bug fixes
Some checks are pending
CodeQL / Analyze (javascript) (push) Waiting to run
CI / general_module_workflow_js (push) Waiting to run

This commit is contained in:
Dennis Eichhorn 2024-10-11 19:17:41 +00:00
parent 1bba6cf8a7
commit a038d97a36
5 changed files with 24 additions and 9 deletions

View File

@ -3,7 +3,7 @@ import { AssetManager } from './Asset/AssetManager.js';
/**
* Autoloader.
*
* The autoloader is responsible for defining namespaces and dynamically loading javascript
* The autoloader is responsible for defining namespaces and dynamically loading js
* files that are not yet included. The intention is to provide a similar functionality as
* include, import etc. Contrary to it's name the autoloader is not able to truly autoload
* referenced classes.
@ -55,7 +55,7 @@ Autoloader.defineNamespace = function (namespace)
};
/**
* Collect all loaded javascript files
* Collect all loaded JS files
*
* @return {void}
*

View File

@ -108,7 +108,10 @@ export class AppNotification
const logs = document.getElementsByClassName('log-msg');
const lastElementAdded = logs[logs.length - 1];
window.navigator.vibrate(msg.vibrate ? 200 : 0);
if (typeof window.navigator.vibrate !== 'undefined') {
window.navigator.vibrate(msg.vibrate ? 200 : 0);
}
if (msg.isSticky) {
return;

View File

@ -1207,7 +1207,11 @@ export class Form
let statusCode = null;
let responseData = null;
if (xhr.getResponseHeader('content-type').includes('application/octet-stream')) {
const contentType = xhr.getResponseHeader('content-type');
if (contentType !== null
&& contentType.includes('application/octet-stream')
) {
responseData = new Blob([xhr.response], { type: 'application/octet-stream' });
const doc = document.createElement('a');
doc.style = 'display: none';
@ -1231,7 +1235,7 @@ export class Form
doc.click();
window.URL.revokeObjectURL(url);
document.body.removeChild(doc);
} else if (xhr.getResponseHeader('content-type').includes('text/html')) {
} else if (contentType.includes('text/html')) {
// window.location = UriFactory.build(uri);
responseData = xhr.response;

View File

@ -108,7 +108,7 @@ export class SmartTextInput
}
});
// @bug This is never getting run?!
// @bug This never runs?!
this.dataList.addEventListener('keydown', function (e) {
jsOMS.preventAll(e);
@ -136,7 +136,11 @@ export class SmartTextInput
this.dataList.addEventListener('click', function (e) {
self.clearDataListSelection(self);
self.addToResultList(self, self.elementContainer === '' ? e.target : e.target.closest('.' + self.elementContainer));
self.addToResultList(
self, self.elementContainer === ''
? e.target
: e.target.closest('.' + self.elementContainer)
);
self.dataList.classList.add('vh');
});
};
@ -280,13 +284,17 @@ export class SmartTextInput
* This can add the selected dropdown elements to a table, badge list etc. depending on the template structure.
*
* @param {SmartTextInput} self This reference
* @param {Element} e Element
* @param {Element} e Element
*
* @return {void}
*
* @since 1.0.0
*/
addToResultList (self, e) {
// @bug There is sometimes a situation when text is in the input field and you then want to switch
// to a different drop down element. When you click on that drop down element, it doesn't fill into the input text
// you then have to click it over and over until it works
// https://github.com/Karaka-Management/jsOMS/issues/142
const data = JSON.parse(e.getAttribute('data-data'));
if (self.inputField.getAttribute('data-autocomplete') === 'true') {

View File

@ -154,7 +154,7 @@ export class Table
/**
* @todo Karaka/jsOMS#90
* Implement export
* Either create download in javascript from this data or make round trip to server who then sends the data.
* Either create download in JS from this data or make round trip to server who then sends the data.
* The export should be possible (if available) in json, csv, excel, word, pdf, ...
* If no endpoint is specified or reachable the client side should create a json or csv export.
*/