fleet-contractor/Site/js/lib/ui.min.js.map
2023-04-28 14:30:46 +08:00

1 line
199 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 = c.offsetParent;\r\n while (p != null && p !== (isParent ? parent : offsetParent)) {\r\n left -= p.scrollLeft;\r\n top -= p.scrollTop;\r\n p = p.parentElement;\r\n }\r\n left += (c.offsetWidth - wrapper.offsetWidth) / 2;\r\n top -= wrapper.offsetHeight + 14;\r\n wrapper.style.left = `${left}px`;\r\n wrapper.style.top = `${top}px`;\r\n wrapper.style.visibility = 'visible';\r\n wrapper.style.opacity = 1;\r\n }, 100);\r\n }\r\n });\r\n container.addEventListener('mouseleave', () => {\r\n tid && clearTimeout(tid);\r\n tid = setTimeout(() => {\r\n wrapper.style.visibility = 'hidden';\r\n wrapper.style.opacity = 0;\r\n }, 300);\r\n });\r\n return container;\r\n}\r\n\r\nfunction resolveTooltip(container = document.body) {\r\n const tips = container.querySelectorAll('[title]');\r\n for (let tip of tips) {\r\n const title = tip.getAttribute('title');\r\n if (title != null) {\r\n tip.removeAttribute('title');\r\n setTooltip(tip, title);\r\n }\r\n }\r\n return container;\r\n}\r\n\r\nexport {\r\n setTooltip,\r\n resolveTooltip\r\n}","function nullOrEmpty(s) {\r\n return s == null || typeof s !== 'string' || s.length === 0;\r\n}\r\n\r\nfunction contains(s, key, ignoreCase) {\r\n if (nullOrEmpty(s) || key == null) {\r\n return false;\r\n }\r\n if (typeof key !== 'string') {\r\n key = String(key);\r\n }\r\n if (ignoreCase) {\r\n return s.toLowerCase().indexOf(key.toLowerCase()) >= 0;\r\n }\r\n return s.indexOf(key) >= 0;\r\n}\r\n\r\nfunction endsWith(s, suffix) {\r\n if (nullOrEmpty(s) || nullOrEmpty(suffix)) {\r\n return false;\r\n }\r\n return s.indexOf(suffix) === s.length - suffix.length;\r\n}\r\n\r\nfunction padStart(s, num, char) {\r\n if (nullOrEmpty(s) || isNaN(num) || num <= s.length) {\r\n return s;\r\n }\r\n return (char ?? ' ').repeat(num - s.length);\r\n}\r\n\r\nfunction formatUrl(msg) {\r\n //const urlReg = /(https?:\\/\\/)?([\\da-z\\.-]+)\\.([a-z\\.]{2,6})([\\/\\w \\.-]*)*\\/?/ig;\r\n //const urlArrray = str.match(urlReg);\r\n const p = /(http|ftp|https):\\/\\/.+?(\\s|\\r\\n|\\r|\\n|\\\"|\\'|\\*|$)/g;\r\n const r = msg.match(p);\r\n msg = escapeHtml(msg);\r\n\r\n if (r?.length > 0) {\r\n const rs = [];\r\n for (let t of r) {\r\n t = t.replace(/[\"'\\r\\n ]/g, '');\r\n if (rs.indexOf(t) < 0) {\r\n rs.push(t);\r\n }\r\n }\r\n\r\n for (let r of rs) {\r\n msg = msg.replaceAll(r, '<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 return /^[1-9]\\d{9,}$/.test(text);\r\n}\r\n\r\nexport {\r\n // cookie\r\n getCookie,\r\n setCookie,\r\n deleteCookie,\r\n // lgres\r\n init,\r\n r,\r\n lang,\r\n // request\r\n get,\r\n post,\r\n upload,\r\n // strings\r\n nullOrEmpty,\r\n contains,\r\n endsWith,\r\n padStart,\r\n formatUrl,\r\n escapeHtml,\r\n // variables\r\n g as global,\r\n isPositive,\r\n isMobile,\r\n // functions\r\n throttle,\r\n debounce,\r\n truncate,\r\n isEmail,\r\n isPhone\r\n}","// import { r, global, contains, isPositive, nullOrEmpty } from \"../utility\";\r\nimport './css/dropdown.scss';\r\nimport { r } from \"../utility/lgres\";\r\nimport { contains, nullOrEmpty } from \"../utility/strings\";\r\nimport { global, isPositive } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createCheckbox } from \"./checkbox\";\r\nimport { createIcon } from \"./icon\"\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\nconst DropdownTitleHeight = 26;\r\nconst DropdownItemHeight = 30;\r\n\r\nlet dropdownGlobal = global[SymbolDropdown];\r\n\r\nif (dropdownGlobal == null) {\r\n // init\r\n dropdownGlobal = {};\r\n Object.defineProperty(dropdownGlobal, 'clear', {\r\n writable: false,\r\n configurable: false,\r\n enumerable: false,\r\n value: function () {\r\n const panel = document.querySelector('.ui-drop-wrapper .ui-drop-box.active');\r\n if (panel == null) {\r\n return;\r\n }\r\n panel.classList.remove('active');\r\n const dropId = panel.parentElement.dataset.dropId;\r\n if (dropId == null) {\r\n return;\r\n }\r\n const dropdown = this[dropId];\r\n if (dropdown?.multiselect && typeof dropdown.oncollapsed === 'function') {\r\n dropdown.oncollapsed();\r\n }\r\n }\r\n })\r\n global[SymbolDropdown] = dropdownGlobal;\r\n\r\n document.addEventListener('mousedown', e => {\r\n let parent = e.target;\r\n while (parent != null) {\r\n if (parent.classList.contains('ui-drop-box')) {\r\n e.stopPropagation();\r\n return;\r\n }\r\n parent = parent.parentElement;\r\n }\r\n dropdownGlobal.clear();\r\n });\r\n}\r\n\r\nfunction selectItems(label, itemlist, htmlkey, textkey) {\r\n const htmls = itemlist.map(it => it[htmlkey]);\r\n if (htmls.some(it => it instanceof HTMLElement)) {\r\n label.replaceChildren(...htmls.filter(it => it != null).map(it => it.cloneNode(true)));\r\n } else {\r\n let text = itemlist.map(it => it[textkey]).join(', ');\r\n if (nullOrEmpty(text)) {\r\n text = r('noneItem', '( None )');\r\n }\r\n label.innerText = text;\r\n }\r\n}\r\n\r\nfunction filterSource(searchkeys, textkey, key, source) {\r\n if (!Array.isArray(searchkeys) || searchkeys.length === 0) {\r\n searchkeys = [textkey];\r\n }\r\n if (key.length > 0) {\r\n source = source.filter(it => {\r\n for (let k of searchkeys) {\r\n if (contains(it[k].toLowerCase(), key)) {\r\n return true;\r\n }\r\n }\r\n return false;\r\n });\r\n }\r\n return source;\r\n}\r\n\r\nclass Dropdown {\r\n #options;\r\n\r\n #wrapper;\r\n #container;\r\n #label;\r\n\r\n #allChecked;\r\n #source;\r\n #lastSelected;\r\n #selected;\r\n #selectedList;\r\n\r\n sourceFilter;\r\n onselectedlist;\r\n onselected;\r\n onexpanded;\r\n\r\n constructor(options = {}) {\r\n options.searchplaceholder ??= r('searchHolder', 'Search...');\r\n options.textkey ??= 'text';\r\n options.valuekey ??= 'value';\r\n options.htmlkey ??= 'html';\r\n options.maxlength ??= 500;\r\n this.#options = options;\r\n }\r\n\r\n create() {\r\n const options = this.#options;\r\n\r\n // wrapper\r\n const wrapper = createElement('div', 'ui-drop-wrapper');\r\n const dropId = String(Math.random()).substring(2);\r\n wrapper.dataset.dropId = dropId;\r\n dropdownGlobal[dropId] = this;\r\n this.#wrapper = wrapper;\r\n\r\n // header\r\n const header = createElement('div', 'ui-drop-header');\r\n header.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n header.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n header.addEventListener('keydown', e => {\r\n const up = e.key === 'ArrowUp';\r\n const down = e.key === 'ArrowDown';\r\n if (up || down) {\r\n const source = this.source;\r\n const count = source.length;\r\n const valuekey = this.#options.valuekey;\r\n let index = source?.indexOf(this.#selected);\r\n if (isNaN(index) || index < -1) {\r\n index = -1;\r\n } else if (index >= count) {\r\n index = count - 1;\r\n }\r\n if (up) {\r\n if (index > 0) {\r\n index--;\r\n } else {\r\n index = 0;\r\n }\r\n } else if (down) {\r\n if (index < 0) {\r\n index = 0;\r\n } else if (index < count) {\r\n index++;\r\n } else {\r\n index = count - 1;\r\n }\r\n }\r\n const target = source[index]?.[valuekey];\r\n if (target != null) {\r\n this.select(target);\r\n }\r\n } else if (e.key === 'Tab') {\r\n this.#dropdown(false);\r\n }\r\n });\r\n header.addEventListener('click', () => {\r\n if (this.disabled) {\r\n return;\r\n }\r\n const active = this.#expanded;\r\n const label = this.#label;\r\n if (active && label.ownerDocument.activeElement === label) {\r\n return;\r\n }\r\n this.#dropdown(!active);\r\n if (!active && typeof this.onexpanded === 'function') {\r\n setTimeout(() => this.onexpanded(), 120);\r\n }\r\n });\r\n\r\n // label or input\r\n let label;\r\n if (options.input) {\r\n label = createElement('input', 'ui-drop-text');\r\n label.setAttribute('type', 'text');\r\n options.placeholder && label.setAttribute('placeholder', options.placeholder);\r\n isPositive(options.maxlength) && label.setAttribute('maxlength', options.maxlength);\r\n isPositive(options.tabIndex) && label.setAttribute('tabindex', options.tabIndex);\r\n label.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n this.#container.classList.add('active');\r\n });\r\n label.addEventListener('blur', e => this.select(e.target.value));\r\n label.addEventListener('mousedown', e => this.#expanded && e.stopPropagation());\r\n } else {\r\n isPositive(options.tabIndex) && header.setAttribute('tabindex', options.tabIndex);\r\n label = createElement('label', 'ui-drop-text');\r\n }\r\n this.#label = label;\r\n if (options.multiselect) {\r\n if (Array.isArray(options.selectedlist)) {\r\n this.selectlist(options.selectedlist, true);\r\n } else {\r\n this.#allChecked = true;\r\n label.innerText = r('allItem', '( All )');\r\n }\r\n } else if (options.selected != null) {\r\n this.select(options.selected, true);\r\n }\r\n header.append(label, createElement('label', 'ui-drop-caret'));\r\n wrapper.appendChild(header);\r\n\r\n this.disabled = options.disabled || false;\r\n return wrapper;\r\n }\r\n\r\n get multiselect() { return this.#options.multiselect }\r\n\r\n get disabled() { return this.#wrapper == null || this.#wrapper.querySelector('.ui-drop-header.disabled') != null }\r\n\r\n set disabled(flag) {\r\n if (this.#wrapper == null) {\r\n return;\r\n }\r\n if (flag) {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.add('disabled');\r\n } else {\r\n this.#wrapper.querySelector('.ui-drop-header').classList.remove('disabled');\r\n }\r\n }\r\n\r\n get source() {\r\n let source = this.#source;\r\n if (source == null || !Array.isArray(source)) {\r\n if (typeof this.sourceFilter === 'function') {\r\n source = this.sourceFilter();\r\n }\r\n if (!Array.isArray(source)) {\r\n source = [];\r\n }\r\n this.#source = source;\r\n }\r\n return source;\r\n }\r\n\r\n set source(list) {\r\n if (!Array.isArray(list)) {\r\n return;\r\n }\r\n this.#source = list;\r\n if (this.#expanded) {\r\n setTimeout(() => this.#dropdown(), 120);\r\n }\r\n }\r\n\r\n get selected() { return this.#selected }\r\n\r\n get selectedlist() { return this.#selectedList || [] }\r\n\r\n select(selected, silence) {\r\n if (this.#lastSelected === selected) {\r\n return false;\r\n }\r\n this.#lastSelected = selected;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n let item = this.source.find(it => it[valuekey] === selected);\r\n if (this.#options.input) {\r\n if (item == null) {\r\n item = { [valuekey]: selected };\r\n }\r\n this.#label.value = selected;\r\n } else {\r\n const expanded = this.#expanded;\r\n if (expanded) {\r\n this.#container.querySelectorAll('li[data-value].selected').forEach(li => li.classList.remove('selected'));\r\n }\r\n if (item == null) {\r\n this.#selected = null;\r\n this.#label.innerText = ' ';\r\n return false;\r\n }\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n this.#label.replaceChildren(html.cloneNode(true));\r\n } else {\r\n let text = item[textkey];\r\n if (nullOrEmpty(text)) {\r\n text = ' ';\r\n }\r\n this.#label.innerText = text;\r\n }\r\n if (expanded) {\r\n const val = selected.replace(/\"/g, '\\\\\"');\r\n const li = this.#container.querySelector(`li[data-value=\"${val}\"]`);\r\n if (li != null) {\r\n li.classList.add('selected');\r\n }\r\n }\r\n }\r\n this.#selected = item;\r\n if (!silence && typeof this.onselected === 'function') {\r\n this.onselected(item);\r\n }\r\n }\r\n\r\n selectlist(selectedlist, silence) {\r\n const source = this.source;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const itemlist = selectedlist.map(v => {\r\n let item = source.find(it => it[valuekey] === v);\r\n if (item == null) {\r\n item = { [valuekey]: v, [textkey]: v };\r\n }\r\n return item;\r\n });\r\n if (itemlist.length === 0) {\r\n this.#selectedList = null;\r\n this.#label.innerText = none;\r\n return false;\r\n }\r\n selectItems(this.#label, itemlist, htmlkey, textkey);\r\n this.#selectedList = itemlist;\r\n if (!silence && typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n get #expanded() { return this.#container?.classList?.contains('active') }\r\n\r\n #dropdown(flag = true) {\r\n const options = this.#options;\r\n let panel = this.#container;\r\n if (panel == null) {\r\n panel = createElement('div', 'ui-drop-box');\r\n // search box\r\n if (!options.input && options.search) {\r\n const search = createElement('div', 'ui-drop-search');\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n isPositive(options.tabIndex) && input.setAttribute('tabindex', options.tabIndex);\r\n !nullOrEmpty(options.searchplaceholder) && input.setAttribute('placeholder', options.searchplaceholder);\r\n input.addEventListener('input', e => {\r\n const key = e.target.value.toLowerCase();\r\n const source = filterSource(options.searchkeys, options.textkey, key, this.source);\r\n this.#filllist(source);\r\n })\r\n search.append(input, createIcon('fa-light', 'search'));\r\n panel.appendChild(search);\r\n }\r\n // list\r\n const list = createElement('ul', 'ui-drop-list');\r\n if (!this.multiselect) {\r\n list.addEventListener('click', e => {\r\n let li = e.target;\r\n while (li.tagName !== 'LI') {\r\n li = li.parentElement;\r\n if (li == null) {\r\n return;\r\n }\r\n }\r\n const value = li.dataset.value;\r\n if (this.select(value) !== false) {\r\n dropdownGlobal.clear();\r\n }\r\n });\r\n }\r\n panel.appendChild(list);\r\n this.#container = panel;\r\n this.#wrapper.appendChild(panel);\r\n }\r\n if (flag) {\r\n let source = this.source;\r\n if (!options.input && options.search) {\r\n const search = panel.querySelector('.ui-drop-search > input');\r\n if (!nullOrEmpty(search?.value)) {\r\n source = filterSource(options.searchkeys, options.textkey, search.value, source);\r\n }\r\n }\r\n this.#filllist(source);\r\n // slide direction\r\n if (!options.slidefixed) {\r\n let parent = options.parent ?? document.body;\r\n let p = this.#wrapper;\r\n let top = p.offsetTop;\r\n while ((p = p.parentElement) != null && p !== parent) {\r\n top -= p.scrollTop;\r\n }\r\n if (top - parent.offsetTop + DropdownTitleHeight + panel.offsetHeight >= parent.offsetHeight) {\r\n panel.classList.add('slide-up');\r\n } else {\r\n panel.classList.remove('slide-up');\r\n }\r\n }\r\n panel.classList.add('active');\r\n } else {\r\n panel.classList.remove('active');\r\n }\r\n }\r\n\r\n #filllist(source) {\r\n const list = this.#container.querySelector('.ui-drop-list');\r\n list.replaceChildren();\r\n const multiselect = this.multiselect;\r\n const allchecked = this.#allChecked;\r\n if (multiselect) {\r\n list.appendChild(\r\n createElement('li', null,\r\n createCheckbox({\r\n label: r('allItem', '( All )'),\r\n checked: allchecked,\r\n customerAttributes: { 'isall': '1' },\r\n onchange: e => this.#triggerselect(e.target)\r\n })\r\n )\r\n );\r\n }\r\n // TODO: virtual mode\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n const selected = this.selected;\r\n const selectedlist = this.selectedlist;\r\n let scrolled;\r\n source.slice(0, 200).forEach((item, i) => {\r\n const val = item[valuekey];\r\n const li = createElement('li');\r\n li.dataset.value = val;\r\n li.setAttribute('title', item[textkey]);\r\n let label;\r\n const html = item[htmlkey];\r\n if (html instanceof HTMLElement) {\r\n label = html;\r\n }\r\n if (multiselect) {\r\n const selected = selectedlist.some(s => s[valuekey] === val);\r\n if (label == null) {\r\n label = createElement('span');\r\n label.innerText = item[textkey];\r\n }\r\n const box = createCheckbox({\r\n label,\r\n checked: allchecked || selected,\r\n customerAttributes: {\r\n 'class': 'dataitem',\r\n 'data-value': val\r\n },\r\n onchange: e => this.#triggerselect(e.target)\r\n });\r\n li.appendChild(box);\r\n } else {\r\n if (label == null) {\r\n li.innerText = item[textkey];\r\n } else {\r\n li.appendChild(label);\r\n }\r\n if (selected != null && selected[valuekey] === val) {\r\n scrolled = DropdownItemHeight * i;\r\n li.classList.add('selected');\r\n }\r\n }\r\n list.appendChild(li);\r\n });\r\n if (scrolled != null) {\r\n setTimeout(() => list.scrollTop = scrolled, 10);\r\n }\r\n }\r\n\r\n #triggerselect(checkbox) {\r\n let list;\r\n const valuekey = this.#options.valuekey;\r\n const textkey = this.#options.textkey;\r\n const htmlkey = this.#options.htmlkey;\r\n if (checkbox.getAttribute('isall') === '1') {\r\n const allchecked = this.#allChecked = checkbox.checked;\r\n const boxes = this.#container.querySelectorAll('input.dataitem');\r\n boxes.forEach(box => box.checked = allchecked);\r\n list = [];\r\n } else if (checkbox.checked) {\r\n if (this.#container.querySelectorAll('input.dataitem:not(:checked)').length === 0) {\r\n this.#allChecked = true;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = true;\r\n list = [];\r\n } else {\r\n const source = this.source;\r\n list = [...this.#container.querySelectorAll('input.dataitem:checked')]\r\n .map(c => source.find(it => it[valuekey] === c.dataset.value))\r\n .filter(it => it != null);\r\n }\r\n } else {\r\n const val = checkbox.dataset.value;\r\n if (this.#allChecked) {\r\n this.#allChecked = false;\r\n this.#container.querySelector('input[isall=\"1\"]').checked = false;\r\n list = this.source.filter(it => it[valuekey] !== val);\r\n } else {\r\n list = this.selectedlist.filter(it => it[valuekey] !== val);\r\n }\r\n }\r\n if (this.#allChecked) {\r\n this.#label.innerText = r('allItem', '( All )');\r\n } else {\r\n selectItems(this.#label, list, htmlkey, textkey);\r\n }\r\n this.#selectedList = list;\r\n if (typeof this.onselectedlist === 'function') {\r\n this.onselectedlist(itemlist);\r\n }\r\n }\r\n\r\n static resolve(dom = document.body) {\r\n const selects = dom.querySelectorAll('select');\r\n for (let sel of selects) {\r\n const source = [...sel.children].map(it => {\r\n return { value: it.value, text: it.innerText }\r\n });\r\n const drop = new Dropdown({\r\n selected: sel.value,\r\n disabled: sel.disabled,\r\n tabIndex: sel.tabIndex\r\n });\r\n drop.source = source;\r\n sel.parentElement.replaceChild(drop.create(), sel);\r\n }\r\n return dom;\r\n }\r\n}\r\n\r\nexport default Dropdown;","import { global } from \"../../utility\";\r\nimport { nullOrEmpty } from \"../../utility/strings\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\nimport { setTooltip } from \"../tooltip\";\r\nimport Dropdown from \"../dropdown\";\r\n\r\nclass GridColumn {\r\n static create() {\r\n return createElement('span');\r\n }\r\n\r\n static setValue(element, val) {\r\n element.innerText = val;\r\n }\r\n\r\n static setStyle(element, style) {\r\n for (let css of Object.entries(style)) {\r\n element.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n}\r\n\r\nclass GridInputColumn extends GridColumn {\r\n static get editing() { return true };\r\n\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('input');\r\n input.setAttribute('type', 'text');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val) {\r\n if (element.tagName !== 'INPUT') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n }\r\n }\r\n\r\n static getValue(e) { return e.target.value }\r\n\r\n static setEnabled(element, enabled) {\r\n element.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridTextColumn extends GridInputColumn {\r\n static createEdit(trigger, col, _parent, vals) {\r\n const input = createElement('textarea');\r\n if (typeof trigger === 'function') {\r\n input.addEventListener('change', trigger);\r\n }\r\n input.addEventListener('input', () => {\r\n if (vals.__editing == null) {\r\n vals.__editing = {\r\n [col.key]: true\r\n }\r\n } else {\r\n vals.__editing[col.key] = true;\r\n }\r\n });\r\n return input;\r\n }\r\n\r\n static setValue(element, val, _item, _col, grid) {\r\n if (element.tagName !== 'TEXTAREA') {\r\n super.setValue(element, val);\r\n } else {\r\n element.value = val;\r\n if (val != null) {\r\n const lines = String(val).split('\\n').length;\r\n element.style.height = `${lines * grid.lineHeight + 12}px`;\r\n }\r\n // TODO: bad performance\r\n }\r\n }\r\n}\r\n\r\nconst SymbolDropdown = Symbol.for('ui-dropdown');\r\n\r\nclass GridDropdownColumn extends GridColumn {\r\n static createEdit(trigger, col, parent) {\r\n const drop = new Dropdown({ ...col.dropOptions, parent });\r\n drop.onselected = trigger;\r\n return drop.create();\r\n }\r\n\r\n static #getDrop(element) {\r\n const dropGlobal = global[SymbolDropdown];\r\n if (dropGlobal == null) {\r\n return null;\r\n }\r\n const dropId = element.dataset.dropId;\r\n const drop = dropGlobal[dropId];\r\n if (drop == null) {\r\n return null;\r\n }\r\n return drop;\r\n }\r\n\r\n static #getSource(item, col) {\r\n let source = col.source;\r\n if (typeof source === 'function') {\r\n source = source(item);\r\n }\r\n return source;\r\n }\r\n\r\n static #setValue(source, element, val) {\r\n const data = source?.find(v => v.value === val);\r\n if (data != null) {\r\n val = data.text;\r\n }\r\n super.setValue(element, val);\r\n }\r\n\r\n static setValue(element, val, item, col) {\r\n if (element.tagName !== 'DIV') {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => this.#setValue(s, element, val));\r\n } else {\r\n this.#setValue(source, element, val);\r\n }\r\n return;\r\n }\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n if (drop.source == null || drop.source.length === 0) {\r\n let source = this.#getSource(item, col);\r\n if (source instanceof Promise) {\r\n source.then(s => {\r\n drop.source = s;\r\n drop.select(val, true);\r\n })\r\n return;\r\n } else if (source != null) {\r\n drop.source = source;\r\n }\r\n }\r\n drop.select(val, true);\r\n }\r\n\r\n static getValue(e) {\r\n return e.value;\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n const drop = this.#getDrop(element);\r\n if (drop == null) {\r\n return;\r\n }\r\n drop.disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridCheckboxColumn extends GridColumn {\r\n static createEdit(trigger) {\r\n const check = createCheckbox({\r\n onchange: typeof trigger === 'function' ? trigger : null\r\n });\r\n return check;\r\n }\r\n\r\n static setValue(element, val) {\r\n element.querySelector('input').checked = val;\r\n }\r\n\r\n static getValue(e) { return e.target.checked }\r\n\r\n static setEnabled(element, enabled) {\r\n element.querySelector('input').disabled = enabled === false;\r\n }\r\n}\r\n\r\nclass GridIconColumn extends GridColumn {\r\n static create() { return createElement('span', 'col-icon') }\r\n\r\n static setValue(element, val, item, col, grid) {\r\n let className = col.className;\r\n if (typeof className === 'function') {\r\n className = className.call(col, item);\r\n }\r\n if (className == null) {\r\n element.className = 'col-icon';\r\n } else {\r\n element.className = `col-icon ${className}`;\r\n }\r\n let type = col.iconType;\r\n if (typeof type === 'function') {\r\n type = type.call(col, item);\r\n }\r\n type ??= 'fa-regular';\r\n if (element.dataset.type !== type || element.dataset.icon !== val) {\r\n const icon = createIcon(type, val);\r\n // const layer = element.children[0];\r\n element.replaceChildren(icon);\r\n !nullOrEmpty(col.tooltip) && setTooltip(element, col.tooltip, false, grid.element);\r\n element.dataset.type = type;\r\n element.dataset.icon = val;\r\n }\r\n }\r\n\r\n static setEnabled(element, enabled) {\r\n if (enabled === false) {\r\n element.classList.add('disabled');\r\n } else {\r\n element.classList.remove('disabled');\r\n }\r\n const tooltip = element.querySelector('.ui-tooltip-wrapper');\r\n if (tooltip != null) {\r\n tooltip.style.display = enabled === false ? 'none' : '';\r\n }\r\n }\r\n}\r\n\r\nexport {\r\n GridColumn,\r\n GridInputColumn,\r\n GridTextColumn,\r\n GridDropdownColumn,\r\n GridCheckboxColumn,\r\n GridIconColumn\r\n}","import '../css/grid.scss';\r\nimport { global, isPositive, isMobile, throttle, truncate } from \"../../utility\";\r\nimport { r } from \"../../utility/lgres\";\r\nimport { createElement } from \"../../functions\";\r\nimport { createIcon } from \"../icon\";\r\nimport { createCheckbox } from \"../checkbox\";\r\nimport { GridColumn, GridInputColumn, GridTextColumn, GridDropdownColumn, GridCheckboxColumn, GridIconColumn } from \"./column\";\r\n\r\nconst ColumnChangedType = {\r\n Reorder: 'reorder',\r\n Resize: 'resize',\r\n Sort: 'sort'\r\n};\r\nconst RefreshInterval = isMobile() ? 32 : 0;\r\nconst HoverInternal = 200;\r\nconst RedumCount = 4;\r\nconst MiniDragOffset = 4;\r\nconst MiniColumnWidth = 50;\r\nconst FilterPanelWidth = 200;\r\n\r\nfunction getClientX(e) {\r\n if (e == null) {\r\n return null;\r\n }\r\n const cx = e.touches && e.touches[0]?.clientX;\r\n return cx ?? e.clientX;\r\n}\r\n\r\nfunction getOffsetLeftFromWindow(element) {\r\n let left = 0;\r\n while (element != null) {\r\n left += element.offsetLeft;\r\n element = element.offsetParent;\r\n }\r\n return left;\r\n}\r\n\r\nfunction indexOfParent(target) {\r\n // return [...target.parentElement.children].indexOf(target);\r\n return Array.prototype.indexOf.call(target.parentElement.children, target);\r\n}\r\n\r\nconst ColumnTypes = {\r\n 0: GridColumn,\r\n 1: GridInputColumn,\r\n 2: GridDropdownColumn,\r\n 3: GridCheckboxColumn,\r\n 4: GridIconColumn,\r\n 5: GridTextColumn\r\n};\r\n\r\nclass Grid {\r\n #source;\r\n #currentSource;\r\n #parent;\r\n #el;\r\n #refs;\r\n #rendering;\r\n #selectedColumnIndex = -1;\r\n #selectedIndexes;\r\n #startIndex = 0;\r\n #needResize;\r\n #containerHeight;\r\n #bodyClientWidth;\r\n #rowCount = -1;\r\n #scrollTop;\r\n #scrollLeft;\r\n #colTypes = {};\r\n #colAttrs = {};\r\n #vtable = [];\r\n\r\n columns = [];\r\n langs = {\r\n all: r('allItem', '( All )'),\r\n ok: r('ok', 'OK'),\r\n reset: r('reset', 'Reset')\r\n };\r\n virtualCount = 100;\r\n rowHeight = 36;\r\n lineHeight = 24;\r\n extraRows = 0;\r\n filterRowHeight = 30;\r\n height;\r\n readonly;\r\n multiSelect = false;\r\n fullrowClick = true;\r\n allowHtml = false;\r\n holderDisabled = false;\r\n headerVisible = true;\r\n window = global;\r\n sortIndex = -1;\r\n sortDirection = 1;\r\n\r\n willSelect;\r\n selectedRowChanged;\r\n cellDblClicked;\r\n cellClicked;\r\n rowDblClicked;\r\n columnChanged;\r\n\r\n static ColumnTypes = {\r\n Common: 0,\r\n Input: 1,\r\n Dropdown: 2,\r\n Checkbox: 3,\r\n Icon: 4,\r\n Text: 5,\r\n isCheckbox(type) { return type === 3 }\r\n };\r\n\r\n static GridColumn = GridColumn;\r\n\r\n constructor(container) {\r\n this.#parent = container;\r\n }\r\n\r\n get element() { return this.#el }\r\n\r\n get source() { return this.#source?.map(s => s.values) }\r\n set source(list) {\r\n if (this.#el == null) {\r\n throw new Error('grid has not been initialized.')\r\n }\r\n if (!Array.isArray(list)) {\r\n throw new Error('source is not an Array.')\r\n }\r\n list = list.map(i => { return { values: i } });\r\n this.#source = list;\r\n this.#refreshSource(list);\r\n }\r\n\r\n #refreshSource(list) {\r\n list ??= this.#source;\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource = list.filter(it => {\r\n for (let col of this.columns) {\r\n if (Array.isArray(col.filterValues)) {\r\n const v = this.#getItemValue(it.values, col.key, col.filter);\r\n if (col.filterValues.indexOf(v) < 0) {\r\n return false;\r\n }\r\n }\r\n }\r\n return true;\r\n });\r\n } else {\r\n this.#currentSource = list;\r\n }\r\n this.#selectedColumnIndex = -1;\r\n this.#selectedIndexes = [];\r\n this.#startIndex = 0;\r\n this.#scrollTop = 0;\r\n this.#scrollLeft = 0;\r\n this.#rowCount = -1;\r\n\r\n if (this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n this.resize();\r\n }\r\n\r\n get virtual() { return this.#currentSource?.length > this.virtualCount }\r\n\r\n get sortKey() {\r\n if (this.columns == null) {\r\n return null;\r\n }\r\n return this.columns[this.sortIndex]?.key;\r\n }\r\n\r\n get selectedIndexes() { return this.#selectedIndexes }\r\n set selectedIndexes(indexes) {\r\n const startIndex = this.#startIndex;\r\n this.#selectedIndexes.splice(0, this.#selectedIndexes.length, ...indexes);\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (indexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged();\r\n }\r\n }\r\n\r\n get selectedIndex() { return (this.#selectedIndexes && this.#selectedIndexes[0]) ?? -1 }\r\n\r\n get loading() { return this.#refs.loading?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n if (this.#refs.loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n this.#refs.loading.style.visibility = 'hidden';\r\n this.#refs.loading.style.opacity = 0;\r\n } else {\r\n this.#refs.loading.style.visibility = 'visible';\r\n this.#refs.loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n get scrollTop() { return this.#refs.body?.scrollTop; }\r\n set scrollTop(top) {\r\n if (this.#refs.body == null) {\r\n return;\r\n }\r\n this.#refs.body.scrollTop = top;\r\n this.reload();\r\n }\r\n\r\n init(container = this.#parent) {\r\n this.#el = null;\r\n this.#refs = {};\r\n this.#rendering = true;\r\n if (!(container instanceof HTMLElement)) {\r\n throw new Error('no specified parent.');\r\n }\r\n this.#parent = container;\r\n const grid = createElement('div', 'ui-grid');\r\n grid.setAttribute('tabindex', 0);\r\n const onKeydown = e => {\r\n let index = this.selectedIndex;\r\n let flag = false;\r\n if (e.key === 'ArrowUp') {\r\n // up\r\n if (index > 0) {\r\n flag = true;\r\n index -= 1;\r\n }\r\n } else if (e.key === 'ArrowDown') {\r\n // down\r\n const count = this.#currentSource?.length ?? 0;\r\n if (index < count - 1) {\r\n flag = true;\r\n index += 1;\r\n }\r\n }\r\n if (flag) {\r\n this.#selectedIndexes = [index];\r\n this.scrollToIndex(index);\r\n this.refresh();\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(index);\r\n }\r\n e.stopPropagation();\r\n }\r\n };\r\n grid.addEventListener('keydown', e => throttle(onKeydown, 800, this, e));\r\n container.replaceChildren(grid);\r\n const sizer = createElement('span', 'ui-grid-sizer');\r\n grid.appendChild(sizer);\r\n this.#refs.sizer = sizer;\r\n\r\n // header & body\r\n const header = this.#createHeader();\r\n grid.appendChild(header);\r\n const body = this.#createBody();\r\n grid.appendChild(body);\r\n\r\n // loading\r\n const loading = createElement('div', 'ui-grid-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n );\r\n this.#refs.loading = loading;\r\n grid.appendChild(loading);\r\n this.#el = grid;\r\n\r\n this.#rendering = false;\r\n if (this.#source != null && this.sortIndex >= 0) {\r\n this.sortColumn();\r\n }\r\n }\r\n\r\n scrollToIndex(index) {\r\n const top = this.#scrollToTop(index * (this.rowHeight + 1), true);\r\n this.#refs.body.scrollTop = top;\r\n }\r\n\r\n resize(force) {\r\n if (this.#rendering || this.#el == null) {\r\n return;\r\n }\r\n const body = this.#refs.body;\r\n // let height = this.#refs.header.offsetHeight + 2;\r\n // let top = body.offsetTop;\r\n // if (top !== height) {\r\n // body.style.top = `${height}px`;\r\n // top = height;\r\n // }\r\n const top = this.headerVisible === false ? 0 : this.#refs.header.offsetHeight;\r\n\r\n let height = this.height;\r\n if (height === 0) {\r\n height = this.#containerHeight;\r\n } else if (isNaN(height) || height < 0) {\r\n height = this.#el.offsetHeight - top;\r\n }\r\n const count = truncate((height - 1) / (this.rowHeight + 1)) + (RedumCount * 2) + 1;\r\n if (force || count !== this.#rowCount) {\r\n this.#rowCount = count;\r\n this.reload();\r\n }\r\n this.#bodyClientWidth = body.clientWidth;\r\n }\r\n\r\n reload() {\r\n let length = this.#currentSource.length;\r\n if (this.extraRows > 0) {\r\n length += this.extraRows;\r\n }\r\n this.#containerHeight = length * (this.rowHeight + 1);\r\n this.#refs.body.scrollTop = 0;\r\n this.#refs.body.scrollLeft = 0;\r\n this.#refs.bodyContent.style.top = '0px';\r\n this.#refs.bodyContainer.style.height = `${this.#containerHeight}px`;\r\n // this.#adjustRows(this.#refs.bodyContent);\r\n this.refresh();\r\n }\r\n\r\n refresh() {\r\n if (this.#refs.bodyContent == null) {\r\n throw new Error('body has not been created.');\r\n }\r\n const widths = {};\r\n this.#fillRows(widths);\r\n if (this.#needResize && widths.flag) {\r\n this.#needResize = false;\r\n this.columns.forEach((col, i) => {\r\n if (!this.#get(col.key, 'autoResize')) {\r\n return;\r\n }\r\n let width = widths[i];\r\n if (width < col.width) {\r\n width = col.width;\r\n }\r\n if (width > 0) {\r\n this.#changeColumnWidth(i, width);\r\n }\r\n });\r\n }\r\n }\r\n\r\n resetChange() {\r\n if (this.#source == null) {\r\n return;\r\n }\r\n for (let row of this.#source) {\r\n delete row.__changed;\r\n }\r\n }\r\n\r\n sortColumn(reload) {\r\n const index = this.sortIndex;\r\n const col = this.columns[index];\r\n if (col == null) {\r\n return;\r\n }\r\n const direction = this.sortDirection;\r\n [...this.#refs.header.children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (i === index) {\r\n arrow.className = `arrow ${(direction !== 1 ? 'desc' : 'asc')}`;\r\n } else if (arrow.className !== 'arrow') {\r\n arrow.className = 'arrow';\r\n }\r\n });\r\n let comparer;\r\n if (typeof col.sortFilter !== 'function') {\r\n const direction = this.sortDirection;\r\n if (isNaN(direction)) {\r\n direction = 1;\r\n }\r\n comparer = (a, b) => {\r\n a = this.#getItemValue(a.values, col.key, col.filter);\r\n b = this.#getItemValue(b.values, col.key, col.filter);\r\n if (a == null && typeof b === 'number') {\r\n a = 0;\r\n } else if (typeof a === 'number' && b == null) {\r\n b = 0;\r\n } else if (a != null && b == null) {\r\n return direction;\r\n } else if (typeof a === 'string' && typeof b === 'string') {\r\n a = a.toLowerCase();\r\n b = b.toLowerCase();\r\n }\r\n return a === b ? 0 : (a > b ? 1 : -1) * direction;\r\n };\r\n } else {\r\n comparer = (a, b) => col.sortFilter(a.values, b.values) * direction;\r\n }\r\n this.#source.sort(comparer);\r\n if (this.#colAttrs.__filtered === true) {\r\n this.#currentSource.sort(comparer);\r\n }\r\n if (this.#rowCount < 0) {\r\n return;\r\n }\r\n if (reload) {\r\n this.reload();\r\n } else {\r\n this.refresh();\r\n }\r\n }\r\n\r\n #createHeader() {\r\n const thead = createElement('table', 'ui-grid-header');\r\n if (this.headerVisible === false) {\r\n thead.style.display = 'none';\r\n }\r\n const header = createElement('tr');\r\n thead.appendChild(header);\r\n const sizer = this.#refs.sizer;\r\n for (let col of this.columns) {\r\n if (col.visible === false) {\r\n const hidden = createElement('th');\r\n hidden.style.display = 'none';\r\n if (col.sortable !== false) {\r\n hidden.dataset.key = col.key;\r\n hidden.addEventListener('click', e => this.#onHeaderClicked(e, col, true));\r\n }\r\n header.appendChild(hidden);\r\n continue;\r\n }\r\n // style\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n if (col.width > 0) {\r\n // col.autoResize = false;\r\n } else {\r\n this.#set(col.key, 'autoResize', true);\r\n this.#needResize = true;\r\n sizer.innerText = col.caption ?? '';\r\n let width = sizer.offsetWidth + 22;\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n width += 32;\r\n }\r\n if (col.allowFilter === true) {\r\n width += 14;\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n col.width = width;\r\n }\r\n col.align ??= isCheckbox ? 'center' : 'left';\r\n if (col.sortable !== false) {\r\n col.sortable = true;\r\n }\r\n const w = `${col.width}px`;\r\n const style = {\r\n 'width': w,\r\n 'max-width': w,\r\n 'min-width': w,\r\n 'text-align': col.align\r\n };\r\n this.#set(col.key, 'style', style);\r\n // element\r\n const th = createElement('th', 'column');\r\n th.dataset.key = col.key;\r\n for (let css of Object.entries(style)) {\r\n th.style.setProperty(css[0], css[1]);\r\n }\r\n if (col.sortable) {\r\n th.style.cursor = 'pointer';\r\n th.addEventListener('click', e => this.#onHeaderClicked(e, col));\r\n }\r\n if (col.orderable !== false) {\r\n col.orderable = true;\r\n th.addEventListener('mousedown', e => this.#onDragStart(e, col));\r\n }\r\n const wrapper = createElement('div');\r\n th.appendChild(wrapper);\r\n if (!this.readonly && col.enabled !== false && col.allcheck && isCheckbox) {\r\n const check = createCheckbox({\r\n onchange: e => this.#onColumnAllChecked(col, e.target.checked)\r\n });\r\n wrapper.appendChild(check);\r\n }\r\n const caption = createElement('span');\r\n if (col.textStyle != null) {\r\n for (let css of Object.entries(col.textStyle)) {\r\n caption.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n caption.innerText = col.caption ?? '';\r\n wrapper.appendChild(caption);\r\n // order arrow\r\n if (col.sortable) {\r\n th.appendChild(createElement('layer', 'arrow'));\r\n }\r\n // filter\r\n if (col.allowFilter === true) {\r\n const filter = createElement('layer', 'filter');\r\n filter.appendChild(createIcon('fa-solid', 'filter'));\r\n filter.addEventListener('mousedown', e => this.#onFilter(e, col));\r\n th.classList.add('header-filter');\r\n th.appendChild(filter);\r\n }\r\n // resize spliter\r\n if (col.resizable !== false) {\r\n const spliter = createElement('layer', 'spliter');\r\n spliter.addEventListener('mousedown', e => this.#onResizeStart(e, col));\r\n spliter.addEventListener('dblclick', e => this.#onAutoResize(e, col));\r\n th.appendChild(spliter);\r\n }\r\n // tooltip\r\n // !nullOrEmpty(col.tooltip) && setTooltip(th, col.tooltip);\r\n header.appendChild(th);\r\n }\r\n const dragger = createElement('div', 'dragger');\r\n const draggerCursor = createElement('layer', 'dragger-cursor');\r\n header.appendChild(createElement('th', null, dragger, draggerCursor));\r\n\r\n sizer.replaceChildren();\r\n this.#refs.header = header;\r\n this.#refs.dragger = dragger;\r\n this.#refs.draggerCursor = draggerCursor;\r\n return thead;\r\n }\r\n\r\n #createBody() {\r\n const body = createElement('div', 'ui-grid-body');\r\n body.addEventListener('scroll', e => throttle(this.#onScroll, RefreshInterval, this, e), { passive: true });\r\n const cols = this.columns;\r\n let width = 1;\r\n for (let col of cols) {\r\n if (col.visible !== false && !isNaN(col.width)) {\r\n width += col.width + 1;\r\n }\r\n }\r\n // body container\r\n const bodyContainer = createElement('div');\r\n bodyContainer.style.position = 'relative';\r\n bodyContainer.style.minWidth = '100%';\r\n bodyContainer.style.minHeight = '1px';\r\n if (width > 0) {\r\n bodyContainer.style.width = `${width}px`;\r\n }\r\n body.appendChild(bodyContainer);\r\n // body content\r\n const bodyContent = createElement('table', 'ui-grid-body-content');\r\n bodyContent.addEventListener('mousedown', e => {\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n const rowIndex = indexOfParent(parent);\r\n let colIndex = indexOfParent(target);\r\n if (colIndex >= this.columns.length) {\r\n colIndex = -1;\r\n }\r\n this.#onRowClicked(e, rowIndex, colIndex);\r\n });\r\n bodyContent.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(bodyContent);\r\n // this.#adjustRows();\r\n // events\r\n if (!this.holderDisabled) {\r\n const holder = createElement('div', 'ui-grid-hover-holder');\r\n holder.addEventListener('mousedown', e => {\r\n const holder = e.currentTarget;\r\n const row = Number(holder.dataset.row);\r\n const col = Number(holder.dataset.col);\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return this.#onRowClicked(e, row + this.#startIndex, col);\r\n });\r\n holder.addEventListener('dblclick', e => this.#onRowDblClicked(e));\r\n bodyContainer.appendChild(holder);\r\n body.addEventListener('mousemove', e => throttle(this.#onBodyMouseMove, HoverInternal, this, e, holder), { passive: true });\r\n }\r\n this.#refs.body = body;\r\n this.#refs.bodyContainer = bodyContainer;\r\n this.#refs.bodyContent = bodyContent;\r\n\r\n // this.refresh();\r\n return body;\r\n }\r\n\r\n #fillRows(widths) {\r\n let count = this.#rowCount;\r\n if (isNaN(count) || count < 0 || !this.virtual) {\r\n count = this.#currentSource.length;\r\n }\r\n const content = this.#refs.bodyContent;\r\n // content.replaceChildren();\r\n const cols = this.columns;\r\n const vtable = this.#vtable;\r\n const vnew = [];\r\n const startIndex = this.#startIndex;\r\n // reuse\r\n for (let i = 0; i < count; i++) {\r\n const index = startIndex + i;\r\n const e = vtable.findIndex(v => v.index === index);\r\n if (e >= 0) {\r\n vnew[i] = vtable.splice(e, 1)[0];\r\n }\r\n }\r\n // move or create\r\n for (let i = 0; i < count; i++) {\r\n if (vnew[i] != null) {\r\n continue;\r\n }\r\n const index = startIndex + i;\r\n const e = vtable.splice(0, 1);\r\n let vdom;\r\n if (e.length > 0) {\r\n vdom = {\r\n ...e[0],\r\n index,\r\n mode: 'move'\r\n };\r\n vdom.el.remove();\r\n } else {\r\n const row = createElement('tr', 'ui-grid-row');\r\n cols.forEach((col, j) => {\r\n const cell = createElement('td');\r\n if (col.visible !== false) {\r\n cell.dataset.col = String(j);\r\n const style = this.#get(col.key, 'style');\r\n if (style != null) {\r\n for (let css of Object.entries(style)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (col.css != null) {\r\n for (let css of Object.entries(col.css)) {\r\n cell.style.setProperty(css[0], css[1]);\r\n }\r\n }\r\n if (Grid.ColumnTypes.isCheckbox(col.type)) {\r\n cell.appendChild(GridCheckboxColumn.createEdit(e => this.#onRowChanged(e, exists + i, col, e.target.checked)));\r\n // this.#colTypes[col.key] = GridCheckboxColumn;\r\n } else {\r\n let type = this.#colTypes[col.key];\r\n if (type == null) {\r\n if (isNaN(col.type)) {\r\n if (this.allowHtml && col.type != null) {\r\n type = col.type;\r\n }\r\n } else {\r\n type = ColumnTypes[col.type];\r\n }\r\n type ??= GridColumn;\r\n this.#colTypes[col.key] = type;\r\n }\r\n cell.appendChild(type.create(col));\r\n }\r\n }\r\n row.appendChild(cell);\r\n });\r\n row.appendChild(createElement('td'));\r\n vdom = {\r\n index,\r\n mode: 'create',\r\n el: row\r\n };\r\n }\r\n vnew[i] = vdom;\r\n }\r\n this.#vtable = vnew;\r\n\r\n const selectedIndexes = this.#selectedIndexes;\r\n vnew.filter(vdom => vdom.mode != null).forEach(vdom => {\r\n const row = vdom.el;\r\n const index = vdom.index;\r\n const vals = this.#currentSource[index];\r\n if (vals == null) {\r\n return;\r\n }\r\n if (!isPositive(row.children.length)) {\r\n return;\r\n }\r\n // row.dataset.row = String(index);\r\n const item = vals.values;\r\n const selected = selectedIndexes.indexOf(index) >= 0;\r\n if (selected) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n // data\r\n const selectChanged = vals.__selected ^ selected;\r\n if (selected) {\r\n vals.__selected = true;\r\n } else {\r\n delete vals.__selected;\r\n }\r\n cols.forEach((col, j) => {\r\n if (col.visible === false) {\r\n return;\r\n }\r\n let val;\r\n if (col.text != null) {\r\n val = col.text;\r\n } else if (typeof col.filter === 'function') {\r\n val = col.filter(item);\r\n } else {\r\n val = item[col.key];\r\n if (val?.displayValue != null) {\r\n val = val.displayValue;\r\n }\r\n }\r\n val ??= '';\r\n // fill\r\n const cell = row.children[j];\r\n cell.dataset.row = String(index);\r\n if (typeof col.bgFilter === 'function') {\r\n const bgColor = col.bgFilter(item);\r\n cell.style.backgroundColor = bgColor ?? '';\r\n }\r\n const isCheckbox = Grid.ColumnTypes.isCheckbox(col.type);\r\n const type = isCheckbox ? GridCheckboxColumn : this.#colTypes[col.key] ?? GridColumn;\r\n let element;\r\n if (!isCheckbox && selectChanged && typeof type.createEdit === 'function') {\r\n if (vals.__editing?.[col.key] && type.editing) {\r\n val = type.getValue({ target: cell.children[0] });\r\n this.#onRowChanged(null, index, col, val, true);\r\n }\r\n element = selected ?\r\n type.createEdit(e => this.#onRowChanged(e, index, col, type.getValue(e)), col, this.#refs.bodyContent, vals) :\r\n type.create(col);\r\n cell.replaceChildren(element);\r\n } else {\r\n element = cell.children[0];\r\n }\r\n let enabled;\r\n if (this.readonly) {\r\n enabled = false;\r\n } else {\r\n enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n }\r\n type.setValue(element, val, item, col, this);\r\n if (typeof type.setEnabled === 'function') {\r\n type.setEnabled(element, enabled);\r\n }\r\n // auto resize\r\n if (this.#needResize && this.#get(col.key, 'autoResize')) {\r\n const width = element.scrollWidth + 12;\r\n if (width > 0 && widths != null && (isNaN(widths[j]) || widths[j] < width)) {\r\n widths[j] = width;\r\n widths.flag = true;\r\n }\r\n }\r\n if (typeof col.styleFilter === 'function') {\r\n const style = col.styleFilter(item);\r\n if (style != null) {\r\n type.setStyle(element, style);\r\n }\r\n }\r\n if (col.events != null) {\r\n for (let ev of Object.entries(col.events)) {\r\n element[ev[0]] = ev[1].bind(item);\r\n }\r\n }\r\n if (col.attrs != null) {\r\n let attrs = col.attrs;\r\n if (typeof attrs === 'function') {\r\n attrs = attrs(item);\r\n }\r\n for (let attr of Object.entries(attrs)) {\r\n element.setAttribute(attr[0], attr[1]);\r\n }\r\n }\r\n });\r\n if (vals.__editing != null) {\r\n delete vals.__editing;\r\n }\r\n });\r\n\r\n content.replaceChildren(...vnew.map(vdom => vdom.el));\r\n }\r\n\r\n #changeColumnWidth(index, width) {\r\n const col = this.columns[index];\r\n // const oldwidth = col.width;\r\n const w = `${width}px`;\r\n col.width = width;\r\n const style = this.#get(col.key, 'style');\r\n style.width = w;\r\n style['max-width'] = w;\r\n style['min-width'] = w;\r\n let element = this.#refs.header.children[index];\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n const body = this.#refs.bodyContent;\r\n for (let row of body.children) {\r\n element = row.children[index];\r\n if (element != null) {\r\n element.style.width = w;\r\n element.style.maxWidth = w;\r\n element.style.minWidth = w;\r\n }\r\n }\r\n // } else {\r\n // width = this.#refs.bodyContainer.offsetWidth - oldwidth + width;\r\n // this.#refs.bodyContainer.style.width = `${width}px`;\r\n // }\r\n }\r\n\r\n #changingColumnOrder(index, offset, x, offsetLeft) {\r\n const children = this.#refs.header.children;\r\n let element = children[index];\r\n this.#refs.dragger.style.left = `${element.offsetLeft - offsetLeft + offset}px`;\r\n this.#refs.dragger.style.width = element.style.width;\r\n this.#refs.dragger.style.display = 'block';\r\n offset = x - getOffsetLeftFromWindow(element);\r\n let idx;\r\n if (offset < 0) {\r\n offset = -offset;\r\n for (let i = index - 1; i >= 0 && offset >= 0; i -= 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i : i + 1;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= 0;\r\n } else {\r\n const count = children.length;\r\n for (let i = index; i < count - 1 && offset >= 0; i += 1) {\r\n element = children[i];\r\n if (element == null || element.className !== 'column') {\r\n idx = i;\r\n break;\r\n }\r\n if (offset < element.offsetWidth) {\r\n idx = (offset > element.offsetWidth / 2) ? i + 1 : i;\r\n break;\r\n }\r\n offset -= element.offsetWidth;\r\n }\r\n idx ??= count - 1;\r\n }\r\n if (idx !== this.#colAttrs.__orderIndex) {\r\n this.#colAttrs.__orderIndex = idx;\r\n element = children[idx];\r\n if (element == null) {\r\n return;\r\n }\r\n this.#refs.draggerCursor.style.left = `${element.offsetLeft - offsetLeft}px`;\r\n this.#refs.draggerCursor.style.display = 'block';\r\n }\r\n }\r\n\r\n #changeColumnOrder(index) {\r\n this.#refs.dragger.style.display = '';\r\n this.#refs.draggerCursor.style.display = '';\r\n const orderIndex = this.#colAttrs.__orderIndex;\r\n if (orderIndex >= 0 && orderIndex !== index) {\r\n let targetIndex = orderIndex - index;\r\n if (targetIndex >= 0 && targetIndex <= 1) {\r\n return;\r\n }\r\n const header = this.#refs.header;\r\n const children = header.children;\r\n const rows = this.#refs.bodyContent.children;\r\n const columns = this.columns;\r\n if (targetIndex > 1) {\r\n targetIndex = orderIndex - 1;\r\n // const current = columns[index];\r\n // for (let i = index; i < targetIndex; i += 1) {\r\n // columns[i] = columns[i + 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex].nextElementSibling);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex].nextElementSibling);\r\n }\r\n } else {\r\n targetIndex = orderIndex;\r\n // const current = columns[index];\r\n // for (let i = index; i > targetIndex; i -= 1) {\r\n // columns[i] = columns[i - 1];\r\n // }\r\n // columns[targetIndex] = current;\r\n const current = columns.splice(index, 1)[0];\r\n columns.splice(targetIndex, 0, current);\r\n header.insertBefore(children[index], children[targetIndex]);\r\n for (let row of rows) {\r\n row.insertBefore(row.children[index], row.children[targetIndex]);\r\n }\r\n }\r\n // refresh sortIndex\r\n [...children].forEach((th, i) => {\r\n const arrow = th.querySelector('.arrow');\r\n if (arrow == null) {\r\n return;\r\n }\r\n if (arrow.className !== 'arrow') {\r\n this.sortIndex = i;\r\n }\r\n });\r\n\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Reorder, index, targetIndex);\r\n }\r\n }\r\n }\r\n\r\n #scrollToTop(top, reload) {\r\n const rowHeight = (this.rowHeight + 1);\r\n top -= (top % (rowHeight * 2)) + (RedumCount * rowHeight);\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#containerHeight - (reload ? 0 : this.#rowCount * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#scrollTop !== top) {\r\n this.#scrollTop = top;\r\n if (this.virtual) {\r\n this.#startIndex = top / rowHeight;\r\n }\r\n this.refresh();\r\n if (this.virtual) {\r\n this.#refs.bodyContent.style.top = `${top}px`;\r\n }\r\n } else if (reload) {\r\n this.refresh();\r\n }\r\n\r\n return top;\r\n }\r\n\r\n #get(key, name) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n return null;\r\n }\r\n return attr[name];\r\n }\r\n\r\n #set(key, name, value) {\r\n const attr = this.#colAttrs[key];\r\n if (attr == null) {\r\n this.#colAttrs[key] = { [name]: value };\r\n } else {\r\n attr[name] = value;\r\n }\r\n }\r\n\r\n #getItemValue(item, key, filter) {\r\n let value;\r\n if (typeof filter === 'function') {\r\n value = filter(item);\r\n } else {\r\n value = item[key];\r\n }\r\n return value?.value ?? value;\r\n }\r\n\r\n #getRowTarget(target) {\r\n let parent;\r\n while ((parent = target.parentElement) != null && !parent.classList.contains('ui-grid-row')) {\r\n target = parent;\r\n }\r\n return [parent, target];\r\n }\r\n\r\n #notHeader(tagName) {\r\n return /^(input|label|layer|svg|use)$/i.test(tagName);\r\n }\r\n\r\n #onHeaderClicked(e, col, force) {\r\n if (!force && (this.#get(col.key, 'resizing') || this.#get(col.key, 'dragging'))) {\r\n return;\r\n }\r\n if (!this.#notHeader(e.target.tagName)) {\r\n const index = this.columns.indexOf(col);\r\n if (index < 0) {\r\n return;\r\n }\r\n if (this.sortIndex === index) {\r\n this.sortDirection = this.sortDirection === 1 ? -1 : 1;\r\n } else {\r\n this.sortIndex = index;\r\n }\r\n this.sortColumn(true);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Sort, index, this.sortDirection);\r\n }\r\n }\r\n }\r\n\r\n #onCloseFilter() {\r\n const panels = this.#el.querySelectorAll('.filter-panel.active');\r\n if (panels.length > 0) {\r\n panels.forEach(el => el.classList.remove('active'));\r\n setTimeout(() => this.#el.querySelectorAll('.filter-panel').forEach(el => el.remove()), 120);\r\n const filtering = this.#colAttrs.__filtering;\r\n if (filtering instanceof HTMLElement) {\r\n filtering.classList.remove('hover');\r\n }\r\n delete this.#colAttrs.__filtering;\r\n return true;\r\n }\r\n return false;\r\n }\r\n\r\n #onFilter(e, col) {\r\n if (this.#onCloseFilter()) {\r\n return;\r\n }\r\n const close = e => {\r\n if ((e.target.tagName === 'LAYER' && e.target.classList.contains('filter')) ||\r\n e.target.tagName === 'use') {\r\n return;\r\n }\r\n if (this.#onCloseFilter()) {\r\n document.removeEventListener('mousedown', close);\r\n }\r\n }\r\n document.addEventListener('mousedown', close);\r\n const panel = createElement('div', 'filter-panel');\r\n panel.addEventListener('mousedown', e => e.stopPropagation());\r\n const filter = e.currentTarget;\r\n const th = filter.parentElement;\r\n const width = th.offsetWidth;\r\n panel.style.top = `${th.offsetHeight}px`;\r\n panel.style.left = (th.offsetLeft + (width > FilterPanelWidth ? width - FilterPanelWidth : 0)) + 'px';\r\n\r\n // search\r\n let searchbox;\r\n if (col.allowSearch !== false) {\r\n const searchholder = createElement('div', 'filter-search-holder');\r\n searchbox = createElement('input', 'filter-search-box ui-text');\r\n searchbox.type = 'text';\r\n const searchicon = createIcon('fa-regular', 'search');\r\n searchicon.addEventListener('mousedown', e => {\r\n searchbox.focus();\r\n e.preventDefault();\r\n });\r\n searchholder.append(searchbox, searchicon);\r\n panel.append(searchholder);\r\n }\r\n // list\r\n const itemlist = createElement('div', 'filter-item-list');\r\n itemlist.addEventListener('scroll', e => throttle(this.#onFilterScroll, RefreshInterval, this, col, itemlist, e.target.scrollTop), { passive: true });\r\n // - all\r\n const itemall = createElement('div', 'filter-item filter-all');\r\n itemall.appendChild(createCheckbox({\r\n label: this.langs.all,\r\n onchange: e => {\r\n const checked = e.target.checked;\r\n itemlist.querySelectorAll('.filter-content input').forEach(box => box.checked = checked);\r\n }\r\n }));\r\n itemlist.appendChild(itemall);\r\n // - items\r\n let array;\r\n if (Array.isArray(col.filterSource)) {\r\n array = col.filterSource;\r\n } else if (typeof col.filterSource === 'function') {\r\n array = col.filterSource.call(this, col);\r\n } else {\r\n const dict = Object.create(null);\r\n for (let item of this.#source) {\r\n const val = this.#getItemValue(item.values, col.key, col.filter);\r\n if (!Object.hasOwnProperty.call(dict, val)) {\r\n const v = item.values[col.key];\r\n dict[val] = {\r\n value: val,\r\n displayValue: typeof col.filter === 'function' ? col.filter(item.values) : v?.displayValue ?? v\r\n };\r\n }\r\n }\r\n array = Object.values(dict)\r\n .sort((a, b) => {\r\n a = a?.value ?? a;\r\n b = b?.value ?? b;\r\n return a > b ? 1 : a < b ? -1 : 0;\r\n });\r\n }\r\n array = array.map(i => {\r\n if (Object.prototype.hasOwnProperty.call(i, 'value') &&\r\n Object.prototype.hasOwnProperty.call(i, 'displayValue')) {\r\n return i;\r\n }\r\n return {\r\n value: i,\r\n displayValue: i == null ? '' : i\r\n };\r\n });\r\n this.#fillFilterList(col, itemlist, array, itemall);\r\n itemall.querySelector('input').checked = ![...itemlist.querySelectorAll('.filter-content input')].some(i => !i.checked);\r\n panel.appendChild(itemlist);\r\n if (searchbox != null) {\r\n searchbox.addEventListener('input', e => {\r\n const key = e.currentTarget.value.toLowerCase();\r\n const items = key.length === 0 ? array : array.filter(i => {\r\n const displayValue = i?.displayValue ?? i;\r\n return String(displayValue ?? '').indexOf(key) >= 0;\r\n });\r\n this.#fillFilterList(col, itemlist, items, itemall);\r\n });\r\n }\r\n // function\r\n const functions = createElement('div', 'filter-function');\r\n functions.append(\r\n createElement('button', ok => {\r\n ok.innerText = this.langs.ok;\r\n ok.addEventListener('click', () => {\r\n const array = this.#get(col.key, 'filterSource').filter(i => i.__checked !== false);\r\n if (typeof col.onFilterOk === 'function') {\r\n col.onFilterOk.call(this, col, array);\r\n } else {\r\n col.filterValues = array.map(a => a.value);\r\n }\r\n this.#colAttrs.__filtered = true;\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.add('active');\r\n this.#onCloseFilter();\r\n });\r\n }),\r\n createElement('button', reset => {\r\n reset.innerText = this.langs.reset;\r\n reset.addEventListener('click', () => {\r\n delete col.filterValues;\r\n this.#colAttrs.__filtered = this.columns.some(c => col.filterValues != null)\r\n this.#refreshSource();\r\n if (typeof col.onFiltered === 'function') {\r\n col.onFiltered.call(this, col);\r\n }\r\n filter.classList.remove('active');\r\n this.#onCloseFilter();\r\n });\r\n })\r\n );\r\n panel.appendChild(functions);\r\n\r\n this.#el.appendChild(panel);\r\n setTimeout(() => panel.classList.add('active'), 0);\r\n this.#colAttrs.__filtering = filter;\r\n filter.classList.add('hover');\r\n }\r\n\r\n #fillFilterList(col, list, array, all) {\r\n list.querySelector('.filter-holder')?.remove();\r\n list.querySelector('.filter-content')?.remove();\r\n const rowHeight = this.filterRowHeight;\r\n const height = array.length * rowHeight;\r\n this.#set(col.key, 'filterHeight', height);\r\n const holder = createElement('div', 'filter-holder');\r\n holder.style.height = `${height}px`;\r\n const content = createElement('div', 'filter-content');\r\n content.style.top = `${rowHeight}px`;\r\n this.#set(col.key, 'filterSource', array);\r\n for (let item of array) {\r\n item.__checked = !Array.isArray(col.filterValues) || col.filterValues.indexOf(item.value ?? item) >= 0;\r\n }\r\n if (array.length > 12) {\r\n array = array.slice(0, 12);\r\n }\r\n this.#doFillFilterList(content, array, all);\r\n list.append(holder, content);\r\n }\r\n\r\n #doFillFilterList(content, array, all) {\r\n for (let item of array) {\r\n const div = createElement('div', 'filter-item');\r\n div.appendChild(createCheckbox({\r\n checked: item.__checked,\r\n label: item?.displayValue ?? item,\r\n onchange: e => {\r\n item.__checked = e.target.checked;\r\n all.querySelector('input').checked = ![...content.querySelectorAll('input')].some(i => !i.checked);\r\n }\r\n }));\r\n content.appendChild(div);\r\n }\r\n }\r\n\r\n #onFilterScroll(col, list, top) {\r\n const rowHeight = this.filterRowHeight;\r\n top -= (top % (rowHeight * 2)) + rowHeight;\r\n if (top < 0) {\r\n top = 0;\r\n } else {\r\n let bottomTop = this.#get(col.key, 'filterHeight') - (12 * rowHeight);\r\n if (bottomTop < 0) {\r\n bottomTop = 0;\r\n }\r\n if (top > bottomTop) {\r\n top = bottomTop;\r\n }\r\n }\r\n if (this.#get(col.key, 'filterTop') !== top) {\r\n this.#set(col.key, 'filterTop', top);\r\n const startIndex = top / rowHeight;\r\n let array = this.#get(col.key, 'filterSource');\r\n if (startIndex + 12 < array.length) {\r\n array = array.slice(startIndex, startIndex + 12);\r\n } else {\r\n array = array.slice(-12);\r\n }\r\n const content = list.querySelector('.filter-content');\r\n content.replaceChildren();\r\n this.#doFillFilterList(content, array, list.querySelector('.filter-all>input'));\r\n content.style.top = `${top + rowHeight}px`;\r\n }\r\n }\r\n\r\n #onDragStart(e, col) {\r\n if (this.#notHeader(e.target.tagName)) {\r\n return;\r\n }\r\n const cx = getClientX(e);\r\n const index = indexOfParent(e.currentTarget);\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.dragging = true;\r\n const offsetLeft = this.#refs.header.querySelector('th:last-child').offsetLeft;\r\n const dragmove = e => {\r\n const cx2 = getClientX(e);\r\n const offset = cx2 - cx;\r\n let pos = attr.offset;\r\n let dragging;\r\n if (pos == null && (offset > MiniDragOffset || offset < -MiniDragOffset)) {\r\n dragging = true;\r\n } else if (pos !== offset) {\r\n dragging = true;\r\n }\r\n if (dragging) {\r\n this.#changingColumnOrder(index, offset, cx2, offsetLeft);\r\n attr.offset = offset;\r\n }\r\n };\r\n attr.mousemove = e => throttle(dragmove, RefreshInterval, this, e);\r\n attr.mouseup = () => {\r\n clearEvents(attr);\r\n if (attr.offset == null) {\r\n delete attr.dragging;\r\n } else {\r\n setTimeout(() => {\r\n delete attr.dragging;\r\n delete attr.offset;\r\n });\r\n this.#changeColumnOrder(index);\r\n }\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onResizeStart(e, col) {\r\n const cx = getClientX(e);\r\n const width = col.width;\r\n const index = indexOfParent(e.currentTarget.parentElement);\r\n const window = this.window ?? global;\r\n const clearEvents = attr => {\r\n for (let event of ['mousemove', 'mouseup']) {\r\n if (attr.hasOwnProperty(event)) {\r\n window.removeEventListener(event, attr[event]);\r\n delete attr[event];\r\n }\r\n }\r\n };\r\n let attr = this.#colAttrs[col.key];\r\n if (attr == null) {\r\n attr = this.#colAttrs[col.key] = {};\r\n } else {\r\n clearEvents(attr);\r\n }\r\n attr.resizing = width;\r\n const resizemove = e => {\r\n const cx2 = getClientX(e);\r\n const val = width + (cx2 - cx);\r\n if (val < MiniColumnWidth) {\r\n return;\r\n }\r\n attr.resizing = val;\r\n attr.sizing = true;\r\n this.#changeColumnWidth(index, val);\r\n };\r\n attr.mousemove = e => throttle(resizemove, RefreshInterval, this, e);\r\n attr.mouseup = e => {\r\n clearEvents(attr);\r\n const width = attr.resizing;\r\n if (width != null) {\r\n setTimeout(() => delete attr.resizing);\r\n if (attr.sizing) {\r\n delete attr.sizing;\r\n delete attr.autoResize;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n e.stopPropagation();\r\n e.preventDefault();\r\n };\r\n ['mousemove', 'mouseup'].forEach(event => window.addEventListener(event, attr[event]));\r\n }\r\n\r\n #onAutoResize(e, col) {\r\n const th = e.currentTarget.parentElement;\r\n const index = indexOfParent(th);\r\n let width = th.querySelector('div:first-child').scrollWidth;\r\n for (let row of this.#refs.bodyContent.children) {\r\n const element = row.children[index].children[0];\r\n const w = element.scrollWidth;\r\n if (w > width) {\r\n width = w;\r\n }\r\n }\r\n if (width < MiniColumnWidth) {\r\n width = MiniColumnWidth;\r\n }\r\n if (width > 0 && width !== col.width) {\r\n width += 12;\r\n this.#changeColumnWidth(index, width);\r\n if (typeof this.columnChanged === 'function') {\r\n this.columnChanged(ColumnChangedType.Resize, index, width);\r\n }\r\n }\r\n }\r\n\r\n #onColumnAllChecked(col, flag) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const key = col.key;\r\n const isFunction = typeof col.enabled === 'function';\r\n const isString = typeof col.enabled === 'string';\r\n if (typeof col.onallchecked === 'function') {\r\n col.onallchecked.call(this, col, flag);\r\n } else {\r\n for (let row of this.#currentSource) {\r\n const item = row.values;\r\n if (item == null) {\r\n continue;\r\n }\r\n const enabled = isFunction ? col.enabled(item) : isString ? item[col.enabled] : col.enabled;\r\n if (enabled !== false) {\r\n item[key] = flag;\r\n row.__changed = true;\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, flag);\r\n }\r\n }\r\n }\r\n this.refresh();\r\n }\r\n }\r\n\r\n #onScroll(e) {\r\n const left = e.target.scrollLeft;\r\n if (this.#scrollLeft !== left) {\r\n this.#scrollLeft = left;\r\n this.#refs.header.style.left = `${-left}px`;\r\n }\r\n if (!this.virtual) {\r\n return;\r\n }\r\n const top = e.target.scrollTop;\r\n this.#scrollToTop(top);\r\n }\r\n\r\n #onBodyMouseMove(e, holder) {\r\n if (e.target.classList.contains('ui-grid-hover-holder')) {\r\n return;\r\n }\r\n let [parent, target] = this.#getRowTarget(e.target);\r\n if (parent == null) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n if (holder.classList.contains('active')) {\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const element = target.children[0];\r\n if (element?.tagName !== 'SPAN') {\r\n if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n return;\r\n }\r\n const row = target.dataset.row;\r\n const col = target.dataset.col;\r\n if (holder.dataset.row === row &&\r\n holder.dataset.col === col) {\r\n return;\r\n }\r\n if (element.scrollWidth > element.offsetWidth) {\r\n holder.dataset.row = row;\r\n holder.dataset.col = col;\r\n holder.innerText = element.innerText;\r\n const top = this.#refs.bodyContent.offsetTop + target.offsetTop;\r\n let left = target.offsetLeft;\r\n let width = holder.offsetWidth;\r\n if (width > this.#bodyClientWidth) {\r\n width = this.#bodyClientWidth;\r\n }\r\n const maxleft = this.#bodyClientWidth + this.#scrollLeft - width;\r\n if (left > maxleft) {\r\n left = maxleft;\r\n }\r\n const height = target.offsetHeight;\r\n holder.style.cssText = `top: ${top}px; left: ${left}px; max-width: ${this.#bodyClientWidth}px; height: ${height - 2}px`;\r\n holder.classList.add('active');\r\n } else if (holder.classList.contains('active')) {\r\n delete holder.dataset.row;\r\n delete holder.dataset.col;\r\n holder.classList.remove('active');\r\n }\r\n }\r\n\r\n #onRowClicked(e, index, colIndex) {\r\n const startIndex = this.#startIndex;\r\n const selectedIndex = startIndex + index;\r\n if (typeof this.willSelect === 'function' && !this.willSelect(selectedIndex, colIndex)) {\r\n return;\r\n }\r\n // multi-select\r\n let flag = false;\r\n const selectedIndexes = this.#selectedIndexes;\r\n if (this.multiSelect) {\r\n if (e.ctrlKey) {\r\n const i = selectedIndexes.indexOf(selectedIndex);\r\n if (i < 0) {\r\n selectedIndexes.push(selectedIndex);\r\n } else {\r\n selectedIndexes.splice(i, 1);\r\n }\r\n flag = true;\r\n } else if (e.shiftKey && selectedIndexes.length > 0) {\r\n if (selectedIndexes.length > 1 || selectedIndexes[0] !== selectedIndex) {\r\n let start = selectedIndexes[selectedIndexes.length - 1];\r\n let end;\r\n if (start > selectedIndex) {\r\n end = start;\r\n start = selectedIndex;\r\n } else {\r\n end = selectedIndex;\r\n }\r\n selectedIndexes.splice(0);\r\n for (let i = start; i <= end; i += 1) {\r\n selectedIndexes.push(i);\r\n }\r\n flag = true;\r\n }\r\n }\r\n }\r\n if (!flag && selectedIndexes.length !== 1 || selectedIndexes[0] !== selectedIndex) {\r\n selectedIndexes.splice(0, selectedIndexes.length, selectedIndex);\r\n flag = true;\r\n }\r\n // apply style\r\n if (flag) {\r\n if (this.readonly !== true) {\r\n this.refresh();\r\n } else {\r\n [...this.#refs.bodyContent.children].forEach((row, i) => {\r\n if (selectedIndexes.indexOf(startIndex + i) >= 0) {\r\n row.classList.add('selected');\r\n } else if (row.classList.contains('selected')) {\r\n row.classList.remove('selected');\r\n }\r\n });\r\n }\r\n if (typeof this.selectedRowChanged === 'function') {\r\n this.selectedRowChanged(selectedIndex);\r\n }\r\n }\r\n this.#selectedColumnIndex = colIndex;\r\n if ((this.fullrowClick || colIndex >= 0) && e.buttons === 1 && typeof this.cellClicked === 'function') {\r\n if (this.cellClicked(selectedIndex, colIndex) === false) {\r\n e.stopPropagation();\r\n e.preventDefault();\r\n }\r\n }\r\n }\r\n\r\n #onRowDblClicked(e) {\r\n if (e.target.tagName === 'INPUT' || e.target.tagName === 'TEXTAREA' || e.target.tagName === 'LAYER' && e.target.className === 'ui-check-inner' || e.target.tagName === 'LABEL' && (e.target.className === 'ui-drop-text' || e.target.className === 'ui-drop-caret')) {\r\n return;\r\n }\r\n const index = this.selectedIndex;\r\n if (typeof this.rowDblClicked === 'function') {\r\n this.rowDblClicked(index);\r\n }\r\n if (typeof this.cellDblClicked === 'function') {\r\n const colIndex = this.#selectedColumnIndex;\r\n if (this.fullrowClick || colIndex >= 0) {\r\n this.cellDblClicked(index, colIndex);\r\n }\r\n }\r\n }\r\n\r\n #onRowChanged(_e, index, col, value, blur) {\r\n if (this.#currentSource == null) {\r\n return;\r\n }\r\n const row = this.#currentSource[this.#startIndex + index];\r\n const item = row.values;\r\n if (item == null) {\r\n return;\r\n }\r\n let enabled = col.enabled;\r\n if (typeof enabled === 'function') {\r\n enabled = enabled.call(col, item);\r\n } else if (typeof enabled === 'string') {\r\n enabled = item[enabled];\r\n }\r\n if (enabled !== false) {\r\n item[col.key] = value;\r\n row.__changed = true;\r\n if (blur) {\r\n if (typeof col.oneditend === 'function') {\r\n col.oneditend.call(this, item, value);\r\n }\r\n } else {\r\n if (typeof col.onchanged === 'function') {\r\n col.onchanged.call(this, item, value);\r\n }\r\n }\r\n }\r\n }\r\n}\r\n\r\nexport default Grid;","import \"./css/popup.scss\";\r\nimport { r } from \"../utility/lgres\";\r\nimport { nullOrEmpty } from \"../utility/strings\";\r\nimport { global } from \"../utility\";\r\nimport { createElement } from \"../functions\";\r\nimport { createIcon, changeIcon } from \"./icon\";\r\n\r\nconst ResizeMods = {\r\n right: 1,\r\n bottom: 2,\r\n left: 4,\r\n top: 8,\r\n bottomRight: 2 | 1,\r\n bottomLeft: 2 | 4,\r\n topRight: 8 | 1,\r\n topLeft: 8 | 4\r\n}\r\n\r\n// const Cursors = {\r\n// [ResizeMods.right]: 'ew-resize',\r\n// [ResizeMods.bottom]: 'ns-resize',\r\n// [ResizeMods.bottomRight]: 'nwse-resize',\r\n// [ResizeMods.left]: 'ew-resize',\r\n// [ResizeMods.bottomLeft]: 'nesw-resize',\r\n// [ResizeMods.top]: 'ns-resize',\r\n// [ResizeMods.topRight]: 'nesw-resize',\r\n// [ResizeMods.topLeft]: 'nwse-resize'\r\n// }\r\n\r\nfunction trimPx(px) {\r\n if (typeof px !== 'string') {\r\n return px;\r\n }\r\n if (px.endsWith('px')) {\r\n const size = Number(px.substring(0, px.length - 2));\r\n return isNaN(size) ? px : size;\r\n }\r\n return px;\r\n}\r\n\r\nclass Popup {\r\n #mask;\r\n #option;\r\n #bounds;\r\n // #cursor;\r\n\r\n constructor(opts = {}) {\r\n this.#option = opts;\r\n }\r\n\r\n get container() { return this.#mask.querySelector('.ui-popup-container') }\r\n\r\n get rect() {\r\n const container = this.container;\r\n if (container == null) {\r\n return null;\r\n }\r\n const style = global.getComputedStyle(container);\r\n const collapsed = container.classList.contains('ui-popup-collapse');\r\n const bounds = this.#bounds;\r\n return {\r\n collapsed,\r\n left: trimPx(style.left),\r\n top: trimPx(style.top),\r\n width: collapsed === true && bounds != null ? bounds.width : trimPx(style.width),\r\n height: collapsed === true && bounds != null ? bounds.height : trimPx(style.height)\r\n };\r\n }\r\n set rect(r) {\r\n const container = this.container;\r\n if (container == null) {\r\n return;\r\n }\r\n const css = [];\r\n if (!isNaN(r.left)) {\r\n css.push(`left: ${r.left}px`);\r\n }\r\n if (!isNaN(r.top)) {\r\n css.push(`top: ${r.top}px`);\r\n }\r\n const collapse = container.querySelector('.ui-popup-header>.icon-expand');\r\n if (r.collapsed === true) {\r\n css.push('width: 160px', 'height: 40px');\r\n this.#bounds = r;\r\n container.classList.add('ui-popup-collapse');\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n } else {\r\n if (!isNaN(r.width) && r.width > 0) {\r\n css.push(`width: ${r.width}px`);\r\n }\r\n if (!isNaN(r.height) && r.height > 0) {\r\n css.push(`height: ${r.height}px`);\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n this.#bounds = null;\r\n if (collapse != null) {\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n }\r\n }\r\n if (css.length > 0) {\r\n container.style.cssText += css.join('; ');\r\n }\r\n }\r\n\r\n create() {\r\n const mask = createElement('div', 'ui-popup-mask');\r\n if (this.#option.mask === false) {\r\n mask.classList.add('ui-popup-transparent');\r\n }\r\n const container = createElement('div', 'ui-popup-container');\r\n let tabIndex = Math.max.apply(null, [...document.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n if (tabIndex < 0) {\r\n tabIndex = 0;\r\n }\r\n container.tabIndex = tabIndex + 1;\r\n const close = () => {\r\n mask.classList.add('ui-popup-active');\r\n mask.style.opacity = 0;\r\n setTimeout(() => mask.remove(), 120);\r\n };\r\n let content = this.#option.content;\r\n if (!(content instanceof HTMLElement)) {\r\n content = createElement('div', d => d.innerText = content);\r\n }\r\n container.append(\r\n createElement('div', header => {\r\n header.className = 'ui-popup-header';\r\n let title = this.#option.title;\r\n if (!(title instanceof HTMLElement)) {\r\n title = createElement('div', t => {\r\n t.className = 'ui-popup-header-title';\r\n t.innerText = title;\r\n });\r\n }\r\n header.appendChild(title);\r\n if (this.#option.movable !== false) {\r\n const move = title.querySelector('.ui-popup-move') ?? title;\r\n move.addEventListener('mousedown', e => {\r\n const x = e.clientX - container.offsetLeft;\r\n const y = e.clientY - container.offsetTop;\r\n let moved;\r\n const move = e => {\r\n container.style.left = `${e.clientX - x}px`;\r\n container.style.top = `${e.clientY - y}px`;\r\n moved = true;\r\n };\r\n mask.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n mask.removeEventListener('mousemove', move, { passive: false });\r\n mask.removeEventListener('mouseup', up);\r\n if (moved === true && typeof this.#option.onMoveEnded === 'function') {\r\n this.#option.onMoveEnded.call(this);\r\n }\r\n moved = false;\r\n };\r\n mask.addEventListener('mouseup', up);\r\n });\r\n }\r\n if (this.#option.collapsable === true) {\r\n const collapse = createIcon('fa-regular', 'compress-alt');\r\n collapse.tabIndex = tabIndex + 2;\r\n collapse.classList.add('icon-expand');\r\n collapse.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n collapse.dispatchEvent(new MouseEvent('click'));\r\n }\r\n });\r\n collapse.addEventListener('click', () => {\r\n if (container.classList.contains('ui-popup-collapse')) {\r\n const bounds = this.#bounds;\r\n if (bounds != null) {\r\n container.style.cssText += `width: ${bounds.width}px; height: ${bounds.height}px`;\r\n this.#bounds = null;\r\n }\r\n container.classList.remove('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'compress-alt');\r\n } else {\r\n const rect = this.rect;\r\n this.#bounds = rect;\r\n container.style.cssText += `width: 160px; height: 40px`;\r\n container.classList.add('ui-popup-collapse');\r\n changeIcon(collapse, 'fa-regular', 'expand-alt');\r\n }\r\n });\r\n header.appendChild(collapse);\r\n }\r\n const cancel = createIcon('fa-regular', 'times');\r\n cancel.tabIndex = tabIndex + 3;\r\n cancel.addEventListener('keypress', e => {\r\n if (e.key === ' ' || e.key === 'Enter') {\r\n close();\r\n }\r\n });\r\n cancel.addEventListener('click', () => close());\r\n header.appendChild(cancel);\r\n }),\r\n createElement('div', 'ui-popup-body', content, createElement('div', 'ui-popup-loading',\r\n createElement('div', null, createIcon('fa-regular', 'spinner-third'))\r\n ))\r\n );\r\n if (Array.isArray(this.#option.buttons)) {\r\n tabIndex = Math.max.apply(null, [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0));\r\n container.appendChild(\r\n createElement('div', 'ui-popup-footer', ...this.#option.buttons.map((b, i) => {\r\n const button = createElement('button', 'ui-popup-button');\r\n if (b.tabIndex > 0) {\r\n button.tabIndex = b.tabIndex;\r\n } else {\r\n button.tabIndex = tabIndex + i + 1;\r\n }\r\n button.innerText = b.text;\r\n button.addEventListener('click', () => {\r\n if (typeof b.trigger === 'function') {\r\n const result = b.trigger(this);\r\n if (typeof result?.then === 'function') {\r\n result.then(r => {\r\n if (r !== false) {\r\n close();\r\n }\r\n }).catch(() => { });\r\n } else if (result !== false) {\r\n close();\r\n }\r\n } else {\r\n close();\r\n }\r\n });\r\n return button;\r\n }))\r\n );\r\n const tabs = [...container.querySelectorAll('[tabindex]')].map(e => e.tabIndex ?? 0);\r\n const tabMin = Math.min.apply(null, tabs);\r\n const tabMax = Math.max.apply(null, tabs);\r\n const last = container.querySelector(`[tabindex=\"${tabMax}\"]`);\r\n if (last != null) {\r\n last.addEventListener('keydown', e => {\r\n if (e.key === 'Tab') {\r\n const first = container.querySelector(`[tabindex=\"${tabMin}\"]`);\r\n first?.focus();\r\n e.preventDefault();\r\n }\r\n });\r\n }\r\n }\r\n // resizable\r\n if (this.#option.resizable === true) {\r\n container.append(\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.right, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottom, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.left, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.top, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomRight, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-bottom-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.bottomLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-left';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topLeft, e));\r\n }),\r\n createElement('layer', layer => {\r\n layer.className = 'ui-popup-border ui-popup-border-top-right';\r\n layer.addEventListener('mousedown', e => this.#resize(ResizeMods.topRight, e));\r\n })\r\n )\r\n }\r\n mask.appendChild(container);\r\n this.#mask = mask;\r\n return mask;\r\n }\r\n\r\n show(parent = document.body) {\r\n if (parent == null) {\r\n return;\r\n }\r\n let mask = this.#mask ?? this.create();\r\n parent.appendChild(mask);\r\n if (this.#option.mask === false) {\r\n // calculator position\r\n const container = this.container;\r\n container.style.left = String((parent.offsetWidth - container.offsetWidth) / 2) + 'px';\r\n container.style.top = String((parent.offsetHeight - container.offsetHeight) / 2) + 'px';\r\n }\r\n return new Promise(resolve => {\r\n setTimeout(() => {\r\n mask.style.opacity = 1;\r\n this.container.focus();\r\n resolve(mask);\r\n }, 0);\r\n });\r\n }\r\n\r\n get loading() { return this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading')?.style?.visibility === 'visible' }\r\n set loading(flag) {\r\n let loading = this.#mask?.querySelector('.ui-popup-body>.ui-popup-loading');\r\n if (loading == null) {\r\n return;\r\n }\r\n if (flag === false) {\r\n loading.style.visibility = 'hidden';\r\n loading.style.opacity = 0;\r\n } else {\r\n loading.style.visibility = 'visible';\r\n loading.style.opacity = 1;\r\n }\r\n }\r\n\r\n #resize(mod, e) {\r\n const container = this.container;\r\n const option = this.#option;\r\n if (typeof option.onResizeStarted === 'function') {\r\n option.onResizeStarted.call(this);\r\n }\r\n const mask = this.#mask;\r\n // this.#cursor = mask.style.cursor;\r\n // mask.style.cursor = Cursors[mod];\r\n const originalX = e.clientX;\r\n const originalY = e.clientY;\r\n const original = {\r\n width: container.offsetWidth,\r\n height: container.offsetHeight,\r\n left: container.offsetLeft,\r\n top: container.offsetTop\r\n };\r\n const minWidth = option.minWidth ?? 200;\r\n const minHeight = option.minHeight ?? 200;\r\n let resized;\r\n const move = e => {\r\n const offsetX = e.clientX - originalX;\r\n const offsetY = e.clientY - originalY;\r\n let width = original.width;\r\n let height = original.height;\r\n let x = original.left;\r\n let y = original.top;\r\n if ((mod & ResizeMods.right) === ResizeMods.right) {\r\n width += offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n }\r\n }\r\n if ((mod & ResizeMods.bottom) === ResizeMods.bottom) {\r\n height += offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n }\r\n }\r\n if ((mod & ResizeMods.left) === ResizeMods.left) {\r\n width -= offsetX;\r\n if (width < minWidth) {\r\n width = minWidth;\r\n x = originalX + original.width - minWidth;\r\n } else {\r\n x += offsetX;\r\n }\r\n }\r\n if ((mod & ResizeMods.top) === ResizeMods.top) {\r\n height -= offsetY;\r\n if (height < minHeight) {\r\n height = minHeight;\r\n y = originalY + original.height - minHeight;\r\n } else {\r\n y += offsetY;\r\n }\r\n }\r\n if (typeof option.onResizing === 'function') {\r\n option.onResizing.call(this, x, y, width, height);\r\n } else {\r\n container.style.cssText += `left: ${x}px; top: ${y}px; width: ${width}px; height: ${height}px`;\r\n }\r\n resized = true;\r\n }\r\n const parent = option.mask === false ? mask.parentElement : mask;\r\n parent.addEventListener('mousemove', move, { passive: false });\r\n const up = () => {\r\n parent.removeEventListener('mousemove', move, { passive: false });\r\n parent.removeEventListener('mouseup', up);\r\n // mask.style.cursor = this.#cursor;\r\n if (resized === true && typeof option.onResizeEnded === 'function') {\r\n option.onResizeEnded.call(this);\r\n }\r\n resized = false;\r\n };\r\n parent.addEventListener('mouseup', up);\r\n }\r\n}\r\n\r\nexport default Popup;\r\n\r\nexport function createPopup(title, content, ...buttons) {\r\n const popup = new Popup({\r\n title,\r\n content,\r\n buttons\r\n });\r\n return popup;\r\n}\r\n\r\nconst iconTypes = {\r\n 'info': 'info-circle',\r\n 'information': 'info-circle',\r\n 'warn': 'exclamation-triangle',\r\n 'warning': 'exclamation-triangle',\r\n 'question': 'question-circle',\r\n 'error': 'times-circle'\r\n}\r\n\r\nexport function showAlert(title, message, iconType = 'info', parent = document.body) {\r\n return new Promise(resolve => {\r\n const popup = new Popup({\r\n title,\r\n content: createElement('div', 'message-wrapper',\r\n createIcon('fa-solid', iconTypes[iconType] ?? 'info-circle'),\r\n createElement('span', span => span.innerText = message)\r\n ),\r\n buttons: [\r\n { text: r('ok', 'OK'), trigger: resolve }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}\r\n\r\nexport function showConfirm(title, content, buttons, iconType = 'question', parent = document.body) {\r\n return new Promise(resolve => {\r\n const wrapper = createElement('div', 'message-wrapper');\r\n if (!nullOrEmpty(iconType)) {\r\n wrapper.appendChild(createIcon('fa-solid', iconTypes[iconType] ?? 'question-circle'));\r\n }\r\n wrapper.appendChild(content instanceof HTMLElement ?\r\n content :\r\n createElement('span', span => span.innerText = content));\r\n const popup = new Popup({\r\n title,\r\n content: wrapper,\r\n buttons: buttons?.map(b => {\r\n return {\r\n text: b.text,\r\n trigger: p => {\r\n let result;\r\n if (typeof b.trigger === 'function') {\r\n result = b.trigger(p, b);\r\n if (typeof result?.then === 'function') {\r\n return result.then(r => {\r\n r !== false && resolve(r);\r\n return r;\r\n });\r\n }\r\n result !== false && resolve(result);\r\n } else {\r\n result = {\r\n key: b.key,\r\n popup: p\r\n };\r\n resolve(result);\r\n }\r\n return result;\r\n }\r\n };\r\n }) ??\r\n [\r\n { text: r('yes', 'Yes'), trigger: p => resolve({ key: 'yes', popup: p }) },\r\n { text: r('no', 'No'), trigger: p => resolve({ key: 'no', popup: p }) }\r\n ]\r\n });\r\n popup.show(parent).then(mask => {\r\n const button = mask.querySelector('.ui-popup-container .ui-popup-footer .ui-popup-button:last-child');\r\n button?.focus();\r\n });\r\n });\r\n}"],"names":["createElement","tagName","init","children","element","svgns","createUse","type","id","c","path","ver","use","changeIcon","svg","createIcon","style","css","resolveIcon","container","svgs","icon","fillCheckbox","label","tabindex","charactor","layer","e","input","span","createRadiobox","opts","entry","createCheckbox","resolveCheckbox","legacy","checks","chk","text","boxes","box","setTooltip","content","flag","parent","isParent","tipid","tip","wrapper","cnt","tipId","tid","p","left","top","offsetParent","resolveTooltip","tips","title","nullOrEmpty","s","contains","key","ignoreCase","r","defaultValue","g","isPositive","n","isMobile","throttle","method","delay","context","args","current","truncate","v","SymbolDropdown","DropdownTitleHeight","DropdownItemHeight","dropdownGlobal","global","panel","dropId","dropdown","selectItems","itemlist","htmlkey","textkey","htmls","it","filterSource","searchkeys","source","k","_Dropdown","options","__privateAdd","_expanded","_dropdown","_filllist","_triggerselect","_options","_wrapper","_container","_label","_allChecked","_source","_lastSelected","_selected","_selectedList","__publicField","__privateSet","__privateGet","header","up","down","count","valuekey","index","target","_a","__privateMethod","dropdown_fn","active","expanded_get","filllist_fn","list","selected","silence","item","expanded","li","html","val","selectedlist","dom","selects","sel","drop","Dropdown","_b","search","value","multiselect","allchecked","triggerselect_fn","scrolled","i","checkbox","GridColumn","GridInputColumn","trigger","col","_parent","vals","enabled","GridTextColumn","_item","_col","grid","lines","_GridDropdownColumn","_getSource","getSource_fn","_setValue","setValue_fn","_getDrop","getDrop_fn","GridDropdownColumn","dropGlobal","data","__superGet","GridCheckboxColumn","GridIconColumn","className","tooltip","ColumnChangedType","RefreshInterval","HoverInternal","RedumCount","MiniDragOffset","MiniColumnWidth","FilterPanelWidth","getClientX","getOffsetLeftFromWindow","indexOfParent","ColumnTypes","_Grid","_refreshSource","_createHeader","_createBody","_fillRows","_changeColumnWidth","_changingColumnOrder","_changeColumnOrder","_scrollToTop","_get","_set","_getItemValue","_getRowTarget","_notHeader","_onHeaderClicked","_onCloseFilter","_onFilter","_fillFilterList","_doFillFilterList","_onFilterScroll","_onDragStart","_onResizeStart","_onAutoResize","_onColumnAllChecked","_onScroll","_onBodyMouseMove","_onRowClicked","_onRowDblClicked","_onRowChanged","_currentSource","_el","_refs","_rendering","_selectedColumnIndex","_selectedIndexes","_startIndex","_needResize","_containerHeight","_bodyClientWidth","_rowCount","_scrollTop","_scrollLeft","_colTypes","_colAttrs","_vtable","refreshSource_fn","indexes","startIndex","row","onKeydown","sizer","createHeader_fn","body","createBody_fn","loading","scrollToTop_fn","force","height","length","widths","fillRows_fn","get_fn","width","changeColumnWidth_fn","reload","direction","th","arrow","comparer","a","b","getItemValue_fn","Grid","thead","hidden","onHeaderClicked_fn","isCheckbox","set_fn","w","onDragStart_fn","check","onColumnAllChecked_fn","caption","filter","onFilter_fn","spliter","onResizeStart_fn","onAutoResize_fn","dragger","draggerCursor","onScroll_fn","cols","bodyContainer","bodyContent","getRowTarget_fn","rowIndex","colIndex","onRowClicked_fn","onRowDblClicked_fn","holder","onBodyMouseMove_fn","vtable","vnew","vdom","j","cell","onRowChanged_fn","selectedIndexes","selectChanged","bgColor","ev","attrs","attr","changingColumnOrder_fn","offset","x","offsetLeft","idx","changeColumnOrder_fn","orderIndex","targetIndex","rows","columns","rowHeight","bottomTop","name","notHeader_fn","onCloseFilter_fn","panels","el","filtering","close","searchbox","searchholder","searchicon","onFilterScroll_fn","itemall","checked","array","dict","fillFilterList_fn","items","displayValue","functions","ok","reset","all","doFillFilterList_fn","div","cx","clearEvents","event","dragmove","cx2","pos","dragging","window","resizemove","isFunction","isString","maxleft","selectedIndex","start","end","_e","blur","ResizeMods","trimPx","px","size","Popup","_resize","_mask","_option","_bounds","collapsed","bounds","collapse","mask","tabIndex","d","t","y","moved","move","rect","cancel","button","result","tabs","tabMin","tabMax","last","first","resize_fn","resolve","_c","mod","option","originalX","originalY","original","minWidth","minHeight","resized","offsetX","offsetY","createPopup","buttons","iconTypes","showAlert","message","iconType","showConfirm"],"mappings":"+oCAAO,SAASA,EAAcC,EAASC,KAASC,EAAU,CACtD,MAAMC,EAAU,SAAS,cAAcH,CAAO,EAC9C,OAAI,OAAOC,GAAS,WAChBA,EAAKE,CAAO,EACLF,GAAQ,OACfE,EAAQ,UAAYF,GAEpBC,EAAS,OAAS,GAClBC,EAAQ,OAAO,GAAGD,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,C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