many fixes and expands and module expansions

This commit is contained in:
Dennis Eichhorn 2021-04-04 17:10:53 +02:00
parent ec8838719b
commit 83798b7545
5 changed files with 22 additions and 10 deletions

View File

@ -22,7 +22,7 @@ export class AdvancedInput
this.id = e.id;
this.inputComponent = e;
this.inputField = this.inputComponent.getElementsByClassName('input')[0];
this.dropdownElement = document.getElementById(this.id + '-dropdown');
this.dropdownElement = document.getElementById(this.id + '-popup');
this.tagElement = document.getElementById(this.id + '-tags');
this.dataList = this.dropdownElement.getElementsByTagName('table')[0];
this.dataListBody = this.dataList.getElementsByTagName('tbody')[0];
@ -41,7 +41,7 @@ export class AdvancedInput
if (e.relatedTarget === null ||
e.relatedTarget.parentElement === null ||
e.relatedTarget.parentElement.parentElement === null ||
!jsOMS.hasClass(e.relatedTarget.parentElement.parentElement.parentElement, 'dropdown')
!jsOMS.hasClass(e.relatedTarget.parentElement.parentElement.parentElement, 'popup')
) {
jsOMS.removeClass(self.dropdownElement, 'active');
}

View File

@ -28,7 +28,7 @@ export class AdvancedSelect
this.id = e.id;
this.selectComponent = e;
this.selectField = this.selectComponent.getElementsByClassName('input')[0];
this.dropdownElement = document.getElementById(this.id + '-dropdown');
this.dropdownElement = document.getElementById(this.id + '-popup');
this.tagElement = document.getElementById(this.id + '-tags');
this.dataList = this.dropdownElement.getElementsByTagName('table')[0];
this.dataListBody = this.dataList.getElementsByTagName('tbody')[0];
@ -47,7 +47,7 @@ export class AdvancedSelect
if (e.relatedTarget === null ||
e.relatedTarget.parentElement === null ||
e.relatedTarget.parentElement.parentElement === null ||
!jsOMS.hasClass(e.relatedTarget.parentElement.parentElement.parentElement, 'dropdown')
!jsOMS.hasClass(e.relatedTarget.parentElement.parentElement.parentElement, 'popup')
) {
jsOMS.removeClass(self.dropdownElement, 'active');
}

View File

@ -263,8 +263,10 @@ export class Table
if (sortType === 1 && content1 > content2) {
shouldSwitch = true;
break;
} else if (sortType === -1 && content1 < content2) {
shouldSwitch = true;
break;
} else {
break;
}
@ -378,7 +380,10 @@ export class Table
for (let i = 0; i < rowLength; ++i) {
const box = rows[i].cells[columnId].querySelector('input[type=checkbox]');
box.checked = status;
if (box !== null) {
box.checked = status;
}
}
});
}

View File

@ -44,6 +44,9 @@ export class HttpUri
*
* @throws {Error}
*
* @todo The default parseer fails for uris which have a query without a value but a fragment e.g. ?debug#something.
* In such a case something#something is returned as fragment instead of just #something or something
*
* @since 1.0.0
*/
static parseUrl (str, mode = 'php')
@ -52,9 +55,9 @@ export class HttpUri
'relative', 'path', 'directory', 'file', 'query', 'fragment'
],
parser = {
php: /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
php: /^(?:([^:\/?#]+):)?(?:\/\/()(?:(?:()(?:([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?()(?:(()(?:(?:[^?#\/]*\/)*)()(?:[^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
strict: /^(?:([^:\/?#]+):)?(?:\/\/((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?))?((((?:[^?#\/]*\/)*)([^?#]*))(?:\?([^#]*))?(?:#(.*))?)/,
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // Added one optional slash to post-scheme to catch file:/// (should restrict this)
loose: /^(?:(?![^:@]+:[^:@\/]*@)([^:\/?#.]+):)?(?:\/\/\/?)?((?:(([^:@]*):?([^:@]*))?@)?([^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/ // Added one optional slash to post-scheme to catch file:/// (should restrict this)
};
if (!parser.hasOwnProperty(mode)) {

View File

@ -126,11 +126,13 @@ export class UriFactory
*/
static unique (url)
{
// @todo: there is a bug for uris which have a parameter without a value and a fragment e.g. ?debug#something.
// The fragment is ignored in such a case.
if (url.includes('?')) {
const parsed = HttpUri.parseUrl(url);
// unique queries
const parts = parsed.query.replace(/\?/g, '&').split('&'),
const parts = typeof parsed.query === 'undefined' ? [] : parsed.query.replace(/\?/g, '&').split('&'),
full = url.split('?')[0],
pars = [];
@ -140,12 +142,14 @@ export class UriFactory
for (let i = 0; i < length; ++i) {
spl = parts[i].split('=');
comps[spl[0]] = spl[1];
comps[spl[0]] = spl.length < 2 ? '' : spl[1];
}
for (const a in comps) {
if (comps.hasOwnProperty(a) && comps[a] !== '' && comps[a] !== null) {
if (comps.hasOwnProperty(a) && comps[a] !== '' && comps[a] !== null && typeof comps[a] !== 'undefined') {
pars.push(a + '=' + (comps[a].includes('%') ? comps[a] : encodeURIComponent(comps[a])));
} else if (comps.hasOwnProperty(a)) {
pars.push(a);
}
}