diff --git a/.github/workflows/greetings.yml b/.github/workflows/greetings.yml index adb8716..75cb759 100755 --- a/.github/workflows/greetings.yml +++ b/.github/workflows/greetings.yml @@ -9,5 +9,5 @@ jobs: - uses: actions/first-interaction@v1 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - issue-message: 'Thank you for createing this issue. We will check it as soon as possible.' + issue-message: 'Thank you for creating this issue. We will check it as soon as possible.' pr-message: 'Thank you for your pull request. We will check it as soon as possible.' diff --git a/Model/Message/NotifyType.js b/Model/Message/NotifyType.js deleted file mode 100755 index 05321f9..0000000 --- a/Model/Message/NotifyType.js +++ /dev/null @@ -1,15 +0,0 @@ -/** - * Notification type. - * - * @copyright Dennis Eichhorn - * @license OMS License 2.0 - * @version 1.0.0 - * @since 1.0.0 - */ -export const EnumNotifyType = Object.freeze({ - BINARY: 0, - INFO: 1, - WARNING: 2, - ERROR: 3, - FATAL: 4 -}); diff --git a/UI/Component/Form.js b/UI/Component/Form.js index dfd0c4b..41752f0 100755 --- a/UI/Component/Form.js +++ b/UI/Component/Form.js @@ -1180,6 +1180,17 @@ export class Form const redirect = form.getFormElement().getAttribute('data-redirect'); + if (form.getMethod() === 'GET_REDIRECT') { + let url = form.getAction(); + for (const pair of data) { + url += '&' + pair[0] + '=' + pair[1]; + } + + window.location.href = url; + + return; + } + request.setData(data); request.setType(RequestType.FORM_DATA); // @todo consider to allow different request type request.setUri(action !== null ? action : form.getAction()); diff --git a/UI/Component/SmartTextInput.js b/UI/Component/SmartTextInput.js index fab0b61..e998a23 100644 --- a/UI/Component/SmartTextInput.js +++ b/UI/Component/SmartTextInput.js @@ -31,13 +31,10 @@ export class SmartTextInput this.inputComponent = e; this.inputField = this.inputComponent.getElementsByClassName('input-div')[0]; - // @todo Implement. Then find all data-tpl-value and data-tpl-text which are the elements to fill - this.dataContainer = this.inputField.getAttribute('data-container') === '' - ? this.inputComponent - : this.inputField.closest(this.inputField.getAttribute('data-container')); this.dataList = this.inputComponent.getElementsByClassName('input-datalist')[0]; this.dataListBody = this.inputComponent.getElementsByClassName('input-datalist-body')[0]; this.dataTpl = document.getElementsByClassName('input-data-tpl')[0]; + this.elementContainer = this.dataTpl.hasAttribute('data-container') ? this.dataTpl.getAttribute('data-container') : ''; this.src = this.inputComponent.getAttribute('data-src'); const self = this; @@ -69,8 +66,13 @@ export class SmartTextInput if (length > 0 && self.inputField.getAttribute('data-value') !== '') { let isValid = false; + for (let i = 0; i < length; ++i) { - if (list[i].textContent === self.inputField.textContent) { + const textElements = list[i].hasAttribute('data-tpl-text') + ? [list[i]] + : list[i].querySelectorAll('[data-tpl-text]'); + + if (Array.from(textElements).map(e => e.textContent).join(' ').trim() === self.inputField.textContent) { isValid = true; break; @@ -128,13 +130,13 @@ export class SmartTextInput } } else if (e.code === 'Enter' || e.code === 'Tab') { self.clearDataListSelection(self); - self.addToResultList(self, document.activeElement); + self.addToResultList(self, self.elementContainer === '' ? document.activeElement : document.activeElement.closest('.' + self.elementContainer)); } }); this.dataList.addEventListener('click', function (e) { self.clearDataListSelection(self); - self.addToResultList(self, e.target); + self.addToResultList(self, self.elementContainer === '' ? e.target : e.target.closest('.' + self.elementContainer)); self.dataList.classList.add('vh'); }); }; @@ -291,8 +293,11 @@ export class SmartTextInput self.inputField.value = jsOMS.getArray(self.inputField.getAttribute('data-value'), data); } - self.inputField.setAttribute('data-value', e.getAttribute('data-value')); - self.inputField.textContent = e.textContent; + const value = e.hasAttribute('data-value') ? e.getAttribute('data-value') : e.querySelector('[data-value]').getAttribute('data-value'); + const textElements = e.hasAttribute('data-tpl-text') ? [e] : e.querySelectorAll('[data-tpl-text]'); + + self.inputField.setAttribute('data-value', value); + self.inputField.textContent = Array.from(textElements).map(e => e.textContent).join(' ').trim(); self.inputField.focus(); self.dataList.classList.add('vh'); diff --git a/UI/Input/Mouse/MouseManager.js b/UI/Input/Mouse/MouseManager.js index 1227799..34da2a4 100755 --- a/UI/Input/Mouse/MouseManager.js +++ b/UI/Input/Mouse/MouseManager.js @@ -37,12 +37,16 @@ export class MouseManager */ add (element, type, button, callback, exact) { - if (typeof this.elements[element] === 'undefined') { - this.elements[element] = []; - } + const elements = document.querySelectorAll(element); + const length = elements.length; + for (let i = 0; i < length; ++i) { + if (typeof this.elements[elements[i].id] === 'undefined') { + this.elements[elements[i].id] = []; + } - this.bind(element, type); - this.elements[element].push({ callback: callback, type: type, button: button, exact: exact }); + this.bind(elements[i].id, type); + this.elements[elements[i].id].push({ callback: callback, type: type, button: button, exact: exact }); + } }; /**