forked from lekoala/data-grid
-
Notifications
You must be signed in to change notification settings - Fork 0
/
data-grid.min.js.map
7 lines (7 loc) · 139 KB
/
data-grid.min.js.map
1
2
3
4
5
6
7
{
"version": 3,
"sources": ["src/utils/camelize.js", "src/utils/normalizeData.js", "src/utils/shortcuts.js", "src/core/base-element.js", "src/utils/addSelectOption.js", "src/utils/appendParamsToUrl.js", "src/utils/convertArray.js", "src/utils/elementOffset.js", "src/utils/getTextWidth.js", "src/utils/interpolate.js", "src/utils/randstr.js", "src/data-grid.js", "src/core/base-plugin.js", "src/plugins/column-resizer.js", "src/utils/getParentElement.js", "src/plugins/context-menu.js", "src/plugins/draggable-headers.js", "src/plugins/touch-support.js", "src/plugins/selectable-rows.js", "src/plugins/fixed-height.js", "src/plugins/autosize-column.js", "src/utils/debounce.js", "src/plugins/responsive-grid.js", "data-grid.js"],
"sourcesContent": ["/**\r\n * @param {String} str\r\n * @returns {String}\r\n */\r\nexport default function camelize(str) {\r\n return str.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g, (m, chr) => chr.toUpperCase());\r\n}\r\n", "/**\r\n * Parse data attribute and return properly typed data\r\n * @param {String} v\r\n * @returns {any}\r\n */\r\nexport default function normalizeData(v) {\r\n // Bool\r\n if (v === \"true\") {\r\n return true;\r\n }\r\n if (v === \"false\") {\r\n return false;\r\n }\r\n // Null or empty\r\n if (v === \"\" || v === \"null\") {\r\n return null;\r\n }\r\n // Numeric attributes\r\n if (v === Number(v).toString()) {\r\n return Number(v);\r\n }\r\n // Only attempt json parsing for array or objects\r\n if (v && (v.indexOf(\"[\") === 0 || v.indexOf(\"{\") === 0)) {\r\n try {\r\n // In case we have only single quoted vues\r\n if (v.indexOf('\"') === -1) {\r\n v = v.replace(/'/g, '\"');\r\n }\r\n return JSON.parse(decodeURIComponent(v));\r\n } catch {\r\n console.log(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @callback FlexibleListener\r\n * @param {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} event\r\n */\r\n\r\nconst supportedPassiveTypes = [\r\n \"scroll\",\r\n \"wheel\",\r\n \"touchstart\",\r\n \"touchmove\",\r\n \"touchenter\",\r\n \"touchend\",\r\n \"touchleave\",\r\n \"mouseout\",\r\n \"mouseleave\",\r\n \"mouseup\",\r\n \"mousedown\",\r\n \"mousemove\",\r\n \"mouseenter\",\r\n \"mousewheel\",\r\n \"mouseover\",\r\n];\r\n\r\n/**\r\n *\r\n * @param {string} type\r\n * @returns {AddEventListenerOptions}\r\n */\r\nfunction passiveOpts(type) {\r\n if (supportedPassiveTypes.includes(type)) {\r\n return { passive: true };\r\n }\r\n return {};\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} name\r\n * @returns {any}\r\n */\r\nexport function getAttribute(el, name) {\r\n return el.getAttribute(name);\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} name\r\n * @returns {Boolean}\r\n */\r\nexport function hasAttribute(el, name) {\r\n return el.hasAttribute(name);\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} name\r\n * @param {any} v\r\n * @param {Boolean} check Prevent setting if attribute is already there\r\n */\r\nexport function setAttribute(el, name, v, check = false) {\r\n if (check && hasAttribute(el, name)) return;\r\n el.setAttribute(name, \"\" + v);\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} name\r\n */\r\nexport function removeAttribute(el, name) {\r\n if (hasAttribute(el, name)) {\r\n el.removeAttribute(name);\r\n }\r\n}\r\n\r\n/**\r\n * @param {EventTarget} el\r\n * @param {String} type\r\n * @param {FlexibleListener} listener\r\n */\r\nexport function on(el, type, listener) {\r\n el.addEventListener(type, listener, passiveOpts(type));\r\n}\r\n\r\n/**\r\n * @param {EventTarget} el\r\n * @param {String} type\r\n * @param {EventListenerOrEventListenerObject&FlexibleListener} listener\r\n */\r\nexport function off(el, type, listener) {\r\n el.removeEventListener(type, listener, passiveOpts(type));\r\n}\r\n\r\n/**\r\n * @param {EventTarget} el\r\n * @param {String} type\r\n * @param {EventListenerOrEventListenerObject&FlexibleListener} listener\r\n */\r\nexport function one(el, type, listener) {\r\n el.addEventListener(type, listener, {\r\n once: true,\r\n });\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} el\r\n * @param {String} name\r\n * @param {any} data\r\n * @param {Boolean} bubbles\r\n */\r\nexport function dispatch(el, name, data = {}, bubbles = false) {\r\n let opts = {};\r\n if (bubbles) {\r\n opts.bubbles = true;\r\n }\r\n if (data) {\r\n opts.detail = data;\r\n }\r\n el.dispatchEvent(new CustomEvent(name, opts));\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} name\r\n * @returns {Boolean}\r\n */\r\nexport function hasClass(el, name) {\r\n return el.classList.contains(name);\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} name\r\n */\r\nexport function addClass(el, name) {\r\n el.classList.add(name);\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} name\r\n */\r\nexport function removeClass(el, name) {\r\n el.classList.remove(name);\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} name\r\n */\r\nexport function toggleClass(el, name) {\r\n el.classList.toggle(name);\r\n}\r\n\r\n/**\r\n * @param {String|HTMLElement} selector\r\n * @param {HTMLElement|Document} base\r\n * @returns {HTMLElement|null}\r\n */\r\nexport function $(selector, base = document) {\r\n if (selector instanceof HTMLElement) {\r\n return selector;\r\n }\r\n return base.querySelector(selector);\r\n}\r\n\r\n/**\r\n * @param {String} selector\r\n * @param {Element|Document} base\r\n * @returns {Array<HTMLElement>}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {any}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array<HTMLElement>}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {any} el\r\n * @returns {HTMLElement}\r\n */\r\nexport function asElement(el) {\r\n return el instanceof HTMLElement ? el : new HTMLElement();\r\n}\r\n\r\n/**\r\n * @param {any} el\r\n * @returns {any}\r\n */\r\nexport function asAnyElement(el) {\r\n return el instanceof HTMLElement ? el : new HTMLElement();\r\n}\r\n", "import camelize from \"../utils/camelize.js\";\r\nimport normalizeData from \"../utils/normalizeData.js\";\r\nimport { dispatch, getAttribute, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Base element that does not contain any specific logic\r\n * related to this project but makes HTMLElemnt usable\r\n */\r\nclass BaseElement extends HTMLElement {\r\n /**\r\n * @param {Object} options\r\n */\r\n constructor(options = {}) {\r\n super();\r\n this.options = Object.assign(this.defaultOptions, this.normalizedDataset, options);\r\n\r\n this.log(\"constructor\");\r\n\r\n this.fireEvents = true;\r\n this._ready();\r\n\r\n this.log(\"ready\");\r\n }\r\n\r\n get defaultOptions() {\r\n return {};\r\n }\r\n\r\n /**\r\n * @param {String} opt\r\n * @returns {any}\r\n */\r\n getOption(opt) {\r\n return this.options[opt];\r\n }\r\n\r\n /**\r\n * @param {String} opt\r\n * @param {any} v\r\n */\r\n setOption(opt, v) {\r\n setAttribute(this, `data-${opt}`, v);\r\n }\r\n\r\n /**\r\n * @param {String} opt\r\n */\r\n toggleOption(opt) {\r\n setAttribute(this, `data-${opt}`, !this.getOption(opt));\r\n }\r\n\r\n get normalizedDataset() {\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n data[key] = normalizeData(data[key]);\r\n }\r\n return data;\r\n }\r\n\r\n /**\r\n * @returns {String}\r\n */\r\n static template() {\r\n return \"\";\r\n }\r\n\r\n /**\r\n * This is called at the end of constructor. Extend in subclass if needed.\r\n */\r\n _ready() {}\r\n\r\n /**\r\n * @param {String|Error} message\r\n */\r\n log(message) {\r\n if (this.options.debug) {\r\n console.log(\"[\" + getAttribute(this, \"id\") + \"] \" + message);\r\n }\r\n }\r\n\r\n /**\r\n * Handle events within the component\r\n * @link https://gist.github.com/WebReflection/ec9f6687842aa385477c4afca625bbf4#handling-events\r\n * @param {Event} event\r\n */\r\n handleEvent(event) {\r\n if (this[`on${event.type}`]) {\r\n this[`on${event.type}`](event);\r\n }\r\n }\r\n\r\n /**\r\n * This is called when connected. Extend in subclass if needed.\r\n */\r\n _connected() {}\r\n\r\n connectedCallback() {\r\n // ensure whenDefined callbacks are run first\r\n setTimeout(() => {\r\n this.log(\"connectedCallback\");\r\n\r\n // Append only when labels had the opportunity to be set\r\n // Don't use shadow dom as it makes theming super hard\r\n const template = document.createElement(\"template\");\r\n // @ts-ignore\r\n template.innerHTML = this.constructor.template();\r\n this.appendChild(template.content.cloneNode(true));\r\n\r\n this._connected();\r\n // @link https://gist.github.com/WebReflection/ec9f6687842aa385477c4afca625bbf4#life-cycle-events\r\n dispatch(this, \"connected\");\r\n }, 0);\r\n }\r\n\r\n /**\r\n * This is called when disconnected. Extend in subclass if needed.\r\n */\r\n _disconnected() {}\r\n\r\n disconnectedCallback() {\r\n this.log(\"disconnectedCallback\");\r\n this._disconnected();\r\n // @link https://gist.github.com/WebReflection/ec9f6687842aa385477c4afca625bbf4#life-cycle-events\r\n dispatch(this, \"disconnected\");\r\n }\r\n\r\n /**\r\n * @link https://gist.github.com/WebReflection/ec9f6687842aa385477c4afca625bbf4#a-props-like-accessor\r\n * @returns {Object}\r\n */\r\n get transformAttributes() {\r\n return {};\r\n }\r\n\r\n /**\r\n * This is only meant to work with data attributes\r\n * This allows us to have properties that reflect automatically in the component\r\n * @link https://gist.github.com/WebReflection/ec9f6687842aa385477c4afca625bbf4#reflected-dataset-attributes\r\n * @param {String} attributeName\r\n * @param {String} oldValue\r\n * @param {String} newValue\r\n */\r\n attributeChangedCallback(attributeName, oldValue, newValue) {\r\n // It didn't change\r\n if (oldValue === newValue) {\r\n return;\r\n }\r\n\r\n this.log(\"attributeChangedCallback: \" + attributeName);\r\n\r\n let isOption = false;\r\n const transformer = this.transformAttributes[attributeName] ?? normalizeData;\r\n\r\n // Data attributes are mapped to options while other attributes are mapped as properties\r\n if (attributeName.indexOf(\"data-\") === 0) {\r\n attributeName = attributeName.slice(5);\r\n isOption = true;\r\n }\r\n attributeName = camelize(attributeName);\r\n if (isOption) {\r\n this.options[attributeName] = transformer(newValue);\r\n } else {\r\n this[attributeName] = transformer(newValue);\r\n }\r\n\r\n // Fire internal event\r\n if (this.fireEvents && this[`${attributeName}Changed`]) {\r\n this[`${attributeName}Changed`]();\r\n }\r\n }\r\n}\r\n\r\nexport default BaseElement;\r\n", "/**\r\n * @param {HTMLSelectElement} el\r\n * @param {String} value\r\n * @param {String} label\r\n * @param {Boolean} checked\r\n */\r\nexport default function addSelectOption(el, value, label, checked = false) {\r\n let opt = document.createElement(\"option\");\r\n opt.value = \"\" + value;\r\n if (checked) {\r\n opt.selected = true;\r\n }\r\n opt.label = label;\r\n el.appendChild(opt);\r\n}\r\n", "/**\r\n * @param {URL} url\r\n * @param {Object} params\r\n */\r\nexport default function appendParamsToUrl(url, params = {}) {\r\n Object.keys(params).forEach((key) => {\r\n if (Array.isArray(params[key])) {\r\n // @ts-ignore\r\n Object.keys(params[key]).forEach((k) => url.searchParams.append(isNaN(k) ? `${key}[${k}]` : key, params[key][k]));\r\n } else {\r\n url.searchParams.append(key, params[key]);\r\n }\r\n });\r\n}\r\n", "/**\r\n * Force value as arrays\r\n * @param {String|Array} v\r\n * @returns {Array}\r\n */\r\nexport default function convertArray(v) {\r\n if (typeof v === \"string\") {\r\n if (v[0] === \"[\") {\r\n // \"['my', 'value']\" would fail as a json\r\n if (v.indexOf('\"') === -1) {\r\n v = v.replace(/'/g, '\"');\r\n }\r\n return JSON.parse(v);\r\n }\r\n\r\n return v.split(\",\");\r\n }\r\n if (!Array.isArray(v)) {\r\n console.error(\"Invalid array\", v);\r\n return [];\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @param {HTMLElement} el\r\n * @returns {Object}\r\n */\r\nexport default function elementOffset(el) {\r\n var rect = el.getBoundingClientRect(),\r\n scrollLeft = window.pageXOffset || document.documentElement.scrollLeft,\r\n scrollTop = window.pageYOffset || document.documentElement.scrollTop;\r\n return { top: rect.top + scrollTop, left: rect.left + scrollLeft };\r\n}\r\n", "/**\r\n * Uses canvas.measureText to compute and return the width of the given text of given font in pixels.\r\n * Getting computed styles only works for dom that are added in the dom\r\n * @see https://stackoverflow.com/questions/118241/calculate-text-width-with-javascript/21015393#21015393\r\n * @param {String} text The text to be rendered.\r\n * @param {Element} el Target element (defaults to body)\r\n * @param {Boolean} withPadding Include padding on element\r\n * @returns {Number}\r\n */\r\nexport default function getTextWidth(text, el = document.body, withPadding = false) {\r\n if (!el) {\r\n el = document.createElement(\"div\");\r\n }\r\n const styles = window.getComputedStyle(el);\r\n const fontWeight = styles.getPropertyValue(\"font-weight\") || \"normal\";\r\n const fontSize = styles.getPropertyValue(\"font-size\") || \"1rem\";\r\n const fontFamily = styles.getPropertyValue(\"font-family\") || \"Arial\";\r\n\r\n let padding = 0;\r\n if (withPadding) {\r\n const paddingLeft = styles.getPropertyValue(\"padding-left\") || \"0\";\r\n const paddingRight = styles.getPropertyValue(\"padding-right\") || \"0\";\r\n padding = parseInt(paddingLeft) + parseInt(paddingRight);\r\n }\r\n\r\n // re-use canvas object for better performance\r\n // @ts-ignore\r\n const canvas = getTextWidth.canvas || (getTextWidth.canvas = document.createElement(\"canvas\"));\r\n const context = canvas.getContext(\"2d\");\r\n context.font = `${fontWeight} ${fontSize} ${fontFamily}`;\r\n const metrics = context.measureText(text);\r\n return parseInt(metrics.width) + padding;\r\n}\r\n", "/**\r\n * Replace element within {} by their data value\r\n * @param {String} str\r\n * @param {Object} data\r\n * @returns {String}\r\n */\r\nexport default function interpolate(str, data) {\r\n return str.replace(/\\{([^}]+)?\\}/g, function ($1, $2) {\r\n return data[$2];\r\n });\r\n}\r\n", "/**\r\n * @param {String} prefix\r\n * @returns {String}\r\n */\r\nexport default function randstr(prefix) {\r\n return Math.random()\r\n .toString(36)\r\n .replace(\"0.\", prefix || \"\");\r\n}\r\n", "/**\r\n * Data Grid Web component\r\n *\r\n * Credits for inspiration\r\n * @link https://github.com/riverside/zino-grid\r\n */\r\n\"use strict\";\r\n\r\nimport BaseElement from \"./core/base-element.js\";\r\nimport addSelectOption from \"./utils/addSelectOption.js\";\r\nimport appendParamsToUrl from \"./utils/appendParamsToUrl.js\";\r\nimport camelize from \"./utils/camelize.js\";\r\nimport convertArray from \"./utils/convertArray.js\";\r\nimport elementOffset from \"./utils/elementOffset.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport interpolate from \"./utils/interpolate.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport { asElement, dispatch, find, findAll, hasClass, removeAttribute, setAttribute } from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * @typedef Column\r\n * @property {String} field - the key in the data\r\n * @property {String} title - the title to display in the header (defaults to \"field\" if not set)\r\n * @property {Number} width - the width of the column (auto otherwise)\r\n * @property {String} class - class to set on the column (target body or header with th.class or td.class)\r\n * @property {String} attr - don't render the column and set a matching attribute on the row with the value of the field\r\n * @property {Boolean} hidden - hide the column\r\n * @property {Boolean} editable - replace with input\r\n * @property {Boolean} noSort - allow disabling sort for a given column\r\n * @property {Number} responsive - the higher the value, the sooner it will be hidden, disable with 0\r\n */\r\n\r\n/**\r\n * @typedef Action\r\n * @property {String} title - the title of the button\r\n * @property {String} name - the name of the action\r\n * @property {String} class - the class for the button\r\n * @property {String} url - link for the action\r\n * @property {String} html - custom button data\r\n * @property {Boolean} confirm - needs confirmation\r\n * @property {Boolean} default - is the default row action\r\n */\r\n\r\n/**\r\n * TODO: figure out why @property syntax is not working for static methods\r\n * @link https://dev.to/dakmor/type-safe-web-components-with-jsdoc-4icf\r\n * @typedef {Object} Plugins\r\n * @property {Object|import(\"./plugins/column-resizer.js\").default} [ColumnResizer]\r\n * @property {Object|import(\"./plugins/context-menu\").default} [ContextMenu]\r\n * @property {Object|import('./plugins/draggable-headers.js').default} [DraggableHeaders]\r\n * @property {Object|import('./plugins/touch-support.js').default} [TouchSupport]\r\n * @property {Object|import('./plugins/selectable-rows.js').default} [SelectableRows]\r\n * @property {Object|import(\"./plugins/fixed-height.js\").default} [FixedHeight]\r\n * @property {Object|import(\"./plugins/autosize-column.js\").default} [AutosizeColumn]\r\n * @property {Object|import(\"./plugins/responsive-grid.js\").default} [ResponsiveGrid]\r\n */\r\n\r\n/**\r\n * @typedef Options\r\n * @property {?String} id\r\n * @property {?String} url\r\n * @property {Boolean} debug\r\n * @property {Boolean} filter\r\n * @property {Boolean} menu\r\n * @property {Boolean} sort\r\n * @property {Boolean} server\r\n * @property {Object} serverParams\r\n * @property {String} serverParams.start\r\n * @property {String} serverParams.length\r\n * @property {String} serverParams.search\r\n * @property {String} serverParams.sort\r\n * @property {String} serverParams.sortDir\r\n * @property {String} serverParams.dataKey\r\n * @property {String} serverParams.errorKey\r\n * @property {String} serverParams.metaKey\r\n * @property {String} serverParams.metaTotalKey\r\n * @property {String} serverParams.metaFilteredKey\r\n * @property {String} serverParams.optionsKey\r\n * @property {String} serverParams.paramsKey\r\n * @property {String} defaultSort\r\n * @property {Boolean} reorder\r\n * @property {Boolean} resizable\r\n * @property {String} dir\r\n * @property {Array} perPageValues\r\n * @property {Column[]} columns\r\n * @property {Action[]} actions\r\n * @property {Boolean} collapseActions\r\n * @property {Number} defaultPage\r\n * @property {Number} perPage\r\n * @property {Boolean} selectable\r\n * @property {Boolean} selectVisibleOnly\r\n * @property {Boolean} autosize\r\n * @property {Boolean} expand\r\n * @property {Boolean} autoheight\r\n * @property {Boolean} responsive\r\n */\r\n\r\n/**\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\nlet labels = {\r\n itemsPerPage: \"Items per page\",\r\n gotoPage: \"Go to page\",\r\n gotoFirstPage: \"Go to first page\",\r\n gotoPrevPage: \"Go to previous page\",\r\n gotoNextPage: \"Go to next page\",\r\n gotoLastPage: \"Go to last page\",\r\n of: \"of\",\r\n items: \"items\",\r\n resizeColumn: \"Resize column\",\r\n noData: \"No data\",\r\n areYouSure: \"Are you sure?\",\r\n};\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n // The grid displays that data\r\n this.data = [];\r\n // We store the original data in this\r\n this.originalData = [];\r\n\r\n /**\r\n * @type {Options}\r\n */\r\n this.options = this.options || this.defaultOptions;\r\n\r\n // Init values\r\n this.fireEvents = false;\r\n this.defaultHeight = 0;\r\n this.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta = {};\r\n\r\n // Expose observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing callbacks\r\n for (const attr of DataGrid.observedAttributes) {\r\n if (attr.indexOf(\"data-\") === 0) {\r\n setAttribute(this, attr, this.options[camelize(attr.slice(5))]);\r\n }\r\n }\r\n\r\n // Some IDE types stuff\r\n\r\n /**\r\n * @type {Column[]}\r\n */\r\n this.columns = this.columns ?? null;\r\n /**\r\n * @type {Column[]}\r\n */\r\n this.actions = this.actions ?? null;\r\n // selectable-rows.js\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.selectAll = null;\r\n /**\r\n * @type {EventListenerOrEventListenerObject}\r\n */\r\n this.toggleSelectAll = null;\r\n\r\n // touch-support.js\r\n this.touch = null;\r\n /**\r\n * @type {EventListenerOrEventListenerObject}\r\n */\r\n this.touchstart = null;\r\n /**\r\n * @type {EventListenerOrEventListenerObject}\r\n */\r\n this.touchmove = null;\r\n\r\n // column-resizer.js\r\n this.isResizing = false;\r\n }\r\n\r\n static template() {\r\n return `\r\n<table role=\"grid\" >\r\n <thead role=\"rowgroup\">\r\n <tr role=\"row\" aria-rowindex=\"1\" class=\"dg-head-columns\"><th><!-- keep for getTextWidth --></th></tr>\r\n <tr role=\"row\" aria-rowindex=\"2\" class=\"dg-head-filters\"></tr>\r\n </thead>\r\n <tbody role=\"rowgroup\" data-empty=\"${labels.noData}\"></tbody>\r\n <tfoot role=\"rowgroup\" hidden>\r\n <tr role=\"row\" aria-rowindex=\"1\">\r\n <td role=\"gridcell\">\r\n <div class=\"dg-footer\">\r\n <div class=\"dg-page-nav\">\r\n <select class=\"dg-select-per-page\" aria-label=\"${labels.itemsPerPage}\"></select>\r\n </div>\r\n <div class=\"dg-pagination\">\r\n <button type=\"button\" class=\"dg-btn-first dg-rotate\" title=\"${labels.gotoFirstPage}\" aria-label=\"${labels.gotoFirstPage}\" disabled>\r\n <i class=\"dg-skip-icon\"></i>\r\n </button>\r\n <button type=\"button\" class=\"dg-btn-prev dg-rotate\" title=\"${labels.gotoPrevPage}\" aria-label=\"${labels.gotoPrevPage}\" disabled>\r\n <i class=\"dg-nav-icon\"></i>\r\n </button>\r\n <input type=\"number\" class=\"dg-input-page\" min=\"1\" step=\"1\" value=\"1\" aria-label=\"${labels.gotoPage}\">\r\n <button type=\"button\" class=\"dg-btn-next\" title=\"${labels.gotoNextPage}\" aria-label=\"${labels.gotoNextPage}\" disabled>\r\n <i class=\"dg-nav-icon\"></i>\r\n </button>\r\n <button type=\"button\" class=\"dg-btn-last\" title=\"${labels.gotoLastPage}\" aria-label=\"${labels.gotoLastPage}\" disabled>\r\n <i class=\"dg-skip-icon\"></i>\r\n </button>\r\n </div>\r\n <div class=\"dg-meta\">\r\n <span class=\"dg-low\">0</span> - <span class=\"dg-high\">0</span> ${labels.of} <span class=\"dg-total\">0</span> ${labels.items}\r\n </div>\r\n </div>\r\n </td>\r\n </tr>\r\n </tfoot>\r\n <ul class=\"dg-menu\" hidden></ul>\r\n</table>\r\n`;\r\n }\r\n\r\n /**\r\n * @param {Object} v\r\n */\r\n static setLabels(v) {\r\n labels = Object.assign(labels, v);\r\n }\r\n\r\n /**\r\n * @returns {Column}\r\n */\r\n get defaultColumn() {\r\n return {\r\n field: \"\",\r\n title: \"\",\r\n width: 0,\r\n class: \"\",\r\n attr: \"\",\r\n hidden: false,\r\n editable: false,\r\n noSort: false,\r\n responsive: 1,\r\n };\r\n }\r\n\r\n /**\r\n * @returns {Options}\r\n */\r\n get defaultOptions() {\r\n return {\r\n id: null,\r\n url: null,\r\n perPage: 10,\r\n debug: false,\r\n filter: false,\r\n menu: false,\r\n sort: false,\r\n server: false,\r\n serverParams: {\r\n start: \"start\",\r\n length: \"length\",\r\n search: \"search\",\r\n sort: \"sort\",\r\n sortDir: \"sortDir\",\r\n dataKey: \"data\",\r\n errorKey: \"error\",\r\n metaKey: \"meta\",\r\n metaTotalKey: \"total\",\r\n metaFilteredKey: \"filtered\",\r\n optionsKey: \"options\",\r\n paramsKey: \"params\",\r\n },\r\n defaultSort: \"\",\r\n reorder: false,\r\n dir: \"ltr\",\r\n perPageValues: [10, 25, 50, 100, 250],\r\n columns: [],\r\n actions: [],\r\n collapseActions: false,\r\n selectable: false,\r\n selectVisibleOnly: true,\r\n defaultPage: 1,\r\n resizable: false,\r\n autosize: true,\r\n expand: false,\r\n autoheight: true,\r\n responsive: false,\r\n };\r\n }\r\n\r\n /**\r\n * @param {Plugins} list\r\n */\r\n static registerPlugins(list) {\r\n plugins = list;\r\n }\r\n\r\n static unregisterPlugins() {\r\n plugins = {};\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static plugins() {\r\n return plugins;\r\n }\r\n\r\n /**\r\n * @param {HTMLElement} el\r\n * @param {Object} definition\r\n */\r\n static applyColumnDefinition(el, definition) {\r\n if (definition.width) {\r\n el.setAttribute(\"width\", definition.width);\r\n }\r\n if (definition.class) {\r\n el.setAttribute(\"class\", definition.class);\r\n }\r\n }\r\n\r\n /**\r\n * @param {Object|Array} columns\r\n * @returns {Column[]}\r\n */\r\n convertColumns(columns) {\r\n let cols = [];\r\n // Convert key:value objects to actual columns\r\n if (typeof columns === \"object\" && !Array.isArray(columns)) {\r\n Object.keys(columns).forEach((key) => {\r\n let col = this.defaultColumn;\r\n col.title = columns[key];\r\n col.field = key;\r\n cols.push(col);\r\n });\r\n } else {\r\n columns.forEach((item) => {\r\n let col = this.defaultColumn;\r\n if (typeof item === \"string\") {\r\n col.title = item;\r\n col.field = item;\r\n } else if (typeof item === \"object\") {\r\n col = item;\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n } else {\r\n console.error(\"Column definition must be a string or an object\");\r\n }\r\n cols.push(col);\r\n });\r\n }\r\n return cols;\r\n }\r\n\r\n /**\r\n * @link https://gist.github.com/WebReflection/ec9f6687842aa385477c4afca625bbf4#reflected-dom-attributes\r\n * @returns {Array}\r\n */\r\n static get observedAttributes() {\r\n return [\r\n \"page\",\r\n \"data-filter\",\r\n \"data-sort\",\r\n \"data-debug\",\r\n \"data-reorder\",\r\n \"data-menu\",\r\n \"data-selectable\",\r\n \"data-url\",\r\n \"data-per-page\",\r\n \"data-responsive\",\r\n ];\r\n }\r\n\r\n get transformAttributes() {\r\n return {\r\n columns: (v) => this.convertColumns(convertArray(v)),\r\n actions: (v) => convertArray(v),\r\n defaultPage: (v) => parseInt(v),\r\n perPage: (v) => parseInt(v),\r\n };\r\n }\r\n\r\n get page() {\r\n return parseInt(this.getAttribute(\"page\"));\r\n }\r\n\r\n set page(val) {\r\n setAttribute(this, \"page\", this.constrainPageValue(val));\r\n }\r\n\r\n urlChanged() {\r\n this.loadData().then(() => {\r\n this.configureUi();\r\n });\r\n }\r\n\r\n constrainPageValue(v) {\r\n if (this.pages < v) {\r\n v = this.pages;\r\n }\r\n if (v < 1 || !v) {\r\n v = 1;\r\n }\r\n return v;\r\n }\r\n\r\n fixPage() {\r\n this.pages = this.totalPages();\r\n this.page = this.constrainPageValue(this.page);\r\n\r\n // Show current page in input\r\n this.inputPage.setAttribute(\"max\", \"\" + this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages === 1;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n plugins.ResponsiveGrid.observe(this);\r\n } else {\r\n plugins.ResponsiveGrid.unobserve(this);\r\n }\r\n }\r\n\r\n menuChanged() {\r\n this.renderHeader();\r\n }\r\n\r\n /**\r\n * This is the callback for the select control\r\n */\r\n changePerPage() {\r\n this.options.perPage = parseInt(this.selectPerPage.options[this.selectPerPage.selectedIndex].value);\r\n this.perPageChanged();\r\n }\r\n\r\n /**\r\n * This is the actual event triggered on attribute change\r\n */\r\n perPageChanged() {\r\n // Refresh UI\r\n if (this.options.perPage !== parseInt(this.selectPerPage.options[this.selectPerPage.selectedIndex].value)) {\r\n this.perPageValuesChanged();\r\n }\r\n // Make sure current page is still valid\r\n let updatePage = this.page;\r\n while (updatePage > 1 && this.page * this.options.perPage > this.totalRecords()) {\r\n updatePage--;\r\n }\r\n if (updatePage != this.page) {\r\n this.page = updatePage;\r\n } else {\r\n this.reload(() => {\r\n // Scroll and keep a sizable amount of data displayed\r\n if (this.hasAttribute(\"sticky\")) {\r\n window.scroll({ top: elementOffset(this.selectPerPage).top - this.defaultHeight });\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n this.setAttribute(\"dir\", this.options.dir);\r\n }\r\n\r\n defaultSortChanged() {\r\n this.sortChanged();\r\n }\r\n\r\n /**\r\n * Populate the select dropdown according to options\r\n */\r\n perPageValuesChanged() {\r\n if (!this.selectPerPage) {\r\n return;\r\n }\r\n while (this.selectPerPage.lastChild) {\r\n this.selectPerPage.removeChild(this.selectPerPage.lastChild);\r\n }\r\n this.options.perPageValues.forEach((v) => {\r\n addSelectOption(this.selectPerPage, v, v, v === this.options.perPage);\r\n });\r\n }\r\n\r\n _connected() {\r\n /**\r\n * @type {HTMLTableElement}\r\n */\r\n this.table = find(this, \"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = find(this, \".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = find(this, \".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = find(this, \".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = find(this, \".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = find(this, \".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = find(this, \".dg-input-page\");\r\n\r\n this.getFirst = this.getFirst.bind(this);\r\n this.getPrev = this.getPrev.bind(this);\r\n this.getNext = this.getNext.bind(this);\r\n this.getLast = this.getLast.bind(this);\r\n this.changePerPage = this.changePerPage.bind(this);\r\n this.gotoPage = this.gotoPage.bind(this);\r\n\r\n this.btnFirst.addEventListener(\"click\", this.getFirst);\r\n this.btnPrev.addEventListener(\"click\", this.getPrev);\r\n this.btnNext.addEventListener(\"click\", this.getNext);\r\n this.btnLast.addEventListener(\"click\", this.getLast);\r\n this.selectPerPage.addEventListener(\"change\", this.changePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n for (const plugin in plugins) {\r\n plugins[plugin].connected(this);\r\n }\r\n\r\n // Display even if we don't have data\r\n this.dirChanged();\r\n this.perPageValuesChanged();\r\n\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.filterChanged();\r\n this.reorderChanged();\r\n\r\n this.dirChanged();\r\n this.perPageValuesChanged();\r\n this.pageChanged();\r\n\r\n this.classList.add(\"dg-initialized\");\r\n this.fireEvents = true; // We can now fire attributeChangedCallback events\r\n\r\n this.log(\"initialized\");\r\n });\r\n }\r\n\r\n _disconnected() {\r\n this.btnFirst.removeEventListener(\"click\", this.getFirst);\r\n this.btnPrev.removeEventListener(\"click\", this.getPrev);\r\n this.btnNext.removeEventListener(\"click\", this.getNext);\r\n this.btnLast.removeEventListener(\"click\", this.getLast);\r\n this.selectPerPage.removeEventListener(\"change\", this.changePerPage);\r\n this.inputPage.removeEventListener(\"input\", this.gotoPage);\r\n\r\n for (const plugin in plugins) {\r\n plugins[plugin].disconnected(this);\r\n }\r\n }\r\n\r\n getCol(field) {\r\n let found = null;\r\n this.options.columns.forEach((col) => {\r\n if (col.field == field) {\r\n found = col;\r\n }\r\n });\r\n return found;\r\n }\r\n\r\n getColProp(field, prop) {\r\n const c = this.getCol(field);\r\n return c ? c[prop] : null;\r\n }\r\n\r\n setColProp(field, prop, val) {\r\n const c = this.getCol(field);\r\n if (c) {\r\n c[prop] = val;\r\n }\r\n }\r\n\r\n visibleColumns() {\r\n return this.options.columns.filter((col) => {\r\n return !col.hidden;\r\n });\r\n }\r\n\r\n hiddenColumns() {\r\n return this.options.columns.filter((col) => {\r\n return col.hidden === true;\r\n });\r\n }\r\n\r\n showColumn(field, render = true) {\r\n this.setColProp(field, \"hidden\", false);\r\n\r\n // We need to render the whole table otherwise layout fixed won't do its job\r\n if (render) this.renderTable();\r\n\r\n dispatch(this, \"columnVisibility\", {\r\n col: field,\r\n visibility: \"visible\",\r\n });\r\n }\r\n\r\n hideColumn(field, render = true) {\r\n this.setColProp(field, \"hidden\", true);\r\n\r\n // We need to render the whole table otherwise layout fixed won't do its job\r\n if (render) this.renderTable();\r\n\r\n dispatch(this, \"columnVisibility\", {\r\n col: field,\r\n visibility: \"hidden\",\r\n });\r\n }\r\n\r\n /**\r\n * Returns the starting index of actual data\r\n * @returns {Number}\r\n */\r\n startColIndex() {\r\n return this.options.selectable && plugins.SelectableRows ? 2 : 1;\r\n }\r\n\r\n hasActions() {\r\n return this.options.actions.length > 0;\r\n }\r\n\r\n get actionClass() {\r\n if (this.options.actions.length < 3 && !this.options.collapseActions) {\r\n return \"dg-actions-\" + this.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n\r\n /**\r\n * @param {Boolean} visibleOnly\r\n * @returns {Number}\r\n */\r\n columnsLength(visibleOnly = false) {\r\n let len = 0;\r\n this.options.columns.forEach((col) => {\r\n if (visibleOnly && col.hidden) {\r\n return;\r\n }\r\n if (!col.attr) {\r\n len++;\r\n }\r\n });\r\n if (this.options.selectable && plugins.SelectableRows) {\r\n len++;\r\n }\r\n if (this.options.actions.length) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n configureUi() {\r\n this.querySelector(\"table\").setAttribute(\"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && plugins.ResponsiveGrid) {\r\n // Let the observer make the table visible\r\n } else {\r\n this.table.style.visibility = \"visible\";\r\n }\r\n\r\n // Store row height for later usage\r\n if (!this.rowHeight) {\r\n const tr = this.querySelector(\"tbody tr\") || this.querySelector(\"table tr\");\r\n if (tr instanceof HTMLTableRowElement) {\r\n this.rowHeight = tr.offsetHeight;\r\n }\r\n }\r\n }\r\n\r\n filterChanged() {\r\n const row = this.querySelector(\"thead tr.dg-head-filters\");\r\n if (this.options.filter) {\r\n row.removeAttribute(\"hidden\");\r\n } else {\r\n this.clearFilters();\r\n row.setAttribute(\"hidden\", \"\");\r\n }\r\n }\r\n \r\n reorderChanged() {\r\n this.querySelectorAll(\"thead tr.dg-head-columns th\").forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (!(th instanceof HTMLTableRowElement)) {\r\n return;\r\n }\r\n if (this.options.reorder && plugins.DraggableHeaders) {\r\n th.draggable = true;\r\n } else {\r\n th.removeAttribute(\"draggable\");\r\n }\r\n });\r\n }\r\n\r\n sortChanged() {\r\n this.log(\"toggle sort\");\r\n\r\n this.querySelectorAll(\"thead tr.dg-head-columns th\").forEach((th) => {\r\n const fieldName = th.getAttribute(\"field\");\r\n if (th.classList.contains(\"dg-not-sortable\") || (!this.fireEvents && fieldName == this.options.defaultSort)) {\r\n return;\r\n }\r\n if (this.options.sort && !this.getColProp(fieldName, \"noSort\")) {\r\n th.setAttribute(\"aria-sort\", \"none\");\r\n } else {\r\n th.removeAttribute(\"aria-sort\");\r\n }\r\n });\r\n }\r\n\r\n selectableChanged() {\r\n this.renderTable();\r\n }\r\n\r\n addRow(row) {\r\n this.log(\"Add row\");\r\n this.originalData.push(row);\r\n this.data = this.originalData.slice();\r\n this.sortData();\r\n }\r\n\r\n /**\r\n * @param {any} value Value to remove. Defaults to last row.\r\n * @param {String} key The key of the item to remove. Defaults to first column\r\n */\r\n removeRow(value = null, key = null) {\r\n if (key === null) {\r\n key = this.options.columns[0][\"field\"];\r\n }\r\n if (value === null) {\r\n value = this.originalData[this.originalData.length - 1][key];\r\n }\r\n this.log(\"Removing \" + key + \":\" + value);\r\n for (let i = 0; i < this.originalData.length; i++) {\r\n if (this.originalData[i][key] === value) {\r\n this.originalData.splice(i, 1);\r\n break;\r\n }\r\n }\r\n this.data = this.originalData.slice();\r\n this.sortData();\r\n }\r\n\r\n /**\r\n * @param {String} key Return a specific key (eg: id) instead of the whole row\r\n * @returns {Array}\r\n */\r\n getSelection(key = null) {\r\n if (!plugins.SelectableRows) {\r\n return [];\r\n }\r\n return plugins.SelectableRows.getSelection(this, key);\r\n }\r\n\r\n getData() {\r\n return this.originalData;\r\n }\r\n\r\n clearData() {\r\n // Already empty\r\n if (this.data.length === 0) {\r\n return;\r\n }\r\n this.data = this.originalData = [];\r\n this.renderBody();\r\n // Recompute height if needed\r\n plugins.FixedHeight && plugins.FixedHeight.computeDefaultHeight(this);\r\n }\r\n\r\n refresh(cb = null) {\r\n this.data = this.originalData = [];\r\n return this.reload(cb);\r\n }\r\n\r\n reload(cb = null) {\r\n this.log(\"reload\");\r\n\r\n // If the data was cleared, we need to render again\r\n const needRender = this.originalData.length === 0;\r\n this.fixPage();\r\n this.loadData().finally(() => {\r\n // If we load data from the server, we redraw the table body\r\n // Otherwise, we just need to paginate\r\n this.options.server || needRender ? this.renderBody() : this.paginate();\r\n\r\n // Recompute height if needed\r\n // plugins.FixedHeight && plugins.FixedHeight.computeDefaultHeight(this);\r\n if (cb) {\r\n cb();\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * @returns {Promise}\r\n */\r\n loadData() {\r\n // We already have some data\r\n if (this.originalData.length) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n // if (!this.options.server) {\r\n this.log(\"skip loadData\");\r\n return new Promise((resolve) => {\r\n resolve();\r\n });\r\n }\r\n }\r\n this.log(\"loadData\");\r\n this.loading = true;\r\n this.classList.add(\"dg-loading\");\r\n return this.fetchData()\r\n .then((response) => {\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n\r\n // We can get a straight array or an object\r\n if (Array.isArray(response)) {\r\n this.data = response;\r\n } else {\r\n // Object must contain data key\r\n if (response[this.options.serverParams.errorKey]) {\r\n this.querySelector(\"tbody\").setAttribute(\r\n \"data-empty\",\r\n response[this.options.serverParams.errorKey].replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\")\r\n );\r\n this.removeAttribute(\"data-url\");\r\n return;\r\n }\r\n if (!response[this.options.serverParams.dataKey]) {\r\n console.error(\"Invalid response, it should contain a data key with an array or be a plain array\", response);\r\n this.options.url = null;\r\n return;\r\n }\r\n\r\n // We may have a config object\r\n this.options = Object.assign(this.options, response[this.options.serverParams.optionsKey] ?? {});\r\n // It should return meta data (see metaFilteredKey)\r\n this.meta = response[this.options.serverParams.metaKey] ?? {};\r\n\r\n this.data = response[this.options.serverParams.dataKey];\r\n }\r\n this.originalData = this.data.slice();\r\n this.fixPage();\r\n\r\n // Make sure we have a proper set of columns\r\n if (this.options.columns.length === 0 && this.originalData.length) {\r\n this.options.columns = this.convertColumns(Object.keys(this.originalData[0]));\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n });\r\n }\r\n\r\n getFirst() {\r\n if (this.loading) {\r\n return;\r\n }\r\n this.page = 1;\r\n }\r\n\r\n getLast() {\r\n if (this.loading) {\r\n return;\r\n }\r\n this.page = this.pages;\r\n }\r\n\r\n getPrev() {\r\n if (this.loading) {\r\n return;\r\n }\r\n this.page = this.page - 1;\r\n }\r\n\r\n getNext() {\r\n if (this.loading) {\r\n return;\r\n }\r\n this.page = this.page + 1;\r\n }\r\n\r\n gotoPage(event) {\r\n if (event.type === \"keypress\") {\r\n const key = event.keyCode || event.key;\r\n if (key === 13 || key === \"Enter\") {\r\n event.preventDefault();\r\n } else {\r\n return;\r\n }\r\n }\r\n this.page = parseInt(this.inputPage.value);\r\n }\r\n\r\n getSort() {\r\n let col = this.querySelector(\"thead tr.dg-head-columns th[aria-sort$='scending']\");\r\n if (col) {\r\n return col.getAttribute(\"field\");\r\n }\r\n return this.options.defaultSort;\r\n }\r\n\r\n getSortDir() {\r\n let col = this.querySelector(\"thead tr.dg-head-columns th[aria-sort$='scending']\");\r\n if (col) {\r\n return col.getAttribute(\"aria-sort\") || \"\";\r\n }\r\n return \"\";\r\n }\r\n\r\n getFilters() {\r\n let filters = [];\r\n this.querySelectorAll(\"thead tr.dg-head-filters input\").forEach((input) => {\r\n if (input instanceof HTMLInputElement) {\r\n filters[input.dataset.name] = input.value;\r\n }\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n this.querySelectorAll(\"thead tr.dg-head-filters input\").forEach((input) => {\r\n if (input instanceof HTMLInputElement) {\r\n input.value = \"\";\r\n }\r\n });\r\n this.filterData();\r\n }\r\n\r\n filterData() {\r\n this.log(\"filter data\");\r\n\r\n this.page = 1;\r\n\r\n if (this.options.server) {\r\n this.reload();\r\n } else {\r\n this.data = this.originalData.slice();\r\n\r\n // Look for rows matching the filters\r\n this.querySelectorAll(\"thead tr.dg-head-filters input\").forEach((input) => {\r\n if (!(input instanceof HTMLInputElement)) {\r\n return;\r\n }\r\n let value = input.value;\r\n if (value) {\r\n let name = input.dataset.name;\r\n this.data = this.data.filter((item) => {\r\n let str = item[name] + \"\";\r\n return str.toLowerCase().indexOf(value.toLowerCase()) !== -1;\r\n });\r\n }\r\n });\r\n this.pageChanged();\r\n\r\n let col = this.querySelector(\"thead tr.dg-head-columns th[aria-sort$='scending']\");\r\n if (this.options.sort && col) {\r\n this.sortData();\r\n } else {\r\n this.renderBody();\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * Data will be sorted then rendered using renderBody\r\n * @param {Element} col The column that was clicked or null to use current sort\r\n */\r\n sortData(col = null) {\r\n this.log(\"sort data\");\r\n\r\n // Early exit\r\n if (col && this.getColProp(col.getAttribute(\"field\"), \"noSort\")) {\r\n this.log(\"sorting prevented because column is not sortable\");\r\n return;\r\n }\r\n if (this.loading) {\r\n this.log(\"sorting prevented because loading\");\r\n return;\r\n }\r\n\r\n // We clicked on a column, update sort state\r\n if (col !== null) {\r\n // Remove active sort if any\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (th !== col) {\r\n th.setAttribute(\"aria-sort\", \"none\");\r\n }\r\n });\r\n\r\n // Set tristate col\r\n if (!col.hasAttribute(\"aria-sort\") || col.getAttribute(\"aria-sort\") === \"none\") {\r\n col.setAttribute(\"aria-sort\", \"ascending\");\r\n } else if (col.getAttribute(\"aria-sort\") === \"ascending\") {\r\n col.setAttribute(\"aria-sort\", \"descending\");\r\n } else if (col.getAttribute(\"aria-sort\") === \"descending\") {\r\n col.setAttribute(\"aria-sort\", \"none\");\r\n }\r\n } else {\r\n // Or fetch current sort\r\n col = this.querySelector(\"thead tr.dg-head-columns th[aria-sort$='scending']\");\r\n }\r\n\r\n if (this.options.server) {\r\n // Reload data with updated sort\r\n this.loadData().finally(() => {\r\n this.renderBody();\r\n });\r\n } else {\r\n const sort = col ? col.getAttribute(\"aria-sort\") : \"none\";\r\n if (sort === \"none\") {\r\n let stack = [];\r\n\r\n // Restore order while keeping filters\r\n this.originalData.some((itemA) => {\r\n this.data.some((itemB) => {\r\n if (JSON.stringify(itemA) === JSON.stringify(itemB)) {\r\n stack.push(itemB);\r\n return true;\r\n }\r\n return false;\r\n });\r\n return stack.length === this.data.length;\r\n });\r\n\r\n this.data = stack;\r\n } else {\r\n const field = col.getAttribute(\"field\");\r\n this.data.sort((a, b) => {\r\n if (!isNaN(a[field]) && !isNaN(b[field])) {\r\n return sort === \"ascending\" ? a[field] - b[field] : b[field] - a[field];\r\n }\r\n const valA = sort === \"ascending\" ? a[field].toUpperCase() : b[field].toUpperCase();\r\n const valB = sort === \"ascending\" ? b[field].toUpperCase() : a[field].toUpperCase();\r\n\r\n switch (true) {\r\n case valA > valB:\r\n return 1;\r\n case valA < valB:\r\n return -1;\r\n case valA === valB:\r\n return 0;\r\n }\r\n });\r\n }\r\n this.renderBody();\r\n }\r\n }\r\n\r\n fetchData() {\r\n if (!this.options.url) {\r\n return new Promise((resolve, reject) => reject(\"No url set\"));\r\n }\r\n let url = new URL(this.options.url, window.location.href);\r\n let params = {\r\n r: Date.now(),\r\n };\r\n if (this.options.server) {\r\n // 0 based\r\n params[this.options.serverParams.start] = this.page - 1;\r\n params[this.options.serverParams.length] = this.options.perPage;\r\n params[this.options.serverParams.search] = this.getFilters();\r\n params[this.options.serverParams.sort] = this.getSort() || \"\";\r\n params[this.options.serverParams.sortDir] = this.getSortDir();\r\n\r\n // extra params ?\r\n if (this.meta[this.options.serverParams.paramsKey]) {\r\n params = Object.assign(params, this.meta[this.options.serverParams.paramsKey]);\r\n }\r\n }\r\n\r\n appendParamsToUrl(url, params);\r\n\r\n return fetch(url)\r\n .then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText);\r\n }\r\n return response.json();\r\n })\r\n .catch((err) => {\r\n return {\r\n error: err.message,\r\n };\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && plugins.ContextMenu) {\r\n plugins.ContextMenu.createMenu(this);\r\n }\r\n\r\n let sortedColumn;\r\n\r\n this.renderHeader();\r\n if (this.options.defaultSort) {\r\n // We can have a default sort even with sort disabled\r\n sortedColumn = this.querySelector(\"thead tr.dg-head-columns th[field='\" + this.options.defaultSort + \"']\");\r\n }\r\n\r\n if (sortedColumn) {\r\n this.sortData(sortedColumn);\r\n } else {\r\n this.renderBody();\r\n }\r\n\r\n this.renderFooter();\r\n }\r\n\r\n /**\r\n * Create table header\r\n * - One row for the column headers\r\n * - One row for the filters\r\n */\r\n renderHeader() {\r\n this.log(\"render header\");\r\n\r\n const thead = this.querySelector(\"thead\");\r\n this.createColumnHeaders(thead);\r\n this.createColumnFilters(thead);\r\n\r\n if (this.options.resizable && plugins.ColumnResizer) {\r\n plugins.ColumnResizer.renderResizer(this, labels.resizeColumn);\r\n }\r\n\r\n this.dispatchEvent(new CustomEvent(\"headerRendered\"));\r\n }\r\n\r\n renderFooter() {\r\n this.log(\"render footer\");\r\n\r\n const tfoot = this.querySelector(\"tfoot\");\r\n const td = tfoot.querySelector(\"td\");\r\n tfoot.removeAttribute(\"hidden\");\r\n setAttribute(td, \"colspan\", this.columnsLength(true));\r\n tfoot.style.display = \"\";\r\n }\r\n\r\n /**\r\n * Create the column headers based on column definitions and set options\r\n * @param {HTMLTableSectionElement} thead\r\n */\r\n createColumnHeaders(thead) {\r\n // @link https://stackoverflow.com/questions/21064101/understanding-offsetwidth-clientwidth-scrollwidth-and-height-respectively\r\n // const computedStyles = getComputedStyle(this.table);\r\n // const scrollbarWidth = this.offsetWidth - this.clientWidth - parseInt(computedStyles.borderLeftWidth) - parseInt(computedStyles.borderRightWidth);\r\n const scrollbarWidth = 8;\r\n const availableWidth = this.clientWidth;\r\n const colMaxWidth = Math.round((availableWidth / this.columnsLength(true)) * 2);\r\n\r\n let idx = 0;\r\n let tr;\r\n\r\n // Create row\r\n tr = document.createElement(\"tr\");\r\n this.headerRow = tr;\r\n tr.setAttribute(\"role\", \"row\");\r\n tr.setAttribute(\"aria-rowindex\", \"1\");\r\n tr.setAttribute(\"class\", \"dg-head-columns\");\r\n\r\n if (this.options.selectable && plugins.SelectableRows) {\r\n plugins.SelectableRows.createHeaderCol(this, tr);\r\n }\r\n\r\n // We need a real th from the dom to compute the size\r\n let sampleTh = thead.querySelector(\"tr.dg-head-columns th\");\r\n if (!sampleTh) {\r\n sampleTh = document.createElement(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n // Create columns\r\n idx = 0;\r\n let totalWidth = 0;\r\n this.options.columns.forEach((column) => {\r\n if (column.attr) {\r\n return;\r\n }\r\n const colIdx = idx + this.startColIndex();\r\n let th = document.createElement(\"th\");\r\n th.setAttribute(\"scope\", \"col\");\r\n th.setAttribute(\"role\", \"columnheader button\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n th.setAttribute(\"id\", randstr(\"dg-col-\"));\r\n if (this.options.sort) {\r\n th.setAttribute(\"aria-sort\", \"none\");\r\n }\r\n th.setAttribute(\"field\", column.field);\r\n if (plugins.ResponsiveGrid) {\r\n setAttribute(th, \"data-responsive\", column.responsive);\r\n }\r\n // Make sure the header fits (+ add some room for sort icon if necessary)\r\n const computedWidth = getTextWidth(column.title, sampleTh, true) + 20;\r\n th.dataset.minWidth = \"\" + computedWidth;\r\n DataGrid.applyColumnDefinition(th, column);\r\n th.tabIndex = 0;\r\n th.textContent = column.title;\r\n\r\n let w = 0;\r\n // Autosize small based on first/last row ?\r\n // Take into account minWidth of the header and max available size based on col numbers\r\n if (this.options.autosize && plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = plugins.AutosizeColumn.autosizeColumn(this, th, column, parseInt(th.dataset.minWidth), colAvailableWidth);\r\n } else {\r\n w = Math.max(parseInt(th.dataset.minWidth), parseInt(th.getAttribute(\"width\")));\r\n }\r\n\r\n setAttribute(th, \"width\", w);\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n } else {\r\n totalWidth += w;\r\n }\r\n\r\n // Reorder columns with drag/drop\r\n if (this.options.reorder && plugins.DraggableHeaders) {\r\n plugins.DraggableHeaders.makeHeaderDraggable(this, th);\r\n }\r\n\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // There is too much available width, and we want to avoid fixed layout to split remaining amount\r\n if (totalWidth <= availableWidth) {\r\n const visibleCols = findAll(tr, \"th:not([hidden])\");\r\n if (visibleCols.length) {\r\n const lastCol = visibleCols[visibleCols.length - 1];\r\n removeAttribute(lastCol, \"width\");\r\n }\r\n }\r\n\r\n // Actions\r\n if (this.options.actions.length) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.columnsLength(true));\r\n actionsTh.classList.add(...[\"dg-actions\", \"dg-not-sortable\", \"dg-not-resizable\", this.actionClass]);\r\n actionsTh.tabIndex = 0;\r\n tr.appendChild(actionsTh);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-columns\"));\r\n\r\n // Once columns are inserted, we have an actual dom to query\r\n if (thead.offsetWidth > availableWidth) {\r\n this.log(\"adjust width to fix size\");\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if(this.options.responsive && plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n tr.querySelectorAll(\"th[width]\").forEach((th) => {\r\n if (hasClass(th, \"dg-not-resizable\")) {\r\n return;\r\n }\r\n if (diff <= 0) {\r\n return;\r\n }\r\n const col = asElement(th);\r\n const actualWidth = parseInt(col.getAttribute(\"width\"));\r\n const minWidth = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : 0;\r\n if (actualWidth > minWidth) {\r\n let newWidth = actualWidth - diff;\r\n if (newWidth < minWidth) {\r\n newWidth = minWidth;\r\n }\r\n diff -= actualWidth - newWidth;\r\n\r\n setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && plugins.ContextMenu) {\r\n plugins.ContextMenu.attachContextMenu(this);\r\n }\r\n\r\n // Sort col on click\r\n tr.querySelectorAll(\"[aria-sort]\").forEach((sortableRow) => {\r\n sortableRow.addEventListener(\"click\", () => this.sortData(sortableRow));\r\n });\r\n\r\n setAttribute(this.querySelector(\"table\"), \"aria-colcount\", this.columnsLength(true));\r\n }\r\n\r\n createColumnFilters(thead) {\r\n let idx = 0;\r\n let tr;\r\n\r\n // Create row for filters\r\n tr = document.createElement(\"tr\");\r\n this.filterRow = tr;\r\n tr.setAttribute(\"role\", \"row\");\r\n tr.setAttribute(\"aria-rowindex\", \"2\");\r\n tr.setAttribute(\"class\", \"dg-head-filters\");\r\n if (!this.options.filter) {\r\n tr.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n // Selectable\r\n if (this.options.selectable && plugins.SelectableRows) {\r\n plugins.SelectableRows.createFilterCol(this, tr);\r\n }\r\n\r\n this.options.columns.forEach((column) => {\r\n if (column.attr) {\r\n return;\r\n }\r\n const colIdx = idx + this.startColIndex();\r\n let relatedTh = thead.querySelector(\"tr.dg-head-columns th[aria-colindex='\" + colIdx + \"']\");\r\n if (!relatedTh) {\r\n console.warn(\"Related th not found\", colIdx);\r\n return;\r\n }\r\n let th = document.createElement(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let input = document.createElement(\"input\");\r\n input.type = \"text\";\r\n input.autocomplete = \"off\";\r\n input.spellcheck = false;\r\n // Allows binding filter to this column\r\n input.dataset.name = column.field;\r\n input.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n input.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n input.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(input);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.columnsLength(true));\r\n actionsTh.classList.add(...[\"dg-actions\", this.actionClass]);\r\n actionsTh.tabIndex = 0;\r\n tr.appendChild(actionsTh);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content on enter\r\n tr.querySelectorAll(\"input\").forEach((input) => {\r\n input.addEventListener(\"keypress\", (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n /**\r\n * Render the data as rows in tbody\r\n * It will call paginate() at the end\r\n */\r\n renderBody() {\r\n this.log(\"render body\");\r\n let tr;\r\n let td;\r\n let idx;\r\n let tbody = document.createElement(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = document.createElement(\"tr\");\r\n tr.setAttribute(\"role\", \"row\");\r\n tr.setAttribute(\"hidden\", \"\");\r\n tr.setAttribute(\"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n // Selectable\r\n if (this.options.selectable && plugins.SelectableRows) {\r\n plugins.SelectableRows.createDataCol(this, tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n tr.addEventListener(\"click\", function () {\r\n this.classList.toggle(\"dg-expanded\");\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.log(this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n return;\r\n }\r\n td = document.createElement(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n DataGrid.applyColumnDefinition(td, column);\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing\r\n if (column.editable) {\r\n let input = document.createElement(\"input\");\r\n input.type = \"text\";\r\n input.autocomplete = \"off\";\r\n input.spellcheck = false;\r\n input.tabIndex = 0;\r\n input.classList.add(\"dg-editable\");\r\n input.name = this.getAttribute(\"id\").replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n input.addEventListener(\"keypress\", (ev) => {\r\n if (ev.type === \"keypress\") {\r\n const key = ev.keyCode || ev.key;\r\n if (key === 13 || key === \"Enter\") {\r\n input.blur();\r\n }\r\n }\r\n });\r\n input.addEventListener(\"blur\", () => {\r\n // Only fire on update\r\n if (input.value == item[input.dataset.field]) {\r\n return;\r\n }\r\n // Update underlying data\r\n item[input.dataset.field] = input.value;\r\n // Notify\r\n dispatch(this, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n } else {\r\n td.textContent = item[column.field];\r\n }\r\n if (column.hidden) {\r\n setAttribute(td, \"hidden\", \"\");\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length) {\r\n td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.columnsLength(true));\r\n td.classList.add(...[\"dg-actions\", this.actionClass]);\r\n td.tabIndex = 0;\r\n\r\n // Add menu toggle\r\n let actionsToggle = document.createElement(\"button\");\r\n actionsToggle.classList.add(\"dg-actions-toggle\");\r\n actionsToggle.innerHTML = \"\u2630\";\r\n td.appendChild(actionsToggle);\r\n actionsToggle.addEventListener(\"click\", (ev) => {\r\n if (ev.target instanceof HTMLElement) {\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n }\r\n });\r\n\r\n this.options.actions.forEach((action) => {\r\n let button = document.createElement(\"button\");\r\n if (action.html) {\r\n button.innerHTML = action.html;\r\n } else {\r\n button.innerText = action.title ?? action.name;\r\n }\r\n if (action.title) {\r\n button.title = action.title;\r\n }\r\n if (action.url) {\r\n button.type = \"submit\";\r\n button.formAction = interpolate(action.url, item);\r\n }\r\n if (action.class) {\r\n button.classList.add(...action.class.split(' '));\r\n }\r\n const actionHandler = (ev) => {\r\n ev.stopPropagation();\r\n if (action.confirm) {\r\n let c = confirm(labels.areYouSure);\r\n if (!c) {\r\n ev.preventDefault();\r\n return;\r\n }\r\n }\r\n dispatch(this, \"action\", {\r\n data: item,\r\n action: action.name,\r\n });\r\n };\r\n button.addEventListener(\"click\", actionHandler);\r\n td.appendChild(button);\r\n\r\n // Row action\r\n if (action.default) {\r\n tr.classList.add(\"dg-actionable\");\r\n tr.addEventListener(\"click\", actionHandler);\r\n }\r\n });\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n tbody.appendChild(tr);\r\n });\r\n\r\n tbody.setAttribute(\"role\", \"rowgroup\");\r\n\r\n // Keep data empty message\r\n const prev = this.querySelector(\"tbody\");\r\n tbody.setAttribute(\"data-empty\", prev.getAttribute(\"data-empty\"));\r\n this.querySelector(\"table\").replaceChild(tbody, prev);\r\n\r\n if (plugins.FixedHeight) {\r\n plugins.FixedHeight.createFakeRow(this);\r\n }\r\n\r\n this.paginate();\r\n\r\n if (plugins.SelectableRows) {\r\n plugins.SelectableRows.shouldSelectAll(this, tbody);\r\n }\r\n\r\n this.dispatchEvent(new CustomEvent(\"bodyRendered\"));\r\n }\r\n\r\n paginate() {\r\n this.log(\"paginate\");\r\n\r\n const total = this.totalRecords();\r\n const p = this.page || 1;\r\n\r\n let index;\r\n let high = p * this.options.perPage;\r\n let low = high - this.options.perPage + 1;\r\n const tbody = this.querySelector(\"tbody\");\r\n const tfoot = this.querySelector(\"tfoot\");\r\n\r\n if (high > total) {\r\n high = total;\r\n }\r\n if (!total) {\r\n low = 0;\r\n }\r\n\r\n // Display all rows within the set indexes\r\n // For server side paginated grids, we display everything\r\n // since the server is taking care of actual pagination\r\n tbody.querySelectorAll(\"tr\").forEach((tr) => {\r\n if (this.options.server) {\r\n tr.removeAttribute(\"hidden\");\r\n return;\r\n }\r\n index = Number(tr.getAttribute(\"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n tr.removeAttribute(\"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && plugins.SelectableRows) {\r\n plugins.SelectableRows.clearCheckboxes(this, tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (plugins.FixedHeight) {\r\n if (this.defaultHeight == 0) {\r\n plugins.FixedHeight.computeDefaultHeight(this);\r\n }\r\n plugins.FixedHeight.updateFakeRow(this);\r\n }\r\n\r\n // Enable/disable buttons if shown\r\n if (this.btnFirst) {\r\n this.btnFirst.disabled = this.page <= 1;\r\n this.btnPrev.disabled = this.page <= 1;\r\n this.btnNext.disabled = this.page >= this.pages;\r\n this.btnLast.disabled = this.page >= this.pages;\r\n }\r\n tfoot.querySelector(\".dg-low\").textContent = low.toString();\r\n tfoot.querySelector(\".dg-high\").textContent = high.toString();\r\n tfoot.querySelector(\".dg-total\").textContent = this.totalRecords();\r\n }\r\n\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n totalRecords() {\r\n if (this.options.server) {\r\n return this.meta[this.options.serverParams.metaFilteredKey] || 0;\r\n }\r\n return this.data.length;\r\n }\r\n}\r\n\r\nexport default DataGrid;\r\n", "class BasePlugin {\r\n /**\r\n * Could be changed due to minification process\r\n * It's better to set the actual class name in the plugin itself\r\n */\r\n static get pluginName() {\r\n return this.name;\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static connected(grid) {\r\n grid;\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static disconnected(grid) {\r\n grid;\r\n }\r\n}\r\n\r\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n $$,\r\n addClass,\r\n asElement,\r\n dispatch,\r\n getAttribute,\r\n hasClass,\r\n off,\r\n on,\r\n removeAttribute,\r\n removeClass,\r\n setAttribute,\r\n} from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Allows to resize columns\r\n */\r\nclass ColumnResizer extends BasePlugin {\r\n static get pluginName() {\r\n return \"ColumnResizer\";\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static connected(grid) {\r\n grid.isResizing = false;\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static renderResizer(grid, resizeLabel) {\r\n const table = grid.table;\r\n const cols = $$(\"thead tr.dg-head-columns th\", grid);\r\n\r\n cols.forEach((col) => {\r\n if (hasClass(col, \"dg-not-resizable\")) {\r\n return;\r\n }\r\n // Create a resizer element\r\n const resizer = document.createElement(\"div\");\r\n addClass(resizer, \"dg-resizer\");\r\n resizer.ariaLabel = resizeLabel;\r\n\r\n // Add a resizer element to the column\r\n col.appendChild(resizer);\r\n\r\n // Handle resizing\r\n let startX = 0;\r\n let startW = 0;\r\n let remainingSpace = 0;\r\n let max = 0;\r\n\r\n const mouseMoveHandler = (e) => {\r\n if (e.clientX > max) {\r\n return;\r\n }\r\n const newWidth = startW + (e.clientX - startX);\r\n if (col.dataset.minWidth && newWidth > parseInt(col.dataset.minWidth)) {\r\n setAttribute(col, \"width\", newWidth);\r\n }\r\n };\r\n\r\n // When user releases the mouse, remove the existing event listeners\r\n const mouseUpHandler = () => {\r\n grid.log(\"resized column\");\r\n\r\n grid.isResizing = false;\r\n removeClass(resizer, \"dg-resizer-active\");\r\n if (grid.options.reorder) {\r\n col.draggable = true;\r\n }\r\n col.style.overflow = \"hidden\";\r\n\r\n off(document, \"mousemove\", mouseMoveHandler);\r\n off(document, \"mouseup\", mouseUpHandler);\r\n\r\n dispatch(grid, \"columnResized\", {\r\n col: getAttribute(col, \"field\"),\r\n width: getAttribute(col, \"width\"),\r\n });\r\n };\r\n\r\n // Otherwise it could sort the col\r\n on(resizer, \"click\", (e) => {\r\n e.stopPropagation();\r\n });\r\n\r\n on(resizer, \"mousedown\", (e) => {\r\n e.stopPropagation();\r\n\r\n grid.isResizing = true;\r\n\r\n const target = asElement(e.target);\r\n const currentCols = $$(\".dg-head-columns th\", grid);\r\n const visibleCols = Array.from(currentCols).filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columns = Array.from(visibleCols);\r\n const columnIndex = columns.findIndex((column) => column == target.parentNode);\r\n grid.log(\"resize column\");\r\n\r\n addClass(resizer, \"dg-resizer-active\");\r\n\r\n // Make sure we don't drag it\r\n removeAttribute(col, \"draggable\");\r\n\r\n // Allow overflow when resizing\r\n col.style.overflow = \"visible\";\r\n\r\n // Show full column height (-1 to avoid scrollbar)\r\n resizer.style.height = table.offsetHeight - 1 + \"px\";\r\n\r\n // Register initial data\r\n startX = e.clientX;\r\n startW = col.offsetWidth;\r\n\r\n remainingSpace = (visibleCols.length - columnIndex) * 30;\r\n max = elementOffset(target).left + grid.offsetWidth - remainingSpace;\r\n\r\n // Remove width from next columns to allow auto layout\r\n setAttribute(col, \"width\", startW);\r\n for (let j = 0; j < visibleCols.length; j++) {\r\n if (j > columnIndex) {\r\n removeAttribute(cols[j], \"width\");\r\n }\r\n }\r\n\r\n // Attach handlers\r\n on(document, \"mousemove\", mouseMoveHandler);\r\n on(document, \"mouseup\", mouseUpHandler);\r\n });\r\n });\r\n }\r\n}\r\n\r\nexport default ColumnResizer;\r\n", "/**\r\n * @param {HTMLElement} el\r\n * @param {String} type\r\n * @param {String} prop\r\n * @returns {HTMLElement}\r\n */\r\nexport default function getParentElement(el, type, prop = \"nodeName\") {\r\n let parent = el;\r\n while (parent[prop] != type) {\r\n parent = parent.parentElement;\r\n }\r\n return parent;\r\n}\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport getParentElement from \"../utils/getParentElement.js\";\r\nimport { asAnyElement, find, off, on, removeAttribute, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Create a right click menu on the headers\r\n */\r\nclass ContextMenu extends BasePlugin {\r\n static get pluginName() {\r\n return \"ContextMenu\";\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static disconnected(grid) {\r\n if (grid.headerRow) {\r\n grid.headerRow.oncontextmenu = null;\r\n }\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static attachContextMenu(grid) {\r\n on(grid.headerRow, \"contextmenu\", (ev) => {\r\n ContextMenu.showContextMenu(grid, ev);\r\n });\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static showContextMenu(grid, e) {\r\n e.preventDefault();\r\n\r\n const target = getParentElement(e.target, \"THEAD\");\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n const menu = find(grid, \".dg-menu\");\r\n const rect = target.getBoundingClientRect();\r\n let x = e.clientX - rect.left;\r\n const y = e.clientY - rect.top;\r\n\r\n menu.style.top = `${y}px`;\r\n menu.style.left = `${x}px`;\r\n\r\n removeAttribute(menu, \"hidden\");\r\n if (x + 150 > rect.width) {\r\n x -= menu.offsetWidth;\r\n menu.style.left = `${x}px`;\r\n }\r\n\r\n const documentClickHandler = (e) => {\r\n if (!menu.contains(e.target)) {\r\n setAttribute(menu, \"hidden\", \"\");\r\n off(document, \"click\", documentClickHandler);\r\n }\r\n };\r\n on(document, \"click\", documentClickHandler);\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static createMenu(grid) {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n const menu = find(grid, \".dg-menu\");\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\r\n const field = col.field;\r\n const li = document.createElement(\"li\");\r\n const label = document.createElement(\"label\");\r\n const checkbox = document.createElement(\"input\");\r\n setAttribute(checkbox, \"type\", \"checkbox\");\r\n setAttribute(checkbox, \"data-name\", col.field);\r\n if (!col.hidden) {\r\n checkbox.checked = true;\r\n }\r\n on(checkbox, \"change\", (e) => {\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n const t = asAnyElement(e.target);\r\n if (t.checked) {\r\n grid.showColumn(field);\r\n } else {\r\n // Prevent hidding last\r\n if (grid.visibleColumns().length <= 1) {\r\n // Restore checkbox value\r\n t.checked = true;\r\n return;\r\n }\r\n grid.hideColumn(field);\r\n }\r\n });\r\n\r\n const text = document.createTextNode(col.title);\r\n\r\n label.appendChild(checkbox);\r\n label.appendChild(text);\r\n\r\n li.appendChild(label);\r\n menu.appendChild(li);\r\n });\r\n }\r\n}\r\n\r\nexport default ContextMenu;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport getParentElement from \"../utils/getParentElement.js\";\r\nimport { asElement, dispatch, findAll, getAttribute, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Allows to move headers\r\n */\r\nclass DraggableHeaders extends BasePlugin {\r\n static get pluginName() {\r\n return \"DraggableHeaders\";\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n * @param {HTMLTableRowElement} th\r\n */\r\n static makeHeaderDraggable(grid, th) {\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.isResizing && e.preventDefault) {\r\n e.preventDefault();\r\n return;\r\n }\r\n if (!(e.target instanceof HTMLElement)) {\r\n return;\r\n }\r\n grid.log(\"reorder col\");\r\n e.dataTransfer.effectAllowed = \"move\";\r\n e.dataTransfer.setData(\"text/plain\", e.target.getAttribute(\"aria-colindex\"));\r\n });\r\n on(th, \"dragover\", (e) => {\r\n if (e.preventDefault) {\r\n e.preventDefault();\r\n }\r\n e.dataTransfer.dropEffect = \"move\";\r\n return false;\r\n });\r\n on(th, \"drop\", (e) => {\r\n if (e.stopPropagation) {\r\n e.stopPropagation();\r\n }\r\n const t = asElement(e.target);\r\n const target = getParentElement(t, \"TH\");\r\n const index = parseInt(e.dataTransfer.getData(\"text/plain\"));\r\n const targetIndex = parseInt(target.getAttribute(\"aria-colindex\"));\r\n\r\n if (index === targetIndex) {\r\n grid.log(\"reordered col stayed the same\");\r\n return;\r\n }\r\n grid.log(\"reordered col from \" + index + \" to \" + targetIndex);\r\n\r\n const offset = grid.startColIndex();\r\n const tmp = grid.options.columns[index - offset];\r\n grid.options.columns[index - offset] = grid.options.columns[targetIndex - offset];\r\n grid.options.columns[targetIndex - offset] = tmp;\r\n\r\n const swapNodes = (selector, el1) => {\r\n const rowIndex = el1.parentNode.getAttribute(\"aria-rowindex\");\r\n const el2 = grid.querySelector(selector + \" tr[aria-rowindex='\" + rowIndex + \"'] [aria-colindex='\" + targetIndex + \"']\");\r\n setAttribute(el1, \"aria-colindex\", targetIndex);\r\n setAttribute(el2, \"aria-colindex\", index);\r\n const newNode = document.createElement(\"th\");\r\n el1.parentNode.insertBefore(newNode, el1);\r\n el2.parentNode.replaceChild(el1, el2);\r\n newNode.parentNode.replaceChild(el2, newNode);\r\n };\r\n\r\n // Swap all rows in header and body\r\n findAll(grid, \"thead th[aria-colindex='\" + index + \"']\").forEach((el1) => {\r\n swapNodes(\"thead\", el1);\r\n });\r\n findAll(grid, 'tbody td[aria-colindex=\"' + index + '\"]').forEach((el1) => {\r\n swapNodes(\"tbody\", el1);\r\n });\r\n\r\n // Updates the columns\r\n grid.options.columns = findAll(grid, \"thead tr.dg-head-columns th[field]\").map((th) =>\r\n grid.options.columns.find((c) => c.field == getAttribute(th, \"field\"))\r\n );\r\n\r\n dispatch(grid, \"columnReordered\", {\r\n col: tmp.field,\r\n from: index,\r\n to: targetIndex,\r\n });\r\n return false;\r\n });\r\n }\r\n}\r\n\r\nexport default DraggableHeaders;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\n\r\n/**\r\n * Allows to paginate with horizontal swipe motions\r\n */\r\nclass TouchSupport extends BasePlugin {\r\n static get pluginName() {\r\n return \"TouchSupport\";\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static connected(grid) {\r\n grid.touch = null;\r\n grid.touchstart = TouchSupport.touchstart.bind(grid);\r\n grid.touchmove = TouchSupport.touchmove.bind(grid);\r\n grid.addEventListener(\"touchstart\", grid.touchstart, { passive: true });\r\n grid.addEventListener(\"touchmove\", grid.touchmove, { passive: true });\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static disconnected(grid) {\r\n grid.removeEventListener(\"touchstart\", grid.touchstart);\r\n grid.removeEventListener(\"touchmove\", grid.touchmove);\r\n }\r\n\r\n static touchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n /**\r\n * @this {import(\"../data-grid\").default}\r\n */\r\n static touchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const xDiff = this.touch.clientX - e.touches[0].clientX;\r\n const yDiff = this.touch.clientY - e.touches[0].clientY;\r\n\r\n if (Math.abs(xDiff) > Math.abs(yDiff)) {\r\n if (xDiff > 0) {\r\n this.getNext();\r\n } else {\r\n this.getPrev();\r\n }\r\n }\r\n this.touch = null;\r\n }\r\n}\r\n\r\nexport default TouchSupport;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n static get pluginName() {\r\n return \"SelectableRows\";\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static disconnected(grid) {\r\n if (grid.selectAll) {\r\n grid.selectAll.removeEventListener(\"change\", grid.toggleSelectAll);\r\n }\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n * @param {String} key Return a specific key (eg: id) instead of the whole row\r\n * @returns {Array}\r\n */\r\n static getSelection(grid, key = null) {\r\n let selectedData = [];\r\n\r\n Array.from(grid.querySelectorAll(\"tbody .dg-selectable input:checked\")).forEach((checkbox) => {\r\n if (!(checkbox instanceof HTMLElement)) {\r\n return;\r\n }\r\n const idx = parseInt(checkbox.dataset.id);\r\n const item = grid.data[idx - 1];\r\n if (!item) {\r\n console.warn(`Item ${idx} not found`);\r\n }\r\n if (key) {\r\n selectedData.push(item[key]);\r\n } else {\r\n selectedData.push(item);\r\n }\r\n });\r\n return selectedData;\r\n }\r\n\r\n /**\r\n * Uncheck box if hidden and visible only\r\n * @param {import(\"../data-grid\").default} grid\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n static clearCheckboxes(grid, tbody) {\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n tbody.querySelectorAll(\"tr[hidden] .dg-selectable input\").forEach((input) => {\r\n if (input instanceof HTMLInputElement) {\r\n input.checked = false;\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n static createHeaderCol(grid, tr) {\r\n let th = document.createElement(\"th\");\r\n th.setAttribute(\"scope\", \"col\");\r\n th.setAttribute(\"role\", \"columnheader button\");\r\n th.setAttribute(\"aria-colindex\", \"1\");\r\n th.classList.add(...[\"dg-selectable\", \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n grid.selectAll = document.createElement(\"input\");\r\n grid.selectAll.type = \"checkbox\";\r\n grid.selectAll.classList.add(\"dg-select-all\");\r\n\r\n grid.toggleSelectAll = this.toggleSelectAll.bind(grid);\r\n grid.selectAll.addEventListener(\"change\", grid.toggleSelectAll);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(grid.selectAll);\r\n\r\n th.appendChild(label);\r\n\r\n th.setAttribute(\"width\", \"40\");\r\n tr.appendChild(th);\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n static createFilterCol(grid, tr) {\r\n let th = document.createElement(\"th\");\r\n th.setAttribute(\"role\", \"columnheader button\");\r\n th.setAttribute(\"aria-colindex\", \"1\");\r\n th.classList.add(\"dg-selectable\");\r\n th.tabIndex = 0;\r\n\r\n let label = document.createElement(\"label\");\r\n th.appendChild(label);\r\n tr.appendChild(th);\r\n }\r\n\r\n /**\r\n * Handles the selectAll checkbox when any other .dg-selectable checkbox is checked.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {import(\"../data-grid\").default} grid\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n static shouldSelectAll(grid, tbody) {\r\n if (!grid.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", (e) => {\r\n if (e.target instanceof HTMLInputElement) {\r\n if (!e.target.closest(\".dg-selectable\")) {\r\n return;\r\n }\r\n const totalCheckboxes = grid.querySelectorAll(\"tbody .dg-selectable input[type=checkbox]\");\r\n // @ts-ignore\r\n const totalChecked = Array.from(totalCheckboxes).filter((n) => n.checked);\r\n grid.selectAll.checked = totalChecked.length == totalCheckboxes.length;\r\n\r\n dispatch(grid, \"rowsSelected\", {\r\n selection: grid.getSelection(),\r\n });\r\n }\r\n });\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n static createDataCol(grid, tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n td.setAttribute(\"role\", \"gridcell button\");\r\n td.setAttribute(\"aria-colindex\", \"1\");\r\n td.classList.add(\"dg-selectable\");\r\n\r\n // Create input\r\n let selectOne = document.createElement(\"input\");\r\n // Alias row id for easy retrieval in getSelection\r\n selectOne.dataset.id = tr.getAttribute(\"aria-rowindex\");\r\n selectOne.type = \"checkbox\";\r\n // Label need to take full space thanks to css to make the whole cell clickable\r\n let label = document.createElement(\"label\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * Reflect state\r\n * @this {import(\"../data-grid\").default}\r\n */\r\n static toggleSelectAll() {\r\n const visibleOnly = this.options.selectVisibleOnly;\r\n this.querySelectorAll(\"tbody .dg-selectable input\").forEach((cb) => {\r\n if (!(cb instanceof HTMLInputElement)) {\r\n return;\r\n }\r\n if (visibleOnly && !cb.offsetWidth) {\r\n return;\r\n }\r\n cb.checked = this.selectAll.checked;\r\n });\r\n\r\n dispatch(this, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n }\r\n}\r\n\r\nexport default SelectableRows;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Support for fixed table height\r\n *\r\n * We should add a fake row to push the footer down in case we don't have enough rows\r\n */\r\nclass FixedHeight extends BasePlugin {\r\n static get pluginName() {\r\n return \"FixedHeight\";\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static computeDefaultHeight(grid) {\r\n // Wait until height is fully computed\r\n requestAnimationFrame(() => {\r\n grid.defaultHeight = grid.querySelector(\"table\").offsetHeight;\r\n\r\n // If we have a fixed height, make sure we have overflowY set\r\n if (grid.style.height) {\r\n grid.style.overflowY = \"auto\";\r\n }\r\n\r\n if (grid.options.autoheight) {\r\n // Adjust height so that it fits our table size\r\n if (grid.style.height) {\r\n grid.style.height = grid.defaultHeight + \"px\";\r\n }\r\n // If our min height is too big, adjust value\r\n if (grid.style.minHeight && parseInt(grid.style.minHeight) > grid.defaultHeight) {\r\n grid.style.minHeight = grid.defaultHeight + \"px\";\r\n }\r\n }\r\n });\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static createFakeRow(grid) {\r\n const tbody = grid.querySelector(\"tbody\");\r\n let tr = document.createElement(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n tr.classList.add(\"dg-fake-row\");\r\n tr.tabIndex = 0;\r\n tbody.appendChild(tr);\r\n }\r\n\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static updateFakeRow(grid) {\r\n if (!grid.style.height) {\r\n return;\r\n }\r\n // On last page, adjust height if using fixed height\r\n let fakeRow = grid.querySelector(\".dg-fake-row\");\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // Check if we are below set height\r\n if (parseInt(grid.style.height) > grid.querySelector(\"tbody\").offsetHeight) {\r\n const max = grid.options.perPage * grid.rowHeight;\r\n const visibleRows = grid.querySelectorAll(\"tbody tr:not([hidden])\").length;\r\n const fakeHeight = visibleRows > 1 ? max - visibleRows * grid.rowHeight : max;\r\n setAttribute(fakeRow, \"height\", fakeHeight);\r\n fakeRow.removeAttribute(\"hidden\");\r\n } else {\r\n fakeRow.removeAttribute(\"height\");\r\n }\r\n }\r\n}\r\n\r\nexport default FixedHeight;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport getTextWidth from \"../utils/getTextWidth.js\";\r\nimport { getAttribute, hasAttribute, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Allows to resize columns\r\n */\r\nclass AutosizeColumn extends BasePlugin {\r\n static get pluginName() {\r\n return \"AutosizeColumn\";\r\n }\r\n /**\r\n * Autosize col based on column data\r\n * @param {import(\"../data-grid\").default} grid\r\n * @param {HTMLTableCellElement} th\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Number} min\r\n * @param {Number} max\r\n * @returns {Number}\r\n */\r\n static autosizeColumn(grid, th, column, min, max) {\r\n if (hasAttribute(th, \"width\")) {\r\n return getAttribute(th, \"width\");\r\n }\r\n if (!grid.data.length) {\r\n return;\r\n }\r\n let v = grid.data[0][column.field].toString();\r\n let v2 = grid.data[grid.data.length - 1][column.field].toString();\r\n if (v2.length > v.length) {\r\n v = v2;\r\n }\r\n let width = 0;\r\n if (v.length <= 6) {\r\n width = min;\r\n } else if (v.length > 50) {\r\n width = max;\r\n } else {\r\n // Add some extra room to have some spare space\r\n width = getTextWidth(v + \"0000\", th);\r\n }\r\n if (width < min) {\r\n width = min;\r\n }\r\n setAttribute(th, \"width\", width);\r\n return width;\r\n }\r\n}\r\n\r\nexport default AutosizeColumn;\r\n", "/**\r\n * @param {Function} func\r\n * @param {Number} timeout\r\n * @returns {Function}\r\n */\r\nexport default function debounce(func, timeout = 300) {\r\n let timer;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n func.apply(this, args);\r\n }, timeout);\r\n };\r\n}\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport debounce from \"../utils/debounce.js\";\r\nimport { addClass, findAll, removeClass } from \"../utils/shortcuts.js\";\r\n\r\nfunction sortByPriority(list) {\r\n return Array.from(list).sort(function (a, b) {\r\n a = parseInt(a.dataset.responsive) || 1;\r\n b = parseInt(b.dataset.responsive) || 1;\r\n if (a === b) {\r\n b++;\r\n }\r\n return b - a;\r\n });\r\n}\r\n\r\n/**\r\n * @type {ResizeObserverCallback}\r\n */\r\n//@ts-ignore\r\nconst callback = debounce((entries) => {\r\n for (const entry of entries) {\r\n /**\r\n * @type {import(\"../data-grid\").default}\r\n */\r\n // @ts-ignore\r\n const grid = entry.target;\r\n const table = grid.table;\r\n // check inlineSize (width) and not blockSize (height)\r\n const contentBoxSize = Array.isArray(entry.contentBoxSize) ? entry.contentBoxSize[0] : entry.contentBoxSize;\r\n const size = parseInt(contentBoxSize.inlineSize);\r\n const tableWidth = table.offsetWidth;\r\n const realTableWidth = findAll(grid.headerRow, \"th\").reduce((result, th) => {\r\n return result + th.offsetWidth;\r\n }, 0);\r\n const diff = (realTableWidth || tableWidth) - size - 1;\r\n const minWidth = 50;\r\n // We have an array with the columns to show/hide are in order, most important first\r\n const headerCols = sortByPriority(\r\n findAll(grid.headerRow, \"th[field]\")\r\n .reverse()\r\n .filter((col) => {\r\n return col.dataset.responsive !== \"0\";\r\n })\r\n );\r\n let changed = false;\r\n\r\n // grid.log(`table is ${tableWidth}/${realTableWidth} and available size is ${size}`);\r\n\r\n // The table is too big\r\n if (diff > 0) {\r\n let remaining = diff;\r\n let cols = headerCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\") && col.hasAttribute(\"data-responsive\");\r\n });\r\n if (cols.length === 0) {\r\n cols = headerCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n // Always keep one column\r\n if (cols.length === 1) {\r\n return;\r\n }\r\n }\r\n cols.forEach((col) => {\r\n if (remaining < 0) {\r\n return;\r\n }\r\n\r\n const colWidth = col.offsetWidth;\r\n const field = col.getAttribute(\"field\");\r\n if (!field) {\r\n return;\r\n }\r\n col.dataset.baseWidth = col.offsetWidth;\r\n grid.hideColumn(field, false);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n const requiredWidth =\r\n headerCols\r\n .filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n })\r\n .reduce((result, col) => {\r\n return result + parseInt(col.dataset.minWidth);\r\n }, 0) + minWidth; // Add an offset so that inserting column is smoother\r\n\r\n // Compute available width to insert columns\r\n let remaining = size - requiredWidth;\r\n // Do we have any hidden column that we can restore ?\r\n // Reverse the array to restore the columns in the proper order\r\n headerCols\r\n .slice()\r\n .reverse()\r\n .filter((col) => {\r\n return col.hasAttribute(\"hidden\");\r\n })\r\n .forEach((col) => {\r\n if (remaining < minWidth) {\r\n return;\r\n }\r\n const colWidth = parseInt(col.dataset.minWidth);\r\n\r\n // We need to have enough space to restore it\r\n if (size < colWidth + requiredWidth) {\r\n remaining = -1; // break loop to keep restoring in order\r\n return;\r\n }\r\n\r\n const field = col.getAttribute(\"field\");\r\n if (!field) {\r\n return;\r\n }\r\n grid.showColumn(field, false);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n }\r\n\r\n // Check footer\r\n const footer = grid.table.querySelector(\"tfoot\");\r\n if (footer.offsetWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (footer.offsetWidth < size + 200) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n grid.table.style.visibility = \"visible\";\r\n }\r\n}, 100);\r\nconst resizeObserver = new ResizeObserver(callback);\r\n\r\n/**\r\n * Responsive data grid\r\n */\r\nclass ResponsiveGrid extends BasePlugin {\r\n static get pluginName() {\r\n return \"ResponsiveGrid\";\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static connected(grid) {\r\n if (grid.options.responsive) {\r\n this.observe(grid);\r\n }\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static disconnected(grid) {\r\n this.unobserve(grid);\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static observe(grid) {\r\n if (!grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(grid);\r\n grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n /**\r\n * @param {import(\"../data-grid\").default} grid\r\n */\r\n static unobserve(grid) {\r\n resizeObserver.unobserve(grid);\r\n grid.style.display = \"unset\";\r\n grid.style.overflowX = \"unset\";\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\nimport ColumnResizer from \"./src/plugins/column-resizer.js\";\r\nimport ContextMenu from \"./src/plugins/context-menu.js\";\r\nimport DraggableHeaders from \"./src/plugins/draggable-headers.js\";\r\nimport TouchSupport from \"./src/plugins/touch-support.js\";\r\nimport SelectableRows from \"./src/plugins/selectable-rows.js\";\r\nimport FixedHeight from \"./src/plugins/fixed-height.js\";\r\nimport AutosizeColumn from \"./src/plugins/autosize-column.js\";\r\nimport ResponsiveGrid from \"./src/plugins/responsive-grid.js\";\r\n\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu: ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n});\r\n\r\ncustomElements.define(\"data-grid\", DataGrid);\r\n\r\nexport default DataGrid;\r\n"],
"mappings": "sWAIe,SAARA,EAA0BC,EAAK,CACpC,OAAOA,EAAI,YAAY,EAAE,QAAQ,oBAAqB,CAACC,EAAGC,IAAQA,EAAI,YAAY,CAAC,CACrF,CCDe,SAARC,EAA+BC,EAAG,CAEvC,GAAIA,IAAM,OACR,MAAO,GAET,GAAIA,IAAM,QACR,MAAO,GAGT,GAAIA,IAAM,IAAMA,IAAM,OACpB,OAAO,KAGT,GAAIA,IAAM,OAAOA,CAAC,EAAE,SAAS,EAC3B,OAAO,OAAOA,CAAC,EAGjB,GAAIA,IAAMA,EAAE,QAAQ,GAAG,IAAM,GAAKA,EAAE,QAAQ,GAAG,IAAM,GACnD,GAAI,CAEF,OAAIA,EAAE,QAAQ,GAAG,IAAM,KACrBA,EAAIA,EAAE,QAAQ,KAAM,GAAG,GAElB,KAAK,MAAM,mBAAmBA,CAAC,CAAC,CACzC,OAAQC,EAAN,CACA,eAAQ,IAAI,mBAAqBD,CAAC,EAC3B,CAAC,CACV,CAEF,OAAOA,CACT,CC9BA,IAAME,GAAwB,CAC5B,SACA,QACA,aACA,YACA,aACA,WACA,aACA,WACA,aACA,UACA,YACA,YACA,aACA,aACA,WACF,EAOA,SAASC,GAAYC,EAAM,CACzB,OAAIF,GAAsB,SAASE,CAAI,EAC9B,CAAE,QAAS,EAAK,EAElB,CAAC,CACV,CAOO,SAASC,EAAaC,EAAIC,EAAM,CACrC,OAAOD,EAAG,aAAaC,CAAI,CAC7B,CAOO,SAASC,EAAaF,EAAIC,EAAM,CACrC,OAAOD,EAAG,aAAaC,CAAI,CAC7B,CAQO,SAASE,EAAaH,EAAIC,EAAMG,EAAGC,EAAQ,GAAO,CACnDA,GAASH,EAAaF,EAAIC,CAAI,GACl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,GACA,YAAAC,GACA,eAAAC,GACA,eAAAC,EACF,CAAC,EAED,eAAe,OAAO,YAAaR,CAAQ,EAE3C,IAAOA,GAAQA",
"names": ["camelize", "str", "m", "chr", "normalizeData", "v", "e", "supportedPassiveTypes", "passiveOpts", "type", "getAttribute", "el", "name", "hasAttribute", "setAttribute", "v", "check", "removeAttribute", "on", "listener", "off", "dispatch", "el", "name", "data", "bubbles", "opts", "hasClass", "addClass", "removeClass", "$", "selector", "base", "$$", "find", "el", "findAll", "asElement", "asAnyElement", "BaseElement", "options", "opt", "v", "setAttribute", "data", "__spreadValues", "key", "normalizeData", "message", "getAttribute", "event", "template", "dispatch", "attributeName", "oldValue", "newValue", "_a", "isOption", "transformer", "camelize", "base_element_default", "addSelectOption", "el", "value", "label", "checked", "opt", "appendParamsToUrl", "url", "params", "key", "k", "convertArray", "v", "elementOffset", "el", "rect", "scrollLeft", "scrollTop", "getTextWidth", "text", "el", "withPadding", "styles", "fontWeight", "fontSize", "fontFamily", "padding", "paddingLeft", "paddingRight", "context", "metrics", "interpolate", "str", "data", "$1", "$2", "randstr", "prefix", "plugins", "labels", "DataGrid", "base_element_default", "_a", "_b", "_c", "setAttribute", "randstr", "attr", "camelize", "v", "list", "el", "definition", "columns", "cols", "key", "col", "item", "convertArray", "val", "updatePage", "elementOffset", "addSelectOption", "find", "plugin", "field", "found", "prop", "c", "render", "dispatch", "visibleOnly", "len", "tr", "row", "th", "fieldName", "value", "cb", "needRender", "resolve", "response", "err", "event", "filters", "input", "name", "sort", "stack", "itemA", "itemB", "a", "b", "valA", "valB", "reject", "url", "params", "appendParamsToUrl", "sortedColumn", "thead", "tfoot", "td", "availableWidth", "colMaxWidth", "idx", "sampleTh", "totalWidth", "column", "colIdx", "computedWidth", "getTextWidth", "w", "colAvailableWidth", "visibleCols", "findAll", "lastCol", "removeAttribute", "actionsTh", "diff", "hasClass", "asElement", "actualWidth", "minWidth", "newWidth", "sortableRow", "relatedTh", "e", "tbody", "i", "ev", "actionsToggle", "action", "button", "interpolate", "actionHandler", "prev", "total", "p", "index", "high", "low", "data_grid_default", "BasePlugin", "grid", "base_plugin_default", "ColumnResizer", "base_plugin_default", "grid", "resizeLabel", "table", "cols", "$$", "col", "hasClass", "resizer", "addClass", "startX", "startW", "remainingSpace", "max", "mouseMoveHandler", "e", "newWidth", "setAttribute", "mouseUpHandler", "removeClass", "off", "dispatch", "getAttribute", "on", "target", "asElement", "currentCols", "visibleCols", "columnIndex", "column", "removeAttribute", "elementOffset", "j", "column_resizer_default", "getParentElement", "el", "type", "prop", "parent", "ContextMenu", "base_plugin_default", "grid", "on", "ev", "target", "getParentElement", "menu", "find", "rect", "x", "y", "removeAttribute", "documentClickHandler", "e", "setAttribute", "off", "col", "field", "li", "label", "checkbox", "t", "asAnyElement", "text", "context_menu_default", "DraggableHeaders", "base_plugin_default", "grid", "th", "on", "e", "t", "asElement", "target", "getParentElement", "index", "targetIndex", "offset", "tmp", "swapNodes", "selector", "el1", "rowIndex", "el2", "setAttribute", "newNode", "findAll", "c", "getAttribute", "dispatch", "draggable_headers_default", "TouchSupport", "base_plugin_default", "grid", "e", "xDiff", "yDiff", "touch_support_default", "SelectableRows", "base_plugin_default", "grid", "key", "selectedData", "checkbox", "idx", "item", "tbody", "input", "tr", "th", "label", "e", "totalCheckboxes", "totalChecked", "n", "dispatch", "td", "selectOne", "visibleOnly", "cb", "selectable_rows_default", "FixedHeight", "base_plugin_default", "grid", "tbody", "tr", "setAttribute", "fakeRow", "max", "visibleRows", "fakeHeight", "fixed_height_default", "AutosizeColumn", "base_plugin_default", "grid", "th", "column", "min", "max", "hasAttribute", "getAttribute", "v", "v2", "width", "getTextWidth", "setAttribute", "autosize_column_default", "debounce", "func", "timeout", "timer", "args", "sortByPriority", "list", "a", "b", "callback", "debounce", "entries", "entry", "grid", "table", "contentBoxSize", "size", "tableWidth", "diff", "findAll", "result", "th", "minWidth", "headerCols", "col", "changed", "remaining", "cols", "colWidth", "field", "requiredWidth", "footer", "addClass", "removeClass", "resizeObserver", "ResponsiveGrid", "base_plugin_default", "responsive_grid_default", "data_grid_default", "column_resizer_default", "context_menu_default", "draggable_headers_default", "touch_support_default", "selectable_rows_default", "fixed_height_default", "autosize_column_default", "responsive_grid_default"]
}