fleet-contractor/Site/js/lib/ui.min.js.map
2023-06-05 10:10:22 +08:00

1 line
206 KiB
Plaintext

{"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 = isParent ? parent : c.offsetParent;\r\n while (p != null && p !== 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 wrapper.style.left = `${left}px`;\r\n // check overflow\r\n let t = c.offsetTop;\r\n p = c.offsetParent;\r\n while (p != null) {\r\n const overflow = window.getComputedStyle(p).overflow;\r\n if (overflow !== 'visible') {\r\n break;\r\n }\r\n t += p.offsetTop;\r\n p = p.offsetParent;\r\n }\r\n const offsetHeight = wrapper.offsetHeight + 14;\r\n if (t + top - offsetHeight < 0) {\r\n top += c.parentElement.offsetHeight + 14;\r\n wrapper.classList.add('ui-tooltip-down');\r\n } else {\r\n top -= offsetHeight;\r\n wrapper.classList.remove('ui-tooltip-down');\r\n }\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, '<a target=\"_blank\" href=\"' + r + '\"><svg><use xlink:href=\"' + ((typeof consts !== 'undefined' && consts.path) || '') + 'fonts/fa-regular.svg#link\"></use></svg></a>');\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('&', '&amp;')\r\n .replaceAll('<', '&lt;')\r\n .replaceAll('>', '&gt;')\r\n .replaceAll('\\r\\n', '<br/>')\r\n .replaceAll('\\n', '<br/>')\r\n .replaceAll(' ', '&nbsp;');\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 if (/^[1-9]\\d{9,}$/.test(text)) {\r\n return true;\r\n }\r\n if (/^\\+?[1-9][\\d-]{9,}\\d$/.test(text) && /^[1-9]\\d{9,}$/.test(text.replace('+', '').replace(new RegExp('-', 'g'), ''))) {\r\n return true;\r\n }\r\n return false;\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\n// import { nullOrEmpty } from \"../../utility/strings\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\n// import { 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 static setEnabled(element, enabled) {\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\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 super.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 super.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 super.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 super.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 }\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 { 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 { 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 grid.addEventListener('keydown', 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 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 rows = this.#refs.bodyContent.children;\r\n const widths = {};\r\n this.#fillRows(rows, this.columns, 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 #adjustRows() {\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 cols = this.columns;\r\n const content = this.#refs.bodyContent;\r\n const exists = content.children.length;\r\n count -= exists;\r\n if (count > 0) {\r\n for (let i = 0; i < count; i += 1) {\r\n const row = createElement('tr', 'ui-grid-row');\r\n // row.addEventListener('mousedown', e => this.#onRowClicked(e, exists + i));\r\n // row.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n cols.forEach((col, j) => {\r\n const cell = createElement('td');\r\n if (col.visible !== false) {\r\n cell.dataset.row = String(exists + i);\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, cell)));\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 content.appendChild(row);\r\n }\r\n } else if (count < 0) {\r\n for (let i = -1; i >= count; i -= 1) {\r\n // content.removeChild(content.children[exists + i]);\r\n content.children[exists + i].remove();\r\n }\r\n }\r\n }\r\n\r\n #fillRows(rows, cols, widths) {\r\n const startIndex = this.#startIndex;\r\n const selectedIndexes = this.#selectedIndexes;\r\n [...rows].forEach((row, i) => {\r\n const vals = this.#currentSource[startIndex + i];\r\n if (vals == null) {\r\n return;\r\n }\r\n if (!isPositive(row.children.length)) {\r\n return;\r\n }\r\n const item = vals.values;\r\n const selected = selectedIndexes.indexOf(startIndex + i) >= 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 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, startIndex + i, col, val, cell, true);\r\n }\r\n element = selected ?\r\n type.createEdit(e => this.#onRowChanged(e, startIndex + i, col, type.getValue(e), cell), 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 let tip = col.tooltip;\r\n if (typeof tip === 'function') {\r\n tip = tip.call(col, item);\r\n }\r\n if (nullOrEmpty(tip)) {\r\n element.querySelector('.ui-tooltip-wrapper')?.remove();\r\n } else {\r\n setTooltip(element, tip, false, this.element);\r\n }\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\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, cell, 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 let tip = col.tooltip;\r\n if (typeof tip === 'function') {\r\n tip = tip.call(col, item);\r\n }\r\n if (nullOrEmpty(tip)) {\r\n cell.querySelector('.ui-tooltip-wrapper')?.remove();\r\n } else {\r\n setTooltip(cell.children[0], tip, false, this.element);\r\n }\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-icons>.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 close(animation = true) {\r\n const mask = this.#mask;\r\n if (animation) {\r\n mask.classList.add('ui-popup-active');\r\n mask.style.opacity = 0;\r\n setTimeout(() => { mask.remove(); }, 120);\r\n } else {\r\n mask.remove();\r\n }\r\n if (typeof this.#option.onMasking === 'function') {\r\n this.#option.onMasking.call(this, false);\r\n }\r\n }\r\n\r\n create() {\r\n const mask = createElement('div', 'ui-popup-mask');\r\n const option = this.#option;\r\n if (option.mask === false) {\r\n mask.classList.add('ui-popup-transparent');\r\n } else if (typeof option.onMasking === 'function') {\r\n this.#option.onMasking.call(this, true);\r\n }\r\n if (!isNaN(option.zIndex)) {\r\n mask.style.zIndex = String(option.zIndex);\r\n }\r\n const container = createElement('div', 'ui-popup-container');\r\n if (option.changeZIndex === true) {\r\n container.addEventListener('mousedown', () => {\r\n const masks = [...this.#mask.parentElement.children].filter(e => e.classList.contains('ui-popup-mask'));\r\n let max = 200;\r\n masks.forEach(m => {\r\n let index;\r\n if (m.dataset.zindex != null) {\r\n index = parseInt(m.dataset.zindex);\r\n m.style.zIndex = isNaN(index) ? '' : String(index);\r\n delete m.dataset.zindex;\r\n } else {\r\n index = parseInt(m.style.zIndex);\r\n }\r\n if (index > max) {\r\n max = index;\r\n }\r\n });\r\n mask.dataset.zindex = mask.style.zIndex;\r\n mask.style.zIndex = max + 1;\r\n });\r\n } else {\r\n\r\n }\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 let content = 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 = 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 (option.movable !== false) {\r\n const move = header; // title.querySelector('.ui-popup-move') ?? title;\r\n move.addEventListener('mousedown', e => {\r\n if (['svg', 'use'].includes(e.target?.tagName)) {\r\n return;\r\n }\r\n if (e.buttons !== 1) {\r\n return;\r\n }\r\n const parent = option.mask === false ? mask.parentElement : mask;\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 if (e.buttons === 1) {\r\n container.style.left = `${e.clientX - x}px`;\r\n container.style.top = `${e.clientY - y}px`;\r\n moved = true;\r\n } else {\r\n parent.dispatchEvent(new MouseEvent('mouseup'));\r\n }\r\n };\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 if (moved === true && typeof option.onMoveEnded === 'function') {\r\n option.onMoveEnded.call(this);\r\n }\r\n moved = false;\r\n };\r\n parent.addEventListener('mouseup', up);\r\n });\r\n }\r\n const icons = createElement('div', icons => {\r\n icons.className = 'ui-popup-header-icons';\r\n if (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 if (typeof option.onResizeEnded === 'function') {\r\n option.onResizeEnded.call(this);\r\n }\r\n });\r\n icons.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 this.close();\r\n }\r\n });\r\n cancel.addEventListener('click', () => this.close());\r\n icons.appendChild(cancel);\r\n });\r\n header.appendChild(icons);\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(option.buttons) && option.buttons.length > 0) {\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', ...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 this.close();\r\n }\r\n }).catch(reason => console.warn(reason));\r\n } else if (result !== false) {\r\n this.close();\r\n }\r\n } else {\r\n this.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 } else {\r\n container.querySelector('.ui-popup-body>.ui-popup-loading').classList.add('ui-popup-loading-content');\r\n }\r\n // resizable\r\n if (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 // const exists = [...parent.children].filter(e => e.classList.contains('ui-popup-mask'));\r\n const exists = parent.querySelectorAll('.ui-popup-mask');\r\n let zindex = 0;\r\n for (let ex of exists) {\r\n let z = parseInt(ex.style.zIndex);\r\n if (!isNaN(z) && z > zindex) {\r\n zindex = z;\r\n }\r\n }\r\n if (zindex > 0) {\r\n mask.style.zIndex = String(zindex + 1);\r\n }\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 if (e.buttons !== 1) {\r\n return;\r\n }\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 parent = option.mask === false ? mask.parentElement : mask;\r\n const move = e => {\r\n if (e.buttons !== 1) {\r\n parent.dispatchEvent(new MouseEvent('mouseup'));\r\n return;\r\n }\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 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","t","offsetHeight","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","enabled","tooltip","GridInputColumn","trigger","col","_parent","vals","GridTextColumn","_item","_col","grid","lines","_GridDropdownColumn","_getSource","getSource_fn","_setValue","setValue_fn","_getDrop","getDrop_fn","GridDropdownColumn","dropGlobal","data","__superGet","GridCheckboxColumn","GridIconColumn","className","ColumnChangedType","RefreshInterval","HoverInternal","RedumCount","MiniDragOffset","MiniColumnWidth","FilterPanelWidth","getClientX","getOffsetLeftFromWindow","indexOfParent","ColumnTypes","_Grid","_refreshSource","_createHeader","_createBody","_adjustRows","_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","sizer","createHeader_fn","body","createBody_fn","loading","scrollToTop_fn","force","height","length","adjustRows_fn","rows","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","exists","j","cell","onRowChanged_fn","selectedIndexes","selectChanged","bgColor","ev","attrs","attr","changingColumnOrder_fn","offset","x","offsetLeft","idx","changeColumnOrder_fn","orderIndex","targetIndex","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","animation","mask","option","masks","max","m","tabIndex","d","y","moved","move","icons","rect","cancel","button","result","reason","tabs","tabMin","tabMax","last","first","resize_fn","zindex","ex","z","resolve","_c","mod","originalX","originalY","original","minWidth","minHeight","resized","offsetX","offsetY","createPopup","buttons","iconTypes","showAlert","message","iconType","showConfirm"],"mappings":"opCAAO,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,CAAQ,EAEvBC,CACX,CCXA,MAAMC,GAAQ,6BAEd,SAASC,GAAUC,EAAMC,EAAI,CACzB,MAAMC,EAAI,OAAO,OAAW,IAAc,OAAS,CAAA,EAC7CC,EAAOD,EAAE,MAAQ,GACjBE,EAAMF,EAAE,QAAU,KAAO,GAAK,IAAIA,EAAE,SACpCG,EAAM,SAAS,gBAAgBP,GAAO,KAAK,EACjD,OAAAO,EAAI,eAAe,+BAAgC,aAAc,GAAGF,UAAaH,QAAWI,KAAOH,GAAI,EAChGI,CACX,CAEA,SAASC,GAAWC,EAAKP,EAAMC,EAAI,CAC/B,OAAIM,aAAe,YACfA,EAAI,gBAAgBR,GAAUC,EAAMC,CAAE,CAAC,EAEpCM,CACX,CAEA,SAASC,EAAWR,EAAMC,EAAIQ,EAAO,CACjC,MAAMF,EAAM,SAAS,gBAAgBT,GAAO,KAAK,EAEjD,GADAS,EAAI,YAAYR,GAAUC,EAAMC,CAAE,CAAC,EAC/BQ,GAAS,KACT,QAASC,KAAO,OAAO,QAAQD,CAAK,EAChCF,EAAI,MAAM,YAAYG,EAAI,CAAC,EAAGA,EAAI,CAAC,CAAC,EAG5C,OAAOH,CACX,CAEA,SAASI,GAAYC,EAAW,CAC5B,MAAMC,E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