diff --git a/Site/js/assetsummary.js b/Site/js/assetsummary.js index df98b5d..e64b41a 100644 --- a/Site/js/assetsummary.js +++ b/Site/js/assetsummary.js @@ -50,8 +50,23 @@ if (typeof ($assetsummary) != "function") { p.append(this.basectrl); - this.maskbgctrl = $('
'); - p.append(this.maskbgctrl); + //this.maskbgctrl = $('
'); + //p.append(this.maskbgctrl); + + this.loadingicon = $(''); + p.append(this.loadingicon); + + this.loadingCount = 0; + this.showLoading = function () { + this.loadingCount++; + this.loadingicon.show(); + } + + this.hideLoading = function () { + this.loadingCount--; + if (this.loadingCount === 0) + this.loadingicon.hide(); + } this.refresh = function () { p.parent(".contentPane").unbind(); @@ -530,8 +545,9 @@ if (typeof ($assetsummary) != "function") { } function loadAssetInfo() { - _this.maskbgctrl.show(); + _this.showLoading(); devicerequest('GetAssetSummaryInfo', _this.companyid + String.fromCharCode(170) + _this.assetid, function (data) { + _this.hideLoading(); if (typeof data === 'string') { _dialog.showAlert(GetTextByKey("P_SELECTASSETS_FAILEDGETLIST", 'Failed to get the machine list: ') + data, "Asset Summary"); return; @@ -539,24 +555,23 @@ if (typeof ($assetsummary) != "function") { _this.asset = data; if (_this.status == 0) showAssetInfo(); - _this.maskbgctrl.hide(); }, function () { - _this.maskbgctrl.hide(); + _this.hideLoading(); }); } function loadAssetExtInfo() { - //_this.maskbgctrl.show(); + _this.showLoading(); devicerequest('GetAssetExtInfo', _this.companyid + String.fromCharCode(170) + _this.assetid, function (data) { + _this.hideLoading(); if (typeof data === 'string') { return; } _this.assetext = data; if (_this.status == 0 && _this.asset) showAssetExtInfo(_this.assetext); - //_this.maskbgctrl.hide(); }, function () { - //_this.maskbgctrl.hide(); + _this.hideLoading(); }); } diff --git a/Site/js/lib/app.min.js.map b/Site/js/lib/app.min.js.map index 3999132..9b42e86 100644 --- a/Site/js/lib/app.min.js.map +++ b/Site/js/lib/app.min.js.map @@ -1 +1 @@ -{"version":3,"file":"app.min.js","sources":["../../../../../../FI_G3/_wsp/UILib/ui-lib/lib/app/communications/lib.js","../../../../../../FI_G3/_wsp/UILib/ui-lib/lib/app/communications/contact.js","../../../../../../FI_G3/_wsp/UILib/ui-lib/lib/app/communications/follower.js","../../../../../../FI_G3/_wsp/UILib/ui-lib/lib/app/communications/customer.js","../../../../../../FI_G3/_wsp/UILib/ui-lib/lib/app/communications/internal.js"],"sourcesContent":["import { createElement } from \"../../ui\";\r\n\r\nfunction createBox(title, functions) {\r\n const container = createElement('div', 'comm');\r\n const header = createElement('div', 'title-bar',\r\n title,\r\n createElement('div', 'title-functions', ...functions)\r\n );\r\n container.appendChild(header);\r\n return container;\r\n}\r\n\r\nexport {\r\n createBox\r\n}","import { Dropdown, createElement, createCheckbox, createPopup, showAlert } from \"../../ui\";\r\nimport { isEmail, nullOrEmpty, r } from \"../../utility\";\r\n\r\nclass Contact {\r\n #option;\r\n #refs;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(parent = document.body) {\r\n const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const c = this.#option.contact;\r\n const contactName = createElement('input', input => {\r\n input.type = 'text';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 1;\r\n input.maxLength = 200;\r\n input.autocomplete = 'off';\r\n });\r\n const preferences = new Dropdown({ tabIndex: tabIndex + 2 });\r\n preferences.source = [\r\n { value: '0', text: r('text', 'Text') },\r\n { value: '1', text: r('email', 'Email') },\r\n { value: '2', text: r('phone', 'Phone') }\r\n ];\r\n const contactEmail = createElement('input', input => {\r\n input.type = 'email';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 3;\r\n input.maxLength = 100;\r\n input.autocomplete = 'off';\r\n });\r\n const contactMobile = createElement('input', input => {\r\n input.type = 'tel';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 4;\r\n input.maxLength = 50;\r\n input.autocomplete = 'off';\r\n });\r\n const checkOpt = createCheckbox({ tabIndex: tabIndex + 5 });\r\n const contactNotes = createElement('textarea', txt => {\r\n txt.className = 'ui-text';\r\n txt.tabIndex = tabIndex + 6;\r\n txt.maxLength = 2000;\r\n txt.style.height = '100px';\r\n });\r\n const buttons = [];\r\n if (this.#option.company) {\r\n buttons.push({\r\n text: c == null ? r('addContactRecord', 'Add Contact Record') : r('editContactRecord', 'Edit Contact Record'),\r\n // tabIndex: tabIndex + 7,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.SaveToCustomer = 1;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'customerrecord');\r\n }\r\n }\r\n });\r\n }\r\n buttons.push(\r\n {\r\n text: r('workOrderOnly', 'Work Order Only'),\r\n // tabIndex: tabIndex + 8,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.Id = -1;\r\n item.SaveToCustomer = 0;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'workorder');\r\n }\r\n }\r\n },\r\n {\r\n text: r('cancel', 'Cancel'),\r\n // tabIndex: tabIndex + 9\r\n }\r\n );\r\n const popup = createPopup(\r\n c == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact'),\r\n createElement('div', wrapper => {\r\n wrapper.className = 'setting-wrapper';\r\n wrapper.style.width = '500px';\r\n },\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label setting-required', r('contactNameColon', 'Contact Name:')),\r\n contactName\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactPreferencesColon', 'Contact Preferences:')),\r\n preferences.create()\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactEmailColon', 'Email Address:')),\r\n contactEmail\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactMobileColon', 'Mobile:')),\r\n contactMobile\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactOptColon', 'Opt Out:')),\r\n checkOpt\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactNotesColon', 'Notes:')),\r\n contactNotes\r\n )\r\n ),\r\n ...buttons\r\n )\r\n if (c != null) {\r\n contactName.value = c.Name;\r\n preferences.select(String(c.ContactPreference));\r\n contactEmail.value = c.Email;\r\n contactMobile.value = c.MobilePhone;\r\n checkOpt.querySelector('input').checked = c.OptOut;\r\n contactNotes.value = c.Notes;\r\n } else {\r\n preferences.select('0');\r\n }\r\n this.#refs = {\r\n contactName,\r\n preferences,\r\n contactEmail,\r\n contactMobile,\r\n checkOpt,\r\n contactNotes\r\n };\r\n const result = await popup.show(parent);\r\n setTimeout(() => contactName.focus());\r\n return result;\r\n }\r\n\r\n prepare() {\r\n const name = this.#refs.contactName.value;\r\n const pref = this.#refs.preferences.selected.value;\r\n const email = this.#refs.contactEmail.value;\r\n const phone = this.#refs.contactMobile.value;\r\n const opt = this.#refs.checkOpt.querySelector('input').checked;\r\n const notes = this.#refs.contactNotes.value;\r\n const title = this.#option.contact == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact');\r\n if (nullOrEmpty(name)) {\r\n showAlert(title, r('contactNameRequired', 'Contact Name cannot be empty.'), 'warn')\r\n .then(() => this.#refs.contactName.focus());\r\n return null;\r\n }\r\n if (nullOrEmpty(email) && nullOrEmpty(phone)) {\r\n showAlert(title, r('contactEmailPhoneRequired', 'Email and Mobile Phone cannot both be empty.'), 'warn')\r\n .then(() => nullOrEmpty(email) ?\r\n this.#refs.contactEmail.focus() :\r\n this.#refs.contactMobile.focus());\r\n return null;\r\n }\r\n if (!nullOrEmpty(email) && !isEmail(email)) {\r\n showAlert(title, r('contactEmailInvalid', 'The email address is invalid.'), 'warn')\r\n .then(() => this.#refs.contactEmail.focus());\r\n return null;\r\n }\r\n\r\n let contact = this.#option.contact;\r\n if (contact == null) {\r\n contact = {};\r\n } else if (contact.OptOut !== opt) {\r\n if (opt !== false || contact.OptOut_BC === false) {\r\n contact.selected = !opt;\r\n }\r\n }\r\n contact.Name = name;\r\n contact.ContactPreference = pref;\r\n contact.Email = email;\r\n contact.MobilePhone = phone;\r\n contact.OptOut = opt;\r\n contact.Notes = notes;\r\n return contact;\r\n }\r\n}\r\n\r\nexport default Contact;","import { Grid, createElement, createPopup } from \"../../ui\";\r\nimport { nullOrEmpty, r, contains } from \"../../utility\";\r\n\r\nclass Follower {\r\n #option;\r\n #grid;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(parent = document.body) {\r\n const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const gridContainer = createElement('div', 'follower-grid');\r\n const popup = createPopup(\r\n r('addFollowers', 'Add Followers'),\r\n createElement('div', 'follower-wrapper',\r\n createElement('div', div => div.innerText = r('whoWantReceiveCustomerNotification', 'Who do you want to receive customer notifications?')),\r\n createElement('input', search => {\r\n search.type = 'text';\r\n search.tabIndex = tabIndex + 3;\r\n search.className = 'ui-input follower-search';\r\n search.addEventListener('input', () => {\r\n const key = search.value;\r\n if (nullOrEmpty(key)) {\r\n this.#grid.source = this.#option.followers;\r\n } else {\r\n this.#grid.source = this.#option.followers.filter(f => f.Text || f.Email || contains(f.DisplayName, key, true));\r\n }\r\n });\r\n }),\r\n gridContainer\r\n ),\r\n {\r\n text: r('ok', 'OK'),\r\n key: 'ok',\r\n trigger: () => {\r\n if (typeof this.#option.onOk === 'function') {\r\n return this.#option.onOk.call(this, this.#grid.source.filter(f => f.Email || f.Text));\r\n }\r\n }\r\n },\r\n { text: r('cancel', 'Cancel'), key: 'cancel' }\r\n );\r\n const result = await popup.show(parent);\r\n result.querySelector('.follower-search').focus();\r\n // grid\r\n const grid = new Grid(gridContainer);\r\n grid.columns = [\r\n { key: 'DisplayName', caption: r('contactName', 'Contact Name'), width: 240 },\r\n { key: 'ContactTypeName', caption: r('contactType', 'Contact Type'), width: 120 },\r\n {\r\n key: 'Text',\r\n caption: r('text', 'Text'),\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 60,\r\n enabled: item => !nullOrEmpty(item.Mobile)\r\n },\r\n {\r\n key: 'Email',\r\n caption: r('email', 'Email'),\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 70,\r\n // enabled: item => !nullOrEmpty(item.ID)\r\n }\r\n ];\r\n grid.init();\r\n grid.source = this.#option.followers;\r\n this.#grid = grid;\r\n return result;\r\n }\r\n}\r\n\r\nexport default Follower;","import { Grid, createElement, setTooltip, createIcon, createCheckbox, createRadiobox, createPopup, showAlert, showConfirm } from \"../../ui\";\r\nimport { r, nullOrEmpty, formatUrl, isEmail, isPhone } from \"../../utility\";\r\nimport { createBox } from \"./lib\";\r\nimport Contact from \"./contact\";\r\nimport Follower from \"./follower\";\r\n\r\nclass NoteCol extends Grid.GridColumn {\r\n static create() {\r\n const wrapper = createElement('div', 'contact-wrapper',\r\n createElement('div', 'contact-name'),\r\n createElement('div', 'contact-note')\r\n );\r\n return wrapper;\r\n }\r\n\r\n static setValue(element, _val, item, _col, grid) {\r\n const name = element.querySelector('.contact-name');\r\n name.innerText = item.Name;\r\n if (name.scrollWidth > name.offsetWidth) {\r\n setTooltip(name, item.Name, false, grid.element);\r\n }\r\n element.querySelector('.contact-note').innerText = item.Notes;\r\n }\r\n}\r\n\r\nclass CustomerCommunication {\r\n #container;\r\n #option;\r\n #contacts;\r\n #followers;\r\n #buttonFollower;\r\n #enter;\r\n #message;\r\n #data = {};\r\n #gridContact;\r\n #gridWo;\r\n #gridFollower;\r\n\r\n constructor(opt) {\r\n this.#option = opt ?? {};\r\n }\r\n\r\n get #autoUpdates() { return this.#container.querySelector('.check-auto-update>input') }\r\n get autoUpdatesEnabled() { return this.#autoUpdates?.disabled !== true }\r\n set autoUpdatesEnabled(flag) {\r\n const element = this.#autoUpdates;\r\n if (element == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n element.disabled = true;\r\n element.parentElement?.classList?.add('disabled');\r\n } else {\r\n element.disabled = false;\r\n element.parentElement?.classList?.remove('disabled');\r\n }\r\n }\r\n get autoUpdates() { return this.#autoUpdates?.checked }\r\n set autoUpdates(flag) {\r\n const element = this.#autoUpdates;\r\n if (element == null) {\r\n return;\r\n }\r\n element.checked = flag;\r\n element.dispatchEvent(new Event('change'));\r\n }\r\n\r\n get #statusLink() { return this.#container.querySelector('.check-status-link>input') }\r\n get statusLinkEnabled() { return this.#statusLink?.disabled !== true }\r\n set statusLinkEnabled(flag) {\r\n const element = this.#statusLink;\r\n if (element == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n element.disabled = true;\r\n element.parentElement?.classList?.add('disabled');\r\n } else {\r\n element.disabled = false;\r\n element.parentElement?.classList?.remove('disabled');\r\n }\r\n }\r\n get statusLink() { return this.#statusLink?.checked }\r\n set statusLink(flag) {\r\n const element = this.#statusLink;\r\n if (element == null) {\r\n return;\r\n }\r\n element.checked = flag;\r\n element.dispatchEvent(new Event('change'));\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set loading(flag) {\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#enter.disabled = flag;\r\n this.#container.querySelector('.customer-name>.ui-input').disabled = flag;\r\n this.#container.querySelector('.button-send-message').disabled = flag;\r\n this.#container.querySelector('.button-edit-contacts').disabled = flag;\r\n this.#container.querySelector('.button-edit-followers').disabled = flag;\r\n }\r\n\r\n get text() { return this.#enter?.value }\r\n set text(s) {\r\n const element = this.#enter;\r\n if (element != null) {\r\n element.value = s\r\n s = String(nullOrEmpty(s) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n }\r\n }\r\n\r\n get customerName() { return this.#container.querySelector('.customer-name>.ui-input')?.value }\r\n set customerName(name) {\r\n const element = this.#container.querySelector('.customer-name>.ui-input');\r\n if (element == null) {\r\n return;\r\n }\r\n element.value = name;\r\n }\r\n\r\n get contacts() {\r\n return [...this.#contacts.children].map(el => {\r\n const span = el.querySelector('span');\r\n return { 'Key': span.dataset.to, 'Value': span.dataset.name };\r\n });\r\n }\r\n set contacts(contacts) {\r\n this.#contacts.replaceChildren();\r\n if (contacts?.length > 0) {\r\n for (let c of contacts) {\r\n if (c.OptOut || c.OptOut_BC || c.selected === false) {\r\n continue;\r\n }\r\n const mp = String(c.MobilePhoneDisplayText).trim();\r\n const email = String(c.Email).trim();\r\n const pref = String(c.ContactPreference);\r\n if ((pref !== '1') && !isPhone(mp) ||\r\n pref === '1' && !isEmail(email)) {\r\n continue;\r\n }\r\n const to = pref === '1' ? email : mp;\r\n let icon;\r\n let method;\r\n switch (pref) {\r\n case '0':\r\n icon = 'comment-lines';\r\n method = r('textsToColon', 'Texts to:');\r\n break;\r\n case '2':\r\n icon = 'mobile';\r\n method = r('callsToColon', 'Calls to:');\r\n break;\r\n default:\r\n icon = 'envelope';\r\n method = r('emailsToColon', 'Emails to:');\r\n break;\r\n }\r\n const span = createElement('span', span => {\r\n span.dataset.to = to;\r\n span.dataset.name = c.Name;\r\n span.innerText = c.Name;\r\n });\r\n const item = createElement('div', 'contact-item',\r\n createIcon('fa-light', icon),\r\n span\r\n );\r\n this.#contacts.appendChild(item);\r\n let tip = `${method} ${to}`;\r\n if (span.scrollWidth > span.offsetWidth) {\r\n tip = r('nameColon', 'Name:') + ` ${c.Name}\\n${tip}`;\r\n }\r\n setTooltip(span, tip);\r\n }\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n }\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set readonly(flag) {\r\n this.#option.readonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n const link = this.#container.querySelector('.check-status-link');\r\n if (flag === true) {\r\n link.classList.add('disabled');\r\n } else {\r\n link.classList.remove('disabled');\r\n }\r\n link.querySelector('input').disabled = flag;\r\n const display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-edit-contacts').style.display = display;\r\n this.#container.querySelector('.button-edit-followers').style.display = display;\r\n // this.#enter.disabled = flag === true;\r\n this.#container.querySelector('.message-bar').style.display = display;\r\n // this.#container.querySelector('.button-send-message').style.display = display;\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set recordReadonly(flag) {\r\n this.#option.recordReadonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#container.querySelector('.button-edit-contacts').style.display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-edit-followers').style.display = flag === true ? 'none' : '';\r\n }\r\n\r\n /**\r\n * @param {String} name\r\n */\r\n set companyName(name) {\r\n this.#option.companyName = name;\r\n const div = this.#container.querySelector('.title-company');\r\n if (nullOrEmpty(name)) {\r\n div.style.display = 'none';\r\n } else {\r\n div.innerText = name;\r\n div.style.display = '';\r\n }\r\n }\r\n /**\r\n * @param {String} code\r\n */\r\n set companyCode(code) {\r\n this.#option.companyCode = code;\r\n const div = this.#container.querySelector('.title-company');\r\n if (nullOrEmpty(this.#option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n div.innerText = this.#option.companyName;\r\n if (!nullOrEmpty(code))\r\n div.innerText = this.#option.companyName + \"/\" + code;\r\n div.style.display = '';\r\n }\r\n }\r\n\r\n get followers() {\r\n return [...this.#followers.children].map(el => {\r\n const span = el.querySelector('span');\r\n return { 'Email': span.dataset.email, 'MobilePhone': span.dataset.mp, 'Value': span.dataset.name };\r\n });\r\n }\r\n set followers(followers) {\r\n this.#data.followers = followers;\r\n this.#followers.replaceChildren();\r\n if (followers?.length > 0) {\r\n this.#container.querySelector('.follower-bar').style.display = '';\r\n this.#container.querySelector('.follower-bar>.bar-list').appendChild(this.#buttonFollower);\r\n for (let f of followers) {\r\n if (f.OptOut) {\r\n continue;\r\n }\r\n const mp = String(f.MobilePhone).trim();\r\n const email = String(f.Email).trim();\r\n const tips = [];\r\n if (f.SendEmail) {\r\n tips.push(r('emailsToColon', 'Emails to:') + ` ${email}`);\r\n }\r\n if (f.SendText) {\r\n tips.push(r('textsToColon', 'Texts to:' + ` ${mp}`));\r\n }\r\n let icon;\r\n if (f.SendText && f.SendEmail) {\r\n icon = 'at';\r\n } else {\r\n icon = f.SendText ? 'comment-lines' : 'envelope';\r\n }\r\n const span = createElement('span', span => {\r\n if (f.SendEmail) {\r\n span.dataset.email = email;\r\n }\r\n if (f.SendText) {\r\n span.dataset.mp = mp;\r\n }\r\n span.dataset.name = f.Name;\r\n span.innerText = f.Name;\r\n });\r\n const item = createElement('div', 'contact-item',\r\n createIcon('fa-light', icon),\r\n span\r\n );\r\n this.#followers.appendChild(item);\r\n if (span.scrollWidth > span.offsetWidth) {\r\n tips.splice(0, 0, r('nameColon', 'Name:') + ` ${c.Name}`);\r\n }\r\n setTooltip(span, tips.join('\\n'));\r\n }\r\n } else {\r\n this.#container.querySelector('.follower-bar').style.display = 'none';\r\n this.#container.querySelector('.button-edit-contacts').insertAdjacentElement('beforebegin', this.#buttonFollower)\r\n }\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n }\r\n\r\n setData(key, data) {\r\n this.#data[key] = data;\r\n }\r\n\r\n create() {\r\n const option = this.#option;\r\n const readonly = option.readonly;\r\n // functions\r\n const checkAutoUpdate = createCheckbox({\r\n className: 'check-auto-update',\r\n checked: option.autoUpdates,\r\n checkedNode: createIcon('fa-regular', 'redo-alt'),\r\n uncheckedNode: createIcon('fa-regular', 'ban'),\r\n onchange: function () {\r\n setTooltip(checkAutoUpdate, this.checked ?\r\n r('autoUpdateEnabled', 'Auto Updates Enabled') :\r\n r('autoUpdateDisabled', 'Auto Updates Disabled'));\r\n }\r\n });\r\n if (option.autoUpdatesVisible === false) {\r\n checkAutoUpdate.style.display = 'none';\r\n }\r\n const checkLink = createCheckbox({\r\n className: 'check-status-link',\r\n enabled: !readonly,\r\n checked: option.statusLink,\r\n checkedNode: createIcon('fa-regular', 'link'),\r\n uncheckedNode: createIcon('fa-regular', 'unlink'),\r\n onchange: function () {\r\n setTooltip(checkLink, this.checked ?\r\n r('statusLinkIncluded', 'Status Link Included') :\r\n r('statusLinkExcluded', 'Status Link Excluded'));\r\n }\r\n });\r\n if (option.statusLinkVisible === false) {\r\n checkLink.style.display = 'none';\r\n }\r\n const container = createBox(\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.className = 'title-module';\r\n div.innerText = option.title ?? r('messages', 'Customer Communication');\r\n }),\r\n createElement('div', div => {\r\n div.className = 'title-company';\r\n if (nullOrEmpty(option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n if (nullOrEmpty(option.companyCode)) {\r\n div.innerText = option.companyName;\r\n } else {\r\n div.innerText = option.companyName + \"/\" + option.companyCode;\r\n }\r\n }\r\n })\r\n ),\r\n [\r\n setTooltip(checkAutoUpdate, r('autoUpdateEnabled', 'Auto Updates Enabled')),\r\n setTooltip(checkLink, r('statusLinkExcluded', 'Status Link Excluded'))\r\n ]\r\n );\r\n // contacts\r\n this.#contacts = this.#createContacts(container, option);\r\n // followers\r\n this.#followers = this.#createFollowers(container, option);\r\n // enter box\r\n const enter = createElement('textarea', 'ui-text');\r\n enter.placeholder = r('typeMessage', 'Enter Message Here');\r\n option.maxLength ??= 3000;\r\n enter.maxLength = option.maxLength;\r\n // if (readonly === true) {\r\n // enter.disabled = true;\r\n // }\r\n enter.addEventListener('input', () => {\r\n const val = this.#enter.value;\r\n const s = String(nullOrEmpty(val) ? 0 : val.length) + '/' + String(option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n });\r\n this.#enter = enter;\r\n container.appendChild(\r\n createElement('div', div => {\r\n div.className = 'message-bar';\r\n if (readonly === true) {\r\n div.style.display = 'none';\r\n }\r\n },\r\n enter,\r\n createElement('div', div => div.style.textAlign = 'right',\r\n createElement('div', div => {\r\n div.className = 'customer-name';\r\n if (option.customerNameVisible !== true) {\r\n div.style.display = 'none';\r\n }\r\n },\r\n createElement('span', span => span.innerText = r('nameColon', 'Name:')),\r\n createElement('input', input => {\r\n input.type = 'text';\r\n input.className = 'ui-input';\r\n })\r\n ),\r\n createElement('div', 'prompt-count'),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-send-message';\r\n button.style.backgroundColor = 'rgb(19, 150, 204)';\r\n // if (readonly === true) {\r\n // button.style.display = 'none';\r\n // }\r\n button.appendChild(createIcon('fa-solid', 'paper-plane'));\r\n setTooltip(button, r('sendMessage', 'Send Message'));\r\n button.addEventListener('click', () => {\r\n const val = this.#enter.value;\r\n if (nullOrEmpty(val?.trim())) {\r\n showAlert(r('error', 'Error'), r('messageRequired', 'Please input the message.'), 'warn');\r\n return;\r\n }\r\n if (typeof this.#option.onAddMessage === 'function') {\r\n this.#option.onAddMessage(this.#enter.value);\r\n }\r\n })\r\n })\r\n )\r\n )\r\n );\r\n\r\n const message = createElement('div', 'list-bar');\r\n this.#message = message;\r\n container.appendChild(message);\r\n return this.#container = container;\r\n }\r\n\r\n #createContacts(container, option) {\r\n const readonly = option.readonly;\r\n const recordReadonly = option.recordReadonly;\r\n const contacts = createElement('div');\r\n container.append(\r\n createElement('div', 'contact-bar',\r\n createElement('div', 'bar-icon',\r\n createIcon('fa-solid', 'user-circle', {\r\n 'fill': 'lightgray'\r\n })\r\n ),\r\n createElement('div', 'bar-list',\r\n contacts,\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-edit-contacts';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n if (readonly === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'user-edit'));\r\n setTooltip(button, r('editContacts', 'Edit Contacts'));\r\n button.addEventListener('click', () => {\r\n const pop = createPopup(\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.alignItems = 'center';\r\n div.append(\r\n createElement('div', div => {\r\n div.className = 'ui-popup-move';\r\n div.style.flex = '1 1 auto';\r\n },\r\n createElement('div', div => div.innerText = r('editContacts', 'Edit Contacts')),\r\n createElement('div', div => {\r\n div.className = 'title-company';\r\n if (nullOrEmpty(option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n if (nullOrEmpty(option.companyCode)) {\r\n div.innerText = option.companyName;\r\n } else {\r\n div.innerText = option.companyName + \"/\" + option.companyCode;\r\n }\r\n }\r\n })\r\n ),\r\n createElement('button', button => {\r\n button.style.flex = '0 0 auto';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n button.style.marginRight = '10px';\r\n button.className = 'roundbtn button-add-contact';\r\n if (recordReadonly) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'user-plus', {\r\n width: '16px',\r\n height: '16px'\r\n }));\r\n button.addEventListener('click', () => {\r\n const add = new Contact({\r\n company: !nullOrEmpty(this.#data.companyCode),\r\n onSave: item => {\r\n const exists = this.#gridContact.source.some(s => s.Name === item.Name && s.MobilePhone === item.MobilePhone);\r\n if (exists) {\r\n showAlert(r('addContact', 'Add Contact'), r('contactUniqueRequired', 'Contact name and contact mobile must be a unique combination.'), 'warn');\r\n return false;\r\n }\r\n if (typeof option.onSave === 'function') {\r\n const result = option.onSave(item, true);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n this.#gridContact.source = r.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n this.#gridWo.source = r.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n add.show(container);\r\n });\r\n setTooltip(button, r('addContact', 'Add Contact'))\r\n })\r\n )\r\n }),\r\n createElement('div', null,\r\n createElement('div', div => {\r\n if (nullOrEmpty(this.#data.companyCode)) {\r\n div.style.display = 'none';\r\n }\r\n div.style.fontWeight = 'bold';\r\n div.innerText = r('contactFromRecord', 'Contacts from Customer Record');\r\n }),\r\n createElement('div', div => {\r\n if (nullOrEmpty(this.#data.companyCode)) {\r\n div.style.display = 'none';\r\n }\r\n div.className = 'contacts-record';\r\n div.style.maxHeight = '400px';\r\n div.style.width = '660px';\r\n }),\r\n createElement('div', div => {\r\n div.style.fontWeight = 'bold';\r\n div.innerText = r('contactFromWorkOrder', 'Contacts not on Customer Record');\r\n }),\r\n createElement('div', div => {\r\n div.className = 'contacts-wo';\r\n div.style.maxHeight = '200px';\r\n div.style.width = '660px';\r\n })\r\n )\r\n );\r\n pop.show(container).then(() => {\r\n const selectedCol = This => {\r\n return {\r\n key: 'selected',\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 50,\r\n enabled: item => !item.OptOut && !item.OptOut_BC,\r\n onchanged: function () {\r\n if (typeof option.onChanged === 'function') {\r\n option.onChanged([...This.#gridContact.source, ...This.#gridWo.source]);\r\n }\r\n }\r\n }\r\n };\r\n const iconCol = {\r\n key: 'type',\r\n type: Grid.ColumnTypes.Icon,\r\n width: 50,\r\n filter: c => {\r\n switch (String(c.ContactPreference)) {\r\n case '0': return 'comment-lines';\r\n case '2': return 'mobile';\r\n default: return 'envelope';\r\n }\r\n },\r\n className: 'icon-contact-type',\r\n iconType: 'fa-light'\r\n };\r\n const nameCol = { key: 'Name', type: NoteCol, width: 160 };\r\n const buttonCol = {\r\n type: Grid.ColumnTypes.Icon,\r\n width: 40,\r\n visible: !recordReadonly,\r\n align: 'center',\r\n iconType: 'fa-light'\r\n };\r\n const createEditCol = (This) => {\r\n return {\r\n key: 'edit',\r\n ...buttonCol,\r\n text: 'edit',\r\n tooltip: r('edit', 'Edit'),\r\n events: {\r\n onclick: function () {\r\n const edit = new Contact({\r\n contact: this,\r\n company: !nullOrEmpty(This.#data.companyCode),\r\n onSave: (item, _op) => {\r\n const exists =\r\n This.#gridContact.source.some(s => s !== this && s.Name === item.Name && s.MobilePhone === item.MobilePhone) ||\r\n This.#gridWo.source.some(s => s !== this && s.Name === item.Name && s.MobilePhone === item.MobilePhone);\r\n if (exists) {\r\n showAlert(r('editContact', 'Edit Contact'), r('contactUniqueRequired', 'Contact name and contact mobile must be a unique combination.'), 'warn');\r\n return false;\r\n }\r\n if (typeof option.onSave === 'function') {\r\n const result = option.onSave(item);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n This.#gridContact.source = r.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n This.#gridWo.source = r.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n edit.show(container);\r\n }\r\n }\r\n }\r\n };\r\n // contacts from customer record\r\n const grid = new Grid();\r\n grid.height = 0;\r\n grid.allowHtml = true;\r\n grid.headerVisible = false;\r\n grid.columns = [\r\n selectedCol(this),\r\n iconCol,\r\n nameCol,\r\n { key: 'Email', width: 180 },\r\n { key: 'MobilePhoneDisplayText', width: 130 },\r\n createEditCol(this),\r\n {\r\n key: 'delete',\r\n ...buttonCol,\r\n text: 'times',\r\n tooltip: r('delete', 'Delete'),\r\n events: {\r\n onclick: function () {\r\n showConfirm(\r\n r('remoteContact', 'Remove Contact'),\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.style.paddingLeft = '16px';\r\n div.innerText = r('removeFrom', 'Remove {name} from').replace('{name}', this.Name);\r\n }),\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.justifyContent = 'center';\r\n div.style.marginTop = '10px';\r\n },\r\n createRadiobox({\r\n name: 'remove-type',\r\n label: r('customerRecord', 'Customer Record'),\r\n checked: true,\r\n className: 'radio-customer-record'\r\n }),\r\n createRadiobox({\r\n name: 'remove-type',\r\n label: r('workOrder', 'Work Order')\r\n })\r\n )\r\n ),\r\n [\r\n { key: 'ok', text: r('ok', 'OK') },\r\n { key: 'cancel', text: r('cancel', 'Cancel') }\r\n ]\r\n ).then(result => {\r\n if (result?.key === 'ok') {\r\n const isRecord = result.popup.container.querySelector('.radio-customer-record>input').checked;\r\n if (typeof option.onDelete === 'function') {\r\n option.onDelete(result.key, this, isRecord);\r\n }\r\n const index = grid.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = grid.source;\r\n source.splice(index, 1);\r\n grid.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = source;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n ];\r\n grid.init(pop.container.querySelector('.contacts-record'));\r\n const customerRecords = this.#data.contacts.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n grid.extraRows = customerRecords.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = customerRecords;\r\n grid.selectedRowChanged = index => {\r\n if (index >= 0 && this.#gridWo.selectedIndexes?.length > 0) {\r\n this.#gridWo.selectedIndexes = [];\r\n }\r\n };\r\n this.#gridContact = grid;\r\n\r\n // contacts from work order only\r\n const gridWo = new Grid();\r\n gridWo.height = 0;\r\n gridWo.allowHtml = true;\r\n gridWo.headerVisible = false;\r\n gridWo.columns = [\r\n selectedCol(this),\r\n iconCol,\r\n nameCol,\r\n { key: 'Email', width: 180 },\r\n { key: 'MobilePhoneDisplayText', width: 130 },\r\n createEditCol(this),\r\n {\r\n key: 'delete',\r\n ...buttonCol,\r\n text: 'times',\r\n tooltip: r('delete', 'Delete'),\r\n events: {\r\n onclick: function () {\r\n showConfirm(r('remoteContact', 'Remove Contact'), r('removeFromWorkorder', 'You are removing {name} from work order.\\n\\nDo you want to Continue?').replace('{name}', this.Name), [\r\n { key: 'continue', text: r('continue', 'Continue') },\r\n { key: 'cancel', text: r('cancel', 'Cancel') }\r\n ]).then(result => {\r\n if (result?.key === 'continue') {\r\n if (typeof option.onDelete === 'function') {\r\n option.onDelete(result.key, this);\r\n }\r\n const index = gridWo.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = gridWo.source;\r\n source.splice(index, 1);\r\n gridWo.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n gridWo.source = source;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n ];\r\n gridWo.init(pop.container.querySelector('.contacts-wo'));\r\n const workOrderOnly = this.#data.contacts.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n gridWo.extraRows = workOrderOnly.filter(c => !nullOrEmpty(c.Notes)).length;\r\n gridWo.source = workOrderOnly;\r\n gridWo.selectedRowChanged = index => {\r\n if (index >= 0 && this.#gridContact.selectedIndexes?.length > 0) {\r\n this.#gridContact.selectedIndexes = [];\r\n }\r\n };\r\n this.#gridWo = gridWo;\r\n });\r\n });\r\n })\r\n )\r\n )\r\n );\r\n return contacts;\r\n }\r\n\r\n #createFollowers(container, option) {\r\n const readonly = option.readonly;\r\n const recordReadonly = option.recordReadonly;\r\n const followers = createElement('div');\r\n const buttonEditFollower = createElement('button', button => {\r\n button.className = 'roundbtn button-edit-followers';\r\n button.style.backgroundColor = 'rgb(48, 107, 255)';\r\n if (readonly === true || recordReadonly) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'pen'));\r\n setTooltip(button, r('editFollower', 'Edit Followers'));\r\n button.addEventListener('click', () => {\r\n const pop = createPopup(\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.alignItems = 'center';\r\n div.append(\r\n createElement('div', div => {\r\n div.className = 'ui-popup-move';\r\n div.style.flex = '1 1 auto';\r\n div.innerText = r('editContacts', 'Edit Contacts') + '\\n' + r('followers', 'Followers');\r\n }),\r\n createElement('button', button => {\r\n button.style.flex = '0 0 auto';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n button.style.marginRight = '10px';\r\n button.className = 'roundbtn button-add-follower';\r\n button.appendChild(createIcon('fa-solid', 'user-plus', {\r\n width: '16px',\r\n height: '16px'\r\n }));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onInitFollower === 'function') {\r\n this.#option.onInitFollower().then(data => {\r\n if (typeof data === 'string') {\r\n showAlert(r('customerRecord', 'Customer Record'), data, 'warn');\r\n return;\r\n }\r\n const add = new Follower({\r\n followers: data,\r\n onOk: list => {\r\n if (typeof this.#option.onAddFollower === 'function') {\r\n const result = this.#option.onAddFollower(list);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n this.#gridFollower.source = r;\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n add.show(container);\r\n });\r\n }\r\n });\r\n setTooltip(button, r('addFollower', 'Add Follower'))\r\n })\r\n )\r\n }),\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.style.fontWeight = 'bold';\r\n div.innerText = r('contactFromRecord', 'Contacts from Customer Record');\r\n }),\r\n createElement('div', div => {\r\n div.className = 'followers-record';\r\n div.style.maxHeight = '400px';\r\n div.style.width = '660px';\r\n })\r\n )\r\n );\r\n pop.show(container).then(() => {\r\n const buttonCol = {\r\n type: Grid.ColumnTypes.Icon,\r\n width: 40,\r\n align: 'center',\r\n iconType: 'fa-light'\r\n };\r\n const grid = new Grid();\r\n grid.height = 0;\r\n grid.allowHtml = true;\r\n grid.headerVisible = false;\r\n grid.columns = [\r\n {\r\n key: 'type',\r\n type: Grid.ColumnTypes.Icon,\r\n width: 50,\r\n filter: c => c.SendText && c.SendEmail ? 'at' : (c.SendText ? 'comment-lines' : 'envelope'),\r\n className: 'icon-contact-type',\r\n iconType: 'fa-light'\r\n },\r\n { key: 'Name', width: 160 },\r\n { key: 'Email', width: 180 },\r\n { key: 'MobilePhoneDisplayText', width: 130 },\r\n {\r\n key: 'edit',\r\n ...buttonCol,\r\n text: 'edit',\r\n tooltip: r('edit', 'Edit'),\r\n events: {\r\n onclick: function () {\r\n if (typeof option.onInitFollower === 'function') {\r\n option.onInitFollower().then(data => {\r\n if (typeof data === 'string') {\r\n showAlert(r('customerRecord', 'Customer Record'), data, 'warn');\r\n return;\r\n }\r\n const contact = data.find(d => d.IID === this.UserIID);\r\n showConfirm(\r\n r('editContactMethod', 'Edit Contact Method'),\r\n createElement('div', 'wrapper-edit-method',\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.justifyContent = 'center';\r\n div.style.marginTop = '20px';\r\n },\r\n createCheckbox({\r\n label: r('text', 'Text'),\r\n checked: this.SendText && !nullOrEmpty(contact?.Mobile),\r\n enabled: !nullOrEmpty(contact?.Mobile),\r\n className: 'check-method-text'\r\n }),\r\n createCheckbox({\r\n label: r('email', 'Email'),\r\n checked: this.SendEmail,\r\n className: 'check-method-email'\r\n })\r\n )\r\n ),\r\n [\r\n {\r\n key: 'ok',\r\n text: r('ok', 'OK'),\r\n trigger: (popup, button) => {\r\n const text = popup.container.querySelector('.check-method-text>input').checked;\r\n const email = popup.container.querySelector('.check-method-email>input').checked;\r\n\r\n if (!text && !email) {\r\n return showConfirm(r('editContactMethod', 'Edit Contact Method'), r('promptRemoveFollower', 'Contact method is required. If you continue, user will be removed as a follower.'), [\r\n { key: 'update', text: r('updateContactMethod', 'Update Contact Method') },\r\n { key: 'remove', text: r('removeFollower', 'Remove Follower') }\r\n ], 'question').then(result => {\r\n if (result?.key === 'remove') {\r\n return {\r\n key: result.key,\r\n popup\r\n };\r\n }\r\n return false;\r\n });\r\n }\r\n return {\r\n key: button.key,\r\n popup\r\n };\r\n }\r\n },\r\n { key: 'cancel', text: r('cancel', 'Cancel') }\r\n ],\r\n null\r\n ).then(result => {\r\n const key = result?.key;\r\n if (key === 'remove') {\r\n if (typeof option.onDeleteFollower === 'function') {\r\n option.onDeleteFollower(result.key, this);\r\n }\r\n const index = grid.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = grid.source;\r\n source.splice(index, 1);\r\n grid.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = source;\r\n }\r\n } else if (key === 'ok') {\r\n const text = result.popup.container.querySelector('.check-method-text>input').checked;\r\n const email = result.popup.container.querySelector('.check-method-email>input').checked;\r\n if (typeof option.onChangeFollower === 'function') {\r\n option.onChangeFollower(result.key, this, text, email);\r\n }\r\n this.SendText = text;\r\n this.SendEmail = email;\r\n grid.refresh();\r\n }\r\n });\r\n });\r\n }\r\n }\r\n }\r\n },\r\n {\r\n key: 'delete',\r\n ...buttonCol,\r\n text: 'times',\r\n tooltip: r('delete', 'Delete'),\r\n events: {\r\n onclick: function () {\r\n showConfirm(\r\n r('deleteFollower', 'Delete Follower'),\r\n r('promptDeleteFollower', 'Do you want to delete this follower?')\r\n ).then(result => {\r\n if (result?.key === 'yes') {\r\n if (typeof option.onDeleteFollower === 'function') {\r\n option.onDeleteFollower(result.key, this);\r\n }\r\n const index = grid.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = grid.source;\r\n source.splice(index, 1);\r\n grid.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = source;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n ];\r\n grid.init(pop.container.querySelector('.followers-record'));\r\n grid.source = this.#data.followers;\r\n this.#gridFollower = grid;\r\n });\r\n });\r\n });\r\n this.#buttonFollower = buttonEditFollower;\r\n container.append(\r\n createElement('div', div => {\r\n div.className = 'contact-bar follower-bar';\r\n div.style.display = 'none';\r\n },\r\n setTooltip(createElement('div', 'bar-icon',\r\n createIcon('fa-solid', 'user-tag', {\r\n 'fill': '#fff',\r\n 'background-color': 'lightgray',\r\n 'box-sizing': 'border-box',\r\n 'border-radius': '15px',\r\n 'padding': '4px'\r\n })\r\n ), r('copied', 'Copied')),\r\n createElement('div', 'bar-list',\r\n followers,\r\n buttonEditFollower\r\n )\r\n )\r\n );\r\n return followers;\r\n }\r\n\r\n load(data, contacts, followers) {\r\n const children = [];\r\n if (data?.length > 0) {\r\n contacts ??= this.#data.contacts;\r\n followers ??= this.#data.allfollowers;\r\n for (let comm of data) {\r\n const div = createElement('div', 'item-div');\r\n let name;\r\n if (comm.IsReply && contacts?.length > 0) {\r\n const c = isEmail(comm.Sender) ?\r\n contacts.find(c => c.Email === comm.Sender) :\r\n contacts.find(c => c.MobilePhone === comm.Sender);\r\n name = c?.Name;\r\n }\r\n name ??= comm.IsReply && String(comm.FormatSender) !== '' ? comm.FormatSender : comm.Sender;\r\n let sendto = '';\r\n if (!comm.IsReply && comm.OriPhoneNumbers?.length > 0) {\r\n for (let oriph of comm.OriPhoneNumbers) {\r\n let cname;\r\n const email = isEmail(oriph);\r\n if (contacts?.length > 0) {\r\n let c = email ?\r\n contacts.find(c => c.Email === oriph) :\r\n contacts.find(c => c.MobilePhone === oriph);\r\n if (c != null) {\r\n cname = `${email ? c.Email : c.MobilePhoneDisplayText} - ${c.Name}`;\r\n } else if (followers?.length > 0) {\r\n c = email ?\r\n followers.find(f => f.Email === oriph) :\r\n followers.find(f => f.MobilePhone === oriph);\r\n if (c != null) {\r\n cname = `${email ? c.Email : c.MobilePhoneDisplayText} - ${c.Name}`;\r\n }\r\n }\r\n }\r\n sendto += (cname ?? oriph) + '\\n';\r\n }\r\n }\r\n if (sendto !== '') {\r\n sendto = r('sendToColon', 'Send To :') + `\\n${sendto}`;\r\n }\r\n div.appendChild(createElement('div', div => {\r\n div.className = 'item-poster';\r\n div.innerText = name;\r\n if (!comm.IsReply && sendto?.length > 0) {\r\n setTooltip(div, sendto);\r\n }\r\n }));\r\n const content = createElement('div', 'item-content');\r\n content.appendChild(createElement('span', span => {\r\n if (/https?:\\/\\//i.test(comm.Message)) {\r\n span.innerHTML = formatUrl(comm.Message);\r\n } else {\r\n span.innerText = comm.Message;\r\n }\r\n }));\r\n if (comm.IsReply) {\r\n div.classList.add('item-other');\r\n } else {\r\n div.classList.add('item-self');\r\n const [status, statusmsg] = this.#getMessageStatus(comm);\r\n if (status !== -100) {\r\n let statustext;\r\n switch (status) {\r\n case 0:\r\n statustext = r('pending', 'Pending');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 1:\r\n statustext = r('sent', 'Sent');\r\n break;\r\n case 9:\r\n statustext = r('failed', 'Failed');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 10:\r\n statustext = r('optOut', 'Opt-Out');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 412:\r\n statustext = r('landline', 'Landline');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n default:\r\n statustext = r('undelivered', 'Undelivered');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n }\r\n const divstatus = createElement('div', div => {\r\n div.className = 'item-status';\r\n div.innerText = statustext;\r\n if (status == -10) {\r\n setTooltip(div, statusmsg);\r\n }\r\n });\r\n content.appendChild(divstatus);\r\n }\r\n }\r\n div.append(\r\n content,\r\n createElement('div', div => {\r\n div.className = 'item-time';\r\n div.innerText = comm.TimeStr;\r\n })\r\n );\r\n children.push(div);\r\n }\r\n children[0].style.marginTop = '0';\r\n }\r\n this.#message.replaceChildren(...children);\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n // setTimeout(() => this.#message.scrollTop = this.#message.scrollHeight, 0);\r\n }\r\n\r\n #getMessageStatus(comm) {\r\n let status = -100; // 没有状态,页面上不显示\r\n const ls = [];\r\n let statusmsg = '';\r\n if (!comm.StatusIncorrect && comm.Participator?.length > 0) {\r\n for (let p of comm.Participator) {\r\n if (!isEmail(p.CustomerNumber)) {\r\n if (ls.indexOf(p.Status) < 0) {\r\n ls.push(p.Status);\r\n }\r\n if (statusmsg.length > 0) {\r\n statusmsg += '\\n';\r\n }\r\n statusmsg += `${p.CustomerNumber}: `;\r\n const st = ({\r\n 0: r('undelivered', 'Undelivered'),\r\n 1: r('sent', 'Sent'),\r\n 9: r('failed', 'Failed')\r\n })[p.Status];\r\n if (st != null) {\r\n statusmsg += st;\r\n }\r\n }\r\n }\r\n }\r\n if (ls.length === 1) {\r\n status = ls[0];\r\n } else if (ls.length > 1) {\r\n status = -10; // 多种状态\r\n }\r\n return [status, statusmsg];\r\n }\r\n}\r\n\r\nexport default CustomerCommunication;","import { createElement, setTooltip, createIcon } from \"../../ui\";\r\nimport { r, nullOrEmpty, escapeHtml } from \"../../utility\";\r\nimport { createBox } from \"./lib\";\r\n\r\nclass InternalComment {\r\n #container;\r\n #option;\r\n #enter;\r\n #message;\r\n\r\n constructor(opt) {\r\n this.#option = opt ?? {};\r\n }\r\n\r\n get text() { return this.#enter?.value }\r\n set text(s) {\r\n const element = this.#enter;\r\n if (element != null) {\r\n element.value = s\r\n s = String(nullOrEmpty(s) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n }\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set readonly(flag) {\r\n this.#option.readonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#enter.disabled = flag === true;\r\n this.#container.querySelector('.button-send-message').style.display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-post-note').style.display = flag === true ? 'none' : '';\r\n }\r\n\r\n create() {\r\n const container = createBox(\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.className = 'title-module';\r\n div.innerText = r('internalComments', 'Internal Comments');\r\n })\r\n ), []\r\n );\r\n const readonly = this.#option.readonly;\r\n // enter box\r\n const enter = createElement('textarea', 'ui-text');\r\n enter.placeholder = r('typeComment', 'Enter Comment Here');\r\n enter.maxLength = this.#option.maxLength ??= 3000;\r\n enter.addEventListener('input', () => {\r\n const val = this.#enter.value;\r\n const s = String(nullOrEmpty(val) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n });\r\n if (readonly === true) {\r\n enter.disabled = true;\r\n }\r\n this.#enter = enter;\r\n container.appendChild(\r\n createElement('div', 'message-bar',\r\n enter,\r\n createElement('div', div => div.style.textAlign = 'right',\r\n createElement('div', 'prompt-count'),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-send-message';\r\n button.style.backgroundColor = 'rgb(19, 150, 204)';\r\n if (readonly === true || this.#option.noMessage === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'paper-plane'));\r\n setTooltip(button, r('sendMessage', 'Send Message'));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onAddMessage === 'function') {\r\n this.#option.onAddMessage(this.#enter.value);\r\n }\r\n })\r\n }),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-post-note';\r\n button.style.border = '1px solid rgb(19, 150, 204)';\r\n button.style.fill = 'rgb(19, 150, 204)';\r\n if (readonly === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'comment-alt-lines'));\r\n setTooltip(button, r('postNote', 'Post Note'));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onAddComment === 'function') {\r\n this.#option.onAddComment(this.#enter.value);\r\n }\r\n })\r\n })\r\n )\r\n )\r\n );\r\n\r\n const message = createElement('div', 'list-bar');\r\n this.#message = message;\r\n container.appendChild(message);\r\n return this.#container = container;\r\n }\r\n\r\n load(data) {\r\n const children = [];\r\n if (data?.length > 0) {\r\n for (let comment of data) {\r\n const div = createElement('div', 'item-div');\r\n // if (sendto !== '') {\r\n // sendto = r('sendToColon', 'Send To :') + `\\n${sendto}`;\r\n // }\r\n div.appendChild(createElement('div', div => {\r\n div.className = 'item-poster';\r\n div.innerText = comment.UserName;\r\n }));\r\n const content = createElement('div', 'item-content');\r\n content.appendChild(createElement('span', span => span.innerHTML = escapeHtml(comment.Comment)));\r\n if (comment.FollowUp?.length > 0) {\r\n div.classList.add('item-sent');\r\n const sendto = r('sendToColon', 'Send To :') + '\\r\\n' + comment.FollowUp.split(';').join('\\r\\n');\r\n content.appendChild(createElement('div', div => {\r\n div.className = 'item-status';\r\n div.innerText = r('sent', 'Sent');\r\n setTooltip(div, sendto);\r\n }));\r\n }\r\n div.append(\r\n content,\r\n createElement('div', div => {\r\n div.className = 'item-time';\r\n div.innerText = comment.SubmitDateStr;\r\n })\r\n );\r\n children.push(div);\r\n }\r\n children[0].style.marginTop = '0';\r\n }\r\n this.#message.replaceChildren(...children);\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n // setTimeout(() => this.#message.scrollTop = this.#message.scrollHeight, 0);\r\n }\r\n}\r\n\r\nexport default InternalComment;"],"names":["createElement","createBox","title","functions","container","header","Dropdown","isEmail","Contact","option","__privateAdd","_option","_refs","__privateSet","parent","tabIndex","e","c","__privateGet","contactName","input","preferences","r","contactEmail","contactMobile","checkOpt","createCheckbox","contactNotes","txt","buttons","item","popup","createPopup","wrapper","result","name","pref","email","phone","opt","notes","nullOrEmpty","showAlert","contact","Grid","Follower","_grid","gridContainer","div","search","key","f","contains","grid","NoteCol","element","_val","_col","setTooltip","CustomerCommunication","_autoUpdates","_statusLink","_createContacts","_createFollowers","_getMessageStatus","_container","_contacts","_followers","_buttonFollower","_enter","_message","_data","_gridContact","_gridWo","_gridFollower","_a","autoUpdates_get","flag","_b","_d","_c","statusLink_get","s","el","span","contacts","mp","isPhone","to","icon","method","createIcon","tip","link","display","code","followers","tips","data","readonly","checkAutoUpdate","checkLink","__privateMethod","createContacts_fn","createFollowers_fn","enter","val","button","message","children","comm","sendto","oriph","cname","content","formatUrl","status","statusmsg","getMessageStatus_fn","statustext","divstatus","recordReadonly","pop","selectedCol","This","iconCol","nameCol","buttonCol","createEditCol","_op","showConfirm","createRadiobox","isRecord","index","source","customerRecords","gridWo","workOrderOnly","buttonEditFollower","list","d","text","ls","p","st","InternalComment","comment","escapeHtml"],"mappings":"qsBAAAA,EAAA,OAAA,QAAA,EAAA,cAEA,SAASC,GAAUC,GAAOC,EAAW,CACjC,MAAMC,EAAYJ,EAAc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AAG,CAC9B3B,EAAI,UAAU,IAAI,WAAW,EAC7B,MAAM+D,EAASzF,GAAE,cAAe,WAAW,EAAI;AAAA,EAAS4H,EAAQ,SAAS,MAAM,GAAG,EAAE,KAAK;AAAA,CAAM,EAC/FhC,EAAQ,YAAYlH,EAAc,MAAOgD,GAAO,CAC5CA,EAAI,UAAY,cAChBA,EAAI,UAAY1B,GAAE,OAAQ,MAAM,EAChCoC,GAAWV,EAAK+D,CAAM,CACzB,CAAA,CAAC,EAEN/D,EAAI,OACAkE,EACAlH,EAAc,MAAOgD,GAAO,CACxBA,EAAI,UAAY,YAChBA,EAAI,UAAYkG,EAAQ,aAChD,CAAqB,CACrB,EACgBrC,EAAS,KAAK7D,CAAG,EAErB6D,EAAS,CAAC,EAAE,MAAM,UAAY,IAElC3F,EAAA,KAAKoD,IAAS,gBAAgB,GAAGuC,CAAQ,EACzC3F,EAAA,KAAKoD,IAAS,UAAYpD,EAAA,KAAKoD,IAAS,YAE3C,CACL,CAzIIL,EAAA,YACAtD,EAAA,YACA0D,EAAA,YACAC,GAAA"} \ No newline at end of file +{"version":3,"file":"app.min.js","sources":["../../../../../../UILib/ui-lib/lib/app/communications/lib.js","../../../../../../UILib/ui-lib/lib/app/communications/contact.js","../../../../../../UILib/ui-lib/lib/app/communications/follower.js","../../../../../../UILib/ui-lib/lib/app/communications/customer.js","../../../../../../UILib/ui-lib/lib/app/communications/internal.js"],"sourcesContent":["import { createElement } from \"../../ui\";\r\n\r\nfunction createBox(title, functions) {\r\n const container = createElement('div', 'comm');\r\n const header = createElement('div', 'title-bar',\r\n title,\r\n createElement('div', 'title-functions', ...functions)\r\n );\r\n container.appendChild(header);\r\n return container;\r\n}\r\n\r\nexport {\r\n createBox\r\n}","import { Dropdown, createElement, createCheckbox, createPopup, showAlert } from \"../../ui\";\r\nimport { isEmail, nullOrEmpty, r } from \"../../utility\";\r\n\r\nclass Contact {\r\n #option;\r\n #refs;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(parent = document.body) {\r\n const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const c = this.#option.contact;\r\n const contactName = createElement('input', input => {\r\n input.type = 'text';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 1;\r\n input.maxLength = 200;\r\n input.autocomplete = 'off';\r\n });\r\n const preferences = new Dropdown({ tabIndex: tabIndex + 2 });\r\n preferences.source = [\r\n { value: '0', text: r('text', 'Text') },\r\n { value: '1', text: r('email', 'Email') },\r\n { value: '2', text: r('phone', 'Phone') }\r\n ];\r\n const contactEmail = createElement('input', input => {\r\n input.type = 'email';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 3;\r\n input.maxLength = 100;\r\n input.autocomplete = 'off';\r\n });\r\n const contactMobile = createElement('input', input => {\r\n input.type = 'tel';\r\n input.className = 'ui-input';\r\n input.tabIndex = tabIndex + 4;\r\n input.maxLength = 50;\r\n input.autocomplete = 'off';\r\n });\r\n const checkOpt = createCheckbox({ tabIndex: tabIndex + 5 });\r\n const contactNotes = createElement('textarea', txt => {\r\n txt.className = 'ui-text';\r\n txt.tabIndex = tabIndex + 6;\r\n txt.maxLength = 2000;\r\n txt.style.height = '100px';\r\n });\r\n const buttons = [];\r\n if (this.#option.company) {\r\n buttons.push({\r\n text: c == null ? r('addContactRecord', 'Add Contact Record') : r('editContactRecord', 'Edit Contact Record'),\r\n // tabIndex: tabIndex + 7,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.SaveToCustomer = 1;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'customerrecord');\r\n }\r\n }\r\n });\r\n }\r\n buttons.push(\r\n {\r\n text: r('workOrderOnly', 'Work Order Only'),\r\n // tabIndex: tabIndex + 8,\r\n trigger: () => {\r\n const item = this.prepare();\r\n if (item == null) {\r\n return false;\r\n }\r\n item.Id = -1;\r\n item.SaveToCustomer = 0;\r\n if (typeof this.#option.onSave === 'function') {\r\n return this.#option.onSave.call(this, item, 'workorder');\r\n }\r\n }\r\n },\r\n {\r\n text: r('cancel', 'Cancel'),\r\n // tabIndex: tabIndex + 9\r\n }\r\n );\r\n const popup = createPopup(\r\n c == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact'),\r\n createElement('div', wrapper => {\r\n wrapper.className = 'setting-wrapper';\r\n wrapper.style.width = '500px';\r\n },\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label setting-required', r('contactNameColon', 'Contact Name:')),\r\n contactName\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactPreferencesColon', 'Contact Preferences:')),\r\n preferences.create()\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactEmailColon', 'Email Address:')),\r\n contactEmail\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactMobileColon', 'Mobile:')),\r\n contactMobile\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactOptColon', 'Opt Out:')),\r\n checkOpt\r\n ),\r\n createElement('div', 'setting-item',\r\n createElement('span', 'setting-label', r('contactNotesColon', 'Notes:')),\r\n contactNotes\r\n )\r\n ),\r\n ...buttons\r\n )\r\n if (c != null) {\r\n contactName.value = c.Name;\r\n preferences.select(String(c.ContactPreference));\r\n contactEmail.value = c.Email;\r\n contactMobile.value = c.MobilePhone;\r\n checkOpt.querySelector('input').checked = c.OptOut;\r\n contactNotes.value = c.Notes;\r\n } else {\r\n preferences.select('0');\r\n }\r\n this.#refs = {\r\n contactName,\r\n preferences,\r\n contactEmail,\r\n contactMobile,\r\n checkOpt,\r\n contactNotes\r\n };\r\n const result = await popup.show(parent);\r\n setTimeout(() => contactName.focus());\r\n return result;\r\n }\r\n\r\n prepare() {\r\n const name = this.#refs.contactName.value;\r\n const pref = this.#refs.preferences.selected.value;\r\n const email = this.#refs.contactEmail.value;\r\n const phone = this.#refs.contactMobile.value;\r\n const opt = this.#refs.checkOpt.querySelector('input').checked;\r\n const notes = this.#refs.contactNotes.value;\r\n const title = this.#option.contact == null ? r('addContact', 'Add Contact') : r('editContact', 'Edit Contact');\r\n if (nullOrEmpty(name)) {\r\n showAlert(title, r('contactNameRequired', 'Contact Name cannot be empty.'), 'warn')\r\n .then(() => this.#refs.contactName.focus());\r\n return null;\r\n }\r\n if (nullOrEmpty(email) && nullOrEmpty(phone)) {\r\n showAlert(title, r('contactEmailPhoneRequired', 'Email and Mobile Phone cannot both be empty.'), 'warn')\r\n .then(() => nullOrEmpty(email) ?\r\n this.#refs.contactEmail.focus() :\r\n this.#refs.contactMobile.focus());\r\n return null;\r\n }\r\n if (!nullOrEmpty(email) && !isEmail(email)) {\r\n showAlert(title, r('contactEmailInvalid', 'The email address is invalid.'), 'warn')\r\n .then(() => this.#refs.contactEmail.focus());\r\n return null;\r\n }\r\n\r\n let contact = this.#option.contact;\r\n if (contact == null) {\r\n contact = {};\r\n } else if (contact.OptOut !== opt) {\r\n if (opt !== false || contact.OptOut_BC === false) {\r\n contact.selected = !opt;\r\n }\r\n }\r\n contact.Name = name;\r\n contact.ContactPreference = pref;\r\n contact.Email = email;\r\n contact.MobilePhone = phone;\r\n contact.OptOut = opt;\r\n contact.Notes = notes;\r\n return contact;\r\n }\r\n}\r\n\r\nexport default Contact;","import { Grid, createElement, createPopup } from \"../../ui\";\r\nimport { nullOrEmpty, r, contains } from \"../../utility\";\r\n\r\nclass Follower {\r\n #option;\r\n #grid;\r\n\r\n constructor(option = {}) {\r\n this.#option = option;\r\n }\r\n\r\n async show(parent = document.body) {\r\n const tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0)) + 3;\r\n\r\n const gridContainer = createElement('div', 'follower-grid');\r\n const popup = createPopup(\r\n r('addFollowers', 'Add Followers'),\r\n createElement('div', 'follower-wrapper',\r\n createElement('div', div => div.innerText = r('whoWantReceiveCustomerNotification', 'Who do you want to receive customer notifications?')),\r\n createElement('input', search => {\r\n search.type = 'text';\r\n search.tabIndex = tabIndex + 3;\r\n search.className = 'ui-input follower-search';\r\n search.addEventListener('input', () => {\r\n const key = search.value;\r\n if (nullOrEmpty(key)) {\r\n this.#grid.source = this.#option.followers;\r\n } else {\r\n this.#grid.source = this.#option.followers.filter(f => f.Text || f.Email || contains(f.DisplayName, key, true));\r\n }\r\n });\r\n }),\r\n gridContainer\r\n ),\r\n {\r\n text: r('ok', 'OK'),\r\n key: 'ok',\r\n trigger: () => {\r\n if (typeof this.#option.onOk === 'function') {\r\n return this.#option.onOk.call(this, this.#grid.source.filter(f => f.Email || f.Text));\r\n }\r\n }\r\n },\r\n { text: r('cancel', 'Cancel'), key: 'cancel' }\r\n );\r\n const result = await popup.show(parent);\r\n result.querySelector('.follower-search').focus();\r\n // grid\r\n const grid = new Grid(gridContainer);\r\n grid.columns = [\r\n { key: 'DisplayName', caption: r('contactName', 'Contact Name'), width: 240 },\r\n { key: 'ContactTypeName', caption: r('contactType', 'Contact Type'), width: 120 },\r\n {\r\n key: 'Text',\r\n caption: r('text', 'Text'),\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 60,\r\n enabled: item => !nullOrEmpty(item.Mobile)\r\n },\r\n {\r\n key: 'Email',\r\n caption: r('email', 'Email'),\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 70,\r\n // enabled: item => !nullOrEmpty(item.ID)\r\n }\r\n ];\r\n grid.init();\r\n grid.source = this.#option.followers;\r\n this.#grid = grid;\r\n return result;\r\n }\r\n}\r\n\r\nexport default Follower;","import { Grid, createElement, setTooltip, createIcon, createCheckbox, createRadiobox, createPopup, showAlert, showConfirm } from \"../../ui\";\r\nimport { r, nullOrEmpty, formatUrl, isEmail, isPhone } from \"../../utility\";\r\nimport { createBox } from \"./lib\";\r\nimport Contact from \"./contact\";\r\nimport Follower from \"./follower\";\r\n\r\nclass NoteCol extends Grid.GridColumn {\r\n static create() {\r\n const wrapper = createElement('div', 'contact-wrapper',\r\n createElement('div', 'contact-name'),\r\n createElement('div', 'contact-note')\r\n );\r\n return wrapper;\r\n }\r\n\r\n static setValue(element, _val, item, _col, grid) {\r\n const name = element.querySelector('.contact-name');\r\n name.innerText = item.Name;\r\n if (name.scrollWidth > name.offsetWidth) {\r\n setTooltip(name, item.Name, false, grid.element);\r\n }\r\n element.querySelector('.contact-note').innerText = item.Notes;\r\n }\r\n}\r\n\r\nclass CustomerCommunication {\r\n #container;\r\n #option;\r\n #contacts;\r\n #followers;\r\n #buttonFollower;\r\n #enter;\r\n #message;\r\n #data = {};\r\n #gridContact;\r\n #gridWo;\r\n #gridFollower;\r\n\r\n constructor(opt) {\r\n this.#option = opt ?? {};\r\n }\r\n\r\n get #autoUpdates() { return this.#container.querySelector('.check-auto-update>input') }\r\n get autoUpdatesEnabled() { return this.#autoUpdates?.disabled !== true }\r\n set autoUpdatesEnabled(flag) {\r\n const element = this.#autoUpdates;\r\n if (element == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n element.disabled = true;\r\n element.parentElement?.classList?.add('disabled');\r\n } else {\r\n element.disabled = false;\r\n element.parentElement?.classList?.remove('disabled');\r\n }\r\n }\r\n get autoUpdates() { return this.#autoUpdates?.checked }\r\n set autoUpdates(flag) {\r\n const element = this.#autoUpdates;\r\n if (element == null) {\r\n return;\r\n }\r\n element.checked = flag;\r\n element.dispatchEvent(new Event('change'));\r\n }\r\n\r\n get #statusLink() { return this.#container.querySelector('.check-status-link>input') }\r\n get statusLinkEnabled() { return this.#statusLink?.disabled !== true }\r\n set statusLinkEnabled(flag) {\r\n const element = this.#statusLink;\r\n if (element == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n element.disabled = true;\r\n element.parentElement?.classList?.add('disabled');\r\n } else {\r\n element.disabled = false;\r\n element.parentElement?.classList?.remove('disabled');\r\n }\r\n }\r\n get statusLink() { return this.#statusLink?.checked }\r\n set statusLink(flag) {\r\n const element = this.#statusLink;\r\n if (element == null) {\r\n return;\r\n }\r\n element.checked = flag;\r\n element.dispatchEvent(new Event('change'));\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set loading(flag) {\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#enter.disabled = flag;\r\n this.#container.querySelector('.customer-name>.ui-input').disabled = flag;\r\n this.#container.querySelector('.button-send-message').disabled = flag;\r\n this.#container.querySelector('.button-edit-contacts').disabled = flag;\r\n this.#container.querySelector('.button-edit-followers').disabled = flag;\r\n }\r\n\r\n get text() { return this.#enter?.value }\r\n set text(s) {\r\n const element = this.#enter;\r\n if (element != null) {\r\n element.value = s\r\n s = String(nullOrEmpty(s) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n }\r\n }\r\n\r\n get customerName() { return this.#container.querySelector('.customer-name>.ui-input')?.value }\r\n set customerName(name) {\r\n const element = this.#container.querySelector('.customer-name>.ui-input');\r\n if (element == null) {\r\n return;\r\n }\r\n element.value = name;\r\n }\r\n\r\n get contacts() {\r\n return [...this.#contacts.children].map(el => {\r\n const span = el.querySelector('span');\r\n return { 'Key': span.dataset.to, 'Value': span.dataset.name };\r\n });\r\n }\r\n set contacts(contacts) {\r\n this.#contacts.replaceChildren();\r\n if (contacts?.length > 0) {\r\n for (let c of contacts) {\r\n if (c.OptOut || c.OptOut_BC || c.selected === false) {\r\n continue;\r\n }\r\n const mp = String(c.MobilePhoneDisplayText).trim();\r\n const email = String(c.Email).trim();\r\n const pref = String(c.ContactPreference);\r\n if ((pref !== '1') && !isPhone(mp) ||\r\n pref === '1' && !isEmail(email)) {\r\n continue;\r\n }\r\n const to = pref === '1' ? email : mp;\r\n let icon;\r\n let method;\r\n switch (pref) {\r\n case '0':\r\n icon = 'comment-lines';\r\n method = r('textsToColon', 'Texts to:');\r\n break;\r\n case '2':\r\n icon = 'mobile';\r\n method = r('callsToColon', 'Calls to:');\r\n break;\r\n default:\r\n icon = 'envelope';\r\n method = r('emailsToColon', 'Emails to:');\r\n break;\r\n }\r\n const span = createElement('span', span => {\r\n span.dataset.to = to;\r\n span.dataset.name = c.Name;\r\n span.innerText = c.Name;\r\n });\r\n const item = createElement('div', 'contact-item',\r\n createIcon('fa-light', icon),\r\n span\r\n );\r\n this.#contacts.appendChild(item);\r\n let tip = `${method} ${to}`;\r\n if (span.scrollWidth > span.offsetWidth) {\r\n tip = r('nameColon', 'Name:') + ` ${c.Name}\\n${tip}`;\r\n }\r\n setTooltip(span, tip);\r\n }\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n }\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set readonly(flag) {\r\n this.#option.readonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n const link = this.#container.querySelector('.check-status-link');\r\n if (flag === true) {\r\n link.classList.add('disabled');\r\n } else {\r\n link.classList.remove('disabled');\r\n }\r\n link.querySelector('input').disabled = flag;\r\n const display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-edit-contacts').style.display = display;\r\n this.#container.querySelector('.button-edit-followers').style.display = display;\r\n // this.#enter.disabled = flag === true;\r\n this.#container.querySelector('.message-bar').style.display = display;\r\n // this.#container.querySelector('.button-send-message').style.display = display;\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set recordReadonly(flag) {\r\n this.#option.recordReadonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#container.querySelector('.button-edit-contacts').style.display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-edit-followers').style.display = flag === true ? 'none' : '';\r\n }\r\n\r\n /**\r\n * @param {String} name\r\n */\r\n set companyName(name) {\r\n this.#option.companyName = name;\r\n const div = this.#container.querySelector('.title-company');\r\n if (nullOrEmpty(name)) {\r\n div.style.display = 'none';\r\n } else {\r\n div.innerText = name;\r\n div.style.display = '';\r\n }\r\n }\r\n /**\r\n * @param {String} code\r\n */\r\n set companyCode(code) {\r\n this.#option.companyCode = code;\r\n const div = this.#container.querySelector('.title-company');\r\n if (nullOrEmpty(this.#option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n div.innerText = this.#option.companyName;\r\n if (!nullOrEmpty(code))\r\n div.innerText = this.#option.companyName + \"/\" + code;\r\n div.style.display = '';\r\n }\r\n }\r\n\r\n get followers() {\r\n return [...this.#followers.children].map(el => {\r\n const span = el.querySelector('span');\r\n return { 'Email': span.dataset.email, 'MobilePhone': span.dataset.mp, 'Value': span.dataset.name };\r\n });\r\n }\r\n set followers(followers) {\r\n this.#data.followers = followers;\r\n this.#followers.replaceChildren();\r\n if (followers?.length > 0) {\r\n this.#container.querySelector('.follower-bar').style.display = '';\r\n this.#container.querySelector('.follower-bar>.bar-list').appendChild(this.#buttonFollower);\r\n for (let f of followers) {\r\n if (f.OptOut) {\r\n continue;\r\n }\r\n const mp = String(f.MobilePhone).trim();\r\n const email = String(f.Email).trim();\r\n const tips = [];\r\n if (f.SendEmail) {\r\n tips.push(r('emailsToColon', 'Emails to:') + ` ${email}`);\r\n }\r\n if (f.SendText) {\r\n tips.push(r('textsToColon', 'Texts to:' + ` ${mp}`));\r\n }\r\n let icon;\r\n if (f.SendText && f.SendEmail) {\r\n icon = 'at';\r\n } else {\r\n icon = f.SendText ? 'comment-lines' : 'envelope';\r\n }\r\n const span = createElement('span', span => {\r\n if (f.SendEmail) {\r\n span.dataset.email = email;\r\n }\r\n if (f.SendText) {\r\n span.dataset.mp = mp;\r\n }\r\n span.dataset.name = f.Name;\r\n span.innerText = f.Name;\r\n });\r\n const item = createElement('div', 'contact-item',\r\n createIcon('fa-light', icon),\r\n span\r\n );\r\n this.#followers.appendChild(item);\r\n if (span.scrollWidth > span.offsetWidth) {\r\n tips.splice(0, 0, r('nameColon', 'Name:') + ` ${c.Name}`);\r\n }\r\n setTooltip(span, tips.join('\\n'));\r\n }\r\n } else {\r\n this.#container.querySelector('.follower-bar').style.display = 'none';\r\n this.#container.querySelector('.button-edit-contacts').insertAdjacentElement('beforebegin', this.#buttonFollower)\r\n }\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n }\r\n\r\n setData(key, data) {\r\n this.#data[key] = data;\r\n }\r\n\r\n create() {\r\n const option = this.#option;\r\n const readonly = option.readonly;\r\n // functions\r\n const checkAutoUpdate = createCheckbox({\r\n className: 'check-auto-update',\r\n checked: option.autoUpdates,\r\n checkedNode: createIcon('fa-regular', 'redo-alt'),\r\n uncheckedNode: createIcon('fa-regular', 'ban'),\r\n onchange: function () {\r\n setTooltip(checkAutoUpdate, this.checked ?\r\n r('autoUpdateEnabled', 'Auto Updates Enabled') :\r\n r('autoUpdateDisabled', 'Auto Updates Disabled'));\r\n }\r\n });\r\n if (option.autoUpdatesVisible === false) {\r\n checkAutoUpdate.style.display = 'none';\r\n }\r\n const checkLink = createCheckbox({\r\n className: 'check-status-link',\r\n enabled: !readonly,\r\n checked: option.statusLink,\r\n checkedNode: createIcon('fa-regular', 'link'),\r\n uncheckedNode: createIcon('fa-regular', 'unlink'),\r\n onchange: function () {\r\n setTooltip(checkLink, this.checked ?\r\n r('statusLinkIncluded', 'Status Link Included') :\r\n r('statusLinkExcluded', 'Status Link Excluded'));\r\n }\r\n });\r\n if (option.statusLinkVisible === false) {\r\n checkLink.style.display = 'none';\r\n }\r\n const container = createBox(\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.className = 'title-module';\r\n div.innerText = option.title ?? r('messages', 'Customer Communication');\r\n }),\r\n createElement('div', div => {\r\n div.className = 'title-company';\r\n if (nullOrEmpty(option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n if (nullOrEmpty(option.companyCode)) {\r\n div.innerText = option.companyName;\r\n } else {\r\n div.innerText = option.companyName + \"/\" + option.companyCode;\r\n }\r\n }\r\n })\r\n ),\r\n [\r\n setTooltip(checkAutoUpdate, r('autoUpdateEnabled', 'Auto Updates Enabled')),\r\n setTooltip(checkLink, r('statusLinkExcluded', 'Status Link Excluded'))\r\n ]\r\n );\r\n // contacts\r\n this.#contacts = this.#createContacts(container, option);\r\n // followers\r\n this.#followers = this.#createFollowers(container, option);\r\n // enter box\r\n const enter = createElement('textarea', 'ui-text');\r\n enter.placeholder = r('typeMessage', 'Enter Message Here');\r\n option.maxLength ??= 3000;\r\n enter.maxLength = option.maxLength;\r\n // if (readonly === true) {\r\n // enter.disabled = true;\r\n // }\r\n enter.addEventListener('input', () => {\r\n const val = this.#enter.value;\r\n const s = String(nullOrEmpty(val) ? 0 : val.length) + '/' + String(option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n });\r\n this.#enter = enter;\r\n container.appendChild(\r\n createElement('div', div => {\r\n div.className = 'message-bar';\r\n if (readonly === true) {\r\n div.style.display = 'none';\r\n }\r\n },\r\n enter,\r\n createElement('div', div => div.style.textAlign = 'right',\r\n createElement('div', div => {\r\n div.className = 'customer-name';\r\n if (option.customerNameVisible !== true) {\r\n div.style.display = 'none';\r\n }\r\n },\r\n createElement('span', span => span.innerText = r('nameColon', 'Name:')),\r\n createElement('input', input => {\r\n input.type = 'text';\r\n input.className = 'ui-input';\r\n })\r\n ),\r\n createElement('div', 'prompt-count'),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-send-message';\r\n button.style.backgroundColor = 'rgb(19, 150, 204)';\r\n // if (readonly === true) {\r\n // button.style.display = 'none';\r\n // }\r\n button.appendChild(createIcon('fa-solid', 'paper-plane'));\r\n setTooltip(button, r('sendMessage', 'Send Message'));\r\n button.addEventListener('click', () => {\r\n const val = this.#enter.value;\r\n if (nullOrEmpty(val?.trim())) {\r\n showAlert(r('error', 'Error'), r('messageRequired', 'Please input the message.'), 'warn');\r\n return;\r\n }\r\n if (typeof this.#option.onAddMessage === 'function') {\r\n this.#option.onAddMessage(this.#enter.value);\r\n }\r\n })\r\n })\r\n )\r\n )\r\n );\r\n\r\n const message = createElement('div', 'list-bar');\r\n this.#message = message;\r\n container.appendChild(message);\r\n return this.#container = container;\r\n }\r\n\r\n #createContacts(container, option) {\r\n const readonly = option.readonly;\r\n const recordReadonly = option.recordReadonly;\r\n const contacts = createElement('div');\r\n container.append(\r\n createElement('div', 'contact-bar',\r\n createElement('div', 'bar-icon',\r\n createIcon('fa-solid', 'user-circle', {\r\n 'fill': 'lightgray'\r\n })\r\n ),\r\n createElement('div', 'bar-list',\r\n contacts,\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-edit-contacts';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n if (readonly === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'user-edit'));\r\n setTooltip(button, r('editContacts', 'Edit Contacts'));\r\n button.addEventListener('click', () => {\r\n const pop = createPopup(\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.alignItems = 'center';\r\n div.append(\r\n createElement('div', div => {\r\n div.className = 'ui-popup-move';\r\n div.style.flex = '1 1 auto';\r\n },\r\n createElement('div', div => div.innerText = r('editContacts', 'Edit Contacts')),\r\n createElement('div', div => {\r\n div.className = 'title-company';\r\n if (nullOrEmpty(option.companyName)) {\r\n div.style.display = 'none';\r\n } else {\r\n if (nullOrEmpty(option.companyCode)) {\r\n div.innerText = option.companyName;\r\n } else {\r\n div.innerText = option.companyName + \"/\" + option.companyCode;\r\n }\r\n }\r\n })\r\n ),\r\n createElement('button', button => {\r\n button.style.flex = '0 0 auto';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n button.style.marginRight = '10px';\r\n button.className = 'roundbtn button-add-contact';\r\n if (recordReadonly) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'user-plus', {\r\n width: '16px',\r\n height: '16px'\r\n }));\r\n button.addEventListener('click', () => {\r\n const add = new Contact({\r\n company: !nullOrEmpty(this.#data.companyCode),\r\n onSave: item => {\r\n const exists = this.#gridContact.source.some(s => s.Name === item.Name && s.MobilePhone === item.MobilePhone);\r\n if (exists) {\r\n showAlert(r('addContact', 'Add Contact'), r('contactUniqueRequired', 'Contact name and contact mobile must be a unique combination.'), 'warn');\r\n return false;\r\n }\r\n if (typeof option.onSave === 'function') {\r\n const result = option.onSave(item, true);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n this.#gridContact.source = r.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n this.#gridWo.source = r.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n add.show(container);\r\n });\r\n setTooltip(button, r('addContact', 'Add Contact'))\r\n })\r\n )\r\n }),\r\n createElement('div', null,\r\n createElement('div', div => {\r\n if (nullOrEmpty(this.#data.companyCode)) {\r\n div.style.display = 'none';\r\n }\r\n div.style.fontWeight = 'bold';\r\n div.innerText = r('contactFromRecord', 'Contacts from Customer Record');\r\n }),\r\n createElement('div', div => {\r\n if (nullOrEmpty(this.#data.companyCode)) {\r\n div.style.display = 'none';\r\n }\r\n div.className = 'contacts-record';\r\n div.style.maxHeight = '400px';\r\n div.style.width = '660px';\r\n }),\r\n createElement('div', div => {\r\n div.style.fontWeight = 'bold';\r\n div.innerText = r('contactFromWorkOrder', 'Contacts not on Customer Record');\r\n }),\r\n createElement('div', div => {\r\n div.className = 'contacts-wo';\r\n div.style.maxHeight = '200px';\r\n div.style.width = '660px';\r\n })\r\n )\r\n );\r\n pop.show(container).then(() => {\r\n const selectedCol = This => {\r\n return {\r\n key: 'selected',\r\n type: Grid.ColumnTypes.Checkbox,\r\n width: 50,\r\n enabled: item => !item.OptOut && !item.OptOut_BC,\r\n onchanged: function () {\r\n if (typeof option.onChanged === 'function') {\r\n option.onChanged([...This.#gridContact.source, ...This.#gridWo.source]);\r\n }\r\n }\r\n }\r\n };\r\n const iconCol = {\r\n key: 'type',\r\n type: Grid.ColumnTypes.Icon,\r\n width: 50,\r\n filter: c => {\r\n switch (String(c.ContactPreference)) {\r\n case '0': return 'comment-lines';\r\n case '2': return 'mobile';\r\n default: return 'envelope';\r\n }\r\n },\r\n className: 'icon-contact-type',\r\n iconType: 'fa-light'\r\n };\r\n const nameCol = { key: 'Name', type: NoteCol, width: 160 };\r\n const buttonCol = {\r\n type: Grid.ColumnTypes.Icon,\r\n width: 40,\r\n visible: !recordReadonly,\r\n align: 'center',\r\n iconType: 'fa-light'\r\n };\r\n const createEditCol = (This) => {\r\n return {\r\n key: 'edit',\r\n ...buttonCol,\r\n text: 'edit',\r\n tooltip: r('edit', 'Edit'),\r\n events: {\r\n onclick: function () {\r\n const edit = new Contact({\r\n contact: this,\r\n company: !nullOrEmpty(This.#data.companyCode),\r\n onSave: (item, _op) => {\r\n const exists =\r\n This.#gridContact.source.some(s => s !== this && s.Name === item.Name && s.MobilePhone === item.MobilePhone) ||\r\n This.#gridWo.source.some(s => s !== this && s.Name === item.Name && s.MobilePhone === item.MobilePhone);\r\n if (exists) {\r\n showAlert(r('editContact', 'Edit Contact'), r('contactUniqueRequired', 'Contact name and contact mobile must be a unique combination.'), 'warn');\r\n return false;\r\n }\r\n if (typeof option.onSave === 'function') {\r\n const result = option.onSave(item);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n This.#gridContact.source = r.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n This.#gridWo.source = r.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n edit.show(container);\r\n }\r\n }\r\n }\r\n };\r\n // contacts from customer record\r\n const grid = new Grid();\r\n grid.height = 0;\r\n grid.allowHtml = true;\r\n grid.headerVisible = false;\r\n grid.columns = [\r\n selectedCol(this),\r\n iconCol,\r\n nameCol,\r\n { key: 'Email', width: 180 },\r\n { key: 'MobilePhoneDisplayText', width: 130 },\r\n createEditCol(this),\r\n {\r\n key: 'delete',\r\n ...buttonCol,\r\n text: 'times',\r\n tooltip: r('delete', 'Delete'),\r\n events: {\r\n onclick: function () {\r\n showConfirm(\r\n r('remoteContact', 'Remove Contact'),\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.style.paddingLeft = '16px';\r\n div.innerText = r('removeFrom', 'Remove {name} from').replace('{name}', this.Name);\r\n }),\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.justifyContent = 'center';\r\n div.style.marginTop = '10px';\r\n },\r\n createRadiobox({\r\n name: 'remove-type',\r\n label: r('customerRecord', 'Customer Record'),\r\n checked: true,\r\n className: 'radio-customer-record'\r\n }),\r\n createRadiobox({\r\n name: 'remove-type',\r\n label: r('workOrder', 'Work Order')\r\n })\r\n )\r\n ),\r\n [\r\n { key: 'ok', text: r('ok', 'OK') },\r\n { key: 'cancel', text: r('cancel', 'Cancel') }\r\n ]\r\n ).then(result => {\r\n if (result?.key === 'ok') {\r\n const isRecord = result.popup.container.querySelector('.radio-customer-record>input').checked;\r\n if (typeof option.onDelete === 'function') {\r\n option.onDelete(result.key, this, isRecord);\r\n }\r\n const index = grid.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = grid.source;\r\n source.splice(index, 1);\r\n grid.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = source;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n ];\r\n grid.init(pop.container.querySelector('.contacts-record'));\r\n const customerRecords = this.#data.contacts.filter(c => c.Id >= 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n grid.extraRows = customerRecords.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = customerRecords;\r\n grid.selectedRowChanged = index => {\r\n if (index >= 0 && this.#gridWo.selectedIndexes?.length > 0) {\r\n this.#gridWo.selectedIndexes = [];\r\n }\r\n };\r\n this.#gridContact = grid;\r\n\r\n // contacts from work order only\r\n const gridWo = new Grid();\r\n gridWo.height = 0;\r\n gridWo.allowHtml = true;\r\n gridWo.headerVisible = false;\r\n gridWo.columns = [\r\n selectedCol(this),\r\n iconCol,\r\n nameCol,\r\n { key: 'Email', width: 180 },\r\n { key: 'MobilePhoneDisplayText', width: 130 },\r\n createEditCol(this),\r\n {\r\n key: 'delete',\r\n ...buttonCol,\r\n text: 'times',\r\n tooltip: r('delete', 'Delete'),\r\n events: {\r\n onclick: function () {\r\n showConfirm(r('remoteContact', 'Remove Contact'), r('removeFromWorkorder', 'You are removing {name} from work order.\\n\\nDo you want to Continue?').replace('{name}', this.Name), [\r\n { key: 'continue', text: r('continue', 'Continue') },\r\n { key: 'cancel', text: r('cancel', 'Cancel') }\r\n ]).then(result => {\r\n if (result?.key === 'continue') {\r\n if (typeof option.onDelete === 'function') {\r\n option.onDelete(result.key, this);\r\n }\r\n const index = gridWo.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = gridWo.source;\r\n source.splice(index, 1);\r\n gridWo.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n gridWo.source = source;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n ];\r\n gridWo.init(pop.container.querySelector('.contacts-wo'));\r\n const workOrderOnly = this.#data.contacts.filter(c => c.Id < 0).map(c => {\r\n if (c.OptOut || c.OptOut_BC) {\r\n return c;\r\n }\r\n if (typeof c.selected === 'undefined') {\r\n c.selected = true;\r\n }\r\n return c;\r\n });\r\n gridWo.extraRows = workOrderOnly.filter(c => !nullOrEmpty(c.Notes)).length;\r\n gridWo.source = workOrderOnly;\r\n gridWo.selectedRowChanged = index => {\r\n if (index >= 0 && this.#gridContact.selectedIndexes?.length > 0) {\r\n this.#gridContact.selectedIndexes = [];\r\n }\r\n };\r\n this.#gridWo = gridWo;\r\n });\r\n });\r\n })\r\n )\r\n )\r\n );\r\n return contacts;\r\n }\r\n\r\n #createFollowers(container, option) {\r\n const readonly = option.readonly;\r\n const recordReadonly = option.recordReadonly;\r\n const followers = createElement('div');\r\n const buttonEditFollower = createElement('button', button => {\r\n button.className = 'roundbtn button-edit-followers';\r\n button.style.backgroundColor = 'rgb(48, 107, 255)';\r\n if (readonly === true || recordReadonly) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'pen'));\r\n setTooltip(button, r('editFollower', 'Edit Followers'));\r\n button.addEventListener('click', () => {\r\n const pop = createPopup(\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.alignItems = 'center';\r\n div.append(\r\n createElement('div', div => {\r\n div.className = 'ui-popup-move';\r\n div.style.flex = '1 1 auto';\r\n div.innerText = r('editContacts', 'Edit Contacts') + '\\n' + r('followers', 'Followers');\r\n }),\r\n createElement('button', button => {\r\n button.style.flex = '0 0 auto';\r\n button.style.backgroundColor = 'rgb(1, 199, 172)';\r\n button.style.marginRight = '10px';\r\n button.className = 'roundbtn button-add-follower';\r\n button.appendChild(createIcon('fa-solid', 'user-plus', {\r\n width: '16px',\r\n height: '16px'\r\n }));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onInitFollower === 'function') {\r\n this.#option.onInitFollower().then(data => {\r\n if (typeof data === 'string') {\r\n showAlert(r('customerRecord', 'Customer Record'), data, 'warn');\r\n return;\r\n }\r\n const add = new Follower({\r\n followers: data,\r\n onOk: list => {\r\n if (typeof this.#option.onAddFollower === 'function') {\r\n const result = this.#option.onAddFollower(list);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n this.#gridFollower.source = r;\r\n return r;\r\n });\r\n }\r\n return false;\r\n }\r\n }\r\n });\r\n add.show(container);\r\n });\r\n }\r\n });\r\n setTooltip(button, r('addFollower', 'Add Follower'))\r\n })\r\n )\r\n }),\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.style.fontWeight = 'bold';\r\n div.innerText = r('contactFromRecord', 'Contacts from Customer Record');\r\n }),\r\n createElement('div', div => {\r\n div.className = 'followers-record';\r\n div.style.maxHeight = '400px';\r\n div.style.width = '660px';\r\n })\r\n )\r\n );\r\n pop.show(container).then(() => {\r\n const buttonCol = {\r\n type: Grid.ColumnTypes.Icon,\r\n width: 40,\r\n align: 'center',\r\n iconType: 'fa-light'\r\n };\r\n const grid = new Grid();\r\n grid.height = 0;\r\n grid.allowHtml = true;\r\n grid.headerVisible = false;\r\n grid.columns = [\r\n {\r\n key: 'type',\r\n type: Grid.ColumnTypes.Icon,\r\n width: 50,\r\n filter: c => c.SendText && c.SendEmail ? 'at' : (c.SendText ? 'comment-lines' : 'envelope'),\r\n className: 'icon-contact-type',\r\n iconType: 'fa-light'\r\n },\r\n { key: 'Name', width: 160 },\r\n { key: 'Email', width: 180 },\r\n { key: 'MobilePhoneDisplayText', width: 130 },\r\n {\r\n key: 'edit',\r\n ...buttonCol,\r\n text: 'edit',\r\n tooltip: r('edit', 'Edit'),\r\n events: {\r\n onclick: function () {\r\n if (typeof option.onInitFollower === 'function') {\r\n option.onInitFollower().then(data => {\r\n if (typeof data === 'string') {\r\n showAlert(r('customerRecord', 'Customer Record'), data, 'warn');\r\n return;\r\n }\r\n const contact = data.find(d => d.IID === this.UserIID);\r\n showConfirm(\r\n r('editContactMethod', 'Edit Contact Method'),\r\n createElement('div', 'wrapper-edit-method',\r\n createElement('div', div => {\r\n div.style.display = 'flex';\r\n div.style.justifyContent = 'center';\r\n div.style.marginTop = '20px';\r\n },\r\n createCheckbox({\r\n label: r('text', 'Text'),\r\n checked: this.SendText && !nullOrEmpty(contact?.Mobile),\r\n enabled: !nullOrEmpty(contact?.Mobile),\r\n className: 'check-method-text'\r\n }),\r\n createCheckbox({\r\n label: r('email', 'Email'),\r\n checked: this.SendEmail,\r\n className: 'check-method-email'\r\n })\r\n )\r\n ),\r\n [\r\n {\r\n key: 'ok',\r\n text: r('ok', 'OK'),\r\n trigger: (popup, button) => {\r\n const text = popup.container.querySelector('.check-method-text>input').checked;\r\n const email = popup.container.querySelector('.check-method-email>input').checked;\r\n\r\n if (!text && !email) {\r\n return showConfirm(r('editContactMethod', 'Edit Contact Method'), r('promptRemoveFollower', 'Contact method is required. If you continue, user will be removed as a follower.'), [\r\n { key: 'update', text: r('updateContactMethod', 'Update Contact Method') },\r\n { key: 'remove', text: r('removeFollower', 'Remove Follower') }\r\n ], 'question').then(result => {\r\n if (result?.key === 'remove') {\r\n return {\r\n key: result.key,\r\n popup\r\n };\r\n }\r\n return false;\r\n });\r\n }\r\n return {\r\n key: button.key,\r\n popup\r\n };\r\n }\r\n },\r\n { key: 'cancel', text: r('cancel', 'Cancel') }\r\n ],\r\n null\r\n ).then(result => {\r\n const key = result?.key;\r\n if (key === 'remove') {\r\n if (typeof option.onDeleteFollower === 'function') {\r\n option.onDeleteFollower(result.key, this);\r\n }\r\n const index = grid.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = grid.source;\r\n source.splice(index, 1);\r\n grid.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = source;\r\n }\r\n } else if (key === 'ok') {\r\n const text = result.popup.container.querySelector('.check-method-text>input').checked;\r\n const email = result.popup.container.querySelector('.check-method-email>input').checked;\r\n if (typeof option.onChangeFollower === 'function') {\r\n option.onChangeFollower(result.key, this, text, email);\r\n }\r\n this.SendText = text;\r\n this.SendEmail = email;\r\n grid.refresh();\r\n }\r\n });\r\n });\r\n }\r\n }\r\n }\r\n },\r\n {\r\n key: 'delete',\r\n ...buttonCol,\r\n text: 'times',\r\n tooltip: r('delete', 'Delete'),\r\n events: {\r\n onclick: function () {\r\n showConfirm(\r\n r('deleteFollower', 'Delete Follower'),\r\n r('promptDeleteFollower', 'Do you want to delete this follower?')\r\n ).then(result => {\r\n if (result?.key === 'yes') {\r\n if (typeof option.onDeleteFollower === 'function') {\r\n option.onDeleteFollower(result.key, this);\r\n }\r\n const index = grid.source.indexOf(this);\r\n if (index >= 0) {\r\n const source = grid.source;\r\n source.splice(index, 1);\r\n grid.extraRows = source.filter(c => !nullOrEmpty(c.Notes)).length;\r\n grid.source = source;\r\n }\r\n }\r\n });\r\n }\r\n }\r\n }\r\n ];\r\n grid.init(pop.container.querySelector('.followers-record'));\r\n grid.source = this.#data.followers;\r\n this.#gridFollower = grid;\r\n });\r\n });\r\n });\r\n this.#buttonFollower = buttonEditFollower;\r\n container.append(\r\n createElement('div', div => {\r\n div.className = 'contact-bar follower-bar';\r\n div.style.display = 'none';\r\n },\r\n setTooltip(createElement('div', 'bar-icon',\r\n createIcon('fa-solid', 'user-tag', {\r\n 'fill': '#fff',\r\n 'background-color': 'lightgray',\r\n 'box-sizing': 'border-box',\r\n 'border-radius': '15px',\r\n 'padding': '4px'\r\n })\r\n ), r('copied', 'Copied')),\r\n createElement('div', 'bar-list',\r\n followers,\r\n buttonEditFollower\r\n )\r\n )\r\n );\r\n return followers;\r\n }\r\n\r\n load(data, contacts, followers) {\r\n const children = [];\r\n if (data?.length > 0) {\r\n contacts ??= this.#data.contacts;\r\n followers ??= this.#data.allfollowers;\r\n for (let comm of data) {\r\n const div = createElement('div', 'item-div');\r\n let name;\r\n if (comm.IsReply && contacts?.length > 0) {\r\n const c = isEmail(comm.Sender) ?\r\n contacts.find(c => c.Email === comm.Sender) :\r\n contacts.find(c => c.MobilePhone === comm.Sender);\r\n name = c?.Name;\r\n }\r\n name ??= comm.IsReply && String(comm.FormatSender) !== '' ? comm.FormatSender : comm.Sender;\r\n let sendto = '';\r\n if (!comm.IsReply && comm.OriPhoneNumbers?.length > 0) {\r\n for (let oriph of comm.OriPhoneNumbers) {\r\n let cname;\r\n const email = isEmail(oriph);\r\n if (contacts?.length > 0) {\r\n let c = email ?\r\n contacts.find(c => c.Email === oriph) :\r\n contacts.find(c => c.MobilePhone === oriph);\r\n if (c != null) {\r\n cname = `${email ? c.Email : c.MobilePhoneDisplayText} - ${c.Name}`;\r\n } else if (followers?.length > 0) {\r\n c = email ?\r\n followers.find(f => f.Email === oriph) :\r\n followers.find(f => f.MobilePhone === oriph);\r\n if (c != null) {\r\n cname = `${email ? c.Email : c.MobilePhoneDisplayText} - ${c.Name}`;\r\n }\r\n }\r\n }\r\n sendto += (cname ?? oriph) + '\\n';\r\n }\r\n }\r\n if (sendto !== '') {\r\n sendto = r('sendToColon', 'Send To :') + `\\n${sendto}`;\r\n }\r\n div.appendChild(createElement('div', div => {\r\n div.className = 'item-poster';\r\n div.innerText = name;\r\n if (!comm.IsReply && sendto?.length > 0) {\r\n setTooltip(div, sendto);\r\n }\r\n }));\r\n const content = createElement('div', 'item-content');\r\n content.appendChild(createElement('span', span => {\r\n if (/https?:\\/\\//i.test(comm.Message)) {\r\n span.innerHTML = formatUrl(comm.Message);\r\n } else {\r\n span.innerText = comm.Message;\r\n }\r\n }));\r\n if (comm.IsReply) {\r\n div.classList.add('item-other');\r\n } else {\r\n div.classList.add('item-self');\r\n const [status, statusmsg] = this.#getMessageStatus(comm);\r\n if (status !== -100) {\r\n let statustext;\r\n switch (status) {\r\n case 0:\r\n statustext = r('pending', 'Pending');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 1:\r\n statustext = r('sent', 'Sent');\r\n break;\r\n case 9:\r\n statustext = r('failed', 'Failed');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 10:\r\n statustext = r('optOut', 'Opt-Out');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n case 412:\r\n statustext = r('landline', 'Landline');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n default:\r\n statustext = r('undelivered', 'Undelivered');\r\n content.style.backgroundColor = '#ffc107';\r\n break;\r\n }\r\n const divstatus = createElement('div', div => {\r\n div.className = 'item-status';\r\n div.innerText = statustext;\r\n if (status == -10) {\r\n setTooltip(div, statusmsg);\r\n }\r\n });\r\n content.appendChild(divstatus);\r\n }\r\n }\r\n div.append(\r\n content,\r\n createElement('div', div => {\r\n div.className = 'item-time';\r\n div.innerText = comm.TimeStr;\r\n })\r\n );\r\n children.push(div);\r\n }\r\n children[0].style.marginTop = '0';\r\n }\r\n this.#message.replaceChildren(...children);\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n // setTimeout(() => this.#message.scrollTop = this.#message.scrollHeight, 0);\r\n }\r\n\r\n #getMessageStatus(comm) {\r\n let status = -100; // 没有状态,页面上不显示\r\n const ls = [];\r\n let statusmsg = '';\r\n if (!comm.StatusIncorrect && comm.Participator?.length > 0) {\r\n for (let p of comm.Participator) {\r\n if (!isEmail(p.CustomerNumber)) {\r\n if (ls.indexOf(p.Status) < 0) {\r\n ls.push(p.Status);\r\n }\r\n if (statusmsg.length > 0) {\r\n statusmsg += '\\n';\r\n }\r\n statusmsg += `${p.CustomerNumber}: `;\r\n const st = ({\r\n 0: r('undelivered', 'Undelivered'),\r\n 1: r('sent', 'Sent'),\r\n 9: r('failed', 'Failed')\r\n })[p.Status];\r\n if (st != null) {\r\n statusmsg += st;\r\n }\r\n }\r\n }\r\n }\r\n if (ls.length === 1) {\r\n status = ls[0];\r\n } else if (ls.length > 1) {\r\n status = -10; // 多种状态\r\n }\r\n return [status, statusmsg];\r\n }\r\n}\r\n\r\nexport default CustomerCommunication;","import { createElement, setTooltip, createIcon } from \"../../ui\";\r\nimport { r, nullOrEmpty, escapeHtml } from \"../../utility\";\r\nimport { createBox } from \"./lib\";\r\n\r\nclass InternalComment {\r\n #container;\r\n #option;\r\n #enter;\r\n #message;\r\n\r\n constructor(opt) {\r\n this.#option = opt ?? {};\r\n }\r\n\r\n get text() { return this.#enter?.value }\r\n set text(s) {\r\n const element = this.#enter;\r\n if (element != null) {\r\n element.value = s\r\n s = String(nullOrEmpty(s) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n }\r\n }\r\n\r\n /**\r\n * @param {boolean} flag\r\n */\r\n set readonly(flag) {\r\n this.#option.readonly = flag;\r\n if (this.#container == null) {\r\n return;\r\n }\r\n this.#enter.disabled = flag === true;\r\n this.#container.querySelector('.button-send-message').style.display = flag === true ? 'none' : '';\r\n this.#container.querySelector('.button-post-note').style.display = flag === true ? 'none' : '';\r\n }\r\n\r\n create() {\r\n const container = createBox(\r\n createElement('div', null,\r\n createElement('div', div => {\r\n div.className = 'title-module';\r\n div.innerText = r('internalComments', 'Internal Comments');\r\n })\r\n ), []\r\n );\r\n const readonly = this.#option.readonly;\r\n // enter box\r\n const enter = createElement('textarea', 'ui-text');\r\n enter.placeholder = r('typeComment', 'Enter Comment Here');\r\n enter.maxLength = this.#option.maxLength ??= 3000;\r\n enter.addEventListener('input', () => {\r\n const val = this.#enter.value;\r\n const s = String(nullOrEmpty(val) ? 0 : val.length) + '/' + String(this.#option.maxLength);\r\n this.#container.querySelector('.message-bar .prompt-count').innerText = s;\r\n });\r\n if (readonly === true) {\r\n enter.disabled = true;\r\n }\r\n this.#enter = enter;\r\n container.appendChild(\r\n createElement('div', 'message-bar',\r\n enter,\r\n createElement('div', div => div.style.textAlign = 'right',\r\n createElement('div', 'prompt-count'),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-send-message';\r\n button.style.backgroundColor = 'rgb(19, 150, 204)';\r\n if (readonly === true || this.#option.noMessage === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'paper-plane'));\r\n setTooltip(button, r('sendMessage', 'Send Message'));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onAddMessage === 'function') {\r\n this.#option.onAddMessage(this.#enter.value);\r\n }\r\n })\r\n }),\r\n createElement('button', button => {\r\n button.className = 'roundbtn button-post-note';\r\n button.style.border = '1px solid rgb(19, 150, 204)';\r\n button.style.fill = 'rgb(19, 150, 204)';\r\n if (readonly === true) {\r\n button.style.display = 'none';\r\n }\r\n button.appendChild(createIcon('fa-solid', 'comment-alt-lines'));\r\n setTooltip(button, r('postNote', 'Post Note'));\r\n button.addEventListener('click', () => {\r\n if (typeof this.#option.onAddComment === 'function') {\r\n this.#option.onAddComment(this.#enter.value);\r\n }\r\n })\r\n })\r\n )\r\n )\r\n );\r\n\r\n const message = createElement('div', 'list-bar');\r\n this.#message = message;\r\n container.appendChild(message);\r\n return this.#container = container;\r\n }\r\n\r\n load(data) {\r\n const children = [];\r\n if (data?.length > 0) {\r\n for (let comment of data) {\r\n const div = createElement('div', 'item-div');\r\n // if (sendto !== '') {\r\n // sendto = r('sendToColon', 'Send To :') + `\\n${sendto}`;\r\n // }\r\n div.appendChild(createElement('div', div => {\r\n div.className = 'item-poster';\r\n div.innerText = comment.UserName;\r\n }));\r\n const content = createElement('div', 'item-content');\r\n content.appendChild(createElement('span', span => span.innerHTML = escapeHtml(comment.Comment)));\r\n if (comment.FollowUp?.length > 0) {\r\n div.classList.add('item-sent');\r\n const sendto = r('sendToColon', 'Send To :') + '\\r\\n' + comment.FollowUp.split(';').join('\\r\\n');\r\n content.appendChild(createElement('div', div => {\r\n div.className = 'item-status';\r\n div.innerText = r('sent', 'Sent');\r\n setTooltip(div, sendto);\r\n }));\r\n }\r\n div.append(\r\n content,\r\n createElement('div', div => {\r\n div.className = 'item-time';\r\n div.innerText = comment.SubmitDateStr;\r\n })\r\n );\r\n children.push(div);\r\n }\r\n children[0].style.marginTop = '0';\r\n }\r\n this.#message.replaceChildren(...children);\r\n this.#message.scrollTop = this.#message.scrollHeight\r\n // setTimeout(() => this.#message.scrollTop = this.#message.scrollHeight, 0);\r\n }\r\n}\r\n\r\nexport default InternalComment;"],"names":["createElement","createBox","title","functions","container","header","Dropdown","isEmail","Contact","option","__privateAdd","_option","_refs","__privateSet","parent","tabIndex","e","c","__privateGet","contactName","input","preferences","r","contactEmail","contactMobile","checkOpt","createCheckbox","contactNotes","txt","buttons","item","popup","createPopup","wrapper","result","name","pref","email","phone","opt","notes","nullOrEmpty","showAlert","contact","Grid","Follower","_grid","gridContainer","div","search","key","f","contains","grid","NoteCol","element","_val","_col","setTooltip","CustomerCommunication","_autoUpdates","_statusLink","_createContacts","_createFollowers","_getMessageStatus","_container","_contacts","_followers","_buttonFollower","_enter","_message","_data","_gridContact","_gridWo","_gridFollower","_a","autoUpdates_get","flag","_b","_d","_c","statusLink_get","s","el","span","contacts","mp","isPhone","to","icon","method","createIcon","tip","link","display","code","followers","tips","data","readonly","checkAutoUpdate","checkLink","__privateMethod","createContacts_fn","createFollowers_fn","enter","val","button","message","children","comm","sendto","oriph","cname","content","formatUrl","status","statusmsg","getMessageStatus_fn","statustext","divstatus","recordReadonly","pop","selectedCol","This","iconCol","nameCol","buttonCol","createEditCol","_op","showConfirm","createRadiobox","isRecord","index","source","customerRecords","gridWo","workOrderOnly","buttonEditFollower","list","d","text","ls","p","st","InternalComment","comment","escapeHtml"],"mappings":"qsBAAAA,EAAA,OAAA,QAAA,EAAA,cAEA,SAASC,GAAUC,GAAOC,EAAW,CACjC,MAAMC,EAAYJ,EAAc,MAAO,MAAM,EACvCK,EAASL,EAAc,MAAO,YAChCE,GACAF,EAAc,MAAO,kBAAmB,GAAGG,CAAS,CAC5D,EACI,OAAAC,EAAU,YAAYC,CAAM,EACrBD,CACX,CCVA,MAAAE,GAAA,OAAA,QAAA,EAAA,2IACAC,GAAA,OAAA,aAAA,EAAA,uEAEA,MAAMC,EAAQ,CAIV,YAAYC,EAAS,GAAI,CAHzBC,EAAA,KAAAC,EAAA,QACAD,EAAA,KAAAE,EAAA,QAGIC,EAAA,KAAKF,EAAUF,EAClB,CAED,MAAM,KAAKK,EAAS,SAAS,KAAM,CAC/B,MAAMC,EAAW,KAAK,IAAI,MAAM,KAAM,CAAC,GAAG,SAAS,iBAAiB,YAAY,CAAC,EAAE,IAAIC,GAAKA,EAAE,UAAY,CAAC,CAAC,EAAI,EAE1GC,EAAIC,EAAA,KAAKP,GAAQ,QACjBQ,EAAcnB,EAAc,Q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S,UAAYpD,EAAA,KAAKoD,IAAS,YAE3C,CACL,CAzIIL,EAAA,YACAtD,EAAA,YACA0D,EAAA,YACAC,GAAA"} \ No newline at end of file diff --git a/Site/js/lib/ui.min.js b/Site/js/lib/ui.min.js index bc18f33..21a1dd2 100644 --- a/Site/js/lib/ui.min.js +++ b/Site/js/lib/ui.min.js @@ -1,3 +1,3 @@ -(function(k,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(k=typeof globalThis<"u"?globalThis:k||self,T(k["lib-ui"]={}))})(this,function(k){var N,j,H,z,K,we,Pe,ce,de,ue,Qe,ke,kt,Ce,Ct,ze,Rt,Ve,Ht,We,Ot,Me,$t,B,O,Le,M,b,Ee,Te,D,U,he,fe,se,G,Se,pe,Ne,A,De,Ae,Lt,ct,ii,dt,si,ut,ni,ye,Ze,ht,li,ft,ri,Fe,Pt,V,Y,ne,_e,ge,et,je,zt,Be,Vt,Xe,Wt,me,tt,pt,oi,Ye,Mt,Ke,Dt,yt,ai,gt,ci,mt,di,bt,ui,vt,hi,xt,fi,wt,pi,Ue,Ft,Ge,jt,Ie,Et,J,R,Q,X,te;"use strict";var Ri=Object.defineProperty;var Hi=Object.getPrototypeOf;var Oi=Reflect.get;var $i=(k,T,S)=>T in k?Ri(k,T,{enumerable:!0,configurable:!0,writable:!0,value:S}):k[T]=S;var E=(k,T,S)=>($i(k,typeof T!="symbol"?T+"":T,S),S),qt=(k,T,S)=>{if(!T.has(k))throw TypeError("Cannot "+S)};var o=(k,T,S)=>(qt(k,T,"read from private field"),S?S.call(k):T.get(k)),m=(k,T,S)=>{if(T.has(k))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(k):T.set(k,S)},x=(k,T,S,f)=>(qt(k,T,"write to private field"),f?f.call(k,S):T.set(k,S),S);var p=(k,T,S)=>(qt(k,T,"access private method"),S),ti=(k,T,S)=>Oi(Hi(k),S,T);const T="",S="";function f(d,e,...t){const s=document.createElement(d);return typeof e=="function"?e(s):e!=null&&(s.className=e),t.length>0&&s.append(...t),s}const Bt="http://www.w3.org/2000/svg";function Tt(d,e){const t=typeof consts<"u"?consts:{},s=t.path||"",n=t.resver==null?"":`?${t.resver}`,r=document.createElementNS(Bt,"use");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${s}fonts/${d}.svg${n}#${e}`),r}function qe(d,e,t){return d instanceof SVGElement&&d.replaceChildren(Tt(e,t)),d}function W(d,e,t){const s=document.createElementNS(Bt,"svg");if(s.appendChild(Tt(d,e)),t!=null)for(let n of Object.entries(t))s.style.setProperty(n[0],n[1]);return s}function yi(d){const e=d.querySelectorAll("svg[data-id]");for(let t of e){const s=t.dataset.type,n=t.dataset.id;t.replaceChildren(Tt(s,n)),t.removeAttribute("data-type"),t.removeAttribute("data-id")}return d}const Pi="";function it(d,e="fa-regular",t,s=-1,n="check"){d.appendChild(f("layer",r=>{r.className="ui-check-inner",r.addEventListener("keypress",i=>{if(i.key===" "||i.key==="Enter"){const l=d.querySelector("input");l!=null&&(l.checked=!l.checked,l.dispatchEvent(new Event("change")))}}),s>=0&&(r.tabIndex=s)},W(e,n))),t instanceof Element?d.appendChild(t):(t==null?void 0:t.length)>0&&d.appendChild(f("span",r=>r.innerText=t))}function gi(d={}){const e=f("label","ui-check-wrapper ui-radio-wrapper",f("input",t=>{if(t.setAttribute("type","radio"),t.name=d.name,d.checked===!0&&(t.checked=!0),d.enabled===!1&&(t.disabled=!0),d.customerAttributes!=null)for(let s of Object.entries(d.customerAttributes))t.setAttribute(s[0],s[1]);typeof d.onchange=="function"&&t.addEventListener("change",d.onchange)}));return d.className&&e.classList.add(d.className),it(e,d.type,d.label,d.tabIndex,"circle"),e}function le(d={}){const e=f("label","ui-check-wrapper",f("input",t=>{if(t.setAttribute("type","checkbox"),d.checked===!0&&(t.checked=!0),d.enabled===!1&&(t.disabled=!0),d.customerAttributes!=null)for(let s of Object.entries(d.customerAttributes))t.setAttribute(s[0],s[1]);typeof d.onchange=="function"&&t.addEventListener("change",d.onchange)}));return d.className&&e.classList.add(d.className),d.enabled===!1&&e.classList.add("disabled"),d.checkedNode!=null&&d.uncheckedNode!=null?(e.classList.add("ui-check-image-wrapper"),d.imageHeight,d.checkedNode.classList.add("checked"),e.appendChild(d.checkedNode),d.uncheckedNode.classList.add("unchecked"),e.appendChild(d.uncheckedNode)):it(e,d.type,d.label,d.tabIndex),e}function mi(d=document.body,e){if(e){const s=d.querySelectorAll('input[type="checkbox"]');for(let n of s){if(n.parentElement.classList.contains("ui-check-wrapper"))continue;const r=n.id;let i,l;if(r!=null&&(i=d.querySelector(`label[for="${r}"]`)),i==null){const a=n.nextElementSibling;a!=null&&(a.tagName==="LABEL"?i=a:a.tagName==="SPAN"&&a.dataset.lgid!=null&&(l=a.innerText,a.style.display="none"))}if(i==null){const a=n.previousElementSibling;a!=null&&(a.tagName==="LABEL"?i=a:l==null&&a.tagName==="SPAN"&&a.dataset.lgid!=null&&(l=a.innerText,a.style.display="none"))}i==null?(i=f("label"),n.parentElement.insertBefore(i,n)):l=i.innerText,n.disabled?i.className="ui-check-wrapper disabled":i.className="ui-check-wrapper",i.replaceChildren(),it(i,"fa-regular",l,n.tabIndex),i.insertBefore(n,i.firstChild)}}const t=d.querySelectorAll("label[data-checkbox]");for(let s of t){s.classList.contains("ui-check-wrapper")||s.classList.add("ui-check-wrapper"),s.hasChildNodes()?s.classList.contains("ui-check-image-wrapper")||s.classList.add("ui-check-image-wrapper"):(it(s,s.dataset.type,s.dataset.label,s.dataset.tabIndex),s.removeAttribute("data-type"),s.removeAttribute("data-label"));const n=f("input"),r=s.dataset.id;(r==null?void 0:r.length)>0&&(n.id=r),s.dataset.checked!=null&&(n.checked=!0),n.setAttribute("type","checkbox"),s.insertBefore(n,s.firstChild)}return d}const zi="";function St(d,e,t=!1,s=null){const n=s instanceof HTMLElement;if(n){const l=d.dataset.tipId,a=s.querySelector(`.ui-tooltip-wrapper[data-tip-id="${l}"]`);a==null||a.remove()}else{const l=d.querySelector(".ui-tooltip-wrapper");l==null||l.remove()}const r=f("div",l=>{l.className="ui-tooltip-wrapper ui-tooltip-color",l.style.visibility="hidden",l.style.opacity=0,l.style.top="0",l.style.left="0"},f("div","ui-tooltip-pointer ui-tooltip-color"),f("div","ui-tooltip-curtain ui-tooltip-color"),f("div",l=>{l.className="ui-tooltip-content",e instanceof Element?l.appendChild(e):l.innerText=e}));if(n){const l=String(Math.random()).substring(2);d.dataset.tipId=l,r.dataset.tipId=l,s.appendChild(r)}else d.appendChild(r);let i;return d.addEventListener("mouseenter",()=>{i&&clearTimeout(i);let l=d;for(;(l==null?void 0:l.offsetWidth)==null;)l=l.parentElement;l!=null&&(!t||l.scrollWidth>l.offsetWidth)&&(i=setTimeout(()=>{let a,c,u;if(c=l.offsetLeft,u=l.offsetTop,n)for(a=l.offsetParent;a!=null&&a!==s;)c+=a.offsetLeft,u+=a.offsetTop,a=a.offsetParent;a=l.parentElement;const y=l.offsetParent;for(;a!=null&&a!==(n?s:y);)c-=a.scrollLeft,u-=a.scrollTop,a=a.parentElement;c+=(l.offsetWidth-r.offsetWidth)/2,u-=r.offsetHeight+14,r.style.left=`${c}px`,r.style.top=`${u}px`,r.style.visibility="visible",r.style.opacity=1},100))}),d.addEventListener("mouseleave",()=>{i&&clearTimeout(i),i=setTimeout(()=>{r.style.visibility="hidden",r.style.opacity=0},300)}),d}function bi(d=document.body){const e=d.querySelectorAll("[title]");for(let t of e){const s=t.getAttribute("title");s!=null&&(t.removeAttribute("title"),St(t,s))}return d}const Vi="";function re(d){return d==null||typeof d!="string"||d.length===0}function vi(d,e,t){return re(d)||e==null?!1:(typeof e!="string"&&(e=String(e)),t?d.toLowerCase().indexOf(e.toLowerCase())>=0:d.indexOf(e)>=0)}function F(d,e){return e}let oe=typeof globalThis<"u"?globalThis:self;function Re(d){return!isNaN(d)&&d>0}function xi(){return/mobile/i.test(navigator.userAgent)}function ve(d,e=100,t=oe,...s){if(d==null)return;d.tiid&&clearTimeout(d.tiid);const n=new Date;d.tdate==null||n-d.tdate>e?(d.apply(t,s),d.tdate=n):d.tiid=setTimeout(()=>d.apply(t,s),e)}function wi(d){return(d>0?Math.floor:Math.ceil)(d)}const Xt=Symbol.for("ui-dropdown"),ki=26,Ci=30;let ae=oe[Xt];ae==null&&(ae={},Object.defineProperty(ae,"clear",{writable:!1,configurable:!1,enumerable:!1,value:function(){const d=document.querySelector(".ui-drop-wrapper .ui-drop-box.active");if(d==null)return;d.classList.remove("active");const e=d.parentElement.dataset.dropId;if(e==null)return;const t=this[e];t!=null&&t.multiselect&&typeof t.oncollapsed=="function"&&t.oncollapsed()}}),oe[Xt]=ae,document.addEventListener("mousedown",d=>{let e=d.target;for(;e!=null;){if(e.classList.contains("ui-drop-box")){d.stopPropagation();return}e=e.parentElement}ae.clear()}));function Yt(d,e,t,s){const n=e.map(r=>r[t]);if(n.some(r=>r instanceof HTMLElement))d.replaceChildren(...n.filter(r=>r!=null).map(r=>r.cloneNode(!0)));else{let r=e.map(i=>i[s]).join(", ");re(r)&&(r=F("noneItem","( None )")),d.innerText=r}}function Nt(d,e,t,s){return(!Array.isArray(d)||d.length===0)&&(d=[e]),t.length>0&&(s=s.filter(n=>{for(let r of d)if(vi(n[r].toLowerCase(),t))return!0;return!1})),s}const It=class{constructor(e={}){m(this,ue);m(this,ke);m(this,Ce);m(this,ze);m(this,N,void 0);m(this,j,void 0);m(this,H,void 0);m(this,z,void 0);m(this,K,void 0);m(this,we,void 0);m(this,Pe,void 0);m(this,ce,void 0);m(this,de,void 0);E(this,"sourceFilter");E(this,"onselectedlist");E(this,"onselected");E(this,"onexpanded");e.searchplaceholder??(e.searchplaceholder=F("searchHolder","Search...")),e.textkey??(e.textkey="text"),e.valuekey??(e.valuekey="value"),e.htmlkey??(e.htmlkey="html"),e.maxlength??(e.maxlength=500),x(this,N,e)}create(){const e=o(this,N),t=f("div","ui-drop-wrapper"),s=String(Math.random()).substring(2);t.dataset.dropId=s,ae[s]=this,x(this,j,t);const n=f("div","ui-drop-header");n.addEventListener("keypress",i=>{(i.key===" "||i.key==="Enter")&&n.dispatchEvent(new MouseEvent("click"))}),n.addEventListener("keydown",i=>{var c;const l=i.key==="ArrowUp",a=i.key==="ArrowDown";if(l||a){const u=this.source,y=u.length,w=o(this,N).valuekey;let h=u==null?void 0:u.indexOf(o(this,ce));isNaN(h)||h<-1?h=-1:h>=y&&(h=y-1),l?h>0?h--:h=0:a&&(h<0?h=0:h{if(this.disabled)return;const i=o(this,ue,Qe),l=o(this,z);i&&l.ownerDocument.activeElement===l||(p(this,ke,kt).call(this,!i),!i&&typeof this.onexpanded=="function"&&setTimeout(()=>this.onexpanded(),120))});let r;return e.input?(r=f("input","ui-drop-text"),r.setAttribute("type","text"),e.placeholder&&r.setAttribute("placeholder",e.placeholder),Re(e.maxlength)&&r.setAttribute("maxlength",e.maxlength),Re(e.tabindex)&&r.setAttribute("tabindex",e.tabindex),r.addEventListener("input",i=>{const l=i.target.value.toLowerCase(),a=Nt(e.searchkeys,e.textkey,l,this.source);p(this,Ce,Ct).call(this,a),o(this,H).classList.add("active")}),r.addEventListener("blur",i=>this.select(i.target.value)),r.addEventListener("mousedown",i=>o(this,ue,Qe)&&i.stopPropagation())):(Re(e.tabindex)&&n.setAttribute("tabindex",e.tabindex),r=f("label","ui-drop-text")),x(this,z,r),e.multiselect?Array.isArray(e.selectedlist)?this.selectlist(e.selectedlist,!0):(x(this,K,!0),r.innerText=F("allItem","( All )")):e.selected!=null&&this.select(e.selected,!0),n.append(r,f("label","ui-drop-caret")),t.appendChild(n),this.disabled=e.disabled||!1,t}get multiselect(){return o(this,N).multiselect}get disabled(){return o(this,j)==null||o(this,j).querySelector(".ui-drop-header.disabled")!=null}set disabled(e){o(this,j)!=null&&(e?o(this,j).querySelector(".ui-drop-header").classList.add("disabled"):o(this,j).querySelector(".ui-drop-header").classList.remove("disabled"))}get source(){let e=o(this,we);return(e==null||!Array.isArray(e))&&(typeof this.sourceFilter=="function"&&(e=this.sourceFilter()),Array.isArray(e)||(e=[]),x(this,we,e)),e}set source(e){Array.isArray(e)&&(x(this,we,e),o(this,ue,Qe)&&setTimeout(()=>p(this,ke,kt).call(this),120))}get selected(){return o(this,ce)}get selectedlist(){return o(this,de)||[]}select(e,t){if(o(this,Pe)===e)return!1;x(this,Pe,e);const s=o(this,N).valuekey,n=o(this,N).textkey,r=o(this,N).htmlkey;let i=this.source.find(l=>l[s]===e);if(o(this,N).input)i==null&&(i={[s]:e}),o(this,z).value=e;else{const l=o(this,ue,Qe);if(l&&o(this,H).querySelectorAll("li[data-value].selected").forEach(c=>c.classList.remove("selected")),i==null)return x(this,ce,null),o(this,z).innerText=" ",!1;const a=i[r];if(a instanceof HTMLElement)o(this,z).replaceChildren(a.cloneNode(!0));else{let c=i[n];re(c)&&(c=" "),o(this,z).innerText=c}if(l){const c=e.replace(/"/g,'\\"'),u=o(this,H).querySelector(`li[data-value="${c}"]`);u!=null&&u.classList.add("selected")}}x(this,ce,i),!t&&typeof this.onselected=="function"&&this.onselected(i)}selectlist(e,t){const s=this.source,n=o(this,N).valuekey,r=o(this,N).textkey,i=o(this,N).htmlkey,l=e.map(a=>{let c=s.find(u=>u[n]===a);return c==null&&(c={[n]:a,[r]:a}),c});if(l.length===0)return x(this,de,null),o(this,z).innerText=none,!1;Yt(o(this,z),l,i,r),x(this,de,l),!t&&typeof this.onselectedlist=="function"&&this.onselectedlist(l)}static resolve(e=document.body){const t=e.querySelectorAll("select");for(let s of t){const n=[...s.children].map(i=>({value:i.value,text:i.innerText})),r=new It({selected:s.value,disabled:s.disabled,tabindex:s.tabIndex});r.source=n,s.parentElement.replaceChild(r.create(),s)}return e}};let st=It;N=new WeakMap,j=new WeakMap,H=new WeakMap,z=new WeakMap,K=new WeakMap,we=new WeakMap,Pe=new WeakMap,ce=new WeakMap,de=new WeakMap,ue=new WeakSet,Qe=function(){var e,t;return(t=(e=o(this,H))==null?void 0:e.classList)==null?void 0:t.contains("active")},ke=new WeakSet,kt=function(e=!0){const t=o(this,N);let s=o(this,H);if(s==null){if(s=f("div","ui-drop-box"),!t.input&&t.search){const r=f("div","ui-drop-search"),i=f("input");i.setAttribute("type","text"),Re(t.tabindex)&&i.setAttribute("tabindex",t.tabindex),!re(t.searchplaceholder)&&i.setAttribute("placeholder",t.searchplaceholder),i.addEventListener("input",l=>{const a=l.target.value.toLowerCase(),c=Nt(t.searchkeys,t.textkey,a,this.source);p(this,Ce,Ct).call(this,c)}),r.append(i,W("fa-light","search")),s.appendChild(r)}const n=f("ul","ui-drop-list");this.multiselect||n.addEventListener("click",r=>{let i=r.target;for(;i.tagName!=="LI";)if(i=i.parentElement,i==null)return;const l=i.dataset.value;this.select(l)!==!1&&ae.clear()}),s.appendChild(n),x(this,H,s),o(this,j).appendChild(s)}if(e){let n=this.source;if(!t.input&&t.search){const r=s.querySelector(".ui-drop-search > input");re(r==null?void 0:r.value)||(n=Nt(t.searchkeys,t.textkey,r.value,n))}if(p(this,Ce,Ct).call(this,n),!t.slidefixed){let r=t.parent??document.body,i=o(this,j),l=i.offsetTop;for(;(i=i.parentElement)!=null&&i!==r;)l-=i.scrollTop;l-r.offsetTop+ki+s.offsetHeight>=r.offsetHeight?s.classList.add("slide-up"):s.classList.remove("slide-up")}s.classList.add("active")}else s.classList.remove("active")},Ce=new WeakSet,Ct=function(e){const t=o(this,H).querySelector(".ui-drop-list");t.replaceChildren();const s=this.multiselect,n=o(this,K);s&&t.appendChild(f("li",null,le({label:F("allItem","( All )"),checked:n,customerAttributes:{isall:"1"},onchange:y=>p(this,ze,Rt).call(this,y.target)})));const r=o(this,N).valuekey,i=o(this,N).textkey,l=o(this,N).htmlkey,a=this.selected,c=this.selectedlist;let u;e.slice(0,200).forEach((y,w)=>{const h=y[r],g=f("li");g.dataset.value=h,g.setAttribute("title",y[i]);let C;const v=y[l];if(v instanceof HTMLElement&&(C=v),s){const $=c.some(_=>_[r]===h);C==null&&(C=f("span"),C.innerText=y[i]);const L=le({label:C,checked:n||$,customerAttributes:{class:"dataitem","data-value":h},onchange:_=>p(this,ze,Rt).call(this,_.target)});g.appendChild(L)}else C==null?g.innerText=y[i]:g.appendChild(C),a!=null&&a[r]===h&&(u=Ci*w,g.classList.add("selected"));t.appendChild(g)}),u!=null&&setTimeout(()=>t.scrollTop=u,10)},ze=new WeakSet,Rt=function(e){let t;const s=o(this,N).valuekey,n=o(this,N).textkey,r=o(this,N).htmlkey;if(e.getAttribute("isall")==="1"){const i=x(this,K,e.checked);o(this,H).querySelectorAll("input.dataitem").forEach(a=>a.checked=i),t=[]}else if(e.checked)if(o(this,H).querySelectorAll("input.dataitem:not(:checked)").length===0)x(this,K,!0),o(this,H).querySelector('input[isall="1"]').checked=!0,t=[];else{const i=this.source;t=[...o(this,H).querySelectorAll("input.dataitem:checked")].map(l=>i.find(a=>a[s]===l.dataset.value)).filter(l=>l!=null)}else{const i=e.dataset.value;o(this,K)?(x(this,K,!1),o(this,H).querySelector('input[isall="1"]').checked=!1,t=this.source.filter(l=>l[s]!==i)):t=this.selectedlist.filter(l=>l[s]!==i)}o(this,K)?o(this,z).innerText=F("allItem","( All )"):Yt(o(this,z),t,r,n),x(this,de,t),typeof this.onselectedlist=="function"&&this.onselectedlist(itemlist)};const Wi="";class ie{static create(){return f("span")}static setValue(e,t){e.innerText=t}static setStyle(e,t){for(let s of Object.entries(t))e.style.setProperty(s[0],s[1])}}class Kt extends ie{static get editing(){return!0}static createEdit(e,t,s,n){const r=f("input");return r.setAttribute("type","text"),typeof e=="function"&&r.addEventListener("change",e),r.addEventListener("input",()=>{n.__editing==null?n.__editing={[t.key]:!0}:n.__editing[t.key]=!0}),r}static setValue(e,t){e.tagName!=="INPUT"?super.setValue(e,t):e.value=t}static getValue(e){return e.target.value}static setEnabled(e,t){e.disabled=t===!1}}class Li extends Kt{static createEdit(e,t,s,n){const r=f("textarea");return typeof e=="function"&&r.addEventListener("change",e),r.addEventListener("input",()=>{n.__editing==null?n.__editing={[t.key]:!0}:n.__editing[t.key]=!0}),r}static setValue(e,t,s,n,r){if(e.tagName!=="TEXTAREA")super.setValue(e,t);else if(e.value=t,t!=null){const i=String(t).split(` +(function(k,T){typeof exports=="object"&&typeof module<"u"?T(exports):typeof define=="function"&&define.amd?define(["exports"],T):(k=typeof globalThis<"u"?globalThis:k||self,T(k["lib-ui"]={}))})(this,function(k){var N,j,H,z,K,we,Pe,ce,de,ue,Qe,ke,kt,Ce,Ct,ze,Rt,Ve,Ht,We,Ot,Me,$t,B,O,Le,M,b,Ee,Te,D,U,he,fe,se,G,Se,pe,Ne,A,De,Ae,Lt,ct,ii,dt,si,ut,ni,ye,Ze,ht,li,ft,ri,Fe,Pt,V,Y,ne,_e,ge,et,je,zt,Be,Vt,Xe,Wt,me,tt,pt,oi,Ye,Mt,Ke,Dt,yt,ai,gt,ci,mt,di,bt,ui,vt,hi,xt,fi,wt,pi,Ue,Ft,Ge,jt,Ie,Et,J,R,Q,X,te;"use strict";var Ri=Object.defineProperty;var Hi=Object.getPrototypeOf;var Oi=Reflect.get;var $i=(k,T,S)=>T in k?Ri(k,T,{enumerable:!0,configurable:!0,writable:!0,value:S}):k[T]=S;var E=(k,T,S)=>($i(k,typeof T!="symbol"?T+"":T,S),S),qt=(k,T,S)=>{if(!T.has(k))throw TypeError("Cannot "+S)};var o=(k,T,S)=>(qt(k,T,"read from private field"),S?S.call(k):T.get(k)),m=(k,T,S)=>{if(T.has(k))throw TypeError("Cannot add the same private member more than once");T instanceof WeakSet?T.add(k):T.set(k,S)},x=(k,T,S,f)=>(qt(k,T,"write to private field"),f?f.call(k,S):T.set(k,S),S);var p=(k,T,S)=>(qt(k,T,"access private method"),S),ti=(k,T,S)=>Oi(Hi(k),S,T);const T="",S="";function f(d,e,...t){const s=document.createElement(d);return typeof e=="function"?e(s):e!=null&&(s.className=e),t.length>0&&s.append(...t),s}const Bt="http://www.w3.org/2000/svg";function Tt(d,e){const t=typeof consts<"u"?consts:{},s=t.path||"",n=t.resver==null?"":`?${t.resver}`,r=document.createElementNS(Bt,"use");return r.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",`${s}fonts/${d}.svg${n}#${e}`),r}function qe(d,e,t){return d instanceof SVGElement&&d.replaceChildren(Tt(e,t)),d}function W(d,e,t){const s=document.createElementNS(Bt,"svg");if(s.appendChild(Tt(d,e)),t!=null)for(let n of Object.entries(t))s.style.setProperty(n[0],n[1]);return s}function yi(d){const e=d.querySelectorAll("svg[data-id]");for(let t of e){const s=t.dataset.type,n=t.dataset.id;t.replaceChildren(Tt(s,n)),t.removeAttribute("data-type"),t.removeAttribute("data-id")}return d}const Pi="";function it(d,e="fa-regular",t,s=-1,n="check"){d.appendChild(f("layer",r=>{r.className="ui-check-inner",r.addEventListener("keypress",i=>{if(i.key===" "||i.key==="Enter"){const l=d.querySelector("input");l!=null&&(l.checked=!l.checked,l.dispatchEvent(new Event("change")))}}),s>=0&&(r.tabIndex=s)},W(e,n))),t instanceof Element?d.appendChild(t):(t==null?void 0:t.length)>0&&d.appendChild(f("span",r=>r.innerText=t))}function gi(d={}){const e=f("label","ui-check-wrapper ui-radio-wrapper",f("input",t=>{if(t.setAttribute("type","radio"),t.name=d.name,d.checked===!0&&(t.checked=!0),d.enabled===!1&&(t.disabled=!0),d.customerAttributes!=null)for(let s of Object.entries(d.customerAttributes))t.setAttribute(s[0],s[1]);typeof d.onchange=="function"&&t.addEventListener("change",d.onchange)}));return d.className&&e.classList.add(d.className),it(e,d.type,d.label,d.tabIndex,"circle"),e}function le(d={}){const e=f("label","ui-check-wrapper",f("input",t=>{if(t.setAttribute("type","checkbox"),d.checked===!0&&(t.checked=!0),d.enabled===!1&&(t.disabled=!0),d.customerAttributes!=null)for(let s of Object.entries(d.customerAttributes))t.setAttribute(s[0],s[1]);typeof d.onchange=="function"&&t.addEventListener("change",d.onchange)}));return d.className&&e.classList.add(d.className),d.enabled===!1&&e.classList.add("disabled"),d.checkedNode!=null&&d.uncheckedNode!=null?(e.classList.add("ui-check-image-wrapper"),d.imageHeight,d.checkedNode.classList.add("checked"),e.appendChild(d.checkedNode),d.uncheckedNode.classList.add("unchecked"),e.appendChild(d.uncheckedNode)):it(e,d.type,d.label,d.tabIndex),e}function mi(d=document.body,e){if(e){const s=d.querySelectorAll('input[type="checkbox"]');for(let n of s){if(n.parentElement.classList.contains("ui-check-wrapper"))continue;const r=n.id;let i,l;if(r!=null&&(i=d.querySelector(`label[for="${r}"]`)),i==null){const a=n.nextElementSibling;a!=null&&(a.tagName==="LABEL"?i=a:a.tagName==="SPAN"&&a.dataset.lgid!=null&&(l=a.innerText,a.style.display="none"))}if(i==null){const a=n.previousElementSibling;a!=null&&(a.tagName==="LABEL"?i=a:l==null&&a.tagName==="SPAN"&&a.dataset.lgid!=null&&(l=a.innerText,a.style.display="none"))}i==null?(i=f("label"),n.parentElement.insertBefore(i,n)):l=i.innerText,n.disabled?i.className="ui-check-wrapper disabled":i.className="ui-check-wrapper",i.replaceChildren(),it(i,"fa-regular",l,n.tabIndex),i.insertBefore(n,i.firstChild)}}const t=d.querySelectorAll("label[data-checkbox]");for(let s of t){s.classList.contains("ui-check-wrapper")||s.classList.add("ui-check-wrapper"),s.hasChildNodes()?s.classList.contains("ui-check-image-wrapper")||s.classList.add("ui-check-image-wrapper"):(it(s,s.dataset.type,s.dataset.label,s.dataset.tabIndex),s.removeAttribute("data-type"),s.removeAttribute("data-label"));const n=f("input"),r=s.dataset.id;(r==null?void 0:r.length)>0&&(n.id=r),s.dataset.checked!=null&&(n.checked=!0),n.setAttribute("type","checkbox"),s.insertBefore(n,s.firstChild)}return d}const zi="";function St(d,e,t=!1,s=null){const n=s instanceof HTMLElement;if(n){const l=d.dataset.tipId,a=s.querySelector(`.ui-tooltip-wrapper[data-tip-id="${l}"]`);a==null||a.remove()}else{const l=d.querySelector(".ui-tooltip-wrapper");l==null||l.remove()}const r=f("div",l=>{l.className="ui-tooltip-wrapper ui-tooltip-color",l.style.visibility="hidden",l.style.opacity=0,l.style.top="0",l.style.left="0"},f("div","ui-tooltip-pointer ui-tooltip-color"),f("div","ui-tooltip-curtain ui-tooltip-color"),f("div",l=>{l.className="ui-tooltip-content",e instanceof Element?l.appendChild(e):l.innerText=e}));if(n){const l=String(Math.random()).substring(2);d.dataset.tipId=l,r.dataset.tipId=l,s.appendChild(r)}else d.appendChild(r);let i;return d.addEventListener("mouseenter",()=>{i&&clearTimeout(i);let l=d;for(;(l==null?void 0:l.offsetWidth)==null;)l=l.parentElement;l!=null&&(!t||l.scrollWidth>l.offsetWidth)&&(i=setTimeout(()=>{let a,c,u;if(c=l.offsetLeft,u=l.offsetTop,n)for(a=l.offsetParent;a!=null&&a!==s;)c+=a.offsetLeft,u+=a.offsetTop,a=a.offsetParent;a=l.parentElement;const y=l.offsetParent;for(;a!=null&&a!==(n?s:y);)c-=a.scrollLeft,u-=a.scrollTop,a=a.parentElement;c+=(l.offsetWidth-r.offsetWidth)/2,u-=r.offsetHeight+14,r.style.left=`${c}px`,r.style.top=`${u}px`,r.style.visibility="visible",r.style.opacity=1},100))}),d.addEventListener("mouseleave",()=>{i&&clearTimeout(i),i=setTimeout(()=>{r.style.visibility="hidden",r.style.opacity=0},300)}),d}function bi(d=document.body){const e=d.querySelectorAll("[title]");for(let t of e){const s=t.getAttribute("title");s!=null&&(t.removeAttribute("title"),St(t,s))}return d}const Vi="";function re(d){return d==null||typeof d!="string"||d.length===0}function vi(d,e,t){return re(d)||e==null?!1:(typeof e!="string"&&(e=String(e)),t?d.toLowerCase().indexOf(e.toLowerCase())>=0:d.indexOf(e)>=0)}function F(d,e){return e}let oe=typeof globalThis<"u"?globalThis:self;function Re(d){return!isNaN(d)&&d>0}function xi(){return/mobile/i.test(navigator.userAgent)}function ve(d,e=100,t=oe,...s){if(d==null)return;d.tiid&&clearTimeout(d.tiid);const n=new Date;d.tdate==null||n-d.tdate>e?(d.apply(t,s),d.tdate=n):d.tiid=setTimeout(()=>d.apply(t,s),e)}function wi(d){return(d>0?Math.floor:Math.ceil)(d)}const Xt=Symbol.for("ui-dropdown"),ki=26,Ci=30;let ae=oe[Xt];ae==null&&(ae={},Object.defineProperty(ae,"clear",{writable:!1,configurable:!1,enumerable:!1,value:function(){const d=document.querySelector(".ui-drop-wrapper .ui-drop-box.active");if(d==null)return;d.classList.remove("active");const e=d.parentElement.dataset.dropId;if(e==null)return;const t=this[e];t!=null&&t.multiselect&&typeof t.oncollapsed=="function"&&t.oncollapsed()}}),oe[Xt]=ae,document.addEventListener("mousedown",d=>{let e=d.target;for(;e!=null;){if(e.classList.contains("ui-drop-box")){d.stopPropagation();return}e=e.parentElement}ae.clear()}));function Yt(d,e,t,s){const n=e.map(r=>r[t]);if(n.some(r=>r instanceof HTMLElement))d.replaceChildren(...n.filter(r=>r!=null).map(r=>r.cloneNode(!0)));else{let r=e.map(i=>i[s]).join(", ");re(r)&&(r=F("noneItem","( None )")),d.innerText=r}}function Nt(d,e,t,s){return(!Array.isArray(d)||d.length===0)&&(d=[e]),t.length>0&&(s=s.filter(n=>{for(let r of d)if(vi(n[r].toLowerCase(),t))return!0;return!1})),s}const It=class{constructor(e={}){m(this,ue);m(this,ke);m(this,Ce);m(this,ze);m(this,N,void 0);m(this,j,void 0);m(this,H,void 0);m(this,z,void 0);m(this,K,void 0);m(this,we,void 0);m(this,Pe,void 0);m(this,ce,void 0);m(this,de,void 0);E(this,"sourceFilter");E(this,"onselectedlist");E(this,"onselected");E(this,"onexpanded");e.searchplaceholder??(e.searchplaceholder=F("searchHolder","Search...")),e.textkey??(e.textkey="text"),e.valuekey??(e.valuekey="value"),e.htmlkey??(e.htmlkey="html"),e.maxlength??(e.maxlength=500),x(this,N,e)}create(){const e=o(this,N),t=f("div","ui-drop-wrapper"),s=String(Math.random()).substring(2);t.dataset.dropId=s,ae[s]=this,x(this,j,t);const n=f("div","ui-drop-header");n.addEventListener("keypress",i=>{(i.key===" "||i.key==="Enter")&&n.dispatchEvent(new MouseEvent("click"))}),n.addEventListener("keydown",i=>{var c;const l=i.key==="ArrowUp",a=i.key==="ArrowDown";if(l||a){const u=this.source,y=u.length,w=o(this,N).valuekey;let h=u==null?void 0:u.indexOf(o(this,ce));isNaN(h)||h<-1?h=-1:h>=y&&(h=y-1),l?h>0?h--:h=0:a&&(h<0?h=0:h{if(this.disabled)return;const i=o(this,ue,Qe),l=o(this,z);i&&l.ownerDocument.activeElement===l||(p(this,ke,kt).call(this,!i),!i&&typeof this.onexpanded=="function"&&setTimeout(()=>this.onexpanded(),120))});let r;return e.input?(r=f("input","ui-drop-text"),r.setAttribute("type","text"),e.placeholder&&r.setAttribute("placeholder",e.placeholder),Re(e.maxlength)&&r.setAttribute("maxlength",e.maxlength),Re(e.tabIndex)&&r.setAttribute("tabindex",e.tabIndex),r.addEventListener("input",i=>{const l=i.target.value.toLowerCase(),a=Nt(e.searchkeys,e.textkey,l,this.source);p(this,Ce,Ct).call(this,a),o(this,H).classList.add("active")}),r.addEventListener("blur",i=>this.select(i.target.value)),r.addEventListener("mousedown",i=>o(this,ue,Qe)&&i.stopPropagation())):(Re(e.tabIndex)&&n.setAttribute("tabindex",e.tabIndex),r=f("label","ui-drop-text")),x(this,z,r),e.multiselect?Array.isArray(e.selectedlist)?this.selectlist(e.selectedlist,!0):(x(this,K,!0),r.innerText=F("allItem","( All )")):e.selected!=null&&this.select(e.selected,!0),n.append(r,f("label","ui-drop-caret")),t.appendChild(n),this.disabled=e.disabled||!1,t}get multiselect(){return o(this,N).multiselect}get disabled(){return o(this,j)==null||o(this,j).querySelector(".ui-drop-header.disabled")!=null}set disabled(e){o(this,j)!=null&&(e?o(this,j).querySelector(".ui-drop-header").classList.add("disabled"):o(this,j).querySelector(".ui-drop-header").classList.remove("disabled"))}get source(){let e=o(this,we);return(e==null||!Array.isArray(e))&&(typeof this.sourceFilter=="function"&&(e=this.sourceFilter()),Array.isArray(e)||(e=[]),x(this,we,e)),e}set source(e){Array.isArray(e)&&(x(this,we,e),o(this,ue,Qe)&&setTimeout(()=>p(this,ke,kt).call(this),120))}get selected(){return o(this,ce)}get selectedlist(){return o(this,de)||[]}select(e,t){if(o(this,Pe)===e)return!1;x(this,Pe,e);const s=o(this,N).valuekey,n=o(this,N).textkey,r=o(this,N).htmlkey;let i=this.source.find(l=>l[s]===e);if(o(this,N).input)i==null&&(i={[s]:e}),o(this,z).value=e;else{const l=o(this,ue,Qe);if(l&&o(this,H).querySelectorAll("li[data-value].selected").forEach(c=>c.classList.remove("selected")),i==null)return x(this,ce,null),o(this,z).innerText=" ",!1;const a=i[r];if(a instanceof HTMLElement)o(this,z).replaceChildren(a.cloneNode(!0));else{let c=i[n];re(c)&&(c=" "),o(this,z).innerText=c}if(l){const c=e.replace(/"/g,'\\"'),u=o(this,H).querySelector(`li[data-value="${c}"]`);u!=null&&u.classList.add("selected")}}x(this,ce,i),!t&&typeof this.onselected=="function"&&this.onselected(i)}selectlist(e,t){const s=this.source,n=o(this,N).valuekey,r=o(this,N).textkey,i=o(this,N).htmlkey,l=e.map(a=>{let c=s.find(u=>u[n]===a);return c==null&&(c={[n]:a,[r]:a}),c});if(l.length===0)return x(this,de,null),o(this,z).innerText=none,!1;Yt(o(this,z),l,i,r),x(this,de,l),!t&&typeof this.onselectedlist=="function"&&this.onselectedlist(l)}static resolve(e=document.body){const t=e.querySelectorAll("select");for(let s of t){const n=[...s.children].map(i=>({value:i.value,text:i.innerText})),r=new It({selected:s.value,disabled:s.disabled,tabIndex:s.tabIndex});r.source=n,s.parentElement.replaceChild(r.create(),s)}return e}};let st=It;N=new WeakMap,j=new WeakMap,H=new WeakMap,z=new WeakMap,K=new WeakMap,we=new WeakMap,Pe=new WeakMap,ce=new WeakMap,de=new WeakMap,ue=new WeakSet,Qe=function(){var e,t;return(t=(e=o(this,H))==null?void 0:e.classList)==null?void 0:t.contains("active")},ke=new WeakSet,kt=function(e=!0){const t=o(this,N);let s=o(this,H);if(s==null){if(s=f("div","ui-drop-box"),!t.input&&t.search){const r=f("div","ui-drop-search"),i=f("input");i.setAttribute("type","text"),Re(t.tabIndex)&&i.setAttribute("tabindex",t.tabIndex),!re(t.searchplaceholder)&&i.setAttribute("placeholder",t.searchplaceholder),i.addEventListener("input",l=>{const a=l.target.value.toLowerCase(),c=Nt(t.searchkeys,t.textkey,a,this.source);p(this,Ce,Ct).call(this,c)}),r.append(i,W("fa-light","search")),s.appendChild(r)}const n=f("ul","ui-drop-list");this.multiselect||n.addEventListener("click",r=>{let i=r.target;for(;i.tagName!=="LI";)if(i=i.parentElement,i==null)return;const l=i.dataset.value;this.select(l)!==!1&&ae.clear()}),s.appendChild(n),x(this,H,s),o(this,j).appendChild(s)}if(e){let n=this.source;if(!t.input&&t.search){const r=s.querySelector(".ui-drop-search > input");re(r==null?void 0:r.value)||(n=Nt(t.searchkeys,t.textkey,r.value,n))}if(p(this,Ce,Ct).call(this,n),!t.slidefixed){let r=t.parent??document.body,i=o(this,j),l=i.offsetTop;for(;(i=i.parentElement)!=null&&i!==r;)l-=i.scrollTop;l-r.offsetTop+ki+s.offsetHeight>=r.offsetHeight?s.classList.add("slide-up"):s.classList.remove("slide-up")}s.classList.add("active")}else s.classList.remove("active")},Ce=new WeakSet,Ct=function(e){const t=o(this,H).querySelector(".ui-drop-list");t.replaceChildren();const s=this.multiselect,n=o(this,K);s&&t.appendChild(f("li",null,le({label:F("allItem","( All )"),checked:n,customerAttributes:{isall:"1"},onchange:y=>p(this,ze,Rt).call(this,y.target)})));const r=o(this,N).valuekey,i=o(this,N).textkey,l=o(this,N).htmlkey,a=this.selected,c=this.selectedlist;let u;e.slice(0,200).forEach((y,w)=>{const h=y[r],g=f("li");g.dataset.value=h,g.setAttribute("title",y[i]);let C;const v=y[l];if(v instanceof HTMLElement&&(C=v),s){const $=c.some(_=>_[r]===h);C==null&&(C=f("span"),C.innerText=y[i]);const L=le({label:C,checked:n||$,customerAttributes:{class:"dataitem","data-value":h},onchange:_=>p(this,ze,Rt).call(this,_.target)});g.appendChild(L)}else C==null?g.innerText=y[i]:g.appendChild(C),a!=null&&a[r]===h&&(u=Ci*w,g.classList.add("selected"));t.appendChild(g)}),u!=null&&setTimeout(()=>t.scrollTop=u,10)},ze=new WeakSet,Rt=function(e){let t;const s=o(this,N).valuekey,n=o(this,N).textkey,r=o(this,N).htmlkey;if(e.getAttribute("isall")==="1"){const i=x(this,K,e.checked);o(this,H).querySelectorAll("input.dataitem").forEach(a=>a.checked=i),t=[]}else if(e.checked)if(o(this,H).querySelectorAll("input.dataitem:not(:checked)").length===0)x(this,K,!0),o(this,H).querySelector('input[isall="1"]').checked=!0,t=[];else{const i=this.source;t=[...o(this,H).querySelectorAll("input.dataitem:checked")].map(l=>i.find(a=>a[s]===l.dataset.value)).filter(l=>l!=null)}else{const i=e.dataset.value;o(this,K)?(x(this,K,!1),o(this,H).querySelector('input[isall="1"]').checked=!1,t=this.source.filter(l=>l[s]!==i)):t=this.selectedlist.filter(l=>l[s]!==i)}o(this,K)?o(this,z).innerText=F("allItem","( All )"):Yt(o(this,z),t,r,n),x(this,de,t),typeof this.onselectedlist=="function"&&this.onselectedlist(itemlist)};const Wi="";class ie{static create(){return f("span")}static setValue(e,t){e.innerText=t}static setStyle(e,t){for(let s of Object.entries(t))e.style.setProperty(s[0],s[1])}}class Kt extends ie{static get editing(){return!0}static createEdit(e,t,s,n){const r=f("input");return r.setAttribute("type","text"),typeof e=="function"&&r.addEventListener("change",e),r.addEventListener("input",()=>{n.__editing==null?n.__editing={[t.key]:!0}:n.__editing[t.key]=!0}),r}static setValue(e,t){e.tagName!=="INPUT"?super.setValue(e,t):e.value=t}static getValue(e){return e.target.value}static setEnabled(e,t){e.disabled=t===!1}}class Li extends Kt{static createEdit(e,t,s,n){const r=f("textarea");return typeof e=="function"&&r.addEventListener("change",e),r.addEventListener("input",()=>{n.__editing==null?n.__editing={[t.key]:!0}:n.__editing[t.key]=!0}),r}static setValue(e,t,s,n,r){if(e.tagName!=="TEXTAREA")super.setValue(e,t);else if(e.value=t,t!=null){const i=String(t).split(` `).length;e.style.height=`${i*r.lineHeight+12}px`}}}const Ei=Symbol.for("ui-dropdown"),_t=class extends ie{static createEdit(e,t,s){const n=new st({...t.dropOptions,parent:s});return n.onselected=e,n.create()}static setValue(e,t,s,n){if(e.tagName!=="DIV"){let i=p(this,We,Ot).call(this,s,n);i instanceof Promise?i.then(l=>p(this,Me,$t).call(this,l,e,t)):p(this,Me,$t).call(this,i,e,t);return}const r=p(this,Ve,Ht).call(this,e);if(r!=null){if(r.source==null||r.source.length===0){let i=p(this,We,Ot).call(this,s,n);if(i instanceof Promise){i.then(l=>{r.source=l,r.select(t,!0)});return}else i!=null&&(r.source=i)}r.select(t,!0)}}static getValue(e){return e.value}static setEnabled(e,t){const s=p(this,Ve,Ht).call(this,e);s!=null&&(s.disabled=t===!1)}};let xe=_t;Ve=new WeakSet,Ht=function(e){const t=oe[Ei];if(t==null)return null;const s=e.dataset.dropId,n=t[s];return n??null},We=new WeakSet,Ot=function(e,t){let s=t.source;return typeof s=="function"&&(s=s(e)),s},Me=new WeakSet,$t=function(e,t,s){const n=e==null?void 0:e.find(r=>r.value===s);n!=null&&(s=n.text),ti(_t,this,"setValue").call(this,t,s)},m(xe,Ve),m(xe,We),m(xe,Me);class At extends ie{static createEdit(e){return le({onchange:typeof e=="function"?e:null})}static setValue(e,t){e.querySelector("input").checked=t}static getValue(e){return e.target.checked}static setEnabled(e,t){e.querySelector("input").disabled=t===!1}}class Ti extends ie{static create(){return f("span","col-icon")}static setValue(e,t,s,n,r){let i=n.className;typeof i=="function"&&(i=i.call(n,s)),i==null?e.className="col-icon":e.className=`col-icon ${i}`;let l=n.iconType;if(typeof l=="function"&&(l=l.call(n,s)),l??(l="fa-regular"),e.dataset.type!==l||e.dataset.icon!==t){const a=W(l,t);e.replaceChildren(a),!re(n.tooltip)&&St(e,n.tooltip,!1,r.element),e.dataset.type=l,e.dataset.icon=t}}static setEnabled(e,t){t===!1?e.classList.add("disabled"):e.classList.remove("disabled");const s=e.querySelector(".ui-tooltip-wrapper");s!=null&&(s.style.display=t===!1?"none":"")}}const nt={Reorder:"reorder",Resize:"resize",Sort:"sort"},lt=xi()?32:0,Si=200,Ut=4,Gt=4,He=50,Jt=200;function rt(d){var t;return d==null?null:(d.touches&&((t=d.touches[0])==null?void 0:t.clientX))??d.clientX}function Ni(d){let e=0;for(;d!=null;)e+=d.offsetLeft,d=d.offsetParent;return e}function Oe(d){return Array.prototype.indexOf.call(d.parentElement.children,d)}const Ai={0:ie,1:Kt,2:xe,3:At,4:Ti,5:Li},Je=class{constructor(e){m(this,Ae);m(this,ct);m(this,dt);m(this,ut);m(this,ye);m(this,ht);m(this,ft);m(this,Fe);m(this,V);m(this,ne);m(this,ge);m(this,je);m(this,Be);m(this,Xe);m(this,me);m(this,pt);m(this,Ye);m(this,Ke);m(this,yt);m(this,gt);m(this,mt);m(this,bt);m(this,vt);m(this,xt);m(this,wt);m(this,Ue);m(this,Ge);m(this,Ie);m(this,B,void 0);m(this,O,void 0);m(this,Le,void 0);m(this,M,void 0);m(this,b,void 0);m(this,Ee,void 0);m(this,Te,-1);m(this,D,void 0);m(this,U,0);m(this,he,void 0);m(this,fe,void 0);m(this,se,void 0);m(this,G,-1);m(this,Se,void 0);m(this,pe,void 0);m(this,Ne,{});m(this,A,{});m(this,De,[]);E(this,"columns",[]);E(this,"langs",{all:F("allItem","( All )"),ok:F("ok","OK"),reset:F("reset","Reset")});E(this,"virtualCount",100);E(this,"rowHeight",36);E(this,"lineHeight",24);E(this,"extraRows",0);E(this,"filterRowHeight",30);E(this,"height");E(this,"readonly");E(this,"multiSelect",!1);E(this,"fullrowClick",!0);E(this,"allowHtml",!1);E(this,"holderDisabled",!1);E(this,"headerVisible",!0);E(this,"window",oe);E(this,"sortIndex",-1);E(this,"sortDirection",1);E(this,"willSelect");E(this,"selectedRowChanged");E(this,"cellDblClicked");E(this,"cellClicked");E(this,"rowDblClicked");E(this,"columnChanged");x(this,Le,e)}get element(){return o(this,M)}get source(){var e;return(e=o(this,B))==null?void 0:e.map(t=>t.values)}set source(e){if(o(this,M)==null)throw new Error("grid has not been initialized.");if(!Array.isArray(e))throw new Error("source is not an Array.");e=e.map(t=>({values:t})),x(this,B,e),p(this,Ae,Lt).call(this,e)}get virtual(){var e;return((e=o(this,O))==null?void 0:e.length)>this.virtualCount}get sortKey(){var e;return this.columns==null?null:(e=this.columns[this.sortIndex])==null?void 0:e.key}get selectedIndexes(){return o(this,D)}set selectedIndexes(e){const t=o(this,U);o(this,D).splice(0,o(this,D).length,...e),this.readonly!==!0?this.refresh():[...o(this,b).bodyContent.children].forEach((s,n)=>{e.indexOf(t+n)>=0?s.classList.add("selected"):s.classList.contains("selected")&&s.classList.remove("selected")}),typeof this.selectedRowChanged=="function"&&this.selectedRowChanged()}get selectedIndex(){return(o(this,D)&&o(this,D)[0])??-1}get loading(){var e,t;return((t=(e=o(this,b).loading)==null?void 0:e.style)==null?void 0:t.visibility)==="visible"}set loading(e){o(this,b).loading!=null&&(e===!1?(o(this,b).loading.style.visibility="hidden",o(this,b).loading.style.opacity=0):(o(this,b).loading.style.visibility="visible",o(this,b).loading.style.opacity=1))}get scrollTop(){var e;return(e=o(this,b).body)==null?void 0:e.scrollTop}set scrollTop(e){o(this,b).body!=null&&(o(this,b).body.scrollTop=e,this.reload())}init(e=o(this,Le)){if(x(this,M,null),x(this,b,{}),x(this,Ee,!0),!(e instanceof HTMLElement))throw new Error("no specified parent.");x(this,Le,e);const t=f("div","ui-grid");t.setAttribute("tabindex",0);const s=a=>{var y;let c=this.selectedIndex,u=!1;if(a.key==="ArrowUp")c>0&&(u=!0,c-=1);else if(a.key==="ArrowDown"){const w=((y=o(this,O))==null?void 0:y.length)??0;cve(s,800,this,a)),e.replaceChildren(t);const n=f("span","ui-grid-sizer");t.appendChild(n),o(this,b).sizer=n;const r=p(this,ct,ii).call(this);t.appendChild(r);const i=p(this,dt,si).call(this);t.appendChild(i);const l=f("div","ui-grid-loading",f("div",null,W("fa-regular","spinner-third")));o(this,b).loading=l,t.appendChild(l),x(this,M,t),x(this,Ee,!1),o(this,B)!=null&&this.sortIndex>=0&&this.sortColumn()}scrollToIndex(e){const t=p(this,Fe,Pt).call(this,e*(this.rowHeight+1),!0);o(this,b).body.scrollTop=t}resize(e){if(o(this,Ee)||o(this,M)==null)return;const t=o(this,b).body,s=this.headerVisible===!1?0:o(this,b).header.offsetHeight;let n=this.height;n===0?n=o(this,fe):(isNaN(n)||n<0)&&(n=o(this,M).offsetHeight-s);const r=wi((n-1)/(this.rowHeight+1))+Ut*2+1;(e||r!==o(this,G))&&(x(this,G,r),this.reload()),x(this,se,t.clientWidth)}reload(){let e=o(this,O).length;this.extraRows>0&&(e+=this.extraRows),x(this,fe,e*(this.rowHeight+1)),o(this,b).body.scrollTop=0,o(this,b).body.scrollLeft=0,o(this,b).bodyContent.style.top="0px",o(this,b).bodyContainer.style.height=`${o(this,fe)}px`,this.refresh()}refresh(){if(o(this,b).bodyContent==null)throw new Error("body has not been created.");const e={};p(this,ut,ni).call(this,e),o(this,he)&&e.flag&&(x(this,he,!1),this.columns.forEach((t,s)=>{if(!p(this,V,Y).call(this,t.key,"autoResize"))return;let n=e[s];n0&&p(this,ye,Ze).call(this,s,n)}))}resetChange(){if(o(this,B)!=null)for(let e of o(this,B))delete e.__changed}sortColumn(e){const t=this.sortIndex,s=this.columns[t];if(s==null)return;const n=this.sortDirection;[...o(this,b).header.children].forEach((i,l)=>{const a=i.querySelector(".arrow");a!=null&&(l===t?a.className=`arrow ${n!==1?"desc":"asc"}`:a.className!=="arrow"&&(a.className="arrow"))});let r;if(typeof s.sortFilter!="function"){const i=this.sortDirection;isNaN(i)&&(i=1),r=(l,a)=>{if(l=p(this,ge,et).call(this,l.values,s.key,s.filter),a=p(this,ge,et).call(this,a.values,s.key,s.filter),l==null&&typeof a=="number")l=0;else if(typeof l=="number"&&a==null)a=0;else{if(l!=null&&a==null)return i;typeof l=="string"&&typeof a=="string"&&(l=l.toLowerCase(),a=a.toLowerCase())}return l===a?0:(l>a?1:-1)*i}}else r=(i,l)=>s.sortFilter(i.values,l.values)*n;o(this,B).sort(r),o(this,A).__filtered===!0&&o(this,O).sort(r),!(o(this,G)<0)&&(e?this.reload():this.refresh())}};let $e=Je;B=new WeakMap,O=new WeakMap,Le=new WeakMap,M=new WeakMap,b=new WeakMap,Ee=new WeakMap,Te=new WeakMap,D=new WeakMap,U=new WeakMap,he=new WeakMap,fe=new WeakMap,se=new WeakMap,G=new WeakMap,Se=new WeakMap,pe=new WeakMap,Ne=new WeakMap,A=new WeakMap,De=new WeakMap,Ae=new WeakSet,Lt=function(e){e??(e=o(this,B)),o(this,A).__filtered===!0?x(this,O,e.filter(t=>{for(let s of this.columns)if(Array.isArray(s.filterValues)){const n=p(this,ge,et).call(this,t.values,s.key,s.filter);if(s.filterValues.indexOf(n)<0)return!1}return!0})):x(this,O,e),x(this,Te,-1),x(this,D,[]),x(this,U,0),x(this,Se,0),x(this,pe,0),x(this,G,-1),this.sortIndex>=0&&this.sortColumn(),this.resize()},ct=new WeakSet,ii=function(){const e=f("table","ui-grid-header");this.headerVisible===!1&&(e.style.display="none");const t=f("tr");e.appendChild(t);const s=o(this,b).sizer;for(let i of this.columns){if(i.visible===!1){const h=f("th");h.style.display="none",i.sortable!==!1&&(h.dataset.key=i.key,h.addEventListener("click",g=>p(this,Xe,Wt).call(this,g,i,!0))),t.appendChild(h);continue}const l=Je.ColumnTypes.isCheckbox(i.type);if(!(i.width>0)){p(this,ne,_e).call(this,i.key,"autoResize",!0),x(this,he,!0),s.innerText=i.caption??"";let h=s.offsetWidth+22;!this.readonly&&i.enabled!==!1&&i.allcheck&&l&&(h+=32),i.allowFilter===!0&&(h+=14),hp(this,Xe,Wt).call(this,h,i))),i.orderable!==!1&&(i.orderable=!0,u.addEventListener("mousedown",h=>p(this,gt,ci).call(this,h,i)));const y=f("div");if(u.appendChild(y),!this.readonly&&i.enabled!==!1&&i.allcheck&&l){const h=le({onchange:g=>p(this,vt,hi).call(this,i,g.target.checked)});y.appendChild(h)}const w=f("span");if(i.textStyle!=null)for(let h of Object.entries(i.textStyle))w.style.setProperty(h[0],h[1]);if(w.innerText=i.caption??"",y.appendChild(w),i.sortable&&u.appendChild(f("layer","arrow")),i.allowFilter===!0){const h=f("layer","filter");h.appendChild(W("fa-solid","filter")),h.addEventListener("mousedown",g=>p(this,pt,oi).call(this,g,i)),u.classList.add("header-filter"),u.appendChild(h)}if(i.resizable!==!1){const h=f("layer","spliter");h.addEventListener("mousedown",g=>p(this,mt,di).call(this,g,i)),h.addEventListener("dblclick",g=>p(this,bt,ui).call(this,g,i)),u.appendChild(h)}t.appendChild(u)}const n=f("div","dragger"),r=f("layer","dragger-cursor");return t.appendChild(f("th",null,n,r)),s.replaceChildren(),o(this,b).header=t,o(this,b).dragger=n,o(this,b).draggerCursor=r,e},dt=new WeakSet,si=function(){const e=f("div","ui-grid-body");e.addEventListener("scroll",i=>ve(p(this,xt,fi),lt,this,i),{passive:!0});const t=this.columns;let s=1;for(let i of t)i.visible!==!1&&!isNaN(i.width)&&(s+=i.width+1);const n=f("div");n.style.position="relative",n.style.minWidth="100%",n.style.minHeight="1px",s>0&&(n.style.width=`${s}px`),e.appendChild(n);const r=f("table","ui-grid-body-content");if(r.addEventListener("mousedown",i=>{let[l,a]=p(this,je,zt).call(this,i.target);const c=Oe(l);let u=Oe(a);u>=this.columns.length&&(u=-1),p(this,Ue,Ft).call(this,i,c,u)}),r.addEventListener("dblclick",i=>p(this,Ge,jt).call(this,i)),n.appendChild(r),!this.holderDisabled){const i=f("div","ui-grid-hover-holder");i.addEventListener("mousedown",l=>{const a=l.currentTarget,c=Number(a.dataset.row),u=Number(a.dataset.col);return a.classList.contains("active")&&a.classList.remove("active"),p(this,Ue,Ft).call(this,l,c+o(this,U),u)}),i.addEventListener("dblclick",l=>p(this,Ge,jt).call(this,l)),n.appendChild(i),e.addEventListener("mousemove",l=>ve(p(this,wt,pi),Si,this,l,i),{passive:!0})}return o(this,b).body=e,o(this,b).bodyContainer=n,o(this,b).bodyContent=r,e},ut=new WeakSet,ni=function(e){let t=o(this,G);(isNaN(t)||t<0||!this.virtual)&&(t=o(this,O).length);const s=o(this,b).bodyContent,n=this.columns,r=o(this,De),i=[],l=o(this,U);for(let c=0;cw.index===u);y>=0&&(i[c]=r.splice(y,1)[0])}for(let c=0;c0)w={...y[0],index:u,mode:"move"},w.el.remove();else{const h=f("tr","ui-grid-row");n.forEach((g,C)=>{const v=f("td");if(g.visible!==!1){v.dataset.col=String(C);const $=p(this,V,Y).call(this,g.key,"style");if($!=null)for(let L of Object.entries($))v.style.setProperty(L[0],L[1]);if(g.css!=null)for(let L of Object.entries(g.css))v.style.setProperty(L[0],L[1]);if(Je.ColumnTypes.isCheckbox(g.type))v.appendChild(At.createEdit(L=>p(this,Ie,Et).call(this,L,exists+c,g,L.target.checked)));else{let L=o(this,Ne)[g.key];L==null&&(isNaN(g.type)?this.allowHtml&&g.type!=null&&(L=g.type):L=Ai[g.type],L??(L=ie),o(this,Ne)[g.key]=L),v.appendChild(L.create(g))}}h.appendChild(v)}),h.appendChild(f("td")),w={index:u,mode:"create",el:h}}i[c]=w}x(this,De,i);const a=o(this,D);i.filter(c=>c.mode!=null).forEach(c=>{const u=c.el,y=c.index,w=o(this,O)[y];if(w==null||!Re(u.children.length))return;const h=w.values,g=a.indexOf(y)>=0;g?u.classList.add("selected"):u.classList.contains("selected")&&u.classList.remove("selected");const C=w.__selected^g;g?w.__selected=!0:delete w.__selected,n.forEach((v,$)=>{var Zt;if(v.visible===!1)return;let L;v.text!=null?L=v.text:typeof v.filter=="function"?L=v.filter(h):(L=h[v.key],(L==null?void 0:L.displayValue)!=null&&(L=L.displayValue)),L??(L="");const _=u.children[$];if(_.dataset.row=String(y),typeof v.bgFilter=="function"){const I=v.bgFilter(h);_.style.backgroundColor=I??""}const be=Je.ColumnTypes.isCheckbox(v.type),P=be?At:o(this,Ne)[v.key]??ie;let Z;!be&&C&&typeof P.createEdit=="function"?((Zt=w.__editing)!=null&&Zt[v.key]&&P.editing&&(L=P.getValue({target:_.children[0]}),p(this,Ie,Et).call(this,null,y,v,L,!0)),Z=g?P.createEdit(I=>p(this,Ie,Et).call(this,I,y,v,P.getValue(I)),v,o(this,b).bodyContent,w):P.create(v),_.replaceChildren(Z)):Z=_.children[0];let ee;if(this.readonly?ee=!1:(ee=v.enabled,typeof ee=="function"?ee=ee.call(v,h):typeof ee=="string"&&(ee=h[ee])),P.setValue(Z,L,h,v,this),typeof P.setEnabled=="function"&&P.setEnabled(Z,ee),o(this,he)&&p(this,V,Y).call(this,v.key,"autoResize")){const I=Z.scrollWidth+12;I>0&&e!=null&&(isNaN(e[$])||e[$]c.el))},ye=new WeakSet,Ze=function(e,t){const s=this.columns[e],n=`${t}px`;s.width=t;const r=p(this,V,Y).call(this,s.key,"style");r.width=n,r["max-width"]=n,r["min-width"]=n;let i=o(this,b).header.children[e];i.style.width=n,i.style.maxWidth=n,i.style.minWidth=n;const l=o(this,b).bodyContent;for(let a of l.children)i=a.children[e],i!=null&&(i.style.width=n,i.style.maxWidth=n,i.style.minWidth=n)},ht=new WeakSet,li=function(e,t,s,n){const r=o(this,b).header.children;let i=r[e];o(this,b).dragger.style.left=`${i.offsetLeft-n+t}px`,o(this,b).dragger.style.width=i.style.width,o(this,b).dragger.style.display="block",t=s-Ni(i);let l;if(t<0){t=-t;for(let a=e-1;a>=0&&t>=0&&(i=r[a],!(i==null||i.className!=="column"));a-=1){if(ti.offsetWidth/2?a:a+1;break}t-=i.offsetWidth}l??(l=0)}else{const a=r.length;for(let c=e;c=0;c+=1){if(i=r[c],i==null||i.className!=="column"){l=c;break}if(ti.offsetWidth/2?c+1:c;break}t-=i.offsetWidth}l??(l=a-1)}if(l!==o(this,A).__orderIndex){if(o(this,A).__orderIndex=l,i=r[l],i==null)return;o(this,b).draggerCursor.style.left=`${i.offsetLeft-n}px`,o(this,b).draggerCursor.style.display="block"}},ft=new WeakSet,ri=function(e){o(this,b).dragger.style.display="",o(this,b).draggerCursor.style.display="";const t=o(this,A).__orderIndex;if(t>=0&&t!==e){let s=t-e;if(s>=0&&s<=1)return;const n=o(this,b).header,r=n.children,i=o(this,b).bodyContent.children,l=this.columns;if(s>1){s=t-1;const a=l.splice(e,1)[0];l.splice(s,0,a),n.insertBefore(r[e],r[s].nextElementSibling);for(let c of i)c.insertBefore(c.children[e],c.children[s].nextElementSibling)}else{s=t;const a=l.splice(e,1)[0];l.splice(s,0,a),n.insertBefore(r[e],r[s]);for(let c of i)c.insertBefore(c.children[e],c.children[s])}[...r].forEach((a,c)=>{const u=a.querySelector(".arrow");u!=null&&u.className!=="arrow"&&(this.sortIndex=c)}),typeof this.columnChanged=="function"&&this.columnChanged(nt.Reorder,e,s)}},Fe=new WeakSet,Pt=function(e,t){const s=this.rowHeight+1;if(e-=e%(s*2)+Ut*s,e<0)e=0;else{let n=o(this,fe)-(t?0:o(this,G)*s);n<0&&(n=0),e>n&&(e=n)}return o(this,Se)!==e?(x(this,Se,e),this.virtual&&x(this,U,e/s),this.refresh(),this.virtual&&(o(this,b).bodyContent.style.top=`${e}px`)):t&&this.refresh(),e},V=new WeakSet,Y=function(e,t){const s=o(this,A)[e];return s==null?null:s[t]},ne=new WeakSet,_e=function(e,t,s){const n=o(this,A)[e];n==null?o(this,A)[e]={[t]:s}:n[t]=s},ge=new WeakSet,et=function(e,t,s){let n;return typeof s=="function"?n=s(e):n=e[t],(n==null?void 0:n.value)??n},je=new WeakSet,zt=function(e){let t;for(;(t=e.parentElement)!=null&&!t.classList.contains("ui-grid-row");)e=t;return[t,e]},Be=new WeakSet,Vt=function(e){return/^(input|label|layer|svg|use)$/i.test(e)},Xe=new WeakSet,Wt=function(e,t,s){if(!(!s&&(p(this,V,Y).call(this,t.key,"resizing")||p(this,V,Y).call(this,t.key,"dragging")))&&!p(this,Be,Vt).call(this,e.target.tagName)){const n=this.columns.indexOf(t);if(n<0)return;this.sortIndex===n?this.sortDirection=this.sortDirection===1?-1:1:this.sortIndex=n,this.sortColumn(!0),typeof this.columnChanged=="function"&&this.columnChanged(nt.Sort,n,this.sortDirection)}},me=new WeakSet,tt=function(){const e=o(this,M).querySelectorAll(".filter-panel.active");if(e.length>0){e.forEach(s=>s.classList.remove("active")),setTimeout(()=>o(this,M).querySelectorAll(".filter-panel").forEach(s=>s.remove()),120);const t=o(this,A).__filtering;return t instanceof HTMLElement&&t.classList.remove("hover"),delete o(this,A).__filtering,!0}return!1},pt=new WeakSet,oi=function(e,t){if(p(this,me,tt).call(this))return;const s=h=>{h.target.tagName==="LAYER"&&h.target.classList.contains("filter")||h.target.tagName==="use"||p(this,me,tt).call(this)&&document.removeEventListener("mousedown",s)};document.addEventListener("mousedown",s);const n=f("div","filter-panel");n.addEventListener("mousedown",h=>h.stopPropagation());const r=e.currentTarget,i=r.parentElement,l=i.offsetWidth;n.style.top=`${i.offsetHeight}px`,n.style.left=i.offsetLeft+(l>Jt?l-Jt:0)+"px";let a;if(t.allowSearch!==!1){const h=f("div","filter-search-holder");a=f("input","filter-search-box ui-text"),a.type="text";const g=W("fa-regular","search");g.addEventListener("mousedown",C=>{a.focus(),C.preventDefault()}),h.append(a,g),n.append(h)}const c=f("div","filter-item-list");c.addEventListener("scroll",h=>ve(p(this,yt,ai),lt,this,t,c,h.target.scrollTop),{passive:!0});const u=f("div","filter-item filter-all");u.appendChild(le({label:this.langs.all,onchange:h=>{const g=h.target.checked;c.querySelectorAll(".filter-content input").forEach(C=>C.checked=g)}})),c.appendChild(u);let y;if(Array.isArray(t.filterSource))y=t.filterSource;else if(typeof t.filterSource=="function")y=t.filterSource.call(this,t);else{const h=Object.create(null);for(let g of o(this,B)){const C=p(this,ge,et).call(this,g.values,t.key,t.filter);if(!Object.hasOwnProperty.call(h,C)){const v=g.values[t.key];h[C]={value:C,displayValue:typeof t.filter=="function"?t.filter(g.values):(v==null?void 0:v.displayValue)??v}}}y=Object.values(h).sort((g,C)=>(g=(g==null?void 0:g.value)??g,C=(C==null?void 0:C.value)??C,g>C?1:gObject.prototype.hasOwnProperty.call(h,"value")&&Object.prototype.hasOwnProperty.call(h,"displayValue")?h:{value:h,displayValue:h??""}),p(this,Ye,Mt).call(this,t,c,y,u),u.querySelector("input").checked=![...c.querySelectorAll(".filter-content input")].some(h=>!h.checked),n.appendChild(c),a!=null&&a.addEventListener("input",h=>{const g=h.currentTarget.value.toLowerCase(),C=g.length===0?y:y.filter(v=>{const $=(v==null?void 0:v.displayValue)??v;return String($??"").indexOf(g)>=0});p(this,Ye,Mt).call(this,t,c,C,u)});const w=f("div","filter-function");w.append(f("button",h=>{h.innerText=this.langs.ok,h.addEventListener("click",()=>{const g=p(this,V,Y).call(this,t.key,"filterSource").filter(C=>C.__checked!==!1);typeof t.onFilterOk=="function"?t.onFilterOk.call(this,t,g):t.filterValues=g.map(C=>C.value),o(this,A).__filtered=!0,p(this,Ae,Lt).call(this),typeof t.onFiltered=="function"&&t.onFiltered.call(this,t),r.classList.add("active"),p(this,me,tt).call(this)})}),f("button",h=>{h.innerText=this.langs.reset,h.addEventListener("click",()=>{delete t.filterValues,o(this,A).__filtered=this.columns.some(g=>t.filterValues!=null),p(this,Ae,Lt).call(this),typeof t.onFiltered=="function"&&t.onFiltered.call(this,t),r.classList.remove("active"),p(this,me,tt).call(this)})})),n.appendChild(w),o(this,M).appendChild(n),setTimeout(()=>n.classList.add("active"),0),o(this,A).__filtering=r,r.classList.add("hover")},Ye=new WeakSet,Mt=function(e,t,s,n){var c,u;(c=t.querySelector(".filter-holder"))==null||c.remove(),(u=t.querySelector(".filter-content"))==null||u.remove();const r=this.filterRowHeight,i=s.length*r;p(this,ne,_e).call(this,e.key,"filterHeight",i);const l=f("div","filter-holder");l.style.height=`${i}px`;const a=f("div","filter-content");a.style.top=`${r}px`,p(this,ne,_e).call(this,e.key,"filterSource",s);for(let y of s)y.__checked=!Array.isArray(e.filterValues)||e.filterValues.indexOf(y.value??y)>=0;s.length>12&&(s=s.slice(0,12)),p(this,Ke,Dt).call(this,a,s,n),t.append(l,a)},Ke=new WeakSet,Dt=function(e,t,s){for(let n of t){const r=f("div","filter-item");r.appendChild(le({checked:n.__checked,label:(n==null?void 0:n.displayValue)??n,onchange:i=>{n.__checked=i.target.checked,s.querySelector("input").checked=![...e.querySelectorAll("input")].some(l=>!l.checked)}})),e.appendChild(r)}},yt=new WeakSet,ai=function(e,t,s){const n=this.filterRowHeight;if(s-=s%(n*2)+n,s<0)s=0;else{let r=p(this,V,Y).call(this,e.key,"filterHeight")-12*n;r<0&&(r=0),s>r&&(s=r)}if(p(this,V,Y).call(this,e.key,"filterTop")!==s){p(this,ne,_e).call(this,e.key,"filterTop",s);const r=s/n;let i=p(this,V,Y).call(this,e.key,"filterSource");r+12input")),l.style.top=`${s+n}px`}},gt=new WeakSet,ci=function(e,t){if(p(this,Be,Vt).call(this,e.target.tagName))return;const s=rt(e),n=Oe(e.currentTarget),r=c=>{for(let u of["mousemove","mouseup"])c.hasOwnProperty(u)&&(window.removeEventListener(u,c[u]),delete c[u])};let i=o(this,A)[t.key];i==null?i=o(this,A)[t.key]={}:r(i),i.dragging=!0;const l=o(this,b).header.querySelector("th:last-child").offsetLeft,a=c=>{const u=rt(c),y=u-s;let w=i.offset,h;(w==null&&(y>Gt||y<-Gt)||w!==y)&&(h=!0),h&&(p(this,ht,li).call(this,n,y,u,l),i.offset=y)};i.mousemove=c=>ve(a,lt,this,c),i.mouseup=()=>{r(i),i.offset==null?delete i.dragging:(setTimeout(()=>{delete i.dragging,delete i.offset}),p(this,ft,ri).call(this,n))},["mousemove","mouseup"].forEach(c=>window.addEventListener(c,i[c]))},mt=new WeakSet,di=function(e,t){const s=rt(e),n=t.width,r=Oe(e.currentTarget.parentElement),i=this.window??oe,l=u=>{for(let y of["mousemove","mouseup"])u.hasOwnProperty(y)&&(i.removeEventListener(y,u[y]),delete u[y])};let a=o(this,A)[t.key];a==null?a=o(this,A)[t.key]={}:l(a),a.resizing=n;const c=u=>{const y=rt(u),w=n+(y-s);wve(c,lt,this,u),a.mouseup=u=>{l(a);const y=a.resizing;y!=null&&(setTimeout(()=>delete a.resizing),a.sizing&&(delete a.sizing,delete a.autoResize,p(this,ye,Ze).call(this,r,y),typeof this.columnChanged=="function"&&this.columnChanged(nt.Resize,r,y))),u.stopPropagation(),u.preventDefault()},["mousemove","mouseup"].forEach(u=>i.addEventListener(u,a[u]))},bt=new WeakSet,ui=function(e,t){const s=e.currentTarget.parentElement,n=Oe(s);let r=s.querySelector("div:first-child").scrollWidth;for(let i of o(this,b).bodyContent.children){const a=i.children[n].children[0].scrollWidth;a>r&&(r=a)}r0&&r!==t.width&&(r+=12,p(this,ye,Ze).call(this,n,r),typeof this.columnChanged=="function"&&this.columnChanged(nt.Resize,n,r))},vt=new WeakSet,hi=function(e,t){if(o(this,O)==null)return;const s=e.key,n=typeof e.enabled=="function",r=typeof e.enabled=="string";if(typeof e.onallchecked=="function")e.onallchecked.call(this,e,t);else{for(let i of o(this,O)){const l=i.values;if(l==null)continue;(n?e.enabled(l):r?l[e.enabled]:e.enabled)!==!1&&(l[s]=t,i.__changed=!0,typeof e.onchanged=="function"&&e.onchanged.call(this,l,t))}this.refresh()}},xt=new WeakSet,fi=function(e){const t=e.target.scrollLeft;if(o(this,pe)!==t&&(x(this,pe,t),o(this,b).header.style.left=`${-t}px`),!this.virtual)return;const s=e.target.scrollTop;p(this,Fe,Pt).call(this,s)},wt=new WeakSet,pi=function(e,t){if(e.target.classList.contains("ui-grid-hover-holder"))return;let[s,n]=p(this,je,zt).call(this,e.target);if(s==null){delete t.dataset.row,delete t.dataset.col,t.classList.contains("active")&&t.classList.remove("active");return}const r=n.children[0];if((r==null?void 0:r.tagName)!=="SPAN"){t.classList.contains("active")&&(delete t.dataset.row,delete t.dataset.col,t.classList.remove("active"));return}const i=n.dataset.row,l=n.dataset.col;if(!(t.dataset.row===i&&t.dataset.col===l))if(r.scrollWidth>r.offsetWidth){t.dataset.row=i,t.dataset.col=l,t.innerText=r.innerText;const a=o(this,b).bodyContent.offsetTop+n.offsetTop;let c=n.offsetLeft,u=t.offsetWidth;u>o(this,se)&&(u=o(this,se));const y=o(this,se)+o(this,pe)-u;c>y&&(c=y);const w=n.offsetHeight;t.style.cssText=`top: ${a}px; left: ${c}px; max-width: ${o(this,se)}px; height: ${w-2}px`,t.classList.add("active")}else t.classList.contains("active")&&(delete t.dataset.row,delete t.dataset.col,t.classList.remove("active"))},Ue=new WeakSet,Ft=function(e,t,s){const n=o(this,U),r=n+t;if(typeof this.willSelect=="function"&&!this.willSelect(r,s))return;let i=!1;const l=o(this,D);if(this.multiSelect){if(e.ctrlKey){const a=l.indexOf(r);a<0?l.push(r):l.splice(a,1),i=!0}else if(e.shiftKey&&l.length>0&&(l.length>1||l[0]!==r)){let a=l[l.length-1],c;a>r?(c=a,a=r):c=r,l.splice(0);for(let u=a;u<=c;u+=1)l.push(u);i=!0}}(!i&&l.length!==1||l[0]!==r)&&(l.splice(0,l.length,r),i=!0),i&&(this.readonly!==!0?this.refresh():[...o(this,b).bodyContent.children].forEach((a,c)=>{l.indexOf(n+c)>=0?a.classList.add("selected"):a.classList.contains("selected")&&a.classList.remove("selected")}),typeof this.selectedRowChanged=="function"&&this.selectedRowChanged(r)),x(this,Te,s),(this.fullrowClick||s>=0)&&e.buttons===1&&typeof this.cellClicked=="function"&&this.cellClicked(r,s)===!1&&(e.stopPropagation(),e.preventDefault())},Ge=new WeakSet,jt=function(e){if(e.target.tagName==="INPUT"||e.target.tagName==="TEXTAREA"||e.target.tagName==="LAYER"&&e.target.className==="ui-check-inner"||e.target.tagName==="LABEL"&&(e.target.className==="ui-drop-text"||e.target.className==="ui-drop-caret"))return;const t=this.selectedIndex;if(typeof this.rowDblClicked=="function"&&this.rowDblClicked(t),typeof this.cellDblClicked=="function"){const s=o(this,Te);(this.fullrowClick||s>=0)&&this.cellDblClicked(t,s)}},Ie=new WeakSet,Et=function(e,t,s,n,r){if(o(this,O)==null)return;const i=o(this,O)[o(this,U)+t],l=i.values;if(l==null)return;let a=s.enabled;typeof a=="function"?a=a.call(s,l):typeof a=="string"&&(a=l[a]),a!==!1&&(l[s.key]=n,i.__changed=!0,r?typeof s.oneditend=="function"&&s.oneditend.call(this,l,n):typeof s.onchanged=="function"&&s.onchanged.call(this,l,n))},E($e,"ColumnTypes",{Common:0,Input:1,Dropdown:2,Checkbox:3,Icon:4,Text:5,isCheckbox(e){return e===3}}),E($e,"GridColumn",ie);const Mi="",q={right:1,bottom:2,left:4,top:8,bottomRight:3,bottomLeft:6,topRight:9,topLeft:12};function ot(d){if(typeof d!="string")return d;if(d.endsWith("px")){const e=Number(d.substring(0,d.length-2));return isNaN(e)?d:e}return d}class at{constructor(e={}){m(this,X);m(this,J,void 0);m(this,R,void 0);m(this,Q,void 0);x(this,R,e)}get container(){return o(this,J).querySelector(".ui-popup-container")}get rect(){const e=this.container;if(e==null)return null;const t=oe.getComputedStyle(e),s=e.classList.contains("ui-popup-collapse"),n=o(this,Q);return{collapsed:s,left:ot(t.left),top:ot(t.top),width:s===!0&&n!=null?n.width:ot(t.width),height:s===!0&&n!=null?n.height:ot(t.height)}}set rect(e){const t=this.container;if(t==null)return;const s=[];isNaN(e.left)||s.push(`left: ${e.left}px`),isNaN(e.top)||s.push(`top: ${e.top}px`);const n=t.querySelector(".ui-popup-header>.icon-expand");e.collapsed===!0?(s.push("width: 160px","height: 40px"),x(this,Q,e),t.classList.add("ui-popup-collapse"),n!=null&&qe(n,"fa-regular","expand-alt")):(!isNaN(e.width)&&e.width>0&&s.push(`width: ${e.width}px`),!isNaN(e.height)&&e.height>0&&s.push(`height: ${e.height}px`),t.classList.remove("ui-popup-collapse"),x(this,Q,null),n!=null&&qe(n,"fa-regular","compress-alt")),s.length>0&&(t.style.cssText+=s.join("; "))}create(){const e=f("div","ui-popup-mask");o(this,R).mask===!1&&e.classList.add("ui-popup-transparent");const t=f("div","ui-popup-container");let s=Math.max.apply(null,[...document.querySelectorAll("[tabindex]")].map(i=>i.tabIndex??0));s<0&&(s=0),t.tabIndex=s+1;const n=()=>{e.classList.add("ui-popup-active"),e.style.opacity=0,setTimeout(()=>e.remove(),120)};let r=o(this,R).content;if(r instanceof HTMLElement||(r=f("div",i=>i.innerText=r)),t.append(f("div",i=>{i.className="ui-popup-header";let l=o(this,R).title;if(l instanceof HTMLElement||(l=f("div",c=>{c.className="ui-popup-header-title",c.innerText=l})),i.appendChild(l),o(this,R).movable!==!1&&(l.querySelector(".ui-popup-move")??l).addEventListener("mousedown",u=>{const y=u.clientX-t.offsetLeft,w=u.clientY-t.offsetTop;let h;const g=v=>{t.style.left=`${v.clientX-y}px`,t.style.top=`${v.clientY-w}px`,h=!0};e.addEventListener("mousemove",g,{passive:!1});const C=()=>{e.removeEventListener("mousemove",g,{passive:!1}),e.removeEventListener("mouseup",C),h===!0&&typeof o(this,R).onMoveEnded=="function"&&o(this,R).onMoveEnded.call(this),h=!1};e.addEventListener("mouseup",C)}),o(this,R).collapsable===!0){const c=W("fa-regular","compress-alt");c.tabIndex=s+2,c.classList.add("icon-expand"),c.addEventListener("keypress",u=>{(u.key===" "||u.key==="Enter")&&c.dispatchEvent(new MouseEvent("click"))}),c.addEventListener("click",()=>{if(t.classList.contains("ui-popup-collapse")){const u=o(this,Q);u!=null&&(t.style.cssText+=`width: ${u.width}px; height: ${u.height}px`,x(this,Q,null)),t.classList.remove("ui-popup-collapse"),qe(c,"fa-regular","compress-alt")}else{const u=this.rect;x(this,Q,u),t.style.cssText+="width: 160px; height: 40px",t.classList.add("ui-popup-collapse"),qe(c,"fa-regular","expand-alt")}}),i.appendChild(c)}const a=W("fa-regular","times");a.tabIndex=s+3,a.addEventListener("keypress",c=>{(c.key===" "||c.key==="Enter")&&n()}),a.addEventListener("click",()=>n()),i.appendChild(a)}),f("div","ui-popup-body",r,f("div","ui-popup-loading",f("div",null,W("fa-regular","spinner-third"))))),Array.isArray(o(this,R).buttons)){s=Math.max.apply(null,[...t.querySelectorAll("[tabindex]")].map(u=>u.tabIndex??0)),t.appendChild(f("div","ui-popup-footer",...o(this,R).buttons.map((u,y)=>{const w=f("button","ui-popup-button");return u.tabIndex>0?w.tabIndex=u.tabIndex:w.tabIndex=s+y+1,w.innerText=u.text,w.addEventListener("click",()=>{if(typeof u.trigger=="function"){const h=u.trigger(this);typeof(h==null?void 0:h.then)=="function"?h.then(g=>{g!==!1&&n()}).catch(()=>{}):h!==!1&&n()}else n()}),w})));const i=[...t.querySelectorAll("[tabindex]")].map(u=>u.tabIndex??0),l=Math.min.apply(null,i),a=Math.max.apply(null,i),c=t.querySelector(`[tabindex="${a}"]`);c!=null&&c.addEventListener("keydown",u=>{if(u.key==="Tab"){const y=t.querySelector(`[tabindex="${l}"]`);y==null||y.focus(),u.preventDefault()}})}return o(this,R).resizable===!0&&t.append(f("layer",i=>{i.className="ui-popup-border ui-popup-border-right",i.addEventListener("mousedown",l=>p(this,X,te).call(this,q.right,l))}),f("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom",i.addEventListener("mousedown",l=>p(this,X,te).call(this,q.bottom,l))}),f("layer",i=>{i.className="ui-popup-border ui-popup-border-left",i.addEventListener("mousedown",l=>p(this,X,te).call(this,q.left,l))}),f("layer",i=>{i.className="ui-popup-border ui-popup-border-top",i.addEventListener("mousedown",l=>p(this,X,te).call(this,q.top,l))}),f("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom-right",i.addEventListener("mousedown",l=>p(this,X,te).call(this,q.bottomRight,l))}),f("layer",i=>{i.className="ui-popup-border ui-popup-border-bottom-left",i.addEventListener("mousedown",l=>p(this,X,te).call(this,q.bottomLeft,l))}),f("layer",i=>{i.className="ui-popup-border ui-popup-border-top-left",i.addEventListener("mousedown",l=>p(this,X,te).call(this,q.topLeft,l))}),f("layer",i=>{i.className="ui-popup-border ui-popup-border-top-right",i.addEventListener("mousedown",l=>p(this,X,te).call(this,q.topRight,l))})),e.appendChild(t),x(this,J,e),e}show(e=document.body){if(e==null)return;let t=o(this,J)??this.create();if(e.appendChild(t),o(this,R).mask===!1){const s=this.container;s.style.left=String((e.offsetWidth-s.offsetWidth)/2)+"px",s.style.top=String((e.offsetHeight-s.offsetHeight)/2)+"px"}return new Promise(s=>{setTimeout(()=>{t.style.opacity=1,this.container.focus(),s(t)},0)})}get loading(){var e,t,s;return((s=(t=(e=o(this,J))==null?void 0:e.querySelector(".ui-popup-body>.ui-popup-loading"))==null?void 0:t.style)==null?void 0:s.visibility)==="visible"}set loading(e){var s;let t=(s=o(this,J))==null?void 0:s.querySelector(".ui-popup-body>.ui-popup-loading");t!=null&&(e===!1?(t.style.visibility="hidden",t.style.opacity=0):(t.style.visibility="visible",t.style.opacity=1))}}J=new WeakMap,R=new WeakMap,Q=new WeakMap,X=new WeakSet,te=function(e,t){const s=this.container,n=o(this,R);typeof n.onResizeStarted=="function"&&n.onResizeStarted.call(this);const r=o(this,J),i=t.clientX,l=t.clientY,a={width:s.offsetWidth,height:s.offsetHeight,left:s.offsetLeft,top:s.offsetTop},c=n.minWidth??200,u=n.minHeight??200;let y;const w=C=>{const v=C.clientX-i,$=C.clientY-l;let L=a.width,_=a.height,be=a.left,P=a.top;(e&q.right)===q.right&&(L+=v,L{h.removeEventListener("mousemove",w,{passive:!1}),h.removeEventListener("mouseup",g),y===!0&&typeof n.onResizeEnded=="function"&&n.onResizeEnded.call(this),y=!1};h.addEventListener("mouseup",g)};function Ii(d,e,...t){return new at({title:d,content:e,buttons:t})}const Qt={info:"info-circle",information:"info-circle",warn:"exclamation-triangle",warning:"exclamation-triangle",question:"question-circle",error:"times-circle"};function _i(d,e,t="info",s=document.body){return new Promise(n=>{new at({title:d,content:f("div","message-wrapper",W("fa-solid",Qt[t]??"info-circle"),f("span",i=>i.innerText=e)),buttons:[{text:F("ok","OK"),trigger:n}]}).show(s).then(i=>{const l=i.querySelector(".ui-popup-container .ui-popup-footer .ui-popup-button:last-child");l==null||l.focus()})})}function qi(d,e,t,s="question",n=document.body){return new Promise(r=>{const i=f("div","message-wrapper");re(s)||i.appendChild(W("fa-solid",Qt[s]??"question-circle")),i.appendChild(e instanceof HTMLElement?e:f("span",a=>a.innerText=e)),new at({title:d,content:i,buttons:(t==null?void 0:t.map(a=>({text:a.text,trigger:c=>{let u;if(typeof a.trigger=="function"){if(u=a.trigger(c,a),typeof(u==null?void 0:u.then)=="function")return u.then(y=>(y!==!1&&r(y),y));u!==!1&&r(u)}else u={key:a.key,popup:c},r(u);return u}})))??[{text:F("yes","Yes"),trigger:a=>r({key:"yes",popup:a})},{text:F("no","No"),trigger:a=>r({key:"no",popup:a})}]}).show(n).then(a=>{const c=a.querySelector(".ui-popup-container .ui-popup-footer .ui-popup-button:last-child");c==null||c.focus()})})}k.Dropdown=st,k.Grid=$e,k.Popup=at,k.changeIcon=qe,k.createCheckbox=le,k.createElement=f,k.createIcon=W,k.createPopup=Ii,k.createRadiobox=gi,k.resolveCheckbox=mi,k.resolveIcon=yi,k.resolveTooltip=bi,k.setTooltip=St,k.showAlert=_i,k.showConfirm=qi,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=ui.min.js.map diff --git a/Site/js/lib/ui.min.js.map b/Site/js/lib/ui.min.js.map index b166e89..cf09218 100644 --- a/Site/js/lib/ui.min.js.map +++ b/Site/js/lib/ui.min.js.map @@ -1 +1 @@ -{"version":3,"file":"ui.min.js","sources":["../lib/functions.js","../lib/ui/icon.js","../lib/ui/checkbox.js","../lib/ui/tooltip.js","../lib/utility/strings.js","../lib/utility/lgres.js","../lib/utility.js","../lib/ui/dropdown.js","../lib/ui/grid/column.js","../lib/ui/grid/grid.js","../lib/ui/popup.js"],"sourcesContent":["export function createElement(tagName, init, ...children) {\r\n const element = document.createElement(tagName);\r\n if (typeof init === 'function') {\r\n init(element);\r\n } else if (init != null) {\r\n element.className = init;\r\n }\r\n if (children.length > 0) {\r\n element.append(...children);\r\n }\r\n return element;\r\n}\r\n","const svgns = 'http://www.w3.org/2000/svg';\r\n\r\nfunction createUse(type, id) {\r\n const c = typeof consts !== 'undefined' ? consts : {};\r\n const path = c.path || '';\r\n const ver = c.resver == null ? '' : `?${c.resver}`;\r\n const use = document.createElementNS(svgns, 'use');\r\n use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', `${path}fonts/${type}.svg${ver}#${id}`);\r\n return use;\r\n}\r\n\r\nfunction changeIcon(svg, type, id) {\r\n if (svg instanceof SVGElement) {\r\n svg.replaceChildren(createUse(type, id));\r\n }\r\n return svg;\r\n}\r\n\r\nfunction createIcon(type, id, style) {\r\n const svg = document.createElementNS(svgns, 'svg');\r\n svg.appendChild(createUse(type, id));\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n svg.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n return svg;\r\n}\r\n\r\nfunction resolveIcon(container) {\r\n const svgs = container.querySelectorAll('svg[data-id]');\r\n for (let icon of svgs) {\r\n const type = icon.dataset.type;\r\n const id = icon.dataset.id;\r\n icon.replaceChildren(createUse(type, id));\r\n icon.removeAttribute('data-type');\r\n icon.removeAttribute('data-id');\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n createIcon,\r\n changeIcon,\r\n resolveIcon\r\n}","import './css/checkbox.scss';\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon } from \"./icon\";\r\n\r\nfunction fillCheckbox(container, type = 'fa-regular', label, tabindex = -1, charactor = 'check') {\r\n container.appendChild(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-check-inner';\r\n layer.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n const input = container.querySelector('input');\r\n if (input != null) {\r\n input.checked = !input.checked;\r\n input.dispatchEvent(new Event('change'));\r\n }\r\n }\r\n });\r\n if (tabindex >= 0) {\r\n layer.tabIndex = tabindex;\r\n }\r\n }, createIcon(type, charactor))\r\n );\r\n if (label instanceof Element) {\r\n container.appendChild(label);\r\n } else if (label?.length > 0) {\r\n container.appendChild(\r\n createElement('span', span => span.innerText = label)\r\n );\r\n }\r\n}\r\n\r\nfunction createRadiobox(opts = {}) {\r\n const container = createElement('label', 'ui-check-wrapper ui-radio-wrapper',\r\n createElement('input', input => {\r\n input.setAttribute('type', 'radio');\r\n input.name = opts.name;\r\n if (opts.checked === true) {\r\n input.checked = true;\r\n }\r\n if (opts.enabled === false) {\r\n input.disabled = true;\r\n }\r\n if (opts.customerAttributes != null) {\r\n for (let entry of Object.entries(opts.customerAttributes)) {\r\n input.setAttribute(entry[0], entry[1]);\r\n }\r\n }\r\n if (typeof opts.onchange === 'function') {\r\n input.addEventListener('change', opts.onchange);\r\n }\r\n }));\r\n if (opts.className) {\r\n container.classList.add(opts.className);\r\n }\r\n fillCheckbox(container, opts.type, opts.label, opts.tabIndex, 'circle');\r\n return container;\r\n}\r\n\r\nfunction createCheckbox(opts = {}) {\r\n const container = createElement('label', 'ui-check-wrapper',\r\n createElement('input', input => {\r\n input.setAttribute('type', 'checkbox');\r\n if (opts.checked === true) {\r\n input.checked = true;\r\n }\r\n if (opts.enabled === false) {\r\n input.disabled = true;\r\n }\r\n if (opts.customerAttributes != null) {\r\n for (let entry of Object.entries(opts.customerAttributes)) {\r\n input.setAttribute(entry[0], entry[1]);\r\n }\r\n }\r\n if (typeof opts.onchange === 'function') {\r\n input.addEventListener('change', opts.onchange);\r\n }\r\n }));\r\n if (opts.className) {\r\n container.classList.add(opts.className);\r\n }\r\n if (opts.enabled === false) {\r\n container.classList.add('disabled');\r\n }\r\n if (opts.checkedNode != null && opts.uncheckedNode != null) {\r\n container.classList.add('ui-check-image-wrapper');\r\n let height = opts.imageHeight;\r\n if (isNaN(height) || height <= 0) {\r\n height = 14;\r\n }\r\n opts.checkedNode.classList.add('checked');\r\n container.appendChild(opts.checkedNode);\r\n opts.uncheckedNode.classList.add('unchecked');\r\n container.appendChild(opts.uncheckedNode);\r\n } else {\r\n fillCheckbox(container, opts.type, opts.label, opts.tabIndex);\r\n }\r\n return container;\r\n}\r\n\r\nfunction resolveCheckbox(container = document.body, legacy) {\r\n if (legacy) {\r\n const checks = container.querySelectorAll('input[type=\"checkbox\"]');\r\n for (let chk of checks) {\r\n if (chk.parentElement.classList.contains('ui-check-wrapper')) {\r\n // skip\r\n continue;\r\n }\r\n const id = chk.id;\r\n let label, text;\r\n if (id != null) {\r\n label = container.querySelector(`label[for=\"${id}\"]`);\r\n }\r\n if (label == null) {\r\n const e = chk.nextElementSibling;\r\n if (e != null) {\r\n if (e.tagName === 'LABEL') {\r\n label = e;\r\n } else if (e.tagName === 'SPAN' && e.dataset.lgid != null) {\r\n text = e.innerText;\r\n e.style.display = 'none';\r\n }\r\n }\r\n }\r\n if (label == null) {\r\n const e = chk.previousElementSibling;\r\n if (e != null) {\r\n if (e.tagName === 'LABEL') {\r\n label = e;\r\n } else if (text == null && e.tagName === 'SPAN' && e.dataset.lgid != null) {\r\n text = e.innerText;\r\n e.style.display = 'none';\r\n }\r\n }\r\n }\r\n if (label == null) {\r\n label = createElement('label');\r\n chk.parentElement.insertBefore(label, chk);\r\n } else {\r\n text = label.innerText;\r\n }\r\n if (chk.disabled) {\r\n label.className = 'ui-check-wrapper disabled';\r\n } else {\r\n label.className = 'ui-check-wrapper';\r\n }\r\n label.replaceChildren();\r\n fillCheckbox(label, 'fa-regular', text, chk.tabIndex);\r\n label.insertBefore(chk, label.firstChild);\r\n }\r\n }\r\n const boxes = container.querySelectorAll('label[data-checkbox]');\r\n for (let box of boxes) {\r\n if (!box.classList.contains('ui-check-wrapper')) {\r\n box.classList.add('ui-check-wrapper');\r\n }\r\n if (box.hasChildNodes()) {\r\n if (!box.classList.contains('ui-check-image-wrapper')) {\r\n box.classList.add('ui-check-image-wrapper');\r\n }\r\n } else {\r\n fillCheckbox(box,\r\n box.dataset.type,\r\n box.dataset.label,\r\n box.dataset.tabIndex)\r\n box.removeAttribute('data-type');\r\n box.removeAttribute('data-label');\r\n }\r\n const input = createElement('input');\r\n const id = box.dataset.id;\r\n if (id?.length > 0) {\r\n input.id = id;\r\n }\r\n if (box.dataset.checked != null) {\r\n input.checked = true;\r\n }\r\n input.setAttribute('type', 'checkbox');\r\n box.insertBefore(input, box.firstChild);\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n createCheckbox,\r\n resolveCheckbox,\r\n createRadiobox\r\n}","import './css/tooltip.scss';\r\nimport { createElement } from \"../functions\";\r\n// import { global } from \"../utility\";\r\n\r\nfunction setTooltip(container, content, flag = false, parent = null) {\r\n const isParent = parent instanceof HTMLElement;\r\n if (isParent) {\r\n const tipid = container.dataset.tipId;\r\n const tip = parent.querySelector(`.ui-tooltip-wrapper[data-tip-id=\"${tipid}\"]`);\r\n tip?.remove();\r\n } else {\r\n const tip = container.querySelector('.ui-tooltip-wrapper');\r\n tip?.remove();\r\n }\r\n const wrapper = createElement('div', wrapper => {\r\n wrapper.className = 'ui-tooltip-wrapper ui-tooltip-color';\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n wrapper.style.top = '0';\r\n wrapper.style.left = '0';\r\n },\r\n createElement('div', 'ui-tooltip-pointer ui-tooltip-color'),\r\n createElement('div', 'ui-tooltip-curtain ui-tooltip-color'),\r\n createElement('div', cnt => {\r\n cnt.className = 'ui-tooltip-content';\r\n if (content instanceof Element) {\r\n cnt.appendChild(content);\r\n } else {\r\n cnt.innerText = content;\r\n }\r\n })\r\n );\r\n // container.insertAdjacentElement('afterend', wrapper);\r\n if (isParent) {\r\n const tipId = String(Math.random()).substring(2);\r\n container.dataset.tipId = tipId;\r\n wrapper.dataset.tipId = tipId;\r\n parent.appendChild(wrapper);\r\n } else {\r\n container.appendChild(wrapper);\r\n }\r\n\r\n let tid;\r\n container.addEventListener('mouseenter', () => {\r\n tid && clearTimeout(tid);\r\n let c = container;\r\n while (c?.offsetWidth == null) {\r\n c = c.parentElement;\r\n }\r\n if (c == null) {\r\n return;\r\n }\r\n if (!flag || c.scrollWidth > c.offsetWidth) {\r\n tid = setTimeout(() => {\r\n let p;\r\n let left;\r\n let top;\r\n left = c.offsetLeft;\r\n top = c.offsetTop;\r\n if (isParent) {\r\n p = c.offsetParent;\r\n while (p != null && p !== parent) {\r\n left += p.offsetLeft;\r\n top += p.offsetTop;\r\n p = p.offsetParent;\r\n }\r\n }\r\n p = c.parentElement;\r\n const offsetParent = c.offsetParent;\r\n while (p != null && p !== (isParent ? parent : offsetParent)) {\r\n left -= p.scrollLeft;\r\n top -= p.scrollTop;\r\n p = p.parentElement;\r\n }\r\n left += (c.offsetWidth - wrapper.offsetWidth) / 2;\r\n top -= wrapper.offsetHeight + 14;\r\n wrapper.style.left = `${left}px`;\r\n wrapper.style.top = `${top}px`;\r\n wrapper.style.visibility = 'visible';\r\n wrapper.style.opacity = 1;\r\n }, 100);\r\n }\r\n });\r\n container.addEventListener('mouseleave', () => {\r\n tid && clearTimeout(tid);\r\n tid = setTimeout(() => {\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n }, 300);\r\n });\r\n return container;\r\n}\r\n\r\nfunction resolveTooltip(container = document.body) {\r\n const tips = container.querySelectorAll('[title]');\r\n for (let tip of tips) {\r\n const title = tip.getAttribute('title');\r\n if (title != null) {\r\n tip.removeAttribute('title');\r\n setTooltip(tip, title);\r\n }\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n setTooltip,\r\n resolveTooltip\r\n}","function nullOrEmpty(s) {\r\n return s == null || typeof s !== 'string' || s.length === 0;\r\n}\r\n\r\nfunction contains(s, key, ignoreCase) {\r\n if (nullOrEmpty(s) || key == null) {\r\n return false;\r\n }\r\n if (typeof key !== 'string') {\r\n key = String(key);\r\n }\r\n if (ignoreCase) {\r\n return s.toLowerCase().indexOf(key.toLowerCase()) >= 0;\r\n }\r\n return s.indexOf(key) >= 0;\r\n}\r\n\r\nfunction endsWith(s, suffix) {\r\n if (nullOrEmpty(s) || nullOrEmpty(suffix)) {\r\n return false;\r\n }\r\n return s.indexOf(suffix) === s.length - suffix.length;\r\n}\r\n\r\nfunction padStart(s, num, char) {\r\n if (nullOrEmpty(s) || isNaN(num) || num <= s.length) {\r\n return s;\r\n }\r\n return (char ?? ' ').repeat(num - s.length);\r\n}\r\n\r\nfunction formatUrl(msg) {\r\n //const urlReg = /(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?/ig;\r\n //const urlArrray = str.match(urlReg);\r\n const p = /(http|ftp|https):\\/\\/.+?(\\s|\\r\\n|\\r|\\n|\\\"|\\'|\\*|$)/g;\r\n const r = msg.match(p);\r\n msg = escapeHtml(msg);\r\n\r\n if (r?.length > 0) {\r\n const rs = [];\r\n for (let t of r) {\r\n t = t.replace(/[\"'\\r\\n ]/g, '');\r\n if (rs.indexOf(t) < 0) {\r\n rs.push(t);\r\n }\r\n }\r\n\r\n for (let r of rs) {\r\n msg = msg.replaceAll(r, '');\r\n }\r\n }\r\n\r\n return msg;\r\n}\r\n\r\nfunction escapeHtml(text) {\r\n if (text == null) {\r\n return '';\r\n }\r\n return String(text)\r\n .replaceAll('&', '&')\r\n .replaceAll('<', '<')\r\n .replaceAll('>', '>')\r\n .replaceAll('\\r\\n', '
')\r\n .replaceAll('\\n', '
')\r\n .replaceAll(' ', ' ');\r\n}\r\n\r\nexport {\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml\r\n}","import { getCookie } from \"./cookie\";\r\nimport { get } from \"./request\";\r\nimport { nullOrEmpty } from \"./strings\";\r\n\r\nlet cache;\r\n\r\nfunction getCurrentLgId() {\r\n let lgid;\r\n if (typeof consts !== 'undefined') {\r\n lgid = getCookie(consts.cookie?.lang);\r\n if (nullOrEmpty(lgid)) {\r\n lgid = consts.user?.language;\r\n }\r\n }\r\n if (nullOrEmpty(lgid)) {\r\n lgid = getCookie('lgid');\r\n }\r\n if (nullOrEmpty(lgid)) {\r\n lgid = navigator.language || 'en-us';\r\n }\r\n lgid = lgid.toLowerCase().replace(/-/g, '_');\r\n if (nullOrEmpty(lgid)) {\r\n lgid = 'en';\r\n }\r\n switch (lgid) {\r\n case 'en':\r\n case 'en_au':\r\n case 'fr':\r\n case 'zh_cn':\r\n return lgid;\r\n }\r\n const lang = lgid.split('_')[0];\r\n switch (lang) {\r\n case 'en':\r\n case 'fr':\r\n return lang;\r\n }\r\n return 'en';\r\n}\r\n\r\nfunction getStorageKey(lgid) {\r\n if (typeof consts !== 'undefined') {\r\n return (consts.prefix || '') + `res_${lgid}`;\r\n }\r\n return `res_${lgid}`;\r\n}\r\n\r\nasync function doRefreshLgres(template = '') {\r\n const lgid = getCurrentLgId();\r\n const r = await get(`language/${lgid}${template}`);\r\n const dict = await r.json();\r\n localStorage.setItem(getStorageKey(lgid), JSON.stringify(dict));\r\n return dict;\r\n}\r\n\r\nasync function refreshLgres(template, lgres) {\r\n if (lgres == null || typeof consts === 'undefined') {\r\n lgres = await doRefreshLgres(template);\r\n }\r\n const ver = Number(consts.resver);\r\n if (isNaN(lgres.ver) || isNaN(ver) || ver > lgres.ver) {\r\n console.log(`found new language res version: ${lgres.ver} => ${ver}`);\r\n lgres = await doRefreshLgres(template);\r\n }\r\n Object.defineProperty(lgres, 'r', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function (key, defaultValue) {\r\n return getLanguage(this, key, defaultValue);\r\n }\r\n });\r\n cache = lgres;\r\n return lgres;\r\n}\r\n\r\nfunction getLanguage(lgres, key, defaultValue) {\r\n let value = lgres[key];\r\n return value ?? defaultValue;\r\n}\r\n\r\nfunction applyLanguage(dom, result) {\r\n for (let text of dom.querySelectorAll('[data-lgid]')) {\r\n const key = text.dataset.lgid;\r\n if (text.tagName === 'INPUT') {\r\n text.value = getLanguage(result, key, text.value);\r\n } else {\r\n text.innerText = getLanguage(result, key, text.innerText);\r\n }\r\n }\r\n for (let title of dom.querySelectorAll('[data-title-lgid]')) {\r\n const key = title.dataset.titleLgid;\r\n title.setAttribute('title', getLanguage(result, key, title.getAttribute('title')));\r\n }\r\n for (let holder of dom.querySelectorAll('[data-placeholder-lgid]')) {\r\n const key = holder.dataset.placeholderLgid;\r\n holder.setAttribute('placeholder', getLanguage(result, key, holder.getAttribute('placeholder')));\r\n }\r\n}\r\n\r\nasync function init(dom = document.body, options = {}) {\r\n const lgid = getCurrentLgId();\r\n let lgres = localStorage.getItem(getStorageKey(lgid));\r\n let result;\r\n if (lgres != null) {\r\n try {\r\n lgres = JSON.parse(lgres);\r\n result = await refreshLgres(options.template, lgres);\r\n } catch (e) {\r\n console.error('error while parsing lgres, try refresh ...', e);\r\n result = await refreshLgres(options.template);\r\n }\r\n } else {\r\n result = await refreshLgres(options.template);\r\n }\r\n\r\n try {\r\n if (document.readyState === 'loading') {\r\n return await new Promise((resolve, reject) => {\r\n let tid = setTimeout(() => reject('timeout'), 30000);\r\n document.addEventListener('DOMContentLoaded', () => {\r\n clearTimeout(tid);\r\n tid = void 0;\r\n if (typeof options.callback === 'function') {\r\n options.callback(result);\r\n }\r\n applyLanguage(dom, result);\r\n resolve(result);\r\n });\r\n });\r\n }\r\n if (typeof options.callback === 'function') {\r\n options.callback(result);\r\n }\r\n applyLanguage(dom, result);\r\n return result;\r\n } catch (err) {\r\n console.error('error while loading language res ...', err);\r\n }\r\n}\r\n\r\nfunction r(key, defaultValue) {\r\n if (cache != null) {\r\n return getLanguage(cache, key, defaultValue);\r\n }\r\n return defaultValue;\r\n}\r\n\r\nconst lang = {\r\n get current() {\r\n return getCurrentLgId();\r\n },\r\n get unknownError() {\r\n return r('unknownError', 'An unknown error occurred, please contact the administrator.');\r\n },\r\n get savedSuccessfully() {\r\n return r('savedSuccessfully', 'Saved successfully.');\r\n }\r\n}\r\n\r\nexport {\r\n init,\r\n r,\r\n lang\r\n}","import { getCookie, setCookie, deleteCookie } from \"./utility/cookie\";\r\nimport { init, r, lang } from \"./utility/lgres\";\r\nimport { get, post, upload } from \"./utility/request\";\r\nimport { nullOrEmpty, contains, endsWith, padStart, formatUrl, escapeHtml } from \"./utility/strings\";\r\n\r\nlet g = typeof globalThis !== 'undefined' ? globalThis : self;\r\n\r\nfunction isPositive(n) {\r\n return !isNaN(n) && n > 0;\r\n}\r\n\r\nfunction isMobile() {\r\n return /mobile/i.test(navigator.userAgent);\r\n}\r\n\r\nfunction throttle(method, delay = 100, context = g, ...args) {\r\n if (method == null) {\r\n return;\r\n }\r\n method.tiid && clearTimeout(method.tiid);\r\n const current = new Date();\r\n if (method.tdate == null || current - method.tdate > delay) {\r\n method.apply(context, args);\r\n method.tdate = current;\r\n } else {\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n }\r\n}\r\n\r\nfunction debounce(method, delay = 100, context = g, ...args) {\r\n if (method == null) {\r\n return;\r\n }\r\n method.tiid && clearTimeout(method.tiid);\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n}\r\n\r\nfunction truncate(v) {\r\n return (v > 0 ? Math.floor : Math.ceil)(v);\r\n}\r\n\r\nfunction isEmail(text) {\r\n return /^\\w[-\\w.+]*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/.test(text);\r\n}\r\n\r\nfunction isPhone(text) {\r\n return /^[1-9]\\d{9,}$/.test(text);\r\n}\r\n\r\nexport {\r\n // cookie\r\n getCookie,\r\n setCookie,\r\n deleteCookie,\r\n // lgres\r\n init,\r\n r,\r\n lang,\r\n // request\r\n get,\r\n post,\r\n upload,\r\n // strings\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml,\r\n // variables\r\n g as global,\r\n isPositive,\r\n isMobile,\r\n // functions\r\n throttle,\r\n debounce,\r\n truncate,\r\n isEmail,\r\n isPhone\r\n}","// import { r, global, contains, isPositive, nullOrEmpty } from \"../utility\";\r\nimport './css/dropdown.scss';\r\nimport { r } from \"../utility/lgres\";\r\nimport { contains, nullOrEmpty } from \"../utility/strings\";\r\nimport { global, isPositive } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createCheckbox } from \"./checkbox\";\r\nimport { createIcon } from \"./icon\"\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\nconst DropdownTitleHeight = 26;\r\nconst DropdownItemHeight = 30;\r\n\r\nlet dropdownGlobal = global[SymbolDropdown];\r\n\r\nif (dropdownGlobal == null) {\r\n // init\r\n dropdownGlobal = {};\r\n Object.defineProperty(dropdownGlobal, 'clear', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function () {\r\n const panel = document.querySelector('.ui-drop-wrapper .ui-drop-box.active');\r\n if (panel == null) {\r\n return;\r\n }\r\n panel.classList.remove('active');\r\n const dropId = panel.parentElement.dataset.dropId;\r\n if (dropId == null) {\r\n return;\r\n }\r\n const dropdown = this[dropId];\r\n if (dropdown?.multiselect && typeof dropdown.oncollapsed === 'function') {\r\n dropdown.oncollapsed();\r\n }\r\n }\r\n })\r\n global[SymbolDropdown] = dropdownGlobal;\r\n\r\n document.addEventListener('mousedown', e => {\r\n let parent = e.target;\r\n while (parent != null) {\r\n if (parent.classList.contains('ui-drop-box')) {\r\n e.stopPropagation();\r\n return;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n dropdownGlobal.clear();\r\n });\r\n}\r\n\r\nfunction selectItems(label, itemlist, htmlkey, textkey) {\r\n const htmls = itemlist.map(it => it[htmlkey]);\r\n if (htmls.some(it => it instanceof HTMLElement)) {\r\n label.replaceChildren(...htmls.filter(it => it != null).map(it => it.cloneNode(true)));\r\n } else {\r\n let text = itemlist.map(it => it[textkey]).join(', ');\r\n if (nullOrEmpty(text)) {\r\n text = r('noneItem', '( None )');\r\n }\r\n label.innerText = text;\r\n }\r\n}\r\n\r\nfunction filterSource(searchkeys, textkey, key, source) {\r\n if (!Array.isArray(searchkeys) || searchkeys.length === 0) {\r\n searchkeys = [textkey];\r\n }\r\n if (key.length > 0) {\r\n source = source.filter(it => {\r\n for (let k of searchkeys) {\r\n if (contains(it[k].toLowerCase(), key)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n }\r\n return source;\r\n}\r\n\r\nclass Dropdown {\r\n #options;\r\n\r\n #wrapper;\r\n #container;\r\n #label;\r\n\r\n #allChecked;\r\n #source;\r\n #lastSelected;\r\n #selected;\r\n #selectedList;\r\n\r\n sourceFilter;\r\n onselectedlist;\r\n onselected;\r\n onexpanded;\r\n\r\n constructor(options = {}) {\r\n options.searchplaceholder ??= r('searchHolder', 'Search...');\r\n options.textkey ??= 'text';\r\n options.valuekey ??= 'value';\r\n options.htmlkey ??= 'html';\r\n options.maxlength ??= 500;\r\n this.#options = options;\r\n }\r\n\r\n create() {\r\n const options = this.#options;\r\n\r\n // wrapper\r\n const wrapper = createElement('div', 'ui-drop-wrapper');\r\n const dropId = String(Math.random()).substring(2);\r\n wrapper.dataset.dropId = dropId;\r\n dropdownGlobal[dropId] = this;\r\n this.#wrapper = wrapper;\r\n\r\n // header\r\n const header = createElement('div', 'ui-drop-header');\r\n header.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n header.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n header.addEventListener('keydown', e => {\r\n const up = e.key === 'ArrowUp';\r\n const down = e.key === 'ArrowDown';\r\n if (up || down) {\r\n const source = this.source;\r\n const count = source.length;\r\n const valuekey = this.#options.valuekey;\r\n let index = source?.indexOf(this.#selected);\r\n if (isNaN(index) || index < -1) {\r\n index = -1;\r\n } else if (index >= count) {\r\n index = count - 1;\r\n }\r\n if (up) {\r\n if (index > 0) {\r\n index--;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (down) {\r\n if (index < 0) {\r\n index = 0;\r\n } else if (index < count) {\r\n index++;\r\n } else {\r\n index = count - 1;\r\n }\r\n }\r\n const target = source[index]?.[valuekey];\r\n if (target != null) {\r\n this.select(target);\r\n }\r\n } else if (e.key === 'Tab') {\r\n this.#dropdown(false);\r\n }\r\n });\r\n header.addEventListener('click', () => {\r\n if (this.disabled) {\r\n return;\r\n }\r\n const active = this.#expanded;\r\n const label = this.#label;\r\n if (active && label.ownerDocument.activeElement === label) {\r\n return;\r\n }\r\n this.#dropdown(!active);\r\n if (!active && typeof this.onexpanded === 'function') {\r\n setTimeout(() => this.onexpanded(), 120);\r\n }\r\n });\r\n\r\n // label or input\r\n let label;\r\n if (options.input) {\r\n label = createElement('input', 'ui-drop-text');\r\n label.setAttribute('type', 'text');\r\n options.placeholder && label.setAttribute('placeholder', options.placeholder);\r\n isPositive(options.maxlength) && label.setAttribute('maxlength', options.maxlength);\r\n isPositive(options.tabindex) && label.setAttribute('tabindex', options.tabindex);\r\n label.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n this.#container.classList.add('active');\r\n });\r\n label.addEventListener('blur', e => this.select(e.target.value));\r\n label.addEventListener('mousedown', e => this.#expanded && e.stopPropagation());\r\n } else {\r\n isPositive(options.tabindex) && header.setAttribute('tabindex', options.tabindex);\r\n label = createElement('label', 'ui-drop-text');\r\n }\r\n this.#label = label;\r\n if (options.multiselect) {\r\n if (Array.isArray(options.selectedlist)) {\r\n this.selectlist(options.selectedlist, true);\r\n } else {\r\n this.#allChecked = true;\r\n label.innerText = r('allItem', '( All )');\r\n }\r\n } else if (options.selected != null) {\r\n this.select(options.selected, true);\r\n }\r\n header.append(label, createElement('label', 'ui-drop-caret'));\r\n wrapper.appendChild(header);\r\n\r\n this.disabled = options.disabled || false;\r\n return wrapper;\r\n }\r\n\r\n get multiselect() { return this.#options.multiselect }\r\n\r\n get disabled() { return this.#wrapper == null || this.#wrapper.querySelector('.ui-drop-header.disabled') != null }\r\n\r\n set disabled(flag) {\r\n if (this.#wrapper == null) {\r\n return;\r\n }\r\n if (flag) {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.add('disabled');\r\n } else {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.remove('disabled');\r\n }\r\n }\r\n\r\n get source() {\r\n let source = this.#source;\r\n if (source == null || !Array.isArray(source)) {\r\n if (typeof this.sourceFilter === 'function') {\r\n source = this.sourceFilter();\r\n }\r\n if (!Array.isArray(source)) {\r\n source = [];\r\n }\r\n this.#source = source;\r\n }\r\n return source;\r\n }\r\n\r\n set source(list) {\r\n if (!Array.isArray(list)) {\r\n return;\r\n }\r\n this.#source = list;\r\n if (this.#expanded) {\r\n setTimeout(() => this.#dropdown(), 120);\r\n }\r\n }\r\n\r\n get selected() { return this.#selected }\r\n\r\n get selectedlist() { return this.#selectedList || [] }\r\n\r\n select(selected, silence) {\r\n if (this.#lastSelected === selected) {\r\n return false;\r\n }\r\n this.#lastSelected = selected;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n let item = this.source.find(it => it[valuekey] === selected);\r\n if (this.#options.input) {\r\n if (item == null) {\r\n item = { [valuekey]: selected };\r\n }\r\n this.#label.value = selected;\r\n } else {\r\n const expanded = this.#expanded;\r\n if (expanded) {\r\n this.#container.querySelectorAll('li[data-value].selected').forEach(li => li.classList.remove('selected'));\r\n }\r\n if (item == null) {\r\n this.#selected = null;\r\n this.#label.innerText = ' ';\r\n return false;\r\n }\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n this.#label.replaceChildren(html.cloneNode(true));\r\n } else {\r\n let text = item[textkey];\r\n if (nullOrEmpty(text)) {\r\n text = ' ';\r\n }\r\n this.#label.innerText = text;\r\n }\r\n if (expanded) {\r\n const val = selected.replace(/\"/g, '\\\\\"');\r\n const li = this.#container.querySelector(`li[data-value=\"${val}\"]`);\r\n if (li != null) {\r\n li.classList.add('selected');\r\n }\r\n }\r\n }\r\n this.#selected = item;\r\n if (!silence && typeof this.onselected === 'function') {\r\n this.onselected(item);\r\n }\r\n }\r\n\r\n selectlist(selectedlist, silence) {\r\n const source = this.source;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const itemlist = selectedlist.map(v => {\r\n let item = source.find(it => it[valuekey] === v);\r\n if (item == null) {\r\n item = { [valuekey]: v, [textkey]: v };\r\n }\r\n return item;\r\n });\r\n if (itemlist.length === 0) {\r\n this.#selectedList = null;\r\n this.#label.innerText = none;\r\n return false;\r\n }\r\n selectItems(this.#label, itemlist, htmlkey, textkey);\r\n this.#selectedList = itemlist;\r\n if (!silence && typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n get #expanded() { return this.#container?.classList?.contains('active') }\r\n\r\n #dropdown(flag = true) {\r\n const options = this.#options;\r\n let panel = this.#container;\r\n if (panel == null) {\r\n panel = createElement('div', 'ui-drop-box');\r\n // search box\r\n if (!options.input && options.search) {\r\n const search = createElement('div', 'ui-drop-search');\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n isPositive(options.tabindex) && input.setAttribute('tabindex', options.tabindex);\r\n !nullOrEmpty(options.searchplaceholder) && input.setAttribute('placeholder', options.searchplaceholder);\r\n input.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n })\r\n search.append(input, createIcon('fa-light', 'search'));\r\n panel.appendChild(search);\r\n }\r\n // list\r\n const list = createElement('ul', 'ui-drop-list');\r\n if (!this.multiselect) {\r\n list.addEventListener('click', e => {\r\n let li = e.target;\r\n while (li.tagName !== 'LI') {\r\n li = li.parentElement;\r\n if (li == null) {\r\n return;\r\n }\r\n }\r\n const value = li.dataset.value;\r\n if (this.select(value) !== false) {\r\n dropdownGlobal.clear();\r\n }\r\n });\r\n }\r\n panel.appendChild(list);\r\n this.#container = panel;\r\n this.#wrapper.appendChild(panel);\r\n }\r\n if (flag) {\r\n let source = this.source;\r\n if (!options.input && options.search) {\r\n const search = panel.querySelector('.ui-drop-search > input');\r\n if (!nullOrEmpty(search?.value)) {\r\n source = filterSource(options.searchkeys, options.textkey, search.value, source);\r\n }\r\n }\r\n this.#filllist(source);\r\n // slide direction\r\n if (!options.slidefixed) {\r\n let parent = options.parent ?? document.body;\r\n let p = this.#wrapper;\r\n let top = p.offsetTop;\r\n while ((p = p.parentElement) != null && p !== parent) {\r\n top -= p.scrollTop;\r\n }\r\n if (top - parent.offsetTop + DropdownTitleHeight + panel.offsetHeight >= parent.offsetHeight) {\r\n panel.classList.add('slide-up');\r\n } else {\r\n panel.classList.remove('slide-up');\r\n }\r\n }\r\n panel.classList.add('active');\r\n } else {\r\n panel.classList.remove('active');\r\n }\r\n }\r\n\r\n #filllist(source) {\r\n const list = this.#container.querySelector('.ui-drop-list');\r\n list.replaceChildren();\r\n const multiselect = this.multiselect;\r\n const allchecked = this.#allChecked;\r\n if (multiselect) {\r\n list.appendChild(\r\n createElement('li', null,\r\n createCheckbox({\r\n label: r('allItem', '( All )'),\r\n checked: allchecked,\r\n customerAttributes: { 'isall': '1' },\r\n onchange: e => this.#triggerselect(e.target)\r\n })\r\n )\r\n );\r\n }\r\n // TODO: virtual mode\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const selected = this.selected;\r\n const selectedlist = this.selectedlist;\r\n let scrolled;\r\n source.slice(0, 200).forEach((item, i) => {\r\n const val = item[valuekey];\r\n const li = createElement('li');\r\n li.dataset.value = val;\r\n li.setAttribute('title', item[textkey]);\r\n let label;\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n label = html;\r\n }\r\n if (multiselect) {\r\n const selected = selectedlist.some(s => s[valuekey] === val);\r\n if (label == null) {\r\n label = createElement('span');\r\n label.innerText = item[textkey];\r\n }\r\n const box = createCheckbox({\r\n label,\r\n checked: allchecked || selected,\r\n customerAttributes: {\r\n 'class': 'dataitem',\r\n 'data-value': val\r\n },\r\n onchange: e => this.#triggerselect(e.target)\r\n });\r\n li.appendChild(box);\r\n } else {\r\n if (label == null) {\r\n li.innerText = item[textkey];\r\n } else {\r\n li.appendChild(label);\r\n }\r\n if (selected != null && selected[valuekey] === val) {\r\n scrolled = DropdownItemHeight * i;\r\n li.classList.add('selected');\r\n }\r\n }\r\n list.appendChild(li);\r\n });\r\n if (scrolled != null) {\r\n setTimeout(() => list.scrollTop = scrolled, 10);\r\n }\r\n }\r\n\r\n #triggerselect(checkbox) {\r\n let list;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n if (checkbox.getAttribute('isall') === '1') {\r\n const allchecked = this.#allChecked = checkbox.checked;\r\n const boxes = this.#container.querySelectorAll('input.dataitem');\r\n boxes.forEach(box => box.checked = allchecked);\r\n list = [];\r\n } else if (checkbox.checked) {\r\n if (this.#container.querySelectorAll('input.dataitem:not(:checked)').length === 0) {\r\n this.#allChecked = true;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = true;\r\n list = [];\r\n } else {\r\n const source = this.source;\r\n list = [...this.#container.querySelectorAll('input.dataitem:checked')]\r\n .map(c => source.find(it => it[valuekey] === c.dataset.value))\r\n .filter(it => it != null);\r\n }\r\n } else {\r\n const val = checkbox.dataset.value;\r\n if (this.#allChecked) {\r\n this.#allChecked = false;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = false;\r\n list = this.source.filter(it => it[valuekey] !== val);\r\n } else {\r\n list = this.selectedlist.filter(it => it[valuekey] !== val);\r\n }\r\n }\r\n if (this.#allChecked) {\r\n this.#label.innerText = r('allItem', '( All )');\r\n } else {\r\n selectItems(this.#label, list, htmlkey, textkey);\r\n }\r\n this.#selectedList = list;\r\n if (typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n static resolve(dom = document.body) {\r\n const selects = dom.querySelectorAll('select');\r\n for (let sel of selects) {\r\n const source = [...sel.children].map(it => {\r\n return { value: it.value, text: it.innerText }\r\n });\r\n const drop = new Dropdown({\r\n selected: sel.value,\r\n disabled: sel.disabled,\r\n tabindex: sel.tabIndex\r\n });\r\n drop.source = source;\r\n sel.parentElement.replaceChild(drop.create(), sel);\r\n }\r\n return dom;\r\n }\r\n}\r\n\r\nexport default Dropdown;","import { global } from \"../../utility\";\r\nimport { nullOrEmpty } from \"../../utility/strings\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\nimport { setTooltip } from \"../tooltip\";\r\nimport Dropdown from \"../dropdown\";\r\n\r\nclass GridColumn {\r\n static create() {\r\n return createElement('span');\r\n }\r\n\r\n static setValue(element, val) {\r\n element.innerText = val;\r\n }\r\n\r\n static setStyle(element, style) {\r\n for (let css of Object.entries(style)) {\r\n element.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n}\r\n\r\nclass GridInputColumn extends GridColumn {\r\n static get editing() { return true };\r\n\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val) {\r\n if (element.tagName !== 'INPUT') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n }\r\n }\r\n\r\n static getValue(e) { return e.target.value }\r\n\r\n static setEnabled(element, enabled) {\r\n element.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridTextColumn extends GridInputColumn {\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('textarea');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val, _item, _col, grid) {\r\n if (element.tagName !== 'TEXTAREA') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n if (val != null) {\r\n const lines = String(val).split('\\n').length;\r\n element.style.height = `${lines * grid.lineHeight + 12}px`;\r\n }\r\n // TODO: bad performance\r\n }\r\n }\r\n}\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\n\r\nclass GridDropdownColumn extends GridColumn {\r\n static createEdit(trigger, col, parent) {\r\n const drop = new Dropdown({ ...col.dropOptions, parent });\r\n drop.onselected = trigger;\r\n return drop.create();\r\n }\r\n\r\n static #getDrop(element) {\r\n const dropGlobal = global[SymbolDropdown];\r\n if (dropGlobal == null) {\r\n return null;\r\n }\r\n const dropId = element.dataset.dropId;\r\n const drop = dropGlobal[dropId];\r\n if (drop == null) {\r\n return null;\r\n }\r\n return drop;\r\n }\r\n\r\n static #getSource(item, col) {\r\n let source = col.source;\r\n if (typeof source === 'function') {\r\n source = source(item);\r\n }\r\n return source;\r\n }\r\n\r\n static #setValue(source, element, val) {\r\n const data = source?.find(v => v.value === val);\r\n if (data != null) {\r\n val = data.text;\r\n }\r\n super.setValue(element, val);\r\n }\r\n\r\n static setValue(element, val, item, col) {\r\n if (element.tagName !== 'DIV') {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => this.#setValue(s, element, val));\r\n } else {\r\n this.#setValue(source, element, val);\r\n }\r\n return;\r\n }\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n if (drop.source == null || drop.source.length === 0) {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => {\r\n drop.source = s;\r\n drop.select(val, true);\r\n })\r\n return;\r\n } else if (source != null) {\r\n drop.source = source;\r\n }\r\n }\r\n drop.select(val, true);\r\n }\r\n\r\n static getValue(e) {\r\n return e.value;\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n drop.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridCheckboxColumn extends GridColumn {\r\n static createEdit(trigger) {\r\n const check = createCheckbox({\r\n onchange: typeof trigger === 'function' ? trigger : null\r\n });\r\n return check;\r\n }\r\n\r\n static setValue(element, val) {\r\n element.querySelector('input').checked = val;\r\n }\r\n\r\n static getValue(e) { return e.target.checked }\r\n\r\n static setEnabled(element, enabled) {\r\n element.querySelector('input').disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridIconColumn extends GridColumn {\r\n static create() { return createElement('span', 'col-icon') }\r\n\r\n static setValue(element, val, item, col, grid) {\r\n let className = col.className;\r\n if (typeof className === 'function') {\r\n className = className.call(col, item);\r\n }\r\n if (className == null) {\r\n element.className = 'col-icon';\r\n } else {\r\n element.className = `col-icon ${className}`;\r\n }\r\n let type = col.iconType;\r\n if (typeof type === 'function') {\r\n type = type.call(col, item);\r\n }\r\n type ??= 'fa-regular';\r\n if (element.dataset.type !== type || element.dataset.icon !== val) {\r\n const icon = createIcon(type, val);\r\n // const layer = element.children[0];\r\n element.replaceChildren(icon);\r\n !nullOrEmpty(col.tooltip) && setTooltip(element, col.tooltip, false, grid.element);\r\n element.dataset.type = type;\r\n element.dataset.icon = val;\r\n }\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n if (enabled === false) {\r\n element.classList.add('disabled');\r\n } else {\r\n element.classList.remove('disabled');\r\n }\r\n const tooltip = element.querySelector('.ui-tooltip-wrapper');\r\n if (tooltip != null) {\r\n tooltip.style.display = enabled === false ? 'none' : '';\r\n }\r\n }\r\n}\r\n\r\nexport {\r\n GridColumn,\r\n GridInputColumn,\r\n GridTextColumn,\r\n GridDropdownColumn,\r\n GridCheckboxColumn,\r\n GridIconColumn\r\n}","import '../css/grid.scss';\r\nimport { global, isPositive, isMobile, throttle, truncate } from \"../../utility\";\r\nimport { r } from \"../../utility/lgres\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\nimport { GridColumn, GridInputColumn, GridTextColumn, GridDropdownColumn, GridCheckboxColumn, GridIconColumn } from \"./column\";\r\n\r\nconst ColumnChangedType = {\r\n Reorder: 'reorder',\r\n Resize: 'resize',\r\n Sort: 'sort'\r\n};\r\nconst RefreshInterval = isMobile() ? 32 : 0;\r\nconst HoverInternal = 200;\r\nconst RedumCount = 4;\r\nconst MiniDragOffset = 4;\r\nconst MiniColumnWidth = 50;\r\nconst FilterPanelWidth = 200;\r\n\r\nfunction getClientX(e) {\r\n if (e == null) {\r\n return null;\r\n }\r\n const cx = e.touches && e.touches[0]?.clientX;\r\n return cx ?? e.clientX;\r\n}\r\n\r\nfunction getOffsetLeftFromWindow(element) {\r\n let left = 0;\r\n while (element != null) {\r\n left += element.offsetLeft;\r\n element = element.offsetParent;\r\n }\r\n return left;\r\n}\r\n\r\nfunction indexOfParent(target) {\r\n // return [...target.parentElement.children].indexOf(target);\r\n return Array.prototype.indexOf.call(target.parentElement.children, target);\r\n}\r\n\r\nconst ColumnTypes = {\r\n 0: GridColumn,\r\n 1: GridInputColumn,\r\n 2: GridDropdownColumn,\r\n 3: GridCheckboxColumn,\r\n 4: GridIconColumn,\r\n 5: GridTextColumn\r\n};\r\n\r\nclass Grid {\r\n #source;\r\n #currentSource;\r\n #parent;\r\n #el;\r\n #refs;\r\n #rendering;\r\n #selectedColumnIndex = -1;\r\n #selectedIndexes;\r\n #startIndex = 0;\r\n #needResize;\r\n #containerHeight;\r\n #bodyClientWidth;\r\n #rowCount = -1;\r\n #scrollTop;\r\n #scrollLeft;\r\n #colTypes = {};\r\n #colAttrs = {};\r\n #vtable = [];\r\n\r\n columns = [];\r\n langs = {\r\n all: r('allItem', '( All )'),\r\n ok: r('ok', 'OK'),\r\n reset: r('reset', 'Reset')\r\n };\r\n virtualCount = 100;\r\n rowHeight = 36;\r\n lineHeight = 24;\r\n extraRows = 0;\r\n filterRowHeight = 30;\r\n height;\r\n readonly;\r\n multiSelect = false;\r\n fullrowClick = true;\r\n allowHtml = false;\r\n holderDisabled = false;\r\n headerVisible = true;\r\n window = global;\r\n sortIndex = -1;\r\n sortDirection = 1;\r\n\r\n willSelect;\r\n selectedRowChanged;\r\n cellDblClicked;\r\n cellClicked;\r\n rowDblClicked;\r\n columnChanged;\r\n\r\n static ColumnTypes = {\r\n Common: 0,\r\n Input: 1,\r\n Dropdown: 2,\r\n Checkbox: 3,\r\n Icon: 4,\r\n Text: 5,\r\n isCheckbox(type) { return type === 3 }\r\n };\r\n\r\n static GridColumn = GridColumn;\r\n\r\n constructor(container) {\r\n this.#parent = container;\r\n }\r\n\r\n get element() { return this.#el }\r\n\r\n get source() { return this.#source?.map(s => s.values) }\r\n set source(list) {\r\n if (this.#el == null) {\r\n throw new Error('grid has not been initialized.')\r\n }\r\n if (!Array.isArray(list)) {\r\n throw new Error('source is not an Array.')\r\n }\r\n list = list.map(i => { return { values: i } });\r\n this.#source = list;\r\n this.#refreshSource(list);\r\n }\r\n\r\n #refreshSource(list) {\r\n list ??= this.#source;\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource = list.filter(it => {\r\n for (let col of this.columns) {\r\n if (Array.isArray(col.filterValues)) {\r\n const v = this.#getItemValue(it.values, col.key, col.filter);\r\n if (col.filterValues.indexOf(v) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n });\r\n } else {\r\n this.#currentSource = list;\r\n }\r\n this.#selectedColumnIndex = -1;\r\n this.#selectedIndexes = [];\r\n this.#startIndex = 0;\r\n this.#scrollTop = 0;\r\n this.#scrollLeft = 0;\r\n this.#rowCount = -1;\r\n\r\n if (this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n this.resize();\r\n }\r\n\r\n get virtual() { return this.#currentSource?.length > this.virtualCount }\r\n\r\n get sortKey() {\r\n if (this.columns == null) {\r\n return null;\r\n }\r\n return this.columns[this.sortIndex]?.key;\r\n }\r\n\r\n get selectedIndexes() { return this.#selectedIndexes }\r\n set selectedIndexes(indexes) {\r\n const startIndex = this.#startIndex;\r\n this.#selectedIndexes.splice(0, this.#selectedIndexes.length, ...indexes);\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (indexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged();\r\n }\r\n }\r\n\r\n get selectedIndex() { return (this.#selectedIndexes && this.#selectedIndexes[0]) ?? -1 }\r\n\r\n get loading() { return this.#refs.loading?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n if (this.#refs.loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n this.#refs.loading.style.visibility = 'hidden';\r\n this.#refs.loading.style.opacity = 0;\r\n } else {\r\n this.#refs.loading.style.visibility = 'visible';\r\n this.#refs.loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n get scrollTop() { return this.#refs.body?.scrollTop; }\r\n set scrollTop(top) {\r\n if (this.#refs.body == null) {\r\n return;\r\n }\r\n this.#refs.body.scrollTop = top;\r\n this.reload();\r\n }\r\n\r\n init(container = this.#parent) {\r\n this.#el = null;\r\n this.#refs = {};\r\n this.#rendering = true;\r\n if (!(container instanceof HTMLElement)) {\r\n throw new Error('no specified parent.');\r\n }\r\n this.#parent = container;\r\n const grid = createElement('div', 'ui-grid');\r\n grid.setAttribute('tabindex', 0);\r\n const onKeydown = e => {\r\n let index = this.selectedIndex;\r\n let flag = false;\r\n if (e.key === 'ArrowUp') {\r\n // up\r\n if (index > 0) {\r\n flag = true;\r\n index -= 1;\r\n }\r\n } else if (e.key === 'ArrowDown') {\r\n // down\r\n const count = this.#currentSource?.length ?? 0;\r\n if (index < count - 1) {\r\n flag = true;\r\n index += 1;\r\n }\r\n }\r\n if (flag) {\r\n this.#selectedIndexes = [index];\r\n this.scrollToIndex(index);\r\n this.refresh();\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(index);\r\n }\r\n e.stopPropagation();\r\n }\r\n };\r\n grid.addEventListener('keydown', e => throttle(onKeydown, 800, this, e));\r\n container.replaceChildren(grid);\r\n const sizer = createElement('span', 'ui-grid-sizer');\r\n grid.appendChild(sizer);\r\n this.#refs.sizer = sizer;\r\n\r\n // header & body\r\n const header = this.#createHeader();\r\n grid.appendChild(header);\r\n const body = this.#createBody();\r\n grid.appendChild(body);\r\n\r\n // loading\r\n const loading = createElement('div', 'ui-grid-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n );\r\n this.#refs.loading = loading;\r\n grid.appendChild(loading);\r\n this.#el = grid;\r\n\r\n this.#rendering = false;\r\n if (this.#source != null && this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n }\r\n\r\n scrollToIndex(index) {\r\n const top = this.#scrollToTop(index * (this.rowHeight + 1), true);\r\n this.#refs.body.scrollTop = top;\r\n }\r\n\r\n resize(force) {\r\n if (this.#rendering || this.#el == null) {\r\n return;\r\n }\r\n const body = this.#refs.body;\r\n // let height = this.#refs.header.offsetHeight + 2;\r\n // let top = body.offsetTop;\r\n // if (top !== height) {\r\n // body.style.top = `${height}px`;\r\n // top = height;\r\n // }\r\n const top = this.headerVisible === false ? 0 : this.#refs.header.offsetHeight;\r\n\r\n let height = this.height;\r\n if (height === 0) {\r\n height = this.#containerHeight;\r\n } else if (isNaN(height) || height < 0) {\r\n height = this.#el.offsetHeight - top;\r\n }\r\n const count = truncate((height - 1) / (this.rowHeight + 1)) + (RedumCount * 2) + 1;\r\n if (force || count !== this.#rowCount) {\r\n this.#rowCount = count;\r\n this.reload();\r\n }\r\n this.#bodyClientWidth = body.clientWidth;\r\n }\r\n\r\n reload() {\r\n let length = this.#currentSource.length;\r\n if (this.extraRows > 0) {\r\n length += this.extraRows;\r\n }\r\n this.#containerHeight = length * (this.rowHeight + 1);\r\n this.#refs.body.scrollTop = 0;\r\n this.#refs.body.scrollLeft = 0;\r\n this.#refs.bodyContent.style.top = '0px';\r\n this.#refs.bodyContainer.style.height = `${this.#containerHeight}px`;\r\n // this.#adjustRows(this.#refs.bodyContent);\r\n this.refresh();\r\n }\r\n\r\n refresh() {\r\n if (this.#refs.bodyContent == null) {\r\n throw new Error('body has not been created.');\r\n }\r\n const widths = {};\r\n this.#fillRows(widths);\r\n if (this.#needResize && widths.flag) {\r\n this.#needResize = false;\r\n this.columns.forEach((col, i) => {\r\n if (!this.#get(col.key, 'autoResize')) {\r\n return;\r\n }\r\n let width = widths[i];\r\n if (width < col.width) {\r\n width = col.width;\r\n }\r\n if (width > 0) {\r\n this.#changeColumnWidth(i, width);\r\n }\r\n });\r\n }\r\n }\r\n\r\n resetChange() {\r\n if (this.#source == null) {\r\n return;\r\n }\r\n for (let row of this.#source) {\r\n delete row.__changed;\r\n }\r\n }\r\n\r\n sortColumn(reload) {\r\n const index = this.sortIndex;\r\n const col = this.columns[index];\r\n if (col == null) {\r\n return;\r\n }\r\n const direction = this.sortDirection;\r\n [...this.#refs.header.children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (i === index) {\r\n arrow.className = `arrow ${(direction !== 1 ? 'desc' : 'asc')}`;\r\n } else if (arrow.className !== 'arrow') {\r\n arrow.className = 'arrow';\r\n }\r\n });\r\n let comparer;\r\n if (typeof col.sortFilter !== 'function') {\r\n const direction = this.sortDirection;\r\n if (isNaN(direction)) {\r\n direction = 1;\r\n }\r\n comparer = (a, b) => {\r\n a = this.#getItemValue(a.values, col.key, col.filter);\r\n b = this.#getItemValue(b.values, col.key, col.filter);\r\n if (a == null && typeof b === 'number') {\r\n a = 0;\r\n } else if (typeof a === 'number' && b == null) {\r\n b = 0;\r\n } else if (a != null && b == null) {\r\n return direction;\r\n } else if (typeof a === 'string' && typeof b === 'string') {\r\n a = a.toLowerCase();\r\n b = b.toLowerCase();\r\n }\r\n return a === b ? 0 : (a > b ? 1 : -1) * direction;\r\n };\r\n } else {\r\n comparer = (a, b) => col.sortFilter(a.values, b.values) * direction;\r\n }\r\n this.#source.sort(comparer);\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource.sort(comparer);\r\n }\r\n if (this.#rowCount < 0) {\r\n return;\r\n }\r\n if (reload) {\r\n this.reload();\r\n } else {\r\n this.refresh();\r\n }\r\n }\r\n\r\n #createHeader() {\r\n const thead = createElement('table', 'ui-grid-header');\r\n if (this.headerVisible === false) {\r\n thead.style.display = 'none';\r\n }\r\n const header = createElement('tr');\r\n thead.appendChild(header);\r\n const sizer = this.#refs.sizer;\r\n for (let col of this.columns) {\r\n if (col.visible === false) {\r\n const hidden = createElement('th');\r\n hidden.style.display = 'none';\r\n if (col.sortable !== false) {\r\n hidden.dataset.key = col.key;\r\n hidden.addEventListener('click', e => this.#onHeaderClicked(e, col, true));\r\n }\r\n header.appendChild(hidden);\r\n continue;\r\n }\r\n // style\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n if (col.width > 0) {\r\n // col.autoResize = false;\r\n } else {\r\n this.#set(col.key, 'autoResize', true);\r\n this.#needResize = true;\r\n sizer.innerText = col.caption ?? '';\r\n let width = sizer.offsetWidth + 22;\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n width += 32;\r\n }\r\n if (col.allowFilter === true) {\r\n width += 14;\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n col.width = width;\r\n }\r\n col.align ??= isCheckbox ? 'center' : 'left';\r\n if (col.sortable !== false) {\r\n col.sortable = true;\r\n }\r\n const w = `${col.width}px`;\r\n const style = {\r\n 'width': w,\r\n 'max-width': w,\r\n 'min-width': w,\r\n 'text-align': col.align\r\n };\r\n this.#set(col.key, 'style', style);\r\n // element\r\n const th = createElement('th', 'column');\r\n th.dataset.key = col.key;\r\n for (let css of Object.entries(style)) {\r\n th.style.setProperty(css[0], css[1]);\r\n }\r\n if (col.sortable) {\r\n th.style.cursor = 'pointer';\r\n th.addEventListener('click', e => this.#onHeaderClicked(e, col));\r\n }\r\n if (col.orderable !== false) {\r\n col.orderable = true;\r\n th.addEventListener('mousedown', e => this.#onDragStart(e, col));\r\n }\r\n const wrapper = createElement('div');\r\n th.appendChild(wrapper);\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n const check = createCheckbox({\r\n onchange: e => this.#onColumnAllChecked(col, e.target.checked)\r\n });\r\n wrapper.appendChild(check);\r\n }\r\n const caption = createElement('span');\r\n if (col.textStyle != null) {\r\n for (let css of Object.entries(col.textStyle)) {\r\n caption.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n caption.innerText = col.caption ?? '';\r\n wrapper.appendChild(caption);\r\n // order arrow\r\n if (col.sortable) {\r\n th.appendChild(createElement('layer', 'arrow'));\r\n }\r\n // filter\r\n if (col.allowFilter === true) {\r\n const filter = createElement('layer', 'filter');\r\n filter.appendChild(createIcon('fa-solid', 'filter'));\r\n filter.addEventListener('mousedown', e => this.#onFilter(e, col));\r\n th.classList.add('header-filter');\r\n th.appendChild(filter);\r\n }\r\n // resize spliter\r\n if (col.resizable !== false) {\r\n const spliter = createElement('layer', 'spliter');\r\n spliter.addEventListener('mousedown', e => this.#onResizeStart(e, col));\r\n spliter.addEventListener('dblclick', e => this.#onAutoResize(e, col));\r\n th.appendChild(spliter);\r\n }\r\n // tooltip\r\n // !nullOrEmpty(col.tooltip) && setTooltip(th, col.tooltip);\r\n header.appendChild(th);\r\n }\r\n const dragger = createElement('div', 'dragger');\r\n const draggerCursor = createElement('layer', 'dragger-cursor');\r\n header.appendChild(createElement('th', null, dragger, draggerCursor));\r\n\r\n sizer.replaceChildren();\r\n this.#refs.header = header;\r\n this.#refs.dragger = dragger;\r\n this.#refs.draggerCursor = draggerCursor;\r\n return thead;\r\n }\r\n\r\n #createBody() {\r\n const body = createElement('div', 'ui-grid-body');\r\n body.addEventListener('scroll', e => throttle(this.#onScroll, RefreshInterval, this, e), { passive: true });\r\n const cols = this.columns;\r\n let width = 1;\r\n for (let col of cols) {\r\n if (col.visible !== false && !isNaN(col.width)) {\r\n width += col.width + 1;\r\n }\r\n }\r\n // body container\r\n const bodyContainer = createElement('div');\r\n bodyContainer.style.position = 'relative';\r\n bodyContainer.style.minWidth = '100%';\r\n bodyContainer.style.minHeight = '1px';\r\n if (width > 0) {\r\n bodyContainer.style.width = `${width}px`;\r\n }\r\n body.appendChild(bodyContainer);\r\n // body content\r\n const bodyContent = createElement('table', 'ui-grid-body-content');\r\n bodyContent.addEventListener('mousedown', e => {\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n const rowIndex = indexOfParent(parent);\r\n let colIndex = indexOfParent(target);\r\n if (colIndex >= this.columns.length) {\r\n colIndex = -1;\r\n }\r\n this.#onRowClicked(e, rowIndex, colIndex);\r\n });\r\n bodyContent.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(bodyContent);\r\n // this.#adjustRows();\r\n // events\r\n if (!this.holderDisabled) {\r\n const holder = createElement('div', 'ui-grid-hover-holder');\r\n holder.addEventListener('mousedown', e => {\r\n const holder = e.currentTarget;\r\n const row = Number(holder.dataset.row);\r\n const col = Number(holder.dataset.col);\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return this.#onRowClicked(e, row + this.#startIndex, col);\r\n });\r\n holder.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(holder);\r\n body.addEventListener('mousemove', e => throttle(this.#onBodyMouseMove, HoverInternal, this, e, holder), { passive: true });\r\n }\r\n this.#refs.body = body;\r\n this.#refs.bodyContainer = bodyContainer;\r\n this.#refs.bodyContent = bodyContent;\r\n\r\n // this.refresh();\r\n return body;\r\n }\r\n\r\n #fillRows(widths) {\r\n let count = this.#rowCount;\r\n if (isNaN(count) || count < 0 || !this.virtual) {\r\n count = this.#currentSource.length;\r\n }\r\n const content = this.#refs.bodyContent;\r\n // content.replaceChildren();\r\n const cols = this.columns;\r\n const vtable = this.#vtable;\r\n const vnew = [];\r\n const startIndex = this.#startIndex;\r\n // reuse\r\n for (let i = 0; i < count; i++) {\r\n const index = startIndex + i;\r\n const e = vtable.findIndex(v => v.index === index);\r\n if (e >= 0) {\r\n vnew[i] = vtable.splice(e, 1)[0];\r\n }\r\n }\r\n // move or create\r\n for (let i = 0; i < count; i++) {\r\n if (vnew[i] != null) {\r\n continue;\r\n }\r\n const index = startIndex + i;\r\n const e = vtable.splice(0, 1);\r\n let vdom;\r\n if (e.length > 0) {\r\n vdom = {\r\n ...e[0],\r\n index,\r\n mode: 'move'\r\n };\r\n vdom.el.remove();\r\n } else {\r\n const row = createElement('tr', 'ui-grid-row');\r\n cols.forEach((col, j) => {\r\n const cell = createElement('td');\r\n if (col.visible !== false) {\r\n cell.dataset.col = String(j);\r\n const style = this.#get(col.key, 'style');\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (col.css != null) {\r\n for (let css of Object.entries(col.css)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (Grid.ColumnTypes.isCheckbox(col.type)) {\r\n cell.appendChild(GridCheckboxColumn.createEdit(e => this.#onRowChanged(e, exists + i, col, e.target.checked)));\r\n // this.#colTypes[col.key] = GridCheckboxColumn;\r\n } else {\r\n let type = this.#colTypes[col.key];\r\n if (type == null) {\r\n if (isNaN(col.type)) {\r\n if (this.allowHtml && col.type != null) {\r\n type = col.type;\r\n }\r\n } else {\r\n type = ColumnTypes[col.type];\r\n }\r\n type ??= GridColumn;\r\n this.#colTypes[col.key] = type;\r\n }\r\n cell.appendChild(type.create(col));\r\n }\r\n }\r\n row.appendChild(cell);\r\n });\r\n row.appendChild(createElement('td'));\r\n vdom = {\r\n index,\r\n mode: 'create',\r\n el: row\r\n };\r\n }\r\n vnew[i] = vdom;\r\n }\r\n this.#vtable = vnew;\r\n\r\n const selectedIndexes = this.#selectedIndexes;\r\n vnew.filter(vdom => vdom.mode != null).forEach(vdom => {\r\n const row = vdom.el;\r\n const index = vdom.index;\r\n const vals = this.#currentSource[index];\r\n if (vals == null) {\r\n return;\r\n }\r\n if (!isPositive(row.children.length)) {\r\n return;\r\n }\r\n // row.dataset.row = String(index);\r\n const item = vals.values;\r\n const selected = selectedIndexes.indexOf(index) >= 0;\r\n if (selected) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n // data\r\n const selectChanged = vals.__selected ^ selected;\r\n if (selected) {\r\n vals.__selected = true;\r\n } else {\r\n delete vals.__selected;\r\n }\r\n cols.forEach((col, j) => {\r\n if (col.visible === false) {\r\n return;\r\n }\r\n let val;\r\n if (col.text != null) {\r\n val = col.text;\r\n } else if (typeof col.filter === 'function') {\r\n val = col.filter(item);\r\n } else {\r\n val = item[col.key];\r\n if (val?.displayValue != null) {\r\n val = val.displayValue;\r\n }\r\n }\r\n val ??= '';\r\n // fill\r\n const cell = row.children[j];\r\n cell.dataset.row = String(index);\r\n if (typeof col.bgFilter === 'function') {\r\n const bgColor = col.bgFilter(item);\r\n cell.style.backgroundColor = bgColor ?? '';\r\n }\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n const type = isCheckbox ? GridCheckboxColumn : this.#colTypes[col.key] ?? GridColumn;\r\n let element;\r\n if (!isCheckbox && selectChanged && typeof type.createEdit === 'function') {\r\n if (vals.__editing?.[col.key] && type.editing) {\r\n val = type.getValue({ target: cell.children[0] });\r\n this.#onRowChanged(null, index, col, val, true);\r\n }\r\n element = selected ?\r\n type.createEdit(e => this.#onRowChanged(e, index, col, type.getValue(e)), col, this.#refs.bodyContent, vals) :\r\n type.create(col);\r\n cell.replaceChildren(element);\r\n } else {\r\n element = cell.children[0];\r\n }\r\n let enabled;\r\n if (this.readonly) {\r\n enabled = false;\r\n } else {\r\n enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n }\r\n type.setValue(element, val, item, col, this);\r\n if (typeof type.setEnabled === 'function') {\r\n type.setEnabled(element, enabled);\r\n }\r\n // auto resize\r\n if (this.#needResize && this.#get(col.key, 'autoResize')) {\r\n const width = element.scrollWidth + 12;\r\n if (width > 0 && widths != null && (isNaN(widths[j]) || widths[j] < width)) {\r\n widths[j] = width;\r\n widths.flag = true;\r\n }\r\n }\r\n if (typeof col.styleFilter === 'function') {\r\n const style = col.styleFilter(item);\r\n if (style != null) {\r\n type.setStyle(element, style);\r\n }\r\n }\r\n if (col.events != null) {\r\n for (let ev of Object.entries(col.events)) {\r\n element[ev[0]] = ev[1].bind(item);\r\n }\r\n }\r\n if (col.attrs != null) {\r\n let attrs = col.attrs;\r\n if (typeof attrs === 'function') {\r\n attrs = attrs(item);\r\n }\r\n for (let attr of Object.entries(attrs)) {\r\n element.setAttribute(attr[0], attr[1]);\r\n }\r\n }\r\n });\r\n if (vals.__editing != null) {\r\n delete vals.__editing;\r\n }\r\n });\r\n\r\n content.replaceChildren(...vnew.map(vdom => vdom.el));\r\n }\r\n\r\n #changeColumnWidth(index, width) {\r\n const col = this.columns[index];\r\n // const oldwidth = col.width;\r\n const w = `${width}px`;\r\n col.width = width;\r\n const style = this.#get(col.key, 'style');\r\n style.width = w;\r\n style['max-width'] = w;\r\n style['min-width'] = w;\r\n let element = this.#refs.header.children[index];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n const body = this.#refs.bodyContent;\r\n for (let row of body.children) {\r\n element = row.children[index];\r\n if (element != null) {\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n }\r\n }\r\n // } else {\r\n // width = this.#refs.bodyContainer.offsetWidth - oldwidth + width;\r\n // this.#refs.bodyContainer.style.width = `${width}px`;\r\n // }\r\n }\r\n\r\n #changingColumnOrder(index, offset, x, offsetLeft) {\r\n const children = this.#refs.header.children;\r\n let element = children[index];\r\n this.#refs.dragger.style.left = `${element.offsetLeft - offsetLeft + offset}px`;\r\n this.#refs.dragger.style.width = element.style.width;\r\n this.#refs.dragger.style.display = 'block';\r\n offset = x - getOffsetLeftFromWindow(element);\r\n let idx;\r\n if (offset < 0) {\r\n offset = -offset;\r\n for (let i = index - 1; i >= 0 && offset >= 0; i -= 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i : i + 1;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= 0;\r\n } else {\r\n const count = children.length;\r\n for (let i = index; i < count - 1 && offset >= 0; i += 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n idx = i;\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i + 1 : i;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= count - 1;\r\n }\r\n if (idx !== this.#colAttrs.__orderIndex) {\r\n this.#colAttrs.__orderIndex = idx;\r\n element = children[idx];\r\n if (element == null) {\r\n return;\r\n }\r\n this.#refs.draggerCursor.style.left = `${element.offsetLeft - offsetLeft}px`;\r\n this.#refs.draggerCursor.style.display = 'block';\r\n }\r\n }\r\n\r\n #changeColumnOrder(index) {\r\n this.#refs.dragger.style.display = '';\r\n this.#refs.draggerCursor.style.display = '';\r\n const orderIndex = this.#colAttrs.__orderIndex;\r\n if (orderIndex >= 0 && orderIndex !== index) {\r\n let targetIndex = orderIndex - index;\r\n if (targetIndex >= 0 && targetIndex <= 1) {\r\n return;\r\n }\r\n const header = this.#refs.header;\r\n const children = header.children;\r\n const rows = this.#refs.bodyContent.children;\r\n const columns = this.columns;\r\n if (targetIndex > 1) {\r\n targetIndex = orderIndex - 1;\r\n // const current = columns[index];\r\n // for (let i = index; i < targetIndex; i += 1) {\r\n // columns[i] = columns[i + 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex].nextElementSibling);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex].nextElementSibling);\r\n }\r\n } else {\r\n targetIndex = orderIndex;\r\n // const current = columns[index];\r\n // for (let i = index; i > targetIndex; i -= 1) {\r\n // columns[i] = columns[i - 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex]);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex]);\r\n }\r\n }\r\n // refresh sortIndex\r\n [...children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (arrow.className !== 'arrow') {\r\n this.sortIndex = i;\r\n }\r\n });\r\n\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Reorder, index, targetIndex);\r\n }\r\n }\r\n }\r\n\r\n #scrollToTop(top, reload) {\r\n const rowHeight = (this.rowHeight + 1);\r\n top -= (top % (rowHeight * 2)) + (RedumCount * rowHeight);\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#containerHeight - (reload ? 0 : this.#rowCount * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#scrollTop !== top) {\r\n this.#scrollTop = top;\r\n if (this.virtual) {\r\n this.#startIndex = top / rowHeight;\r\n }\r\n this.refresh();\r\n if (this.virtual) {\r\n this.#refs.bodyContent.style.top = `${top}px`;\r\n }\r\n } else if (reload) {\r\n this.refresh();\r\n }\r\n\r\n return top;\r\n }\r\n\r\n #get(key, name) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n return null;\r\n }\r\n return attr[name];\r\n }\r\n\r\n #set(key, name, value) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n this.#colAttrs[key] = { [name]: value };\r\n } else {\r\n attr[name] = value;\r\n }\r\n }\r\n\r\n #getItemValue(item, key, filter) {\r\n let value;\r\n if (typeof filter === 'function') {\r\n value = filter(item);\r\n } else {\r\n value = item[key];\r\n }\r\n return value?.value ?? value;\r\n }\r\n\r\n #getRowTarget(target) {\r\n let parent;\r\n while ((parent = target.parentElement) != null && !parent.classList.contains('ui-grid-row')) {\r\n target = parent;\r\n }\r\n return [parent, target];\r\n }\r\n\r\n #notHeader(tagName) {\r\n return /^(input|label|layer|svg|use)$/i.test(tagName);\r\n }\r\n\r\n #onHeaderClicked(e, col, force) {\r\n if (!force && (this.#get(col.key, 'resizing') || this.#get(col.key, 'dragging'))) {\r\n return;\r\n }\r\n if (!this.#notHeader(e.target.tagName)) {\r\n const index = this.columns.indexOf(col);\r\n if (index < 0) {\r\n return;\r\n }\r\n if (this.sortIndex === index) {\r\n this.sortDirection = this.sortDirection === 1 ? -1 : 1;\r\n } else {\r\n this.sortIndex = index;\r\n }\r\n this.sortColumn(true);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Sort, index, this.sortDirection);\r\n }\r\n }\r\n }\r\n\r\n #onCloseFilter() {\r\n const panels = this.#el.querySelectorAll('.filter-panel.active');\r\n if (panels.length > 0) {\r\n panels.forEach(el => el.classList.remove('active'));\r\n setTimeout(() => this.#el.querySelectorAll('.filter-panel').forEach(el => el.remove()), 120);\r\n const filtering = this.#colAttrs.__filtering;\r\n if (filtering instanceof HTMLElement) {\r\n filtering.classList.remove('hover');\r\n }\r\n delete this.#colAttrs.__filtering;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n #onFilter(e, col) {\r\n if (this.#onCloseFilter()) {\r\n return;\r\n }\r\n const close = e => {\r\n if ((e.target.tagName === 'LAYER' && e.target.classList.contains('filter')) ||\r\n e.target.tagName === 'use') {\r\n return;\r\n }\r\n if (this.#onCloseFilter()) {\r\n document.removeEventListener('mousedown', close);\r\n }\r\n }\r\n document.addEventListener('mousedown', close);\r\n const panel = createElement('div', 'filter-panel');\r\n panel.addEventListener('mousedown', e => e.stopPropagation());\r\n const filter = e.currentTarget;\r\n const th = filter.parentElement;\r\n const width = th.offsetWidth;\r\n panel.style.top = `${th.offsetHeight}px`;\r\n panel.style.left = (th.offsetLeft + (width > FilterPanelWidth ? width - FilterPanelWidth : 0)) + 'px';\r\n\r\n // search\r\n let searchbox;\r\n if (col.allowSearch !== false) {\r\n const searchholder = createElement('div', 'filter-search-holder');\r\n searchbox = createElement('input', 'filter-search-box ui-text');\r\n searchbox.type = 'text';\r\n const searchicon = createIcon('fa-regular', 'search');\r\n searchicon.addEventListener('mousedown', e => {\r\n searchbox.focus();\r\n e.preventDefault();\r\n });\r\n searchholder.append(searchbox, searchicon);\r\n panel.append(searchholder);\r\n }\r\n // list\r\n const itemlist = createElement('div', 'filter-item-list');\r\n itemlist.addEventListener('scroll', e => throttle(this.#onFilterScroll, RefreshInterval, this, col, itemlist, e.target.scrollTop), { passive: true });\r\n // - all\r\n const itemall = createElement('div', 'filter-item filter-all');\r\n itemall.appendChild(createCheckbox({\r\n label: this.langs.all,\r\n onchange: e => {\r\n const checked = e.target.checked;\r\n itemlist.querySelectorAll('.filter-content input').forEach(box => box.checked = checked);\r\n }\r\n }));\r\n itemlist.appendChild(itemall);\r\n // - items\r\n let array;\r\n if (Array.isArray(col.filterSource)) {\r\n array = col.filterSource;\r\n } else if (typeof col.filterSource === 'function') {\r\n array = col.filterSource.call(this, col);\r\n } else {\r\n const dict = Object.create(null);\r\n for (let item of this.#source) {\r\n const val = this.#getItemValue(item.values, col.key, col.filter);\r\n if (!Object.hasOwnProperty.call(dict, val)) {\r\n const v = item.values[col.key];\r\n dict[val] = {\r\n value: val,\r\n displayValue: typeof col.filter === 'function' ? col.filter(item.values) : v?.displayValue ?? v\r\n };\r\n }\r\n }\r\n array = Object.values(dict)\r\n .sort((a, b) => {\r\n a = a?.value ?? a;\r\n b = b?.value ?? b;\r\n return a > b ? 1 : a < b ? -1 : 0;\r\n });\r\n }\r\n array = array.map(i => {\r\n if (Object.prototype.hasOwnProperty.call(i, 'value') &&\r\n Object.prototype.hasOwnProperty.call(i, 'displayValue')) {\r\n return i;\r\n }\r\n return {\r\n value: i,\r\n displayValue: i == null ? '' : i\r\n };\r\n });\r\n this.#fillFilterList(col, itemlist, array, itemall);\r\n itemall.querySelector('input').checked = ![...itemlist.querySelectorAll('.filter-content input')].some(i => !i.checked);\r\n panel.appendChild(itemlist);\r\n if (searchbox != null) {\r\n searchbox.addEventListener('input', e => {\r\n const key = e.currentTarget.value.toLowerCase();\r\n const items = key.length === 0 ? array : array.filter(i => {\r\n const displayValue = i?.displayValue ?? i;\r\n return String(displayValue ?? '').indexOf(key) >= 0;\r\n });\r\n this.#fillFilterList(col, itemlist, items, itemall);\r\n });\r\n }\r\n // function\r\n const functions = createElement('div', 'filter-function');\r\n functions.append(\r\n createElement('button', ok => {\r\n ok.innerText = this.langs.ok;\r\n ok.addEventListener('click', () => {\r\n const array = this.#get(col.key, 'filterSource').filter(i => i.__checked !== false);\r\n if (typeof col.onFilterOk === 'function') {\r\n col.onFilterOk.call(this, col, array);\r\n } else {\r\n col.filterValues = array.map(a => a.value);\r\n }\r\n this.#colAttrs.__filtered = true;\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.add('active');\r\n this.#onCloseFilter();\r\n });\r\n }),\r\n createElement('button', reset => {\r\n reset.innerText = this.langs.reset;\r\n reset.addEventListener('click', () => {\r\n delete col.filterValues;\r\n this.#colAttrs.__filtered = this.columns.some(c => col.filterValues != null)\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.remove('active');\r\n this.#onCloseFilter();\r\n });\r\n })\r\n );\r\n panel.appendChild(functions);\r\n\r\n this.#el.appendChild(panel);\r\n setTimeout(() => panel.classList.add('active'), 0);\r\n this.#colAttrs.__filtering = filter;\r\n filter.classList.add('hover');\r\n }\r\n\r\n #fillFilterList(col, list, array, all) {\r\n list.querySelector('.filter-holder')?.remove();\r\n list.querySelector('.filter-content')?.remove();\r\n const rowHeight = this.filterRowHeight;\r\n const height = array.length * rowHeight;\r\n this.#set(col.key, 'filterHeight', height);\r\n const holder = createElement('div', 'filter-holder');\r\n holder.style.height = `${height}px`;\r\n const content = createElement('div', 'filter-content');\r\n content.style.top = `${rowHeight}px`;\r\n this.#set(col.key, 'filterSource', array);\r\n for (let item of array) {\r\n item.__checked = !Array.isArray(col.filterValues) || col.filterValues.indexOf(item.value ?? item) >= 0;\r\n }\r\n if (array.length > 12) {\r\n array = array.slice(0, 12);\r\n }\r\n this.#doFillFilterList(content, array, all);\r\n list.append(holder, content);\r\n }\r\n\r\n #doFillFilterList(content, array, all) {\r\n for (let item of array) {\r\n const div = createElement('div', 'filter-item');\r\n div.appendChild(createCheckbox({\r\n checked: item.__checked,\r\n label: item?.displayValue ?? item,\r\n onchange: e => {\r\n item.__checked = e.target.checked;\r\n all.querySelector('input').checked = ![...content.querySelectorAll('input')].some(i => !i.checked);\r\n }\r\n }));\r\n content.appendChild(div);\r\n }\r\n }\r\n\r\n #onFilterScroll(col, list, top) {\r\n const rowHeight = this.filterRowHeight;\r\n top -= (top % (rowHeight * 2)) + rowHeight;\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#get(col.key, 'filterHeight') - (12 * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#get(col.key, 'filterTop') !== top) {\r\n this.#set(col.key, 'filterTop', top);\r\n const startIndex = top / rowHeight;\r\n let array = this.#get(col.key, 'filterSource');\r\n if (startIndex + 12 < array.length) {\r\n array = array.slice(startIndex, startIndex + 12);\r\n } else {\r\n array = array.slice(-12);\r\n }\r\n const content = list.querySelector('.filter-content');\r\n content.replaceChildren();\r\n this.#doFillFilterList(content, array, list.querySelector('.filter-all>input'));\r\n content.style.top = `${top + rowHeight}px`;\r\n }\r\n }\r\n\r\n #onDragStart(e, col) {\r\n if (this.#notHeader(e.target.tagName)) {\r\n return;\r\n }\r\n const cx = getClientX(e);\r\n const index = indexOfParent(e.currentTarget);\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.dragging = true;\r\n const offsetLeft = this.#refs.header.querySelector('th:last-child').offsetLeft;\r\n const dragmove = e => {\r\n const cx2 = getClientX(e);\r\n const offset = cx2 - cx;\r\n let pos = attr.offset;\r\n let dragging;\r\n if (pos == null && (offset > MiniDragOffset || offset < -MiniDragOffset)) {\r\n dragging = true;\r\n } else if (pos !== offset) {\r\n dragging = true;\r\n }\r\n if (dragging) {\r\n this.#changingColumnOrder(index, offset, cx2, offsetLeft);\r\n attr.offset = offset;\r\n }\r\n };\r\n attr.mousemove = e => throttle(dragmove, RefreshInterval, this, e);\r\n attr.mouseup = () => {\r\n clearEvents(attr);\r\n if (attr.offset == null) {\r\n delete attr.dragging;\r\n } else {\r\n setTimeout(() => {\r\n delete attr.dragging;\r\n delete attr.offset;\r\n });\r\n this.#changeColumnOrder(index);\r\n }\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onResizeStart(e, col) {\r\n const cx = getClientX(e);\r\n const width = col.width;\r\n const index = indexOfParent(e.currentTarget.parentElement);\r\n const window = this.window ?? global;\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.resizing = width;\r\n const resizemove = e => {\r\n const cx2 = getClientX(e);\r\n const val = width + (cx2 - cx);\r\n if (val < MiniColumnWidth) {\r\n return;\r\n }\r\n attr.resizing = val;\r\n attr.sizing = true;\r\n this.#changeColumnWidth(index, val);\r\n };\r\n attr.mousemove = e => throttle(resizemove, RefreshInterval, this, e);\r\n attr.mouseup = e => {\r\n clearEvents(attr);\r\n const width = attr.resizing;\r\n if (width != null) {\r\n setTimeout(() => delete attr.resizing);\r\n if (attr.sizing) {\r\n delete attr.sizing;\r\n delete attr.autoResize;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n e.stopPropagation();\r\n e.preventDefault();\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onAutoResize(e, col) {\r\n const th = e.currentTarget.parentElement;\r\n const index = indexOfParent(th);\r\n let width = th.querySelector('div:first-child').scrollWidth;\r\n for (let row of this.#refs.bodyContent.children) {\r\n const element = row.children[index].children[0];\r\n const w = element.scrollWidth;\r\n if (w > width) {\r\n width = w;\r\n }\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n if (width > 0 && width !== col.width) {\r\n width += 12;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n\r\n #onColumnAllChecked(col, flag) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const key = col.key;\r\n const isFunction = typeof col.enabled === 'function';\r\n const isString = typeof col.enabled === 'string';\r\n if (typeof col.onallchecked === 'function') {\r\n col.onallchecked.call(this, col, flag);\r\n } else {\r\n for (let row of this.#currentSource) {\r\n const item = row.values;\r\n if (item == null) {\r\n continue;\r\n }\r\n const enabled = isFunction ? col.enabled(item) : isString ? item[col.enabled] : col.enabled;\r\n if (enabled !== false) {\r\n item[key] = flag;\r\n row.__changed = true;\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, flag);\r\n }\r\n }\r\n }\r\n this.refresh();\r\n }\r\n }\r\n\r\n #onScroll(e) {\r\n const left = e.target.scrollLeft;\r\n if (this.#scrollLeft !== left) {\r\n this.#scrollLeft = left;\r\n this.#refs.header.style.left = `${-left}px`;\r\n }\r\n if (!this.virtual) {\r\n return;\r\n }\r\n const top = e.target.scrollTop;\r\n this.#scrollToTop(top);\r\n }\r\n\r\n #onBodyMouseMove(e, holder) {\r\n if (e.target.classList.contains('ui-grid-hover-holder')) {\r\n return;\r\n }\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n if (parent == null) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const element = target.children[0];\r\n if (element?.tagName !== 'SPAN') {\r\n if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const row = target.dataset.row;\r\n const col = target.dataset.col;\r\n if (holder.dataset.row === row &&\r\n holder.dataset.col === col) {\r\n return;\r\n }\r\n if (element.scrollWidth > element.offsetWidth) {\r\n holder.dataset.row = row;\r\n holder.dataset.col = col;\r\n holder.innerText = element.innerText;\r\n const top = this.#refs.bodyContent.offsetTop + target.offsetTop;\r\n let left = target.offsetLeft;\r\n let width = holder.offsetWidth;\r\n if (width > this.#bodyClientWidth) {\r\n width = this.#bodyClientWidth;\r\n }\r\n const maxleft = this.#bodyClientWidth + this.#scrollLeft - width;\r\n if (left > maxleft) {\r\n left = maxleft;\r\n }\r\n const height = target.offsetHeight;\r\n holder.style.cssText = `top: ${top}px; left: ${left}px; max-width: ${this.#bodyClientWidth}px; height: ${height - 2}px`;\r\n holder.classList.add('active');\r\n } else if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n }\r\n\r\n #onRowClicked(e, index, colIndex) {\r\n const startIndex = this.#startIndex;\r\n const selectedIndex = startIndex + index;\r\n if (typeof this.willSelect === 'function' && !this.willSelect(selectedIndex, colIndex)) {\r\n return;\r\n }\r\n // multi-select\r\n let flag = false;\r\n const selectedIndexes = this.#selectedIndexes;\r\n if (this.multiSelect) {\r\n if (e.ctrlKey) {\r\n const i = selectedIndexes.indexOf(selectedIndex);\r\n if (i < 0) {\r\n selectedIndexes.push(selectedIndex);\r\n } else {\r\n selectedIndexes.splice(i, 1);\r\n }\r\n flag = true;\r\n } else if (e.shiftKey && selectedIndexes.length > 0) {\r\n if (selectedIndexes.length > 1 || selectedIndexes[0] !== selectedIndex) {\r\n let start = selectedIndexes[selectedIndexes.length - 1];\r\n let end;\r\n if (start > selectedIndex) {\r\n end = start;\r\n start = selectedIndex;\r\n } else {\r\n end = selectedIndex;\r\n }\r\n selectedIndexes.splice(0);\r\n for (let i = start; i <= end; i += 1) {\r\n selectedIndexes.push(i);\r\n }\r\n flag = true;\r\n }\r\n }\r\n }\r\n if (!flag && selectedIndexes.length !== 1 || selectedIndexes[0] !== selectedIndex) {\r\n selectedIndexes.splice(0, selectedIndexes.length, selectedIndex);\r\n flag = true;\r\n }\r\n // apply style\r\n if (flag) {\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (selectedIndexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(selectedIndex);\r\n }\r\n }\r\n this.#selectedColumnIndex = colIndex;\r\n if ((this.fullrowClick || colIndex >= 0) && e.buttons === 1 && typeof this.cellClicked === 'function') {\r\n if (this.cellClicked(selectedIndex, colIndex) === false) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n }\r\n }\r\n\r\n #onRowDblClicked(e) {\r\n if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'LAYER' && e.target.className === 'ui-check-inner' || e.target.tagName === 'LABEL' && (e.target.className === 'ui-drop-text' || e.target.className === 'ui-drop-caret')) {\r\n return;\r\n }\r\n const index = this.selectedIndex;\r\n if (typeof this.rowDblClicked === 'function') {\r\n this.rowDblClicked(index);\r\n }\r\n if (typeof this.cellDblClicked === 'function') {\r\n const colIndex = this.#selectedColumnIndex;\r\n if (this.fullrowClick || colIndex >= 0) {\r\n this.cellDblClicked(index, colIndex);\r\n }\r\n }\r\n }\r\n\r\n #onRowChanged(_e, index, col, value, blur) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const row = this.#currentSource[this.#startIndex + index];\r\n const item = row.values;\r\n if (item == null) {\r\n return;\r\n }\r\n let enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n if (enabled !== false) {\r\n item[col.key] = value;\r\n row.__changed = true;\r\n if (blur) {\r\n if (typeof col.oneditend === 'function') {\r\n col.oneditend.call(this, item, value);\r\n }\r\n } else {\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, value);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default Grid;","import \"./css/popup.scss\";\r\nimport { r } from \"../utility/lgres\";\r\nimport { nullOrEmpty } from \"../utility/strings\";\r\nimport { global } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon, changeIcon } from \"./icon\";\r\n\r\nconst ResizeMods = {\r\n right: 1,\r\n bottom: 2,\r\n left: 4,\r\n top: 8,\r\n bottomRight: 2 | 1,\r\n bottomLeft: 2 | 4,\r\n topRight: 8 | 1,\r\n topLeft: 8 | 4\r\n}\r\n\r\n// const Cursors = {\r\n// [ResizeMods.right]: 'ew-resize',\r\n// [ResizeMods.bottom]: 'ns-resize',\r\n// [ResizeMods.bottomRight]: 'nwse-resize',\r\n// [ResizeMods.left]: 'ew-resize',\r\n// [ResizeMods.bottomLeft]: 'nesw-resize',\r\n// [ResizeMods.top]: 'ns-resize',\r\n// [ResizeMods.topRight]: 'nesw-resize',\r\n// [ResizeMods.topLeft]: 'nwse-resize'\r\n// }\r\n\r\nfunction trimPx(px) {\r\n if (typeof px !== 'string') {\r\n return px;\r\n }\r\n if (px.endsWith('px')) {\r\n const size = Number(px.substring(0, px.length - 2));\r\n return isNaN(size) ? px : size;\r\n }\r\n return px;\r\n}\r\n\r\nclass Popup {\r\n #mask;\r\n #option;\r\n #bounds;\r\n // #cursor;\r\n\r\n constructor(opts = {}) {\r\n this.#option = opts;\r\n }\r\n\r\n get container() { return this.#mask.querySelector('.ui-popup-container') }\r\n\r\n get rect() {\r\n const container = this.container;\r\n if (container == null) {\r\n return null;\r\n }\r\n const style = global.getComputedStyle(container);\r\n const collapsed = container.classList.contains('ui-popup-collapse');\r\n const bounds = this.#bounds;\r\n return {\r\n collapsed,\r\n left: trimPx(style.left),\r\n top: trimPx(style.top),\r\n width: collapsed === true && bounds != null ? bounds.width : trimPx(style.width),\r\n height: collapsed === true && bounds != null ? bounds.height : trimPx(style.height)\r\n };\r\n }\r\n set rect(r) {\r\n const container = this.container;\r\n if (container == null) {\r\n return;\r\n }\r\n const css = [];\r\n if (!isNaN(r.left)) {\r\n css.push(`left: ${r.left}px`);\r\n }\r\n if (!isNaN(r.top)) {\r\n css.push(`top: ${r.top}px`);\r\n }\r\n const collapse = container.querySelector('.ui-popup-header>.icon-expand');\r\n if (r.collapsed === true) {\r\n css.push('width: 160px', 'height: 40px');\r\n this.#bounds = r;\r\n container.classList.add('ui-popup-collapse');\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n } else {\r\n if (!isNaN(r.width) && r.width > 0) {\r\n css.push(`width: ${r.width}px`);\r\n }\r\n if (!isNaN(r.height) && r.height > 0) {\r\n css.push(`height: ${r.height}px`);\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n this.#bounds = null;\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n }\r\n }\r\n if (css.length > 0) {\r\n container.style.cssText += css.join('; ');\r\n }\r\n }\r\n\r\n create() {\r\n const mask = createElement('div', 'ui-popup-mask');\r\n if (this.#option.mask === false) {\r\n mask.classList.add('ui-popup-transparent');\r\n }\r\n const container = createElement('div', 'ui-popup-container');\r\n let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n if (tabIndex < 0) {\r\n tabIndex = 0;\r\n }\r\n container.tabIndex = tabIndex + 1;\r\n const close = () => {\r\n mask.classList.add('ui-popup-active');\r\n mask.style.opacity = 0;\r\n setTimeout(() => mask.remove(), 120);\r\n };\r\n let content = this.#option.content;\r\n if (!(content instanceof HTMLElement)) {\r\n content = createElement('div', d => d.innerText = content);\r\n }\r\n container.append(\r\n createElement('div', header => {\r\n header.className = 'ui-popup-header';\r\n let title = this.#option.title;\r\n if (!(title instanceof HTMLElement)) {\r\n title = createElement('div', t => {\r\n t.className = 'ui-popup-header-title';\r\n t.innerText = title;\r\n });\r\n }\r\n header.appendChild(title);\r\n if (this.#option.movable !== false) {\r\n const move = title.querySelector('.ui-popup-move') ?? title;\r\n move.addEventListener('mousedown', e => {\r\n const x = e.clientX - container.offsetLeft;\r\n const y = e.clientY - container.offsetTop;\r\n let moved;\r\n const move = e => {\r\n container.style.left = `${e.clientX - x}px`;\r\n container.style.top = `${e.clientY - y}px`;\r\n moved = true;\r\n };\r\n mask.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n mask.removeEventListener('mousemove', move, { passive: false });\r\n mask.removeEventListener('mouseup', up);\r\n if (moved === true && typeof this.#option.onMoveEnded === 'function') {\r\n this.#option.onMoveEnded.call(this);\r\n }\r\n moved = false;\r\n };\r\n mask.addEventListener('mouseup', up);\r\n });\r\n }\r\n if (this.#option.collapsable === true) {\r\n const collapse = createIcon('fa-regular', 'compress-alt');\r\n collapse.tabIndex = tabIndex + 2;\r\n collapse.classList.add('icon-expand');\r\n collapse.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n collapse.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n collapse.addEventListener('click', () => {\r\n if (container.classList.contains('ui-popup-collapse')) {\r\n const bounds = this.#bounds;\r\n if (bounds != null) {\r\n container.style.cssText += `width: ${bounds.width}px; height: ${bounds.height}px`;\r\n this.#bounds = null;\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n } else {\r\n const rect = this.rect;\r\n this.#bounds = rect;\r\n container.style.cssText += `width: 160px; height: 40px`;\r\n container.classList.add('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n });\r\n header.appendChild(collapse);\r\n }\r\n const cancel = createIcon('fa-regular', 'times');\r\n cancel.tabIndex = tabIndex + 3;\r\n cancel.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n close();\r\n }\r\n });\r\n cancel.addEventListener('click', () => close());\r\n header.appendChild(cancel);\r\n }),\r\n createElement('div', 'ui-popup-body', content, createElement('div', 'ui-popup-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n ))\r\n );\r\n if (Array.isArray(this.#option.buttons)) {\r\n tabIndex = Math.max.apply(null, [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n container.appendChild(\r\n createElement('div', 'ui-popup-footer', ...this.#option.buttons.map((b, i) => {\r\n const button = createElement('button', 'ui-popup-button');\r\n if (b.tabIndex > 0) {\r\n button.tabIndex = b.tabIndex;\r\n } else {\r\n button.tabIndex = tabIndex + i + 1;\r\n }\r\n button.innerText = b.text;\r\n button.addEventListener('click', () => {\r\n if (typeof b.trigger === 'function') {\r\n const result = b.trigger(this);\r\n if (typeof result?.then === 'function') {\r\n result.then(r => {\r\n if (r !== false) {\r\n close();\r\n }\r\n }).catch(() => { });\r\n } else if (result !== false) {\r\n close();\r\n }\r\n } else {\r\n close();\r\n }\r\n });\r\n return button;\r\n }))\r\n );\r\n const tabs = [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0);\r\n const tabMin = Math.min.apply(null, tabs);\r\n const tabMax = Math.max.apply(null, tabs);\r\n const last = container.querySelector(`[tabindex=\"${tabMax}\"]`);\r\n if (last != null) {\r\n last.addEventListener('keydown', e => {\r\n if (e.key === 'Tab') {\r\n const first = container.querySelector(`[tabindex=\"${tabMin}\"]`);\r\n first?.focus();\r\n e.preventDefault();\r\n }\r\n });\r\n }\r\n }\r\n // resizable\r\n if (this.#option.resizable === true) {\r\n container.append(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.right, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottom, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.left, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.top, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomRight, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topRight, e));\r\n })\r\n )\r\n }\r\n mask.appendChild(container);\r\n this.#mask = mask;\r\n return mask;\r\n }\r\n\r\n show(parent = document.body) {\r\n if (parent == null) {\r\n return;\r\n }\r\n let mask = this.#mask ?? this.create();\r\n parent.appendChild(mask);\r\n if (this.#option.mask === false) {\r\n // calculator position\r\n const container = this.container;\r\n container.style.left = String((parent.offsetWidth - container.offsetWidth) / 2) + 'px';\r\n container.style.top = String((parent.offsetHeight - container.offsetHeight) / 2) + 'px';\r\n }\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n mask.style.opacity = 1;\r\n this.container.focus();\r\n resolve(mask);\r\n }, 0);\r\n });\r\n }\r\n\r\n get loading() { return this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading')?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n let loading = this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading');\r\n if (loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n loading.style.visibility = 'hidden';\r\n loading.style.opacity = 0;\r\n } else {\r\n loading.style.visibility = 'visible';\r\n loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n #resize(mod, e) {\r\n const container = this.container;\r\n const option = this.#option;\r\n if (typeof option.onResizeStarted === 'function') {\r\n option.onResizeStarted.call(this);\r\n }\r\n const mask = this.#mask;\r\n // this.#cursor = mask.style.cursor;\r\n // mask.style.cursor = Cursors[mod];\r\n const originalX = e.clientX;\r\n const originalY = e.clientY;\r\n const original = {\r\n width: container.offsetWidth,\r\n height: container.offsetHeight,\r\n left: container.offsetLeft,\r\n top: container.offsetTop\r\n };\r\n const minWidth = option.minWidth ?? 200;\r\n const minHeight = option.minHeight ?? 200;\r\n let resized;\r\n const move = e => {\r\n const offsetX = e.clientX - originalX;\r\n const offsetY = e.clientY - originalY;\r\n let width = original.width;\r\n let height = original.height;\r\n let x = original.left;\r\n let y = original.top;\r\n if ((mod & ResizeMods.right) === ResizeMods.right) {\r\n width += offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n }\r\n }\r\n if ((mod & ResizeMods.bottom) === ResizeMods.bottom) {\r\n height += offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n }\r\n }\r\n if ((mod & ResizeMods.left) === ResizeMods.left) {\r\n width -= offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n x = originalX + original.width - minWidth;\r\n } else {\r\n x += offsetX;\r\n }\r\n }\r\n if ((mod & ResizeMods.top) === ResizeMods.top) {\r\n height -= offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n y = originalY + original.height - minHeight;\r\n } else {\r\n y += offsetY;\r\n }\r\n }\r\n if (typeof option.onResizing === 'function') {\r\n option.onResizing.call(this, x, y, width, height);\r\n } else {\r\n container.style.cssText += `left: ${x}px; top: ${y}px; width: ${width}px; height: ${height}px`;\r\n }\r\n resized = true;\r\n }\r\n const parent = option.mask === false ? mask.parentElement : mask;\r\n parent.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n parent.removeEventListener('mousemove', move, { passive: false });\r\n parent.removeEventListener('mouseup', up);\r\n // mask.style.cursor = this.#cursor;\r\n if (resized === true && typeof option.onResizeEnded === 'function') {\r\n option.onResizeEnded.call(this);\r\n }\r\n resized = false;\r\n };\r\n parent.addEventListener('mouseup', up);\r\n }\r\n}\r\n\r\nexport default Popup;\r\n\r\nexport function createPopup(title, content, ...buttons) {\r\n const popup = new Popup({\r\n title,\r\n content,\r\n buttons\r\n });\r\n return popup;\r\n}\r\n\r\nconst iconTypes = {\r\n 'info': 'info-circle',\r\n 'information': 'info-circle',\r\n 'warn': 'exclamation-triangle',\r\n 'warning': 'exclamation-triangle',\r\n 'question': 'question-circle',\r\n 'error': 'times-circle'\r\n}\r\n\r\nexport function showAlert(title, message, iconType = 'info', parent = document.body) {\r\n return new Promise(resolve => {\r\n const popup = new Popup({\r\n title,\r\n content: createElement('div', 'message-wrapper',\r\n createIcon('fa-solid', iconTypes[iconType] ?? 'info-circle'),\r\n createElement('span', span => span.innerText = message)\r\n ),\r\n buttons: [\r\n { text: r('ok', 'OK'), trigger: resolve }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}\r\n\r\nexport function showConfirm(title, content, buttons, iconType = 'question', parent = document.body) {\r\n return new Promise(resolve => {\r\n const wrapper = createElement('div', 'message-wrapper');\r\n if (!nullOrEmpty(iconType)) {\r\n wrapper.appendChild(createIcon('fa-solid', iconTypes[iconType] ?? 'question-circle'));\r\n }\r\n wrapper.appendChild(content instanceof HTMLElement ?\r\n content :\r\n createElement('span', span => span.innerText = content));\r\n const popup = new Popup({\r\n title,\r\n content: wrapper,\r\n buttons: buttons?.map(b => {\r\n return {\r\n text: b.text,\r\n trigger: p => {\r\n let result;\r\n if (typeof b.trigger === 'function') {\r\n result = b.trigger(p, b);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n r !== false && resolve(r);\r\n return r;\r\n });\r\n }\r\n result !== false && resolve(result);\r\n } else {\r\n result = {\r\n key: b.key,\r\n popup: p\r\n };\r\n resolve(result);\r\n }\r\n return result;\r\n }\r\n };\r\n }) ??\r\n [\r\n { text: r('yes', 'Yes'), trigger: p => resolve({ key: 'yes', popup: p }) },\r\n { text: r('no', 'No'), trigger: p => resolve({ key: 'no', popup: p }) }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}"],"names":["createElement","tagName","init","children","element","svgns","createUse","type","id","c","path","ver","use","changeIcon","svg","createIcon","style","css","resolveIcon","container","svgs","icon","fillCheckbox","label","tabindex","charactor","layer","e","input","span","createRadiobox","opts","entry","createCheckbox","resolveCheckbox","legacy","checks","chk","text","boxes","box","setTooltip","content","flag","parent","isParent","tipid","tip","wrapper","cnt","tipId","tid","p","left","top","offsetParent","resolveTooltip","tips","title","nullOrEmpty","s","contains","key","ignoreCase","r","defaultValue","g","isPositive","n","isMobile","throttle","method","delay","context","args","current","truncate","v","SymbolDropdown","DropdownTitleHeight","DropdownItemHeight","dropdownGlobal","global","panel","dropId","dropdown","selectItems","itemlist","htmlkey","textkey","htmls","it","filterSource","searchkeys","source","k","_Dropdown","options","__privateAdd","_expanded","_dropdown","_filllist","_triggerselect","_options","_wrapper","_container","_label","_allChecked","_source","_lastSelected","_selected","_selectedList","__publicField","__privateSet","__privateGet","header","up","down","count","valuekey","index","target","_a","__privateMethod","dropdown_fn","active","expanded_get","filllist_fn","list","selected","silence","item","expanded","li","html","val","selectedlist","dom","selects","sel","drop","Dropdown","_b","search","value","multiselect","allchecked","triggerselect_fn","scrolled","i","checkbox","GridColumn","GridInputColumn","trigger","col","_parent","vals","enabled","GridTextColumn","_item","_col","grid","lines","_GridDropdownColumn","_getSource","getSource_fn","_setValue","setValue_fn","_getDrop","getDrop_fn","GridDropdownColumn","dropGlobal","data","__superGet","GridCheckboxColumn","GridIconColumn","className","tooltip","ColumnChangedType","RefreshInterval","HoverInternal","RedumCount","MiniDragOffset","MiniColumnWidth","FilterPanelWidth","getClientX","getOffsetLeftFromWindow","indexOfParent","ColumnTypes","_Grid","_refreshSource","_createHeader","_createBody","_fillRows","_changeColumnWidth","_changingColumnOrder","_changeColumnOrder","_scrollToTop","_get","_set","_getItemValue","_getRowTarget","_notHeader","_onHeaderClicked","_onCloseFilter","_onFilter","_fillFilterList","_doFillFilterList","_onFilterScroll","_onDragStart","_onResizeStart","_onAutoResize","_onColumnAllChecked","_onScroll","_onBodyMouseMove","_onRowClicked","_onRowDblClicked","_onRowChanged","_currentSource","_el","_refs","_rendering","_selectedColumnIndex","_selectedIndexes","_startIndex","_needResize","_containerHeight","_bodyClientWidth","_rowCount","_scrollTop","_scrollLeft","_colTypes","_colAttrs","_vtable","refreshSource_fn","indexes","startIndex","row","onKeydown","sizer","createHeader_fn","body","createBody_fn","loading","scrollToTop_fn","force","height","length","widths","fillRows_fn","get_fn","width","changeColumnWidth_fn","reload","direction","th","arrow","comparer","a","b","getItemValue_fn","Grid","thead","hidden","onHeaderClicked_fn","isCheckbox","set_fn","w","onDragStart_fn","check","onColumnAllChecked_fn","caption","filter","onFilter_fn","spliter","onResizeStart_fn","onAutoResize_fn","dragger","draggerCursor","onScroll_fn","cols","bodyContainer","bodyContent","getRowTarget_fn","rowIndex","colIndex","onRowClicked_fn","onRowDblClicked_fn","holder","onBodyMouseMove_fn","vtable","vnew","vdom","j","cell","onRowChanged_fn","selectedIndexes","selectChanged","bgColor","ev","attrs","attr","changingColumnOrder_fn","offset","x","offsetLeft","idx","changeColumnOrder_fn","orderIndex","targetIndex","rows","columns","rowHeight","bottomTop","name","notHeader_fn","onCloseFilter_fn","panels","el","filtering","close","searchbox","searchholder","searchicon","onFilterScroll_fn","itemall","checked","array","dict","fillFilterList_fn","items","displayValue","functions","ok","reset","all","doFillFilterList_fn","div","cx","clearEvents","event","dragmove","cx2","pos","dragging","window","resizemove","isFunction","isString","maxleft","selectedIndex","start","end","_e","blur","ResizeMods","trimPx","px","size","Popup","_resize","_mask","_option","_bounds","collapsed","bounds","collapse","mask","tabIndex","d","t","y","moved","move","rect","cancel","button","result","tabs","tabMin","tabMax","last","first","resize_fn","resolve","_c","mod","option","originalX","originalY","original","minWidth","minHeight","resized","offsetX","offsetY","createPopup","buttons","iconTypes","showAlert","message","iconType","showConfirm"],"mappings":"+oCAAO,SAASA,EAAcC,EAASC,KAASC,EAAU,CACtD,MAAMC,EAAU,SAAS,cAAcH,CAAO,EAC9C,OAAI,OAAOC,GAAS,WAChBA,EAAKE,CAAO,EACLF,GAAQ,OACfE,EAAQ,UAAYF,GAEpBC,EAAS,OAAS,GAClBC,EAAQ,OAA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GAAA,YAAAA,EAAQ,OAAS,WACxB,OAAOA,EAAO,KAAKzT,IACfA,IAAM,IAASgU,EAAQhU,CAAC,EACjBA,EACV,EAELyT,IAAW,IAASO,EAAQP,CAAM,OAElCA,EAAS,CACL,IAAKtH,EAAE,IACP,MAAO/M,CACvC,EAC4B4U,EAAQP,CAAM,EAElB,OAAOA,CACV,CACrB,MAEgB,CACI,CAAE,KAAMzT,EAAE,MAAO,KAAK,EAAG,QAASZ,GAAK4U,EAAQ,CAAE,IAAK,MAAO,MAAO5U,CAAG,CAAA,CAAG,EAC1E,CAAE,KAAMY,EAAE,KAAM,IAAI,EAAG,QAASZ,GAAK4U,EAAQ,CAAE,IAAK,KAAM,MAAO5U,CAAG,CAAA,CAAG,CAC1E,CACjB,CAAS,EACK,KAAKR,CAAM,EAAE,KAAKmU,GAAQ,CAC5B,MAAMS,EAAST,EAAK,cAAc,kEAAkE,EACpGS,GAAA,MAAAA,EAAQ,OACpB,CAAS,CACT,CAAK,CACL"} \ No newline at end of file +{"version":3,"file":"ui.min.js","sources":["../lib/functions.js","../lib/ui/icon.js","../lib/ui/checkbox.js","../lib/ui/tooltip.js","../lib/utility/strings.js","../lib/utility/lgres.js","../lib/utility.js","../lib/ui/dropdown.js","../lib/ui/grid/column.js","../lib/ui/grid/grid.js","../lib/ui/popup.js"],"sourcesContent":["export function createElement(tagName, init, ...children) {\r\n const element = document.createElement(tagName);\r\n if (typeof init === 'function') {\r\n init(element);\r\n } else if (init != null) {\r\n element.className = init;\r\n }\r\n if (children.length > 0) {\r\n element.append(...children);\r\n }\r\n return element;\r\n}\r\n","const svgns = 'http://www.w3.org/2000/svg';\r\n\r\nfunction createUse(type, id) {\r\n const c = typeof consts !== 'undefined' ? consts : {};\r\n const path = c.path || '';\r\n const ver = c.resver == null ? '' : `?${c.resver}`;\r\n const use = document.createElementNS(svgns, 'use');\r\n use.setAttributeNS('http://www.w3.org/1999/xlink', 'xlink:href', `${path}fonts/${type}.svg${ver}#${id}`);\r\n return use;\r\n}\r\n\r\nfunction changeIcon(svg, type, id) {\r\n if (svg instanceof SVGElement) {\r\n svg.replaceChildren(createUse(type, id));\r\n }\r\n return svg;\r\n}\r\n\r\nfunction createIcon(type, id, style) {\r\n const svg = document.createElementNS(svgns, 'svg');\r\n svg.appendChild(createUse(type, id));\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n svg.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n return svg;\r\n}\r\n\r\nfunction resolveIcon(container) {\r\n const svgs = container.querySelectorAll('svg[data-id]');\r\n for (let icon of svgs) {\r\n const type = icon.dataset.type;\r\n const id = icon.dataset.id;\r\n icon.replaceChildren(createUse(type, id));\r\n icon.removeAttribute('data-type');\r\n icon.removeAttribute('data-id');\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n createIcon,\r\n changeIcon,\r\n resolveIcon\r\n}","import './css/checkbox.scss';\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon } from \"./icon\";\r\n\r\nfunction fillCheckbox(container, type = 'fa-regular', label, tabindex = -1, charactor = 'check') {\r\n container.appendChild(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-check-inner';\r\n layer.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n const input = container.querySelector('input');\r\n if (input != null) {\r\n input.checked = !input.checked;\r\n input.dispatchEvent(new Event('change'));\r\n }\r\n }\r\n });\r\n if (tabindex >= 0) {\r\n layer.tabIndex = tabindex;\r\n }\r\n }, createIcon(type, charactor))\r\n );\r\n if (label instanceof Element) {\r\n container.appendChild(label);\r\n } else if (label?.length > 0) {\r\n container.appendChild(\r\n createElement('span', span => span.innerText = label)\r\n );\r\n }\r\n}\r\n\r\nfunction createRadiobox(opts = {}) {\r\n const container = createElement('label', 'ui-check-wrapper ui-radio-wrapper',\r\n createElement('input', input => {\r\n input.setAttribute('type', 'radio');\r\n input.name = opts.name;\r\n if (opts.checked === true) {\r\n input.checked = true;\r\n }\r\n if (opts.enabled === false) {\r\n input.disabled = true;\r\n }\r\n if (opts.customerAttributes != null) {\r\n for (let entry of Object.entries(opts.customerAttributes)) {\r\n input.setAttribute(entry[0], entry[1]);\r\n }\r\n }\r\n if (typeof opts.onchange === 'function') {\r\n input.addEventListener('change', opts.onchange);\r\n }\r\n }));\r\n if (opts.className) {\r\n container.classList.add(opts.className);\r\n }\r\n fillCheckbox(container, opts.type, opts.label, opts.tabIndex, 'circle');\r\n return container;\r\n}\r\n\r\nfunction createCheckbox(opts = {}) {\r\n const container = createElement('label', 'ui-check-wrapper',\r\n createElement('input', input => {\r\n input.setAttribute('type', 'checkbox');\r\n if (opts.checked === true) {\r\n input.checked = true;\r\n }\r\n if (opts.enabled === false) {\r\n input.disabled = true;\r\n }\r\n if (opts.customerAttributes != null) {\r\n for (let entry of Object.entries(opts.customerAttributes)) {\r\n input.setAttribute(entry[0], entry[1]);\r\n }\r\n }\r\n if (typeof opts.onchange === 'function') {\r\n input.addEventListener('change', opts.onchange);\r\n }\r\n }));\r\n if (opts.className) {\r\n container.classList.add(opts.className);\r\n }\r\n if (opts.enabled === false) {\r\n container.classList.add('disabled');\r\n }\r\n if (opts.checkedNode != null && opts.uncheckedNode != null) {\r\n container.classList.add('ui-check-image-wrapper');\r\n let height = opts.imageHeight;\r\n if (isNaN(height) || height <= 0) {\r\n height = 14;\r\n }\r\n opts.checkedNode.classList.add('checked');\r\n container.appendChild(opts.checkedNode);\r\n opts.uncheckedNode.classList.add('unchecked');\r\n container.appendChild(opts.uncheckedNode);\r\n } else {\r\n fillCheckbox(container, opts.type, opts.label, opts.tabIndex);\r\n }\r\n return container;\r\n}\r\n\r\nfunction resolveCheckbox(container = document.body, legacy) {\r\n if (legacy) {\r\n const checks = container.querySelectorAll('input[type=\"checkbox\"]');\r\n for (let chk of checks) {\r\n if (chk.parentElement.classList.contains('ui-check-wrapper')) {\r\n // skip\r\n continue;\r\n }\r\n const id = chk.id;\r\n let label, text;\r\n if (id != null) {\r\n label = container.querySelector(`label[for=\"${id}\"]`);\r\n }\r\n if (label == null) {\r\n const e = chk.nextElementSibling;\r\n if (e != null) {\r\n if (e.tagName === 'LABEL') {\r\n label = e;\r\n } else if (e.tagName === 'SPAN' && e.dataset.lgid != null) {\r\n text = e.innerText;\r\n e.style.display = 'none';\r\n }\r\n }\r\n }\r\n if (label == null) {\r\n const e = chk.previousElementSibling;\r\n if (e != null) {\r\n if (e.tagName === 'LABEL') {\r\n label = e;\r\n } else if (text == null && e.tagName === 'SPAN' && e.dataset.lgid != null) {\r\n text = e.innerText;\r\n e.style.display = 'none';\r\n }\r\n }\r\n }\r\n if (label == null) {\r\n label = createElement('label');\r\n chk.parentElement.insertBefore(label, chk);\r\n } else {\r\n text = label.innerText;\r\n }\r\n if (chk.disabled) {\r\n label.className = 'ui-check-wrapper disabled';\r\n } else {\r\n label.className = 'ui-check-wrapper';\r\n }\r\n label.replaceChildren();\r\n fillCheckbox(label, 'fa-regular', text, chk.tabIndex);\r\n label.insertBefore(chk, label.firstChild);\r\n }\r\n }\r\n const boxes = container.querySelectorAll('label[data-checkbox]');\r\n for (let box of boxes) {\r\n if (!box.classList.contains('ui-check-wrapper')) {\r\n box.classList.add('ui-check-wrapper');\r\n }\r\n if (box.hasChildNodes()) {\r\n if (!box.classList.contains('ui-check-image-wrapper')) {\r\n box.classList.add('ui-check-image-wrapper');\r\n }\r\n } else {\r\n fillCheckbox(box,\r\n box.dataset.type,\r\n box.dataset.label,\r\n box.dataset.tabIndex)\r\n box.removeAttribute('data-type');\r\n box.removeAttribute('data-label');\r\n }\r\n const input = createElement('input');\r\n const id = box.dataset.id;\r\n if (id?.length > 0) {\r\n input.id = id;\r\n }\r\n if (box.dataset.checked != null) {\r\n input.checked = true;\r\n }\r\n input.setAttribute('type', 'checkbox');\r\n box.insertBefore(input, box.firstChild);\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n createCheckbox,\r\n resolveCheckbox,\r\n createRadiobox\r\n}","import './css/tooltip.scss';\r\nimport { createElement } from \"../functions\";\r\n// import { global } from \"../utility\";\r\n\r\nfunction setTooltip(container, content, flag = false, parent = null) {\r\n const isParent = parent instanceof HTMLElement;\r\n if (isParent) {\r\n const tipid = container.dataset.tipId;\r\n const tip = parent.querySelector(`.ui-tooltip-wrapper[data-tip-id=\"${tipid}\"]`);\r\n tip?.remove();\r\n } else {\r\n const tip = container.querySelector('.ui-tooltip-wrapper');\r\n tip?.remove();\r\n }\r\n const wrapper = createElement('div', wrapper => {\r\n wrapper.className = 'ui-tooltip-wrapper ui-tooltip-color';\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n wrapper.style.top = '0';\r\n wrapper.style.left = '0';\r\n },\r\n createElement('div', 'ui-tooltip-pointer ui-tooltip-color'),\r\n createElement('div', 'ui-tooltip-curtain ui-tooltip-color'),\r\n createElement('div', cnt => {\r\n cnt.className = 'ui-tooltip-content';\r\n if (content instanceof Element) {\r\n cnt.appendChild(content);\r\n } else {\r\n cnt.innerText = content;\r\n }\r\n })\r\n );\r\n // container.insertAdjacentElement('afterend', wrapper);\r\n if (isParent) {\r\n const tipId = String(Math.random()).substring(2);\r\n container.dataset.tipId = tipId;\r\n wrapper.dataset.tipId = tipId;\r\n parent.appendChild(wrapper);\r\n } else {\r\n container.appendChild(wrapper);\r\n }\r\n\r\n let tid;\r\n container.addEventListener('mouseenter', () => {\r\n tid && clearTimeout(tid);\r\n let c = container;\r\n while (c?.offsetWidth == null) {\r\n c = c.parentElement;\r\n }\r\n if (c == null) {\r\n return;\r\n }\r\n if (!flag || c.scrollWidth > c.offsetWidth) {\r\n tid = setTimeout(() => {\r\n let p;\r\n let left;\r\n let top;\r\n left = c.offsetLeft;\r\n top = c.offsetTop;\r\n if (isParent) {\r\n p = c.offsetParent;\r\n while (p != null && p !== parent) {\r\n left += p.offsetLeft;\r\n top += p.offsetTop;\r\n p = p.offsetParent;\r\n }\r\n }\r\n p = c.parentElement;\r\n const offsetParent = c.offsetParent;\r\n while (p != null && p !== (isParent ? parent : offsetParent)) {\r\n left -= p.scrollLeft;\r\n top -= p.scrollTop;\r\n p = p.parentElement;\r\n }\r\n left += (c.offsetWidth - wrapper.offsetWidth) / 2;\r\n top -= wrapper.offsetHeight + 14;\r\n wrapper.style.left = `${left}px`;\r\n wrapper.style.top = `${top}px`;\r\n wrapper.style.visibility = 'visible';\r\n wrapper.style.opacity = 1;\r\n }, 100);\r\n }\r\n });\r\n container.addEventListener('mouseleave', () => {\r\n tid && clearTimeout(tid);\r\n tid = setTimeout(() => {\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n }, 300);\r\n });\r\n return container;\r\n}\r\n\r\nfunction resolveTooltip(container = document.body) {\r\n const tips = container.querySelectorAll('[title]');\r\n for (let tip of tips) {\r\n const title = tip.getAttribute('title');\r\n if (title != null) {\r\n tip.removeAttribute('title');\r\n setTooltip(tip, title);\r\n }\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n setTooltip,\r\n resolveTooltip\r\n}","function nullOrEmpty(s) {\r\n return s == null || typeof s !== 'string' || s.length === 0;\r\n}\r\n\r\nfunction contains(s, key, ignoreCase) {\r\n if (nullOrEmpty(s) || key == null) {\r\n return false;\r\n }\r\n if (typeof key !== 'string') {\r\n key = String(key);\r\n }\r\n if (ignoreCase) {\r\n return s.toLowerCase().indexOf(key.toLowerCase()) >= 0;\r\n }\r\n return s.indexOf(key) >= 0;\r\n}\r\n\r\nfunction endsWith(s, suffix) {\r\n if (nullOrEmpty(s) || nullOrEmpty(suffix)) {\r\n return false;\r\n }\r\n return s.indexOf(suffix) === s.length - suffix.length;\r\n}\r\n\r\nfunction padStart(s, num, char) {\r\n if (nullOrEmpty(s) || isNaN(num) || num <= s.length) {\r\n return s;\r\n }\r\n return (char ?? ' ').repeat(num - s.length);\r\n}\r\n\r\nfunction formatUrl(msg) {\r\n //const urlReg = /(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?/ig;\r\n //const urlArrray = str.match(urlReg);\r\n const p = /(http|ftp|https):\\/\\/.+?(\\s|\\r\\n|\\r|\\n|\\\"|\\'|\\*|$)/g;\r\n const r = msg.match(p);\r\n msg = escapeHtml(msg);\r\n\r\n if (r?.length > 0) {\r\n const rs = [];\r\n for (let t of r) {\r\n t = t.replace(/[\"'\\r\\n ]/g, '');\r\n if (rs.indexOf(t) < 0) {\r\n rs.push(t);\r\n }\r\n }\r\n\r\n for (let r of rs) {\r\n msg = msg.replaceAll(r, '');\r\n }\r\n }\r\n\r\n return msg;\r\n}\r\n\r\nfunction escapeHtml(text) {\r\n if (text == null) {\r\n return '';\r\n }\r\n return String(text)\r\n .replaceAll('&', '&')\r\n .replaceAll('<', '<')\r\n .replaceAll('>', '>')\r\n .replaceAll('\\r\\n', '
')\r\n .replaceAll('\\n', '
')\r\n .replaceAll(' ', ' ');\r\n}\r\n\r\nexport {\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml\r\n}","import { getCookie } from \"./cookie\";\r\nimport { get } from \"./request\";\r\nimport { nullOrEmpty } from \"./strings\";\r\n\r\nlet cache;\r\n\r\nfunction getCurrentLgId() {\r\n let lgid;\r\n if (typeof consts !== 'undefined') {\r\n lgid = getCookie(consts.cookie?.lang);\r\n if (nullOrEmpty(lgid)) {\r\n lgid = consts.user?.language;\r\n }\r\n }\r\n if (nullOrEmpty(lgid)) {\r\n lgid = getCookie('lgid');\r\n }\r\n if (nullOrEmpty(lgid)) {\r\n lgid = navigator.language || 'en-us';\r\n }\r\n lgid = lgid.toLowerCase().replace(/-/g, '_');\r\n if (nullOrEmpty(lgid)) {\r\n lgid = 'en';\r\n }\r\n switch (lgid) {\r\n case 'en':\r\n case 'en_au':\r\n case 'fr':\r\n case 'zh_cn':\r\n return lgid;\r\n }\r\n const lang = lgid.split('_')[0];\r\n switch (lang) {\r\n case 'en':\r\n case 'fr':\r\n return lang;\r\n }\r\n return 'en';\r\n}\r\n\r\nfunction getStorageKey(lgid) {\r\n if (typeof consts !== 'undefined') {\r\n return (consts.prefix || '') + `res_${lgid}`;\r\n }\r\n return `res_${lgid}`;\r\n}\r\n\r\nasync function doRefreshLgres(template = '') {\r\n const lgid = getCurrentLgId();\r\n const r = await get(`language/${lgid}${template}`);\r\n const dict = await r.json();\r\n localStorage.setItem(getStorageKey(lgid), JSON.stringify(dict));\r\n return dict;\r\n}\r\n\r\nasync function refreshLgres(template, lgres) {\r\n if (lgres == null || typeof consts === 'undefined') {\r\n lgres = await doRefreshLgres(template);\r\n }\r\n const ver = Number(consts.resver);\r\n if (isNaN(lgres.ver) || isNaN(ver) || ver > lgres.ver) {\r\n console.log(`found new language res version: ${lgres.ver} => ${ver}`);\r\n lgres = await doRefreshLgres(template);\r\n }\r\n Object.defineProperty(lgres, 'r', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function (key, defaultValue) {\r\n return getLanguage(this, key, defaultValue);\r\n }\r\n });\r\n cache = lgres;\r\n return lgres;\r\n}\r\n\r\nfunction getLanguage(lgres, key, defaultValue) {\r\n let value = lgres[key];\r\n return value ?? defaultValue;\r\n}\r\n\r\nfunction applyLanguage(dom, result) {\r\n for (let text of dom.querySelectorAll('[data-lgid]')) {\r\n const key = text.dataset.lgid;\r\n if (text.tagName === 'INPUT') {\r\n text.value = getLanguage(result, key, text.value);\r\n } else {\r\n text.innerText = getLanguage(result, key, text.innerText);\r\n }\r\n }\r\n for (let title of dom.querySelectorAll('[data-title-lgid]')) {\r\n const key = title.dataset.titleLgid;\r\n title.setAttribute('title', getLanguage(result, key, title.getAttribute('title')));\r\n }\r\n for (let holder of dom.querySelectorAll('[data-placeholder-lgid]')) {\r\n const key = holder.dataset.placeholderLgid;\r\n holder.setAttribute('placeholder', getLanguage(result, key, holder.getAttribute('placeholder')));\r\n }\r\n}\r\n\r\nasync function init(dom = document.body, options = {}) {\r\n const lgid = getCurrentLgId();\r\n let lgres = localStorage.getItem(getStorageKey(lgid));\r\n let result;\r\n if (lgres != null) {\r\n try {\r\n lgres = JSON.parse(lgres);\r\n result = await refreshLgres(options.template, lgres);\r\n } catch (e) {\r\n console.error('error while parsing lgres, try refresh ...', e);\r\n result = await refreshLgres(options.template);\r\n }\r\n } else {\r\n result = await refreshLgres(options.template);\r\n }\r\n\r\n try {\r\n if (document.readyState === 'loading') {\r\n return await new Promise((resolve, reject) => {\r\n let tid = setTimeout(() => reject('timeout'), 30000);\r\n document.addEventListener('DOMContentLoaded', () => {\r\n clearTimeout(tid);\r\n tid = void 0;\r\n if (typeof options.callback === 'function') {\r\n options.callback(result);\r\n }\r\n applyLanguage(dom, result);\r\n resolve(result);\r\n });\r\n });\r\n }\r\n if (typeof options.callback === 'function') {\r\n options.callback(result);\r\n }\r\n applyLanguage(dom, result);\r\n return result;\r\n } catch (err) {\r\n console.error('error while loading language res ...', err);\r\n }\r\n}\r\n\r\nfunction r(key, defaultValue) {\r\n if (cache != null) {\r\n return getLanguage(cache, key, defaultValue);\r\n }\r\n return defaultValue;\r\n}\r\n\r\nconst lang = {\r\n get current() {\r\n return getCurrentLgId();\r\n },\r\n get unknownError() {\r\n return r('unknownError', 'An unknown error occurred, please contact the administrator.');\r\n },\r\n get savedSuccessfully() {\r\n return r('savedSuccessfully', 'Saved successfully.');\r\n }\r\n}\r\n\r\nexport {\r\n init,\r\n r,\r\n lang\r\n}","import { getCookie, setCookie, deleteCookie } from \"./utility/cookie\";\r\nimport { init, r, lang } from \"./utility/lgres\";\r\nimport { get, post, upload } from \"./utility/request\";\r\nimport { nullOrEmpty, contains, endsWith, padStart, formatUrl, escapeHtml } from \"./utility/strings\";\r\n\r\nlet g = typeof globalThis !== 'undefined' ? globalThis : self;\r\n\r\nfunction isPositive(n) {\r\n return !isNaN(n) && n > 0;\r\n}\r\n\r\nfunction isMobile() {\r\n return /mobile/i.test(navigator.userAgent);\r\n}\r\n\r\nfunction throttle(method, delay = 100, context = g, ...args) {\r\n if (method == null) {\r\n return;\r\n }\r\n method.tiid && clearTimeout(method.tiid);\r\n const current = new Date();\r\n if (method.tdate == null || current - method.tdate > delay) {\r\n method.apply(context, args);\r\n method.tdate = current;\r\n } else {\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n }\r\n}\r\n\r\nfunction debounce(method, delay = 100, context = g, ...args) {\r\n if (method == null) {\r\n return;\r\n }\r\n method.tiid && clearTimeout(method.tiid);\r\n method.tiid = setTimeout(() => method.apply(context, args), delay);\r\n}\r\n\r\nfunction truncate(v) {\r\n return (v > 0 ? Math.floor : Math.ceil)(v);\r\n}\r\n\r\nfunction isEmail(text) {\r\n return /^\\w[-\\w.+]*@\\w+([-.]\\w+)*\\.\\w+([-.]\\w+)*$/.test(text);\r\n}\r\n\r\nfunction isPhone(text) {\r\n return /^[1-9]\\d{9,}$/.test(text);\r\n}\r\n\r\nexport {\r\n // cookie\r\n getCookie,\r\n setCookie,\r\n deleteCookie,\r\n // lgres\r\n init,\r\n r,\r\n lang,\r\n // request\r\n get,\r\n post,\r\n upload,\r\n // strings\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml,\r\n // variables\r\n g as global,\r\n isPositive,\r\n isMobile,\r\n // functions\r\n throttle,\r\n debounce,\r\n truncate,\r\n isEmail,\r\n isPhone\r\n}","// import { r, global, contains, isPositive, nullOrEmpty } from \"../utility\";\r\nimport './css/dropdown.scss';\r\nimport { r } from \"../utility/lgres\";\r\nimport { contains, nullOrEmpty } from \"../utility/strings\";\r\nimport { global, isPositive } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createCheckbox } from \"./checkbox\";\r\nimport { createIcon } from \"./icon\"\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\nconst DropdownTitleHeight = 26;\r\nconst DropdownItemHeight = 30;\r\n\r\nlet dropdownGlobal = global[SymbolDropdown];\r\n\r\nif (dropdownGlobal == null) {\r\n // init\r\n dropdownGlobal = {};\r\n Object.defineProperty(dropdownGlobal, 'clear', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function () {\r\n const panel = document.querySelector('.ui-drop-wrapper .ui-drop-box.active');\r\n if (panel == null) {\r\n return;\r\n }\r\n panel.classList.remove('active');\r\n const dropId = panel.parentElement.dataset.dropId;\r\n if (dropId == null) {\r\n return;\r\n }\r\n const dropdown = this[dropId];\r\n if (dropdown?.multiselect && typeof dropdown.oncollapsed === 'function') {\r\n dropdown.oncollapsed();\r\n }\r\n }\r\n })\r\n global[SymbolDropdown] = dropdownGlobal;\r\n\r\n document.addEventListener('mousedown', e => {\r\n let parent = e.target;\r\n while (parent != null) {\r\n if (parent.classList.contains('ui-drop-box')) {\r\n e.stopPropagation();\r\n return;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n dropdownGlobal.clear();\r\n });\r\n}\r\n\r\nfunction selectItems(label, itemlist, htmlkey, textkey) {\r\n const htmls = itemlist.map(it => it[htmlkey]);\r\n if (htmls.some(it => it instanceof HTMLElement)) {\r\n label.replaceChildren(...htmls.filter(it => it != null).map(it => it.cloneNode(true)));\r\n } else {\r\n let text = itemlist.map(it => it[textkey]).join(', ');\r\n if (nullOrEmpty(text)) {\r\n text = r('noneItem', '( None )');\r\n }\r\n label.innerText = text;\r\n }\r\n}\r\n\r\nfunction filterSource(searchkeys, textkey, key, source) {\r\n if (!Array.isArray(searchkeys) || searchkeys.length === 0) {\r\n searchkeys = [textkey];\r\n }\r\n if (key.length > 0) {\r\n source = source.filter(it => {\r\n for (let k of searchkeys) {\r\n if (contains(it[k].toLowerCase(), key)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n }\r\n return source;\r\n}\r\n\r\nclass Dropdown {\r\n #options;\r\n\r\n #wrapper;\r\n #container;\r\n #label;\r\n\r\n #allChecked;\r\n #source;\r\n #lastSelected;\r\n #selected;\r\n #selectedList;\r\n\r\n sourceFilter;\r\n onselectedlist;\r\n onselected;\r\n onexpanded;\r\n\r\n constructor(options = {}) {\r\n options.searchplaceholder ??= r('searchHolder', 'Search...');\r\n options.textkey ??= 'text';\r\n options.valuekey ??= 'value';\r\n options.htmlkey ??= 'html';\r\n options.maxlength ??= 500;\r\n this.#options = options;\r\n }\r\n\r\n create() {\r\n const options = this.#options;\r\n\r\n // wrapper\r\n const wrapper = createElement('div', 'ui-drop-wrapper');\r\n const dropId = String(Math.random()).substring(2);\r\n wrapper.dataset.dropId = dropId;\r\n dropdownGlobal[dropId] = this;\r\n this.#wrapper = wrapper;\r\n\r\n // header\r\n const header = createElement('div', 'ui-drop-header');\r\n header.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n header.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n header.addEventListener('keydown', e => {\r\n const up = e.key === 'ArrowUp';\r\n const down = e.key === 'ArrowDown';\r\n if (up || down) {\r\n const source = this.source;\r\n const count = source.length;\r\n const valuekey = this.#options.valuekey;\r\n let index = source?.indexOf(this.#selected);\r\n if (isNaN(index) || index < -1) {\r\n index = -1;\r\n } else if (index >= count) {\r\n index = count - 1;\r\n }\r\n if (up) {\r\n if (index > 0) {\r\n index--;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (down) {\r\n if (index < 0) {\r\n index = 0;\r\n } else if (index < count) {\r\n index++;\r\n } else {\r\n index = count - 1;\r\n }\r\n }\r\n const target = source[index]?.[valuekey];\r\n if (target != null) {\r\n this.select(target);\r\n }\r\n } else if (e.key === 'Tab') {\r\n this.#dropdown(false);\r\n }\r\n });\r\n header.addEventListener('click', () => {\r\n if (this.disabled) {\r\n return;\r\n }\r\n const active = this.#expanded;\r\n const label = this.#label;\r\n if (active && label.ownerDocument.activeElement === label) {\r\n return;\r\n }\r\n this.#dropdown(!active);\r\n if (!active && typeof this.onexpanded === 'function') {\r\n setTimeout(() => this.onexpanded(), 120);\r\n }\r\n });\r\n\r\n // label or input\r\n let label;\r\n if (options.input) {\r\n label = createElement('input', 'ui-drop-text');\r\n label.setAttribute('type', 'text');\r\n options.placeholder && label.setAttribute('placeholder', options.placeholder);\r\n isPositive(options.maxlength) && label.setAttribute('maxlength', options.maxlength);\r\n isPositive(options.tabIndex) && label.setAttribute('tabindex', options.tabIndex);\r\n label.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n this.#container.classList.add('active');\r\n });\r\n label.addEventListener('blur', e => this.select(e.target.value));\r\n label.addEventListener('mousedown', e => this.#expanded && e.stopPropagation());\r\n } else {\r\n isPositive(options.tabIndex) && header.setAttribute('tabindex', options.tabIndex);\r\n label = createElement('label', 'ui-drop-text');\r\n }\r\n this.#label = label;\r\n if (options.multiselect) {\r\n if (Array.isArray(options.selectedlist)) {\r\n this.selectlist(options.selectedlist, true);\r\n } else {\r\n this.#allChecked = true;\r\n label.innerText = r('allItem', '( All )');\r\n }\r\n } else if (options.selected != null) {\r\n this.select(options.selected, true);\r\n }\r\n header.append(label, createElement('label', 'ui-drop-caret'));\r\n wrapper.appendChild(header);\r\n\r\n this.disabled = options.disabled || false;\r\n return wrapper;\r\n }\r\n\r\n get multiselect() { return this.#options.multiselect }\r\n\r\n get disabled() { return this.#wrapper == null || this.#wrapper.querySelector('.ui-drop-header.disabled') != null }\r\n\r\n set disabled(flag) {\r\n if (this.#wrapper == null) {\r\n return;\r\n }\r\n if (flag) {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.add('disabled');\r\n } else {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.remove('disabled');\r\n }\r\n }\r\n\r\n get source() {\r\n let source = this.#source;\r\n if (source == null || !Array.isArray(source)) {\r\n if (typeof this.sourceFilter === 'function') {\r\n source = this.sourceFilter();\r\n }\r\n if (!Array.isArray(source)) {\r\n source = [];\r\n }\r\n this.#source = source;\r\n }\r\n return source;\r\n }\r\n\r\n set source(list) {\r\n if (!Array.isArray(list)) {\r\n return;\r\n }\r\n this.#source = list;\r\n if (this.#expanded) {\r\n setTimeout(() => this.#dropdown(), 120);\r\n }\r\n }\r\n\r\n get selected() { return this.#selected }\r\n\r\n get selectedlist() { return this.#selectedList || [] }\r\n\r\n select(selected, silence) {\r\n if (this.#lastSelected === selected) {\r\n return false;\r\n }\r\n this.#lastSelected = selected;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n let item = this.source.find(it => it[valuekey] === selected);\r\n if (this.#options.input) {\r\n if (item == null) {\r\n item = { [valuekey]: selected };\r\n }\r\n this.#label.value = selected;\r\n } else {\r\n const expanded = this.#expanded;\r\n if (expanded) {\r\n this.#container.querySelectorAll('li[data-value].selected').forEach(li => li.classList.remove('selected'));\r\n }\r\n if (item == null) {\r\n this.#selected = null;\r\n this.#label.innerText = ' ';\r\n return false;\r\n }\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n this.#label.replaceChildren(html.cloneNode(true));\r\n } else {\r\n let text = item[textkey];\r\n if (nullOrEmpty(text)) {\r\n text = ' ';\r\n }\r\n this.#label.innerText = text;\r\n }\r\n if (expanded) {\r\n const val = selected.replace(/\"/g, '\\\\\"');\r\n const li = this.#container.querySelector(`li[data-value=\"${val}\"]`);\r\n if (li != null) {\r\n li.classList.add('selected');\r\n }\r\n }\r\n }\r\n this.#selected = item;\r\n if (!silence && typeof this.onselected === 'function') {\r\n this.onselected(item);\r\n }\r\n }\r\n\r\n selectlist(selectedlist, silence) {\r\n const source = this.source;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const itemlist = selectedlist.map(v => {\r\n let item = source.find(it => it[valuekey] === v);\r\n if (item == null) {\r\n item = { [valuekey]: v, [textkey]: v };\r\n }\r\n return item;\r\n });\r\n if (itemlist.length === 0) {\r\n this.#selectedList = null;\r\n this.#label.innerText = none;\r\n return false;\r\n }\r\n selectItems(this.#label, itemlist, htmlkey, textkey);\r\n this.#selectedList = itemlist;\r\n if (!silence && typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n get #expanded() { return this.#container?.classList?.contains('active') }\r\n\r\n #dropdown(flag = true) {\r\n const options = this.#options;\r\n let panel = this.#container;\r\n if (panel == null) {\r\n panel = createElement('div', 'ui-drop-box');\r\n // search box\r\n if (!options.input && options.search) {\r\n const search = createElement('div', 'ui-drop-search');\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n isPositive(options.tabIndex) && input.setAttribute('tabindex', options.tabIndex);\r\n !nullOrEmpty(options.searchplaceholder) && input.setAttribute('placeholder', options.searchplaceholder);\r\n input.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n })\r\n search.append(input, createIcon('fa-light', 'search'));\r\n panel.appendChild(search);\r\n }\r\n // list\r\n const list = createElement('ul', 'ui-drop-list');\r\n if (!this.multiselect) {\r\n list.addEventListener('click', e => {\r\n let li = e.target;\r\n while (li.tagName !== 'LI') {\r\n li = li.parentElement;\r\n if (li == null) {\r\n return;\r\n }\r\n }\r\n const value = li.dataset.value;\r\n if (this.select(value) !== false) {\r\n dropdownGlobal.clear();\r\n }\r\n });\r\n }\r\n panel.appendChild(list);\r\n this.#container = panel;\r\n this.#wrapper.appendChild(panel);\r\n }\r\n if (flag) {\r\n let source = this.source;\r\n if (!options.input && options.search) {\r\n const search = panel.querySelector('.ui-drop-search > input');\r\n if (!nullOrEmpty(search?.value)) {\r\n source = filterSource(options.searchkeys, options.textkey, search.value, source);\r\n }\r\n }\r\n this.#filllist(source);\r\n // slide direction\r\n if (!options.slidefixed) {\r\n let parent = options.parent ?? document.body;\r\n let p = this.#wrapper;\r\n let top = p.offsetTop;\r\n while ((p = p.parentElement) != null && p !== parent) {\r\n top -= p.scrollTop;\r\n }\r\n if (top - parent.offsetTop + DropdownTitleHeight + panel.offsetHeight >= parent.offsetHeight) {\r\n panel.classList.add('slide-up');\r\n } else {\r\n panel.classList.remove('slide-up');\r\n }\r\n }\r\n panel.classList.add('active');\r\n } else {\r\n panel.classList.remove('active');\r\n }\r\n }\r\n\r\n #filllist(source) {\r\n const list = this.#container.querySelector('.ui-drop-list');\r\n list.replaceChildren();\r\n const multiselect = this.multiselect;\r\n const allchecked = this.#allChecked;\r\n if (multiselect) {\r\n list.appendChild(\r\n createElement('li', null,\r\n createCheckbox({\r\n label: r('allItem', '( All )'),\r\n checked: allchecked,\r\n customerAttributes: { 'isall': '1' },\r\n onchange: e => this.#triggerselect(e.target)\r\n })\r\n )\r\n );\r\n }\r\n // TODO: virtual mode\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const selected = this.selected;\r\n const selectedlist = this.selectedlist;\r\n let scrolled;\r\n source.slice(0, 200).forEach((item, i) => {\r\n const val = item[valuekey];\r\n const li = createElement('li');\r\n li.dataset.value = val;\r\n li.setAttribute('title', item[textkey]);\r\n let label;\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n label = html;\r\n }\r\n if (multiselect) {\r\n const selected = selectedlist.some(s => s[valuekey] === val);\r\n if (label == null) {\r\n label = createElement('span');\r\n label.innerText = item[textkey];\r\n }\r\n const box = createCheckbox({\r\n label,\r\n checked: allchecked || selected,\r\n customerAttributes: {\r\n 'class': 'dataitem',\r\n 'data-value': val\r\n },\r\n onchange: e => this.#triggerselect(e.target)\r\n });\r\n li.appendChild(box);\r\n } else {\r\n if (label == null) {\r\n li.innerText = item[textkey];\r\n } else {\r\n li.appendChild(label);\r\n }\r\n if (selected != null && selected[valuekey] === val) {\r\n scrolled = DropdownItemHeight * i;\r\n li.classList.add('selected');\r\n }\r\n }\r\n list.appendChild(li);\r\n });\r\n if (scrolled != null) {\r\n setTimeout(() => list.scrollTop = scrolled, 10);\r\n }\r\n }\r\n\r\n #triggerselect(checkbox) {\r\n let list;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n if (checkbox.getAttribute('isall') === '1') {\r\n const allchecked = this.#allChecked = checkbox.checked;\r\n const boxes = this.#container.querySelectorAll('input.dataitem');\r\n boxes.forEach(box => box.checked = allchecked);\r\n list = [];\r\n } else if (checkbox.checked) {\r\n if (this.#container.querySelectorAll('input.dataitem:not(:checked)').length === 0) {\r\n this.#allChecked = true;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = true;\r\n list = [];\r\n } else {\r\n const source = this.source;\r\n list = [...this.#container.querySelectorAll('input.dataitem:checked')]\r\n .map(c => source.find(it => it[valuekey] === c.dataset.value))\r\n .filter(it => it != null);\r\n }\r\n } else {\r\n const val = checkbox.dataset.value;\r\n if (this.#allChecked) {\r\n this.#allChecked = false;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = false;\r\n list = this.source.filter(it => it[valuekey] !== val);\r\n } else {\r\n list = this.selectedlist.filter(it => it[valuekey] !== val);\r\n }\r\n }\r\n if (this.#allChecked) {\r\n this.#label.innerText = r('allItem', '( All )');\r\n } else {\r\n selectItems(this.#label, list, htmlkey, textkey);\r\n }\r\n this.#selectedList = list;\r\n if (typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n static resolve(dom = document.body) {\r\n const selects = dom.querySelectorAll('select');\r\n for (let sel of selects) {\r\n const source = [...sel.children].map(it => {\r\n return { value: it.value, text: it.innerText }\r\n });\r\n const drop = new Dropdown({\r\n selected: sel.value,\r\n disabled: sel.disabled,\r\n tabIndex: sel.tabIndex\r\n });\r\n drop.source = source;\r\n sel.parentElement.replaceChild(drop.create(), sel);\r\n }\r\n return dom;\r\n }\r\n}\r\n\r\nexport default Dropdown;","import { global } from \"../../utility\";\r\nimport { nullOrEmpty } from \"../../utility/strings\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\nimport { setTooltip } from \"../tooltip\";\r\nimport Dropdown from \"../dropdown\";\r\n\r\nclass GridColumn {\r\n static create() {\r\n return createElement('span');\r\n }\r\n\r\n static setValue(element, val) {\r\n element.innerText = val;\r\n }\r\n\r\n static setStyle(element, style) {\r\n for (let css of Object.entries(style)) {\r\n element.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n}\r\n\r\nclass GridInputColumn extends GridColumn {\r\n static get editing() { return true };\r\n\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val) {\r\n if (element.tagName !== 'INPUT') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n }\r\n }\r\n\r\n static getValue(e) { return e.target.value }\r\n\r\n static setEnabled(element, enabled) {\r\n element.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridTextColumn extends GridInputColumn {\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('textarea');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val, _item, _col, grid) {\r\n if (element.tagName !== 'TEXTAREA') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n if (val != null) {\r\n const lines = String(val).split('\\n').length;\r\n element.style.height = `${lines * grid.lineHeight + 12}px`;\r\n }\r\n // TODO: bad performance\r\n }\r\n }\r\n}\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\n\r\nclass GridDropdownColumn extends GridColumn {\r\n static createEdit(trigger, col, parent) {\r\n const drop = new Dropdown({ ...col.dropOptions, parent });\r\n drop.onselected = trigger;\r\n return drop.create();\r\n }\r\n\r\n static #getDrop(element) {\r\n const dropGlobal = global[SymbolDropdown];\r\n if (dropGlobal == null) {\r\n return null;\r\n }\r\n const dropId = element.dataset.dropId;\r\n const drop = dropGlobal[dropId];\r\n if (drop == null) {\r\n return null;\r\n }\r\n return drop;\r\n }\r\n\r\n static #getSource(item, col) {\r\n let source = col.source;\r\n if (typeof source === 'function') {\r\n source = source(item);\r\n }\r\n return source;\r\n }\r\n\r\n static #setValue(source, element, val) {\r\n const data = source?.find(v => v.value === val);\r\n if (data != null) {\r\n val = data.text;\r\n }\r\n super.setValue(element, val);\r\n }\r\n\r\n static setValue(element, val, item, col) {\r\n if (element.tagName !== 'DIV') {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => this.#setValue(s, element, val));\r\n } else {\r\n this.#setValue(source, element, val);\r\n }\r\n return;\r\n }\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n if (drop.source == null || drop.source.length === 0) {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => {\r\n drop.source = s;\r\n drop.select(val, true);\r\n })\r\n return;\r\n } else if (source != null) {\r\n drop.source = source;\r\n }\r\n }\r\n drop.select(val, true);\r\n }\r\n\r\n static getValue(e) {\r\n return e.value;\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n drop.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridCheckboxColumn extends GridColumn {\r\n static createEdit(trigger) {\r\n const check = createCheckbox({\r\n onchange: typeof trigger === 'function' ? trigger : null\r\n });\r\n return check;\r\n }\r\n\r\n static setValue(element, val) {\r\n element.querySelector('input').checked = val;\r\n }\r\n\r\n static getValue(e) { return e.target.checked }\r\n\r\n static setEnabled(element, enabled) {\r\n element.querySelector('input').disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridIconColumn extends GridColumn {\r\n static create() { return createElement('span', 'col-icon') }\r\n\r\n static setValue(element, val, item, col, grid) {\r\n let className = col.className;\r\n if (typeof className === 'function') {\r\n className = className.call(col, item);\r\n }\r\n if (className == null) {\r\n element.className = 'col-icon';\r\n } else {\r\n element.className = `col-icon ${className}`;\r\n }\r\n let type = col.iconType;\r\n if (typeof type === 'function') {\r\n type = type.call(col, item);\r\n }\r\n type ??= 'fa-regular';\r\n if (element.dataset.type !== type || element.dataset.icon !== val) {\r\n const icon = createIcon(type, val);\r\n // const layer = element.children[0];\r\n element.replaceChildren(icon);\r\n !nullOrEmpty(col.tooltip) && setTooltip(element, col.tooltip, false, grid.element);\r\n element.dataset.type = type;\r\n element.dataset.icon = val;\r\n }\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n if (enabled === false) {\r\n element.classList.add('disabled');\r\n } else {\r\n element.classList.remove('disabled');\r\n }\r\n const tooltip = element.querySelector('.ui-tooltip-wrapper');\r\n if (tooltip != null) {\r\n tooltip.style.display = enabled === false ? 'none' : '';\r\n }\r\n }\r\n}\r\n\r\nexport {\r\n GridColumn,\r\n GridInputColumn,\r\n GridTextColumn,\r\n GridDropdownColumn,\r\n GridCheckboxColumn,\r\n GridIconColumn\r\n}","import '../css/grid.scss';\r\nimport { global, isPositive, isMobile, throttle, truncate } from \"../../utility\";\r\nimport { r } from \"../../utility/lgres\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\nimport { GridColumn, GridInputColumn, GridTextColumn, GridDropdownColumn, GridCheckboxColumn, GridIconColumn } from \"./column\";\r\n\r\nconst ColumnChangedType = {\r\n Reorder: 'reorder',\r\n Resize: 'resize',\r\n Sort: 'sort'\r\n};\r\nconst RefreshInterval = isMobile() ? 32 : 0;\r\nconst HoverInternal = 200;\r\nconst RedumCount = 4;\r\nconst MiniDragOffset = 4;\r\nconst MiniColumnWidth = 50;\r\nconst FilterPanelWidth = 200;\r\n\r\nfunction getClientX(e) {\r\n if (e == null) {\r\n return null;\r\n }\r\n const cx = e.touches && e.touches[0]?.clientX;\r\n return cx ?? e.clientX;\r\n}\r\n\r\nfunction getOffsetLeftFromWindow(element) {\r\n let left = 0;\r\n while (element != null) {\r\n left += element.offsetLeft;\r\n element = element.offsetParent;\r\n }\r\n return left;\r\n}\r\n\r\nfunction indexOfParent(target) {\r\n // return [...target.parentElement.children].indexOf(target);\r\n return Array.prototype.indexOf.call(target.parentElement.children, target);\r\n}\r\n\r\nconst ColumnTypes = {\r\n 0: GridColumn,\r\n 1: GridInputColumn,\r\n 2: GridDropdownColumn,\r\n 3: GridCheckboxColumn,\r\n 4: GridIconColumn,\r\n 5: GridTextColumn\r\n};\r\n\r\nclass Grid {\r\n #source;\r\n #currentSource;\r\n #parent;\r\n #el;\r\n #refs;\r\n #rendering;\r\n #selectedColumnIndex = -1;\r\n #selectedIndexes;\r\n #startIndex = 0;\r\n #needResize;\r\n #containerHeight;\r\n #bodyClientWidth;\r\n #rowCount = -1;\r\n #scrollTop;\r\n #scrollLeft;\r\n #colTypes = {};\r\n #colAttrs = {};\r\n #vtable = [];\r\n\r\n columns = [];\r\n langs = {\r\n all: r('allItem', '( All )'),\r\n ok: r('ok', 'OK'),\r\n reset: r('reset', 'Reset')\r\n };\r\n virtualCount = 100;\r\n rowHeight = 36;\r\n lineHeight = 24;\r\n extraRows = 0;\r\n filterRowHeight = 30;\r\n height;\r\n readonly;\r\n multiSelect = false;\r\n fullrowClick = true;\r\n allowHtml = false;\r\n holderDisabled = false;\r\n headerVisible = true;\r\n window = global;\r\n sortIndex = -1;\r\n sortDirection = 1;\r\n\r\n willSelect;\r\n selectedRowChanged;\r\n cellDblClicked;\r\n cellClicked;\r\n rowDblClicked;\r\n columnChanged;\r\n\r\n static ColumnTypes = {\r\n Common: 0,\r\n Input: 1,\r\n Dropdown: 2,\r\n Checkbox: 3,\r\n Icon: 4,\r\n Text: 5,\r\n isCheckbox(type) { return type === 3 }\r\n };\r\n\r\n static GridColumn = GridColumn;\r\n\r\n constructor(container) {\r\n this.#parent = container;\r\n }\r\n\r\n get element() { return this.#el }\r\n\r\n get source() { return this.#source?.map(s => s.values) }\r\n set source(list) {\r\n if (this.#el == null) {\r\n throw new Error('grid has not been initialized.')\r\n }\r\n if (!Array.isArray(list)) {\r\n throw new Error('source is not an Array.')\r\n }\r\n list = list.map(i => { return { values: i } });\r\n this.#source = list;\r\n this.#refreshSource(list);\r\n }\r\n\r\n #refreshSource(list) {\r\n list ??= this.#source;\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource = list.filter(it => {\r\n for (let col of this.columns) {\r\n if (Array.isArray(col.filterValues)) {\r\n const v = this.#getItemValue(it.values, col.key, col.filter);\r\n if (col.filterValues.indexOf(v) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n });\r\n } else {\r\n this.#currentSource = list;\r\n }\r\n this.#selectedColumnIndex = -1;\r\n this.#selectedIndexes = [];\r\n this.#startIndex = 0;\r\n this.#scrollTop = 0;\r\n this.#scrollLeft = 0;\r\n this.#rowCount = -1;\r\n\r\n if (this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n this.resize();\r\n }\r\n\r\n get virtual() { return this.#currentSource?.length > this.virtualCount }\r\n\r\n get sortKey() {\r\n if (this.columns == null) {\r\n return null;\r\n }\r\n return this.columns[this.sortIndex]?.key;\r\n }\r\n\r\n get selectedIndexes() { return this.#selectedIndexes }\r\n set selectedIndexes(indexes) {\r\n const startIndex = this.#startIndex;\r\n this.#selectedIndexes.splice(0, this.#selectedIndexes.length, ...indexes);\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (indexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged();\r\n }\r\n }\r\n\r\n get selectedIndex() { return (this.#selectedIndexes && this.#selectedIndexes[0]) ?? -1 }\r\n\r\n get loading() { return this.#refs.loading?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n if (this.#refs.loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n this.#refs.loading.style.visibility = 'hidden';\r\n this.#refs.loading.style.opacity = 0;\r\n } else {\r\n this.#refs.loading.style.visibility = 'visible';\r\n this.#refs.loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n get scrollTop() { return this.#refs.body?.scrollTop; }\r\n set scrollTop(top) {\r\n if (this.#refs.body == null) {\r\n return;\r\n }\r\n this.#refs.body.scrollTop = top;\r\n this.reload();\r\n }\r\n\r\n init(container = this.#parent) {\r\n this.#el = null;\r\n this.#refs = {};\r\n this.#rendering = true;\r\n if (!(container instanceof HTMLElement)) {\r\n throw new Error('no specified parent.');\r\n }\r\n this.#parent = container;\r\n const grid = createElement('div', 'ui-grid');\r\n grid.setAttribute('tabindex', 0);\r\n const onKeydown = e => {\r\n let index = this.selectedIndex;\r\n let flag = false;\r\n if (e.key === 'ArrowUp') {\r\n // up\r\n if (index > 0) {\r\n flag = true;\r\n index -= 1;\r\n }\r\n } else if (e.key === 'ArrowDown') {\r\n // down\r\n const count = this.#currentSource?.length ?? 0;\r\n if (index < count - 1) {\r\n flag = true;\r\n index += 1;\r\n }\r\n }\r\n if (flag) {\r\n this.#selectedIndexes = [index];\r\n this.scrollToIndex(index);\r\n this.refresh();\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(index);\r\n }\r\n e.stopPropagation();\r\n }\r\n };\r\n grid.addEventListener('keydown', e => throttle(onKeydown, 800, this, e));\r\n container.replaceChildren(grid);\r\n const sizer = createElement('span', 'ui-grid-sizer');\r\n grid.appendChild(sizer);\r\n this.#refs.sizer = sizer;\r\n\r\n // header & body\r\n const header = this.#createHeader();\r\n grid.appendChild(header);\r\n const body = this.#createBody();\r\n grid.appendChild(body);\r\n\r\n // loading\r\n const loading = createElement('div', 'ui-grid-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n );\r\n this.#refs.loading = loading;\r\n grid.appendChild(loading);\r\n this.#el = grid;\r\n\r\n this.#rendering = false;\r\n if (this.#source != null && this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n }\r\n\r\n scrollToIndex(index) {\r\n const top = this.#scrollToTop(index * (this.rowHeight + 1), true);\r\n this.#refs.body.scrollTop = top;\r\n }\r\n\r\n resize(force) {\r\n if (this.#rendering || this.#el == null) {\r\n return;\r\n }\r\n const body = this.#refs.body;\r\n // let height = this.#refs.header.offsetHeight + 2;\r\n // let top = body.offsetTop;\r\n // if (top !== height) {\r\n // body.style.top = `${height}px`;\r\n // top = height;\r\n // }\r\n const top = this.headerVisible === false ? 0 : this.#refs.header.offsetHeight;\r\n\r\n let height = this.height;\r\n if (height === 0) {\r\n height = this.#containerHeight;\r\n } else if (isNaN(height) || height < 0) {\r\n height = this.#el.offsetHeight - top;\r\n }\r\n const count = truncate((height - 1) / (this.rowHeight + 1)) + (RedumCount * 2) + 1;\r\n if (force || count !== this.#rowCount) {\r\n this.#rowCount = count;\r\n this.reload();\r\n }\r\n this.#bodyClientWidth = body.clientWidth;\r\n }\r\n\r\n reload() {\r\n let length = this.#currentSource.length;\r\n if (this.extraRows > 0) {\r\n length += this.extraRows;\r\n }\r\n this.#containerHeight = length * (this.rowHeight + 1);\r\n this.#refs.body.scrollTop = 0;\r\n this.#refs.body.scrollLeft = 0;\r\n this.#refs.bodyContent.style.top = '0px';\r\n this.#refs.bodyContainer.style.height = `${this.#containerHeight}px`;\r\n // this.#adjustRows(this.#refs.bodyContent);\r\n this.refresh();\r\n }\r\n\r\n refresh() {\r\n if (this.#refs.bodyContent == null) {\r\n throw new Error('body has not been created.');\r\n }\r\n const widths = {};\r\n this.#fillRows(widths);\r\n if (this.#needResize && widths.flag) {\r\n this.#needResize = false;\r\n this.columns.forEach((col, i) => {\r\n if (!this.#get(col.key, 'autoResize')) {\r\n return;\r\n }\r\n let width = widths[i];\r\n if (width < col.width) {\r\n width = col.width;\r\n }\r\n if (width > 0) {\r\n this.#changeColumnWidth(i, width);\r\n }\r\n });\r\n }\r\n }\r\n\r\n resetChange() {\r\n if (this.#source == null) {\r\n return;\r\n }\r\n for (let row of this.#source) {\r\n delete row.__changed;\r\n }\r\n }\r\n\r\n sortColumn(reload) {\r\n const index = this.sortIndex;\r\n const col = this.columns[index];\r\n if (col == null) {\r\n return;\r\n }\r\n const direction = this.sortDirection;\r\n [...this.#refs.header.children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (i === index) {\r\n arrow.className = `arrow ${(direction !== 1 ? 'desc' : 'asc')}`;\r\n } else if (arrow.className !== 'arrow') {\r\n arrow.className = 'arrow';\r\n }\r\n });\r\n let comparer;\r\n if (typeof col.sortFilter !== 'function') {\r\n const direction = this.sortDirection;\r\n if (isNaN(direction)) {\r\n direction = 1;\r\n }\r\n comparer = (a, b) => {\r\n a = this.#getItemValue(a.values, col.key, col.filter);\r\n b = this.#getItemValue(b.values, col.key, col.filter);\r\n if (a == null && typeof b === 'number') {\r\n a = 0;\r\n } else if (typeof a === 'number' && b == null) {\r\n b = 0;\r\n } else if (a != null && b == null) {\r\n return direction;\r\n } else if (typeof a === 'string' && typeof b === 'string') {\r\n a = a.toLowerCase();\r\n b = b.toLowerCase();\r\n }\r\n return a === b ? 0 : (a > b ? 1 : -1) * direction;\r\n };\r\n } else {\r\n comparer = (a, b) => col.sortFilter(a.values, b.values) * direction;\r\n }\r\n this.#source.sort(comparer);\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource.sort(comparer);\r\n }\r\n if (this.#rowCount < 0) {\r\n return;\r\n }\r\n if (reload) {\r\n this.reload();\r\n } else {\r\n this.refresh();\r\n }\r\n }\r\n\r\n #createHeader() {\r\n const thead = createElement('table', 'ui-grid-header');\r\n if (this.headerVisible === false) {\r\n thead.style.display = 'none';\r\n }\r\n const header = createElement('tr');\r\n thead.appendChild(header);\r\n const sizer = this.#refs.sizer;\r\n for (let col of this.columns) {\r\n if (col.visible === false) {\r\n const hidden = createElement('th');\r\n hidden.style.display = 'none';\r\n if (col.sortable !== false) {\r\n hidden.dataset.key = col.key;\r\n hidden.addEventListener('click', e => this.#onHeaderClicked(e, col, true));\r\n }\r\n header.appendChild(hidden);\r\n continue;\r\n }\r\n // style\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n if (col.width > 0) {\r\n // col.autoResize = false;\r\n } else {\r\n this.#set(col.key, 'autoResize', true);\r\n this.#needResize = true;\r\n sizer.innerText = col.caption ?? '';\r\n let width = sizer.offsetWidth + 22;\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n width += 32;\r\n }\r\n if (col.allowFilter === true) {\r\n width += 14;\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n col.width = width;\r\n }\r\n col.align ??= isCheckbox ? 'center' : 'left';\r\n if (col.sortable !== false) {\r\n col.sortable = true;\r\n }\r\n const w = `${col.width}px`;\r\n const style = {\r\n 'width': w,\r\n 'max-width': w,\r\n 'min-width': w,\r\n 'text-align': col.align\r\n };\r\n this.#set(col.key, 'style', style);\r\n // element\r\n const th = createElement('th', 'column');\r\n th.dataset.key = col.key;\r\n for (let css of Object.entries(style)) {\r\n th.style.setProperty(css[0], css[1]);\r\n }\r\n if (col.sortable) {\r\n th.style.cursor = 'pointer';\r\n th.addEventListener('click', e => this.#onHeaderClicked(e, col));\r\n }\r\n if (col.orderable !== false) {\r\n col.orderable = true;\r\n th.addEventListener('mousedown', e => this.#onDragStart(e, col));\r\n }\r\n const wrapper = createElement('div');\r\n th.appendChild(wrapper);\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n const check = createCheckbox({\r\n onchange: e => this.#onColumnAllChecked(col, e.target.checked)\r\n });\r\n wrapper.appendChild(check);\r\n }\r\n const caption = createElement('span');\r\n if (col.textStyle != null) {\r\n for (let css of Object.entries(col.textStyle)) {\r\n caption.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n caption.innerText = col.caption ?? '';\r\n wrapper.appendChild(caption);\r\n // order arrow\r\n if (col.sortable) {\r\n th.appendChild(createElement('layer', 'arrow'));\r\n }\r\n // filter\r\n if (col.allowFilter === true) {\r\n const filter = createElement('layer', 'filter');\r\n filter.appendChild(createIcon('fa-solid', 'filter'));\r\n filter.addEventListener('mousedown', e => this.#onFilter(e, col));\r\n th.classList.add('header-filter');\r\n th.appendChild(filter);\r\n }\r\n // resize spliter\r\n if (col.resizable !== false) {\r\n const spliter = createElement('layer', 'spliter');\r\n spliter.addEventListener('mousedown', e => this.#onResizeStart(e, col));\r\n spliter.addEventListener('dblclick', e => this.#onAutoResize(e, col));\r\n th.appendChild(spliter);\r\n }\r\n // tooltip\r\n // !nullOrEmpty(col.tooltip) && setTooltip(th, col.tooltip);\r\n header.appendChild(th);\r\n }\r\n const dragger = createElement('div', 'dragger');\r\n const draggerCursor = createElement('layer', 'dragger-cursor');\r\n header.appendChild(createElement('th', null, dragger, draggerCursor));\r\n\r\n sizer.replaceChildren();\r\n this.#refs.header = header;\r\n this.#refs.dragger = dragger;\r\n this.#refs.draggerCursor = draggerCursor;\r\n return thead;\r\n }\r\n\r\n #createBody() {\r\n const body = createElement('div', 'ui-grid-body');\r\n body.addEventListener('scroll', e => throttle(this.#onScroll, RefreshInterval, this, e), { passive: true });\r\n const cols = this.columns;\r\n let width = 1;\r\n for (let col of cols) {\r\n if (col.visible !== false && !isNaN(col.width)) {\r\n width += col.width + 1;\r\n }\r\n }\r\n // body container\r\n const bodyContainer = createElement('div');\r\n bodyContainer.style.position = 'relative';\r\n bodyContainer.style.minWidth = '100%';\r\n bodyContainer.style.minHeight = '1px';\r\n if (width > 0) {\r\n bodyContainer.style.width = `${width}px`;\r\n }\r\n body.appendChild(bodyContainer);\r\n // body content\r\n const bodyContent = createElement('table', 'ui-grid-body-content');\r\n bodyContent.addEventListener('mousedown', e => {\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n const rowIndex = indexOfParent(parent);\r\n let colIndex = indexOfParent(target);\r\n if (colIndex >= this.columns.length) {\r\n colIndex = -1;\r\n }\r\n this.#onRowClicked(e, rowIndex, colIndex);\r\n });\r\n bodyContent.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(bodyContent);\r\n // this.#adjustRows();\r\n // events\r\n if (!this.holderDisabled) {\r\n const holder = createElement('div', 'ui-grid-hover-holder');\r\n holder.addEventListener('mousedown', e => {\r\n const holder = e.currentTarget;\r\n const row = Number(holder.dataset.row);\r\n const col = Number(holder.dataset.col);\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return this.#onRowClicked(e, row + this.#startIndex, col);\r\n });\r\n holder.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(holder);\r\n body.addEventListener('mousemove', e => throttle(this.#onBodyMouseMove, HoverInternal, this, e, holder), { passive: true });\r\n }\r\n this.#refs.body = body;\r\n this.#refs.bodyContainer = bodyContainer;\r\n this.#refs.bodyContent = bodyContent;\r\n\r\n // this.refresh();\r\n return body;\r\n }\r\n\r\n #fillRows(widths) {\r\n let count = this.#rowCount;\r\n if (isNaN(count) || count < 0 || !this.virtual) {\r\n count = this.#currentSource.length;\r\n }\r\n const content = this.#refs.bodyContent;\r\n // content.replaceChildren();\r\n const cols = this.columns;\r\n const vtable = this.#vtable;\r\n const vnew = [];\r\n const startIndex = this.#startIndex;\r\n // reuse\r\n for (let i = 0; i < count; i++) {\r\n const index = startIndex + i;\r\n const e = vtable.findIndex(v => v.index === index);\r\n if (e >= 0) {\r\n vnew[i] = vtable.splice(e, 1)[0];\r\n }\r\n }\r\n // move or create\r\n for (let i = 0; i < count; i++) {\r\n if (vnew[i] != null) {\r\n continue;\r\n }\r\n const index = startIndex + i;\r\n const e = vtable.splice(0, 1);\r\n let vdom;\r\n if (e.length > 0) {\r\n vdom = {\r\n ...e[0],\r\n index,\r\n mode: 'move'\r\n };\r\n vdom.el.remove();\r\n } else {\r\n const row = createElement('tr', 'ui-grid-row');\r\n cols.forEach((col, j) => {\r\n const cell = createElement('td');\r\n if (col.visible !== false) {\r\n cell.dataset.col = String(j);\r\n const style = this.#get(col.key, 'style');\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (col.css != null) {\r\n for (let css of Object.entries(col.css)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (Grid.ColumnTypes.isCheckbox(col.type)) {\r\n cell.appendChild(GridCheckboxColumn.createEdit(e => this.#onRowChanged(e, exists + i, col, e.target.checked)));\r\n // this.#colTypes[col.key] = GridCheckboxColumn;\r\n } else {\r\n let type = this.#colTypes[col.key];\r\n if (type == null) {\r\n if (isNaN(col.type)) {\r\n if (this.allowHtml && col.type != null) {\r\n type = col.type;\r\n }\r\n } else {\r\n type = ColumnTypes[col.type];\r\n }\r\n type ??= GridColumn;\r\n this.#colTypes[col.key] = type;\r\n }\r\n cell.appendChild(type.create(col));\r\n }\r\n }\r\n row.appendChild(cell);\r\n });\r\n row.appendChild(createElement('td'));\r\n vdom = {\r\n index,\r\n mode: 'create',\r\n el: row\r\n };\r\n }\r\n vnew[i] = vdom;\r\n }\r\n this.#vtable = vnew;\r\n\r\n const selectedIndexes = this.#selectedIndexes;\r\n vnew.filter(vdom => vdom.mode != null).forEach(vdom => {\r\n const row = vdom.el;\r\n const index = vdom.index;\r\n const vals = this.#currentSource[index];\r\n if (vals == null) {\r\n return;\r\n }\r\n if (!isPositive(row.children.length)) {\r\n return;\r\n }\r\n // row.dataset.row = String(index);\r\n const item = vals.values;\r\n const selected = selectedIndexes.indexOf(index) >= 0;\r\n if (selected) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n // data\r\n const selectChanged = vals.__selected ^ selected;\r\n if (selected) {\r\n vals.__selected = true;\r\n } else {\r\n delete vals.__selected;\r\n }\r\n cols.forEach((col, j) => {\r\n if (col.visible === false) {\r\n return;\r\n }\r\n let val;\r\n if (col.text != null) {\r\n val = col.text;\r\n } else if (typeof col.filter === 'function') {\r\n val = col.filter(item);\r\n } else {\r\n val = item[col.key];\r\n if (val?.displayValue != null) {\r\n val = val.displayValue;\r\n }\r\n }\r\n val ??= '';\r\n // fill\r\n const cell = row.children[j];\r\n cell.dataset.row = String(index);\r\n if (typeof col.bgFilter === 'function') {\r\n const bgColor = col.bgFilter(item);\r\n cell.style.backgroundColor = bgColor ?? '';\r\n }\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n const type = isCheckbox ? GridCheckboxColumn : this.#colTypes[col.key] ?? GridColumn;\r\n let element;\r\n if (!isCheckbox && selectChanged && typeof type.createEdit === 'function') {\r\n if (vals.__editing?.[col.key] && type.editing) {\r\n val = type.getValue({ target: cell.children[0] });\r\n this.#onRowChanged(null, index, col, val, true);\r\n }\r\n element = selected ?\r\n type.createEdit(e => this.#onRowChanged(e, index, col, type.getValue(e)), col, this.#refs.bodyContent, vals) :\r\n type.create(col);\r\n cell.replaceChildren(element);\r\n } else {\r\n element = cell.children[0];\r\n }\r\n let enabled;\r\n if (this.readonly) {\r\n enabled = false;\r\n } else {\r\n enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n }\r\n type.setValue(element, val, item, col, this);\r\n if (typeof type.setEnabled === 'function') {\r\n type.setEnabled(element, enabled);\r\n }\r\n // auto resize\r\n if (this.#needResize && this.#get(col.key, 'autoResize')) {\r\n const width = element.scrollWidth + 12;\r\n if (width > 0 && widths != null && (isNaN(widths[j]) || widths[j] < width)) {\r\n widths[j] = width;\r\n widths.flag = true;\r\n }\r\n }\r\n if (typeof col.styleFilter === 'function') {\r\n const style = col.styleFilter(item);\r\n if (style != null) {\r\n type.setStyle(element, style);\r\n }\r\n }\r\n if (col.events != null) {\r\n for (let ev of Object.entries(col.events)) {\r\n element[ev[0]] = ev[1].bind(item);\r\n }\r\n }\r\n if (col.attrs != null) {\r\n let attrs = col.attrs;\r\n if (typeof attrs === 'function') {\r\n attrs = attrs(item);\r\n }\r\n for (let attr of Object.entries(attrs)) {\r\n element.setAttribute(attr[0], attr[1]);\r\n }\r\n }\r\n });\r\n if (vals.__editing != null) {\r\n delete vals.__editing;\r\n }\r\n });\r\n\r\n content.replaceChildren(...vnew.map(vdom => vdom.el));\r\n }\r\n\r\n #changeColumnWidth(index, width) {\r\n const col = this.columns[index];\r\n // const oldwidth = col.width;\r\n const w = `${width}px`;\r\n col.width = width;\r\n const style = this.#get(col.key, 'style');\r\n style.width = w;\r\n style['max-width'] = w;\r\n style['min-width'] = w;\r\n let element = this.#refs.header.children[index];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n const body = this.#refs.bodyContent;\r\n for (let row of body.children) {\r\n element = row.children[index];\r\n if (element != null) {\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n }\r\n }\r\n // } else {\r\n // width = this.#refs.bodyContainer.offsetWidth - oldwidth + width;\r\n // this.#refs.bodyContainer.style.width = `${width}px`;\r\n // }\r\n }\r\n\r\n #changingColumnOrder(index, offset, x, offsetLeft) {\r\n const children = this.#refs.header.children;\r\n let element = children[index];\r\n this.#refs.dragger.style.left = `${element.offsetLeft - offsetLeft + offset}px`;\r\n this.#refs.dragger.style.width = element.style.width;\r\n this.#refs.dragger.style.display = 'block';\r\n offset = x - getOffsetLeftFromWindow(element);\r\n let idx;\r\n if (offset < 0) {\r\n offset = -offset;\r\n for (let i = index - 1; i >= 0 && offset >= 0; i -= 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i : i + 1;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= 0;\r\n } else {\r\n const count = children.length;\r\n for (let i = index; i < count - 1 && offset >= 0; i += 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n idx = i;\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i + 1 : i;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= count - 1;\r\n }\r\n if (idx !== this.#colAttrs.__orderIndex) {\r\n this.#colAttrs.__orderIndex = idx;\r\n element = children[idx];\r\n if (element == null) {\r\n return;\r\n }\r\n this.#refs.draggerCursor.style.left = `${element.offsetLeft - offsetLeft}px`;\r\n this.#refs.draggerCursor.style.display = 'block';\r\n }\r\n }\r\n\r\n #changeColumnOrder(index) {\r\n this.#refs.dragger.style.display = '';\r\n this.#refs.draggerCursor.style.display = '';\r\n const orderIndex = this.#colAttrs.__orderIndex;\r\n if (orderIndex >= 0 && orderIndex !== index) {\r\n let targetIndex = orderIndex - index;\r\n if (targetIndex >= 0 && targetIndex <= 1) {\r\n return;\r\n }\r\n const header = this.#refs.header;\r\n const children = header.children;\r\n const rows = this.#refs.bodyContent.children;\r\n const columns = this.columns;\r\n if (targetIndex > 1) {\r\n targetIndex = orderIndex - 1;\r\n // const current = columns[index];\r\n // for (let i = index; i < targetIndex; i += 1) {\r\n // columns[i] = columns[i + 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex].nextElementSibling);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex].nextElementSibling);\r\n }\r\n } else {\r\n targetIndex = orderIndex;\r\n // const current = columns[index];\r\n // for (let i = index; i > targetIndex; i -= 1) {\r\n // columns[i] = columns[i - 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex]);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex]);\r\n }\r\n }\r\n // refresh sortIndex\r\n [...children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (arrow.className !== 'arrow') {\r\n this.sortIndex = i;\r\n }\r\n });\r\n\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Reorder, index, targetIndex);\r\n }\r\n }\r\n }\r\n\r\n #scrollToTop(top, reload) {\r\n const rowHeight = (this.rowHeight + 1);\r\n top -= (top % (rowHeight * 2)) + (RedumCount * rowHeight);\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#containerHeight - (reload ? 0 : this.#rowCount * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#scrollTop !== top) {\r\n this.#scrollTop = top;\r\n if (this.virtual) {\r\n this.#startIndex = top / rowHeight;\r\n }\r\n this.refresh();\r\n if (this.virtual) {\r\n this.#refs.bodyContent.style.top = `${top}px`;\r\n }\r\n } else if (reload) {\r\n this.refresh();\r\n }\r\n\r\n return top;\r\n }\r\n\r\n #get(key, name) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n return null;\r\n }\r\n return attr[name];\r\n }\r\n\r\n #set(key, name, value) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n this.#colAttrs[key] = { [name]: value };\r\n } else {\r\n attr[name] = value;\r\n }\r\n }\r\n\r\n #getItemValue(item, key, filter) {\r\n let value;\r\n if (typeof filter === 'function') {\r\n value = filter(item);\r\n } else {\r\n value = item[key];\r\n }\r\n return value?.value ?? value;\r\n }\r\n\r\n #getRowTarget(target) {\r\n let parent;\r\n while ((parent = target.parentElement) != null && !parent.classList.contains('ui-grid-row')) {\r\n target = parent;\r\n }\r\n return [parent, target];\r\n }\r\n\r\n #notHeader(tagName) {\r\n return /^(input|label|layer|svg|use)$/i.test(tagName);\r\n }\r\n\r\n #onHeaderClicked(e, col, force) {\r\n if (!force && (this.#get(col.key, 'resizing') || this.#get(col.key, 'dragging'))) {\r\n return;\r\n }\r\n if (!this.#notHeader(e.target.tagName)) {\r\n const index = this.columns.indexOf(col);\r\n if (index < 0) {\r\n return;\r\n }\r\n if (this.sortIndex === index) {\r\n this.sortDirection = this.sortDirection === 1 ? -1 : 1;\r\n } else {\r\n this.sortIndex = index;\r\n }\r\n this.sortColumn(true);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Sort, index, this.sortDirection);\r\n }\r\n }\r\n }\r\n\r\n #onCloseFilter() {\r\n const panels = this.#el.querySelectorAll('.filter-panel.active');\r\n if (panels.length > 0) {\r\n panels.forEach(el => el.classList.remove('active'));\r\n setTimeout(() => this.#el.querySelectorAll('.filter-panel').forEach(el => el.remove()), 120);\r\n const filtering = this.#colAttrs.__filtering;\r\n if (filtering instanceof HTMLElement) {\r\n filtering.classList.remove('hover');\r\n }\r\n delete this.#colAttrs.__filtering;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n #onFilter(e, col) {\r\n if (this.#onCloseFilter()) {\r\n return;\r\n }\r\n const close = e => {\r\n if ((e.target.tagName === 'LAYER' && e.target.classList.contains('filter')) ||\r\n e.target.tagName === 'use') {\r\n return;\r\n }\r\n if (this.#onCloseFilter()) {\r\n document.removeEventListener('mousedown', close);\r\n }\r\n }\r\n document.addEventListener('mousedown', close);\r\n const panel = createElement('div', 'filter-panel');\r\n panel.addEventListener('mousedown', e => e.stopPropagation());\r\n const filter = e.currentTarget;\r\n const th = filter.parentElement;\r\n const width = th.offsetWidth;\r\n panel.style.top = `${th.offsetHeight}px`;\r\n panel.style.left = (th.offsetLeft + (width > FilterPanelWidth ? width - FilterPanelWidth : 0)) + 'px';\r\n\r\n // search\r\n let searchbox;\r\n if (col.allowSearch !== false) {\r\n const searchholder = createElement('div', 'filter-search-holder');\r\n searchbox = createElement('input', 'filter-search-box ui-text');\r\n searchbox.type = 'text';\r\n const searchicon = createIcon('fa-regular', 'search');\r\n searchicon.addEventListener('mousedown', e => {\r\n searchbox.focus();\r\n e.preventDefault();\r\n });\r\n searchholder.append(searchbox, searchicon);\r\n panel.append(searchholder);\r\n }\r\n // list\r\n const itemlist = createElement('div', 'filter-item-list');\r\n itemlist.addEventListener('scroll', e => throttle(this.#onFilterScroll, RefreshInterval, this, col, itemlist, e.target.scrollTop), { passive: true });\r\n // - all\r\n const itemall = createElement('div', 'filter-item filter-all');\r\n itemall.appendChild(createCheckbox({\r\n label: this.langs.all,\r\n onchange: e => {\r\n const checked = e.target.checked;\r\n itemlist.querySelectorAll('.filter-content input').forEach(box => box.checked = checked);\r\n }\r\n }));\r\n itemlist.appendChild(itemall);\r\n // - items\r\n let array;\r\n if (Array.isArray(col.filterSource)) {\r\n array = col.filterSource;\r\n } else if (typeof col.filterSource === 'function') {\r\n array = col.filterSource.call(this, col);\r\n } else {\r\n const dict = Object.create(null);\r\n for (let item of this.#source) {\r\n const val = this.#getItemValue(item.values, col.key, col.filter);\r\n if (!Object.hasOwnProperty.call(dict, val)) {\r\n const v = item.values[col.key];\r\n dict[val] = {\r\n value: val,\r\n displayValue: typeof col.filter === 'function' ? col.filter(item.values) : v?.displayValue ?? v\r\n };\r\n }\r\n }\r\n array = Object.values(dict)\r\n .sort((a, b) => {\r\n a = a?.value ?? a;\r\n b = b?.value ?? b;\r\n return a > b ? 1 : a < b ? -1 : 0;\r\n });\r\n }\r\n array = array.map(i => {\r\n if (Object.prototype.hasOwnProperty.call(i, 'value') &&\r\n Object.prototype.hasOwnProperty.call(i, 'displayValue')) {\r\n return i;\r\n }\r\n return {\r\n value: i,\r\n displayValue: i == null ? '' : i\r\n };\r\n });\r\n this.#fillFilterList(col, itemlist, array, itemall);\r\n itemall.querySelector('input').checked = ![...itemlist.querySelectorAll('.filter-content input')].some(i => !i.checked);\r\n panel.appendChild(itemlist);\r\n if (searchbox != null) {\r\n searchbox.addEventListener('input', e => {\r\n const key = e.currentTarget.value.toLowerCase();\r\n const items = key.length === 0 ? array : array.filter(i => {\r\n const displayValue = i?.displayValue ?? i;\r\n return String(displayValue ?? '').indexOf(key) >= 0;\r\n });\r\n this.#fillFilterList(col, itemlist, items, itemall);\r\n });\r\n }\r\n // function\r\n const functions = createElement('div', 'filter-function');\r\n functions.append(\r\n createElement('button', ok => {\r\n ok.innerText = this.langs.ok;\r\n ok.addEventListener('click', () => {\r\n const array = this.#get(col.key, 'filterSource').filter(i => i.__checked !== false);\r\n if (typeof col.onFilterOk === 'function') {\r\n col.onFilterOk.call(this, col, array);\r\n } else {\r\n col.filterValues = array.map(a => a.value);\r\n }\r\n this.#colAttrs.__filtered = true;\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.add('active');\r\n this.#onCloseFilter();\r\n });\r\n }),\r\n createElement('button', reset => {\r\n reset.innerText = this.langs.reset;\r\n reset.addEventListener('click', () => {\r\n delete col.filterValues;\r\n this.#colAttrs.__filtered = this.columns.some(c => col.filterValues != null)\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.remove('active');\r\n this.#onCloseFilter();\r\n });\r\n })\r\n );\r\n panel.appendChild(functions);\r\n\r\n this.#el.appendChild(panel);\r\n setTimeout(() => panel.classList.add('active'), 0);\r\n this.#colAttrs.__filtering = filter;\r\n filter.classList.add('hover');\r\n }\r\n\r\n #fillFilterList(col, list, array, all) {\r\n list.querySelector('.filter-holder')?.remove();\r\n list.querySelector('.filter-content')?.remove();\r\n const rowHeight = this.filterRowHeight;\r\n const height = array.length * rowHeight;\r\n this.#set(col.key, 'filterHeight', height);\r\n const holder = createElement('div', 'filter-holder');\r\n holder.style.height = `${height}px`;\r\n const content = createElement('div', 'filter-content');\r\n content.style.top = `${rowHeight}px`;\r\n this.#set(col.key, 'filterSource', array);\r\n for (let item of array) {\r\n item.__checked = !Array.isArray(col.filterValues) || col.filterValues.indexOf(item.value ?? item) >= 0;\r\n }\r\n if (array.length > 12) {\r\n array = array.slice(0, 12);\r\n }\r\n this.#doFillFilterList(content, array, all);\r\n list.append(holder, content);\r\n }\r\n\r\n #doFillFilterList(content, array, all) {\r\n for (let item of array) {\r\n const div = createElement('div', 'filter-item');\r\n div.appendChild(createCheckbox({\r\n checked: item.__checked,\r\n label: item?.displayValue ?? item,\r\n onchange: e => {\r\n item.__checked = e.target.checked;\r\n all.querySelector('input').checked = ![...content.querySelectorAll('input')].some(i => !i.checked);\r\n }\r\n }));\r\n content.appendChild(div);\r\n }\r\n }\r\n\r\n #onFilterScroll(col, list, top) {\r\n const rowHeight = this.filterRowHeight;\r\n top -= (top % (rowHeight * 2)) + rowHeight;\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#get(col.key, 'filterHeight') - (12 * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#get(col.key, 'filterTop') !== top) {\r\n this.#set(col.key, 'filterTop', top);\r\n const startIndex = top / rowHeight;\r\n let array = this.#get(col.key, 'filterSource');\r\n if (startIndex + 12 < array.length) {\r\n array = array.slice(startIndex, startIndex + 12);\r\n } else {\r\n array = array.slice(-12);\r\n }\r\n const content = list.querySelector('.filter-content');\r\n content.replaceChildren();\r\n this.#doFillFilterList(content, array, list.querySelector('.filter-all>input'));\r\n content.style.top = `${top + rowHeight}px`;\r\n }\r\n }\r\n\r\n #onDragStart(e, col) {\r\n if (this.#notHeader(e.target.tagName)) {\r\n return;\r\n }\r\n const cx = getClientX(e);\r\n const index = indexOfParent(e.currentTarget);\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.dragging = true;\r\n const offsetLeft = this.#refs.header.querySelector('th:last-child').offsetLeft;\r\n const dragmove = e => {\r\n const cx2 = getClientX(e);\r\n const offset = cx2 - cx;\r\n let pos = attr.offset;\r\n let dragging;\r\n if (pos == null && (offset > MiniDragOffset || offset < -MiniDragOffset)) {\r\n dragging = true;\r\n } else if (pos !== offset) {\r\n dragging = true;\r\n }\r\n if (dragging) {\r\n this.#changingColumnOrder(index, offset, cx2, offsetLeft);\r\n attr.offset = offset;\r\n }\r\n };\r\n attr.mousemove = e => throttle(dragmove, RefreshInterval, this, e);\r\n attr.mouseup = () => {\r\n clearEvents(attr);\r\n if (attr.offset == null) {\r\n delete attr.dragging;\r\n } else {\r\n setTimeout(() => {\r\n delete attr.dragging;\r\n delete attr.offset;\r\n });\r\n this.#changeColumnOrder(index);\r\n }\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onResizeStart(e, col) {\r\n const cx = getClientX(e);\r\n const width = col.width;\r\n const index = indexOfParent(e.currentTarget.parentElement);\r\n const window = this.window ?? global;\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.resizing = width;\r\n const resizemove = e => {\r\n const cx2 = getClientX(e);\r\n const val = width + (cx2 - cx);\r\n if (val < MiniColumnWidth) {\r\n return;\r\n }\r\n attr.resizing = val;\r\n attr.sizing = true;\r\n this.#changeColumnWidth(index, val);\r\n };\r\n attr.mousemove = e => throttle(resizemove, RefreshInterval, this, e);\r\n attr.mouseup = e => {\r\n clearEvents(attr);\r\n const width = attr.resizing;\r\n if (width != null) {\r\n setTimeout(() => delete attr.resizing);\r\n if (attr.sizing) {\r\n delete attr.sizing;\r\n delete attr.autoResize;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n e.stopPropagation();\r\n e.preventDefault();\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onAutoResize(e, col) {\r\n const th = e.currentTarget.parentElement;\r\n const index = indexOfParent(th);\r\n let width = th.querySelector('div:first-child').scrollWidth;\r\n for (let row of this.#refs.bodyContent.children) {\r\n const element = row.children[index].children[0];\r\n const w = element.scrollWidth;\r\n if (w > width) {\r\n width = w;\r\n }\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n if (width > 0 && width !== col.width) {\r\n width += 12;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n\r\n #onColumnAllChecked(col, flag) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const key = col.key;\r\n const isFunction = typeof col.enabled === 'function';\r\n const isString = typeof col.enabled === 'string';\r\n if (typeof col.onallchecked === 'function') {\r\n col.onallchecked.call(this, col, flag);\r\n } else {\r\n for (let row of this.#currentSource) {\r\n const item = row.values;\r\n if (item == null) {\r\n continue;\r\n }\r\n const enabled = isFunction ? col.enabled(item) : isString ? item[col.enabled] : col.enabled;\r\n if (enabled !== false) {\r\n item[key] = flag;\r\n row.__changed = true;\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, flag);\r\n }\r\n }\r\n }\r\n this.refresh();\r\n }\r\n }\r\n\r\n #onScroll(e) {\r\n const left = e.target.scrollLeft;\r\n if (this.#scrollLeft !== left) {\r\n this.#scrollLeft = left;\r\n this.#refs.header.style.left = `${-left}px`;\r\n }\r\n if (!this.virtual) {\r\n return;\r\n }\r\n const top = e.target.scrollTop;\r\n this.#scrollToTop(top);\r\n }\r\n\r\n #onBodyMouseMove(e, holder) {\r\n if (e.target.classList.contains('ui-grid-hover-holder')) {\r\n return;\r\n }\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n if (parent == null) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const element = target.children[0];\r\n if (element?.tagName !== 'SPAN') {\r\n if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const row = target.dataset.row;\r\n const col = target.dataset.col;\r\n if (holder.dataset.row === row &&\r\n holder.dataset.col === col) {\r\n return;\r\n }\r\n if (element.scrollWidth > element.offsetWidth) {\r\n holder.dataset.row = row;\r\n holder.dataset.col = col;\r\n holder.innerText = element.innerText;\r\n const top = this.#refs.bodyContent.offsetTop + target.offsetTop;\r\n let left = target.offsetLeft;\r\n let width = holder.offsetWidth;\r\n if (width > this.#bodyClientWidth) {\r\n width = this.#bodyClientWidth;\r\n }\r\n const maxleft = this.#bodyClientWidth + this.#scrollLeft - width;\r\n if (left > maxleft) {\r\n left = maxleft;\r\n }\r\n const height = target.offsetHeight;\r\n holder.style.cssText = `top: ${top}px; left: ${left}px; max-width: ${this.#bodyClientWidth}px; height: ${height - 2}px`;\r\n holder.classList.add('active');\r\n } else if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n }\r\n\r\n #onRowClicked(e, index, colIndex) {\r\n const startIndex = this.#startIndex;\r\n const selectedIndex = startIndex + index;\r\n if (typeof this.willSelect === 'function' && !this.willSelect(selectedIndex, colIndex)) {\r\n return;\r\n }\r\n // multi-select\r\n let flag = false;\r\n const selectedIndexes = this.#selectedIndexes;\r\n if (this.multiSelect) {\r\n if (e.ctrlKey) {\r\n const i = selectedIndexes.indexOf(selectedIndex);\r\n if (i < 0) {\r\n selectedIndexes.push(selectedIndex);\r\n } else {\r\n selectedIndexes.splice(i, 1);\r\n }\r\n flag = true;\r\n } else if (e.shiftKey && selectedIndexes.length > 0) {\r\n if (selectedIndexes.length > 1 || selectedIndexes[0] !== selectedIndex) {\r\n let start = selectedIndexes[selectedIndexes.length - 1];\r\n let end;\r\n if (start > selectedIndex) {\r\n end = start;\r\n start = selectedIndex;\r\n } else {\r\n end = selectedIndex;\r\n }\r\n selectedIndexes.splice(0);\r\n for (let i = start; i <= end; i += 1) {\r\n selectedIndexes.push(i);\r\n }\r\n flag = true;\r\n }\r\n }\r\n }\r\n if (!flag && selectedIndexes.length !== 1 || selectedIndexes[0] !== selectedIndex) {\r\n selectedIndexes.splice(0, selectedIndexes.length, selectedIndex);\r\n flag = true;\r\n }\r\n // apply style\r\n if (flag) {\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (selectedIndexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(selectedIndex);\r\n }\r\n }\r\n this.#selectedColumnIndex = colIndex;\r\n if ((this.fullrowClick || colIndex >= 0) && e.buttons === 1 && typeof this.cellClicked === 'function') {\r\n if (this.cellClicked(selectedIndex, colIndex) === false) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n }\r\n }\r\n\r\n #onRowDblClicked(e) {\r\n if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'LAYER' && e.target.className === 'ui-check-inner' || e.target.tagName === 'LABEL' && (e.target.className === 'ui-drop-text' || e.target.className === 'ui-drop-caret')) {\r\n return;\r\n }\r\n const index = this.selectedIndex;\r\n if (typeof this.rowDblClicked === 'function') {\r\n this.rowDblClicked(index);\r\n }\r\n if (typeof this.cellDblClicked === 'function') {\r\n const colIndex = this.#selectedColumnIndex;\r\n if (this.fullrowClick || colIndex >= 0) {\r\n this.cellDblClicked(index, colIndex);\r\n }\r\n }\r\n }\r\n\r\n #onRowChanged(_e, index, col, value, blur) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const row = this.#currentSource[this.#startIndex + index];\r\n const item = row.values;\r\n if (item == null) {\r\n return;\r\n }\r\n let enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n if (enabled !== false) {\r\n item[col.key] = value;\r\n row.__changed = true;\r\n if (blur) {\r\n if (typeof col.oneditend === 'function') {\r\n col.oneditend.call(this, item, value);\r\n }\r\n } else {\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, value);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default Grid;","import \"./css/popup.scss\";\r\nimport { r } from \"../utility/lgres\";\r\nimport { nullOrEmpty } from \"../utility/strings\";\r\nimport { global } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon, changeIcon } from \"./icon\";\r\n\r\nconst ResizeMods = {\r\n right: 1,\r\n bottom: 2,\r\n left: 4,\r\n top: 8,\r\n bottomRight: 2 | 1,\r\n bottomLeft: 2 | 4,\r\n topRight: 8 | 1,\r\n topLeft: 8 | 4\r\n}\r\n\r\n// const Cursors = {\r\n// [ResizeMods.right]: 'ew-resize',\r\n// [ResizeMods.bottom]: 'ns-resize',\r\n// [ResizeMods.bottomRight]: 'nwse-resize',\r\n// [ResizeMods.left]: 'ew-resize',\r\n// [ResizeMods.bottomLeft]: 'nesw-resize',\r\n// [ResizeMods.top]: 'ns-resize',\r\n// [ResizeMods.topRight]: 'nesw-resize',\r\n// [ResizeMods.topLeft]: 'nwse-resize'\r\n// }\r\n\r\nfunction trimPx(px) {\r\n if (typeof px !== 'string') {\r\n return px;\r\n }\r\n if (px.endsWith('px')) {\r\n const size = Number(px.substring(0, px.length - 2));\r\n return isNaN(size) ? px : size;\r\n }\r\n return px;\r\n}\r\n\r\nclass Popup {\r\n #mask;\r\n #option;\r\n #bounds;\r\n // #cursor;\r\n\r\n constructor(opts = {}) {\r\n this.#option = opts;\r\n }\r\n\r\n get container() { return this.#mask.querySelector('.ui-popup-container') }\r\n\r\n get rect() {\r\n const container = this.container;\r\n if (container == null) {\r\n return null;\r\n }\r\n const style = global.getComputedStyle(container);\r\n const collapsed = container.classList.contains('ui-popup-collapse');\r\n const bounds = this.#bounds;\r\n return {\r\n collapsed,\r\n left: trimPx(style.left),\r\n top: trimPx(style.top),\r\n width: collapsed === true && bounds != null ? bounds.width : trimPx(style.width),\r\n height: collapsed === true && bounds != null ? bounds.height : trimPx(style.height)\r\n };\r\n }\r\n set rect(r) {\r\n const container = this.container;\r\n if (container == null) {\r\n return;\r\n }\r\n const css = [];\r\n if (!isNaN(r.left)) {\r\n css.push(`left: ${r.left}px`);\r\n }\r\n if (!isNaN(r.top)) {\r\n css.push(`top: ${r.top}px`);\r\n }\r\n const collapse = container.querySelector('.ui-popup-header>.icon-expand');\r\n if (r.collapsed === true) {\r\n css.push('width: 160px', 'height: 40px');\r\n this.#bounds = r;\r\n container.classList.add('ui-popup-collapse');\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n } else {\r\n if (!isNaN(r.width) && r.width > 0) {\r\n css.push(`width: ${r.width}px`);\r\n }\r\n if (!isNaN(r.height) && r.height > 0) {\r\n css.push(`height: ${r.height}px`);\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n this.#bounds = null;\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n }\r\n }\r\n if (css.length > 0) {\r\n container.style.cssText += css.join('; ');\r\n }\r\n }\r\n\r\n create() {\r\n const mask = createElement('div', 'ui-popup-mask');\r\n if (this.#option.mask === false) {\r\n mask.classList.add('ui-popup-transparent');\r\n }\r\n const container = createElement('div', 'ui-popup-container');\r\n let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n if (tabIndex < 0) {\r\n tabIndex = 0;\r\n }\r\n container.tabIndex = tabIndex + 1;\r\n const close = () => {\r\n mask.classList.add('ui-popup-active');\r\n mask.style.opacity = 0;\r\n setTimeout(() => mask.remove(), 120);\r\n };\r\n let content = this.#option.content;\r\n if (!(content instanceof HTMLElement)) {\r\n content = createElement('div', d => d.innerText = content);\r\n }\r\n container.append(\r\n createElement('div', header => {\r\n header.className = 'ui-popup-header';\r\n let title = this.#option.title;\r\n if (!(title instanceof HTMLElement)) {\r\n title = createElement('div', t => {\r\n t.className = 'ui-popup-header-title';\r\n t.innerText = title;\r\n });\r\n }\r\n header.appendChild(title);\r\n if (this.#option.movable !== false) {\r\n const move = title.querySelector('.ui-popup-move') ?? title;\r\n move.addEventListener('mousedown', e => {\r\n const x = e.clientX - container.offsetLeft;\r\n const y = e.clientY - container.offsetTop;\r\n let moved;\r\n const move = e => {\r\n container.style.left = `${e.clientX - x}px`;\r\n container.style.top = `${e.clientY - y}px`;\r\n moved = true;\r\n };\r\n mask.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n mask.removeEventListener('mousemove', move, { passive: false });\r\n mask.removeEventListener('mouseup', up);\r\n if (moved === true && typeof this.#option.onMoveEnded === 'function') {\r\n this.#option.onMoveEnded.call(this);\r\n }\r\n moved = false;\r\n };\r\n mask.addEventListener('mouseup', up);\r\n });\r\n }\r\n if (this.#option.collapsable === true) {\r\n const collapse = createIcon('fa-regular', 'compress-alt');\r\n collapse.tabIndex = tabIndex + 2;\r\n collapse.classList.add('icon-expand');\r\n collapse.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n collapse.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n collapse.addEventListener('click', () => {\r\n if (container.classList.contains('ui-popup-collapse')) {\r\n const bounds = this.#bounds;\r\n if (bounds != null) {\r\n container.style.cssText += `width: ${bounds.width}px; height: ${bounds.height}px`;\r\n this.#bounds = null;\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n } else {\r\n const rect = this.rect;\r\n this.#bounds = rect;\r\n container.style.cssText += `width: 160px; height: 40px`;\r\n container.classList.add('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n });\r\n header.appendChild(collapse);\r\n }\r\n const cancel = createIcon('fa-regular', 'times');\r\n cancel.tabIndex = tabIndex + 3;\r\n cancel.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n close();\r\n }\r\n });\r\n cancel.addEventListener('click', () => close());\r\n header.appendChild(cancel);\r\n }),\r\n createElement('div', 'ui-popup-body', content, createElement('div', 'ui-popup-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n ))\r\n );\r\n if (Array.isArray(this.#option.buttons)) {\r\n tabIndex = Math.max.apply(null, [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n container.appendChild(\r\n createElement('div', 'ui-popup-footer', ...this.#option.buttons.map((b, i) => {\r\n const button = createElement('button', 'ui-popup-button');\r\n if (b.tabIndex > 0) {\r\n button.tabIndex = b.tabIndex;\r\n } else {\r\n button.tabIndex = tabIndex + i + 1;\r\n }\r\n button.innerText = b.text;\r\n button.addEventListener('click', () => {\r\n if (typeof b.trigger === 'function') {\r\n const result = b.trigger(this);\r\n if (typeof result?.then === 'function') {\r\n result.then(r => {\r\n if (r !== false) {\r\n close();\r\n }\r\n }).catch(() => { });\r\n } else if (result !== false) {\r\n close();\r\n }\r\n } else {\r\n close();\r\n }\r\n });\r\n return button;\r\n }))\r\n );\r\n const tabs = [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0);\r\n const tabMin = Math.min.apply(null, tabs);\r\n const tabMax = Math.max.apply(null, tabs);\r\n const last = container.querySelector(`[tabindex=\"${tabMax}\"]`);\r\n if (last != null) {\r\n last.addEventListener('keydown', e => {\r\n if (e.key === 'Tab') {\r\n const first = container.querySelector(`[tabindex=\"${tabMin}\"]`);\r\n first?.focus();\r\n e.preventDefault();\r\n }\r\n });\r\n }\r\n }\r\n // resizable\r\n if (this.#option.resizable === true) {\r\n container.append(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.right, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottom, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.left, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.top, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomRight, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topRight, e));\r\n })\r\n )\r\n }\r\n mask.appendChild(container);\r\n this.#mask = mask;\r\n return mask;\r\n }\r\n\r\n show(parent = document.body) {\r\n if (parent == null) {\r\n return;\r\n }\r\n let mask = this.#mask ?? this.create();\r\n parent.appendChild(mask);\r\n if (this.#option.mask === false) {\r\n // calculator position\r\n const container = this.container;\r\n container.style.left = String((parent.offsetWidth - container.offsetWidth) / 2) + 'px';\r\n container.style.top = String((parent.offsetHeight - container.offsetHeight) / 2) + 'px';\r\n }\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n mask.style.opacity = 1;\r\n this.container.focus();\r\n resolve(mask);\r\n }, 0);\r\n });\r\n }\r\n\r\n get loading() { return this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading')?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n let loading = this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading');\r\n if (loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n loading.style.visibility = 'hidden';\r\n loading.style.opacity = 0;\r\n } else {\r\n loading.style.visibility = 'visible';\r\n loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n #resize(mod, e) {\r\n const container = this.container;\r\n const option = this.#option;\r\n if (typeof option.onResizeStarted === 'function') {\r\n option.onResizeStarted.call(this);\r\n }\r\n const mask = this.#mask;\r\n // this.#cursor = mask.style.cursor;\r\n // mask.style.cursor = Cursors[mod];\r\n const originalX = e.clientX;\r\n const originalY = e.clientY;\r\n const original = {\r\n width: container.offsetWidth,\r\n height: container.offsetHeight,\r\n left: container.offsetLeft,\r\n top: container.offsetTop\r\n };\r\n const minWidth = option.minWidth ?? 200;\r\n const minHeight = option.minHeight ?? 200;\r\n let resized;\r\n const move = e => {\r\n const offsetX = e.clientX - originalX;\r\n const offsetY = e.clientY - originalY;\r\n let width = original.width;\r\n let height = original.height;\r\n let x = original.left;\r\n let y = original.top;\r\n if ((mod & ResizeMods.right) === ResizeMods.right) {\r\n width += offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n }\r\n }\r\n if ((mod & ResizeMods.bottom) === ResizeMods.bottom) {\r\n height += offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n }\r\n }\r\n if ((mod & ResizeMods.left) === ResizeMods.left) {\r\n width -= offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n x = originalX + original.width - minWidth;\r\n } else {\r\n x += offsetX;\r\n }\r\n }\r\n if ((mod & ResizeMods.top) === ResizeMods.top) {\r\n height -= offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n y = originalY + original.height - minHeight;\r\n } else {\r\n y += offsetY;\r\n }\r\n }\r\n if (typeof option.onResizing === 'function') {\r\n option.onResizing.call(this, x, y, width, height);\r\n } else {\r\n container.style.cssText += `left: ${x}px; top: ${y}px; width: ${width}px; height: ${height}px`;\r\n }\r\n resized = true;\r\n }\r\n const parent = option.mask === false ? mask.parentElement : mask;\r\n parent.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n parent.removeEventListener('mousemove', move, { passive: false });\r\n parent.removeEventListener('mouseup', up);\r\n // mask.style.cursor = this.#cursor;\r\n if (resized === true && typeof option.onResizeEnded === 'function') {\r\n option.onResizeEnded.call(this);\r\n }\r\n resized = false;\r\n };\r\n parent.addEventListener('mouseup', up);\r\n }\r\n}\r\n\r\nexport default Popup;\r\n\r\nexport function createPopup(title, content, ...buttons) {\r\n const popup = new Popup({\r\n title,\r\n content,\r\n buttons\r\n });\r\n return popup;\r\n}\r\n\r\nconst iconTypes = {\r\n 'info': 'info-circle',\r\n 'information': 'info-circle',\r\n 'warn': 'exclamation-triangle',\r\n 'warning': 'exclamation-triangle',\r\n 'question': 'question-circle',\r\n 'error': 'times-circle'\r\n}\r\n\r\nexport function showAlert(title, message, iconType = 'info', parent = document.body) {\r\n return new Promise(resolve => {\r\n const popup = new Popup({\r\n title,\r\n content: createElement('div', 'message-wrapper',\r\n createIcon('fa-solid', iconTypes[iconType] ?? 'info-circle'),\r\n createElement('span', span => span.innerText = message)\r\n ),\r\n buttons: [\r\n { text: r('ok', 'OK'), trigger: resolve }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}\r\n\r\nexport function showConfirm(title, content, buttons, iconType = 'question', parent = document.body) {\r\n return new Promise(resolve => {\r\n const wrapper = createElement('div', 'message-wrapper');\r\n if (!nullOrEmpty(iconType)) {\r\n wrapper.appendChild(createIcon('fa-solid', iconTypes[iconType] ?? 'question-circle'));\r\n }\r\n wrapper.appendChild(content instanceof HTMLElement ?\r\n content :\r\n createElement('span', span => span.innerText = content));\r\n const popup = new Popup({\r\n title,\r\n content: wrapper,\r\n buttons: buttons?.map(b => {\r\n return {\r\n text: b.text,\r\n trigger: p => {\r\n let result;\r\n if (typeof b.trigger === 'function') {\r\n result = b.trigger(p, b);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n r !== false && resolve(r);\r\n return r;\r\n });\r\n }\r\n result !== false && resolve(result);\r\n } else {\r\n result = {\r\n key: b.key,\r\n popup: p\r\n };\r\n resolve(result);\r\n }\r\n return result;\r\n }\r\n };\r\n }) ??\r\n [\r\n { text: r('yes', 'Yes'), trigger: p => resolve({ key: 'yes', popup: p }) },\r\n { text: r('no', 'No'), trigger: p => resolve({ key: 'no', popup: p }) }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}"],"names":["createElement","tagName","init","children","element","svgns","createUse","type","id","c","path","ver","use","changeIcon","svg","createIcon","style","css","resolveIcon","container","svgs","icon","fillCheckbox","label","tabindex","charactor","layer","e","input","span","createRadiobox","opts","entry","createCheckbox","resolveCheckbox","legacy","checks","chk","text","boxes","box","setTooltip","content","flag","parent","isParent","tipid","tip","wrapper","cnt","tipId","tid","p","left","top","offsetParent","resolveTooltip","tips","title","nullOrEmpty","s","contains","key","ignoreCase","r","defaultValue","g","isPositive","n","isMobile","throttle","method","delay","context","args","current","truncate","v","SymbolDropdown","DropdownTitleHeight","DropdownItemHeight","dropdownGlobal","global","panel","dropId","dropdown","selectItems","itemlist","htmlkey","textkey","htmls","it","filterSource","searchkeys","source","k","_Dropdown","options","__privateAdd","_expanded","_dropdown","_filllist","_triggerselect","_options","_wrapper","_container","_label","_allChecked","_source","_lastSelected","_selected","_selectedList","__publicField","__privateSet","__privateGet","header","up","down","count","valuekey","index","target","_a","__privateMethod","dropdown_fn","active","expanded_get","filllist_fn","list","selected","silence","item","expanded","li","html","val","selectedlist","dom","selects","sel","drop","Dropdown","_b","search","value","multiselect","allchecked","triggerselect_fn","scrolled","i","checkbox","GridColumn","GridInputColumn","trigger","col","_parent","vals","enabled","GridTextColumn","_item","_col","grid","lines","_GridDropdownColumn","_getSource","getSource_fn","_setValue","setValue_fn","_getDrop","getDrop_fn","GridDropdownColumn","dropGlobal","data","__superGet","GridCheckboxColumn","GridIconColumn","className","tooltip","ColumnChangedType","RefreshInterval","HoverInternal","RedumCount","MiniDragOffset","MiniColumnWidth","FilterPanelWidth","getClientX","getOffsetLeftFromWindow","indexOfParent","ColumnTypes","_Grid","_refreshSource","_createHeader","_createBody","_fillRows","_changeColumnWidth","_changingColumnOrder","_changeColumnOrder","_scrollToTop","_get","_set","_getItemValue","_getRowTarget","_notHeader","_onHeaderClicked","_onCloseFilter","_onFilter","_fillFilterList","_doFillFilterList","_onFilterScroll","_onDragStart","_onResizeStart","_onAutoResize","_onColumnAllChecked","_onScroll","_onBodyMouseMove","_onRowClicked","_onRowDblClicked","_onRowChanged","_currentSource","_el","_refs","_rendering","_selectedColumnIndex","_selectedIndexes","_startIndex","_needResize","_containerHeight","_bodyClientWidth","_rowCount","_scrollTop","_scrollLeft","_colTypes","_colAttrs","_vtable","refreshSource_fn","indexes","startIndex","row","onKeydown","sizer","createHeader_fn","body","createBody_fn","loading","scrollToTop_fn","force","height","length","widths","fillRows_fn","get_fn","width","changeColumnWidth_fn","reload","direction","th","arrow","comparer","a","b","getItemValue_fn","Grid","thead","hidden","onHeaderClicked_fn","isCheckbox","set_fn","w","onDragStart_fn","check","onColumnAllChecked_fn","caption","filter","onFilter_fn","spliter","onResizeStart_fn","onAutoResize_fn","dragger","draggerCursor","onScroll_fn","cols","bodyContainer","bodyContent","getRowTarget_fn","rowIndex","colIndex","onRowClicked_fn","onRowDblClicked_fn","holder","onBodyMouseMove_fn","vtable","vnew","vdom","j","cell","onRowChanged_fn","selectedIndexes","selectChanged","bgColor","ev","attrs","attr","changingColumnOrder_fn","offset","x","offsetLeft","idx","changeColumnOrder_fn","orderIndex","targetIndex","rows","columns","rowHeight","bottomTop","name","notHeader_fn","onCloseFilter_fn","panels","el","filtering","close","searchbox","searchholder","searchicon","onFilterScroll_fn","itemall","checked","array","dict","fillFilterList_fn","items","displayValue","functions","ok","reset","all","doFillFilterList_fn","div","cx","clearEvents","event","dragmove","cx2","pos","dragging","window","resizemove","isFunction","isString","maxleft","selectedIndex","start","end","_e","blur","ResizeMods","trimPx","px","size","Popup","_resize","_mask","_option","_bounds","collapsed","bounds","collapse","mask","tabIndex","d","t","y","moved","move","rect","cancel","button","result","tabs","tabMin","tabMax","last","first","resize_fn","resolve","_c","mod","option","originalX","originalY","original","minWidth","minHeight","resized","offsetX","offsetY","createPopup","buttons","iconTypes","showAlert","message","iconType","showConfirm"],"mappings":"+oCAAO,SAASA,EAAcC,EAASC,KAASC,EAAU,CACtD,MAAMC,EAAU,SAAS,cAAcH,CAAO,EAC9C,OAAI,OAAOC,GAAS,WAChBA,EAAKE,CAAO,EACLF,GAAQ,OACfE,EAAQ,UAAYF,GAEpBC,EAAS,OAAS,GAClBC,EAAQ,OAAO,GAAGD,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