From 8c9909b8891237cd3ab7a859dbcb877cbc3a6b46 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Mon, 26 Feb 2024 17:19:09 -0500 Subject: [PATCH 1/3] Added support for select elements as filters, spinner, and minor fixes. --- data-grid.js | 2 + dist/data-grid.css | 14 +- dist/data-grid.css.map | 2 +- dist/data-grid.js | 98 +++++-- dist/data-grid.js.map | 6 +- dist/data-grid.min.css | 4 +- dist/data-grid.min.css.map | 2 +- dist/data-grid.min.js | 15 +- dist/data-grid.min.js.map | 8 +- package-lock.json | 457 +++++++++++++++++---------------- package.json | 2 +- readme.md | 119 +++++---- scss/_core.scss | 19 +- scss/_responsive.scss | 11 +- src/data-grid.js | 79 ++++-- src/plugins/spinner-support.js | 35 +++ 16 files changed, 532 insertions(+), 341 deletions(-) create mode 100644 src/plugins/spinner-support.js diff --git a/data-grid.js b/data-grid.js index dee7f18..f79c5cc 100644 --- a/data-grid.js +++ b/data-grid.js @@ -10,6 +10,7 @@ import AutosizeColumn from "./src/plugins/autosize-column.js"; import ResponsiveGrid from "./src/plugins/responsive-grid.js"; import RowActions from "./src/plugins/row-actions.js"; import EditableColumn from "./src/plugins/editable-column.js"; +import SpinnerSupport from "./src/plugins/spinner-support.js"; // Using shorthand property names // This make them reserved and keys will be preserved @@ -25,6 +26,7 @@ DataGrid.registerPlugins({ ResponsiveGrid, RowActions, EditableColumn, + SpinnerSupport }); // Prevent errors if included multiple times diff --git a/dist/data-grid.css b/dist/data-grid.css index 411ac58..5514127 100644 --- a/dist/data-grid.css +++ b/dist/data-grid.css @@ -73,6 +73,9 @@ data-grid::-webkit-scrollbar-thumb { data-grid::-webkit-scrollbar-thumb:hover { background: var(--scroller-thumb-hover); } +data-grid[class=""] > table[role=grid] tr.dg-head-columns, data-grid:not([class]) > table[role=grid] tr.dg-head-columns, data-grid.dg-loading > table[role=grid] tr.dg-head-columns { + display: none; +} data-grid img { border: none; height: auto; @@ -265,10 +268,10 @@ data-grid button:disabled { pointer-events: none; } data-grid thead tr:nth-child(2) th { - padding: 0; + padding: 0 2px 0 0; background-color: transparent; } -data-grid thead tr:nth-child(2) th input { +data-grid thead tr:nth-child(2) th > * { width: 100%; border-radius: 0; margin: 0; @@ -630,7 +633,6 @@ data-grid .dg-responsive-table th { left: 0; padding: var(--padding); width: calc(100% - var(--responsive-width) - var(--padding) * 4); - white-space: nowrap; content: attr(data-name); display: block; font-weight: bold; @@ -685,6 +687,12 @@ data-grid .dg-responsive-table th { data-grid[responsive] .dg-head-filters th.dg-selectable label::before { content: "Column Filters"; } + data-grid[responsive] tfoot .dg-page-nav { + min-width: revert; + } + data-grid[data-responsive=true] tfoot .dg-page-nav { + min-width: revert; + } } /*# sourceMappingURL=data-grid.css.map */ \ No newline at end of file diff --git a/dist/data-grid.css.map b/dist/data-grid.css.map index e6402ab..8ccb07c 100644 --- a/dist/data-grid.css.map +++ b/dist/data-grid.css.map @@ -1 +1 @@ -{"version":3,"sources":["../scss/_core.scss","data-grid.css","../scss/_rtl.scss","../scss/_menu.scss","../scss/_actions.scss","../scss/_resizer.scss","../scss/_responsive.scss"],"names":[],"mappings":"AAAA;;;EAAA;AAKA;EACE;IACE,UAAA;ECAF;EDGA;IACE,YAAA;ECDF;AACF;ADIA;EACE,iBAAA;EACA,oBAAA;EACA,mBAAA;EACA,2BAAA;EACA,wCAAA;EACA,gDAAA;EACA,8BAAA;EAEA,0BAAA;EACA,gDAAA;EACA,uCAAA;EACA,8CAAA;EACA,qDAAA;EACA,4CAAA;EACA,yBAAA;EACA,mDAAA;EACA,qCAAA;EACA,2CAAA;EACA,eAAA;EACA,wBAAA;EACA,2BAAA;EACA,uBAAA;EAEA,8BAAA;EACA,8BAAA;EACA,+BAAA;EACA,yCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EAEA,cAAA;EACA,gBAAA;EACA,kBAAA;ACLF;ADQE;EACE,uBA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BN;AKjjBI;EACE,cAAA;ALmjBN;;AK7iBA;EAGI;IACE,aAAA;EL8iBJ;EK1iBE;IACE,aAAA;EL4iBJ;EK1iBE;IACE,aAAA;EL4iBJ;EKxiBE;;;;;;IAME,cAAA;EL0iBJ;EKtiBE;IACE,aAAA;IASA,iDAAA;ELgiBJ;EKviBI;IACE,YAAA;ELyiBN;EKviBI;IACE,WAAA;ELyiBN;EKjiBI;IACE,UAAA;IACA,0CAAA;ELmiBN;EKjiBI;IACE,YAAA;IACA,gDAAA;IACA,kBAAA;IACA,uEAAA;ELmiBN;EKjiBM;IACE,SAAA;ELmiBR;EKjiBM;IACE,kBAAA;IACA,MAAA;IACA,OAAA;IACA,uBAAA;IACA,gEAAA;IACA,mBAAA;IACA,wBAAA;IACA,cAAA;IACA,iBAAA;IACA,0CAAA;ELmiBR;EKjiBM;IACE,gFAAA;ELmiBR;EK7hBE;IACE,YAAA;IACA,mBAAA;EL+hBJ;EK3hBI;IAEE,UAAA;EL4hBN;EK1hBI;IACE,YAAA;EL4hBN;EK1hBI;IACE,gBAAA;IACA,WAAA;EL4hBN;EK1hBI;IACE,YAAA;EL4hBN;EK1hBI;IACE,qBAAA;IACA,cAAA;EL4hBN;EKzhBE;IACE,yBAAA;EL2hBJ;EKxhBI;IACE,UAAA;IACA,gEAAA;EL0hBN;EKxhBM;IACE,mCAAA;EL0hBR;EKvhBI;IACE,uBAAA;IACA,mBAAA;IACA,UAAA;IACA,yEAAA;ELyhBN;EKthBE;IACE,cAAA;ELwhBJ;EKthBE;IACE,uBAAA;ELwhBJ;EKthBE;IACE,yBAAA;ELwhBJ;AACF","file":"data-grid.css","sourcesContent":["/**\r\n * Data Grid Web component \r\n * https://github.com/lekoala/data-grid\r\n */\r\n\r\n@keyframes dataGridShow {\r\n 0% {\r\n opacity: 1;\r\n }\r\n\r\n 100% {\r\n opacity: 0.5;\r\n }\r\n}\r\n\r\ndata-grid {\r\n --padding: 0.5rem;\r\n --padding-x: 0.75rem;\r\n --padding-y: 0.5rem;\r\n --padding-y-header: 0.75rem;\r\n --padding-half: calc(var(--padding) / 2);\r\n --color-rgb: var(--bs-primary-rgb, 13, 110, 253);\r\n --color: rgb(var(--color-rgb));\r\n\r\n --highlight-color: #fffcee;\r\n --header-background: var(--bs-gray-200, #e9ecef);\r\n --header-color: var(--bs-dark, #212529);\r\n --input-background: var(--bs-body-bg, #ffffff);\r\n --input-border-color: var(--bs-border-color, #e9ecef);\r\n --btn-background: var(--bs-body-bg, #ffffff);\r\n --btn-color: var(--color);\r\n --btn-border-color: var(--bs-border-color, #e9ecef);\r\n --body-bg: var(--bs-body-bg, #212529);\r\n --body-color: var(--bs-body-color, #212529);\r\n --icon-scale: 1;\r\n --border-radius: 0.25rem;\r\n --row-border-color: #f2f2f2;\r\n --responsive-width: 60%;\r\n\r\n --black: var(--bs-black, #000);\r\n --white: var(--bs-white, #fff);\r\n --gray: var(--bs-gray, #6c757d);\r\n --gray-dark: var(--bs-gray-dark, #343a40);\r\n --gray-100: var(--bs-gray-100, #f8f9fa);\r\n --gray-200: var(--bs-gray-200, #e9ecef);\r\n --gray-300: var(--bs-gray-300, #dee2e6);\r\n --gray-400: var(--bs-gray-400, #ced4da);\r\n --gray-500: var(--bs-gray-500, #adb5bd);\r\n --gray-600: var(--bs-gray-600, #6c757d);\r\n --gray-700: var(--bs-gray-700, #495057);\r\n --gray-800: var(--bs-gray-800, #343a40);\r\n --gray-900: var(--bs-gray-900, #212529);\r\n\r\n display: block;\r\n min-height: 6rem;\r\n position: relative;\r\n\r\n // When used with fixed height, have a nice scrollbar\r\n & {\r\n --scroller-color: 0, 0%;\r\n --scroller-color-lightness: 80%;\r\n --scroller-hover-factor: 0.8;\r\n --scroller-thumb: hsl(var(--scroller-color), var(--scroller-color-lightness));\r\n /* Replicate hover for webkit */\r\n --scroller-thumb-hover: hsl(var(--scroller-color), calc(var(--scroller-color-lightness) * var(--scroller-hover-factor)));\r\n --scroller-background: transparent;\r\n scrollbar-color: var(--scroller-thumb) var(--scroller-background);\r\n scrollbar-width: thin;\r\n\r\n &::-webkit-scrollbar {\r\n width: 8px;\r\n height: 8px;\r\n }\r\n\r\n &::-webkit-scrollbar-track {\r\n background: transparent;\r\n }\r\n\r\n &::-webkit-scrollbar-thumb {\r\n background: var(--scroller-thumb);\r\n }\r\n\r\n &::-webkit-scrollbar-thumb:hover {\r\n background: var(--scroller-thumb-hover);\r\n }\r\n }\r\n\r\n img {\r\n border: none;\r\n height: auto;\r\n max-width: 100%;\r\n vertical-align: middle;\r\n }\r\n\r\n [hidden] {\r\n display: none;\r\n }\r\n\r\n table {\r\n display: table;\r\n // Table and column widths are set by the widths of table and col elements\r\n // or by the width of the first row of cells. Cells in subsequent rows do not affect column widths.\r\n table-layout: fixed;\r\n width: 100%;\r\n max-width: 100%;\r\n white-space: normal;\r\n // Background needs to be on the table, not on the component in case the table overflows the component\r\n background: var(--header-background);\r\n }\r\n\r\n thead,\r\n tfoot {\r\n background-color: var(--header-background);\r\n color: var(--header-color);\r\n }\r\n\r\n &.dg-loading {\r\n &:not(.dg-initialized) {\r\n\r\n thead,\r\n tfoot {\r\n background: none;\r\n }\r\n }\r\n\r\n tbody {\r\n animation-name: dataGridShow;\r\n animation-timing-function: ease-in;\r\n animation-fill-mode: forwards;\r\n animation-duration: 0.3s; // only triggers after 300ms\r\n pointer-events: none; // disable clicks while loading\r\n }\r\n }\r\n\r\n tr {\r\n position: relative;\r\n }\r\n\r\n th,\r\n td {\r\n empty-cells: show;\r\n padding: var(--padding-y) var(--padding-x);\r\n text-align: left;\r\n\r\n &[tabindex] {\r\n outline: none;\r\n word-break: normal;\r\n }\r\n }\r\n\r\n th {\r\n font-weight: bold;\r\n padding: var(--padding-y-header) var(--padding-x);\r\n }\r\n\r\n // Prevent overflow on headers and cells\r\n th,\r\n td {\r\n position: relative;\r\n overflow: hidden;\r\n text-align: left;\r\n // These two properties keep content on one line\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n\r\n // Use this to allow content to flow over multiple lines\r\n &.dg-wrap {\r\n white-space: normal;\r\n word-break: break-all;\r\n }\r\n }\r\n\r\n // Expand on multiple lines on row click\r\n .dg-expandable {\r\n cursor: pointer;\r\n\r\n &.dg-expanded td {\r\n white-space: normal;\r\n word-break: break-all;\r\n }\r\n }\r\n\r\n .dg-clickable-cell {\r\n margin: 0;\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n cursor: pointer;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n\r\n // Stick headers\r\n // https://css-tricks.com/making-tables-with-sticky-header-and-footers-got-a-bit-easier/\r\n &[sticky] table {\r\n\r\n thead,\r\n tfoot {\r\n z-index: 2;\r\n position: sticky;\r\n margin: 0;\r\n border: 0;\r\n }\r\n\r\n // Use silly value to prevent sub pixel alignment issue\r\n thead {\r\n inset-block-start: -1px;\r\n }\r\n\r\n tfoot {\r\n inset-block-end: -1px;\r\n }\r\n }\r\n\r\n // Pagination icons\r\n .dg-nav-icon,\r\n .dg-skip-icon {\r\n width: 22px;\r\n height: 22px;\r\n box-sizing: border-box;\r\n position: absolute;\r\n display: block;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%) scale(var(--icon-scale, 1));\r\n\r\n &:before,\r\n &:after {\r\n content: \"\";\r\n display: block;\r\n box-sizing: border-box;\r\n position: absolute;\r\n }\r\n }\r\n\r\n .dg-nav-icon::before {\r\n width: 0;\r\n height: 10px;\r\n border-top: 5px solid transparent;\r\n border-bottom: 5px solid transparent;\r\n border-left: 6px solid;\r\n top: 6px;\r\n left: 9px;\r\n }\r\n\r\n .dg-skip-icon {\r\n &::before {\r\n width: 3px;\r\n height: 10px;\r\n background: currentColor;\r\n top: 6px;\r\n left: 14px;\r\n }\r\n\r\n &::after {\r\n width: 0;\r\n height: 10px;\r\n border-top: 5px solid transparent;\r\n border-bottom: 5px solid transparent;\r\n border-left: 6px solid;\r\n top: 6px;\r\n left: 7px;\r\n }\r\n }\r\n\r\n .dg-rotate {\r\n transform: rotate(-180deg);\r\n }\r\n\r\n // Default actions buttons\r\n button {\r\n background-color: var(--btn-background);\r\n border: solid 1px var(--btn-border-color);\r\n border-radius: var(--border-radius);\r\n color: var(--body-color);\r\n height: 2rem;\r\n margin: 0 0.2rem;\r\n padding: 0 0.5rem;\r\n pointer-events: all;\r\n text-align: center;\r\n cursor: pointer;\r\n\r\n &:hover {\r\n opacity: 0.7;\r\n }\r\n\r\n &:disabled:hover {\r\n background-color: inherit;\r\n border-color: inherit;\r\n }\r\n }\r\n\r\n // Form elements\r\n input[type=\"checkbox\"] {\r\n margin: 0;\r\n }\r\n\r\n input:not([type=\"checkbox\"]),\r\n select {\r\n background-color: var(--input-background, \"#fff\");\r\n color: currentColor;\r\n box-sizing: border-box;\r\n border: 1px solid var(--input-border-color, \"#f0f0f0\");\r\n border-radius: var(--border-radius);\r\n height: 2rem;\r\n margin: 0 0.2rem;\r\n padding: 0 var(--padding);\r\n max-width: none;\r\n }\r\n\r\n input:not([type=\"checkbox\"]),\r\n select,\r\n button {\r\n &:focus {\r\n box-shadow: 0 0 0 var(--padding-half) rgba(var(--color-rgb), 0.25);\r\n outline: 0;\r\n }\r\n\r\n &[disabled],\r\n &:disabled {\r\n opacity: 0.35;\r\n pointer-events: none;\r\n }\r\n }\r\n\r\n // Filters (2nd header row)\r\n thead tr:nth-child(2) th {\r\n padding: 0;\r\n background-color: transparent;\r\n\r\n input {\r\n width: 100%;\r\n border-radius: 0;\r\n margin: 0;\r\n\r\n &:focus {\r\n box-shadow: inset 0px 0px 0px 1px var(--color);\r\n }\r\n }\r\n }\r\n\r\n // Editable\r\n tbody td.dg-editable-col {\r\n padding: 0;\r\n height: 0; // it needs a height for height 100%\r\n }\r\n\r\n tbody td input.dg-editable {\r\n width: 100%;\r\n background: transparent;\r\n border: 0;\r\n border-radius: 0;\r\n margin: 0;\r\n box-shadow: none;\r\n height: 100%;\r\n\r\n &:focus {\r\n box-shadow: inset 0px 0px 0px 1px var(--color);\r\n }\r\n }\r\n\r\n // Empty table or error message (don't use :empty as it would create fouc on load)\r\n &.dg-empty {\r\n tbody {\r\n height: 4rem;\r\n position: relative;\r\n\r\n &:before {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n content: attr(data-empty);\r\n transform: translate(-50%, -50%);\r\n opacity: 0.5;\r\n font-size: 1.5rem;\r\n text-align: center;\r\n white-space: nowrap;\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n width: 90%;\r\n }\r\n }\r\n\r\n tr {\r\n &.dg-fake-row {\r\n height: 4rem;\r\n border: none;\r\n }\r\n }\r\n\r\n &.dg-network-error {\r\n table {\r\n color: #842029;\r\n background-color: #f8d7da;\r\n border: 1px solid #f5c2c7;\r\n }\r\n\r\n tbody {\r\n height: auto;\r\n\r\n &:before {\r\n font-size: 2rem;\r\n top: auto;\r\n transform: translate(-50%);\r\n }\r\n\r\n tr:not(.dg-fake-row) {\r\n display: none;\r\n }\r\n }\r\n }\r\n\r\n &:not(.dg-network-error) {\r\n tbody {\r\n &:before {\r\n top: auto;\r\n transform: translate(-50%, 30%);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Zebra rows\r\n tbody tr {\r\n &:nth-child(even) {\r\n background-color: var(--bs-table-striped-bg, #f8f9fa);\r\n }\r\n\r\n border-bottom: solid 1px var(--row-border-color);\r\n\r\n &:hover {\r\n background-color: var(--highlight-color) !important;\r\n }\r\n\r\n &:focus {\r\n background-color: var(--highlight-color) !important;\r\n border-bottom-color: var(--highlight-color) !important;\r\n outline: none;\r\n }\r\n }\r\n\r\n // Meta footer\r\n tfoot {\r\n min-width: 280px;\r\n\r\n td {\r\n padding: var(--padding-y-header) var(--padding-x);\r\n }\r\n\r\n .dg-page-nav {\r\n display: flex;\r\n align-items: center;\r\n min-width: 160px;\r\n }\r\n\r\n .dg-input-page {\r\n width: 4rem;\r\n }\r\n\r\n .dg-footer {\r\n display: flex;\r\n align-items: center;\r\n flex-direction: row;\r\n justify-content: space-between;\r\n }\r\n\r\n .dg-pagination {\r\n display: flex;\r\n text-align: center;\r\n\r\n button {\r\n // Fix icon inside button\r\n position: relative;\r\n width: 2rem;\r\n }\r\n }\r\n\r\n .dg-meta {\r\n // Prevent layout from jumping around\r\n min-width: 160px;\r\n text-align: right;\r\n }\r\n\r\n &.dg-footer-compact {\r\n .dg-meta {\r\n display: none;\r\n }\r\n\r\n .dg-input-page {\r\n display: none;\r\n }\r\n }\r\n }\r\n\r\n // Pagination in header\r\n [aria-sort] {\r\n cursor: pointer;\r\n padding-right: 1.5rem;\r\n }\r\n\r\n [aria-sort=\"none\"]:after,\r\n [aria-sort=\"none\"]:before,\r\n [aria-sort=\"ascending\"]:before,\r\n [aria-sort=\"descending\"]:after {\r\n right: 0.5rem;\r\n top: calc(50% - 0.5rem);\r\n border: solid transparent;\r\n content: \" \";\r\n height: 0;\r\n width: 0;\r\n position: absolute;\r\n border-color: rgba(0, 0, 0, 0);\r\n border-width: 0.25rem;\r\n margin-left: -0.25rem;\r\n }\r\n\r\n [aria-sort=\"none\"] {\r\n &:before {\r\n border-bottom-color: currentColor;\r\n opacity: 0.25;\r\n top: calc(50% - 0.6rem);\r\n }\r\n\r\n &:after {\r\n border-top-color: currentColor;\r\n opacity: 0.25;\r\n bottom: calc(50% - 0.5rem);\r\n top: auto;\r\n }\r\n }\r\n\r\n [aria-sort=\"ascending\"]:before {\r\n border-bottom-color: var(--body-color);\r\n opacity: 0.75;\r\n }\r\n\r\n [aria-sort=\"descending\"]:after {\r\n border-top-color: var(--body-color);\r\n opacity: 0.75;\r\n bottom: calc(50% - 0.5rem);\r\n top: auto;\r\n }\r\n}\r\n\r\n[data-bs-theme=\"dark\"] data-grid {\r\n --scroller-color-lightness: 20%;\r\n --highlight-color: #43423e;\r\n --header-background: var(--bs-gray-800, #34373b);\r\n --header-color: var(--bs-light, #e9ecef);\r\n --body-color: var(--bs-body-color, #494e53);\r\n --row-border-color: var(--bs-gray-900, #212325);\r\n\r\n tbody tr {\r\n &:nth-child(even) {\r\n background-color: var(--bs-table-striped-bg, #2c3034);\r\n }\r\n }\r\n}","/**\n * Data Grid Web component \n * https://github.com/lekoala/data-grid\n */\n@keyframes dataGridShow {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\ndata-grid {\n --padding: 0.5rem;\n --padding-x: 0.75rem;\n --padding-y: 0.5rem;\n --padding-y-header: 0.75rem;\n --padding-half: calc(var(--padding) / 2);\n --color-rgb: var(--bs-primary-rgb, 13, 110, 253);\n --color: rgb(var(--color-rgb));\n --highlight-color: #fffcee;\n --header-background: var(--bs-gray-200, #e9ecef);\n --header-color: var(--bs-dark, #212529);\n --input-background: var(--bs-body-bg, #ffffff);\n --input-border-color: var(--bs-border-color, #e9ecef);\n --btn-background: var(--bs-body-bg, #ffffff);\n --btn-color: var(--color);\n --btn-border-color: var(--bs-border-color, #e9ecef);\n --body-bg: var(--bs-body-bg, #212529);\n --body-color: var(--bs-body-color, #212529);\n --icon-scale: 1;\n --border-radius: 0.25rem;\n --row-border-color: #f2f2f2;\n --responsive-width: 60%;\n --black: var(--bs-black, #000);\n --white: var(--bs-white, #fff);\n --gray: var(--bs-gray, #6c757d);\n --gray-dark: var(--bs-gray-dark, #343a40);\n --gray-100: var(--bs-gray-100, #f8f9fa);\n --gray-200: var(--bs-gray-200, #e9ecef);\n --gray-300: var(--bs-gray-300, #dee2e6);\n --gray-400: var(--bs-gray-400, #ced4da);\n --gray-500: var(--bs-gray-500, #adb5bd);\n --gray-600: var(--bs-gray-600, #6c757d);\n --gray-700: var(--bs-gray-700, #495057);\n --gray-800: var(--bs-gray-800, #343a40);\n --gray-900: var(--bs-gray-900, #212529);\n display: block;\n min-height: 6rem;\n position: relative;\n}\ndata-grid {\n --scroller-color: 0, 0%;\n --scroller-color-lightness: 80%;\n --scroller-hover-factor: 0.8;\n --scroller-thumb: hsl(var(--scroller-color), var(--scroller-color-lightness));\n /* Replicate hover for webkit */\n --scroller-thumb-hover: hsl(var(--scroller-color), calc(var(--scroller-color-lightness) * var(--scroller-hover-factor)));\n --scroller-background: transparent;\n scrollbar-color: var(--scroller-thumb) var(--scroller-background);\n scrollbar-width: thin;\n}\ndata-grid::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\ndata-grid::-webkit-scrollbar-track {\n background: transparent;\n}\ndata-grid::-webkit-scrollbar-thumb {\n background: var(--scroller-thumb);\n}\ndata-grid::-webkit-scrollbar-thumb:hover {\n background: var(--scroller-thumb-hover);\n}\ndata-grid img {\n border: none;\n height: auto;\n max-width: 100%;\n vertical-align: middle;\n}\ndata-grid [hidden] {\n display: none;\n}\ndata-grid table {\n display: table;\n table-layout: fixed;\n width: 100%;\n max-width: 100%;\n white-space: normal;\n background: var(--header-background);\n}\ndata-grid thead,\ndata-grid tfoot {\n background-color: var(--header-background);\n color: var(--header-color);\n}\ndata-grid.dg-loading:not(.dg-initialized) thead,\ndata-grid.dg-loading:not(.dg-initialized) tfoot {\n background: none;\n}\ndata-grid.dg-loading tbody {\n animation-name: dataGridShow;\n animation-timing-function: ease-in;\n animation-fill-mode: forwards;\n animation-duration: 0.3s;\n pointer-events: none;\n}\ndata-grid tr {\n position: relative;\n}\ndata-grid th,\ndata-grid td {\n empty-cells: show;\n padding: var(--padding-y) var(--padding-x);\n text-align: left;\n}\ndata-grid th[tabindex],\ndata-grid td[tabindex] {\n outline: none;\n word-break: normal;\n}\ndata-grid th {\n font-weight: bold;\n padding: var(--padding-y-header) var(--padding-x);\n}\ndata-grid th,\ndata-grid td {\n position: relative;\n overflow: hidden;\n text-align: left;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\ndata-grid th.dg-wrap,\ndata-grid td.dg-wrap {\n white-space: normal;\n word-break: break-all;\n}\ndata-grid .dg-expandable {\n cursor: pointer;\n}\ndata-grid .dg-expandable.dg-expanded td {\n white-space: normal;\n word-break: break-all;\n}\ndata-grid .dg-clickable-cell {\n margin: 0;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n}\ndata-grid[sticky] table thead,\ndata-grid[sticky] table tfoot {\n z-index: 2;\n position: sticky;\n margin: 0;\n border: 0;\n}\ndata-grid[sticky] table thead {\n inset-block-start: -1px;\n}\ndata-grid[sticky] table tfoot {\n inset-block-end: -1px;\n}\ndata-grid .dg-nav-icon,\ndata-grid .dg-skip-icon {\n width: 22px;\n height: 22px;\n box-sizing: border-box;\n position: absolute;\n display: block;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(var(--icon-scale, 1));\n}\ndata-grid .dg-nav-icon:before, data-grid .dg-nav-icon:after,\ndata-grid .dg-skip-icon:before,\ndata-grid .dg-skip-icon:after {\n content: \"\";\n display: block;\n box-sizing: border-box;\n position: absolute;\n}\ndata-grid .dg-nav-icon::before {\n width: 0;\n height: 10px;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n border-left: 6px solid;\n top: 6px;\n left: 9px;\n}\ndata-grid .dg-skip-icon::before {\n width: 3px;\n height: 10px;\n background: currentColor;\n top: 6px;\n left: 14px;\n}\ndata-grid .dg-skip-icon::after {\n width: 0;\n height: 10px;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n border-left: 6px solid;\n top: 6px;\n left: 7px;\n}\ndata-grid .dg-rotate {\n transform: rotate(-180deg);\n}\ndata-grid button {\n background-color: var(--btn-background);\n border: solid 1px var(--btn-border-color);\n border-radius: var(--border-radius);\n color: var(--body-color);\n height: 2rem;\n margin: 0 0.2rem;\n padding: 0 0.5rem;\n pointer-events: all;\n text-align: center;\n cursor: pointer;\n}\ndata-grid button:hover {\n opacity: 0.7;\n}\ndata-grid button:disabled:hover {\n background-color: inherit;\n border-color: inherit;\n}\ndata-grid input[type=checkbox] {\n margin: 0;\n}\ndata-grid input:not([type=checkbox]),\ndata-grid select {\n background-color: var(--input-background, \"#fff\");\n color: currentColor;\n box-sizing: border-box;\n border: 1px solid var(--input-border-color, \"#f0f0f0\");\n border-radius: var(--border-radius);\n height: 2rem;\n margin: 0 0.2rem;\n padding: 0 var(--padding);\n max-width: none;\n}\ndata-grid input:not([type=checkbox]):focus,\ndata-grid select:focus,\ndata-grid button:focus {\n box-shadow: 0 0 0 var(--padding-half) rgba(var(--color-rgb), 0.25);\n outline: 0;\n}\ndata-grid input:not([type=checkbox])[disabled], data-grid input:not([type=checkbox]):disabled,\ndata-grid select[disabled],\ndata-grid select:disabled,\ndata-grid button[disabled],\ndata-grid button:disabled {\n opacity: 0.35;\n pointer-events: none;\n}\ndata-grid thead tr:nth-child(2) th {\n padding: 0;\n background-color: transparent;\n}\ndata-grid thead tr:nth-child(2) th input {\n width: 100%;\n border-radius: 0;\n margin: 0;\n}\ndata-grid thead tr:nth-child(2) th input:focus {\n box-shadow: inset 0px 0px 0px 1px var(--color);\n}\ndata-grid tbody td.dg-editable-col {\n padding: 0;\n height: 0;\n}\ndata-grid tbody td input.dg-editable {\n width: 100%;\n background: transparent;\n border: 0;\n border-radius: 0;\n margin: 0;\n box-shadow: none;\n height: 100%;\n}\ndata-grid tbody td input.dg-editable:focus {\n box-shadow: inset 0px 0px 0px 1px var(--color);\n}\ndata-grid.dg-empty tbody {\n height: 4rem;\n position: relative;\n}\ndata-grid.dg-empty tbody:before {\n position: absolute;\n top: 50%;\n left: 50%;\n content: attr(data-empty);\n transform: translate(-50%, -50%);\n opacity: 0.5;\n font-size: 1.5rem;\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 90%;\n}\ndata-grid.dg-empty tr.dg-fake-row {\n height: 4rem;\n border: none;\n}\ndata-grid.dg-empty.dg-network-error table {\n color: #842029;\n background-color: #f8d7da;\n border: 1px solid #f5c2c7;\n}\ndata-grid.dg-empty.dg-network-error tbody {\n height: auto;\n}\ndata-grid.dg-empty.dg-network-error tbody:before {\n font-size: 2rem;\n top: auto;\n transform: translate(-50%);\n}\ndata-grid.dg-empty.dg-network-error tbody tr:not(.dg-fake-row) {\n display: none;\n}\ndata-grid.dg-empty:not(.dg-network-error) tbody:before {\n top: auto;\n transform: translate(-50%, 30%);\n}\ndata-grid tbody tr {\n border-bottom: solid 1px var(--row-border-color);\n}\ndata-grid tbody tr:nth-child(even) {\n background-color: var(--bs-table-striped-bg, #f8f9fa);\n}\ndata-grid tbody tr:hover {\n background-color: var(--highlight-color) !important;\n}\ndata-grid tbody tr:focus {\n background-color: var(--highlight-color) !important;\n border-bottom-color: var(--highlight-color) !important;\n outline: none;\n}\ndata-grid tfoot {\n min-width: 280px;\n}\ndata-grid tfoot td {\n padding: var(--padding-y-header) var(--padding-x);\n}\ndata-grid tfoot .dg-page-nav {\n display: flex;\n align-items: center;\n min-width: 160px;\n}\ndata-grid tfoot .dg-input-page {\n width: 4rem;\n}\ndata-grid tfoot .dg-footer {\n display: flex;\n align-items: center;\n flex-direction: row;\n justify-content: space-between;\n}\ndata-grid tfoot .dg-pagination {\n display: flex;\n text-align: center;\n}\ndata-grid tfoot .dg-pagination button {\n position: relative;\n width: 2rem;\n}\ndata-grid tfoot .dg-meta {\n min-width: 160px;\n text-align: right;\n}\ndata-grid tfoot.dg-footer-compact .dg-meta {\n display: none;\n}\ndata-grid tfoot.dg-footer-compact .dg-input-page {\n display: none;\n}\ndata-grid [aria-sort] {\n cursor: pointer;\n padding-right: 1.5rem;\n}\ndata-grid [aria-sort=none]:after,\ndata-grid [aria-sort=none]:before,\ndata-grid [aria-sort=ascending]:before,\ndata-grid [aria-sort=descending]:after {\n right: 0.5rem;\n top: calc(50% - 0.5rem);\n border: solid transparent;\n content: \" \";\n height: 0;\n width: 0;\n position: absolute;\n border-color: rgba(0, 0, 0, 0);\n border-width: 0.25rem;\n margin-left: -0.25rem;\n}\ndata-grid [aria-sort=none]:before {\n border-bottom-color: currentColor;\n opacity: 0.25;\n top: calc(50% - 0.6rem);\n}\ndata-grid [aria-sort=none]:after {\n border-top-color: currentColor;\n opacity: 0.25;\n bottom: calc(50% - 0.5rem);\n top: auto;\n}\ndata-grid [aria-sort=ascending]:before {\n border-bottom-color: var(--body-color);\n opacity: 0.75;\n}\ndata-grid [aria-sort=descending]:after {\n border-top-color: var(--body-color);\n opacity: 0.75;\n bottom: calc(50% - 0.5rem);\n top: auto;\n}\n\n[data-bs-theme=dark] data-grid {\n --scroller-color-lightness: 20%;\n --highlight-color: #43423e;\n --header-background: var(--bs-gray-800, #34373b);\n --header-color: var(--bs-light, #e9ecef);\n --body-color: var(--bs-body-color, #494e53);\n --row-border-color: var(--bs-gray-900, #212325);\n}\n[data-bs-theme=dark] data-grid tbody tr:nth-child(even) {\n background-color: var(--bs-table-striped-bg, #2c3034);\n}\n\ndata-grid[dir=rtl] th,\ndata-grid[dir=rtl] td {\n text-align: right;\n}\ndata-grid[dir=rtl] [aria-sort] {\n padding-left: 1rem;\n padding-right: 0.5rem;\n}\ndata-grid[dir=rtl] [aria-sort=none]:after,\ndata-grid[dir=rtl] [aria-sort=none]:before,\ndata-grid[dir=rtl] [aria-sort=ascending]:before,\ndata-grid[dir=rtl] [aria-sort=descending]:after {\n left: 0.75rem;\n right: auto;\n}\ndata-grid[dir=rtl] tfoot .dg-meta {\n text-align: left;\n}\n\ndata-grid .dg-menu {\n position: absolute;\n z-index: 3;\n background: var(--body-bg);\n list-style: none;\n max-width: 150px;\n margin: 0;\n padding: var(--padding);\n box-shadow: 0 0 1rem rgba(0, 0, 0, 0.25);\n border-radius: var(--border-radius);\n}\ndata-grid .dg-menu li {\n margin: 0;\n padding: 0;\n}\ndata-grid .dg-menu label {\n display: flex;\n align-items: center;\n margin-bottom: 0.25em;\n}\ndata-grid .dg-menu input {\n margin-right: 0.5em;\n}\n\ndata-grid .dg-actions {\n text-overflow: initial;\n width: 100px;\n text-align: right;\n white-space: nowrap !important;\n}\ndata-grid .dg-actions button {\n margin: 0;\n}\ndata-grid .dg-actions button + button {\n margin-left: 0.5rem;\n}\ndata-grid .dg-actions .dg-actions-toggle {\n display: none;\n width: calc(100px - var(--padding-x) * 2);\n}\ndata-grid .dg-actions.dg-actions-1 {\n width: 100%;\n}\ndata-grid .dg-actions.dg-actions-2 button {\n width: calc(50% - 0.25rem);\n}\ndata-grid .dg-actions.dg-actions-more button {\n display: none;\n}\ndata-grid .dg-actions.dg-actions-more button.dg-actions-toggle {\n display: inline-block;\n}\ndata-grid .dg-actions.dg-actions-expand {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n width: 100%;\n height: 100%;\n}\ndata-grid .dg-actions.dg-actions-expand.dg-actions-more {\n width: 100%;\n}\ndata-grid .dg-actions.dg-actions-expand.dg-actions-more button {\n display: inline-block;\n}\ndata-grid tr.dg-actionable {\n cursor: pointer;\n}\ndata-grid tr.dg-actionable:hover td {\n background-color: var(--highlight-color);\n}\n\ndata-grid .dg-resizer {\n position: absolute;\n top: 0;\n right: 0;\n width: 6px;\n z-index: 2;\n cursor: col-resize;\n user-select: none;\n}\ndata-grid .dg-resizer:before {\n content: \"\";\n display: block;\n position: absolute;\n top: var(--padding-y-header);\n height: 1.5rem;\n right: 0;\n width: 2px;\n background: var(--body-color);\n opacity: 0.2;\n}\ndata-grid .dg-resizer:hover:before {\n opacity: 0.6;\n}\ndata-grid .dg-resizer.dg-resizer-active {\n border-right: 1px dashed var(--color);\n}\ndata-grid .dg-resizer.dg-resizer-active:before {\n opacity: 0.6;\n}\n\ndata-grid .dg-responsive-toggle {\n padding: 0;\n text-align: center;\n}\ndata-grid .dg-responsive-child-row > td {\n padding: 0;\n}\ndata-grid .dg-responsive-table {\n table-layout: auto;\n border: 0;\n}\ndata-grid .dg-responsive-table td,\ndata-grid .dg-responsive-table th {\n white-space: normal;\n}\ndata-grid .dg-responsive-table th {\n max-width: 40%;\n}\n\n@media only screen and (max-width: 767px) {\n data-grid[responsive] .dg-resizer {\n display: none;\n }\n data-grid[responsive] .dg-meta {\n display: none;\n }\n data-grid[responsive] .dg-input-page {\n display: none;\n }\n data-grid[responsive] table,\n data-grid[responsive] tbody,\n data-grid[responsive] tfoot,\n data-grid[responsive] th,\n data-grid[responsive] td,\n data-grid[responsive] tr:not([hidden]) {\n display: block;\n }\n data-grid[responsive] thead {\n display: flex;\n border-bottom: 2px solid var(--header-background);\n }\n data-grid[responsive] thead > tr {\n flex-grow: 1;\n }\n data-grid[responsive] thead th {\n width: auto;\n }\n data-grid[responsive] tbody tr {\n padding: 0;\n border: 1px solid var(--header-background);\n }\n data-grid[responsive] tbody td {\n border: none;\n border-bottom: 1px solid var(--row-border-color);\n position: relative;\n padding-left: calc(100% - var(--responsive-width) - var(--padding) * 2);\n }\n data-grid[responsive] tbody td:last-child {\n border: 0;\n }\n data-grid[responsive] tbody td:before {\n position: absolute;\n top: 0;\n left: 0;\n padding: var(--padding);\n width: calc(100% - var(--responsive-width) - var(--padding) * 4);\n white-space: nowrap;\n content: attr(data-name);\n display: block;\n font-weight: bold;\n background-color: var(--header-background);\n }\n data-grid[responsive] tbody td[role=gridcell] {\n padding-left: calc(100% - var(--responsive-width) - var(--padding) * 4 + 0.5rem);\n }\n data-grid[responsive] .dg-selectable {\n height: 28px;\n margin: 2px 1px 2px;\n }\n data-grid[responsive] td.dg-selectable::before, data-grid[responsive] td.dg-actions::before {\n padding: 0;\n }\n data-grid[responsive] td.dg-selectable label {\n padding: 5px;\n }\n data-grid[responsive] td[role=gridcell] {\n min-height: 35px;\n width: auto;\n }\n data-grid[responsive] td[data-name]::before {\n height: 100%;\n }\n data-grid[responsive] td.dg-actions {\n padding-left: inherit;\n width: inherit;\n }\n data-grid[responsive] .dg-actions button {\n width: inherit !important;\n }\n data-grid[responsive] tr.dg-head-columns {\n padding: 0;\n width: calc(100% - var(--responsive-width) - var(--padding) * 4);\n }\n data-grid[responsive] tr.dg-head-columns th[role=\"columnheader button\"] {\n padding: 0.36em 1.3em 0.36em 0.75em;\n }\n data-grid[responsive] tr.dg-head-filters {\n background: transparent;\n vertical-align: top;\n padding: 0;\n width: calc(100% - (100% - var(--responsive-width) - var(--padding) * 4));\n }\n data-grid[responsive] .dg-head-filters th input:not([type=checkbox], [type=radio]) {\n height: 2.25em;\n }\n data-grid[responsive] .dg-head-filters th.dg-selectable {\n background: transparent;\n }\n data-grid[responsive] .dg-head-filters th.dg-selectable label::before {\n content: \"Column Filters\";\n }\n}\n\n/*# sourceMappingURL=data-grid.css.map */\n","data-grid {\r\n &[dir=\"rtl\"] {\r\n th,\r\n td {\r\n text-align: right;\r\n }\r\n [aria-sort] {\r\n padding-left: 1rem;\r\n padding-right: 0.5rem;\r\n }\r\n [aria-sort=\"none\"]:after,\r\n [aria-sort=\"none\"]:before,\r\n [aria-sort=\"ascending\"]:before,\r\n [aria-sort=\"descending\"]:after {\r\n left: 0.75rem;\r\n right: auto;\r\n }\r\n tfoot .dg-meta {\r\n text-align: left;\r\n }\r\n }\r\n}\r\n","data-grid {\r\n .dg-menu {\r\n position: absolute;\r\n z-index: 3;\r\n background: var(--body-bg);\r\n list-style: none;\r\n max-width: 150px;\r\n margin: 0;\r\n padding: var(--padding);\r\n box-shadow: 0 0 1rem rgba(0, 0, 0, 0.25);\r\n border-radius: var(--border-radius);\r\n\r\n li {\r\n margin: 0;\r\n padding: 0;\r\n }\r\n label {\r\n display: flex;\r\n align-items: center;\r\n margin-bottom: 0.25em;\r\n }\r\n input {\r\n margin-right: 0.5em;\r\n }\r\n }\r\n}\r\n","data-grid {\r\n .dg-actions {\r\n text-overflow: initial;\r\n width: 100px;\r\n text-align: right;\r\n white-space: nowrap !important;\r\n\r\n button {\r\n margin: 0;\r\n\r\n + button {\r\n margin-left: 0.5rem;\r\n }\r\n }\r\n .dg-actions-toggle {\r\n display: none;\r\n width: calc(100px - var(--padding-x) * 2);\r\n }\r\n &.dg-actions-1 {\r\n width: 100%;\r\n }\r\n // This needs icons to work\r\n &.dg-actions-2 button {\r\n width: calc(50% - 0.25rem);\r\n }\r\n &.dg-actions-more button {\r\n display: none;\r\n\r\n &.dg-actions-toggle {\r\n display: inline-block;\r\n }\r\n }\r\n &.dg-actions-expand {\r\n position: absolute;\r\n right: 0;\r\n display: flex;\r\n align-items: center;\r\n justify-content: flex-end;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n &.dg-actions-expand.dg-actions-more {\r\n width: 100%;\r\n\r\n button {\r\n display: inline-block;\r\n }\r\n }\r\n }\r\n tr.dg-actionable {\r\n cursor: pointer;\r\n\r\n &:hover td {\r\n background-color: var(--highlight-color);\r\n }\r\n }\r\n}\r\n","data-grid {\r\n .dg-resizer {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n width: 6px; // clickable zone\r\n z-index: 2;\r\n cursor: col-resize;\r\n user-select: none;\r\n\r\n &:before {\r\n content: \"\";\r\n display: block;\r\n position: absolute;\r\n top: var(--padding-y-header);\r\n height: 1.5rem;\r\n right: 0;\r\n width: 2px;\r\n background: var(--body-color);\r\n opacity: 0.2;\r\n }\r\n &:hover:before {\r\n opacity: 0.6;\r\n }\r\n &.dg-resizer-active {\r\n border-right: 1px dashed var(--color);\r\n\r\n &:before {\r\n opacity: 0.6;\r\n }\r\n }\r\n }\r\n}\r\n","data-grid {\r\n .dg-responsive-toggle {\r\n padding: 0;\r\n text-align: center;\r\n }\r\n .dg-responsive-child-row > td {\r\n padding: 0;\r\n }\r\n .dg-responsive-table {\r\n table-layout: auto;\r\n border: 0;\r\n\r\n td,\r\n th {\r\n white-space: normal;\r\n }\r\n\r\n th {\r\n max-width: 40%;\r\n }\r\n }\r\n}\r\n\r\n// CSS Only responsive\r\n@media only screen and (max-width: 767px) {\r\n data-grid[responsive] {\r\n // Doesn't make any sense to resize\r\n .dg-resizer {\r\n display: none;\r\n }\r\n\r\n // more compact footer\r\n .dg-meta {\r\n display: none;\r\n }\r\n .dg-input-page {\r\n display: none;\r\n }\r\n\r\n // everything as blocks\r\n table,\r\n tbody,\r\n tfoot,\r\n th,\r\n td,\r\n tr:not([hidden]) {\r\n display: block;\r\n }\r\n\r\n // use flex for thead\r\n thead {\r\n display: flex;\r\n\r\n > tr {\r\n flex-grow: 1;\r\n }\r\n th {\r\n width: auto;\r\n }\r\n\r\n border-bottom: 2px solid var(--header-background);\r\n }\r\n\r\n // use pseudo element to display column name\r\n tbody {\r\n tr {\r\n padding: 0;\r\n border: 1px solid var(--header-background);\r\n }\r\n td {\r\n border: none;\r\n border-bottom: 1px solid var(--row-border-color);\r\n position: relative;\r\n padding-left: calc(100% - var(--responsive-width) - var(--padding) * 2);\r\n\r\n &:last-child {\r\n border: 0;\r\n }\r\n &:before {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n padding: var(--padding);\r\n width: calc(100% - var(--responsive-width) - var(--padding) * 4);\r\n white-space: nowrap;\r\n content: attr(data-name);\r\n display: block;\r\n font-weight: bold;\r\n background-color: var(--header-background);\r\n }\r\n &[role=\"gridcell\"] {\r\n padding-left: calc(100% - var(--responsive-width) - var(--padding) * 4 + 0.5rem);\r\n }\r\n }\r\n }\r\n\r\n // give selectable some room\r\n .dg-selectable {\r\n height: 28px;\r\n margin: 2px 1px 2px;\r\n }\r\n\r\n td {\r\n &.dg-selectable::before,\r\n &.dg-actions::before {\r\n padding: 0;\r\n }\r\n &.dg-selectable label {\r\n padding: 5px;\r\n }\r\n &[role=\"gridcell\"] {\r\n min-height: 35px;\r\n width: auto;\r\n }\r\n &[data-name]::before {\r\n height: 100%;\r\n }\r\n &.dg-actions {\r\n padding-left: inherit;\r\n width: inherit;\r\n }\r\n }\r\n .dg-actions button {\r\n width: inherit !important;\r\n }\r\n tr {\r\n &.dg-head-columns {\r\n padding: 0;\r\n width: calc(100% - var(--responsive-width) - var(--padding) * 4);\r\n\r\n th[role=\"columnheader button\"] {\r\n padding: 0.36em 1.3em 0.36em 0.75em;\r\n }\r\n }\r\n &.dg-head-filters {\r\n background: transparent;\r\n vertical-align: top;\r\n padding: 0;\r\n width: calc(100% - (100% - var(--responsive-width) - var(--padding) * 4));\r\n }\r\n }\r\n .dg-head-filters th input:not([type=\"checkbox\"], [type=\"radio\"]) {\r\n height: 2.25em;\r\n }\r\n .dg-head-filters th.dg-selectable {\r\n background: transparent;\r\n }\r\n .dg-head-filters th.dg-selectable label::before {\r\n content: \"Column Filters\";\r\n }\r\n }\r\n}\r\n"]} \ No newline at end of file +{"version":3,"sources":["../scss/_core.scss","data-grid.css","../scss/_rtl.scss","../scss/_menu.scss","../scss/_actions.scss","../scss/_resizer.scss","../scss/_responsive.scss"],"names":[],"mappings":"AAAA;;;EAAA;AAKA;EACE;IACE,UAAA;ECAF;EDGA;IACE,YAAA;ECDF;AACF;ADIA;EACE,iBAAA;EACA,oBAAA;EACA,mBAAA;EACA,2BAAA;EACA,wCAAA;EACA,gDAAA;EACA,8BAAA;EAEA,0BAAA;EACA,gDAAA;EACA,uCAAA;EACA,8CAAA;EACA,qDAAA;EACA,4CAAA;EACA,yBAAA;EACA,mDAAA;EACA,qCAAA;EACA,2CAAA;EACA,eAAA;EACA,wBAAA;EACA,2BAAA;EACA,uBAAA;EAEA,8BAAA;EACA,8BAAA;EACA,+BAAA;EACA,yCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EACA,uCAAA;EAEA,cAAA;EACA,gBAAA;EACA,kBAAA;ACLF;ADQE;EACE,uBAAA;EACA,+BAAA;EACA,4BAAA;EACA,6EAAA;EACA,+BAAA;EACA,wHAAA;EACA,kCAAA;EACA,iEAAA;EACA,qBAAA;ACNJ;ADQI;EACE,UAAA;EACA,WAAA;ACNN;ADSI;EACE,uBAAA;ACPN;ADUI;EACE,iCAAA;ACRN;ADWI;EACE,uCAAA;ACTN;ADmBQ;EACE,aAAA;ACjBV;ADuBE;EACE,YAAA;EACA,YAAA;EACA,eAAA;EACA,sBAAA;ACrBJ;ADwBE;EACE,aAAA;ACtBJ;ADyBE;EACE,cAAA;EAGA,mBAAA;EACA,WAAA;EACA,eAAA;EACA,mBAAA;EAEA,oCAAA;AC1BJ;AD6BE;;EAEE,0CAAA;EACA,0BAAA;AC3BJ;ADiCM;;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A;IACA,uBAAA;IACA,gEAAA;IACA,wBAAA;IACA,cAAA;IACA,iBAAA;IACA,0CAAA;ELsiBR;EKpiBM;IACE,gFAAA;ELsiBR;EKhiBE;IACE,YAAA;IACA,mBAAA;ELkiBJ;EK9hBI;IAEE,UAAA;EL+hBN;EK7hBI;IACE,YAAA;EL+hBN;EK7hBI;IACE,gBAAA;IACA,WAAA;EL+hBN;EK7hBI;IACE,YAAA;EL+hBN;EK7hBI;IACE,qBAAA;IACA,cAAA;EL+hBN;EK5hBE;IACE,yBAAA;EL8hBJ;EK3hBI;IACE,UAAA;IACA,gEAAA;EL6hBN;EK3hBM;IACE,mCAAA;EL6hBR;EK1hBI;IACE,uBAAA;IACA,mBAAA;IACA,UAAA;IACA,yEAAA;EL4hBN;EKzhBE;IACE,cAAA;EL2hBJ;EKzhBE;IACE,uBAAA;EL2hBJ;EKzhBE;IACE,yBAAA;EL2hBJ;EKxhBE;IACE,iBAAA;EL0hBJ;EKrhBE;IACE,iBAAA;ELuhBJ;AACF","file":"data-grid.css","sourcesContent":["/**\r\n * Data Grid Web component \r\n * https://github.com/lekoala/data-grid\r\n */\r\n\r\n@keyframes dataGridShow {\r\n 0% {\r\n opacity: 1;\r\n }\r\n\r\n 100% {\r\n opacity: 0.5;\r\n }\r\n}\r\n\r\ndata-grid {\r\n --padding: 0.5rem;\r\n --padding-x: 0.75rem;\r\n --padding-y: 0.5rem;\r\n --padding-y-header: 0.75rem;\r\n --padding-half: calc(var(--padding) / 2);\r\n --color-rgb: var(--bs-primary-rgb, 13, 110, 253);\r\n --color: rgb(var(--color-rgb));\r\n\r\n --highlight-color: #fffcee;\r\n --header-background: var(--bs-gray-200, #e9ecef);\r\n --header-color: var(--bs-dark, #212529);\r\n --input-background: var(--bs-body-bg, #ffffff);\r\n --input-border-color: var(--bs-border-color, #e9ecef);\r\n --btn-background: var(--bs-body-bg, #ffffff);\r\n --btn-color: var(--color);\r\n --btn-border-color: var(--bs-border-color, #e9ecef);\r\n --body-bg: var(--bs-body-bg, #212529);\r\n --body-color: var(--bs-body-color, #212529);\r\n --icon-scale: 1;\r\n --border-radius: 0.25rem;\r\n --row-border-color: #f2f2f2;\r\n --responsive-width: 60%;\r\n\r\n --black: var(--bs-black, #000);\r\n --white: var(--bs-white, #fff);\r\n --gray: var(--bs-gray, #6c757d);\r\n --gray-dark: var(--bs-gray-dark, #343a40);\r\n --gray-100: var(--bs-gray-100, #f8f9fa);\r\n --gray-200: var(--bs-gray-200, #e9ecef);\r\n --gray-300: var(--bs-gray-300, #dee2e6);\r\n --gray-400: var(--bs-gray-400, #ced4da);\r\n --gray-500: var(--bs-gray-500, #adb5bd);\r\n --gray-600: var(--bs-gray-600, #6c757d);\r\n --gray-700: var(--bs-gray-700, #495057);\r\n --gray-800: var(--bs-gray-800, #343a40);\r\n --gray-900: var(--bs-gray-900, #212529);\r\n\r\n display: block;\r\n min-height: 6rem;\r\n position: relative;\r\n\r\n // When used with fixed height, have a nice scrollbar\r\n & {\r\n --scroller-color: 0, 0%;\r\n --scroller-color-lightness: 80%;\r\n --scroller-hover-factor: 0.8;\r\n --scroller-thumb: hsl(var(--scroller-color), var(--scroller-color-lightness));\r\n /* Replicate hover for webkit */\r\n --scroller-thumb-hover: hsl(var(--scroller-color), calc(var(--scroller-color-lightness) * var(--scroller-hover-factor)));\r\n --scroller-background: transparent;\r\n scrollbar-color: var(--scroller-thumb) var(--scroller-background);\r\n scrollbar-width: thin;\r\n\r\n &::-webkit-scrollbar {\r\n width: 8px;\r\n height: 8px;\r\n }\r\n\r\n &::-webkit-scrollbar-track {\r\n background: transparent;\r\n }\r\n\r\n &::-webkit-scrollbar-thumb {\r\n background: var(--scroller-thumb);\r\n }\r\n\r\n &::-webkit-scrollbar-thumb:hover {\r\n background: var(--scroller-thumb-hover);\r\n }\r\n }\r\n\r\n // Before grid init, or on loading\r\n &[class=\"\"],\r\n &:not([class]),\r\n &.dg-loading {\r\n > table {\r\n &[role=grid] {\r\n tr.dg-head-columns {\r\n display: none; //ensures the empty column header bar is hidden\r\n }\r\n }\r\n }\r\n }\r\n\r\n img {\r\n border: none;\r\n height: auto;\r\n max-width: 100%;\r\n vertical-align: middle;\r\n }\r\n\r\n [hidden] {\r\n display: none;\r\n }\r\n\r\n table {\r\n display: table;\r\n // Table and column widths are set by the widths of table and col elements\r\n // or by the width of the first row of cells. Cells in subsequent rows do not affect column widths.\r\n table-layout: fixed;\r\n width: 100%;\r\n max-width: 100%;\r\n white-space: normal;\r\n // Background needs to be on the table, not on the component in case the table overflows the component\r\n background: var(--header-background);\r\n }\r\n\r\n thead,\r\n tfoot {\r\n background-color: var(--header-background);\r\n color: var(--header-color);\r\n }\r\n\r\n &.dg-loading {\r\n &:not(.dg-initialized) {\r\n\r\n thead,\r\n tfoot {\r\n background: none;\r\n }\r\n }\r\n\r\n tbody {\r\n animation-name: dataGridShow;\r\n animation-timing-function: ease-in;\r\n animation-fill-mode: forwards;\r\n animation-duration: 0.3s; // only triggers after 300ms\r\n pointer-events: none; // disable clicks while loading\r\n }\r\n }\r\n\r\n tr {\r\n position: relative;\r\n }\r\n\r\n th,\r\n td {\r\n empty-cells: show;\r\n padding: var(--padding-y) var(--padding-x);\r\n text-align: left;\r\n\r\n &[tabindex] {\r\n outline: none;\r\n word-break: normal;\r\n }\r\n }\r\n\r\n th {\r\n font-weight: bold;\r\n padding: var(--padding-y-header) var(--padding-x);\r\n }\r\n\r\n // Prevent overflow on headers and cells\r\n th,\r\n td {\r\n position: relative;\r\n overflow: hidden;\r\n text-align: left;\r\n // These two properties keep content on one line\r\n text-overflow: ellipsis;\r\n white-space: nowrap;\r\n\r\n // Use this to allow content to flow over multiple lines\r\n &.dg-wrap {\r\n white-space: normal;\r\n word-break: break-all;\r\n }\r\n }\r\n\r\n // Expand on multiple lines on row click\r\n .dg-expandable {\r\n cursor: pointer;\r\n\r\n &.dg-expanded td {\r\n white-space: normal;\r\n word-break: break-all;\r\n }\r\n }\r\n\r\n .dg-clickable-cell {\r\n margin: 0;\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n width: 100%;\r\n height: 100%;\r\n cursor: pointer;\r\n display: flex;\r\n align-items: center;\r\n justify-content: center;\r\n }\r\n\r\n // Stick headers\r\n // https://css-tricks.com/making-tables-with-sticky-header-and-footers-got-a-bit-easier/\r\n &[sticky] table {\r\n\r\n thead,\r\n tfoot {\r\n z-index: 2;\r\n position: sticky;\r\n margin: 0;\r\n border: 0;\r\n }\r\n\r\n // Use silly value to prevent sub pixel alignment issue\r\n thead {\r\n inset-block-start: -1px;\r\n }\r\n\r\n tfoot {\r\n inset-block-end: -1px;\r\n }\r\n }\r\n\r\n // Pagination icons\r\n .dg-nav-icon,\r\n .dg-skip-icon {\r\n width: 22px;\r\n height: 22px;\r\n box-sizing: border-box;\r\n position: absolute;\r\n display: block;\r\n top: 50%;\r\n left: 50%;\r\n transform: translate(-50%, -50%) scale(var(--icon-scale, 1));\r\n\r\n &:before,\r\n &:after {\r\n content: \"\";\r\n display: block;\r\n box-sizing: border-box;\r\n position: absolute;\r\n }\r\n }\r\n\r\n .dg-nav-icon::before {\r\n width: 0;\r\n height: 10px;\r\n border-top: 5px solid transparent;\r\n border-bottom: 5px solid transparent;\r\n border-left: 6px solid;\r\n top: 6px;\r\n left: 9px;\r\n }\r\n\r\n .dg-skip-icon {\r\n &::before {\r\n width: 3px;\r\n height: 10px;\r\n background: currentColor;\r\n top: 6px;\r\n left: 14px;\r\n }\r\n\r\n &::after {\r\n width: 0;\r\n height: 10px;\r\n border-top: 5px solid transparent;\r\n border-bottom: 5px solid transparent;\r\n border-left: 6px solid;\r\n top: 6px;\r\n left: 7px;\r\n }\r\n }\r\n\r\n .dg-rotate {\r\n transform: rotate(-180deg);\r\n }\r\n\r\n // Default actions buttons\r\n button {\r\n background-color: var(--btn-background);\r\n border: solid 1px var(--btn-border-color);\r\n border-radius: var(--border-radius);\r\n color: var(--body-color);\r\n height: 2rem;\r\n margin: 0 0.2rem;\r\n padding: 0 0.5rem;\r\n pointer-events: all;\r\n text-align: center;\r\n cursor: pointer;\r\n\r\n &:hover {\r\n opacity: 0.7;\r\n }\r\n\r\n &:disabled:hover {\r\n background-color: inherit;\r\n border-color: inherit;\r\n }\r\n }\r\n\r\n // Form elements\r\n input[type=\"checkbox\"] {\r\n margin: 0;\r\n }\r\n\r\n input:not([type=\"checkbox\"]),\r\n select {\r\n background-color: var(--input-background, \"#fff\");\r\n color: currentColor;\r\n box-sizing: border-box;\r\n border: 1px solid var(--input-border-color, \"#f0f0f0\");\r\n border-radius: var(--border-radius);\r\n height: 2rem;\r\n margin: 0 0.2rem;\r\n padding: 0 var(--padding);\r\n max-width: none;\r\n }\r\n\r\n input:not([type=\"checkbox\"]),\r\n select,\r\n button {\r\n &:focus {\r\n box-shadow: 0 0 0 var(--padding-half) rgba(var(--color-rgb), 0.25);\r\n outline: 0;\r\n }\r\n\r\n &[disabled],\r\n &:disabled {\r\n opacity: 0.35;\r\n pointer-events: none;\r\n }\r\n }\r\n\r\n // Filters (2nd header row)\r\n thead tr:nth-child(2) th {\r\n padding: 0 2px 0 0;\r\n background-color: transparent;\r\n\r\n > * { \r\n width: 100%;\r\n border-radius: 0;\r\n margin: 0;\r\n }\r\n\r\n input {\r\n &:focus {\r\n box-shadow: inset 0px 0px 0px 1px var(--color);\r\n }\r\n }\r\n }\r\n\r\n // Editable\r\n tbody td.dg-editable-col {\r\n padding: 0;\r\n height: 0; // it needs a height for height 100%\r\n }\r\n\r\n tbody td input.dg-editable {\r\n width: 100%;\r\n background: transparent;\r\n border: 0;\r\n border-radius: 0;\r\n margin: 0;\r\n box-shadow: none;\r\n height: 100%;\r\n\r\n &:focus {\r\n box-shadow: inset 0px 0px 0px 1px var(--color);\r\n }\r\n }\r\n\r\n // Empty table or error message (don't use :empty as it would create fouc on load)\r\n &.dg-empty {\r\n tbody {\r\n height: 4rem;\r\n position: relative;\r\n\r\n &:before {\r\n position: absolute;\r\n top: 50%;\r\n left: 50%;\r\n content: attr(data-empty);\r\n transform: translate(-50%, -50%);\r\n opacity: 0.5;\r\n font-size: 1.5rem;\r\n text-align: center;\r\n white-space: nowrap;\r\n text-overflow: ellipsis;\r\n overflow: hidden;\r\n width: 90%;\r\n }\r\n }\r\n\r\n tr {\r\n &.dg-fake-row {\r\n height: 4rem;\r\n border: none;\r\n }\r\n }\r\n\r\n &.dg-network-error {\r\n table {\r\n color: #842029;\r\n background-color: #f8d7da;\r\n border: 1px solid #f5c2c7;\r\n }\r\n\r\n tbody {\r\n height: auto;\r\n\r\n &:before {\r\n font-size: 2rem;\r\n top: auto;\r\n transform: translate(-50%);\r\n }\r\n\r\n tr:not(.dg-fake-row) {\r\n display: none;\r\n }\r\n }\r\n }\r\n\r\n &:not(.dg-network-error) {\r\n tbody {\r\n &:before {\r\n top: auto;\r\n transform: translate(-50%, 30%);\r\n }\r\n }\r\n }\r\n }\r\n\r\n // Zebra rows\r\n tbody tr {\r\n &:nth-child(even) {\r\n background-color: var(--bs-table-striped-bg, #f8f9fa);\r\n }\r\n\r\n border-bottom: solid 1px var(--row-border-color);\r\n\r\n &:hover {\r\n background-color: var(--highlight-color) !important;\r\n }\r\n\r\n &:focus {\r\n background-color: var(--highlight-color) !important;\r\n border-bottom-color: var(--highlight-color) !important;\r\n outline: none;\r\n }\r\n }\r\n\r\n // Meta footer\r\n tfoot {\r\n min-width: 280px;\r\n\r\n td {\r\n padding: var(--padding-y-header) var(--padding-x);\r\n }\r\n\r\n .dg-page-nav {\r\n display: flex;\r\n align-items: center;\r\n min-width: 160px;\r\n }\r\n\r\n .dg-input-page {\r\n width: 4rem;\r\n }\r\n\r\n .dg-footer {\r\n display: flex;\r\n align-items: center;\r\n flex-direction: row;\r\n justify-content: space-between;\r\n }\r\n\r\n .dg-pagination {\r\n display: flex;\r\n text-align: center;\r\n\r\n button {\r\n // Fix icon inside button\r\n position: relative;\r\n width: 2rem;\r\n }\r\n }\r\n\r\n .dg-meta {\r\n // Prevent layout from jumping around\r\n min-width: 160px;\r\n text-align: right;\r\n }\r\n\r\n &.dg-footer-compact {\r\n .dg-meta {\r\n display: none;\r\n }\r\n\r\n .dg-input-page {\r\n display: none;\r\n }\r\n }\r\n }\r\n\r\n // Pagination in header\r\n [aria-sort] {\r\n cursor: pointer;\r\n padding-right: 1.5rem;\r\n }\r\n\r\n [aria-sort=\"none\"]:after,\r\n [aria-sort=\"none\"]:before,\r\n [aria-sort=\"ascending\"]:before,\r\n [aria-sort=\"descending\"]:after {\r\n right: 0.5rem;\r\n top: calc(50% - 0.5rem);\r\n border: solid transparent;\r\n content: \" \";\r\n height: 0;\r\n width: 0;\r\n position: absolute;\r\n border-color: rgba(0, 0, 0, 0);\r\n border-width: 0.25rem;\r\n margin-left: -0.25rem;\r\n }\r\n\r\n [aria-sort=\"none\"] {\r\n &:before {\r\n border-bottom-color: currentColor;\r\n opacity: 0.25;\r\n top: calc(50% - 0.6rem);\r\n }\r\n\r\n &:after {\r\n border-top-color: currentColor;\r\n opacity: 0.25;\r\n bottom: calc(50% - 0.5rem);\r\n top: auto;\r\n }\r\n }\r\n\r\n [aria-sort=\"ascending\"]:before {\r\n border-bottom-color: var(--body-color);\r\n opacity: 0.75;\r\n }\r\n\r\n [aria-sort=\"descending\"]:after {\r\n border-top-color: var(--body-color);\r\n opacity: 0.75;\r\n bottom: calc(50% - 0.5rem);\r\n top: auto;\r\n }\r\n}\r\n\r\n[data-bs-theme=\"dark\"] data-grid {\r\n --scroller-color-lightness: 20%;\r\n --highlight-color: #43423e;\r\n --header-background: var(--bs-gray-800, #34373b);\r\n --header-color: var(--bs-light, #e9ecef);\r\n --body-color: var(--bs-body-color, #494e53);\r\n --row-border-color: var(--bs-gray-900, #212325);\r\n\r\n tbody tr {\r\n &:nth-child(even) {\r\n background-color: var(--bs-table-striped-bg, #2c3034);\r\n }\r\n }\r\n}","/**\n * Data Grid Web component \n * https://github.com/lekoala/data-grid\n */\n@keyframes dataGridShow {\n 0% {\n opacity: 1;\n }\n 100% {\n opacity: 0.5;\n }\n}\ndata-grid {\n --padding: 0.5rem;\n --padding-x: 0.75rem;\n --padding-y: 0.5rem;\n --padding-y-header: 0.75rem;\n --padding-half: calc(var(--padding) / 2);\n --color-rgb: var(--bs-primary-rgb, 13, 110, 253);\n --color: rgb(var(--color-rgb));\n --highlight-color: #fffcee;\n --header-background: var(--bs-gray-200, #e9ecef);\n --header-color: var(--bs-dark, #212529);\n --input-background: var(--bs-body-bg, #ffffff);\n --input-border-color: var(--bs-border-color, #e9ecef);\n --btn-background: var(--bs-body-bg, #ffffff);\n --btn-color: var(--color);\n --btn-border-color: var(--bs-border-color, #e9ecef);\n --body-bg: var(--bs-body-bg, #212529);\n --body-color: var(--bs-body-color, #212529);\n --icon-scale: 1;\n --border-radius: 0.25rem;\n --row-border-color: #f2f2f2;\n --responsive-width: 60%;\n --black: var(--bs-black, #000);\n --white: var(--bs-white, #fff);\n --gray: var(--bs-gray, #6c757d);\n --gray-dark: var(--bs-gray-dark, #343a40);\n --gray-100: var(--bs-gray-100, #f8f9fa);\n --gray-200: var(--bs-gray-200, #e9ecef);\n --gray-300: var(--bs-gray-300, #dee2e6);\n --gray-400: var(--bs-gray-400, #ced4da);\n --gray-500: var(--bs-gray-500, #adb5bd);\n --gray-600: var(--bs-gray-600, #6c757d);\n --gray-700: var(--bs-gray-700, #495057);\n --gray-800: var(--bs-gray-800, #343a40);\n --gray-900: var(--bs-gray-900, #212529);\n display: block;\n min-height: 6rem;\n position: relative;\n}\ndata-grid {\n --scroller-color: 0, 0%;\n --scroller-color-lightness: 80%;\n --scroller-hover-factor: 0.8;\n --scroller-thumb: hsl(var(--scroller-color), var(--scroller-color-lightness));\n /* Replicate hover for webkit */\n --scroller-thumb-hover: hsl(var(--scroller-color), calc(var(--scroller-color-lightness) * var(--scroller-hover-factor)));\n --scroller-background: transparent;\n scrollbar-color: var(--scroller-thumb) var(--scroller-background);\n scrollbar-width: thin;\n}\ndata-grid::-webkit-scrollbar {\n width: 8px;\n height: 8px;\n}\ndata-grid::-webkit-scrollbar-track {\n background: transparent;\n}\ndata-grid::-webkit-scrollbar-thumb {\n background: var(--scroller-thumb);\n}\ndata-grid::-webkit-scrollbar-thumb:hover {\n background: var(--scroller-thumb-hover);\n}\ndata-grid[class=\"\"] > table[role=grid] tr.dg-head-columns, data-grid:not([class]) > table[role=grid] tr.dg-head-columns, data-grid.dg-loading > table[role=grid] tr.dg-head-columns {\n display: none;\n}\ndata-grid img {\n border: none;\n height: auto;\n max-width: 100%;\n vertical-align: middle;\n}\ndata-grid [hidden] {\n display: none;\n}\ndata-grid table {\n display: table;\n table-layout: fixed;\n width: 100%;\n max-width: 100%;\n white-space: normal;\n background: var(--header-background);\n}\ndata-grid thead,\ndata-grid tfoot {\n background-color: var(--header-background);\n color: var(--header-color);\n}\ndata-grid.dg-loading:not(.dg-initialized) thead,\ndata-grid.dg-loading:not(.dg-initialized) tfoot {\n background: none;\n}\ndata-grid.dg-loading tbody {\n animation-name: dataGridShow;\n animation-timing-function: ease-in;\n animation-fill-mode: forwards;\n animation-duration: 0.3s;\n pointer-events: none;\n}\ndata-grid tr {\n position: relative;\n}\ndata-grid th,\ndata-grid td {\n empty-cells: show;\n padding: var(--padding-y) var(--padding-x);\n text-align: left;\n}\ndata-grid th[tabindex],\ndata-grid td[tabindex] {\n outline: none;\n word-break: normal;\n}\ndata-grid th {\n font-weight: bold;\n padding: var(--padding-y-header) var(--padding-x);\n}\ndata-grid th,\ndata-grid td {\n position: relative;\n overflow: hidden;\n text-align: left;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\ndata-grid th.dg-wrap,\ndata-grid td.dg-wrap {\n white-space: normal;\n word-break: break-all;\n}\ndata-grid .dg-expandable {\n cursor: pointer;\n}\ndata-grid .dg-expandable.dg-expanded td {\n white-space: normal;\n word-break: break-all;\n}\ndata-grid .dg-clickable-cell {\n margin: 0;\n position: absolute;\n top: 0;\n left: 0;\n width: 100%;\n height: 100%;\n cursor: pointer;\n display: flex;\n align-items: center;\n justify-content: center;\n}\ndata-grid[sticky] table thead,\ndata-grid[sticky] table tfoot {\n z-index: 2;\n position: sticky;\n margin: 0;\n border: 0;\n}\ndata-grid[sticky] table thead {\n inset-block-start: -1px;\n}\ndata-grid[sticky] table tfoot {\n inset-block-end: -1px;\n}\ndata-grid .dg-nav-icon,\ndata-grid .dg-skip-icon {\n width: 22px;\n height: 22px;\n box-sizing: border-box;\n position: absolute;\n display: block;\n top: 50%;\n left: 50%;\n transform: translate(-50%, -50%) scale(var(--icon-scale, 1));\n}\ndata-grid .dg-nav-icon:before, data-grid .dg-nav-icon:after,\ndata-grid .dg-skip-icon:before,\ndata-grid .dg-skip-icon:after {\n content: \"\";\n display: block;\n box-sizing: border-box;\n position: absolute;\n}\ndata-grid .dg-nav-icon::before {\n width: 0;\n height: 10px;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n border-left: 6px solid;\n top: 6px;\n left: 9px;\n}\ndata-grid .dg-skip-icon::before {\n width: 3px;\n height: 10px;\n background: currentColor;\n top: 6px;\n left: 14px;\n}\ndata-grid .dg-skip-icon::after {\n width: 0;\n height: 10px;\n border-top: 5px solid transparent;\n border-bottom: 5px solid transparent;\n border-left: 6px solid;\n top: 6px;\n left: 7px;\n}\ndata-grid .dg-rotate {\n transform: rotate(-180deg);\n}\ndata-grid button {\n background-color: var(--btn-background);\n border: solid 1px var(--btn-border-color);\n border-radius: var(--border-radius);\n color: var(--body-color);\n height: 2rem;\n margin: 0 0.2rem;\n padding: 0 0.5rem;\n pointer-events: all;\n text-align: center;\n cursor: pointer;\n}\ndata-grid button:hover {\n opacity: 0.7;\n}\ndata-grid button:disabled:hover {\n background-color: inherit;\n border-color: inherit;\n}\ndata-grid input[type=checkbox] {\n margin: 0;\n}\ndata-grid input:not([type=checkbox]),\ndata-grid select {\n background-color: var(--input-background, \"#fff\");\n color: currentColor;\n box-sizing: border-box;\n border: 1px solid var(--input-border-color, \"#f0f0f0\");\n border-radius: var(--border-radius);\n height: 2rem;\n margin: 0 0.2rem;\n padding: 0 var(--padding);\n max-width: none;\n}\ndata-grid input:not([type=checkbox]):focus,\ndata-grid select:focus,\ndata-grid button:focus {\n box-shadow: 0 0 0 var(--padding-half) rgba(var(--color-rgb), 0.25);\n outline: 0;\n}\ndata-grid input:not([type=checkbox])[disabled], data-grid input:not([type=checkbox]):disabled,\ndata-grid select[disabled],\ndata-grid select:disabled,\ndata-grid button[disabled],\ndata-grid button:disabled {\n opacity: 0.35;\n pointer-events: none;\n}\ndata-grid thead tr:nth-child(2) th {\n padding: 0 2px 0 0;\n background-color: transparent;\n}\ndata-grid thead tr:nth-child(2) th > * {\n width: 100%;\n border-radius: 0;\n margin: 0;\n}\ndata-grid thead tr:nth-child(2) th input:focus {\n box-shadow: inset 0px 0px 0px 1px var(--color);\n}\ndata-grid tbody td.dg-editable-col {\n padding: 0;\n height: 0;\n}\ndata-grid tbody td input.dg-editable {\n width: 100%;\n background: transparent;\n border: 0;\n border-radius: 0;\n margin: 0;\n box-shadow: none;\n height: 100%;\n}\ndata-grid tbody td input.dg-editable:focus {\n box-shadow: inset 0px 0px 0px 1px var(--color);\n}\ndata-grid.dg-empty tbody {\n height: 4rem;\n position: relative;\n}\ndata-grid.dg-empty tbody:before {\n position: absolute;\n top: 50%;\n left: 50%;\n content: attr(data-empty);\n transform: translate(-50%, -50%);\n opacity: 0.5;\n font-size: 1.5rem;\n text-align: center;\n white-space: nowrap;\n text-overflow: ellipsis;\n overflow: hidden;\n width: 90%;\n}\ndata-grid.dg-empty tr.dg-fake-row {\n height: 4rem;\n border: none;\n}\ndata-grid.dg-empty.dg-network-error table {\n color: #842029;\n background-color: #f8d7da;\n border: 1px solid #f5c2c7;\n}\ndata-grid.dg-empty.dg-network-error tbody {\n height: auto;\n}\ndata-grid.dg-empty.dg-network-error tbody:before {\n font-size: 2rem;\n top: auto;\n transform: translate(-50%);\n}\ndata-grid.dg-empty.dg-network-error tbody tr:not(.dg-fake-row) {\n display: none;\n}\ndata-grid.dg-empty:not(.dg-network-error) tbody:before {\n top: auto;\n transform: translate(-50%, 30%);\n}\ndata-grid tbody tr {\n border-bottom: solid 1px var(--row-border-color);\n}\ndata-grid tbody tr:nth-child(even) {\n background-color: var(--bs-table-striped-bg, #f8f9fa);\n}\ndata-grid tbody tr:hover {\n background-color: var(--highlight-color) !important;\n}\ndata-grid tbody tr:focus {\n background-color: var(--highlight-color) !important;\n border-bottom-color: var(--highlight-color) !important;\n outline: none;\n}\ndata-grid tfoot {\n min-width: 280px;\n}\ndata-grid tfoot td {\n padding: var(--padding-y-header) var(--padding-x);\n}\ndata-grid tfoot .dg-page-nav {\n display: flex;\n align-items: center;\n min-width: 160px;\n}\ndata-grid tfoot .dg-input-page {\n width: 4rem;\n}\ndata-grid tfoot .dg-footer {\n display: flex;\n align-items: center;\n flex-direction: row;\n justify-content: space-between;\n}\ndata-grid tfoot .dg-pagination {\n display: flex;\n text-align: center;\n}\ndata-grid tfoot .dg-pagination button {\n position: relative;\n width: 2rem;\n}\ndata-grid tfoot .dg-meta {\n min-width: 160px;\n text-align: right;\n}\ndata-grid tfoot.dg-footer-compact .dg-meta {\n display: none;\n}\ndata-grid tfoot.dg-footer-compact .dg-input-page {\n display: none;\n}\ndata-grid [aria-sort] {\n cursor: pointer;\n padding-right: 1.5rem;\n}\ndata-grid [aria-sort=none]:after,\ndata-grid [aria-sort=none]:before,\ndata-grid [aria-sort=ascending]:before,\ndata-grid [aria-sort=descending]:after {\n right: 0.5rem;\n top: calc(50% - 0.5rem);\n border: solid transparent;\n content: \" \";\n height: 0;\n width: 0;\n position: absolute;\n border-color: rgba(0, 0, 0, 0);\n border-width: 0.25rem;\n margin-left: -0.25rem;\n}\ndata-grid [aria-sort=none]:before {\n border-bottom-color: currentColor;\n opacity: 0.25;\n top: calc(50% - 0.6rem);\n}\ndata-grid [aria-sort=none]:after {\n border-top-color: currentColor;\n opacity: 0.25;\n bottom: calc(50% - 0.5rem);\n top: auto;\n}\ndata-grid [aria-sort=ascending]:before {\n border-bottom-color: var(--body-color);\n opacity: 0.75;\n}\ndata-grid [aria-sort=descending]:after {\n border-top-color: var(--body-color);\n opacity: 0.75;\n bottom: calc(50% - 0.5rem);\n top: auto;\n}\n\n[data-bs-theme=dark] data-grid {\n --scroller-color-lightness: 20%;\n --highlight-color: #43423e;\n --header-background: var(--bs-gray-800, #34373b);\n --header-color: var(--bs-light, #e9ecef);\n --body-color: var(--bs-body-color, #494e53);\n --row-border-color: var(--bs-gray-900, #212325);\n}\n[data-bs-theme=dark] data-grid tbody tr:nth-child(even) {\n background-color: var(--bs-table-striped-bg, #2c3034);\n}\n\ndata-grid[dir=rtl] th,\ndata-grid[dir=rtl] td {\n text-align: right;\n}\ndata-grid[dir=rtl] [aria-sort] {\n padding-left: 1rem;\n padding-right: 0.5rem;\n}\ndata-grid[dir=rtl] [aria-sort=none]:after,\ndata-grid[dir=rtl] [aria-sort=none]:before,\ndata-grid[dir=rtl] [aria-sort=ascending]:before,\ndata-grid[dir=rtl] [aria-sort=descending]:after {\n left: 0.75rem;\n right: auto;\n}\ndata-grid[dir=rtl] tfoot .dg-meta {\n text-align: left;\n}\n\ndata-grid .dg-menu {\n position: absolute;\n z-index: 3;\n background: var(--body-bg);\n list-style: none;\n max-width: 150px;\n margin: 0;\n padding: var(--padding);\n box-shadow: 0 0 1rem rgba(0, 0, 0, 0.25);\n border-radius: var(--border-radius);\n}\ndata-grid .dg-menu li {\n margin: 0;\n padding: 0;\n}\ndata-grid .dg-menu label {\n display: flex;\n align-items: center;\n margin-bottom: 0.25em;\n}\ndata-grid .dg-menu input {\n margin-right: 0.5em;\n}\n\ndata-grid .dg-actions {\n text-overflow: initial;\n width: 100px;\n text-align: right;\n white-space: nowrap !important;\n}\ndata-grid .dg-actions button {\n margin: 0;\n}\ndata-grid .dg-actions button + button {\n margin-left: 0.5rem;\n}\ndata-grid .dg-actions .dg-actions-toggle {\n display: none;\n width: calc(100px - var(--padding-x) * 2);\n}\ndata-grid .dg-actions.dg-actions-1 {\n width: 100%;\n}\ndata-grid .dg-actions.dg-actions-2 button {\n width: calc(50% - 0.25rem);\n}\ndata-grid .dg-actions.dg-actions-more button {\n display: none;\n}\ndata-grid .dg-actions.dg-actions-more button.dg-actions-toggle {\n display: inline-block;\n}\ndata-grid .dg-actions.dg-actions-expand {\n position: absolute;\n right: 0;\n display: flex;\n align-items: center;\n justify-content: flex-end;\n width: 100%;\n height: 100%;\n}\ndata-grid .dg-actions.dg-actions-expand.dg-actions-more {\n width: 100%;\n}\ndata-grid .dg-actions.dg-actions-expand.dg-actions-more button {\n display: inline-block;\n}\ndata-grid tr.dg-actionable {\n cursor: pointer;\n}\ndata-grid tr.dg-actionable:hover td {\n background-color: var(--highlight-color);\n}\n\ndata-grid .dg-resizer {\n position: absolute;\n top: 0;\n right: 0;\n width: 6px;\n z-index: 2;\n cursor: col-resize;\n user-select: none;\n}\ndata-grid .dg-resizer:before {\n content: \"\";\n display: block;\n position: absolute;\n top: var(--padding-y-header);\n height: 1.5rem;\n right: 0;\n width: 2px;\n background: var(--body-color);\n opacity: 0.2;\n}\ndata-grid .dg-resizer:hover:before {\n opacity: 0.6;\n}\ndata-grid .dg-resizer.dg-resizer-active {\n border-right: 1px dashed var(--color);\n}\ndata-grid .dg-resizer.dg-resizer-active:before {\n opacity: 0.6;\n}\n\ndata-grid .dg-responsive-toggle {\n padding: 0;\n text-align: center;\n}\ndata-grid .dg-responsive-child-row > td {\n padding: 0;\n}\ndata-grid .dg-responsive-table {\n table-layout: auto;\n border: 0;\n}\ndata-grid .dg-responsive-table td,\ndata-grid .dg-responsive-table th {\n white-space: normal;\n}\ndata-grid .dg-responsive-table th {\n max-width: 40%;\n}\n\n@media only screen and (max-width: 767px) {\n data-grid[responsive] .dg-resizer {\n display: none;\n }\n data-grid[responsive] .dg-meta {\n display: none;\n }\n data-grid[responsive] .dg-input-page {\n display: none;\n }\n data-grid[responsive] table,\n data-grid[responsive] tbody,\n data-grid[responsive] tfoot,\n data-grid[responsive] th,\n data-grid[responsive] td,\n data-grid[responsive] tr:not([hidden]) {\n display: block;\n }\n data-grid[responsive] thead {\n display: flex;\n border-bottom: 2px solid var(--header-background);\n }\n data-grid[responsive] thead > tr {\n flex-grow: 1;\n }\n data-grid[responsive] thead th {\n width: auto;\n }\n data-grid[responsive] tbody tr {\n padding: 0;\n border: 1px solid var(--header-background);\n }\n data-grid[responsive] tbody td {\n border: none;\n border-bottom: 1px solid var(--row-border-color);\n position: relative;\n padding-left: calc(100% - var(--responsive-width) - var(--padding) * 2);\n }\n data-grid[responsive] tbody td:last-child {\n border: 0;\n }\n data-grid[responsive] tbody td:before {\n position: absolute;\n top: 0;\n left: 0;\n padding: var(--padding);\n width: calc(100% - var(--responsive-width) - var(--padding) * 4);\n content: attr(data-name);\n display: block;\n font-weight: bold;\n background-color: var(--header-background);\n }\n data-grid[responsive] tbody td[role=gridcell] {\n padding-left: calc(100% - var(--responsive-width) - var(--padding) * 4 + 0.5rem);\n }\n data-grid[responsive] .dg-selectable {\n height: 28px;\n margin: 2px 1px 2px;\n }\n data-grid[responsive] td.dg-selectable::before, data-grid[responsive] td.dg-actions::before {\n padding: 0;\n }\n data-grid[responsive] td.dg-selectable label {\n padding: 5px;\n }\n data-grid[responsive] td[role=gridcell] {\n min-height: 35px;\n width: auto;\n }\n data-grid[responsive] td[data-name]::before {\n height: 100%;\n }\n data-grid[responsive] td.dg-actions {\n padding-left: inherit;\n width: inherit;\n }\n data-grid[responsive] .dg-actions button {\n width: inherit !important;\n }\n data-grid[responsive] tr.dg-head-columns {\n padding: 0;\n width: calc(100% - var(--responsive-width) - var(--padding) * 4);\n }\n data-grid[responsive] tr.dg-head-columns th[role=\"columnheader button\"] {\n padding: 0.36em 1.3em 0.36em 0.75em;\n }\n data-grid[responsive] tr.dg-head-filters {\n background: transparent;\n vertical-align: top;\n padding: 0;\n width: calc(100% - (100% - var(--responsive-width) - var(--padding) * 4));\n }\n data-grid[responsive] .dg-head-filters th input:not([type=checkbox], [type=radio]) {\n height: 2.25em;\n }\n data-grid[responsive] .dg-head-filters th.dg-selectable {\n background: transparent;\n }\n data-grid[responsive] .dg-head-filters th.dg-selectable label::before {\n content: \"Column Filters\";\n }\n data-grid[responsive] tfoot .dg-page-nav {\n min-width: revert;\n }\n data-grid[data-responsive=true] tfoot .dg-page-nav {\n min-width: revert;\n }\n}\n\n/*# sourceMappingURL=data-grid.css.map */\n","data-grid {\r\n &[dir=\"rtl\"] {\r\n th,\r\n td {\r\n text-align: right;\r\n }\r\n [aria-sort] {\r\n padding-left: 1rem;\r\n padding-right: 0.5rem;\r\n }\r\n [aria-sort=\"none\"]:after,\r\n [aria-sort=\"none\"]:before,\r\n [aria-sort=\"ascending\"]:before,\r\n [aria-sort=\"descending\"]:after {\r\n left: 0.75rem;\r\n right: auto;\r\n }\r\n tfoot .dg-meta {\r\n text-align: left;\r\n }\r\n }\r\n}\r\n","data-grid {\r\n .dg-menu {\r\n position: absolute;\r\n z-index: 3;\r\n background: var(--body-bg);\r\n list-style: none;\r\n max-width: 150px;\r\n margin: 0;\r\n padding: var(--padding);\r\n box-shadow: 0 0 1rem rgba(0, 0, 0, 0.25);\r\n border-radius: var(--border-radius);\r\n\r\n li {\r\n margin: 0;\r\n padding: 0;\r\n }\r\n label {\r\n display: flex;\r\n align-items: center;\r\n margin-bottom: 0.25em;\r\n }\r\n input {\r\n margin-right: 0.5em;\r\n }\r\n }\r\n}\r\n","data-grid {\r\n .dg-actions {\r\n text-overflow: initial;\r\n width: 100px;\r\n text-align: right;\r\n white-space: nowrap !important;\r\n\r\n button {\r\n margin: 0;\r\n\r\n + button {\r\n margin-left: 0.5rem;\r\n }\r\n }\r\n .dg-actions-toggle {\r\n display: none;\r\n width: calc(100px - var(--padding-x) * 2);\r\n }\r\n &.dg-actions-1 {\r\n width: 100%;\r\n }\r\n // This needs icons to work\r\n &.dg-actions-2 button {\r\n width: calc(50% - 0.25rem);\r\n }\r\n &.dg-actions-more button {\r\n display: none;\r\n\r\n &.dg-actions-toggle {\r\n display: inline-block;\r\n }\r\n }\r\n &.dg-actions-expand {\r\n position: absolute;\r\n right: 0;\r\n display: flex;\r\n align-items: center;\r\n justify-content: flex-end;\r\n width: 100%;\r\n height: 100%;\r\n }\r\n &.dg-actions-expand.dg-actions-more {\r\n width: 100%;\r\n\r\n button {\r\n display: inline-block;\r\n }\r\n }\r\n }\r\n tr.dg-actionable {\r\n cursor: pointer;\r\n\r\n &:hover td {\r\n background-color: var(--highlight-color);\r\n }\r\n }\r\n}\r\n","data-grid {\r\n .dg-resizer {\r\n position: absolute;\r\n top: 0;\r\n right: 0;\r\n width: 6px; // clickable zone\r\n z-index: 2;\r\n cursor: col-resize;\r\n user-select: none;\r\n\r\n &:before {\r\n content: \"\";\r\n display: block;\r\n position: absolute;\r\n top: var(--padding-y-header);\r\n height: 1.5rem;\r\n right: 0;\r\n width: 2px;\r\n background: var(--body-color);\r\n opacity: 0.2;\r\n }\r\n &:hover:before {\r\n opacity: 0.6;\r\n }\r\n &.dg-resizer-active {\r\n border-right: 1px dashed var(--color);\r\n\r\n &:before {\r\n opacity: 0.6;\r\n }\r\n }\r\n }\r\n}\r\n","data-grid {\r\n .dg-responsive-toggle {\r\n padding: 0;\r\n text-align: center;\r\n }\r\n .dg-responsive-child-row > td {\r\n padding: 0;\r\n }\r\n .dg-responsive-table {\r\n table-layout: auto;\r\n border: 0;\r\n\r\n td,\r\n th {\r\n white-space: normal;\r\n }\r\n\r\n th {\r\n max-width: 40%;\r\n }\r\n }\r\n}\r\n\r\n// CSS Only responsive\r\n@media only screen and (max-width: 767px) {\r\n data-grid[responsive] {\r\n // Doesn't make any sense to resize\r\n .dg-resizer {\r\n display: none;\r\n }\r\n\r\n // more compact footer\r\n .dg-meta {\r\n display: none;\r\n }\r\n .dg-input-page {\r\n display: none;\r\n }\r\n\r\n // everything as blocks\r\n table,\r\n tbody,\r\n tfoot,\r\n th,\r\n td,\r\n tr:not([hidden]) {\r\n display: block;\r\n }\r\n\r\n // use flex for thead\r\n thead {\r\n display: flex;\r\n\r\n > tr {\r\n flex-grow: 1;\r\n }\r\n th {\r\n width: auto;\r\n }\r\n\r\n border-bottom: 2px solid var(--header-background);\r\n }\r\n\r\n // use pseudo element to display column name\r\n tbody {\r\n tr {\r\n padding: 0;\r\n border: 1px solid var(--header-background);\r\n }\r\n td {\r\n border: none;\r\n border-bottom: 1px solid var(--row-border-color);\r\n position: relative;\r\n padding-left: calc(100% - var(--responsive-width) - var(--padding) * 2);\r\n\r\n &:last-child {\r\n border: 0;\r\n }\r\n &:before {\r\n position: absolute;\r\n top: 0;\r\n left: 0;\r\n padding: var(--padding);\r\n width: calc(100% - var(--responsive-width) - var(--padding) * 4);\r\n content: attr(data-name);\r\n display: block;\r\n font-weight: bold;\r\n background-color: var(--header-background);\r\n }\r\n &[role=\"gridcell\"] {\r\n padding-left: calc(100% - var(--responsive-width) - var(--padding) * 4 + 0.5rem);\r\n }\r\n }\r\n }\r\n\r\n // give selectable some room\r\n .dg-selectable {\r\n height: 28px;\r\n margin: 2px 1px 2px;\r\n }\r\n\r\n td {\r\n &.dg-selectable::before,\r\n &.dg-actions::before {\r\n padding: 0;\r\n }\r\n &.dg-selectable label {\r\n padding: 5px;\r\n }\r\n &[role=\"gridcell\"] {\r\n min-height: 35px;\r\n width: auto;\r\n }\r\n &[data-name]::before {\r\n height: 100%;\r\n }\r\n &.dg-actions {\r\n padding-left: inherit;\r\n width: inherit;\r\n }\r\n }\r\n .dg-actions button {\r\n width: inherit !important;\r\n }\r\n tr {\r\n &.dg-head-columns {\r\n padding: 0;\r\n width: calc(100% - var(--responsive-width) - var(--padding) * 4);\r\n\r\n th[role=\"columnheader button\"] {\r\n padding: 0.36em 1.3em 0.36em 0.75em;\r\n }\r\n }\r\n &.dg-head-filters {\r\n background: transparent;\r\n vertical-align: top;\r\n padding: 0;\r\n width: calc(100% - (100% - var(--responsive-width) - var(--padding) * 4));\r\n }\r\n }\r\n .dg-head-filters th input:not([type=\"checkbox\"], [type=\"radio\"]) {\r\n height: 2.25em;\r\n }\r\n .dg-head-filters th.dg-selectable {\r\n background: transparent;\r\n }\r\n .dg-head-filters th.dg-selectable label::before {\r\n content: \"Column Filters\";\r\n }\r\n\r\n tfoot .dg-page-nav {\r\n min-width: revert;\r\n }\r\n }\r\n\r\n data-grid[data-responsive=true] {\r\n tfoot .dg-page-nav {\r\n min-width: revert;\r\n } \r\n }\r\n}\r\n"]} \ No newline at end of file diff --git a/dist/data-grid.js b/dist/data-grid.js index e72e88c..c6f100f 100644 --- a/dist/data-grid.js +++ b/dist/data-grid.js @@ -378,7 +378,8 @@ function applyColumnDefinition(el, column) { } } } -var DataGrid = class extends base_element_default { +var DataGrid = class _DataGrid extends base_element_default { + #filterSelector = "[id^=dg-filter]"; _ready() { setAttribute(this, "id", this.options.id ?? randstr("el-"), true); this.data = []; @@ -392,11 +393,13 @@ var DataGrid = class extends base_element_default { for (const [pluginName, pluginClass] of Object.entries(plugins)) { this.plugins[pluginName] = new pluginClass(this); } - for (const attr of DataGrid.observedAttributes) { + for (const attr of _DataGrid.observedAttributes) { if (attr.indexOf("data-") === 0) { setAttribute(this, attr, this.options[camelize(attr.slice(5))]); } } + if (this.options.showSpinner && this.plugins.SpinnerSupport) + this.plugins.SpinnerSupport.add(); } static template() { return ` @@ -473,7 +476,9 @@ var DataGrid = class extends base_element_default { responsive: 1, responsiveHidden: false, format: "", - transform: "" + transform: "", + filterType: "text", + firstFilterOption: { value: "", text: "" } }; } /** @@ -519,7 +524,10 @@ var DataGrid = class extends base_element_default { autoheight: true, autohidePager: false, responsive: false, - responsiveToggle: true + responsiveToggle: true, + filterOnEnter: true, + showSpinner: false, + spinnerCssClasses: "" }; } /** @@ -1082,14 +1090,14 @@ var DataGrid = class extends base_element_default { } getFilters() { let filters = []; - const inputs = findAll(this, "thead tr.dg-head-filters input"); + const inputs = findAll(this, this.#filterSelector); inputs.forEach((input) => { filters[input.dataset.name] = input.value; }); return filters; } clearFilters() { - const inputs = findAll(this, "thead tr.dg-head-filters input"); + const inputs = findAll(this, this.#filterSelector); inputs.forEach((input) => { input.value = ""; }); @@ -1102,7 +1110,7 @@ var DataGrid = class extends base_element_default { this.reload(); } else { this.data = this.originalData?.slice() ?? []; - const inputs = findAll(this, "thead tr.dg-head-filters input"); + const inputs = findAll(this, this.#filterSelector); inputs.forEach((input) => { let value = input.value; if (value) { @@ -1414,23 +1422,16 @@ var DataGrid = class extends base_element_default { } let th = ce("th"); th.setAttribute("aria-colindex", "" + colIdx); - let input = ce("input"); - input.type = "text"; - input.inputMode = "search"; - input.autocomplete = "off"; - input.spellcheck = false; - input.dataset.name = column.field; - input.id = randstr("dg-filter-"); - input.setAttribute("aria-labelledby", relatedTh.getAttribute("id")); + let filter = this.createFilterElement(column, relatedTh); if (!this.options.filter) { th.tabIndex = 0; } else { - input.tabIndex = 0; + filter.tabIndex = 0; } if (column.hidden) { th.setAttribute("hidden", ""); } - th.appendChild(input); + th.appendChild(filter); tr.appendChild(th); idx++; }); @@ -1438,15 +1439,40 @@ var DataGrid = class extends base_element_default { this.plugins.RowActions.makeActionFilter(tr); } thead.replaceChild(tr, thead.querySelector("tr.dg-head-filters")); - tr.querySelectorAll("input").forEach((input) => { - input.addEventListener("keypress", (e) => { + tr.querySelectorAll(this.#filterSelector).forEach((el) => { + const eventName = /select/i.test(el.tagName) ? "change" : "keyup"; + el.addEventListener(eventName, (e) => { const key = e.keyCode || e.key; - if (key === 13 || key === "Enter") { + if (key === 13 || key === "Enter" || !this.options.filterOnEnter || e.type == "change") { this.filterData.call(this); } }); }); } + createFilterElement(column, relatedTh) { + const isSelect = column.filterType == "select", filter = isSelect ? ce("select") : ce("input"); + if (isSelect) { + if (!Array.isArray(column.filterList)) { + const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter((v) => !!v).sort(); + column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e }))); + } + column.filterList.forEach((e) => { + const opt = ce("option"); + opt.value = e.value; + opt.text = e.text; + filter.add(opt); + }); + } else { + filter.type = "text"; + filter.inputMode = "search"; + filter.autocomplete = "off"; + filter.spellcheck = false; + } + filter.dataset.name = column.field; + filter.id = randstr("dg-filter-"); + filter.setAttribute("aria-labelledby", relatedTh.getAttribute("id")); + return filter; + } /** * Render the data as rows in tbody * It will call paginate() at the end @@ -1562,6 +1588,7 @@ var DataGrid = class extends base_element_default { if (this.plugins.SelectableRows) { this.plugins.SelectableRows.shouldSelectAll(tbody); } + this.data.length && this.classList.remove("dg-empty"); dispatch(this, "bodyRendered"); } paginate() { @@ -2646,6 +2673,34 @@ var EditableColumn = class extends base_plugin_default { }; var editable_column_default = EditableColumn; +// src/plugins/spinner-support.js +var SpinnerSupport = class extends base_plugin_default { + /** + * Adds a spinner element with its associated css styles. + */ + add() { + const grid = this.grid, show = grid.options.showSpinner; + if (!show) + return; + const cssClasses = grid.options.spinnerCssClasses, cls = cssClasses.split(" ").map((e) => `.${e}`).join(""), template = ` + +`; + if (!document.getElementById("dg-styles")) { + const styleParent = document.querySelector("head") ?? document.querySelector("body"), position = /head/i.test(styleParent.tagName) ? "beforeend" : "afterbegin"; + styleParent.insertAdjacentHTML(position, template); + } + grid.insertAdjacentHTML("afterbegin", ``); + } +}; +var spinner_support_default = SpinnerSupport; + // data-grid.js data_grid_default.registerPlugins({ ColumnResizer: column_resizer_default, @@ -2657,7 +2712,8 @@ data_grid_default.registerPlugins({ AutosizeColumn: autosize_column_default, ResponsiveGrid: responsive_grid_default, RowActions: row_actions_default, - EditableColumn: editable_column_default + EditableColumn: editable_column_default, + SpinnerSupport: spinner_support_default }); if (!customElements.get("data-grid")) { customElements.define("data-grid", data_grid_default); diff --git a/dist/data-grid.js.map b/dist/data-grid.js.map index d86944e..2ca7bac 100644 --- a/dist/data-grid.js.map +++ b/dist/data-grid.js.map @@ -1,7 +1,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/interpolate.js", "../src/utils/getTextWidth.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", "../src/plugins/row-actions.js", "../src/plugins/editable-column.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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\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 /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, \"thead tr.dg-head-filters input\");\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, \"thead tr.dg-head-filters input\");\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, \"thead tr.dg-head-filters input\");\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let input = ce(\"input\");\r\n input.type = \"text\";\r\n input.inputMode = \"search\";\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], - "mappings": ";;;AAIe,SAAR,SAA0B,KAAK;AACpC,SAAO,IAAI,YAAY,EAAE,QAAQ,qBAAqB,CAAC,GAAG,QAAQ,IAAI,YAAY,CAAC;AACrF;;;ACDe,SAAR,cAA+B,GAAG;AAEvC,MAAI,MAAM,QAAQ;AAChB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,SAAS;AACjB,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,MAAM,MAAM,QAAQ;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,OAAO,CAAC,EAAE,SAAS,GAAG;AAC9B,WAAO,OAAO,CAAC;AAAA,EACjB;AAEA,MAAI,KAAK,CAAC,KAAK,GAAG,EAAE,SAAS,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG;AAC/C,QAAI;AAEF,UAAI,EAAE,QAAQ,GAAG,MAAM,IAAI;AACzB,YAAI,EAAE,QAAQ,MAAM,GAAG;AAAA,MACzB;AACA,aAAO,KAAK,MAAM,mBAAmB,CAAC,CAAC;AAAA,IACzC,QAAE;AACA,cAAQ,MAAM,qBAAqB,CAAC;AACpC,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACA,SAAO;AACT;;;ACUA,IAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;AAOA,SAAS,YAAY,MAAM;AACzB,MAAI,sBAAsB,SAAS,IAAI,GAAG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H,CAAC;AACD,OAAG,YAAY,KAAK;AAAA,EACtB;AACF;AAEA,IAAO,0BAAQ;;;AC/Cf,kBAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAI,CAAC,eAAe,IAAI,WAAW,GAAG;AACpC,iBAAe,OAAO,aAAa,iBAAQ;AAC7C;AAEA,IAAOC,qBAAQ;", + "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/interpolate.js", "../src/utils/getTextWidth.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", "../src/plugins/row-actions.js", "../src/plugins/editable-column.js", "../src/plugins/spinner-support.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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading\r\n * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.showSpinner && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true,\r\n showSpinner: false,\r\n spinnerCssClasses: \"\"\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n show = grid.options.showSpinner;\r\n if (!show) return;\r\n const cssClasses = grid.options.spinnerCssClasses,\r\n cls = cssClasses.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!document.getElementById(\"dg-styles\")) {\r\n const styleParent = document.querySelector(\"head\") ?? document.querySelector(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data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,OAAO,MAAM;AAAA,MACf,CAAC;AAAA,IACH,CAAC;AACD,OAAG,YAAY,KAAK;AAAA,EACtB;AACF;AAEA,IAAO,0BAAQ;;;AC1Df,IAAM,iBAAN,cAA6B,oBAAW;AAAA;AAAA;AAAA;AAAA,EAItC,MAAM;AACJ,UAAM,OAAO,KAAK,MAChB,OAAO,KAAK,QAAQ;AACtB,QAAI,CAAC;AAAM;AACX,UAAM,aAAa,KAAK,QAAQ,mBAC9B,MAAM,WAAW,MAAM,GAAG,EAAE,IAAI,OAAK,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,GACrD,WAAW;AAAA;AAAA,cAEH,GAAG;AAAA,+BACc,GAAG;AAAA,8CACY,GAAG;AAAA;AAAA,4BAErB,GAAG;AAAA;AAAA;AAAA;AAI3B,QAAI,CAAC,SAAS,eAAe,WAAW,GAAG;AACzC,YAAM,cAAc,SAAS,cAAc,MAAM,KAAK,SAAS,cAAc,MAAM,GACjF,WAAW,QAAQ,KAAK,YAAY,OAAO,IAAI,cAAc;AAC/D,kBAAY,mBAAmB,UAAU,QAAQ;AAAA,IACnD;AACA,SAAK,mBAAmB,cAAc,aAAa,UAAU,QAAQ;AAAA,EACvE;AACF;AAEA,IAAO,0BAAQ;;;ACjBf,kBAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAI,CAAC,eAAe,IAAI,WAAW,GAAG;AACpC,iBAAe,OAAO,aAAa,iBAAQ;AAC7C;AAEA,IAAOC,qBAAQ;", "names": ["col", "e", "th", "labels", "data_grid_default"] } diff --git a/dist/data-grid.min.css b/dist/data-grid.min.css index 1e8c77c..1f253d0 100644 --- a/dist/data-grid.min.css +++ b/dist/data-grid.min.css @@ -1,3 +1,3 @@ -@keyframes dataGridShow{0%{opacity:1}100%{opacity:.5}}data-grid{--padding: 0.5rem;--padding-x: 0.75rem;--padding-y: 0.5rem;--padding-y-header: 0.75rem;--padding-half: calc(var(--padding) / 2);--color-rgb: var(--bs-primary-rgb, 13, 110, 253);--color: rgb(var(--color-rgb));--highlight-color: #fffcee;--header-background: var(--bs-gray-200, #e9ecef);--header-color: var(--bs-dark, #212529);--input-background: var(--bs-body-bg, #ffffff);--input-border-color: var(--bs-border-color, #e9ecef);--btn-background: var(--bs-body-bg, #ffffff);--btn-color: var(--color);--btn-border-color: var(--bs-border-color, #e9ecef);--body-bg: var(--bs-body-bg, #212529);--body-color: var(--bs-body-color, #212529);--icon-scale: 1;--border-radius: 0.25rem;--row-border-color: #f2f2f2;--responsive-width: 60%;--black: var(--bs-black, #000);--white: var(--bs-white, #fff);--gray: var(--bs-gray, #6c757d);--gray-dark: var(--bs-gray-dark, #343a40);--gray-100: var(--bs-gray-100, #f8f9fa);--gray-200: var(--bs-gray-200, #e9ecef);--gray-300: var(--bs-gray-300, #dee2e6);--gray-400: var(--bs-gray-400, #ced4da);--gray-500: var(--bs-gray-500, #adb5bd);--gray-600: var(--bs-gray-600, #6c757d);--gray-700: var(--bs-gray-700, #495057);--gray-800: var(--bs-gray-800, #343a40);--gray-900: var(--bs-gray-900, #212529);display:block;min-height:6rem;position:relative}data-grid{--scroller-color: 0, 0%;--scroller-color-lightness: 80%;--scroller-hover-factor: 0.8;--scroller-thumb: hsl(var(--scroller-color), var(--scroller-color-lightness));--scroller-thumb-hover: hsl(var(--scroller-color), calc(var(--scroller-color-lightness) * var(--scroller-hover-factor)));--scroller-background: transparent;scrollbar-color:var(--scroller-thumb) var(--scroller-background);scrollbar-width:thin}data-grid::-webkit-scrollbar{width:8px;height:8px}data-grid::-webkit-scrollbar-track{background:rgba(0,0,0,0)}data-grid::-webkit-scrollbar-thumb{background:var(--scroller-thumb)}data-grid::-webkit-scrollbar-thumb:hover{background:var(--scroller-thumb-hover)}data-grid img{border:none;height:auto;max-width:100%;vertical-align:middle}data-grid [hidden]{display:none}data-grid table{display:table;table-layout:fixed;width:100%;max-width:100%;white-space:normal;background:var(--header-background)}data-grid thead,data-grid tfoot{background-color:var(--header-background);color:var(--header-color)}data-grid.dg-loading:not(.dg-initialized) thead,data-grid.dg-loading:not(.dg-initialized) tfoot{background:none}data-grid.dg-loading tbody{animation-name:dataGridShow;animation-timing-function:ease-in;animation-fill-mode:forwards;animation-duration:.3s;pointer-events:none}data-grid tr{position:relative}data-grid th,data-grid td{empty-cells:show;padding:var(--padding-y) var(--padding-x);text-align:left}data-grid th[tabindex],data-grid td[tabindex]{outline:none;word-break:normal}data-grid th{font-weight:bold;padding:var(--padding-y-header) var(--padding-x)}data-grid th,data-grid td{position:relative;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}data-grid th.dg-wrap,data-grid td.dg-wrap{white-space:normal;word-break:break-all}data-grid .dg-expandable{cursor:pointer}data-grid .dg-expandable.dg-expanded td{white-space:normal;word-break:break-all}data-grid .dg-clickable-cell{margin:0;position:absolute;top:0;left:0;width:100%;height:100%;cursor:pointer;display:flex;align-items:center;justify-content:center}data-grid[sticky] table thead,data-grid[sticky] table tfoot{z-index:2;position:sticky;margin:0;border:0}data-grid[sticky] table thead{inset-block-start:-1px}data-grid[sticky] table tfoot{inset-block-end:-1px}data-grid .dg-nav-icon,data-grid .dg-skip-icon{width:22px;height:22px;box-sizing:border-box;position:absolute;display:block;top:50%;left:50%;transform:translate(-50%, -50%) scale(var(--icon-scale, 1))}data-grid .dg-nav-icon:before,data-grid .dg-nav-icon:after,data-grid .dg-skip-icon:before,data-grid .dg-skip-icon:after{content:"";display:block;box-sizing:border-box;position:absolute}data-grid .dg-nav-icon::before{width:0;height:10px;border-top:5px solid rgba(0,0,0,0);border-bottom:5px solid rgba(0,0,0,0);border-left:6px solid;top:6px;left:9px}data-grid .dg-skip-icon::before{width:3px;height:10px;background:currentColor;top:6px;left:14px}data-grid .dg-skip-icon::after{width:0;height:10px;border-top:5px solid rgba(0,0,0,0);border-bottom:5px solid rgba(0,0,0,0);border-left:6px solid;top:6px;left:7px}data-grid .dg-rotate{transform:rotate(-180deg)}data-grid button{background-color:var(--btn-background);border:solid 1px var(--btn-border-color);border-radius:var(--border-radius);color:var(--body-color);height:2rem;margin:0 .2rem;padding:0 .5rem;pointer-events:all;text-align:center;cursor:pointer}data-grid button:hover{opacity:.7}data-grid button:disabled:hover{background-color:inherit;border-color:inherit}data-grid input[type=checkbox]{margin:0}data-grid input:not([type=checkbox]),data-grid select{background-color:var(--input-background, "#fff");color:currentColor;box-sizing:border-box;border:1px solid var(--input-border-color, "#f0f0f0");border-radius:var(--border-radius);height:2rem;margin:0 .2rem;padding:0 var(--padding);max-width:none}data-grid input:not([type=checkbox]):focus,data-grid select:focus,data-grid button:focus{box-shadow:0 0 0 var(--padding-half) rgba(var(--color-rgb), 0.25);outline:0}data-grid input:not([type=checkbox])[disabled],data-grid input:not([type=checkbox]):disabled,data-grid select[disabled],data-grid select:disabled,data-grid button[disabled],data-grid button:disabled{opacity:.35;pointer-events:none}data-grid thead tr:nth-child(2) th{padding:0;background-color:rgba(0,0,0,0)}data-grid thead tr:nth-child(2) th input{width:100%;border-radius:0;margin:0}data-grid thead tr:nth-child(2) th input:focus{box-shadow:inset 0px 0px 0px 1px var(--color)}data-grid tbody td.dg-editable-col{padding:0;height:0}data-grid tbody td input.dg-editable{width:100%;background:rgba(0,0,0,0);border:0;border-radius:0;margin:0;box-shadow:none;height:100%}data-grid tbody td input.dg-editable:focus{box-shadow:inset 0px 0px 0px 1px var(--color)}data-grid.dg-empty tbody{height:4rem;position:relative}data-grid.dg-empty tbody:before{position:absolute;top:50%;left:50%;content:attr(data-empty);transform:translate(-50%, -50%);opacity:.5;font-size:1.5rem;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;width:90%}data-grid.dg-empty tr.dg-fake-row{height:4rem;border:none}data-grid.dg-empty.dg-network-error table{color:#842029;background-color:#f8d7da;border:1px solid #f5c2c7}data-grid.dg-empty.dg-network-error tbody{height:auto}data-grid.dg-empty.dg-network-error tbody:before{font-size:2rem;top:auto;transform:translate(-50%)}data-grid.dg-empty.dg-network-error tbody tr:not(.dg-fake-row){display:none}data-grid.dg-empty:not(.dg-network-error) tbody:before{top:auto;transform:translate(-50%, 30%)}data-grid tbody tr{border-bottom:solid 1px var(--row-border-color)}data-grid tbody tr:nth-child(even){background-color:var(--bs-table-striped-bg, #f8f9fa)}data-grid tbody tr:hover{background-color:var(--highlight-color) !important}data-grid tbody tr:focus{background-color:var(--highlight-color) !important;border-bottom-color:var(--highlight-color) !important;outline:none}data-grid tfoot{min-width:280px}data-grid tfoot td{padding:var(--padding-y-header) var(--padding-x)}data-grid tfoot .dg-page-nav{display:flex;align-items:center;min-width:160px}data-grid tfoot .dg-input-page{width:4rem}data-grid tfoot .dg-footer{display:flex;align-items:center;flex-direction:row;justify-content:space-between}data-grid tfoot .dg-pagination{display:flex;text-align:center}data-grid tfoot .dg-pagination button{position:relative;width:2rem}data-grid tfoot .dg-meta{min-width:160px;text-align:right}data-grid tfoot.dg-footer-compact .dg-meta{display:none}data-grid tfoot.dg-footer-compact .dg-input-page{display:none}data-grid [aria-sort]{cursor:pointer;padding-right:1.5rem}data-grid [aria-sort=none]:after,data-grid [aria-sort=none]:before,data-grid [aria-sort=ascending]:before,data-grid [aria-sort=descending]:after{right:.5rem;top:calc(50% - .5rem);border:solid rgba(0,0,0,0);content:" ";height:0;width:0;position:absolute;border-color:rgba(0,0,0,0);border-width:.25rem;margin-left:-0.25rem}data-grid [aria-sort=none]:before{border-bottom-color:currentColor;opacity:.25;top:calc(50% - .6rem)}data-grid [aria-sort=none]:after{border-top-color:currentColor;opacity:.25;bottom:calc(50% - .5rem);top:auto}data-grid [aria-sort=ascending]:before{border-bottom-color:var(--body-color);opacity:.75}data-grid [aria-sort=descending]:after{border-top-color:var(--body-color);opacity:.75;bottom:calc(50% - .5rem);top:auto}[data-bs-theme=dark] data-grid{--scroller-color-lightness: 20%;--highlight-color: #43423e;--header-background: var(--bs-gray-800, #34373b);--header-color: var(--bs-light, #e9ecef);--body-color: var(--bs-body-color, #494e53);--row-border-color: var(--bs-gray-900, #212325)}[data-bs-theme=dark] data-grid tbody tr:nth-child(even){background-color:var(--bs-table-striped-bg, #2c3034)}data-grid[dir=rtl] th,data-grid[dir=rtl] td{text-align:right}data-grid[dir=rtl] [aria-sort]{padding-left:1rem;padding-right:.5rem}data-grid[dir=rtl] [aria-sort=none]:after,data-grid[dir=rtl] [aria-sort=none]:before,data-grid[dir=rtl] [aria-sort=ascending]:before,data-grid[dir=rtl] [aria-sort=descending]:after{left:.75rem;right:auto}data-grid[dir=rtl] tfoot .dg-meta{text-align:left}data-grid .dg-menu{position:absolute;z-index:3;background:var(--body-bg);list-style:none;max-width:150px;margin:0;padding:var(--padding);box-shadow:0 0 1rem rgba(0,0,0,.25);border-radius:var(--border-radius)}data-grid .dg-menu li{margin:0;padding:0}data-grid .dg-menu label{display:flex;align-items:center;margin-bottom:.25em}data-grid .dg-menu input{margin-right:.5em}data-grid .dg-actions{text-overflow:initial;width:100px;text-align:right;white-space:nowrap !important}data-grid .dg-actions button{margin:0}data-grid .dg-actions button+button{margin-left:.5rem}data-grid .dg-actions .dg-actions-toggle{display:none;width:calc(100px - var(--padding-x)*2)}data-grid .dg-actions.dg-actions-1{width:100%}data-grid .dg-actions.dg-actions-2 button{width:calc(50% - .25rem)}data-grid .dg-actions.dg-actions-more button{display:none}data-grid .dg-actions.dg-actions-more button.dg-actions-toggle{display:inline-block}data-grid .dg-actions.dg-actions-expand{position:absolute;right:0;display:flex;align-items:center;justify-content:flex-end;width:100%;height:100%}data-grid .dg-actions.dg-actions-expand.dg-actions-more{width:100%}data-grid .dg-actions.dg-actions-expand.dg-actions-more button{display:inline-block}data-grid tr.dg-actionable{cursor:pointer}data-grid tr.dg-actionable:hover td{background-color:var(--highlight-color)}data-grid .dg-resizer{position:absolute;top:0;right:0;width:6px;z-index:2;cursor:col-resize;-webkit-user-select:none;-moz-user-select:none;user-select:none}data-grid .dg-resizer:before{content:"";display:block;position:absolute;top:var(--padding-y-header);height:1.5rem;right:0;width:2px;background:var(--body-color);opacity:.2}data-grid .dg-resizer:hover:before{opacity:.6}data-grid .dg-resizer.dg-resizer-active{border-right:1px dashed var(--color)}data-grid .dg-resizer.dg-resizer-active:before{opacity:.6}data-grid .dg-responsive-toggle{padding:0;text-align:center}data-grid .dg-responsive-child-row>td{padding:0}data-grid .dg-responsive-table{table-layout:auto;border:0}data-grid .dg-responsive-table td,data-grid .dg-responsive-table th{white-space:normal}data-grid .dg-responsive-table th{max-width:40%}@media only screen and (max-width: 767px){data-grid[responsive] .dg-resizer{display:none}data-grid[responsive] .dg-meta{display:none}data-grid[responsive] .dg-input-page{display:none}data-grid[responsive] table,data-grid[responsive] tbody,data-grid[responsive] tfoot,data-grid[responsive] th,data-grid[responsive] td,data-grid[responsive] tr:not([hidden]){display:block}data-grid[responsive] thead{display:flex;border-bottom:2px solid var(--header-background)}data-grid[responsive] thead>tr{flex-grow:1}data-grid[responsive] thead th{width:auto}data-grid[responsive] tbody tr{padding:0;border:1px solid var(--header-background)}data-grid[responsive] tbody td{border:none;border-bottom:1px solid var(--row-border-color);position:relative;padding-left:calc(100% - var(--responsive-width) - var(--padding)*2)}data-grid[responsive] tbody td:last-child{border:0}data-grid[responsive] tbody td:before{position:absolute;top:0;left:0;padding:var(--padding);width:calc(100% - var(--responsive-width) - var(--padding)*4);white-space:nowrap;content:attr(data-name);display:block;font-weight:bold;background-color:var(--header-background)}data-grid[responsive] tbody td[role=gridcell]{padding-left:calc(100% - var(--responsive-width) - var(--padding)*4 + .5rem)}data-grid[responsive] .dg-selectable{height:28px;margin:2px 1px 2px}data-grid[responsive] td.dg-selectable::before,data-grid[responsive] td.dg-actions::before{padding:0}data-grid[responsive] td.dg-selectable label{padding:5px}data-grid[responsive] td[role=gridcell]{min-height:35px;width:auto}data-grid[responsive] td[data-name]::before{height:100%}data-grid[responsive] td.dg-actions{padding-left:inherit;width:inherit}data-grid[responsive] .dg-actions button{width:inherit !important}data-grid[responsive] tr.dg-head-columns{padding:0;width:calc(100% - var(--responsive-width) - var(--padding)*4)}data-grid[responsive] tr.dg-head-columns th[role="columnheader button"]{padding:.36em 1.3em .36em .75em}data-grid[responsive] tr.dg-head-filters{background:rgba(0,0,0,0);vertical-align:top;padding:0;width:calc(100% - (100% - var(--responsive-width) - var(--padding)*4))}data-grid[responsive] .dg-head-filters th input:not([type=checkbox],[type=radio]){height:2.25em}data-grid[responsive] .dg-head-filters th.dg-selectable{background:rgba(0,0,0,0)}data-grid[responsive] .dg-head-filters th.dg-selectable label::before{content:"Column Filters"}} +@keyframes dataGridShow{0%{opacity:1}100%{opacity:.5}}data-grid{--padding: 0.5rem;--padding-x: 0.75rem;--padding-y: 0.5rem;--padding-y-header: 0.75rem;--padding-half: calc(var(--padding) / 2);--color-rgb: var(--bs-primary-rgb, 13, 110, 253);--color: rgb(var(--color-rgb));--highlight-color: #fffcee;--header-background: var(--bs-gray-200, #e9ecef);--header-color: var(--bs-dark, #212529);--input-background: var(--bs-body-bg, #ffffff);--input-border-color: var(--bs-border-color, #e9ecef);--btn-background: var(--bs-body-bg, #ffffff);--btn-color: var(--color);--btn-border-color: var(--bs-border-color, #e9ecef);--body-bg: var(--bs-body-bg, #212529);--body-color: var(--bs-body-color, #212529);--icon-scale: 1;--border-radius: 0.25rem;--row-border-color: #f2f2f2;--responsive-width: 60%;--black: var(--bs-black, #000);--white: var(--bs-white, #fff);--gray: var(--bs-gray, #6c757d);--gray-dark: var(--bs-gray-dark, #343a40);--gray-100: var(--bs-gray-100, #f8f9fa);--gray-200: var(--bs-gray-200, #e9ecef);--gray-300: var(--bs-gray-300, #dee2e6);--gray-400: var(--bs-gray-400, #ced4da);--gray-500: var(--bs-gray-500, #adb5bd);--gray-600: var(--bs-gray-600, #6c757d);--gray-700: var(--bs-gray-700, #495057);--gray-800: var(--bs-gray-800, #343a40);--gray-900: var(--bs-gray-900, #212529);display:block;min-height:6rem;position:relative}data-grid{--scroller-color: 0, 0%;--scroller-color-lightness: 80%;--scroller-hover-factor: 0.8;--scroller-thumb: hsl(var(--scroller-color), var(--scroller-color-lightness));--scroller-thumb-hover: hsl(var(--scroller-color), calc(var(--scroller-color-lightness) * var(--scroller-hover-factor)));--scroller-background: transparent;scrollbar-color:var(--scroller-thumb) var(--scroller-background);scrollbar-width:thin}data-grid::-webkit-scrollbar{width:8px;height:8px}data-grid::-webkit-scrollbar-track{background:rgba(0,0,0,0)}data-grid::-webkit-scrollbar-thumb{background:var(--scroller-thumb)}data-grid::-webkit-scrollbar-thumb:hover{background:var(--scroller-thumb-hover)}data-grid[class=""]>table[role=grid] tr.dg-head-columns,data-grid:not([class])>table[role=grid] tr.dg-head-columns,data-grid.dg-loading>table[role=grid] tr.dg-head-columns{display:none}data-grid img{border:none;height:auto;max-width:100%;vertical-align:middle}data-grid [hidden]{display:none}data-grid table{display:table;table-layout:fixed;width:100%;max-width:100%;white-space:normal;background:var(--header-background)}data-grid thead,data-grid tfoot{background-color:var(--header-background);color:var(--header-color)}data-grid.dg-loading:not(.dg-initialized) thead,data-grid.dg-loading:not(.dg-initialized) tfoot{background:none}data-grid.dg-loading tbody{animation-name:dataGridShow;animation-timing-function:ease-in;animation-fill-mode:forwards;animation-duration:.3s;pointer-events:none}data-grid tr{position:relative}data-grid th,data-grid td{empty-cells:show;padding:var(--padding-y) var(--padding-x);text-align:left}data-grid th[tabindex],data-grid td[tabindex]{outline:none;word-break:normal}data-grid th{font-weight:bold;padding:var(--padding-y-header) var(--padding-x)}data-grid th,data-grid td{position:relative;overflow:hidden;text-align:left;text-overflow:ellipsis;white-space:nowrap}data-grid th.dg-wrap,data-grid td.dg-wrap{white-space:normal;word-break:break-all}data-grid .dg-expandable{cursor:pointer}data-grid .dg-expandable.dg-expanded td{white-space:normal;word-break:break-all}data-grid .dg-clickable-cell{margin:0;position:absolute;top:0;left:0;width:100%;height:100%;cursor:pointer;display:flex;align-items:center;justify-content:center}data-grid[sticky] table thead,data-grid[sticky] table tfoot{z-index:2;position:sticky;margin:0;border:0}data-grid[sticky] table thead{inset-block-start:-1px}data-grid[sticky] table tfoot{inset-block-end:-1px}data-grid .dg-nav-icon,data-grid .dg-skip-icon{width:22px;height:22px;box-sizing:border-box;position:absolute;display:block;top:50%;left:50%;transform:translate(-50%, -50%) scale(var(--icon-scale, 1))}data-grid .dg-nav-icon:before,data-grid .dg-nav-icon:after,data-grid .dg-skip-icon:before,data-grid .dg-skip-icon:after{content:"";display:block;box-sizing:border-box;position:absolute}data-grid .dg-nav-icon::before{width:0;height:10px;border-top:5px solid rgba(0,0,0,0);border-bottom:5px solid rgba(0,0,0,0);border-left:6px solid;top:6px;left:9px}data-grid .dg-skip-icon::before{width:3px;height:10px;background:currentColor;top:6px;left:14px}data-grid .dg-skip-icon::after{width:0;height:10px;border-top:5px solid rgba(0,0,0,0);border-bottom:5px solid rgba(0,0,0,0);border-left:6px solid;top:6px;left:7px}data-grid .dg-rotate{transform:rotate(-180deg)}data-grid button{background-color:var(--btn-background);border:solid 1px var(--btn-border-color);border-radius:var(--border-radius);color:var(--body-color);height:2rem;margin:0 .2rem;padding:0 .5rem;pointer-events:all;text-align:center;cursor:pointer}data-grid button:hover{opacity:.7}data-grid button:disabled:hover{background-color:inherit;border-color:inherit}data-grid input[type=checkbox]{margin:0}data-grid input:not([type=checkbox]),data-grid select{background-color:var(--input-background, "#fff");color:currentColor;box-sizing:border-box;border:1px solid var(--input-border-color, "#f0f0f0");border-radius:var(--border-radius);height:2rem;margin:0 .2rem;padding:0 var(--padding);max-width:none}data-grid input:not([type=checkbox]):focus,data-grid select:focus,data-grid button:focus{box-shadow:0 0 0 var(--padding-half) rgba(var(--color-rgb), 0.25);outline:0}data-grid input:not([type=checkbox])[disabled],data-grid input:not([type=checkbox]):disabled,data-grid select[disabled],data-grid select:disabled,data-grid button[disabled],data-grid button:disabled{opacity:.35;pointer-events:none}data-grid thead tr:nth-child(2) th{padding:0 2px 0 0;background-color:rgba(0,0,0,0)}data-grid thead tr:nth-child(2) th>*{width:100%;border-radius:0;margin:0}data-grid thead tr:nth-child(2) th input:focus{box-shadow:inset 0px 0px 0px 1px var(--color)}data-grid tbody td.dg-editable-col{padding:0;height:0}data-grid tbody td input.dg-editable{width:100%;background:rgba(0,0,0,0);border:0;border-radius:0;margin:0;box-shadow:none;height:100%}data-grid tbody td input.dg-editable:focus{box-shadow:inset 0px 0px 0px 1px var(--color)}data-grid.dg-empty tbody{height:4rem;position:relative}data-grid.dg-empty tbody:before{position:absolute;top:50%;left:50%;content:attr(data-empty);transform:translate(-50%, -50%);opacity:.5;font-size:1.5rem;text-align:center;white-space:nowrap;text-overflow:ellipsis;overflow:hidden;width:90%}data-grid.dg-empty tr.dg-fake-row{height:4rem;border:none}data-grid.dg-empty.dg-network-error table{color:#842029;background-color:#f8d7da;border:1px solid #f5c2c7}data-grid.dg-empty.dg-network-error tbody{height:auto}data-grid.dg-empty.dg-network-error tbody:before{font-size:2rem;top:auto;transform:translate(-50%)}data-grid.dg-empty.dg-network-error tbody tr:not(.dg-fake-row){display:none}data-grid.dg-empty:not(.dg-network-error) tbody:before{top:auto;transform:translate(-50%, 30%)}data-grid tbody tr{border-bottom:solid 1px var(--row-border-color)}data-grid tbody tr:nth-child(even){background-color:var(--bs-table-striped-bg, #f8f9fa)}data-grid tbody tr:hover{background-color:var(--highlight-color) !important}data-grid tbody tr:focus{background-color:var(--highlight-color) !important;border-bottom-color:var(--highlight-color) !important;outline:none}data-grid tfoot{min-width:280px}data-grid tfoot td{padding:var(--padding-y-header) var(--padding-x)}data-grid tfoot .dg-page-nav{display:flex;align-items:center;min-width:160px}data-grid tfoot .dg-input-page{width:4rem}data-grid tfoot .dg-footer{display:flex;align-items:center;flex-direction:row;justify-content:space-between}data-grid tfoot .dg-pagination{display:flex;text-align:center}data-grid tfoot .dg-pagination button{position:relative;width:2rem}data-grid tfoot .dg-meta{min-width:160px;text-align:right}data-grid tfoot.dg-footer-compact .dg-meta{display:none}data-grid tfoot.dg-footer-compact .dg-input-page{display:none}data-grid [aria-sort]{cursor:pointer;padding-right:1.5rem}data-grid [aria-sort=none]:after,data-grid [aria-sort=none]:before,data-grid [aria-sort=ascending]:before,data-grid [aria-sort=descending]:after{right:.5rem;top:calc(50% - .5rem);border:solid rgba(0,0,0,0);content:" ";height:0;width:0;position:absolute;border-color:rgba(0,0,0,0);border-width:.25rem;margin-left:-0.25rem}data-grid [aria-sort=none]:before{border-bottom-color:currentColor;opacity:.25;top:calc(50% - .6rem)}data-grid [aria-sort=none]:after{border-top-color:currentColor;opacity:.25;bottom:calc(50% - .5rem);top:auto}data-grid [aria-sort=ascending]:before{border-bottom-color:var(--body-color);opacity:.75}data-grid [aria-sort=descending]:after{border-top-color:var(--body-color);opacity:.75;bottom:calc(50% - .5rem);top:auto}[data-bs-theme=dark] data-grid{--scroller-color-lightness: 20%;--highlight-color: #43423e;--header-background: var(--bs-gray-800, #34373b);--header-color: var(--bs-light, #e9ecef);--body-color: var(--bs-body-color, #494e53);--row-border-color: var(--bs-gray-900, #212325)}[data-bs-theme=dark] data-grid tbody tr:nth-child(even){background-color:var(--bs-table-striped-bg, #2c3034)}data-grid[dir=rtl] th,data-grid[dir=rtl] td{text-align:right}data-grid[dir=rtl] [aria-sort]{padding-left:1rem;padding-right:.5rem}data-grid[dir=rtl] [aria-sort=none]:after,data-grid[dir=rtl] [aria-sort=none]:before,data-grid[dir=rtl] [aria-sort=ascending]:before,data-grid[dir=rtl] [aria-sort=descending]:after{left:.75rem;right:auto}data-grid[dir=rtl] tfoot .dg-meta{text-align:left}data-grid .dg-menu{position:absolute;z-index:3;background:var(--body-bg);list-style:none;max-width:150px;margin:0;padding:var(--padding);box-shadow:0 0 1rem rgba(0,0,0,.25);border-radius:var(--border-radius)}data-grid .dg-menu li{margin:0;padding:0}data-grid .dg-menu label{display:flex;align-items:center;margin-bottom:.25em}data-grid .dg-menu input{margin-right:.5em}data-grid .dg-actions{text-overflow:initial;width:100px;text-align:right;white-space:nowrap !important}data-grid .dg-actions button{margin:0}data-grid .dg-actions button+button{margin-left:.5rem}data-grid .dg-actions .dg-actions-toggle{display:none;width:calc(100px - var(--padding-x)*2)}data-grid .dg-actions.dg-actions-1{width:100%}data-grid .dg-actions.dg-actions-2 button{width:calc(50% - .25rem)}data-grid .dg-actions.dg-actions-more button{display:none}data-grid .dg-actions.dg-actions-more button.dg-actions-toggle{display:inline-block}data-grid .dg-actions.dg-actions-expand{position:absolute;right:0;display:flex;align-items:center;justify-content:flex-end;width:100%;height:100%}data-grid .dg-actions.dg-actions-expand.dg-actions-more{width:100%}data-grid .dg-actions.dg-actions-expand.dg-actions-more button{display:inline-block}data-grid tr.dg-actionable{cursor:pointer}data-grid tr.dg-actionable:hover td{background-color:var(--highlight-color)}data-grid .dg-resizer{position:absolute;top:0;right:0;width:6px;z-index:2;cursor:col-resize;-webkit-user-select:none;-moz-user-select:none;user-select:none}data-grid .dg-resizer:before{content:"";display:block;position:absolute;top:var(--padding-y-header);height:1.5rem;right:0;width:2px;background:var(--body-color);opacity:.2}data-grid .dg-resizer:hover:before{opacity:.6}data-grid .dg-resizer.dg-resizer-active{border-right:1px dashed var(--color)}data-grid .dg-resizer.dg-resizer-active:before{opacity:.6}data-grid .dg-responsive-toggle{padding:0;text-align:center}data-grid .dg-responsive-child-row>td{padding:0}data-grid .dg-responsive-table{table-layout:auto;border:0}data-grid .dg-responsive-table td,data-grid .dg-responsive-table th{white-space:normal}data-grid .dg-responsive-table th{max-width:40%}@media only screen and (max-width: 767px){data-grid[responsive] .dg-resizer{display:none}data-grid[responsive] .dg-meta{display:none}data-grid[responsive] .dg-input-page{display:none}data-grid[responsive] table,data-grid[responsive] tbody,data-grid[responsive] tfoot,data-grid[responsive] th,data-grid[responsive] td,data-grid[responsive] tr:not([hidden]){display:block}data-grid[responsive] thead{display:flex;border-bottom:2px solid var(--header-background)}data-grid[responsive] thead>tr{flex-grow:1}data-grid[responsive] thead th{width:auto}data-grid[responsive] tbody tr{padding:0;border:1px solid var(--header-background)}data-grid[responsive] tbody td{border:none;border-bottom:1px solid var(--row-border-color);position:relative;padding-left:calc(100% - var(--responsive-width) - var(--padding)*2)}data-grid[responsive] tbody td:last-child{border:0}data-grid[responsive] tbody td:before{position:absolute;top:0;left:0;padding:var(--padding);width:calc(100% - var(--responsive-width) - var(--padding)*4);content:attr(data-name);display:block;font-weight:bold;background-color:var(--header-background)}data-grid[responsive] tbody td[role=gridcell]{padding-left:calc(100% - var(--responsive-width) - var(--padding)*4 + .5rem)}data-grid[responsive] .dg-selectable{height:28px;margin:2px 1px 2px}data-grid[responsive] td.dg-selectable::before,data-grid[responsive] td.dg-actions::before{padding:0}data-grid[responsive] td.dg-selectable label{padding:5px}data-grid[responsive] td[role=gridcell]{min-height:35px;width:auto}data-grid[responsive] td[data-name]::before{height:100%}data-grid[responsive] td.dg-actions{padding-left:inherit;width:inherit}data-grid[responsive] .dg-actions button{width:inherit !important}data-grid[responsive] tr.dg-head-columns{padding:0;width:calc(100% - var(--responsive-width) - var(--padding)*4)}data-grid[responsive] tr.dg-head-columns th[role="columnheader button"]{padding:.36em 1.3em .36em .75em}data-grid[responsive] tr.dg-head-filters{background:rgba(0,0,0,0);vertical-align:top;padding:0;width:calc(100% - (100% - var(--responsive-width) - var(--padding)*4))}data-grid[responsive] .dg-head-filters th input:not([type=checkbox],[type=radio]){height:2.25em}data-grid[responsive] .dg-head-filters th.dg-selectable{background:rgba(0,0,0,0)}data-grid[responsive] .dg-head-filters th.dg-selectable label::before{content:"Column Filters"}data-grid[responsive] tfoot .dg-page-nav{min-width:revert}data-grid[data-responsive=true] tfoot .dg-page-nav{min-width:revert}} -/*# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIi4uL3Njc3MvX2NvcmUuc2NzcyIsIi4uL3Njc3MvX3J0bC5zY3NzIiwiLi4vc2Nzcy9fbWVudS5zY3NzIiwiLi4vc2Nzcy9fYWN0aW9ucy5zY3NzIiwiLi4vc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QUFBLENBRUEsd0VBQ0UsK0JBQUEsQ0FHSix5Q0FDRSx3QkFBQSxDQUNBLGtCQUFBLENBQ0EsU0FBQSxDQUNBLHNFQUFBLENBR0osa0ZBQ0UsYUFBQSxDQUVGLHdEQUNFLHdCQUFBLENBRUYsc0VBQ0Usd0JBQUEsQ0FHRix5Q0FDRSxnQkFBQSxDQUtGLG1EQUNFLGdCQUFBLENBQUEiLCJmaWxlIjoiZGF0YS1ncmlkLm1pbi5jc3MifQ== */ \ No newline at end of file diff --git a/dist/data-grid.min.css.map b/dist/data-grid.min.css.map index 2b3be75..280b0e1 100644 --- a/dist/data-grid.min.css.map +++ b/dist/data-grid.min.css.map @@ -1 +1 @@ -{"version":3,"sourceRoot":"","sources":["../scss/_core.scss","../scss/_rtl.scss","../scss/_menu.scss","../scss/_actions.scss","../scss/_resizer.scss","../scss/_responsive.scss"],"names":[],"mappings":"AAKA,wBACE,GACE,UAGF,KACE,YAIJ,UACE,kBACA,qBACA,oBACA,4BACA,yCACA,iDACA,+BAEA,2BACA,iDACA,wCACA,+CACA,sDACA,6CACA,0BACA,oDACA,sCACA,4CACA,gBACA,yBACA,4BACA,wBAEA,+BACA,+BACA,gCACA,0CACA,wCACA,wCACA,wCACA,wCACA,wCACA,wCACA,wCACA,wCACA,wCAEA,cACA,gBACA,kBAGA,UACE,wBACA,gCACA,6BACA,8EAEA,yHACA,mCACA,iEACA,qBAEA,6BACE,UACA,WAGF,mCACE,yBAGF,mCACE,iCAGF,yCACE,uCAIJ,cACE,YACA,YACA,eACA,sBAGF,mBACE,aAGF,gBACE,cAGA,mBACA,WACA,eACA,mBAEA,oCAGF,gCAEE,0CACA,0BAME,gGAEE,gBAIJ,2BACE,4BACA,kCACA,6BACA,uBACA,oBAIJ,aACE,kBAGF,0BAEE,iBACA,0CACA,gBAEA,8CACE,aACA,kBAIJ,aACE,iBACA,iDAIF,0BAEE,kBACA,gBACA,gBAEA,uBACA,mBAGA,0CACE,mBACA,qBAKJ,yBACE,eAEA,wCACE,mBACA,qBAIJ,6BACE,SACA,kBACA,MACA,OACA,WACA,YACA,eACA,aACA,mBACA,uBAOA,4DAEE,UACA,gBACA,SACA,SAIF,8BACE,uBAGF,8BACE,qBAKJ,+CAEE,WACA,YACA,sBACA,kBACA,cACA,QACA,SACA,4DAEA,wHAEE,WACA,cACA,sBACA,kBAIJ,+BACE,QACA,YACA,mCACA,sCACA,sBACA,QACA,SAIA,gCACE,UACA,YACA,wBACA,QACA,UAGF,+BACE,QACA,YACA,mCACA,sCACA,sBACA,QACA,SAIJ,qBACE,0BAIF,iBACE,uCACA,yCACA,mCACA,wBACA,YACA,eACA,gBACA,mBACA,kBACA,eAEA,uBACE,WAGF,gCACE,yBACA,qBAKJ,+BACE,SAGF,sDAEE,iDACA,mBACA,sBACA,sDACA,mCACA,YACA,eACA,yBACA,eAMA,yFACE,kEACA,UAGF,uMAEE,YACA,oBAKJ,mCACE,UACA,+BAEA,yCACE,WACA,gBACA,SAEA,+CACE,8CAMN,mCACE,UACA,SAGF,qCACE,WACA,yBACA,SACA,gBACA,SACA,gBACA,YAEA,2CACE,8CAMF,yBACE,YACA,kBAEA,gCACE,kBACA,QACA,SACA,yBACA,gCACA,WACA,iBACA,kBACA,mBACA,uBACA,gBACA,UAKF,kCACE,YACA,YAKF,0CACE,cACA,yBACA,yBAGF,0CACE,YAEA,iDACE,eACA,SACA,0BAGF,+DACE,aAOF,uDACE,SACA,+BAOR,mBAKE,gDAJA,mCACE,qDAKF,yBACE,mDAGF,yBACE,mDACA,sDACA,aAKJ,gBACE,gBAEA,mBACE,iDAGF,6BACE,aACA,mBACA,gBAGF,+BACE,WAGF,2BACE,aACA,mBACA,mBACA,8BAGF,+BACE,aACA,kBAEA,sCAEE,kBACA,WAIJ,yBAEE,gBACA,iBAIA,2CACE,aAGF,iDACE,aAMN,sBACE,eACA,qBAGF,iJAIE,YACA,sBACA,2BACA,YACA,SACA,QACA,kBACA,2BACA,oBACA,qBAIA,kCACE,iCACA,YACA,sBAGF,iCACE,8BACA,YACA,yBACA,SAIJ,uCACE,sCACA,YAGF,uCACE,mCACA,YACA,yBACA,SAIJ,+BACE,gCACA,2BACA,iDACA,yCACA,4CACA,gDAGE,wDACE,qDC3iBF,4CAEE,iBAEF,+BACE,kBACA,oBAEF,qLAIE,YACA,WAEF,kCACE,gBCjBJ,mBACE,kBACA,UACA,0BACA,gBACA,gBACA,SACA,uBACA,oCACA,mCAEA,sBACE,SACA,UAEF,yBACE,aACA,mBACA,oBAEF,yBACE,kBCrBJ,sBACE,sBACA,YACA,iBACA,8BAEA,6BACE,SAEA,oCACE,kBAGJ,yCACE,aACA,uCAEF,mCACE,WAGF,0CACE,yBAEF,6CACE,aAEA,+DACE,qBAGJ,wCACE,kBACA,QACA,aACA,mBACA,yBACA,WACA,YAEF,wDACE,WAEA,+DACE,qBAIN,2BACE,eAEA,oCACE,wCCpDJ,sBACE,kBACA,MACA,QACA,UACA,UACA,kBACA,iBAEA,6BACE,WACA,cACA,kBACA,4BACA,cACA,QACA,UACA,6BACA,WAEF,mCACE,WAEF,wCACE,qCAEA,+CACE,WC3BN,gCACE,UACA,kBAEF,sCACE,UAEF,+BACE,kBACA,SAEA,oEAEE,mBAGF,kCACE,cAMN,0CAGI,kCACE,aAIF,+BACE,aAEF,qCACE,aAIF,6KAME,cAIF,4BACE,aASA,iDAPA,+BACE,YAEF,+BACE,WAQF,+BACE,UACA,0CAEF,+BACE,YACA,gDACA,kBACA,qEAEA,0CACE,SAEF,sCACE,kBACA,MACA,OACA,uBACA,8DACA,mBACA,wBACA,cACA,iBACA,0CAEF,8CACE,6EAMN,qCACE,YACA,mBAIA,2FAEE,UAEF,6CACE,YAEF,wCACE,gBACA,WAEF,4CACE,YAEF,oCACE,qBACA,cAGJ,yCACE,yBAGA,yCACE,UACA,8DAEA,wEACE,gCAGJ,yCACE,yBACA,mBACA,UACA,uEAGJ,kFACE,cAEF,wDACE,yBAEF,sEACE","file":"data-grid.min.css"} \ No newline at end of file +{"version":3,"sourceRoot":"","sources":["../scss/_core.scss","../scss/_rtl.scss","../scss/_menu.scss","../scss/_actions.scss","../scss/_resizer.scss","../scss/_responsive.scss"],"names":[],"mappings":"AAKA,wBACE,GACE,UAGF,KACE,YAIJ,UACE,kBACA,qBACA,oBACA,4BACA,yCACA,iDACA,+BAEA,2BACA,iDACA,wCACA,+CACA,sDACA,6CACA,0BACA,oDACA,sCACA,4CACA,gBACA,yBACA,4BACA,wBAEA,+BACA,+BACA,gCACA,0CACA,wCACA,wCACA,wCACA,wCACA,wCACA,wCACA,wCACA,wCACA,wCAEA,cACA,gBACA,kBAGA,UACE,wBACA,gCACA,6BACA,8EAEA,yHACA,mCACA,iEACA,qBAEA,6BACE,UACA,WAGF,mCACE,yBAGF,mCACE,iCAGF,yCACE,uCAUE,4KACE,aAMR,cACE,YACA,YACA,eACA,sBAGF,mBACE,aAGF,gBACE,cAGA,mBACA,WACA,eACA,mBAEA,oCAGF,gCAEE,0CACA,0BAME,gGAEE,gBAIJ,2BACE,4BACA,kCACA,6BACA,uBACA,oBAIJ,aACE,kBAGF,0BAEE,iBACA,0CACA,gBAEA,8CACE,aACA,kBAIJ,aACE,iBACA,iDAIF,0BAEE,kBACA,gBACA,gBAEA,uBACA,mBAGA,0CACE,mBACA,qBAKJ,yBACE,eAEA,wCACE,mBACA,qBAIJ,6BACE,SACA,kBACA,MACA,OACA,WACA,YACA,eACA,aACA,mBACA,uBAOA,4DAEE,UACA,gBACA,SACA,SAIF,8BACE,uBAGF,8BACE,qBAKJ,+CAEE,WACA,YACA,sBACA,kBACA,cACA,QACA,SACA,4DAEA,wHAEE,WACA,cACA,sBACA,kBAIJ,+BACE,QACA,YACA,mCACA,sCACA,sBACA,QACA,SAIA,gCACE,UACA,YACA,wBACA,QACA,UAGF,+BACE,QACA,YACA,mCACA,sCACA,sBACA,QACA,SAIJ,qBACE,0BAIF,iBACE,uCACA,yCACA,mCACA,wBACA,YACA,eACA,gBACA,mBACA,kBACA,eAEA,uBACE,WAGF,gCACE,yBACA,qBAKJ,+BACE,SAGF,sDAEE,iDACA,mBACA,sBACA,sDACA,mCACA,YACA,eACA,yBACA,eAMA,yFACE,kEACA,UAGF,uMAEE,YACA,oBAKJ,mCACE,kBACA,+BAEA,qCACE,WACA,gBACA,SAIA,+CACE,8CAMN,mCACE,UACA,SAGF,qCACE,WACA,yBACA,SACA,gBACA,SACA,gBACA,YAEA,2CACE,8CAMF,yBACE,YACA,kBAEA,gCACE,kBACA,QACA,SACA,yBACA,gCACA,WACA,iBACA,kBACA,mBACA,uBACA,gBACA,UAKF,kCACE,YACA,YAKF,0CACE,cACA,yBACA,yBAGF,0CACE,YAEA,iDACE,eACA,SACA,0BAGF,+DACE,aAOF,uDACE,SACA,+BAOR,mBAKE,gDAJA,mCACE,qDAKF,yBACE,mDAGF,yBACE,mDACA,sDACA,aAKJ,gBACE,gBAEA,mBACE,iDAGF,6BACE,aACA,mBACA,gBAGF,+BACE,WAGF,2BACE,aACA,mBACA,mBACA,8BAGF,+BACE,aACA,kBAEA,sCAEE,kBACA,WAIJ,yBAEE,gBACA,iBAIA,2CACE,aAGF,iDACE,aAMN,sBACE,eACA,qBAGF,iJAIE,YACA,sBACA,2BACA,YACA,SACA,QACA,kBACA,2BACA,oBACA,qBAIA,kCACE,iCACA,YACA,sBAGF,iCACE,8BACA,YACA,yBACA,SAIJ,uCACE,sCACA,YAGF,uCACE,mCACA,YACA,yBACA,SAIJ,+BACE,gCACA,2BACA,iDACA,yCACA,4CACA,gDAGE,wDACE,qDC1jBF,4CAEE,iBAEF,+BACE,kBACA,oBAEF,qLAIE,YACA,WAEF,kCACE,gBCjBJ,mBACE,kBACA,UACA,0BACA,gBACA,gBACA,SACA,uBACA,oCACA,mCAEA,sBACE,SACA,UAEF,yBACE,aACA,mBACA,oBAEF,yBACE,kBCrBJ,sBACE,sBACA,YACA,iBACA,8BAEA,6BACE,SAEA,oCACE,kBAGJ,yCACE,aACA,uCAEF,mCACE,WAGF,0CACE,yBAEF,6CACE,aAEA,+DACE,qBAGJ,wCACE,kBACA,QACA,aACA,mBACA,yBACA,WACA,YAEF,wDACE,WAEA,+DACE,qBAIN,2BACE,eAEA,oCACE,wCCpDJ,sBACE,kBACA,MACA,QACA,UACA,UACA,kBACA,iBAEA,6BACE,WACA,cACA,kBACA,4BACA,cACA,QACA,UACA,6BACA,WAEF,mCACE,WAEF,wCACE,qCAEA,+CACE,WC3BN,gCACE,UACA,kBAEF,sCACE,UAEF,+BACE,kBACA,SAEA,oEAEE,mBAGF,kCACE,cAMN,0CAGI,kCACE,aAIF,+BACE,aAEF,qCACE,aAIF,6KAME,cAIF,4BACE,aASA,iDAPA,+BACE,YAEF,+BACE,WAQF,+BACE,UACA,0CAEF,+BACE,YACA,gDACA,kBACA,qEAEA,0CACE,SAEF,sCACE,kBACA,MACA,OACA,uBACA,8DACA,wBACA,cACA,iBACA,0CAEF,8CACE,6EAMN,qCACE,YACA,mBAIA,2FAEE,UAEF,6CACE,YAEF,wCACE,gBACA,WAEF,4CACE,YAEF,oCACE,qBACA,cAGJ,yCACE,yBAGA,yCACE,UACA,8DAEA,wEACE,gCAGJ,yCACE,yBACA,mBACA,UACA,uEAGJ,kFACE,cAEF,wDACE,yBAEF,sEACE,yBAGF,yCACE,iBAKF,mDACE","file":"data-grid.min.css"} \ No newline at end of file diff --git a/dist/data-grid.min.js b/dist/data-grid.min.js index 14d384f..2b1dc45 100644 --- a/dist/data-grid.min.js +++ b/dist/data-grid.min.js @@ -1,4 +1,4 @@ -function O(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}function V(n){if(n==="true")return!0;if(n==="false")return!1;if(n===""||n==="null")return null;if(n===Number(n).toString())return Number(n);if(n&&["[","{"].includes(n.substring(0,1)))try{return n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(decodeURIComponent(n))}catch{return console.error("Failed to parse "+n),{}}return n}var Rt=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];function ct(n){return Rt.includes(n)?{passive:!0}:{}}function k(n,t){return n.getAttribute(t)}function j(n,t){return n.hasAttribute(t)}function d(n,t,e="",i=!1){i&&j(n,t)||n.setAttribute(t,""+e)}function L(n,t){j(n,t)&&n.removeAttribute(t)}function w(n,t,e){n.addEventListener(t,e,ct(t))}function H(n,t,e){n.removeEventListener(t,e,ct(t))}function x(n,t,e={},i=!1){let s={};i&&(s.bubbles=!0),e&&(s.detail=e),n.dispatchEvent(new CustomEvent(t,s))}function $(n,t){return n.classList.contains(t)}function S(n,t){n.classList.add(...t.split(" "))}function F(n,t){n.classList.remove(...t.split(" "))}function ut(n,t){n.classList.toggle(t)}function Dt(n,t=document){return n instanceof HTMLElement?n:t.querySelector(n)}function It(n,t=document){return Array.from(t.querySelectorAll(n))}function W(n,t){return Dt(t,n)}function f(n,t){return It(t,n)}function A(n,t=null){let e=document.createElement(n);return t&&t.appendChild(e),e}function gt(n,t){t.parentNode.insertBefore(n,t.nextSibling)}var U=class extends HTMLElement{constructor(t={}){super(),this.options=Object.assign({},this.defaultOptions,this.normalizedDataset,t),this.log("constructor"),this.fireEvents=!0,this._ready(),this.log("ready")}get defaultOptions(){return{}}getOption(t){return this.options[t]}setOption(t,e){d(this,`data-${t}`,e)}toggleOption(t){d(this,`data-${t}`,!this.getOption(t))}get normalizedDataset(){let t=this.dataset.config?JSON.parse(this.dataset.config):{},e={...this.dataset};for(var i in e)i!="config"&&(e[i]=V(e[i]));return Object.assign(e,t),e}static template(){return""}_ready(){}log(t){this.options.debug&&console.log("["+k(this,"id")+"] "+t)}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}_connected(){}connectedCallback(){setTimeout(()=>{this.log("connectedCallback");let t=document.createElement("template");t.innerHTML=this.constructor.template(),this.appendChild(t.content.cloneNode(!0)),this._connected(),x(this,"connected")},0)}_disconnected(){}disconnectedCallback(){this.log("disconnectedCallback"),this._disconnected(),x(this,"disconnected")}get transformAttributes(){return{}}attributeChangedCallback(t,e,i){if(e===i)return;this.log("attributeChangedCallback: "+t);let s=!1,o=this.transformAttributes[t]??V;t.indexOf("data-")===0&&(t=t.slice(5),s=!0),t=O(t),s?this.options[t]=o(i):this[t]=o(i),this.fireEvents&&this[`${t}Changed`]&&this[`${t}Changed`]()}},pt=U;function X(n,t,e,i=!1){let s=document.createElement("option");s.value=""+t,i&&(s.selected=!0),s.label=e,n.appendChild(s)}function Y(n,t={}){Object.keys(t).forEach(e=>{Array.isArray(t[e])?Object.keys(t[e]).forEach(i=>n.searchParams.append(isNaN(i)?`${e}[${i}]`:e,t[e][i])):n.searchParams.append(e,t[e])})}function K(n){return typeof n=="string"?n[0]==="["?(n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(n)):n.split(","):Array.isArray(n)?n:(console.error("Invalid array",n),[])}function J(n){var t=n.getBoundingClientRect(),e=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+i,left:t.left+e}}function q(n,t){return n.replace(/\{([^}]+)?\}/g,function(e,i){return t[i]})}function T(n,t=document.body,e=!1){t||(t=document.createElement("div"));let i=window.getComputedStyle(t),s=i.getPropertyValue("font-weight")||"normal",o=i.getPropertyValue("font-size")||"1rem",r=i.getPropertyValue("font-family")||"Arial",l=0;if(e){let u=i.getPropertyValue("padding-left")||"0",g=i.getPropertyValue("padding-right")||"0";l=parseInt(u)+parseInt(g)}let c=(T.canvas||(T.canvas=document.createElement("canvas"))).getContext("2d");c.font=`${s} ${o} ${r}`;let h=c.measureText(n);return parseInt(h.width)+l}function N(n){return Math.random().toString(36).replace("0.",n||"")}var G={},C={itemsPerPage:"Items per page",gotoPage:"Go to page",gotoFirstPage:"Go to first page",gotoPrevPage:"Go to previous page",gotoNextPage:"Go to next page",gotoLastPage:"Go to last page",of:"of",items:"items",resizeColumn:"Resize column",noData:"No data",areYouSure:"Are you sure?",networkError:"Network response error"};function ft(n,t){t.width&&d(n,"width",t.width),t.class&&S(n,t.class),t.hidden&&(d(n,"hidden",""),t.responsiveHidden&&S(n,"dg-responsive-hidden"))}var B=class extends pt{_ready(){d(this,"id",this.options.id??N("el-"),!0),this.data=[],this.originalData,this.options=this.options||this.defaultOptions,this.fireEvents=!1,this.page=this.options.defaultPage||1,this.pages=0,this.meta,this.plugins={};for(let[t,e]of Object.entries(G))this.plugins[t]=new e(this);for(let t of B.observedAttributes)t.indexOf("data-")===0&&d(this,t,this.options[O(t.slice(5))])}static template(){return` +function H(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}function M(n){if(n==="true")return!0;if(n==="false")return!1;if(n===""||n==="null")return null;if(n===Number(n).toString())return Number(n);if(n&&["[","{"].includes(n.substring(0,1)))try{return n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(decodeURIComponent(n))}catch{return console.error("Failed to parse "+n),{}}return n}var It=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];function ut(n){return It.includes(n)?{passive:!0}:{}}function k(n,t){return n.getAttribute(t)}function j(n,t){return n.hasAttribute(t)}function d(n,t,e="",i=!1){i&&j(n,t)||n.setAttribute(t,""+e)}function S(n,t){j(n,t)&&n.removeAttribute(t)}function w(n,t,e){n.addEventListener(t,e,ut(t))}function W(n,t,e){n.removeEventListener(t,e,ut(t))}function y(n,t,e={},i=!1){let s={};i&&(s.bubbles=!0),e&&(s.detail=e),n.dispatchEvent(new CustomEvent(t,s))}function $(n,t){return n.classList.contains(t)}function L(n,t){n.classList.add(...t.split(" "))}function F(n,t){n.classList.remove(...t.split(" "))}function gt(n,t){n.classList.toggle(t)}function $t(n,t=document){return n instanceof HTMLElement?n:t.querySelector(n)}function Tt(n,t=document){return Array.from(t.querySelectorAll(n))}function T(n,t){return $t(t,n)}function f(n,t){return Tt(t,n)}function x(n,t=null){let e=document.createElement(n);return t&&t.appendChild(e),e}function pt(n,t){t.parentNode.insertBefore(n,t.nextSibling)}var _=class extends HTMLElement{constructor(t={}){super(),this.options=Object.assign({},this.defaultOptions,this.normalizedDataset,t),this.log("constructor"),this.fireEvents=!0,this._ready(),this.log("ready")}get defaultOptions(){return{}}getOption(t){return this.options[t]}setOption(t,e){d(this,`data-${t}`,e)}toggleOption(t){d(this,`data-${t}`,!this.getOption(t))}get normalizedDataset(){let t=this.dataset.config?JSON.parse(this.dataset.config):{},e={...this.dataset};for(var i in e)i!="config"&&(e[i]=M(e[i]));return Object.assign(e,t),e}static template(){return""}_ready(){}log(t){this.options.debug&&console.log("["+k(this,"id")+"] "+t)}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}_connected(){}connectedCallback(){setTimeout(()=>{this.log("connectedCallback");let t=document.createElement("template");t.innerHTML=this.constructor.template(),this.appendChild(t.content.cloneNode(!0)),this._connected(),y(this,"connected")},0)}_disconnected(){}disconnectedCallback(){this.log("disconnectedCallback"),this._disconnected(),y(this,"disconnected")}get transformAttributes(){return{}}attributeChangedCallback(t,e,i){if(e===i)return;this.log("attributeChangedCallback: "+t);let s=!1,o=this.transformAttributes[t]??M;t.indexOf("data-")===0&&(t=t.slice(5),s=!0),t=H(t),s?this.options[t]=o(i):this[t]=o(i),this.fireEvents&&this[`${t}Changed`]&&this[`${t}Changed`]()}},ft=_;function U(n,t,e,i=!1){let s=document.createElement("option");s.value=""+t,i&&(s.selected=!0),s.label=e,n.appendChild(s)}function X(n,t={}){Object.keys(t).forEach(e=>{Array.isArray(t[e])?Object.keys(t[e]).forEach(i=>n.searchParams.append(isNaN(i)?`${e}[${i}]`:e,t[e][i])):n.searchParams.append(e,t[e])})}function V(n){return typeof n=="string"?n[0]==="["?(n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(n)):n.split(","):Array.isArray(n)?n:(console.error("Invalid array",n),[])}function Y(n){var t=n.getBoundingClientRect(),e=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+i,left:t.left+e}}function q(n,t){return n.replace(/\{([^}]+)?\}/g,function(e,i){return t[i]})}function O(n,t=document.body,e=!1){t||(t=document.createElement("div"));let i=window.getComputedStyle(t),s=i.getPropertyValue("font-weight")||"normal",o=i.getPropertyValue("font-size")||"1rem",r=i.getPropertyValue("font-family")||"Arial",l=0;if(e){let u=i.getPropertyValue("padding-left")||"0",g=i.getPropertyValue("padding-right")||"0";l=parseInt(u)+parseInt(g)}let c=(O.canvas||(O.canvas=document.createElement("canvas"))).getContext("2d");c.font=`${s} ${o} ${r}`;let h=c.measureText(n);return parseInt(h.width)+l}function N(n){return Math.random().toString(36).replace("0.",n||"")}var B={},C={itemsPerPage:"Items per page",gotoPage:"Go to page",gotoFirstPage:"Go to first page",gotoPrevPage:"Go to previous page",gotoNextPage:"Go to next page",gotoLastPage:"Go to last page",of:"of",items:"items",resizeColumn:"Resize column",noData:"No data",areYouSure:"Are you sure?",networkError:"Network response error"};function mt(n,t){t.width&&d(n,"width",t.width),t.class&&L(n,t.class),t.hidden&&(d(n,"hidden",""),t.responsiveHidden&&L(n,"dg-responsive-hidden"))}var J=class n extends ft{#t="[id^=dg-filter]";_ready(){d(this,"id",this.options.id??N("el-"),!0),this.data=[],this.originalData,this.options=this.options||this.defaultOptions,this.fireEvents=!1,this.page=this.options.defaultPage||1,this.pages=0,this.meta,this.plugins={};for(let[t,e]of Object.entries(B))this.plugins[t]=new e(this);for(let t of n.observedAttributes)t.indexOf("data-")===0&&d(this,t,this.options[H(t.slice(5))]);this.options.showSpinner&&this.plugins.SpinnerSupport&&this.plugins.SpinnerSupport.add()}static template(){return` @@ -36,11 +36,20 @@ function O(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUppe
-`}get labels(){return C}static getLabels(){return C}static setLabels(t){C=Object.assign(C,t)}get defaultColumn(){return{field:"",title:"",width:0,class:"",attr:"",hidden:!1,editable:!1,noSort:!1,responsive:1,responsiveHidden:!1,format:"",transform:""}}get defaultOptions(){return{id:null,url:null,perPage:10,debug:!1,filter:!1,menu:!1,sort:!1,server:!1,serverParams:{start:"start",length:"length",search:"search",sort:"sort",sortDir:"sortDir",dataKey:"data",metaKey:"meta",metaTotalKey:"total",metaFilteredKey:"filtered",optionsKey:"options",paramsKey:"params"},defaultSort:"",reorder:!1,dir:"ltr",perPageValues:[10,25,50,100,250],hidePerPage:!1,columns:[],actions:[],collapseActions:!1,selectable:!1,selectVisibleOnly:!0,defaultPage:1,resizable:!1,autosize:!0,expand:!1,autoheight:!0,autohidePager:!1,responsive:!1,responsiveToggle:!0}}static registerPlugins(t){G=t}static unregisterPlugins(t=null){t===null?G={}:delete G[t]}static registeredPlugins(){return G}convertColumns(t){let e=[];return typeof t=="object"&&!Array.isArray(t)?Object.keys(t).forEach(i=>{let s=Object.assign({},this.defaultColumn);s.title=t[i],s.field=i,e.push(s)}):t.forEach(i=>{let s=Object.assign({},this.defaultColumn);typeof i=="string"?(s.title=i,s.field=i):typeof i=="object"?(s=Object.assign(s,i),s.field||console.error("Invalid column definition",i),s.title||(s.title=s.field)):console.error("Column definition must be a string or an object"),e.push(s)}),e}static get observedAttributes(){return["page","data-filter","data-sort","data-debug","data-reorder","data-menu","data-selectable","data-url","data-per-page","data-responsive"]}get transformAttributes(){return{columns:t=>this.convertColumns(K(t)),actions:t=>K(t),defaultPage:t=>parseInt(t),perPage:t=>parseInt(t)}}get page(){return parseInt(this.getAttribute("page"))}set page(t){d(this,"page",this.constrainPageValue(t))}urlChanged(){this.loadData().then(()=>{this.configureUi()})}constrainPageValue(t){return this.pages1&&this.page*this.options.perPage>this.totalRecords();)t--;t!=this.page?this.page=t:this.reload(()=>{(!this.plugins.FixedHeight||!this.plugins.FixedHeight.hasFixedHeight)&&this.selectPerPage.scrollIntoView()})}dirChanged(){d(this,"dir",this.options.dir)}defaultSortChanged(){this.sortChanged()}perPageValuesChanged(){if(this.selectPerPage){for(;this.selectPerPage.lastChild;)this.selectPerPage.removeChild(this.selectPerPage.lastChild);this.options.perPageValues.forEach(t=>{X(this.selectPerPage,t,t,t===this.options.perPage)})}}_connected(){this.table=this.querySelector("table"),this.btnFirst=this.querySelector(".dg-btn-first"),this.btnPrev=this.querySelector(".dg-btn-prev"),this.btnNext=this.querySelector(".dg-btn-next"),this.btnLast=this.querySelector(".dg-btn-last"),this.selectPerPage=this.querySelector(".dg-select-per-page"),this.inputPage=this.querySelector(".dg-input-page"),this.getFirst=this.getFirst.bind(this),this.getPrev=this.getPrev.bind(this),this.getNext=this.getNext.bind(this),this.getLast=this.getLast.bind(this),this.changePerPage=this.changePerPage.bind(this),this.gotoPage=this.gotoPage.bind(this),this.btnFirst.addEventListener("click",this.getFirst),this.btnPrev.addEventListener("click",this.getPrev),this.btnNext.addEventListener("click",this.getNext),this.btnLast.addEventListener("click",this.getLast),this.selectPerPage.addEventListener("change",this.changePerPage),this.selectPerPage.toggleAttribute("hidden",this.options.hidePerPage),this.inputPage.addEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.connected()}),this.dirChanged(),this.perPageValuesChanged(),this.loadData().finally(()=>{this.configureUi(),this.sortChanged(),this.classList.add("dg-initialized"),this.filterChanged(),this.reorderChanged(),this.dirChanged(),this.perPageValuesChanged(),this.pageChanged(),this.fireEvents=!0,this.log("initialized")})}_disconnected(){this.btnFirst.removeEventListener("click",this.getFirst),this.btnPrev.removeEventListener("click",this.getPrev),this.btnNext.removeEventListener("click",this.getNext),this.btnLast.removeEventListener("click",this.getLast),this.selectPerPage.removeEventListener("change",this.changePerPage),this.inputPage.removeEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.disconnected()})}getCol(t){let e=null;return this.options.columns.forEach(i=>{i.field==t&&(e=i)}),e}getColProp(t,e){let i=this.getCol(t);return i?i[e]:null}setColProp(t,e,i){let s=this.getCol(t);s&&(s[e]=i)}visibleColumns(){return this.options.columns.filter(t=>!t.hidden)}hiddenColumns(){return this.options.columns.filter(t=>t.hidden===!0)}showColumn(t,e=!0){this.setColProp(t,"hidden",!1),e&&this.renderTable(),x(this,"columnVisibility",{col:t,visibility:"visible"})}hideColumn(t,e=!0){this.setColProp(t,"hidden",!0),e&&this.renderTable(),x(this,"columnVisibility",{col:t,visibility:"hidden"})}startColIndex(){let t=1;return this.options.selectable&&this.plugins.SelectableRows&&t++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&t++,t}isSticky(){return this.hasAttribute("sticky")}columnsLength(t=!1){let e=0;return this.options.columns.forEach(i=>{t&&i.hidden||i.attr||e++}),this.options.selectable&&this.plugins.SelectableRows&&e++,this.options.actions.length&&this.plugins.RowActions&&e++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&e++,e}configureUi(){if(d(this.querySelector("table"),"aria-rowcount",this.data.length),this.table.style.visibility="hidden",this.renderTable(),this.options.responsive&&this.plugins.ResponsiveGrid||(this.table.style.visibility="visible"),!this.rowHeight){let t=W(this,"tbody tr")||W(this,"table tr");t&&(this.rowHeight=t.offsetHeight)}}filterChanged(){let t=this.querySelector("thead tr.dg-head-filters");this.options.filter?L(t,"hidden"):(this.clearFilters(),d(t,"hidden",""))}reorderChanged(){f(this,"thead tr.dg-head-columns th").forEach(e=>{e.classList.contains("dg-selectable")||e.classList.contains("dg-actions")||(this.options.reorder&&this.plugins.DraggableHeaders?e.draggable=!0:e.removeAttribute("draggable"))})}sortChanged(){this.log("toggle sort"),this.querySelectorAll("thead tr.dg-head-columns th").forEach(t=>{let e=t.getAttribute("field");t.classList.contains("dg-not-sortable")||!this.fireEvents&&e==this.options.defaultSort||(this.options.sort&&!this.getColProp(e,"noSort")?d(t,"aria-sort","none"):L(t,"aria-sort"))})}selectableChanged(){this.renderTable()}addRow(t){Array.isArray(this.originalData)&&(this.log("Add row"),this.originalData.push(t),this.data=this.originalData.slice(),this.sortData())}removeRow(t=null,e=null){if(Array.isArray(this.originalData)){e===null&&(e=this.options.columns[0].field),t===null&&(t=this.originalData[this.originalData.length-1][e]),this.log("Removing "+e+":"+t);for(let i=0;i{this.options.server||e?this.renderBody():this.paginate(),t&&t()})}loadData(){let t=()=>!this.data.length&&this.classList.add("dg-empty"),e=this.querySelector("tbody");return(this.meta||this.originalData||this.classList.contains("dg-initialized"))&&(!this.options.server||this.options.server&&!this.fireEvents)?(this.log("skip loadData"),t(),new Promise(i=>{i()})):(this.log("loadData"),this.loading=!0,this.classList.add("dg-loading"),this.classList.remove("dg-empty","dg-network-error"),this.fetchData().then(i=>{if(Array.isArray(i))this.data=i;else{if(!i[this.options.serverParams.dataKey]){console.error("Invalid response, it should contain a data key with an array or be a plain array",i),this.options.url=null;return}this.options=Object.assign(this.options,i[this.options.serverParams.optionsKey]??{}),this.meta=i[this.options.serverParams.metaKey]??{},this.data=i[this.options.serverParams.dataKey]}this.originalData=this.data.slice(),this.fixPage(),this.options.columns.length===0&&this.originalData.length?this.options.columns=this.convertColumns(Object.keys(this.originalData[0])):this.options.columns=this.convertColumns(this.options.columns)}).catch(i=>{this.log(i),i.message&&e.setAttribute("data-empty",i.message.replace(/^\s+|\r\n|\n|\r$/g,"")),this.classList.add("dg-empty","dg-network-error")}).finally(()=>{t(),!this.classList.contains("dg-network-error")&&e.getAttribute("data-empty")!=this.labels.noData&&e.setAttribute("data-empty",this.labels.noData),this.classList.remove("dg-loading"),this.loading=!1}))}getFirst(){this.loading||(this.page=1)}getLast(){this.loading||(this.page=this.pages)}getPrev(){this.loading||(this.page=this.page-1)}getNext(){this.loading||(this.page=this.page+1)}gotoPage(t){if(t.type==="keypress"){let e=t.keyCode||t.key;if(e===13||e==="Enter")t.preventDefault();else return}this.page=parseInt(this.inputPage.value)}getSort(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t?t.getAttribute("field"):this.options.defaultSort}getSortDir(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t&&t.getAttribute("aria-sort")||""}getFilters(){let t=[];return f(this,"thead tr.dg-head-filters input").forEach(i=>{t[i.dataset.name]=i.value}),t}clearFilters(){f(this,"thead tr.dg-head-filters input").forEach(e=>{e.value=""}),this.filterData()}filterData(){if(this.log("filter data"),this.page=1,this.options.server)this.reload();else{this.data=this.originalData?.slice()??[],f(this,"thead tr.dg-head-filters input").forEach(i=>{let s=i.value;if(s){let o=i.dataset.name;this.data=this.data.filter(r=>(r[o]+"").toLowerCase().indexOf(s.toLowerCase())!==-1)}}),this.pageChanged();let e=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");this.options.sort&&e?this.sortData():this.renderBody()}}sortData(t=null){if(this.log("sort data"),t&&this.getColProp(t.getAttribute("field"),"noSort")){this.log("sorting prevented because column is not sortable");return}if(this.plugins.ColumnResizer&&this.plugins.ColumnResizer.isResizing){this.log("sorting prevented because resizing");return}if(this.loading){this.log("sorting prevented because loading");return}if(t!==null){let e=i=>["dg-selectable","dg-actions","dg-responsive-toggle"].includes(i);this.querySelectorAll("thead tr:first-child th").forEach(i=>{[...i.classList].some(e)||i!==t&&i.setAttribute("aria-sort","none")}),!t.hasAttribute("aria-sort")||t.getAttribute("aria-sort")==="none"?t.setAttribute("aria-sort","ascending"):t.getAttribute("aria-sort")==="ascending"?t.setAttribute("aria-sort","descending"):t.getAttribute("aria-sort")==="descending"&&t.setAttribute("aria-sort","none")}else t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");if(this.options.server)this.loadData().finally(()=>{this.renderBody()});else{let e=t?t.getAttribute("aria-sort"):"none";if(e==="none"){let i=[];this.originalData?.some(s=>(this.data.some(o=>JSON.stringify(s)===JSON.stringify(o)?(i.push(o),!0):!1),i.length===this.data.length)),this.data=i}else{let i=t.getAttribute("field");this.data.sort((s,o)=>{if(!isNaN(s[i])&&!isNaN(o[i]))return e==="ascending"?s[i]-o[i]:o[i]-s[i];let r=e==="ascending"?s[i].toUpperCase():o[i].toUpperCase(),l=e==="ascending"?o[i].toUpperCase():s[i].toUpperCase();switch(!0){case r>l:return 1;case ro("No url set"));let t=window.location.href;t.split("/").pop().includes(".")||(t+=t.endsWith("/")?"":"/");let e=new URL(this.options.url,t),i={r:Date.now()};return this.options.server&&(i[this.options.serverParams.start]=this.page-1,i[this.options.serverParams.length]=this.options.perPage,this.options.filter&&(i[this.options.serverParams.search]=this.getFilters()),i[this.options.serverParams.sort]=this.getSort()||"",i[this.options.serverParams.sortDir]=this.getSortDir(),this.meta?.[this.options.serverParams.paramsKey]&&(i=Object.assign(i,this.meta[this.options.serverParams.paramsKey]))),Y(e,i),fetch(e).then(s=>{if(!s.ok)throw new Error(s.statusText||C.networkError);return s.json()})}renderTable(){this.log("render table"),this.options.menu&&this.plugins.ContextMenu&&this.plugins.ContextMenu.createMenu();let t;this.renderHeader(),this.options.defaultSort&&(t=this.querySelector("thead tr.dg-head-columns th[field='"+this.options.defaultSort+"']")),t?this.sortData(t):this.renderBody(),this.renderFooter()}renderHeader(){this.log("render header");let t=this.querySelector("thead");this.createColumnHeaders(t),this.createColumnFilters(t),this.options.resizable&&this.plugins.ColumnResizer&&this.plugins.ColumnResizer.renderResizer(C.resizeColumn),x(this,"headerRendered")}renderFooter(){this.log("render footer");let t=this.querySelector("tfoot"),e=t.querySelector("td");t.removeAttribute("hidden"),d(e,"colspan",this.columnsLength(!0)),t.style.display=""}createColumnHeaders(t){let e=this.clientWidth,i=Math.round(e/this.columnsLength(!0)*2),s=0,o;o=A("tr"),this.headerRow=o,o.setAttribute("role","row"),o.setAttribute("aria-rowindex","1"),o.setAttribute("class","dg-head-columns");let r=t.querySelector("tr.dg-head-columns th");r||(r=A("th"),t.querySelector("tr").appendChild(r)),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createHeaderCol(o),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createHeaderCol(o),s=0;let l=0;if(this.options.columns.forEach(a=>{if(a.attr)return;let c=s+this.startColIndex(),h=A("th");h.setAttribute("scope","col"),h.setAttribute("role","columnheader button"),h.setAttribute("aria-colindex",""+c),h.setAttribute("id",N("dg-col-")),this.options.sort&&h.setAttribute("aria-sort","none"),h.setAttribute("field",a.field),this.plugins.ResponsiveGrid&&this.options.responsive&&d(h,"data-responsive",a.responsive||"");let u=T(a.title,r,!0)+20;h.dataset.minWidth=""+u,ft(h,a),h.tabIndex=0,h.textContent=a.title;let g=0;if(this.options.autosize&&this.plugins.AutosizeColumn){let m=Math.min(e-l,i);g=this.plugins.AutosizeColumn.computeSize(h,a,parseInt(h.dataset.minWidth),m)}else g=Math.max(parseInt(h.dataset.minWidth),parseInt(h.getAttribute("width")));d(h,"width",g),a.hidden?h.setAttribute("hidden",""):l+=g,this.options.reorder&&this.plugins.DraggableHeaders&&this.plugins.DraggableHeaders.makeHeaderDraggable(h),o.appendChild(h),s++}),le){this.log(`adjust width to fix size, ${t.offsetWidth} > ${e}`);let a=this.offsetWidth-this.clientWidth,c=t.offsetWidth-e-a;this.options.responsive&&this.plugins.ResponsiveGrid&&(c+=a),f(o,"th[width]").forEach(u=>{if($(u,"dg-not-resizable")||c<=0)return;let g=parseInt(u.getAttribute("width")),m=u.dataset.minWidth?parseInt(u.dataset.minWidth):0;if(g>m){let b=g-c;b{a.addEventListener("click",()=>this.sortData(a))}),d(this.querySelector("table"),"aria-colcount",this.columnsLength(!0))}createColumnFilters(t){let e=0,i;i=A("tr"),this.filterRow=i,i.setAttribute("role","row"),i.setAttribute("aria-rowindex","2"),i.setAttribute("class","dg-head-filters"),this.options.filter||i.setAttribute("hidden",""),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createFilterCol(i),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createFilterCol(i),this.options.columns.forEach(s=>{if(s.attr)return;let o=e+this.startColIndex(),r=t.querySelector("tr.dg-head-columns th[aria-colindex='"+o+"']");if(!r){console.warn("Related th not found",o);return}let l=A("th");l.setAttribute("aria-colindex",""+o);let a=A("input");a.type="text",a.inputMode="search",a.autocomplete="off",a.spellcheck=!1,a.dataset.name=s.field,a.id=N("dg-filter-"),a.setAttribute("aria-labelledby",r.getAttribute("id")),this.options.filter?a.tabIndex=0:l.tabIndex=0,s.hidden&&l.setAttribute("hidden",""),l.appendChild(a),i.appendChild(l),e++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionFilter(i),t.replaceChild(i,t.querySelector("tr.dg-head-filters")),i.querySelectorAll("input").forEach(s=>{s.addEventListener("keypress",o=>{let r=o.keyCode||o.key;(r===13||r==="Enter")&&this.filterData.call(this)})})}renderBody(){this.log("render body");let t,e,i,s=A("tbody");this.data.forEach((r,l)=>{t=A("tr"),d(t,"role","row"),d(t,"hidden",""),d(t,"aria-rowindex",l+1),t.tabIndex=0,this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createDataCol(t),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createDataCol(t),this.options.expand&&(t.classList.add("dg-expandable"),w(t,"click",a=>{this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.blockObserver(),ut(a.currentTarget,"dg-expanded"),this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.unblockObserver()})),i=0,this.options.columns.forEach(a=>{if(a||console.error("Empty column found!",this.options.columns),a.attr){r[a.field]&&(a.attr==="class"?S(t,r[a.field]):t.setAttribute(a.attr,r[a.field]));return}if(e=A("td"),e.setAttribute("role","gridcell"),e.setAttribute("aria-colindex",i+this.startColIndex()),ft(e,a),e.setAttribute("data-name",a.title),e.tabIndex=-1,a.editable&&this.plugins.EditableColumn)S(e,"dg-editable-col"),this.plugins.EditableColumn.makeEditableInput(e,a,r,l);else{let c=r[a.field]??"",h;switch(a.transform){case"uppercase":h=c.toUpperCase();break;case"lowercase":h=c.toLowerCase();break;default:h=c;break}if(a.format){if(a.defaultFormatValue!=null&&(h===""||h===null)&&(h=a.defaultFormatValue+""),typeof a.format=="string"&&h)e.innerHTML=q(a.format,Object.assign({_v:c,_tv:h},r));else if(a.format instanceof Function){let u=a.format.call(this,{column:a,rowData:r,cellData:h,td:e,tr:t});e.innerHTML=u||h||c}}else e.textContent=h}t.appendChild(e),i++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionRow(t,r),s.appendChild(t)}),s.setAttribute("role","rowgroup");let o=this.querySelector("tbody");s.setAttribute("data-empty",o.getAttribute("data-empty")),this.querySelector("table").replaceChild(s,o),this.plugins.FixedHeight&&this.plugins.FixedHeight.createFakeRow(),this.paginate(),this.plugins.SelectableRows&&this.plugins.SelectableRows.shouldSelectAll(s),x(this,"bodyRendered")}paginate(){this.log("paginate");let t=this.totalRecords(),e=this.page||1,i,s=e*this.options.perPage,o=s-this.options.perPage+1,r=this.querySelector("tbody"),l=this.querySelector("tfoot");s>t&&(s=t),t||(o=0),r.querySelectorAll("tr").forEach(a=>{if(this.options.server){L(a,"hidden");return}i=Number(k(a,"aria-rowindex")),i>s||i=this.pages,this.btnLast.disabled=this.page>=this.pages),l.querySelector(".dg-low").textContent=o.toString(),l.querySelector(".dg-high").textContent=s.toString(),l.querySelector(".dg-total").textContent=""+this.totalRecords(),l.toggleAttribute("hidden",this.options.autohidePager&&this.options.perPage>this.totalRecords())}totalPages(){return Math.ceil(this.totalRecords()/this.options.perPage)}totalRecords(){return this.options.server?this.meta?.[this.options.serverParams.metaFilteredKey]||0:this.data.length}},_=B;var Z=class{constructor(t){this.grid=t}connected(){}disconnected(){}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}},v=Z;var Q=class extends v{constructor(t){super(t),this.isResizing=!1}renderResizer(t){let e=this.grid,i=e.table,s=f(e,"thead tr.dg-head-columns th");s.forEach(o=>{if($(o,"dg-not-resizable"))return;let r=document.createElement("div");S(r,"dg-resizer"),r.ariaLabel=t,o.appendChild(r);let l=0,a=0,c=0,h=0,u=m=>{if(m.clientX>h)return;let b=a+(m.clientX-l);o.dataset.minWidth&&b>parseInt(o.dataset.minWidth)&&d(o,"width",b)},g=()=>{e.log("resized column"),setTimeout(()=>{this.isResizing=!1},0),F(r,"dg-resizer-active"),e.options.reorder&&(o.draggable=!0),o.style.overflow="hidden",H(document,"mousemove",u),H(document,"mouseup",g),x(e,"columnResized",{col:k(o,"field"),width:k(o,"width")})};w(r,"click",m=>{m.stopPropagation()}),w(r,"mousedown",m=>{m.stopPropagation(),this.isResizing=!0;let b=m.target,P=f(e,"dg-head-columns th").filter(p=>!p.hasAttribute("hidden")),y=P.findIndex(p=>p==b.parentNode);e.log("resize column"),S(r,"dg-resizer-active"),L(o,"draggable"),o.style.overflow="visible",r.style.height=i.offsetHeight-1+"px",l=m.clientX,a=o.offsetWidth,c=(P.length-y)*30,h=J(b).left+e.offsetWidth-c,d(o,"width",a);for(let p=0;py&&L(s[p],"width");w(document,"mousemove",u),w(document,"mouseup",g)})})}},mt=Q;function M(n,t,e="nodeName"){let i=n;for(;i[e]!=t;)i=i.parentElement;return i}var tt=class extends v{connected(){this.menu=this.grid.querySelector(".dg-menu")}disconnected(){this.grid.headerRow&&H(this.grid.headerRow,"contextmenu",this)}attachContextMenu(){let t=this.grid;w(t.headerRow,"contextmenu",this)}onchange(t){let e=this.grid,i=t.target,s=i.dataset.name;if(i.checked)e.showColumn(s);else{if(e.visibleColumns().length<=1){i.checked=!0;return}e.hideColumn(s)}}oncontextmenu(t){t.preventDefault();let e=this.grid,i=M(t.target,"THEAD"),s=this.menu,o=i.getBoundingClientRect(),r=t.clientX-o.left,l=t.clientY-o.top;s.style.top=`${l}px`,s.style.left=`${r}px`,L(s,"hidden"),r+150>o.width&&(r-=s.offsetWidth,s.style.left=`${r}px`);let a=c=>{s.contains(c.target)||(d(s,"hidden",""),H(document,"click",a))};w(document,"click",a)}createMenu(){let t=this.grid,e=this.menu;for(;e.lastChild;)e.removeChild(e.lastChild);e.addEventListener("change",this),t.options.columns.forEach(i=>{if(i.attr)return;let s=document.createElement("li"),o=document.createElement("label"),r=document.createElement("input");d(r,"type","checkbox"),d(r,"data-name",i.field),i.hidden||(r.checked=!0);let l=document.createTextNode(i.title);o.appendChild(r),o.appendChild(l),s.appendChild(o),e.appendChild(s)})}},bt=tt;var et=class extends v{makeHeaderDraggable(t){let e=this.grid;t.draggable=!0,w(t,"dragstart",i=>{if(e.plugins.ColumnResizer&&e.plugins.ColumnResizer.isResizing&&i.preventDefault){i.preventDefault();return}e.log("reorder col"),i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",i.target.getAttribute("aria-colindex"))}),w(t,"dragover",i=>(i.preventDefault&&i.preventDefault(),i.dataTransfer.dropEffect="move",!1)),w(t,"drop",i=>{i.stopPropagation&&i.stopPropagation();let s=i.target,o=M(s,"TH"),r=parseInt(i.dataTransfer.getData("text/plain")),l=parseInt(o.getAttribute("aria-colindex"));if(r===l){e.log("reordered col stayed the same");return}e.log("reordered col from "+r+" to "+l);let a=e.startColIndex(),c=e.options.columns[r-a];e.options.columns[r-a]=e.options.columns[l-a],e.options.columns[l-a]=c;let h=(u,g)=>{let m=g.parentNode.getAttribute("aria-rowindex"),b=e.querySelector(u+" tr[aria-rowindex='"+m+"'] [aria-colindex='"+l+"']");d(g,"aria-colindex",l),d(b,"aria-colindex",r);let R=document.createElement("th");g.parentNode.insertBefore(R,g),b.parentNode.replaceChild(g,b),R.parentNode.replaceChild(b,R)};return f(e,"thead th[aria-colindex='"+r+"']").forEach(u=>{h("thead",u)}),f(e,'tbody td[aria-colindex="'+r+'"]').forEach(u=>{h("tbody",u)}),e.options.columns=f(e,"thead tr.dg-head-columns th[field]").map(u=>e.options.columns.find(g=>g.field==k(u,"field"))),x(e,"columnReordered",{col:c.field,from:r,to:l}),!1})}},vt=et;var it=class extends v{constructor(t){super(t),this.touch=null}connected(){let t=this.grid;t.addEventListener("touchstart",this,{passive:!0}),t.addEventListener("touchmove",this,{passive:!0})}disconnected(){let t=this.grid;t.removeEventListener("touchstart",this),t.removeEventListener("touchmove",this)}ontouchstart(t){this.touch=t.touches[0]}ontouchmove(t){if(!this.touch)return;let e=this.grid,i=this.touch.clientX-t.touches[0].clientX,s=this.touch.clientY-t.touches[0].clientY;Math.abs(i)>Math.abs(s)&&(i>0?e.getNext():e.getPrev()),this.touch=null}},xt=it;var z="dg-selectable",Ct="dg-select-all",yt="form-check-input",st=class extends v{disconnected(){this.selectAll&&this.selectAll.removeEventListener("change",this)}getSelection(t=null){let e=this.grid,i=[];return f(e,`tbody .${z} input:checked`).forEach(o=>{let r=parseInt(o.dataset.id),l=e.data[r-1];l||console.warn(`Item ${r} not found`),t?i.push(l[t]):i.push(l)}),i}clearCheckboxes(t){if(!this.grid.options.selectVisibleOnly)return;f(t,`tr[hidden] .${z} input`).forEach(s=>{s.checked=!1}),this.selectAll.checked=!1}colIndex(){return this.grid.startColIndex()-2}createHeaderCol(t){let e=document.createElement("th");d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0,this.selectAll=document.createElement("input"),this.selectAll.type="checkbox",this.selectAll.classList.add(Ct),this.selectAll.classList.add(yt),this.selectAll.addEventListener("change",this);let i=document.createElement("label");i.appendChild(this.selectAll),e.appendChild(i),e.setAttribute("width","40"),t.appendChild(e)}createFilterCol(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z),e.tabIndex=0,t.appendChild(e)}shouldSelectAll(t){this.selectAll&&(t.addEventListener("change",this),t.dispatchEvent(new Event("change")))}createDataCol(t){let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z);let i=document.createElement("input");i.dataset.id=t.getAttribute("aria-rowindex"),i.type="checkbox",i.classList.add(yt);let s=document.createElement("label");s.classList.add("dg-clickable-cell"),s.appendChild(i),e.appendChild(s),s.addEventListener("click",this),t.appendChild(e)}onclick(t){t.stopPropagation()}onchange(t){let e=this.grid;if($(t.target,Ct)){let i=e.options.selectVisibleOnly;f(e,`tbody .${z} input`).forEach(o=>{i&&!o.offsetWidth||(o.checked=this.selectAll.checked)}),x(e,"rowsSelected",{selection:this.getSelection()})}else{if(!t.target.closest(`.${z}`))return;let i=f(e,`tbody .${z} input[type=checkbox]`),s=i.filter(o=>o.checked);this.selectAll.checked=s.length==i.length,x(e,"rowsSelected",{selection:e.getSelection()})}}},At=st;var rt=class extends v{constructor(t){super(t),this.hasFixedHeight=!1,t.style.height&&(t.style.overflowY="auto",this.hasFixedHeight=!0)}createFakeRow(){let e=this.grid.querySelector("tbody"),i=document.createElement("tr");d(i,"role","row"),d(i,"hidden",""),i.classList.add("dg-fake-row"),i.tabIndex=0,e.appendChild(i)}get fakeRow(){return this.grid.querySelector(".dg-fake-row")}updateFakeRow(){let t=this.grid,e=this.fakeRow;if(!e||t.options.perPage>t.totalRecords()||t.page!==t.totalPages()||!t.options.autoheight)return;let i=t.options.perPage*t.rowHeight,s=t.querySelectorAll("tbody tr:not([hidden])").length,o=s>1?i-s*t.rowHeight:i;o>0?(d(e,"height",o),e.removeAttribute("hidden")):e.removeAttribute("height")}},Pt=rt;var nt=class extends v{computeSize(t,e,i,s){let o=this.grid;if(j(t,"width"))return k(t,"width");if(!o.data.length)return;let r=o.data[0],l=o.data[o.data.length-1],a=r[e.field]?r[e.field].toString():"",c=l[e.field]?l[e.field].toString():"";c.length>a.length&&(a=c);let h=0;return a.length<=6?h=i:a.length>50?h=s:h=T(a+"0000",t),h>s&&(h=s),h{clearTimeout(e),e=setTimeout(()=>{e=null,n(...i)},t)}}var E="dg-responsive",at;function $t(n){return n.sort((t,e)=>{let i=parseInt(t.dataset.responsive)||1;return(parseInt(e.dataset.responsive)||1)-i})}var Wt=ot(n=>{for(let t of n){let e=t.target,i=e.table;if(e.plugins.ResponsiveGrid.observerBlocked)return;let s=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,o=parseInt(s.inlineSize),r=i.offsetWidth,l=f(e.headerRow,"th").reduce((P,y)=>P+y.offsetWidth,0),a=(l||r)-o-1,c=50,h=e.plugins.ResponsiveGrid.prevAction,u=$t(f(e.headerRow,"th[field]").reverse().filter(P=>P.dataset.responsive!=="0")),g=!1;if(e.log(`table is ${r}/${l} and available size is ${o}. Diff: ${a}`),a>0){if(h==="show")return;e.plugins.ResponsiveGrid.prevAction="hide";let P=a,y=u.filter(p=>!p.hasAttribute("hidden")&&p.hasAttribute("data-responsive"));if(y.length===0&&(y=u.filter(p=>!p.hasAttribute("hidden")),y.length===1))return;y.forEach(p=>{if(P<0)return;let I=p.offsetWidth,D=p.getAttribute("field");D&&(p.dataset.baseWidth=""+p.offsetWidth,e.hideColumn(D,!1),e.setColProp(D,"responsiveHidden",!0),g=!0,P-=I,P=Math.round(P))})}else{if(h==="hide")return;e.plugins.ResponsiveGrid.prevAction="show";let P=u.filter(p=>!p.hasAttribute("hidden")).reduce((p,I)=>{let D=I.dataset.minWidth?parseInt(I.dataset.minWidth):I.offsetWidth;return p+D},0)+c,y=o-P;u.slice().reverse().filter(p=>p.hasAttribute("hidden")).forEach(p=>{if(yy){y=-1;return}let D=p.getAttribute("field");D&&(e.showColumn(D,!1),e.setColProp(D,"responsiveHidden",!1),g=!0,y-=I,y=Math.round(y))})}let m=W(e.table,"tfoot"),b=f(e.table,".dg-footer > div").reduce((P,y)=>P+y.offsetWidth,0),R=m.offsetWidth-b;b>o?S(m,"dg-footer-compact"):R>250&&F(m,"dg-footer-compact"),g&&e.renderTable(),setTimeout(()=>{e.plugins.ResponsiveGrid.prevAction=null},1e3),e.table.style.visibility="visible"}},100),Et=new ResizeObserver(Wt),lt=class extends v{constructor(t){super(t),this.observerBlocked=!1,this.prevAction=null}connected(){this.grid.options.responsive&&this.observe()}disconnected(){this.unobserve()}observe(){this.grid.options.responsive&&(Et.observe(this.grid),this.grid.style.display="block",this.grid.style.overflowX="hidden")}unobserve(){Et.unobserve(this.grid),this.grid.style.display="unset",this.grid.style.overflowX="unset"}blockObserver(){this.observerBlocked=!0,at&&clearTimeout(at)}unblockObserver(){at=setTimeout(()=>{this.observerBlocked=!1},200)}hasHiddenColumns(){let t=!1;return this.grid.options.columns.forEach(e=>{e.responsiveHidden&&(t=!0)}),t}colIndex(){return this.grid.startColIndex()-1}createHeaderCol(t){if(!this.grid.options.responsiveToggle)return;let e=A("th",t);d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),d(e,"width","40"),e.classList.add(`${E}-toggle`,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0}createFilterCol(t){if(!this.grid.options.responsiveToggle)return;let e=A("th",t);d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.tabIndex=0}createDataCol(t){if(!this.grid.options.responsiveToggle)return;let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.innerHTML=`
+`}get labels(){return C}static getLabels(){return C}static setLabels(t){C=Object.assign(C,t)}get defaultColumn(){return{field:"",title:"",width:0,class:"",attr:"",hidden:!1,editable:!1,noSort:!1,responsive:1,responsiveHidden:!1,format:"",transform:"",filterType:"text",firstFilterOption:{value:"",text:""}}}get defaultOptions(){return{id:null,url:null,perPage:10,debug:!1,filter:!1,menu:!1,sort:!1,server:!1,serverParams:{start:"start",length:"length",search:"search",sort:"sort",sortDir:"sortDir",dataKey:"data",metaKey:"meta",metaTotalKey:"total",metaFilteredKey:"filtered",optionsKey:"options",paramsKey:"params"},defaultSort:"",reorder:!1,dir:"ltr",perPageValues:[10,25,50,100,250],hidePerPage:!1,columns:[],actions:[],collapseActions:!1,selectable:!1,selectVisibleOnly:!0,defaultPage:1,resizable:!1,autosize:!0,expand:!1,autoheight:!0,autohidePager:!1,responsive:!1,responsiveToggle:!0,filterOnEnter:!0,showSpinner:!1,spinnerCssClasses:""}}static registerPlugins(t){B=t}static unregisterPlugins(t=null){t===null?B={}:delete B[t]}static registeredPlugins(){return B}convertColumns(t){let e=[];return typeof t=="object"&&!Array.isArray(t)?Object.keys(t).forEach(i=>{let s=Object.assign({},this.defaultColumn);s.title=t[i],s.field=i,e.push(s)}):t.forEach(i=>{let s=Object.assign({},this.defaultColumn);typeof i=="string"?(s.title=i,s.field=i):typeof i=="object"?(s=Object.assign(s,i),s.field||console.error("Invalid column definition",i),s.title||(s.title=s.field)):console.error("Column definition must be a string or an object"),e.push(s)}),e}static get observedAttributes(){return["page","data-filter","data-sort","data-debug","data-reorder","data-menu","data-selectable","data-url","data-per-page","data-responsive"]}get transformAttributes(){return{columns:t=>this.convertColumns(V(t)),actions:t=>V(t),defaultPage:t=>parseInt(t),perPage:t=>parseInt(t)}}get page(){return parseInt(this.getAttribute("page"))}set page(t){d(this,"page",this.constrainPageValue(t))}urlChanged(){this.loadData().then(()=>{this.configureUi()})}constrainPageValue(t){return this.pages1&&this.page*this.options.perPage>this.totalRecords();)t--;t!=this.page?this.page=t:this.reload(()=>{(!this.plugins.FixedHeight||!this.plugins.FixedHeight.hasFixedHeight)&&this.selectPerPage.scrollIntoView()})}dirChanged(){d(this,"dir",this.options.dir)}defaultSortChanged(){this.sortChanged()}perPageValuesChanged(){if(this.selectPerPage){for(;this.selectPerPage.lastChild;)this.selectPerPage.removeChild(this.selectPerPage.lastChild);this.options.perPageValues.forEach(t=>{U(this.selectPerPage,t,t,t===this.options.perPage)})}}_connected(){this.table=this.querySelector("table"),this.btnFirst=this.querySelector(".dg-btn-first"),this.btnPrev=this.querySelector(".dg-btn-prev"),this.btnNext=this.querySelector(".dg-btn-next"),this.btnLast=this.querySelector(".dg-btn-last"),this.selectPerPage=this.querySelector(".dg-select-per-page"),this.inputPage=this.querySelector(".dg-input-page"),this.getFirst=this.getFirst.bind(this),this.getPrev=this.getPrev.bind(this),this.getNext=this.getNext.bind(this),this.getLast=this.getLast.bind(this),this.changePerPage=this.changePerPage.bind(this),this.gotoPage=this.gotoPage.bind(this),this.btnFirst.addEventListener("click",this.getFirst),this.btnPrev.addEventListener("click",this.getPrev),this.btnNext.addEventListener("click",this.getNext),this.btnLast.addEventListener("click",this.getLast),this.selectPerPage.addEventListener("change",this.changePerPage),this.selectPerPage.toggleAttribute("hidden",this.options.hidePerPage),this.inputPage.addEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.connected()}),this.dirChanged(),this.perPageValuesChanged(),this.loadData().finally(()=>{this.configureUi(),this.sortChanged(),this.classList.add("dg-initialized"),this.filterChanged(),this.reorderChanged(),this.dirChanged(),this.perPageValuesChanged(),this.pageChanged(),this.fireEvents=!0,this.log("initialized")})}_disconnected(){this.btnFirst.removeEventListener("click",this.getFirst),this.btnPrev.removeEventListener("click",this.getPrev),this.btnNext.removeEventListener("click",this.getNext),this.btnLast.removeEventListener("click",this.getLast),this.selectPerPage.removeEventListener("change",this.changePerPage),this.inputPage.removeEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.disconnected()})}getCol(t){let e=null;return this.options.columns.forEach(i=>{i.field==t&&(e=i)}),e}getColProp(t,e){let i=this.getCol(t);return i?i[e]:null}setColProp(t,e,i){let s=this.getCol(t);s&&(s[e]=i)}visibleColumns(){return this.options.columns.filter(t=>!t.hidden)}hiddenColumns(){return this.options.columns.filter(t=>t.hidden===!0)}showColumn(t,e=!0){this.setColProp(t,"hidden",!1),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"visible"})}hideColumn(t,e=!0){this.setColProp(t,"hidden",!0),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"hidden"})}startColIndex(){let t=1;return this.options.selectable&&this.plugins.SelectableRows&&t++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&t++,t}isSticky(){return this.hasAttribute("sticky")}columnsLength(t=!1){let e=0;return this.options.columns.forEach(i=>{t&&i.hidden||i.attr||e++}),this.options.selectable&&this.plugins.SelectableRows&&e++,this.options.actions.length&&this.plugins.RowActions&&e++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&e++,e}configureUi(){if(d(this.querySelector("table"),"aria-rowcount",this.data.length),this.table.style.visibility="hidden",this.renderTable(),this.options.responsive&&this.plugins.ResponsiveGrid||(this.table.style.visibility="visible"),!this.rowHeight){let t=T(this,"tbody tr")||T(this,"table tr");t&&(this.rowHeight=t.offsetHeight)}}filterChanged(){let t=this.querySelector("thead tr.dg-head-filters");this.options.filter?S(t,"hidden"):(this.clearFilters(),d(t,"hidden",""))}reorderChanged(){f(this,"thead tr.dg-head-columns th").forEach(e=>{e.classList.contains("dg-selectable")||e.classList.contains("dg-actions")||(this.options.reorder&&this.plugins.DraggableHeaders?e.draggable=!0:e.removeAttribute("draggable"))})}sortChanged(){this.log("toggle sort"),this.querySelectorAll("thead tr.dg-head-columns th").forEach(t=>{let e=t.getAttribute("field");t.classList.contains("dg-not-sortable")||!this.fireEvents&&e==this.options.defaultSort||(this.options.sort&&!this.getColProp(e,"noSort")?d(t,"aria-sort","none"):S(t,"aria-sort"))})}selectableChanged(){this.renderTable()}addRow(t){Array.isArray(this.originalData)&&(this.log("Add row"),this.originalData.push(t),this.data=this.originalData.slice(),this.sortData())}removeRow(t=null,e=null){if(Array.isArray(this.originalData)){e===null&&(e=this.options.columns[0].field),t===null&&(t=this.originalData[this.originalData.length-1][e]),this.log("Removing "+e+":"+t);for(let i=0;i{this.options.server||e?this.renderBody():this.paginate(),t&&t()})}loadData(){let t=()=>!this.data.length&&this.classList.add("dg-empty"),e=this.querySelector("tbody");return(this.meta||this.originalData||this.classList.contains("dg-initialized"))&&(!this.options.server||this.options.server&&!this.fireEvents)?(this.log("skip loadData"),t(),new Promise(i=>{i()})):(this.log("loadData"),this.loading=!0,this.classList.add("dg-loading"),this.classList.remove("dg-empty","dg-network-error"),this.fetchData().then(i=>{if(Array.isArray(i))this.data=i;else{if(!i[this.options.serverParams.dataKey]){console.error("Invalid response, it should contain a data key with an array or be a plain array",i),this.options.url=null;return}this.options=Object.assign(this.options,i[this.options.serverParams.optionsKey]??{}),this.meta=i[this.options.serverParams.metaKey]??{},this.data=i[this.options.serverParams.dataKey]}this.originalData=this.data.slice(),this.fixPage(),this.options.columns.length===0&&this.originalData.length?this.options.columns=this.convertColumns(Object.keys(this.originalData[0])):this.options.columns=this.convertColumns(this.options.columns)}).catch(i=>{this.log(i),i.message&&e.setAttribute("data-empty",i.message.replace(/^\s+|\r\n|\n|\r$/g,"")),this.classList.add("dg-empty","dg-network-error")}).finally(()=>{t(),!this.classList.contains("dg-network-error")&&e.getAttribute("data-empty")!=this.labels.noData&&e.setAttribute("data-empty",this.labels.noData),this.classList.remove("dg-loading"),this.loading=!1}))}getFirst(){this.loading||(this.page=1)}getLast(){this.loading||(this.page=this.pages)}getPrev(){this.loading||(this.page=this.page-1)}getNext(){this.loading||(this.page=this.page+1)}gotoPage(t){if(t.type==="keypress"){let e=t.keyCode||t.key;if(e===13||e==="Enter")t.preventDefault();else return}this.page=parseInt(this.inputPage.value)}getSort(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t?t.getAttribute("field"):this.options.defaultSort}getSortDir(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t&&t.getAttribute("aria-sort")||""}getFilters(){let t=[];return f(this,this.#t).forEach(i=>{t[i.dataset.name]=i.value}),t}clearFilters(){f(this,this.#t).forEach(e=>{e.value=""}),this.filterData()}filterData(){if(this.log("filter data"),this.page=1,this.options.server)this.reload();else{this.data=this.originalData?.slice()??[],f(this,this.#t).forEach(i=>{let s=i.value;if(s){let o=i.dataset.name;this.data=this.data.filter(r=>(r[o]+"").toLowerCase().indexOf(s.toLowerCase())!==-1)}}),this.pageChanged();let e=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");this.options.sort&&e?this.sortData():this.renderBody()}}sortData(t=null){if(this.log("sort data"),t&&this.getColProp(t.getAttribute("field"),"noSort")){this.log("sorting prevented because column is not sortable");return}if(this.plugins.ColumnResizer&&this.plugins.ColumnResizer.isResizing){this.log("sorting prevented because resizing");return}if(this.loading){this.log("sorting prevented because loading");return}if(t!==null){let e=i=>["dg-selectable","dg-actions","dg-responsive-toggle"].includes(i);this.querySelectorAll("thead tr:first-child th").forEach(i=>{[...i.classList].some(e)||i!==t&&i.setAttribute("aria-sort","none")}),!t.hasAttribute("aria-sort")||t.getAttribute("aria-sort")==="none"?t.setAttribute("aria-sort","ascending"):t.getAttribute("aria-sort")==="ascending"?t.setAttribute("aria-sort","descending"):t.getAttribute("aria-sort")==="descending"&&t.setAttribute("aria-sort","none")}else t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");if(this.options.server)this.loadData().finally(()=>{this.renderBody()});else{let e=t?t.getAttribute("aria-sort"):"none";if(e==="none"){let i=[];this.originalData?.some(s=>(this.data.some(o=>JSON.stringify(s)===JSON.stringify(o)?(i.push(o),!0):!1),i.length===this.data.length)),this.data=i}else{let i=t.getAttribute("field");this.data.sort((s,o)=>{if(!isNaN(s[i])&&!isNaN(o[i]))return e==="ascending"?s[i]-o[i]:o[i]-s[i];let r=e==="ascending"?s[i].toUpperCase():o[i].toUpperCase(),l=e==="ascending"?o[i].toUpperCase():s[i].toUpperCase();switch(!0){case r>l:return 1;case ro("No url set"));let t=window.location.href;t.split("/").pop().includes(".")||(t+=t.endsWith("/")?"":"/");let e=new URL(this.options.url,t),i={r:Date.now()};return this.options.server&&(i[this.options.serverParams.start]=this.page-1,i[this.options.serverParams.length]=this.options.perPage,this.options.filter&&(i[this.options.serverParams.search]=this.getFilters()),i[this.options.serverParams.sort]=this.getSort()||"",i[this.options.serverParams.sortDir]=this.getSortDir(),this.meta?.[this.options.serverParams.paramsKey]&&(i=Object.assign(i,this.meta[this.options.serverParams.paramsKey]))),X(e,i),fetch(e).then(s=>{if(!s.ok)throw new Error(s.statusText||C.networkError);return s.json()})}renderTable(){this.log("render table"),this.options.menu&&this.plugins.ContextMenu&&this.plugins.ContextMenu.createMenu();let t;this.renderHeader(),this.options.defaultSort&&(t=this.querySelector("thead tr.dg-head-columns th[field='"+this.options.defaultSort+"']")),t?this.sortData(t):this.renderBody(),this.renderFooter()}renderHeader(){this.log("render header");let t=this.querySelector("thead");this.createColumnHeaders(t),this.createColumnFilters(t),this.options.resizable&&this.plugins.ColumnResizer&&this.plugins.ColumnResizer.renderResizer(C.resizeColumn),y(this,"headerRendered")}renderFooter(){this.log("render footer");let t=this.querySelector("tfoot"),e=t.querySelector("td");t.removeAttribute("hidden"),d(e,"colspan",this.columnsLength(!0)),t.style.display=""}createColumnHeaders(t){let e=this.clientWidth,i=Math.round(e/this.columnsLength(!0)*2),s=0,o;o=x("tr"),this.headerRow=o,o.setAttribute("role","row"),o.setAttribute("aria-rowindex","1"),o.setAttribute("class","dg-head-columns");let r=t.querySelector("tr.dg-head-columns th");r||(r=x("th"),t.querySelector("tr").appendChild(r)),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createHeaderCol(o),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createHeaderCol(o),s=0;let l=0;if(this.options.columns.forEach(a=>{if(a.attr)return;let c=s+this.startColIndex(),h=x("th");h.setAttribute("scope","col"),h.setAttribute("role","columnheader button"),h.setAttribute("aria-colindex",""+c),h.setAttribute("id",N("dg-col-")),this.options.sort&&h.setAttribute("aria-sort","none"),h.setAttribute("field",a.field),this.plugins.ResponsiveGrid&&this.options.responsive&&d(h,"data-responsive",a.responsive||"");let u=O(a.title,r,!0)+20;h.dataset.minWidth=""+u,mt(h,a),h.tabIndex=0,h.textContent=a.title;let g=0;if(this.options.autosize&&this.plugins.AutosizeColumn){let m=Math.min(e-l,i);g=this.plugins.AutosizeColumn.computeSize(h,a,parseInt(h.dataset.minWidth),m)}else g=Math.max(parseInt(h.dataset.minWidth),parseInt(h.getAttribute("width")));d(h,"width",g),a.hidden?h.setAttribute("hidden",""):l+=g,this.options.reorder&&this.plugins.DraggableHeaders&&this.plugins.DraggableHeaders.makeHeaderDraggable(h),o.appendChild(h),s++}),le){this.log(`adjust width to fix size, ${t.offsetWidth} > ${e}`);let a=this.offsetWidth-this.clientWidth,c=t.offsetWidth-e-a;this.options.responsive&&this.plugins.ResponsiveGrid&&(c+=a),f(o,"th[width]").forEach(u=>{if($(u,"dg-not-resizable")||c<=0)return;let g=parseInt(u.getAttribute("width")),m=u.dataset.minWidth?parseInt(u.dataset.minWidth):0;if(g>m){let v=g-c;v{a.addEventListener("click",()=>this.sortData(a))}),d(this.querySelector("table"),"aria-colcount",this.columnsLength(!0))}createColumnFilters(t){let e=0,i;i=x("tr"),this.filterRow=i,i.setAttribute("role","row"),i.setAttribute("aria-rowindex","2"),i.setAttribute("class","dg-head-filters"),this.options.filter||i.setAttribute("hidden",""),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createFilterCol(i),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createFilterCol(i),this.options.columns.forEach(s=>{if(s.attr)return;let o=e+this.startColIndex(),r=t.querySelector("tr.dg-head-columns th[aria-colindex='"+o+"']");if(!r){console.warn("Related th not found",o);return}let l=x("th");l.setAttribute("aria-colindex",""+o);let a=this.createFilterElement(s,r);this.options.filter?a.tabIndex=0:l.tabIndex=0,s.hidden&&l.setAttribute("hidden",""),l.appendChild(a),i.appendChild(l),e++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionFilter(i),t.replaceChild(i,t.querySelector("tr.dg-head-filters")),i.querySelectorAll(this.#t).forEach(s=>{let o=/select/i.test(s.tagName)?"change":"keyup";s.addEventListener(o,r=>{let l=r.keyCode||r.key;(l===13||l==="Enter"||!this.options.filterOnEnter||r.type=="change")&&this.filterData.call(this)})})}createFilterElement(t,e){let i=t.filterType=="select",s=i?x("select"):x("input");if(i){if(!Array.isArray(t.filterList)){let o=[...new Set((this.data??[]).map(r=>r[t.field]))].filter(r=>!!r).sort();t.filterList=[t.firstFilterOption||this.defaultColumn.firstFilterOption].concat(o.map(r=>({value:r,text:r})))}t.filterList.forEach(o=>{let r=x("option");r.value=o.value,r.text=o.text,s.add(r)})}else s.type="text",s.inputMode="search",s.autocomplete="off",s.spellcheck=!1;return s.dataset.name=t.field,s.id=N("dg-filter-"),s.setAttribute("aria-labelledby",e.getAttribute("id")),s}renderBody(){this.log("render body");let t,e,i,s=x("tbody");this.data.forEach((r,l)=>{t=x("tr"),d(t,"role","row"),d(t,"hidden",""),d(t,"aria-rowindex",l+1),t.tabIndex=0,this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createDataCol(t),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createDataCol(t),this.options.expand&&(t.classList.add("dg-expandable"),w(t,"click",a=>{this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.blockObserver(),gt(a.currentTarget,"dg-expanded"),this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.unblockObserver()})),i=0,this.options.columns.forEach(a=>{if(a||console.error("Empty column found!",this.options.columns),a.attr){r[a.field]&&(a.attr==="class"?L(t,r[a.field]):t.setAttribute(a.attr,r[a.field]));return}if(e=x("td"),e.setAttribute("role","gridcell"),e.setAttribute("aria-colindex",i+this.startColIndex()),mt(e,a),e.setAttribute("data-name",a.title),e.tabIndex=-1,a.editable&&this.plugins.EditableColumn)L(e,"dg-editable-col"),this.plugins.EditableColumn.makeEditableInput(e,a,r,l);else{let c=r[a.field]??"",h;switch(a.transform){case"uppercase":h=c.toUpperCase();break;case"lowercase":h=c.toLowerCase();break;default:h=c;break}if(a.format){if(a.defaultFormatValue!=null&&(h===""||h===null)&&(h=a.defaultFormatValue+""),typeof a.format=="string"&&h)e.innerHTML=q(a.format,Object.assign({_v:c,_tv:h},r));else if(a.format instanceof Function){let u=a.format.call(this,{column:a,rowData:r,cellData:h,td:e,tr:t});e.innerHTML=u||h||c}}else e.textContent=h}t.appendChild(e),i++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionRow(t,r),s.appendChild(t)}),s.setAttribute("role","rowgroup");let o=this.querySelector("tbody");s.setAttribute("data-empty",o.getAttribute("data-empty")),this.querySelector("table").replaceChild(s,o),this.plugins.FixedHeight&&this.plugins.FixedHeight.createFakeRow(),this.paginate(),this.plugins.SelectableRows&&this.plugins.SelectableRows.shouldSelectAll(s),this.data.length&&this.classList.remove("dg-empty"),y(this,"bodyRendered")}paginate(){this.log("paginate");let t=this.totalRecords(),e=this.page||1,i,s=e*this.options.perPage,o=s-this.options.perPage+1,r=this.querySelector("tbody"),l=this.querySelector("tfoot");s>t&&(s=t),t||(o=0),r.querySelectorAll("tr").forEach(a=>{if(this.options.server){S(a,"hidden");return}i=Number(k(a,"aria-rowindex")),i>s||i=this.pages,this.btnLast.disabled=this.page>=this.pages),l.querySelector(".dg-low").textContent=o.toString(),l.querySelector(".dg-high").textContent=s.toString(),l.querySelector(".dg-total").textContent=""+this.totalRecords(),l.toggleAttribute("hidden",this.options.autohidePager&&this.options.perPage>this.totalRecords())}totalPages(){return Math.ceil(this.totalRecords()/this.options.perPage)}totalRecords(){return this.options.server?this.meta?.[this.options.serverParams.metaFilteredKey]||0:this.data.length}},K=J;var Z=class{constructor(t){this.grid=t}connected(){}disconnected(){}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}},b=Z;var Q=class extends b{constructor(t){super(t),this.isResizing=!1}renderResizer(t){let e=this.grid,i=e.table,s=f(e,"thead tr.dg-head-columns th");s.forEach(o=>{if($(o,"dg-not-resizable"))return;let r=document.createElement("div");L(r,"dg-resizer"),r.ariaLabel=t,o.appendChild(r);let l=0,a=0,c=0,h=0,u=m=>{if(m.clientX>h)return;let v=a+(m.clientX-l);o.dataset.minWidth&&v>parseInt(o.dataset.minWidth)&&d(o,"width",v)},g=()=>{e.log("resized column"),setTimeout(()=>{this.isResizing=!1},0),F(r,"dg-resizer-active"),e.options.reorder&&(o.draggable=!0),o.style.overflow="hidden",W(document,"mousemove",u),W(document,"mouseup",g),y(e,"columnResized",{col:k(o,"field"),width:k(o,"width")})};w(r,"click",m=>{m.stopPropagation()}),w(r,"mousedown",m=>{m.stopPropagation(),this.isResizing=!0;let v=m.target,P=f(e,"dg-head-columns th").filter(p=>!p.hasAttribute("hidden")),A=P.findIndex(p=>p==v.parentNode);e.log("resize column"),L(r,"dg-resizer-active"),S(o,"draggable"),o.style.overflow="visible",r.style.height=i.offsetHeight-1+"px",l=m.clientX,a=o.offsetWidth,c=(P.length-A)*30,h=Y(v).left+e.offsetWidth-c,d(o,"width",a);for(let p=0;pA&&S(s[p],"width");w(document,"mousemove",u),w(document,"mouseup",g)})})}},bt=Q;function G(n,t,e="nodeName"){let i=n;for(;i[e]!=t;)i=i.parentElement;return i}var tt=class extends b{connected(){this.menu=this.grid.querySelector(".dg-menu")}disconnected(){this.grid.headerRow&&W(this.grid.headerRow,"contextmenu",this)}attachContextMenu(){let t=this.grid;w(t.headerRow,"contextmenu",this)}onchange(t){let e=this.grid,i=t.target,s=i.dataset.name;if(i.checked)e.showColumn(s);else{if(e.visibleColumns().length<=1){i.checked=!0;return}e.hideColumn(s)}}oncontextmenu(t){t.preventDefault();let e=this.grid,i=G(t.target,"THEAD"),s=this.menu,o=i.getBoundingClientRect(),r=t.clientX-o.left,l=t.clientY-o.top;s.style.top=`${l}px`,s.style.left=`${r}px`,S(s,"hidden"),r+150>o.width&&(r-=s.offsetWidth,s.style.left=`${r}px`);let a=c=>{s.contains(c.target)||(d(s,"hidden",""),W(document,"click",a))};w(document,"click",a)}createMenu(){let t=this.grid,e=this.menu;for(;e.lastChild;)e.removeChild(e.lastChild);e.addEventListener("change",this),t.options.columns.forEach(i=>{if(i.attr)return;let s=document.createElement("li"),o=document.createElement("label"),r=document.createElement("input");d(r,"type","checkbox"),d(r,"data-name",i.field),i.hidden||(r.checked=!0);let l=document.createTextNode(i.title);o.appendChild(r),o.appendChild(l),s.appendChild(o),e.appendChild(s)})}},vt=tt;var et=class extends b{makeHeaderDraggable(t){let e=this.grid;t.draggable=!0,w(t,"dragstart",i=>{if(e.plugins.ColumnResizer&&e.plugins.ColumnResizer.isResizing&&i.preventDefault){i.preventDefault();return}e.log("reorder col"),i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",i.target.getAttribute("aria-colindex"))}),w(t,"dragover",i=>(i.preventDefault&&i.preventDefault(),i.dataTransfer.dropEffect="move",!1)),w(t,"drop",i=>{i.stopPropagation&&i.stopPropagation();let s=i.target,o=G(s,"TH"),r=parseInt(i.dataTransfer.getData("text/plain")),l=parseInt(o.getAttribute("aria-colindex"));if(r===l){e.log("reordered col stayed the same");return}e.log("reordered col from "+r+" to "+l);let a=e.startColIndex(),c=e.options.columns[r-a];e.options.columns[r-a]=e.options.columns[l-a],e.options.columns[l-a]=c;let h=(u,g)=>{let m=g.parentNode.getAttribute("aria-rowindex"),v=e.querySelector(u+" tr[aria-rowindex='"+m+"'] [aria-colindex='"+l+"']");d(g,"aria-colindex",l),d(v,"aria-colindex",r);let R=document.createElement("th");g.parentNode.insertBefore(R,g),v.parentNode.replaceChild(g,v),R.parentNode.replaceChild(v,R)};return f(e,"thead th[aria-colindex='"+r+"']").forEach(u=>{h("thead",u)}),f(e,'tbody td[aria-colindex="'+r+'"]').forEach(u=>{h("tbody",u)}),e.options.columns=f(e,"thead tr.dg-head-columns th[field]").map(u=>e.options.columns.find(g=>g.field==k(u,"field"))),y(e,"columnReordered",{col:c.field,from:r,to:l}),!1})}},xt=et;var it=class extends b{constructor(t){super(t),this.touch=null}connected(){let t=this.grid;t.addEventListener("touchstart",this,{passive:!0}),t.addEventListener("touchmove",this,{passive:!0})}disconnected(){let t=this.grid;t.removeEventListener("touchstart",this),t.removeEventListener("touchmove",this)}ontouchstart(t){this.touch=t.touches[0]}ontouchmove(t){if(!this.touch)return;let e=this.grid,i=this.touch.clientX-t.touches[0].clientX,s=this.touch.clientY-t.touches[0].clientY;Math.abs(i)>Math.abs(s)&&(i>0?e.getNext():e.getPrev()),this.touch=null}},yt=it;var z="dg-selectable",Ct="dg-select-all",At="form-check-input",st=class extends b{disconnected(){this.selectAll&&this.selectAll.removeEventListener("change",this)}getSelection(t=null){let e=this.grid,i=[];return f(e,`tbody .${z} input:checked`).forEach(o=>{let r=parseInt(o.dataset.id),l=e.data[r-1];l||console.warn(`Item ${r} not found`),t?i.push(l[t]):i.push(l)}),i}clearCheckboxes(t){if(!this.grid.options.selectVisibleOnly)return;f(t,`tr[hidden] .${z} input`).forEach(s=>{s.checked=!1}),this.selectAll.checked=!1}colIndex(){return this.grid.startColIndex()-2}createHeaderCol(t){let e=document.createElement("th");d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0,this.selectAll=document.createElement("input"),this.selectAll.type="checkbox",this.selectAll.classList.add(Ct),this.selectAll.classList.add(At),this.selectAll.addEventListener("change",this);let i=document.createElement("label");i.appendChild(this.selectAll),e.appendChild(i),e.setAttribute("width","40"),t.appendChild(e)}createFilterCol(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z),e.tabIndex=0,t.appendChild(e)}shouldSelectAll(t){this.selectAll&&(t.addEventListener("change",this),t.dispatchEvent(new Event("change")))}createDataCol(t){let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z);let i=document.createElement("input");i.dataset.id=t.getAttribute("aria-rowindex"),i.type="checkbox",i.classList.add(At);let s=document.createElement("label");s.classList.add("dg-clickable-cell"),s.appendChild(i),e.appendChild(s),s.addEventListener("click",this),t.appendChild(e)}onclick(t){t.stopPropagation()}onchange(t){let e=this.grid;if($(t.target,Ct)){let i=e.options.selectVisibleOnly;f(e,`tbody .${z} input`).forEach(o=>{i&&!o.offsetWidth||(o.checked=this.selectAll.checked)}),y(e,"rowsSelected",{selection:this.getSelection()})}else{if(!t.target.closest(`.${z}`))return;let i=f(e,`tbody .${z} input[type=checkbox]`),s=i.filter(o=>o.checked);this.selectAll.checked=s.length==i.length,y(e,"rowsSelected",{selection:e.getSelection()})}}},Pt=st;var rt=class extends b{constructor(t){super(t),this.hasFixedHeight=!1,t.style.height&&(t.style.overflowY="auto",this.hasFixedHeight=!0)}createFakeRow(){let e=this.grid.querySelector("tbody"),i=document.createElement("tr");d(i,"role","row"),d(i,"hidden",""),i.classList.add("dg-fake-row"),i.tabIndex=0,e.appendChild(i)}get fakeRow(){return this.grid.querySelector(".dg-fake-row")}updateFakeRow(){let t=this.grid,e=this.fakeRow;if(!e||t.options.perPage>t.totalRecords()||t.page!==t.totalPages()||!t.options.autoheight)return;let i=t.options.perPage*t.rowHeight,s=t.querySelectorAll("tbody tr:not([hidden])").length,o=s>1?i-s*t.rowHeight:i;o>0?(d(e,"height",o),e.removeAttribute("hidden")):e.removeAttribute("height")}},wt=rt;var nt=class extends b{computeSize(t,e,i,s){let o=this.grid;if(j(t,"width"))return k(t,"width");if(!o.data.length)return;let r=o.data[0],l=o.data[o.data.length-1],a=r[e.field]?r[e.field].toString():"",c=l[e.field]?l[e.field].toString():"";c.length>a.length&&(a=c);let h=0;return a.length<=6?h=i:a.length>50?h=s:h=O(a+"0000",t),h>s&&(h=s),h{clearTimeout(e),e=setTimeout(()=>{e=null,n(...i)},t)}}var E="dg-responsive",at;function zt(n){return n.sort((t,e)=>{let i=parseInt(t.dataset.responsive)||1;return(parseInt(e.dataset.responsive)||1)-i})}var Ot=ot(n=>{for(let t of n){let e=t.target,i=e.table;if(e.plugins.ResponsiveGrid.observerBlocked)return;let s=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,o=parseInt(s.inlineSize),r=i.offsetWidth,l=f(e.headerRow,"th").reduce((P,A)=>P+A.offsetWidth,0),a=(l||r)-o-1,c=50,h=e.plugins.ResponsiveGrid.prevAction,u=zt(f(e.headerRow,"th[field]").reverse().filter(P=>P.dataset.responsive!=="0")),g=!1;if(e.log(`table is ${r}/${l} and available size is ${o}. Diff: ${a}`),a>0){if(h==="show")return;e.plugins.ResponsiveGrid.prevAction="hide";let P=a,A=u.filter(p=>!p.hasAttribute("hidden")&&p.hasAttribute("data-responsive"));if(A.length===0&&(A=u.filter(p=>!p.hasAttribute("hidden")),A.length===1))return;A.forEach(p=>{if(P<0)return;let I=p.offsetWidth,D=p.getAttribute("field");D&&(p.dataset.baseWidth=""+p.offsetWidth,e.hideColumn(D,!1),e.setColProp(D,"responsiveHidden",!0),g=!0,P-=I,P=Math.round(P))})}else{if(h==="hide")return;e.plugins.ResponsiveGrid.prevAction="show";let P=u.filter(p=>!p.hasAttribute("hidden")).reduce((p,I)=>{let D=I.dataset.minWidth?parseInt(I.dataset.minWidth):I.offsetWidth;return p+D},0)+c,A=o-P;u.slice().reverse().filter(p=>p.hasAttribute("hidden")).forEach(p=>{if(AA){A=-1;return}let D=p.getAttribute("field");D&&(e.showColumn(D,!1),e.setColProp(D,"responsiveHidden",!1),g=!0,A-=I,A=Math.round(A))})}let m=T(e.table,"tfoot"),v=f(e.table,".dg-footer > div").reduce((P,A)=>P+A.offsetWidth,0),R=m.offsetWidth-v;v>o?L(m,"dg-footer-compact"):R>250&&F(m,"dg-footer-compact"),g&&e.renderTable(),setTimeout(()=>{e.plugins.ResponsiveGrid.prevAction=null},1e3),e.table.style.visibility="visible"}},100),St=new ResizeObserver(Ot),lt=class extends b{constructor(t){super(t),this.observerBlocked=!1,this.prevAction=null}connected(){this.grid.options.responsive&&this.observe()}disconnected(){this.unobserve()}observe(){this.grid.options.responsive&&(St.observe(this.grid),this.grid.style.display="block",this.grid.style.overflowX="hidden")}unobserve(){St.unobserve(this.grid),this.grid.style.display="unset",this.grid.style.overflowX="unset"}blockObserver(){this.observerBlocked=!0,at&&clearTimeout(at)}unblockObserver(){at=setTimeout(()=>{this.observerBlocked=!1},200)}hasHiddenColumns(){let t=!1;return this.grid.options.columns.forEach(e=>{e.responsiveHidden&&(t=!0)}),t}colIndex(){return this.grid.startColIndex()-1}createHeaderCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),d(e,"width","40"),e.classList.add(`${E}-toggle`,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0}createFilterCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.tabIndex=0}createDataCol(t){if(!this.grid.options.responsiveToggle)return;let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.innerHTML=`
`,t.appendChild(e),e.addEventListener("click",this),e.addEventListener("mousedown",this)}computeLabelWidth(){let t=0,e=0;for(;t<120;){e++;let i=W(this.grid,`.dg-head-columns th[aria-colindex="${e}"]`);if(i)t+=i.offsetWidth;else break}return t}onmousedown(t){t.preventDefault()}onclick(t){t.stopPropagation();let e=t.currentTarget,i=e.parentElement,s=W(e,`.${E}-open`),o=W(e,`.${E}-close`);if(this.blockObserver(),$(i,`${E}-expanded`)){F(i,`${E}-expanded`),s.style.display="unset",o.style.display="none";let l=i.nextElementSibling;f(l,`.${E}-hidden`).forEach(c=>{i.appendChild(c),d(c,"hidden")}),l.parentElement.removeChild(l)}else{S(i,`${E}-expanded`),s.style.display="none",o.style.display="unset";let l=A("tr");gt(l,i),S(l,`${E}-child-row`);let a=A("td",l);d(a,"colspan",this.grid.columnsLength(!0));let c=A("table",a);S(c,`${E}-table`);let h=f(i,`.${E}-hidden`),u=this.computeLabelWidth();h.forEach(g=>{let m=A("tr",c),b=g.dataset.name,R=A("th",m);R.style.width=`${u}px`,R.innerHTML=b,m.appendChild(g),L(g,"hidden")})}this.unblockObserver()}},Lt=lt;var dt=class extends v{hasActions(){return this.grid.options.actions.length>0}makeActionHeader(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.grid.columnsLength(!0)),e.classList.add("dg-actions","dg-not-sortable","dg-not-resizable",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionFilter(t){let e=document.createElement("th");e.setAttribute("role","columnheader button"),e.setAttribute("aria-colindex",""+this.grid.columnsLength(!0)),e.classList.add("dg-actions",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionRow(t,e){let i=this.grid.labels,s=document.createElement("td");d(s,"role","gridcell"),d(s,"aria-colindex",this.grid.columnsLength(!0)),s.classList.add("dg-actions",this.actionClass),s.tabIndex=0;let o=document.createElement("button");o.classList.add("dg-actions-toggle"),o.innerHTML="\u2630",s.appendChild(o),w(o,"click",r=>{r.stopPropagation(),r.target.parentElement.classList.toggle("dg-actions-expand")}),this.grid.options.actions.forEach(r=>{let l=document.createElement("button");r.html?l.innerHTML=r.html:l.innerText=r.title??r.name,r.title&&(l.title=r.title),r.url&&(l.type="submit",l.formAction=q(r.url,e)),r.class&&l.classList.add(...r.class.split(" "));let a=c=>{if(c.stopPropagation(),r.confirm&&!confirm(i.areYouSure)){c.preventDefault();return}x(this.grid,"action",{data:e,action:r.name})};l.addEventListener("click",a),s.appendChild(l),r.default&&(t.classList.add("dg-actionable"),t.addEventListener("click",a))}),t.appendChild(s)}get actionClass(){return this.grid.options.actions.length<3&&!this.grid.options.collapseActions?"dg-actions-"+this.grid.options.actions.length:"dg-actions-more"}},St=dt;var ht=class extends v{makeEditableInput(t,e,i,s){let o=this.grid.getAttribute("id"),r=document.createElement("input");r.type=e.editableType||"text",r.type=="email"&&(r.inputMode="email"),r.type=="decimal"&&(r.type="text",r.inputMode="decimal"),r.autocomplete="off",r.spellcheck=!1,r.tabIndex=0,r.classList.add("dg-editable"),r.name=o.replace("-","_")+"["+(s+1)+"]["+e.field+"]",r.value=i[e.field],r.dataset.field=e.field,r.addEventListener("click",l=>l.stopPropagation()),r.addEventListener("keypress",l=>{if(l.type==="keypress"){let a=l.keyCode||l.key;(a===13||a==="Enter")&&(r.blur(),l.preventDefault())}}),r.addEventListener("blur",()=>{r.value!=i[r.dataset.field]&&(i[r.dataset.field]=r.value,x(this.grid,"edit",{data:i,value:r.value}))}),t.appendChild(r)}},kt=ht;_.registerPlugins({ColumnResizer:mt,ContextMenu:bt,DraggableHeaders:vt,TouchSupport:xt,SelectableRows:At,FixedHeight:Pt,AutosizeColumn:wt,ResponsiveGrid:Lt,RowActions:St,EditableColumn:kt});customElements.get("data-grid")||customElements.define("data-grid",_);var ii=_;export{ii as default}; +
`,t.appendChild(e),e.addEventListener("click",this),e.addEventListener("mousedown",this)}computeLabelWidth(){let t=0,e=0;for(;t<120;){e++;let i=T(this.grid,`.dg-head-columns th[aria-colindex="${e}"]`);if(i)t+=i.offsetWidth;else break}return t}onmousedown(t){t.preventDefault()}onclick(t){t.stopPropagation();let e=t.currentTarget,i=e.parentElement,s=T(e,`.${E}-open`),o=T(e,`.${E}-close`);if(this.blockObserver(),$(i,`${E}-expanded`)){F(i,`${E}-expanded`),s.style.display="unset",o.style.display="none";let l=i.nextElementSibling;f(l,`.${E}-hidden`).forEach(c=>{i.appendChild(c),d(c,"hidden")}),l.parentElement.removeChild(l)}else{L(i,`${E}-expanded`),s.style.display="none",o.style.display="unset";let l=x("tr");pt(l,i),L(l,`${E}-child-row`);let a=x("td",l);d(a,"colspan",this.grid.columnsLength(!0));let c=x("table",a);L(c,`${E}-table`);let h=f(i,`.${E}-hidden`),u=this.computeLabelWidth();h.forEach(g=>{let m=x("tr",c),v=g.dataset.name,R=x("th",m);R.style.width=`${u}px`,R.innerHTML=v,m.appendChild(g),S(g,"hidden")})}this.unblockObserver()}},Lt=lt;var dt=class extends b{hasActions(){return this.grid.options.actions.length>0}makeActionHeader(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.grid.columnsLength(!0)),e.classList.add("dg-actions","dg-not-sortable","dg-not-resizable",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionFilter(t){let e=document.createElement("th");e.setAttribute("role","columnheader button"),e.setAttribute("aria-colindex",""+this.grid.columnsLength(!0)),e.classList.add("dg-actions",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionRow(t,e){let i=this.grid.labels,s=document.createElement("td");d(s,"role","gridcell"),d(s,"aria-colindex",this.grid.columnsLength(!0)),s.classList.add("dg-actions",this.actionClass),s.tabIndex=0;let o=document.createElement("button");o.classList.add("dg-actions-toggle"),o.innerHTML="\u2630",s.appendChild(o),w(o,"click",r=>{r.stopPropagation(),r.target.parentElement.classList.toggle("dg-actions-expand")}),this.grid.options.actions.forEach(r=>{let l=document.createElement("button");r.html?l.innerHTML=r.html:l.innerText=r.title??r.name,r.title&&(l.title=r.title),r.url&&(l.type="submit",l.formAction=q(r.url,e)),r.class&&l.classList.add(...r.class.split(" "));let a=c=>{if(c.stopPropagation(),r.confirm&&!confirm(i.areYouSure)){c.preventDefault();return}y(this.grid,"action",{data:e,action:r.name})};l.addEventListener("click",a),s.appendChild(l),r.default&&(t.classList.add("dg-actionable"),t.addEventListener("click",a))}),t.appendChild(s)}get actionClass(){return this.grid.options.actions.length<3&&!this.grid.options.collapseActions?"dg-actions-"+this.grid.options.actions.length:"dg-actions-more"}},kt=dt;var ht=class extends b{makeEditableInput(t,e,i,s){let o=this.grid.getAttribute("id"),r=document.createElement("input");r.type=e.editableType||"text",r.type=="email"&&(r.inputMode="email"),r.type=="decimal"&&(r.type="text",r.inputMode="decimal"),r.autocomplete="off",r.spellcheck=!1,r.tabIndex=0,r.classList.add("dg-editable"),r.name=o.replace("-","_")+"["+(s+1)+"]["+e.field+"]",r.value=i[e.field],r.dataset.field=e.field,r.addEventListener("click",l=>l.stopPropagation()),r.addEventListener("keypress",l=>{if(l.type==="keypress"){let a=l.keyCode||l.key;(a===13||a==="Enter")&&(r.blur(),l.preventDefault())}}),r.addEventListener("blur",()=>{r.value!=i[r.dataset.field]&&(i[r.dataset.field]=r.value,y(this.grid,"edit",{data:i,value:r.value}))}),t.appendChild(r)}},Rt=ht;var ct=class extends b{add(){let t=this.grid;if(!t.options.showSpinner)return;let i=t.options.spinnerCssClasses,s=i.split(" ").map(r=>`.${r}`).join(""),o=` + +`;if(!document.getElementById("dg-styles")){let r=document.querySelector("head")??document.querySelector("body"),l=/head/i.test(r.tagName)?"beforeend":"afterbegin";r.insertAdjacentHTML(l,o)}t.insertAdjacentHTML("afterbegin",``)}},Dt=ct;K.registerPlugins({ColumnResizer:bt,ContextMenu:vt,DraggableHeaders:xt,TouchSupport:yt,SelectableRows:Pt,FixedHeight:wt,AutosizeColumn:Et,ResponsiveGrid:Lt,RowActions:kt,EditableColumn:Rt,SpinnerSupport:Dt});customElements.get("data-grid")||customElements.define("data-grid",K);var ai=K;export{ai as default}; //# sourceMappingURL=data-grid.min.js.map diff --git a/dist/data-grid.min.js.map b/dist/data-grid.min.js.map index c81eff7..40d8bed 100644 --- a/dist/data-grid.min.js.map +++ b/dist/data-grid.min.js.map @@ -1,7 +1,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/interpolate.js", "../src/utils/getTextWidth.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", "../src/plugins/row-actions.js", "../src/plugins/editable-column.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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\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 /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, \"thead tr.dg-head-filters input\");\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, \"thead tr.dg-head-filters input\");\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, \"thead tr.dg-head-filters input\");\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let input = ce(\"input\");\r\n input.type = \"text\";\r\n input.inputMode = \"search\";\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], - "mappings": "AAIe,SAARA,EAA0BC,EAAK,CACpC,OAAOA,EAAI,YAAY,EAAE,QAAQ,oBAAqB,CAACC,EAAGC,IAAQA,EAAI,YAAY,CAAC,CACrF,CCDe,SAARC,EAA+BC,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IACnFI,EAAM,MAAQH,EAAKD,EAAO,KAAK,EAC/BI,EAAM,QAAQ,MAAQJ,EAAO,MAG7BI,EAAM,iBAAiB,QAAUC,GAAOA,EAAG,gBAAgB,CAAC,EAE5DD,EAAM,iBAAiB,WAAaC,GAAO,CACzC,GAAIA,EAAG,OAAS,WAAY,CAC1B,IAAMC,EAAMD,EAAG,SAAWA,EAAG,KACzBC,IAAQ,IAAMA,IAAQ,WACxBF,EAAM,KAAK,EACXC,EAAG,eAAe,GAGxB,CAAC,EAEDD,EAAM,iBAAiB,OAAQ,IAAM,CAE/BA,EAAM,OAASH,EAAKG,EAAM,QAAQ,KAAK,IAI3CH,EAAKG,EAAM,QAAQ,KAAK,EAAIA,EAAM,MAElCG,EAAS,KAAK,KAAM,OAAQ,CAC1B,KAAMN,EACN,MAAOG,EAAM,KACf,CAAC,EACH,CAAC,EACDL,EAAG,YAAYK,CAAK,CACtB,CACF,EAEOI,GAAQX,GC/CfY,EAAS,gBAAgB,CACvB,cAAAC,GACA,YAAAC,GACA,iBAAAC,GACA,aAAAC,GACA,eAAAC,GACA,YAAAC,GACA,eAAAC,GACA,eAAAC,GACA,WAAAC,GACA,eAAAC,EACF,CAAC,EAGI,eAAe,IAAI,WAAW,GACjC,eAAe,OAAO,YAAaV,CAAQ,EAG7C,IAAOA,GAAQA", - "names": ["camelize", "str", "m", "chr", "normalizeData", "v", "supportedPassiveTypes", "passiveOpts", "type", "getAttribute", "el", "name", "hasAttribute", "setAttribute", "v", "check", "removeAttribute", "on", "listener", "off", "dispatch", "el", "name", "data", "bubbles", "opts", "hasClass", "addClass", "removeClass", "toggleClass", "$", "selector", "base", "$$", "find", "findAll", "ce", "tagName", "parent", "el", "insertAfter", "newNode", "existingNode", "BaseElement", "options", "opt", "v", "setAttribute", "jsonConfig", "data", "key", "normalizeData", "message", "getAttribute", "event", "template", "dispatch", "attributeName", "oldValue", "newValue", "isOption", "transformer", "camelize", "base_element_default", "addSelectOption", "el", "value", "label", "checked", "opt", "appendParamsToUrl", "url", "params", "key", "k", "convertArray", "v", "elementOffset", "el", "rect", "scrollLeft", "scrollTop", "interpolate", "str", "data", "$1", "$2", "getTextWidth", "text", "el", "withPadding", "styles", "fontWeight", "fontSize", "fontFamily", "padding", "paddingLeft", "paddingRight", "context", "metrics", "randstr", "prefix", "plugins", "labels", "applyColumnDefinition", "el", "column", "setAttribute", "addClass", "DataGrid", "base_element_default", "randstr", "pluginName", "pluginClass", "attr", "camelize", "v", "list", "plugin", "columns", "cols", "key", "col", "item", "convertArray", "val", "updatePage", "addSelectOption", "field", "found", "prop", "c", "render", "dispatch", "start", "visibleOnly", "len", "tr", "find", "row", "removeAttribute", "findAll", "th", "fieldName", "value", "data", "metaKey", "dataKey", "cb", "needRender", "flagEmpty", "tbody", "resolve", "response", "err", "event", "filters", "input", "name", "haveClasses", "sort", "stack", "itemA", "itemB", "a", "b", "valA", "valB", "reject", "base", "url", "params", "appendParamsToUrl", "sortedColumn", "thead", "tfoot", "td", "availableWidth", "colMaxWidth", "idx", "ce", "sampleTh", "totalWidth", "colIdx", "computedWidth", "getTextWidth", "w", "colAvailableWidth", "visibleCols", "lastCol", "scrollbarWidth", "diff", "hasClass", "actualWidth", "minWidth", "newWidth", "sortableRow", "relatedTh", "e", "i", "on", "ev", "toggleClass", "tv", "interpolate", "prev", "total", "p", "index", "high", "low", "getAttribute", "data_grid_default", "BasePlugin", "grid", "event", "base_plugin_default", "ColumnResizer", "base_plugin_default", "grid", "resizeLabel", "table", "cols", "findAll", "col", "hasClass", "resizer", "addClass", "startX", "startW", "remainingSpace", "max", "mouseMoveHandler", "e", "newWidth", "setAttribute", "mouseUpHandler", "removeClass", "off", "dispatch", "getAttribute", "on", "target", "visibleCols", "columnIndex", "column", "removeAttribute", "elementOffset", "j", "column_resizer_default", "getParentElement", "el", "type", "prop", "parent", "ContextMenu", "base_plugin_default", "off", "grid", "on", "e", "t", "field", "target", "getParentElement", "menu", "rect", "x", "y", "removeAttribute", "documentClickHandler", "setAttribute", "col", "li", "label", "checkbox", "text", "context_menu_default", "DraggableHeaders", "base_plugin_default", "th", "grid", "on", "e", "t", "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", "SELECTABLE_CLASS", "SELECT_ALL_CLASS", "CHECKBOX_CLASS", "SelectableRows", "base_plugin_default", "key", "grid", "selectedData", "findAll", "checkbox", "idx", "item", "tbody", "input", "tr", "th", "setAttribute", "label", "td", "selectOne", "e", "hasClass", "visibleOnly", "cb", "dispatch", "totalCheckboxes", "totalChecked", "n", "selectable_rows_default", "FixedHeight", "base_plugin_default", "grid", "tbody", "tr", "setAttribute", "fakeRow", "max", "visibleRows", "fakeHeight", "fixed_height_default", "AutosizeColumn", "base_plugin_default", "th", "column", "min", "max", "grid", "hasAttribute", "getAttribute", "firstVal", "lastVal", "v", "v2", "width", "getTextWidth", "setAttribute", "autosize_column_default", "debounce", "handler", "timeout", "timer", "args", "RESPONSIVE_CLASS", "obsTo", "sortByPriority", "list", "a", "b", "v1", "callback", "debounce", "entries", "entry", "grid", "table", "contentBoxSize", "size", "tableWidth", "realTableWidth", "findAll", "result", "th", "diff", "minWidth", "prevAction", "headerCols", "col", "changed", "remaining", "cols", "colWidth", "field", "requiredWidth", "width", "footer", "find", "realFooterWidth", "div", "availableFooterWidth", "addClass", "removeClass", "resizeObserver", "ResponsiveGrid", "base_plugin_default", "flag", "tr", "ce", "setAttribute", "td", "idealWidth", "consideredCol", "hCol", "ev", "open", "close", "hasClass", "childRow", "insertAfter", "childRowTd", "childTable", "hiddenCols", "childTableRow", "label", "labelCol", "removeAttribute", "responsive_grid_default", "RowActions", "base_plugin_default", "tr", "actionsTh", "setAttribute", "item", "labels", "td", "actionsToggle", "on", "ev", "action", "button", "interpolate", "actionHandler", "dispatch", "row_actions_default", "EditableColumn", "base_plugin_default", "td", "column", "item", "i", "gridId", "input", "ev", "key", "dispatch", "editable_column_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", "row_actions_default", "editable_column_default"] + "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/interpolate.js", "../src/utils/getTextWidth.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", "../src/plugins/row-actions.js", "../src/plugins/editable-column.js", "../src/plugins/spinner-support.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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading\r\n * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.showSpinner && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true,\r\n showSpinner: false,\r\n spinnerCssClasses: \"\"\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n show = grid.options.showSpinner;\r\n if (!show) return;\r\n const cssClasses = grid.options.spinnerCssClasses,\r\n cls = cssClasses.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!document.getElementById(\"dg-styles\")) {\r\n const styleParent = document.querySelector(\"head\") ?? document.querySelector(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], + "mappings": "AAIe,SAARA,EAA0BC,EAAK,CACpC,OAAOA,EAAI,YAAY,EAAE,QAAQ,oBAAqB,CAACC,E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,IAAIA,CAAC,EAAE,EAAE,KAAK,EAAE,EACrDC,EAAW;AAAA;AAAA,cAEHF,CAAG;AAAA,+BACcA,CAAG;AAAA,8CACYA,CAAG;AAAA;AAAA,4BAErBA,CAAG;AAAA;AAAA;AAAA,EAI3B,GAAI,CAAC,SAAS,eAAe,WAAW,EAAG,CACzC,IAAMG,EAAc,SAAS,cAAc,MAAM,GAAK,SAAS,cAAc,MAAM,EACjFC,EAAW,QAAQ,KAAKD,EAAY,OAAO,EAAI,YAAc,aAC/DA,EAAY,mBAAmBC,EAAUF,CAAQ,CACnD,CACAJ,EAAK,mBAAmB,aAAc,aAAaC,CAAU,QAAQ,CACvE,CACF,EAEOM,GAAQT,GCjBfU,EAAS,gBAAgB,CACvB,cAAAC,GACA,YAAAC,GACA,iBAAAC,GACA,aAAAC,GACA,eAAAC,GACA,YAAAC,GACA,eAAAC,GACA,eAAAC,GACA,WAAAC,GACA,eAAAC,GACA,eAAAC,EACF,CAAC,EAGI,eAAe,IAAI,WAAW,GACjC,eAAe,OAAO,YAAaX,CAAQ,EAG7C,IAAOA,GAAQA", + "names": ["camelize", "str", "m", "chr", "normalizeData", "v", "supportedPassiveTypes", "passiveOpts", "type", "getAttribute", "el", "name", "hasAttribute", "setAttribute", "v", "check", "removeAttribute", "on", "listener", "off", "dispatch", "el", "name", "data", "bubbles", "opts", "hasClass", "addClass", "removeClass", "toggleClass", "$", "selector", "base", "$$", "find", "findAll", "ce", "tagName", "parent", "el", "insertAfter", "newNode", "existingNode", "BaseElement", "options", "opt", "v", "setAttribute", "jsonConfig", "data", "key", "normalizeData", "message", "getAttribute", "event", "template", "dispatch", "attributeName", "oldValue", "newValue", "isOption", "transformer", "camelize", "base_element_default", "addSelectOption", "el", "value", "label", "checked", "opt", "appendParamsToUrl", "url", "params", "key", "k", "convertArray", "v", "elementOffset", "el", "rect", "scrollLeft", "scrollTop", "interpolate", "str", "data", "$1", "$2", "getTextWidth", "text", "el", "withPadding", "styles", "fontWeight", "fontSize", "fontFamily", "padding", "paddingLeft", "paddingRight", "context", "metrics", "randstr", "prefix", "plugins", "labels", "applyColumnDefinition", "el", "column", "setAttribute", "addClass", "DataGrid", "_DataGrid", "base_element_default", "#filterSelector", "randstr", "pluginName", "pluginClass", "attr", "camelize", "v", "list", "plugin", "columns", "cols", "key", "col", "item", "convertArray", "val", "updatePage", "addSelectOption", "field", "found", "prop", "c", "render", "dispatch", "start", "visibleOnly", "len", "tr", "find", "row", "removeAttribute", "findAll", "th", "fieldName", "value", "data", "metaKey", "dataKey", "cb", "needRender", "flagEmpty", "tbody", "resolve", "response", "err", "event", "filters", "input", "name", "haveClasses", "sort", "stack", "itemA", "itemB", "a", "b", "valA", "valB", "reject", "base", "url", "params", "appendParamsToUrl", "sortedColumn", "thead", "tfoot", "td", "availableWidth", "colMaxWidth", "idx", "ce", "sampleTh", "totalWidth", "colIdx", "computedWidth", "getTextWidth", "w", "colAvailableWidth", "visibleCols", "lastCol", "scrollbarWidth", "diff", "hasClass", "actualWidth", "minWidth", "newWidth", "sortableRow", "relatedTh", "filter", "eventName", "e", "isSelect", "uniqueValues", "opt", "i", "on", "ev", "toggleClass", "tv", "interpolate", "prev", "total", "p", "index", "high", "low", "getAttribute", "data_grid_default", "BasePlugin", "grid", "event", "base_plugin_default", "ColumnResizer", "base_plugin_default", "grid", "resizeLabel", "table", "cols", "findAll", "col", "hasClass", "resizer", "addClass", "startX", "startW", "remainingSpace", "max", "mouseMoveHandler", "e", "newWidth", "setAttribute", "mouseUpHandler", "removeClass", "off", "dispatch", "getAttribute", "on", "target", "visibleCols", "columnIndex", "column", "removeAttribute", "elementOffset", "j", "column_resizer_default", "getParentElement", "el", "type", "prop", "parent", "ContextMenu", "base_plugin_default", "off", "grid", "on", "e", "t", "field", "target", "getParentElement", "menu", "rect", "x", "y", "removeAttribute", "documentClickHandler", "setAttribute", "col", "li", "label", "checkbox", "text", "context_menu_default", "DraggableHeaders", "base_plugin_default", "th", "grid", "on", "e", "t", "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", "SELECTABLE_CLASS", "SELECT_ALL_CLASS", "CHECKBOX_CLASS", "SelectableRows", "base_plugin_default", "key", "grid", "selectedData", "findAll", "checkbox", "idx", "item", "tbody", "input", "tr", "th", "setAttribute", "label", "td", "selectOne", "e", "hasClass", "visibleOnly", "cb", "dispatch", "totalCheckboxes", "totalChecked", "n", "selectable_rows_default", "FixedHeight", "base_plugin_default", "grid", "tbody", "tr", "setAttribute", "fakeRow", "max", "visibleRows", "fakeHeight", "fixed_height_default", "AutosizeColumn", "base_plugin_default", "th", "column", "min", "max", "grid", "hasAttribute", "getAttribute", "firstVal", "lastVal", "v", "v2", "width", "getTextWidth", "setAttribute", "autosize_column_default", "debounce", "handler", "timeout", "timer", "args", "RESPONSIVE_CLASS", "obsTo", "sortByPriority", "list", "a", "b", "v1", "callback", "debounce", "entries", "entry", "grid", "table", "contentBoxSize", "size", "tableWidth", "realTableWidth", "findAll", "result", "th", "diff", "minWidth", "prevAction", "headerCols", "col", "changed", "remaining", "cols", "colWidth", "field", "requiredWidth", "width", "footer", "find", "realFooterWidth", "div", "availableFooterWidth", "addClass", "removeClass", "resizeObserver", "ResponsiveGrid", "base_plugin_default", "flag", "tr", "ce", "setAttribute", "td", "idealWidth", "consideredCol", "hCol", "ev", "open", "close", "hasClass", "childRow", "insertAfter", "childRowTd", "childTable", "hiddenCols", "childTableRow", "label", "labelCol", "removeAttribute", "responsive_grid_default", "RowActions", "base_plugin_default", "tr", "actionsTh", "setAttribute", "item", "labels", "td", "actionsToggle", "on", "ev", "action", "button", "interpolate", "actionHandler", "dispatch", "row_actions_default", "EditableColumn", "base_plugin_default", "td", "column", "item", "i", "gridId", "input", "ev", "key", "dispatch", "editable_column_default", "SpinnerSupport", "base_plugin_default", "grid", "cssClasses", "cls", "e", "template", "styleParent", "position", "spinner_support_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", "row_actions_default", "editable_column_default", "spinner_support_default"] } diff --git a/package-lock.json b/package-lock.json index 23a831d..e8e56ce 100644 --- a/package-lock.json +++ b/package-lock.json @@ -17,7 +17,7 @@ "devDependencies": { "@happy-dom/global-registrator": "^10.5.1", "ava": "^5.3.1", - "esbuild": "^0.18.14", + "esbuild": "*", "jsdoc": "^4.0.2", "jsdoc-plugin-intersection": "^1.0.4", "jsdoc-to-markdown": "^8.0.0", @@ -36,10 +36,26 @@ "node": ">=6.0.0" } }, + "node_modules/@esbuild/aix-ppc64": { + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.1.tgz", + "integrity": "sha512-m55cpeupQ2DbuRGQMMZDzbv9J9PgVelPjlcmM5kxHnrBdBx6REaEd7LamYV7Dm8N7rCyR/XwU6rVP8ploKtIkA==", + "cpu": [ + "ppc64" + ], + "dev": true, + "optional": true, + "os": [ + "aix" + ], + "engines": { + "node": ">=12" + } + }, "node_modules/@esbuild/android-arm": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.14.tgz", - "integrity": "sha512-blODaaL+lngG5bdK/t4qZcQvq2BBqrABmYwqPPcS5VRxrCSGHb9R/rA3fqxh7R18I7WU4KKv+NYkt22FDfalcg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.1.tgz", + "integrity": "sha512-4j0+G27/2ZXGWR5okcJi7pQYhmkVgb4D7UKwxcqrjhvp5TKWx3cUjgB1CGj1mfdmJBQ9VnUGgUhign+FPF2Zgw==", "cpu": [ "arm" ], @@ -53,9 +69,9 @@ } }, "node_modules/@esbuild/android-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.14.tgz", - "integrity": "sha512-rZ2v+Luba5/3D6l8kofWgTnqE+qsC/L5MleKIKFyllHTKHrNBMqeRCnZI1BtRx8B24xMYxeU32iIddRQqMsOsg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.1.tgz", + "integrity": "sha512-hCnXNF0HM6AjowP+Zou0ZJMWWa1VkD77BXe959zERgGJBBxB+sV+J9f/rcjeg2c5bsukD/n17RKWXGFCO5dD5A==", "cpu": [ "arm64" ], @@ -69,9 +85,9 @@ } }, "node_modules/@esbuild/android-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.14.tgz", - "integrity": "sha512-qSwh8y38QKl+1Iqg+YhvCVYlSk3dVLk9N88VO71U4FUjtiSFylMWK3Ugr8GC6eTkkP4Tc83dVppt2n8vIdlSGg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.1.tgz", + "integrity": "sha512-MSfZMBoAsnhpS+2yMFYIQUPs8Z19ajwfuaSZx+tSl09xrHZCjbeXXMsUF/0oq7ojxYEpsSo4c0SfjxOYXRbpaA==", "cpu": [ "x64" ], @@ -85,9 +101,9 @@ } }, "node_modules/@esbuild/darwin-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.14.tgz", - "integrity": "sha512-9Hl2D2PBeDYZiNbnRKRWuxwHa9v5ssWBBjisXFkVcSP5cZqzZRFBUWEQuqBHO4+PKx4q4wgHoWtfQ1S7rUqJ2Q==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.1.tgz", + "integrity": "sha512-Ylk6rzgMD8klUklGPzS414UQLa5NPXZD5tf8JmQU8GQrj6BrFA/Ic9tb2zRe1kOZyCbGl+e8VMbDRazCEBqPvA==", "cpu": [ "arm64" ], @@ -101,9 +117,9 @@ } }, "node_modules/@esbuild/darwin-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.14.tgz", - "integrity": "sha512-ZnI3Dg4ElQ6tlv82qLc/UNHtFsgZSKZ7KjsUNAo1BF1SoYDjkGKHJyCrYyWjFecmXpvvG/KJ9A/oe0H12odPLQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.1.tgz", + "integrity": "sha512-pFIfj7U2w5sMp52wTY1XVOdoxw+GDwy9FsK3OFz4BpMAjvZVs0dT1VXs8aQm22nhwoIWUmIRaE+4xow8xfIDZA==", "cpu": [ "x64" ], @@ -117,9 +133,9 @@ } }, "node_modules/@esbuild/freebsd-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.14.tgz", - "integrity": "sha512-h3OqR80Da4oQCIa37zl8tU5MwHQ7qgPV0oVScPfKJK21fSRZEhLE4IIVpmcOxfAVmqjU6NDxcxhYaM8aDIGRLw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.1.tgz", + "integrity": "sha512-UyW1WZvHDuM4xDz0jWun4qtQFauNdXjXOtIy7SYdf7pbxSWWVlqhnR/T2TpX6LX5NI62spt0a3ldIIEkPM6RHw==", "cpu": [ "arm64" ], @@ -133,9 +149,9 @@ } }, "node_modules/@esbuild/freebsd-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.14.tgz", - "integrity": "sha512-ha4BX+S6CZG4BoH9tOZTrFIYC1DH13UTCRHzFc3GWX74nz3h/N6MPF3tuR3XlsNjMFUazGgm35MPW5tHkn2lzQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.1.tgz", + "integrity": "sha512-itPwCw5C+Jh/c624vcDd9kRCCZVpzpQn8dtwoYIt2TJF3S9xJLiRohnnNrKwREvcZYx0n8sCSbvGH349XkcQeg==", "cpu": [ "x64" ], @@ -149,9 +165,9 @@ } }, "node_modules/@esbuild/linux-arm": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.14.tgz", - "integrity": "sha512-5+7vehI1iqru5WRtJyU2XvTOvTGURw3OZxe3YTdE9muNNIdmKAVmSHpB3Vw2LazJk2ifEdIMt/wTWnVe5V98Kg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.1.tgz", + "integrity": "sha512-LojC28v3+IhIbfQ+Vu4Ut5n3wKcgTu6POKIHN9Wpt0HnfgUGlBuyDDQR4jWZUZFyYLiz4RBBBmfU6sNfn6RhLw==", "cpu": [ "arm" ], @@ -165,9 +181,9 @@ } }, "node_modules/@esbuild/linux-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.14.tgz", - "integrity": "sha512-IXORRe22In7U65NZCzjwAUc03nn8SDIzWCnfzJ6t/8AvGx5zBkcLfknI+0P+hhuftufJBmIXxdSTbzWc8X/V4w==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.1.tgz", + "integrity": "sha512-cX8WdlF6Cnvw/DO9/X7XLH2J6CkBnz7Twjpk56cshk9sjYVcuh4sXQBy5bmTwzBjNVZze2yaV1vtcJS04LbN8w==", "cpu": [ "arm64" ], @@ -181,9 +197,9 @@ } }, "node_modules/@esbuild/linux-ia32": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.14.tgz", - "integrity": "sha512-BfHlMa0nibwpjG+VXbOoqJDmFde4UK2gnW351SQ2Zd4t1N3zNdmUEqRkw/srC1Sa1DRBE88Dbwg4JgWCbNz/FQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.1.tgz", + "integrity": "sha512-4H/sQCy1mnnGkUt/xszaLlYJVTz3W9ep52xEefGtd6yXDQbz/5fZE5dFLUgsPdbUOQANcVUa5iO6g3nyy5BJiw==", "cpu": [ "ia32" ], @@ -197,9 +213,9 @@ } }, "node_modules/@esbuild/linux-loong64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.14.tgz", - "integrity": "sha512-j2/Ex++DRUWIAaUDprXd3JevzGtZ4/d7VKz+AYDoHZ3HjJzCyYBub9CU1wwIXN+viOP0b4VR3RhGClsvyt/xSw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.1.tgz", + "integrity": "sha512-c0jgtB+sRHCciVXlyjDcWb2FUuzlGVRwGXgI+3WqKOIuoo8AmZAddzeOHeYLtD+dmtHw3B4Xo9wAUdjlfW5yYA==", "cpu": [ "loong64" ], @@ -213,9 +229,9 @@ } }, "node_modules/@esbuild/linux-mips64el": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.14.tgz", - "integrity": "sha512-qn2+nc+ZCrJmiicoAnJXJJkZWt8Nwswgu1crY7N+PBR8ChBHh89XRxj38UU6Dkthl2yCVO9jWuafZ24muzDC/A==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.1.tgz", + "integrity": "sha512-TgFyCfIxSujyuqdZKDZ3yTwWiGv+KnlOeXXitCQ+trDODJ+ZtGOzLkSWngynP0HZnTsDyBbPy7GWVXWaEl6lhA==", "cpu": [ "mips64el" ], @@ -229,9 +245,9 @@ } }, "node_modules/@esbuild/linux-ppc64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.14.tgz", - "integrity": "sha512-aGzXzd+djqeEC5IRkDKt3kWzvXoXC6K6GyYKxd+wsFJ2VQYnOWE954qV2tvy5/aaNrmgPTb52cSCHFE+Z7Z0yg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.1.tgz", + "integrity": "sha512-b+yuD1IUeL+Y93PmFZDZFIElwbmFfIKLKlYI8M6tRyzE6u7oEP7onGk0vZRh8wfVGC2dZoy0EqX1V8qok4qHaw==", "cpu": [ "ppc64" ], @@ -245,9 +261,9 @@ } }, "node_modules/@esbuild/linux-riscv64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.14.tgz", - "integrity": "sha512-8C6vWbfr0ygbAiMFLS6OPz0BHvApkT2gCboOGV76YrYw+sD/MQJzyITNsjZWDXJwPu9tjrFQOVG7zijRzBCnLw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.1.tgz", + "integrity": "sha512-wpDlpE0oRKZwX+GfomcALcouqjjV8MIX8DyTrxfyCfXxoKQSDm45CZr9fanJ4F6ckD4yDEPT98SrjvLwIqUCgg==", "cpu": [ "riscv64" ], @@ -261,9 +277,9 @@ } }, "node_modules/@esbuild/linux-s390x": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.14.tgz", - "integrity": "sha512-G/Lf9iu8sRMM60OVGOh94ZW2nIStksEcITkXdkD09/T6QFD/o+g0+9WVyR/jajIb3A0LvBJ670tBnGe1GgXMgw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.1.tgz", + "integrity": "sha512-5BepC2Au80EohQ2dBpyTquqGCES7++p7G+7lXe1bAIvMdXm4YYcEfZtQrP4gaoZ96Wv1Ute61CEHFU7h4FMueQ==", "cpu": [ "s390x" ], @@ -277,9 +293,9 @@ } }, "node_modules/@esbuild/linux-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.14.tgz", - "integrity": "sha512-TBgStYBQaa3EGhgqIDM+ECnkreb0wkcKqL7H6m+XPcGUoU4dO7dqewfbm0mWEQYH3kzFHrzjOFNpSAVzDZRSJw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.1.tgz", + "integrity": "sha512-5gRPk7pKuaIB+tmH+yKd2aQTRpqlf1E4f/mC+tawIm/CGJemZcHZpp2ic8oD83nKgUPMEd0fNanrnFljiruuyA==", "cpu": [ "x64" ], @@ -293,9 +309,9 @@ } }, "node_modules/@esbuild/netbsd-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.14.tgz", - "integrity": "sha512-stvCcjyCQR2lMTroqNhAbvROqRjxPEq0oQ380YdXxA81TaRJEucH/PzJ/qsEtsHgXlWFW6Ryr/X15vxQiyRXVg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.1.tgz", + "integrity": "sha512-4fL68JdrLV2nVW2AaWZBv3XEm3Ae3NZn/7qy2KGAt3dexAgSVT+Hc97JKSZnqezgMlv9x6KV0ZkZY7UO5cNLCg==", "cpu": [ "x64" ], @@ -309,9 +325,9 @@ } }, "node_modules/@esbuild/openbsd-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.14.tgz", - "integrity": "sha512-apAOJF14CIsN5ht1PA57PboEMsNV70j3FUdxLmA2liZ20gEQnfTG5QU0FhENo5nwbTqCB2O3WDsXAihfODjHYw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.1.tgz", + "integrity": "sha512-GhRuXlvRE+twf2ES+8REbeCb/zeikNqwD3+6S5y5/x+DYbAQUNl0HNBs4RQJqrechS4v4MruEr8ZtAin/hK5iw==", "cpu": [ "x64" ], @@ -325,9 +341,9 @@ } }, "node_modules/@esbuild/sunos-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.14.tgz", - "integrity": "sha512-fYRaaS8mDgZcGybPn2MQbn1ZNZx+UXFSUoS5Hd2oEnlsyUcr/l3c6RnXf1bLDRKKdLRSabTmyCy7VLQ7VhGdOQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.1.tgz", + "integrity": "sha512-ZnWEyCM0G1Ex6JtsygvC3KUUrlDXqOihw8RicRuQAzw+c4f1D66YlPNNV3rkjVW90zXVsHwZYWbJh3v+oQFM9Q==", "cpu": [ "x64" ], @@ -341,9 +357,9 @@ } }, "node_modules/@esbuild/win32-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.14.tgz", - "integrity": "sha512-1c44RcxKEJPrVj62XdmYhxXaU/V7auELCmnD+Ri+UCt+AGxTvzxl9uauQhrFso8gj6ZV1DaORV0sT9XSHOAk8Q==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.1.tgz", + "integrity": "sha512-QZ6gXue0vVQY2Oon9WyLFCdSuYbXSoxaZrPuJ4c20j6ICedfsDilNPYfHLlMH7vGfU5DQR0czHLmJvH4Nzis/A==", "cpu": [ "arm64" ], @@ -357,9 +373,9 @@ } }, "node_modules/@esbuild/win32-ia32": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.14.tgz", - "integrity": "sha512-EXAFttrdAxZkFQmpvcAQ2bywlWUsONp/9c2lcfvPUhu8vXBBenCXpoq9YkUvVP639ld3YGiYx0YUQ6/VQz3Maw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.1.tgz", + "integrity": "sha512-HzcJa1NcSWTAU0MJIxOho8JftNp9YALui3o+Ny7hCh0v5f90nprly1U3Sj1Ldj/CvKKdvvFsCRvDkpsEMp4DNw==", "cpu": [ "ia32" ], @@ -373,9 +389,9 @@ } }, "node_modules/@esbuild/win32-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.14.tgz", - "integrity": "sha512-K0QjGbcskx+gY+qp3v4/940qg8JitpXbdxFhRDA1aYoNaPff88+aEwoq45aqJ+ogpxQxmU0ZTjgnrQD/w8iiUg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.1.tgz", + "integrity": "sha512-0MBh53o6XtI6ctDnRMeQ+xoCN8kD2qI1rY1KgF/xdWQwoFeKou7puvDfV8/Wv4Ctx2rRpET/gGdz3YlNtNACSA==", "cpu": [ "x64" ], @@ -809,9 +825,9 @@ } }, "node_modules/caniuse-lite": { - "version": "1.0.30001486", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001486.tgz", - "integrity": "sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg==", + "version": "1.0.30001589", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001589.tgz", + "integrity": "sha512-vNQWS6kI+q6sBlHbh71IIeC+sRwK2N3EDySc/updIGhIee2x5z00J4c1242/5/d6EpEMdOnk/m+6tuk4/tcsqg==", "funding": [ { "type": "opencollective", @@ -1353,9 +1369,9 @@ } }, "node_modules/esbuild": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.14.tgz", - "integrity": "sha512-uNPj5oHPYmj+ZhSQeYQVFZ+hAlJZbAGOmmILWIqrGvPVlNLbyOvU5Bu6Woi8G8nskcx0vwY0iFoMPrzT86Ko+w==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.1.tgz", + "integrity": "sha512-OJwEgrpWm/PCMsLVWXKqvcjme3bHNpOgN7Tb6cQnR5n0TPbQx1/Xrn7rqM+wn17bYeT6MGB5sn1Bh5YiGi70nA==", "dev": true, "hasInstallScript": true, "bin": { @@ -1365,28 +1381,29 @@ "node": ">=12" }, "optionalDependencies": { - "@esbuild/android-arm": "0.18.14", - "@esbuild/android-arm64": "0.18.14", - "@esbuild/android-x64": "0.18.14", - "@esbuild/darwin-arm64": "0.18.14", - "@esbuild/darwin-x64": "0.18.14", - "@esbuild/freebsd-arm64": "0.18.14", - "@esbuild/freebsd-x64": "0.18.14", - "@esbuild/linux-arm": "0.18.14", - "@esbuild/linux-arm64": "0.18.14", - "@esbuild/linux-ia32": "0.18.14", - "@esbuild/linux-loong64": "0.18.14", - "@esbuild/linux-mips64el": "0.18.14", - "@esbuild/linux-ppc64": "0.18.14", - "@esbuild/linux-riscv64": "0.18.14", - "@esbuild/linux-s390x": "0.18.14", - "@esbuild/linux-x64": "0.18.14", - "@esbuild/netbsd-x64": "0.18.14", - "@esbuild/openbsd-x64": "0.18.14", - "@esbuild/sunos-x64": "0.18.14", - "@esbuild/win32-arm64": "0.18.14", - "@esbuild/win32-ia32": "0.18.14", - "@esbuild/win32-x64": "0.18.14" + "@esbuild/aix-ppc64": "0.20.1", + "@esbuild/android-arm": "0.20.1", + "@esbuild/android-arm64": "0.20.1", + "@esbuild/android-x64": "0.20.1", + "@esbuild/darwin-arm64": "0.20.1", + "@esbuild/darwin-x64": "0.20.1", + "@esbuild/freebsd-arm64": "0.20.1", + "@esbuild/freebsd-x64": "0.20.1", + "@esbuild/linux-arm": "0.20.1", + "@esbuild/linux-arm64": "0.20.1", + "@esbuild/linux-ia32": "0.20.1", + "@esbuild/linux-loong64": "0.20.1", + "@esbuild/linux-mips64el": "0.20.1", + "@esbuild/linux-ppc64": "0.20.1", + "@esbuild/linux-riscv64": "0.20.1", + "@esbuild/linux-s390x": "0.20.1", + "@esbuild/linux-x64": "0.20.1", + "@esbuild/netbsd-x64": "0.20.1", + "@esbuild/openbsd-x64": "0.20.1", + "@esbuild/sunos-x64": "0.20.1", + "@esbuild/win32-arm64": "0.20.1", + "@esbuild/win32-ia32": "0.20.1", + "@esbuild/win32-x64": "0.20.1" } }, "node_modules/escalade": { @@ -1983,14 +2000,13 @@ } }, "node_modules/jsdoc-parse": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/jsdoc-parse/-/jsdoc-parse-6.2.0.tgz", - "integrity": "sha512-Afu1fQBEb7QHt6QWX/6eUWvYHJofB90Fjx7FuJYF7mnG9z5BkAIpms1wsnvYLytfmqpEENHs/fax9p8gvMj7dw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsdoc-parse/-/jsdoc-parse-6.2.1.tgz", + "integrity": "sha512-9viGRUUtWOk/G4V0+nQ6rfLucz5plxh5I74WbNSNm9h9NWugCDVX4jbG8hZP9QqKGpdTPDE+qJXzaYNos3wqTA==", "dev": true, "dependencies": { "array-back": "^6.2.2", "lodash.omit": "^4.5.0", - "lodash.pick": "^4.4.0", "reduce-extract": "^1.0.0", "sort-array": "^4.1.5", "test-value": "^3.0.0" @@ -2129,12 +2145,6 @@ "integrity": "sha512-sOQs2aqGpbl27tmCS1QNZA09Uqp01ZzWfDUoD+xzTii0E7dSQfRKcRetFwa+uXaxaqL+TKm7CgD2JdKP7aZBSw==", "dev": true }, - "node_modules/lodash.pick": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", - "integrity": "sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==", - "dev": true - }, "node_modules/lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -2324,9 +2334,9 @@ "dev": true }, "node_modules/nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==", + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==", "funding": [ { "type": "github", @@ -2575,9 +2585,9 @@ } }, "node_modules/postcss": { - "version": "8.4.26", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.26.tgz", - "integrity": "sha512-jrXHFF8iTloAenySjM/ob3gSj7pCu0Ji49hnjqzsgSRa50hkWCKD0HQ+gMNJkW38jBI68MpAAg7ZWwHwX8NMMw==", + "version": "8.4.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", + "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", "funding": [ { "type": "opencollective", @@ -2593,7 +2603,7 @@ } ], "dependencies": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" }, @@ -3622,157 +3632,164 @@ "integrity": "sha512-6zavDGdzG3gUqAdWvlLFfk+36RilI+Pwyuuh7HItyeScCWP3k6i8vKclAQ0bM/0y/Kz/xiwvxhMv9MgTJP5gmA==", "dev": true }, + "@esbuild/aix-ppc64": { + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/aix-ppc64/-/aix-ppc64-0.20.1.tgz", + "integrity": "sha512-m55cpeupQ2DbuRGQMMZDzbv9J9PgVelPjlcmM5kxHnrBdBx6REaEd7LamYV7Dm8N7rCyR/XwU6rVP8ploKtIkA==", + "dev": true, + "optional": true + }, "@esbuild/android-arm": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.18.14.tgz", - "integrity": "sha512-blODaaL+lngG5bdK/t4qZcQvq2BBqrABmYwqPPcS5VRxrCSGHb9R/rA3fqxh7R18I7WU4KKv+NYkt22FDfalcg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm/-/android-arm-0.20.1.tgz", + "integrity": "sha512-4j0+G27/2ZXGWR5okcJi7pQYhmkVgb4D7UKwxcqrjhvp5TKWx3cUjgB1CGj1mfdmJBQ9VnUGgUhign+FPF2Zgw==", "dev": true, "optional": true }, "@esbuild/android-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.18.14.tgz", - "integrity": "sha512-rZ2v+Luba5/3D6l8kofWgTnqE+qsC/L5MleKIKFyllHTKHrNBMqeRCnZI1BtRx8B24xMYxeU32iIddRQqMsOsg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-arm64/-/android-arm64-0.20.1.tgz", + "integrity": "sha512-hCnXNF0HM6AjowP+Zou0ZJMWWa1VkD77BXe959zERgGJBBxB+sV+J9f/rcjeg2c5bsukD/n17RKWXGFCO5dD5A==", "dev": true, "optional": true }, "@esbuild/android-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.18.14.tgz", - "integrity": "sha512-qSwh8y38QKl+1Iqg+YhvCVYlSk3dVLk9N88VO71U4FUjtiSFylMWK3Ugr8GC6eTkkP4Tc83dVppt2n8vIdlSGg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/android-x64/-/android-x64-0.20.1.tgz", + "integrity": "sha512-MSfZMBoAsnhpS+2yMFYIQUPs8Z19ajwfuaSZx+tSl09xrHZCjbeXXMsUF/0oq7ojxYEpsSo4c0SfjxOYXRbpaA==", "dev": true, "optional": true }, "@esbuild/darwin-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.18.14.tgz", - "integrity": "sha512-9Hl2D2PBeDYZiNbnRKRWuxwHa9v5ssWBBjisXFkVcSP5cZqzZRFBUWEQuqBHO4+PKx4q4wgHoWtfQ1S7rUqJ2Q==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-arm64/-/darwin-arm64-0.20.1.tgz", + "integrity": "sha512-Ylk6rzgMD8klUklGPzS414UQLa5NPXZD5tf8JmQU8GQrj6BrFA/Ic9tb2zRe1kOZyCbGl+e8VMbDRazCEBqPvA==", "dev": true, "optional": true }, "@esbuild/darwin-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.18.14.tgz", - "integrity": "sha512-ZnI3Dg4ElQ6tlv82qLc/UNHtFsgZSKZ7KjsUNAo1BF1SoYDjkGKHJyCrYyWjFecmXpvvG/KJ9A/oe0H12odPLQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/darwin-x64/-/darwin-x64-0.20.1.tgz", + "integrity": "sha512-pFIfj7U2w5sMp52wTY1XVOdoxw+GDwy9FsK3OFz4BpMAjvZVs0dT1VXs8aQm22nhwoIWUmIRaE+4xow8xfIDZA==", "dev": true, "optional": true }, "@esbuild/freebsd-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.18.14.tgz", - "integrity": "sha512-h3OqR80Da4oQCIa37zl8tU5MwHQ7qgPV0oVScPfKJK21fSRZEhLE4IIVpmcOxfAVmqjU6NDxcxhYaM8aDIGRLw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-arm64/-/freebsd-arm64-0.20.1.tgz", + "integrity": "sha512-UyW1WZvHDuM4xDz0jWun4qtQFauNdXjXOtIy7SYdf7pbxSWWVlqhnR/T2TpX6LX5NI62spt0a3ldIIEkPM6RHw==", "dev": true, "optional": true }, "@esbuild/freebsd-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.18.14.tgz", - "integrity": "sha512-ha4BX+S6CZG4BoH9tOZTrFIYC1DH13UTCRHzFc3GWX74nz3h/N6MPF3tuR3XlsNjMFUazGgm35MPW5tHkn2lzQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/freebsd-x64/-/freebsd-x64-0.20.1.tgz", + "integrity": "sha512-itPwCw5C+Jh/c624vcDd9kRCCZVpzpQn8dtwoYIt2TJF3S9xJLiRohnnNrKwREvcZYx0n8sCSbvGH349XkcQeg==", "dev": true, "optional": true }, "@esbuild/linux-arm": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.18.14.tgz", - "integrity": "sha512-5+7vehI1iqru5WRtJyU2XvTOvTGURw3OZxe3YTdE9muNNIdmKAVmSHpB3Vw2LazJk2ifEdIMt/wTWnVe5V98Kg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm/-/linux-arm-0.20.1.tgz", + "integrity": "sha512-LojC28v3+IhIbfQ+Vu4Ut5n3wKcgTu6POKIHN9Wpt0HnfgUGlBuyDDQR4jWZUZFyYLiz4RBBBmfU6sNfn6RhLw==", "dev": true, "optional": true }, "@esbuild/linux-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.18.14.tgz", - "integrity": "sha512-IXORRe22In7U65NZCzjwAUc03nn8SDIzWCnfzJ6t/8AvGx5zBkcLfknI+0P+hhuftufJBmIXxdSTbzWc8X/V4w==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-arm64/-/linux-arm64-0.20.1.tgz", + "integrity": "sha512-cX8WdlF6Cnvw/DO9/X7XLH2J6CkBnz7Twjpk56cshk9sjYVcuh4sXQBy5bmTwzBjNVZze2yaV1vtcJS04LbN8w==", "dev": true, "optional": true }, "@esbuild/linux-ia32": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.18.14.tgz", - "integrity": "sha512-BfHlMa0nibwpjG+VXbOoqJDmFde4UK2gnW351SQ2Zd4t1N3zNdmUEqRkw/srC1Sa1DRBE88Dbwg4JgWCbNz/FQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ia32/-/linux-ia32-0.20.1.tgz", + "integrity": "sha512-4H/sQCy1mnnGkUt/xszaLlYJVTz3W9ep52xEefGtd6yXDQbz/5fZE5dFLUgsPdbUOQANcVUa5iO6g3nyy5BJiw==", "dev": true, "optional": true }, "@esbuild/linux-loong64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.18.14.tgz", - "integrity": "sha512-j2/Ex++DRUWIAaUDprXd3JevzGtZ4/d7VKz+AYDoHZ3HjJzCyYBub9CU1wwIXN+viOP0b4VR3RhGClsvyt/xSw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-loong64/-/linux-loong64-0.20.1.tgz", + "integrity": "sha512-c0jgtB+sRHCciVXlyjDcWb2FUuzlGVRwGXgI+3WqKOIuoo8AmZAddzeOHeYLtD+dmtHw3B4Xo9wAUdjlfW5yYA==", "dev": true, "optional": true }, "@esbuild/linux-mips64el": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.18.14.tgz", - "integrity": "sha512-qn2+nc+ZCrJmiicoAnJXJJkZWt8Nwswgu1crY7N+PBR8ChBHh89XRxj38UU6Dkthl2yCVO9jWuafZ24muzDC/A==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-mips64el/-/linux-mips64el-0.20.1.tgz", + "integrity": "sha512-TgFyCfIxSujyuqdZKDZ3yTwWiGv+KnlOeXXitCQ+trDODJ+ZtGOzLkSWngynP0HZnTsDyBbPy7GWVXWaEl6lhA==", "dev": true, "optional": true }, "@esbuild/linux-ppc64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.18.14.tgz", - "integrity": "sha512-aGzXzd+djqeEC5IRkDKt3kWzvXoXC6K6GyYKxd+wsFJ2VQYnOWE954qV2tvy5/aaNrmgPTb52cSCHFE+Z7Z0yg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-ppc64/-/linux-ppc64-0.20.1.tgz", + "integrity": "sha512-b+yuD1IUeL+Y93PmFZDZFIElwbmFfIKLKlYI8M6tRyzE6u7oEP7onGk0vZRh8wfVGC2dZoy0EqX1V8qok4qHaw==", "dev": true, "optional": true }, "@esbuild/linux-riscv64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.18.14.tgz", - "integrity": "sha512-8C6vWbfr0ygbAiMFLS6OPz0BHvApkT2gCboOGV76YrYw+sD/MQJzyITNsjZWDXJwPu9tjrFQOVG7zijRzBCnLw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-riscv64/-/linux-riscv64-0.20.1.tgz", + "integrity": "sha512-wpDlpE0oRKZwX+GfomcALcouqjjV8MIX8DyTrxfyCfXxoKQSDm45CZr9fanJ4F6ckD4yDEPT98SrjvLwIqUCgg==", "dev": true, "optional": true }, "@esbuild/linux-s390x": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.18.14.tgz", - "integrity": "sha512-G/Lf9iu8sRMM60OVGOh94ZW2nIStksEcITkXdkD09/T6QFD/o+g0+9WVyR/jajIb3A0LvBJ670tBnGe1GgXMgw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-s390x/-/linux-s390x-0.20.1.tgz", + "integrity": "sha512-5BepC2Au80EohQ2dBpyTquqGCES7++p7G+7lXe1bAIvMdXm4YYcEfZtQrP4gaoZ96Wv1Ute61CEHFU7h4FMueQ==", "dev": true, "optional": true }, "@esbuild/linux-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.18.14.tgz", - "integrity": "sha512-TBgStYBQaa3EGhgqIDM+ECnkreb0wkcKqL7H6m+XPcGUoU4dO7dqewfbm0mWEQYH3kzFHrzjOFNpSAVzDZRSJw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/linux-x64/-/linux-x64-0.20.1.tgz", + "integrity": "sha512-5gRPk7pKuaIB+tmH+yKd2aQTRpqlf1E4f/mC+tawIm/CGJemZcHZpp2ic8oD83nKgUPMEd0fNanrnFljiruuyA==", "dev": true, "optional": true }, "@esbuild/netbsd-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.18.14.tgz", - "integrity": "sha512-stvCcjyCQR2lMTroqNhAbvROqRjxPEq0oQ380YdXxA81TaRJEucH/PzJ/qsEtsHgXlWFW6Ryr/X15vxQiyRXVg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/netbsd-x64/-/netbsd-x64-0.20.1.tgz", + "integrity": "sha512-4fL68JdrLV2nVW2AaWZBv3XEm3Ae3NZn/7qy2KGAt3dexAgSVT+Hc97JKSZnqezgMlv9x6KV0ZkZY7UO5cNLCg==", "dev": true, "optional": true }, "@esbuild/openbsd-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.18.14.tgz", - "integrity": "sha512-apAOJF14CIsN5ht1PA57PboEMsNV70j3FUdxLmA2liZ20gEQnfTG5QU0FhENo5nwbTqCB2O3WDsXAihfODjHYw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/openbsd-x64/-/openbsd-x64-0.20.1.tgz", + "integrity": "sha512-GhRuXlvRE+twf2ES+8REbeCb/zeikNqwD3+6S5y5/x+DYbAQUNl0HNBs4RQJqrechS4v4MruEr8ZtAin/hK5iw==", "dev": true, "optional": true }, "@esbuild/sunos-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.18.14.tgz", - "integrity": "sha512-fYRaaS8mDgZcGybPn2MQbn1ZNZx+UXFSUoS5Hd2oEnlsyUcr/l3c6RnXf1bLDRKKdLRSabTmyCy7VLQ7VhGdOQ==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/sunos-x64/-/sunos-x64-0.20.1.tgz", + "integrity": "sha512-ZnWEyCM0G1Ex6JtsygvC3KUUrlDXqOihw8RicRuQAzw+c4f1D66YlPNNV3rkjVW90zXVsHwZYWbJh3v+oQFM9Q==", "dev": true, "optional": true }, "@esbuild/win32-arm64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.18.14.tgz", - "integrity": "sha512-1c44RcxKEJPrVj62XdmYhxXaU/V7auELCmnD+Ri+UCt+AGxTvzxl9uauQhrFso8gj6ZV1DaORV0sT9XSHOAk8Q==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-arm64/-/win32-arm64-0.20.1.tgz", + "integrity": "sha512-QZ6gXue0vVQY2Oon9WyLFCdSuYbXSoxaZrPuJ4c20j6ICedfsDilNPYfHLlMH7vGfU5DQR0czHLmJvH4Nzis/A==", "dev": true, "optional": true }, "@esbuild/win32-ia32": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.18.14.tgz", - "integrity": "sha512-EXAFttrdAxZkFQmpvcAQ2bywlWUsONp/9c2lcfvPUhu8vXBBenCXpoq9YkUvVP639ld3YGiYx0YUQ6/VQz3Maw==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-ia32/-/win32-ia32-0.20.1.tgz", + "integrity": "sha512-HzcJa1NcSWTAU0MJIxOho8JftNp9YALui3o+Ny7hCh0v5f90nprly1U3Sj1Ldj/CvKKdvvFsCRvDkpsEMp4DNw==", "dev": true, "optional": true }, "@esbuild/win32-x64": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.18.14.tgz", - "integrity": "sha512-K0QjGbcskx+gY+qp3v4/940qg8JitpXbdxFhRDA1aYoNaPff88+aEwoq45aqJ+ogpxQxmU0ZTjgnrQD/w8iiUg==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/@esbuild/win32-x64/-/win32-x64-0.20.1.tgz", + "integrity": "sha512-0MBh53o6XtI6ctDnRMeQ+xoCN8kD2qI1rY1KgF/xdWQwoFeKou7puvDfV8/Wv4Ctx2rRpET/gGdz3YlNtNACSA==", "dev": true, "optional": true }, @@ -4071,9 +4088,9 @@ "dev": true }, "caniuse-lite": { - "version": "1.0.30001486", - "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001486.tgz", - "integrity": "sha512-uv7/gXuHi10Whlj0pp5q/tsK/32J2QSqVRKQhs2j8VsDCjgyruAh/eEXHF822VqO9yT6iZKw3nRwZRSPBE9OQg==" + "version": "1.0.30001589", + "resolved": "https://registry.npmjs.org/caniuse-lite/-/caniuse-lite-1.0.30001589.tgz", + "integrity": "sha512-vNQWS6kI+q6sBlHbh71IIeC+sRwK2N3EDySc/updIGhIee2x5z00J4c1242/5/d6EpEMdOnk/m+6tuk4/tcsqg==" }, "catharsis": { "version": "0.9.0", @@ -4474,33 +4491,34 @@ "dev": true }, "esbuild": { - "version": "0.18.14", - "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.18.14.tgz", - "integrity": "sha512-uNPj5oHPYmj+ZhSQeYQVFZ+hAlJZbAGOmmILWIqrGvPVlNLbyOvU5Bu6Woi8G8nskcx0vwY0iFoMPrzT86Ko+w==", + "version": "0.20.1", + "resolved": "https://registry.npmjs.org/esbuild/-/esbuild-0.20.1.tgz", + "integrity": "sha512-OJwEgrpWm/PCMsLVWXKqvcjme3bHNpOgN7Tb6cQnR5n0TPbQx1/Xrn7rqM+wn17bYeT6MGB5sn1Bh5YiGi70nA==", "dev": true, "requires": { - "@esbuild/android-arm": "0.18.14", - "@esbuild/android-arm64": "0.18.14", - "@esbuild/android-x64": "0.18.14", - "@esbuild/darwin-arm64": "0.18.14", - "@esbuild/darwin-x64": "0.18.14", - "@esbuild/freebsd-arm64": "0.18.14", - "@esbuild/freebsd-x64": "0.18.14", - "@esbuild/linux-arm": "0.18.14", - "@esbuild/linux-arm64": "0.18.14", - "@esbuild/linux-ia32": "0.18.14", - "@esbuild/linux-loong64": "0.18.14", - "@esbuild/linux-mips64el": "0.18.14", - "@esbuild/linux-ppc64": "0.18.14", - "@esbuild/linux-riscv64": "0.18.14", - "@esbuild/linux-s390x": "0.18.14", - "@esbuild/linux-x64": "0.18.14", - "@esbuild/netbsd-x64": "0.18.14", - "@esbuild/openbsd-x64": "0.18.14", - "@esbuild/sunos-x64": "0.18.14", - "@esbuild/win32-arm64": "0.18.14", - "@esbuild/win32-ia32": "0.18.14", - "@esbuild/win32-x64": "0.18.14" + "@esbuild/aix-ppc64": "0.20.1", + "@esbuild/android-arm": "0.20.1", + "@esbuild/android-arm64": "0.20.1", + "@esbuild/android-x64": "0.20.1", + "@esbuild/darwin-arm64": "0.20.1", + "@esbuild/darwin-x64": "0.20.1", + "@esbuild/freebsd-arm64": "0.20.1", + "@esbuild/freebsd-x64": "0.20.1", + "@esbuild/linux-arm": "0.20.1", + "@esbuild/linux-arm64": "0.20.1", + "@esbuild/linux-ia32": "0.20.1", + "@esbuild/linux-loong64": "0.20.1", + "@esbuild/linux-mips64el": "0.20.1", + "@esbuild/linux-ppc64": "0.20.1", + "@esbuild/linux-riscv64": "0.20.1", + "@esbuild/linux-s390x": "0.20.1", + "@esbuild/linux-x64": "0.20.1", + "@esbuild/netbsd-x64": "0.20.1", + "@esbuild/openbsd-x64": "0.20.1", + "@esbuild/sunos-x64": "0.20.1", + "@esbuild/win32-arm64": "0.20.1", + "@esbuild/win32-ia32": "0.20.1", + "@esbuild/win32-x64": "0.20.1" } }, "escalade": { @@ -4939,14 +4957,13 @@ } }, "jsdoc-parse": { - "version": "6.2.0", - "resolved": "https://registry.npmjs.org/jsdoc-parse/-/jsdoc-parse-6.2.0.tgz", - "integrity": "sha512-Afu1fQBEb7QHt6QWX/6eUWvYHJofB90Fjx7FuJYF7mnG9z5BkAIpms1wsnvYLytfmqpEENHs/fax9p8gvMj7dw==", + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/jsdoc-parse/-/jsdoc-parse-6.2.1.tgz", + "integrity": "sha512-9viGRUUtWOk/G4V0+nQ6rfLucz5plxh5I74WbNSNm9h9NWugCDVX4jbG8hZP9QqKGpdTPDE+qJXzaYNos3wqTA==", "dev": true, "requires": { "array-back": "^6.2.2", "lodash.omit": "^4.5.0", - "lodash.pick": "^4.4.0", "reduce-extract": "^1.0.0", "sort-array": "^4.1.5", "test-value": "^3.0.0" @@ -5050,12 +5067,6 @@ "integrity": "sha512-sOQs2aqGpbl27tmCS1QNZA09Uqp01ZzWfDUoD+xzTii0E7dSQfRKcRetFwa+uXaxaqL+TKm7CgD2JdKP7aZBSw==", "dev": true }, - "lodash.pick": { - "version": "4.4.0", - "resolved": "https://registry.npmjs.org/lodash.pick/-/lodash.pick-4.4.0.tgz", - "integrity": "sha512-hXt6Ul/5yWjfklSGvLQl8vM//l3FtyHZeuelpzK6mm99pNvN9yTDruNZPEJZD1oWrqo+izBmB7oUfWgcCX7s4Q==", - "dev": true - }, "lru-cache": { "version": "6.0.0", "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", @@ -5188,9 +5199,9 @@ "dev": true }, "nanoid": { - "version": "3.3.6", - "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.6.tgz", - "integrity": "sha512-BGcqMMJuToF7i1rt+2PWSNVnWIkGCU78jBG3RxO/bZlnZPK2Cmi2QaffxGO/2RvWi9sL+FAiRiXMgsyxQ1DIDA==" + "version": "3.3.7", + "resolved": "https://registry.npmjs.org/nanoid/-/nanoid-3.3.7.tgz", + "integrity": "sha512-eSRppjcPIatRIMC1U6UngP8XFcz8MQWGQdt1MTBQ7NaAmvXDfvNxbvWV3x2y6CdEUciCSsDHDQZbhYaB8QEo2g==" }, "neo-async": { "version": "2.6.2", @@ -5346,11 +5357,11 @@ } }, "postcss": { - "version": "8.4.26", - "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.26.tgz", - "integrity": "sha512-jrXHFF8iTloAenySjM/ob3gSj7pCu0Ji49hnjqzsgSRa50hkWCKD0HQ+gMNJkW38jBI68MpAAg7ZWwHwX8NMMw==", + "version": "8.4.35", + "resolved": "https://registry.npmjs.org/postcss/-/postcss-8.4.35.tgz", + "integrity": "sha512-u5U8qYpBCpN13BsiEB0CbR1Hhh4Gc0zLFuedrHJKMctHCHAGrMdG0PRM/KErzAL3CU6/eckEtmHNB3x6e3c0vA==", "requires": { - "nanoid": "^3.3.6", + "nanoid": "^3.3.7", "picocolors": "^1.0.0", "source-map-js": "^1.0.2" } diff --git a/package.json b/package.json index 3d8df75..2e01379 100644 --- a/package.json +++ b/package.json @@ -45,7 +45,7 @@ "devDependencies": { "@happy-dom/global-registrator": "^10.5.1", "ava": "^5.3.1", - "esbuild": "^0.18.14", + "esbuild": "*", "jsdoc": "^4.0.2", "jsdoc-plugin-intersection": "^1.0.4", "jsdoc-to-markdown": "^8.0.0", diff --git a/readme.md b/readme.md index 6040112..0ea36a5 100644 --- a/readme.md +++ b/readme.md @@ -83,35 +83,38 @@ data-grid { These are the options accessibles through the components data attributes. Some options only work if the proper plugin is loaded. You can also pass them as a json string in data-config. -| Name | Type | Description | -| ----------------- | -------------------------------------------- | ------------------------------------------------------------------------------ | -| id | String | Custom id for the grid | -| url | String | An URL with data to display in JSON format | -| debug | Boolean | Log actions in DevTools console | -| filter | Boolean | Allows a filtering functionality | -| sort | Boolean | Allows a sort by column functionality | -| defaultSort | String | Default sort field if sorting is enabled | -| server | Boolean | Is a server side powered grid | -| serverParams | [ServerParams](#ServerParams) | Describe keys passed to the server backend | -| dir | String | Dir | -| perPageValues | Array | Available per page options | -| hidePerPage | Boolean | Hides the page size select element | -| columns | [Array.<Column>](#Column) | Available columns | -| defaultPage | Number | Starting page | -| perPage | Number | Number of records displayed per page (page size) | -| expand | Boolean | Allow cell content to spawn over multiple lines | -| actions | [Array.<Action>](#Action) | Row actions (RowActions module) | -| collapseActions | Boolean | Group actions (RowActions module) | -| resizable | Boolean | Make columns resizable (ColumnResizer module) | -| selectable | Boolean | Allow selecting rows with a checkbox (SelectableRows module) | -| selectVisibleOnly | Boolean | Select all only selects visible rows (SelectableRows module) | -| autosize | Boolean | Compute column sizes based on given data (Autosize module) | -| autoheight | Boolean | Adjust height so that it matches table size (FixedHeight module) | -| autohidePager | Boolean | auto-hides the pager when number of records falls below the selected page size | -| menu | Boolean | Right click menu on column headers (ContextMenu module) | -| reorder | Boolean | Allows a column reordering functionality (DraggableHeaders module) | -| responsive | Boolean | Change display mode on small screens (ResponsiveGrid module) | -| responsiveToggle | Boolean | Show toggle column (ResponsiveGrid module) | +| Name | Type | Description | +| ----------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------------------------------- | +| id | String | Custom id for the grid | +| url | String | An URL with data to display in JSON format | +| debug | Boolean | Log actions in DevTools console | +| filter | Boolean | Allows a filtering functionality | +| sort | Boolean | Allows a sort by column functionality | +| defaultSort | String | Default sort field if sorting is enabled | +| server | Boolean | Is a server side powered grid | +| serverParams | [ServerParams](#ServerParams) | Describe keys passed to the server backend | +| dir | String | Dir | +| perPageValues | Array | Available per page options | +| hidePerPage | Boolean | Hides the page size select element | +| columns | [Array.<Column>](#Column) | Available columns | +| defaultPage | Number | Starting page | +| perPage | Number | Number of records displayed per page (page size) | +| expand | Boolean | Allow cell content to spawn over multiple lines | +| actions | [Array.<Action>](#Action) | Row actions (RowActions module) | +| collapseActions | Boolean | Group actions (RowActions module) | +| resizable | Boolean | Make columns resizable (ColumnResizer module) | +| selectable | Boolean | Allow selecting rows with a checkbox (SelectableRows module) | +| selectVisibleOnly | Boolean | Select all only selects visible rows (SelectableRows module) | +| autosize | Boolean | Compute column sizes based on given data (Autosize module) | +| autoheight | Boolean | Adjust height so that it matches table size (FixedHeight module) | +| autohidePager | Boolean | auto-hides the pager when number of records falls below the selected page size | +| menu | Boolean | Right click menu on column headers (ContextMenu module) | +| reorder | Boolean | Allows a column reordering functionality (DraggableHeaders module) | +| responsive | Boolean | Change display mode on small screens (ResponsiveGrid module) | +| responsiveToggle | Boolean | Show toggle column (ResponsiveGrid module) | +| filterOnEnter | Boolean | Toggles the ability to filter column data by pressing the Enter or Return key. | +| showSpinner | Boolean | Shows or hides a spinning icon on grid loading | +| spinnerCssClasses | String | Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner) | @@ -120,22 +123,23 @@ You can also pass them as a json string in data-config. When using the response data or the JS api, you have the opportunity to pass column definitions. This scenario is not supported using regular attributes to avoid cluttering the node with a very large attribute. -| Name | Type | Description | -| ---------------- | -------------------------------------------- | ------------------------------------------------------------------------------------------- | -| field | String | the key in the data | -| title | String | the title to display in the header (defaults to "field" if not set) | -| width | Number | the width of the column (auto otherwise) | -| class | String | class to set on the column (target body or header with th.class or td.class) | -| attr | String | don't render the column and set a matching attribute on the row with the value of the field | -| hidden | Boolean | hide the column | -| noSort | Boolean | allow disabling sort for a given column | -| format | String \| function | custom data formatting - either by a | -| transform | String | custom value transformation | -| editable | Boolean | replace with input (EditableColumn module) | -| responsive | Number | the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module) | -| responsiveHidden | Boolean | hidden through responsive module (ResponsiveGrid module) | - -- Format: either by a string of HTML template or by a function with an object parameter consisting of column, rowData, cellData, td, tr. +| Name | Type | Description | +| ----------------- | -------------------------------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| field | String | the key in the data | +| title | String | the title to display in the header (defaults to "field" if not set) | +| width | Number | the width of the column (auto otherwise) | +| class | String | class to set on the column (target body or header with th.class or td.class) | +| attr | String | don't render the column and set a matching attribute on the row with the value of the field | +| hidden | Boolean | hide the column | +| noSort | Boolean | allow disabling sort for a given column | +| format | String \| function | custom data formatting, either by a string of HTML template or by a function with an object parameter consisting of column, rowData, cellData, td, tr. | +| transform | String | custom value transformation | +| editable | Boolean | replace with input (EditableColumn module) | +| responsive | Number | the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module) | +| responsiveHidden | Boolean | hidden through responsive module (ResponsiveGrid module) | +| filterType | String | defines a filter field type ("text" or "select" - defaults to "text") | +| filterList | Array | defines a custom array to populate a filter select field in the format of ```[{value: "", text: ""},...]```.
When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records. | +| firstFilterOption | Object | defines an object for the first option element of the filter select field. defaults to ```{value: "", text: ""}``` | @@ -158,18 +162,19 @@ regular attributes to avoid cluttering the node with a very large attribute. Some features have been extracted as plugins to make base class lighter. You can find them in the `plugins` directory. -| Name | Type | Description | -| ------------------ | -------------------------------------------------- | ---------------------------------------------- | -| [ColumnResizer] | [ColumnResizer](#ColumnResizer) | resize handlers in the headers | -| [ContextMenu] | [ContextMenu](#ContextMenu) | menu to show/hide columns | -| [DraggableHeaders] | [DraggableHeaders](#DraggableHeaders) | draggable headers columns | -| [EditableColumn] | [EditableColumn](#EditableColumn) | draggable headers columns | -| [TouchSupport] | [TouchSupport](#TouchSupport) | touch swipe | -| [SelectableRows] | [SelectableRows](#SelectableRows) | create a column with checkboxes to select rows | -| [FixedHeight] | [FixedHeight](#FixedHeight) | allows having fixed height tables | -| [AutosizeColumn] | [AutosizeColumn](#AutosizeColumn) | compute ideal width based on column content | -| [ResponsiveGrid] | [ResponsiveGrid](#ResponsiveGrid) | hide/show column on the fly | -| [RowActions] | [RowActions](#RowActions) | add action on rows | +| Name | Type | Description | +| ------------------ | -------------------------------------------------- | --------------------------------------------------------- | +| [ColumnResizer] | [ColumnResizer](#ColumnResizer) | resize handlers in the headers | +| [ContextMenu] | [ContextMenu](#ContextMenu) | menu to show/hide columns | +| [DraggableHeaders] | [DraggableHeaders](#DraggableHeaders) | draggable headers columns | +| [EditableColumn] | [EditableColumn](#EditableColumn) | draggable headers columns | +| [TouchSupport] | [TouchSupport](#TouchSupport) | touch swipe | +| [SelectableRows] | [SelectableRows](#SelectableRows) | create a column with checkboxes to select rows | +| [FixedHeight] | [FixedHeight](#FixedHeight) | allows having fixed height tables | +| [AutosizeColumn] | [AutosizeColumn](#AutosizeColumn) | compute ideal width based on column content | +| [ResponsiveGrid] | [ResponsiveGrid](#ResponsiveGrid) | hide/show column on the fly | +| [RowActions] | [RowActions](#RowActions) | add action on rows | +| [SpinnerSupport] | [SpinnerSupport](#SpinnerSupport) | inserts a spinning icon element to indicate grid loading. | diff --git a/scss/_core.scss b/scss/_core.scss index 913d0dc..14ee715 100644 --- a/scss/_core.scss +++ b/scss/_core.scss @@ -85,6 +85,19 @@ data-grid { } } + // Before grid init, or on loading + &[class=""], + &:not([class]), + &.dg-loading { + > table { + &[role=grid] { + tr.dg-head-columns { + display: none; //ensures the empty column header bar is hidden + } + } + } + } + img { border: none; height: auto; @@ -328,14 +341,16 @@ data-grid { // Filters (2nd header row) thead tr:nth-child(2) th { - padding: 0; + padding: 0 2px 0 0; background-color: transparent; - input { + > * { width: 100%; border-radius: 0; margin: 0; + } + input { &:focus { box-shadow: inset 0px 0px 0px 1px var(--color); } diff --git a/scss/_responsive.scss b/scss/_responsive.scss index 64387be..b315a2d 100644 --- a/scss/_responsive.scss +++ b/scss/_responsive.scss @@ -82,7 +82,6 @@ data-grid { left: 0; padding: var(--padding); width: calc(100% - var(--responsive-width) - var(--padding) * 4); - white-space: nowrap; content: attr(data-name); display: block; font-weight: bold; @@ -148,5 +147,15 @@ data-grid { .dg-head-filters th.dg-selectable label::before { content: "Column Filters"; } + + tfoot .dg-page-nav { + min-width: revert; + } + } + + data-grid[data-responsive=true] { + tfoot .dg-page-nav { + min-width: revert; + } } } diff --git a/src/data-grid.js b/src/data-grid.js index fd0213e..149f3f1 100644 --- a/src/data-grid.js +++ b/src/data-grid.js @@ -46,6 +46,9 @@ import { * @property {String} [editableType] - type of input (EditableColumn module) * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module) * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module) + * @property {String} [filterType] - defines a filter field type ("text" or "select" - defaults to "text") + * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: "", text: ""},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records. + * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: "", text: ""} */ /** @@ -70,6 +73,7 @@ import { /** @typedef {import('./plugins/row-actions').default} RowActions */ /** @typedef {import('./plugins/selectable-rows').default} SelectableRows */ /** @typedef {import('./plugins/touch-support').default} TouchSupport */ +/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */ /** * These plugins are all optional @@ -84,6 +88,7 @@ import { * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly * @property {RowActions} [RowActions] add action on rows + * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading. */ /** @@ -132,6 +137,9 @@ import { * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module) * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module) * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module) + * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key + * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading + * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner) */ /** @@ -198,6 +206,8 @@ function applyColumnDefinition(el, column) { /** */ class DataGrid extends BaseElement { + #filterSelector = "[id^=dg-filter]"; + _ready() { setAttribute(this, "id", this.options.id ?? randstr("el-"), true); @@ -240,6 +250,10 @@ class DataGrid extends BaseElement { setAttribute(this, attr, this.options[camelize(attr.slice(5))]); } } + + // Inserts spinner + if (this.options.showSpinner && this.plugins.SpinnerSupport) + this.plugins.SpinnerSupport.add(); } static template() { @@ -322,6 +336,8 @@ class DataGrid extends BaseElement { responsiveHidden: false, format: "", transform: "", + filterType: "text", + firstFilterOption: { value: "", text: "" } }; } @@ -369,6 +385,9 @@ class DataGrid extends BaseElement { autohidePager: false, responsive: false, responsiveToggle: true, + filterOnEnter: true, + showSpinner: false, + spinnerCssClasses: "" }; } @@ -1058,7 +1077,7 @@ class DataGrid extends BaseElement { getFilters() { let filters = []; - const inputs = findAll(this, "thead tr.dg-head-filters input"); + const inputs = findAll(this, this.#filterSelector); inputs.forEach((input) => { filters[input.dataset.name] = input.value; }); @@ -1066,7 +1085,7 @@ class DataGrid extends BaseElement { } clearFilters() { - const inputs = findAll(this, "thead tr.dg-head-filters input"); + const inputs = findAll(this, this.#filterSelector); inputs.forEach((input) => { input.value = ""; }); @@ -1084,7 +1103,7 @@ class DataGrid extends BaseElement { this.data = this.originalData?.slice() ?? []; // Look for rows matching the filters - const inputs = findAll(this, "thead tr.dg-head-filters input"); + const inputs = findAll(this, this.#filterSelector); inputs.forEach((input) => { let value = input.value; if (value) { @@ -1470,27 +1489,18 @@ class DataGrid extends BaseElement { let th = ce("th"); th.setAttribute("aria-colindex", "" + colIdx); - let input = ce("input"); - input.type = "text"; - input.inputMode = "search"; - input.autocomplete = "off"; - input.spellcheck = false; - // Allows binding filter to this column - input.dataset.name = column.field; - input.id = randstr("dg-filter-"); - // Don't use aria-label as it triggers autocomplete - input.setAttribute("aria-labelledby", relatedTh.getAttribute("id")); + let filter = this.createFilterElement(column, relatedTh); if (!this.options.filter) { th.tabIndex = 0; } else { - input.tabIndex = 0; + filter.tabIndex = 0; } if (column.hidden) { th.setAttribute("hidden", ""); } - th.appendChild(input); + th.appendChild(filter); tr.appendChild(th); idx++; }); @@ -1502,17 +1512,46 @@ class DataGrid extends BaseElement { thead.replaceChild(tr, thead.querySelector("tr.dg-head-filters")); - // Filter content on enter - tr.querySelectorAll("input").forEach((input) => { - input.addEventListener("keypress", (e) => { + // Filter content by field events + tr.querySelectorAll(this.#filterSelector).forEach((el) => { + const eventName = /select/i.test(el.tagName) ? "change" : "keyup"; + el.addEventListener(eventName, (e) => { const key = e.keyCode || e.key; - if (key === 13 || key === "Enter") { + if (key === 13 || key === "Enter" || !this.options.filterOnEnter || e.type == "change") { this.filterData.call(this); } }); }); } + createFilterElement(column, relatedTh) { + const isSelect = column.filterType == "select", + filter = isSelect ? ce("select") : ce("input"); + if (isSelect) { + if (!Array.isArray(column.filterList)) { // Gets unique values from column records + const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort(); + column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e }))); + } + column.filterList.forEach((e) => { + const opt = ce("option"); + opt.value = e.value; + opt.text = e.text; + filter.add(opt); + }); + } else { + filter.type = "text"; + filter.inputMode = "search"; + filter.autocomplete = "off"; + filter.spellcheck = false; + } + // Allows binding filter to this column + filter.dataset.name = column.field; + filter.id = randstr("dg-filter-"); + // Don't use aria-label as it triggers autocomplete + filter.setAttribute("aria-labelledby", relatedTh.getAttribute("id")); + return filter; + } + /** * Render the data as rows in tbody * It will call paginate() at the end @@ -1652,6 +1691,8 @@ class DataGrid extends BaseElement { this.plugins.SelectableRows.shouldSelectAll(tbody); } + this.data.length && this.classList.remove("dg-empty"); + dispatch(this, "bodyRendered"); } diff --git a/src/plugins/spinner-support.js b/src/plugins/spinner-support.js new file mode 100644 index 0000000..b0faa79 --- /dev/null +++ b/src/plugins/spinner-support.js @@ -0,0 +1,35 @@ +import BasePlugin from "../core/base-plugin.js"; + +/** + * Adds an element for showing a spinning icon on grid loading. + */ +class SpinnerSupport extends BasePlugin { + /** + * Adds a spinner element with its associated css styles. + */ + add() { + const grid = this.grid, + show = grid.options.showSpinner; + if (!show) return; + const cssClasses = grid.options.spinnerCssClasses, + cls = cssClasses.split(" ").map(e => `.${e}`).join(""), + template = ` + +`; + if (!document.getElementById("dg-styles")) { + const styleParent = document.querySelector("head") ?? document.querySelector("body"), + position = /head/i.test(styleParent.tagName) ? "beforeend" : "afterbegin"; + styleParent.insertAdjacentHTML(position, template); + } + grid.insertAdjacentHTML("afterbegin", ``); + } +} + +export default SpinnerSupport; From 7231cbb6f748b1c7a5946788348cd9dbec1b9846 Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Mon, 26 Feb 2024 19:41:24 -0500 Subject: [PATCH 2/3] Minor tweaks in SpinnerSupport class. --- dist/data-grid.js | 6 +++--- dist/data-grid.js.map | 4 ++-- dist/data-grid.min.js | 8 ++++---- dist/data-grid.min.js.map | 6 +++--- src/plugins/spinner-support.js | 7 ++++--- 5 files changed, 16 insertions(+), 15 deletions(-) diff --git a/dist/data-grid.js b/dist/data-grid.js index c6f100f..92222f4 100644 --- a/dist/data-grid.js +++ b/dist/data-grid.js @@ -2692,11 +2692,11 @@ var SpinnerSupport = class extends base_plugin_default { } `; - if (!document.getElementById("dg-styles")) { - const styleParent = document.querySelector("head") ?? document.querySelector("body"), position = /head/i.test(styleParent.tagName) ? "beforeend" : "afterbegin"; + if (!$("#dg-styles")) { + const styleParent = $("head") ?? $("body"), position = /head/i.test(styleParent.tagName) ? "beforeend" : "afterbegin"; styleParent.insertAdjacentHTML(position, template); } - grid.insertAdjacentHTML("afterbegin", ``); + !$(`i${cls}`, grid) && grid.insertAdjacentHTML("afterbegin", ``); } }; var spinner_support_default = SpinnerSupport; diff --git a/dist/data-grid.js.map b/dist/data-grid.js.map index 2ca7bac..5007e5b 100644 --- a/dist/data-grid.js.map +++ b/dist/data-grid.js.map @@ -1,7 +1,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/interpolate.js", "../src/utils/getTextWidth.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", "../src/plugins/row-actions.js", "../src/plugins/editable-column.js", "../src/plugins/spinner-support.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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading\r\n * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.showSpinner && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true,\r\n showSpinner: false,\r\n spinnerCssClasses: \"\"\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n show = grid.options.showSpinner;\r\n if (!show) return;\r\n const cssClasses = grid.options.spinnerCssClasses,\r\n cls = cssClasses.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!document.getElementById(\"dg-styles\")) {\r\n const styleParent = document.querySelector(\"head\") ?? document.querySelector(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], - "mappings": ";;;AAIe,SAAR,SAA0B,KAAK;AACpC,SAAO,IAAI,YAAY,EAAE,QAAQ,qBAAqB,CAAC,GAAG,QAAQ,IAAI,YAAY,CAAC;AACrF;;;ACDe,SAAR,cAA+B,GAAG;AAEvC,MAAI,MAAM,QAAQ;AAChB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,SAAS;AACjB,WAAO;AAAA,EACT;AAEA,MAAI,MAA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AAG,EAAE,IAAI,OAAK,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,GACrD,WAAW;AAAA;AAAA,cAEH,GAAG;AAAA,+BACc,GAAG;AAAA,8CACY,GAAG;AAAA;AAAA,4BAErB,GAAG;AAAA;AAAA;AAAA;AAI3B,QAAI,CAAC,SAAS,eAAe,WAAW,GAAG;AACzC,YAAM,cAAc,SAAS,cAAc,MAAM,KAAK,SAAS,cAAc,MAAM,GACjF,WAAW,QAAQ,KAAK,YAAY,OAAO,IAAI,cAAc;AAC/D,kBAAY,mBAAmB,UAAU,QAAQ;AAAA,IACnD;AACA,SAAK,mBAAmB,cAAc,aAAa,UAAU,QAAQ;AAAA,EACvE;AACF;AAEA,IAAO,0BAAQ;;;ACjBf,kBAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAI,CAAC,eAAe,IAAI,WAAW,GAAG;AACpC,iBAAe,OAAO,aAAa,iBAAQ;AAC7C;AAEA,IAAOC,qBAAQ;", + "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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading\r\n * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.showSpinner && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true,\r\n showSpinner: false,\r\n spinnerCssClasses: \"\"\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { $ } from \"../utils/shortcuts.js\"\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n show = grid.options.showSpinner;\r\n if (!show) return;\r\n const cssClasses = grid.options.spinnerCssClasses,\r\n cls = cssClasses.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!$(\"#dg-styles\")) {\r\n const styleParent = $(\"head\") ?? $(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n !$(`i${cls}`, grid) && grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], + "mappings": ";;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YAAY,KAAK;AAAA,EACtB;AACF;AAEA,IAAO,0BAAQ;;;ACzDf,IAAM,iBAAN,cAA6B,oBAAW;AAAA;AAAA;AAAA;AAAA,EAItC,MAAM;AACJ,UAAM,OAAO,KAAK,MAChB,OAAO,KAAK,QAAQ;AACtB,QAAI,CAAC;AAAM;AACX,UAAM,aAAa,KAAK,QAAQ,mBAC9B,MAAM,WAAW,MAAM,GAAG,EAAE,IAAI,OAAK,IAAI,CAAC,EAAE,EAAE,KAAK,EAAE,GACrD,WAAW;AAAA;AAAA,cAEH,GAAG;AAAA,+BACc,GAAG;AAAA,8CACY,GAAG;AAAA;AAAA,4BAErB,GAAG;AAAA;AAAA;AAAA;AAI3B,QAAI,CAAC,EAAE,YAAY,GAAG;AACpB,YAAM,cAAc,EAAE,MAAM,KAAK,EAAE,MAAM,GACvC,WAAW,QAAQ,KAAK,YAAY,OAAO,IAAI,cAAc;AAC/D,kBAAY,mBAAmB,UAAU,QAAQ;AAAA,IACnD;AACA,KAAC,EAAE,IAAI,GAAG,IAAI,IAAI,KAAK,KAAK,mBAAmB,cAAc,aAAa,UAAU,QAAQ;AAAA,EAC9F;AACF;AAEA,IAAO,0BAAQ;;;AClBf,kBAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAI,CAAC,eAAe,IAAI,WAAW,GAAG;AACpC,iBAAe,OAAO,aAAa,iBAAQ;AAC7C;AAEA,IAAOC,qBAAQ;", "names": ["col", "e", "th", "labels", "data_grid_default"] } diff --git a/dist/data-grid.min.js b/dist/data-grid.min.js index 2b1dc45..0da5e12 100644 --- a/dist/data-grid.min.js +++ b/dist/data-grid.min.js @@ -1,4 +1,4 @@ -function H(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}function M(n){if(n==="true")return!0;if(n==="false")return!1;if(n===""||n==="null")return null;if(n===Number(n).toString())return Number(n);if(n&&["[","{"].includes(n.substring(0,1)))try{return n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(decodeURIComponent(n))}catch{return console.error("Failed to parse "+n),{}}return n}var It=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];function ut(n){return It.includes(n)?{passive:!0}:{}}function k(n,t){return n.getAttribute(t)}function j(n,t){return n.hasAttribute(t)}function d(n,t,e="",i=!1){i&&j(n,t)||n.setAttribute(t,""+e)}function S(n,t){j(n,t)&&n.removeAttribute(t)}function w(n,t,e){n.addEventListener(t,e,ut(t))}function W(n,t,e){n.removeEventListener(t,e,ut(t))}function y(n,t,e={},i=!1){let s={};i&&(s.bubbles=!0),e&&(s.detail=e),n.dispatchEvent(new CustomEvent(t,s))}function $(n,t){return n.classList.contains(t)}function L(n,t){n.classList.add(...t.split(" "))}function F(n,t){n.classList.remove(...t.split(" "))}function gt(n,t){n.classList.toggle(t)}function $t(n,t=document){return n instanceof HTMLElement?n:t.querySelector(n)}function Tt(n,t=document){return Array.from(t.querySelectorAll(n))}function T(n,t){return $t(t,n)}function f(n,t){return Tt(t,n)}function x(n,t=null){let e=document.createElement(n);return t&&t.appendChild(e),e}function pt(n,t){t.parentNode.insertBefore(n,t.nextSibling)}var _=class extends HTMLElement{constructor(t={}){super(),this.options=Object.assign({},this.defaultOptions,this.normalizedDataset,t),this.log("constructor"),this.fireEvents=!0,this._ready(),this.log("ready")}get defaultOptions(){return{}}getOption(t){return this.options[t]}setOption(t,e){d(this,`data-${t}`,e)}toggleOption(t){d(this,`data-${t}`,!this.getOption(t))}get normalizedDataset(){let t=this.dataset.config?JSON.parse(this.dataset.config):{},e={...this.dataset};for(var i in e)i!="config"&&(e[i]=M(e[i]));return Object.assign(e,t),e}static template(){return""}_ready(){}log(t){this.options.debug&&console.log("["+k(this,"id")+"] "+t)}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}_connected(){}connectedCallback(){setTimeout(()=>{this.log("connectedCallback");let t=document.createElement("template");t.innerHTML=this.constructor.template(),this.appendChild(t.content.cloneNode(!0)),this._connected(),y(this,"connected")},0)}_disconnected(){}disconnectedCallback(){this.log("disconnectedCallback"),this._disconnected(),y(this,"disconnected")}get transformAttributes(){return{}}attributeChangedCallback(t,e,i){if(e===i)return;this.log("attributeChangedCallback: "+t);let s=!1,o=this.transformAttributes[t]??M;t.indexOf("data-")===0&&(t=t.slice(5),s=!0),t=H(t),s?this.options[t]=o(i):this[t]=o(i),this.fireEvents&&this[`${t}Changed`]&&this[`${t}Changed`]()}},ft=_;function U(n,t,e,i=!1){let s=document.createElement("option");s.value=""+t,i&&(s.selected=!0),s.label=e,n.appendChild(s)}function X(n,t={}){Object.keys(t).forEach(e=>{Array.isArray(t[e])?Object.keys(t[e]).forEach(i=>n.searchParams.append(isNaN(i)?`${e}[${i}]`:e,t[e][i])):n.searchParams.append(e,t[e])})}function V(n){return typeof n=="string"?n[0]==="["?(n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(n)):n.split(","):Array.isArray(n)?n:(console.error("Invalid array",n),[])}function Y(n){var t=n.getBoundingClientRect(),e=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+i,left:t.left+e}}function q(n,t){return n.replace(/\{([^}]+)?\}/g,function(e,i){return t[i]})}function O(n,t=document.body,e=!1){t||(t=document.createElement("div"));let i=window.getComputedStyle(t),s=i.getPropertyValue("font-weight")||"normal",o=i.getPropertyValue("font-size")||"1rem",r=i.getPropertyValue("font-family")||"Arial",l=0;if(e){let u=i.getPropertyValue("padding-left")||"0",g=i.getPropertyValue("padding-right")||"0";l=parseInt(u)+parseInt(g)}let c=(O.canvas||(O.canvas=document.createElement("canvas"))).getContext("2d");c.font=`${s} ${o} ${r}`;let h=c.measureText(n);return parseInt(h.width)+l}function N(n){return Math.random().toString(36).replace("0.",n||"")}var B={},C={itemsPerPage:"Items per page",gotoPage:"Go to page",gotoFirstPage:"Go to first page",gotoPrevPage:"Go to previous page",gotoNextPage:"Go to next page",gotoLastPage:"Go to last page",of:"of",items:"items",resizeColumn:"Resize column",noData:"No data",areYouSure:"Are you sure?",networkError:"Network response error"};function mt(n,t){t.width&&d(n,"width",t.width),t.class&&L(n,t.class),t.hidden&&(d(n,"hidden",""),t.responsiveHidden&&L(n,"dg-responsive-hidden"))}var J=class n extends ft{#t="[id^=dg-filter]";_ready(){d(this,"id",this.options.id??N("el-"),!0),this.data=[],this.originalData,this.options=this.options||this.defaultOptions,this.fireEvents=!1,this.page=this.options.defaultPage||1,this.pages=0,this.meta,this.plugins={};for(let[t,e]of Object.entries(B))this.plugins[t]=new e(this);for(let t of n.observedAttributes)t.indexOf("data-")===0&&d(this,t,this.options[H(t.slice(5))]);this.options.showSpinner&&this.plugins.SpinnerSupport&&this.plugins.SpinnerSupport.add()}static template(){return` +function F(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}function j(n){if(n==="true")return!0;if(n==="false")return!1;if(n===""||n==="null")return null;if(n===Number(n).toString())return Number(n);if(n&&["[","{"].includes(n.substring(0,1)))try{return n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(decodeURIComponent(n))}catch{return console.error("Failed to parse "+n),{}}return n}var It=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];function gt(n){return It.includes(n)?{passive:!0}:{}}function k(n,t){return n.getAttribute(t)}function V(n,t){return n.hasAttribute(t)}function d(n,t,e="",i=!1){i&&V(n,t)||n.setAttribute(t,""+e)}function S(n,t){V(n,t)&&n.removeAttribute(t)}function w(n,t,e){n.addEventListener(t,e,gt(t))}function W(n,t,e){n.removeEventListener(t,e,gt(t))}function y(n,t,e={},i=!1){let s={};i&&(s.bubbles=!0),e&&(s.detail=e),n.dispatchEvent(new CustomEvent(t,s))}function I(n,t){return n.classList.contains(t)}function L(n,t){n.classList.add(...t.split(" "))}function q(n,t){n.classList.remove(...t.split(" "))}function pt(n,t){n.classList.toggle(t)}function H(n,t=document){return n instanceof HTMLElement?n:t.querySelector(n)}function Tt(n,t=document){return Array.from(t.querySelectorAll(n))}function T(n,t){return H(t,n)}function f(n,t){return Tt(t,n)}function x(n,t=null){let e=document.createElement(n);return t&&t.appendChild(e),e}function ft(n,t){t.parentNode.insertBefore(n,t.nextSibling)}var U=class extends HTMLElement{constructor(t={}){super(),this.options=Object.assign({},this.defaultOptions,this.normalizedDataset,t),this.log("constructor"),this.fireEvents=!0,this._ready(),this.log("ready")}get defaultOptions(){return{}}getOption(t){return this.options[t]}setOption(t,e){d(this,`data-${t}`,e)}toggleOption(t){d(this,`data-${t}`,!this.getOption(t))}get normalizedDataset(){let t=this.dataset.config?JSON.parse(this.dataset.config):{},e={...this.dataset};for(var i in e)i!="config"&&(e[i]=j(e[i]));return Object.assign(e,t),e}static template(){return""}_ready(){}log(t){this.options.debug&&console.log("["+k(this,"id")+"] "+t)}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}_connected(){}connectedCallback(){setTimeout(()=>{this.log("connectedCallback");let t=document.createElement("template");t.innerHTML=this.constructor.template(),this.appendChild(t.content.cloneNode(!0)),this._connected(),y(this,"connected")},0)}_disconnected(){}disconnectedCallback(){this.log("disconnectedCallback"),this._disconnected(),y(this,"disconnected")}get transformAttributes(){return{}}attributeChangedCallback(t,e,i){if(e===i)return;this.log("attributeChangedCallback: "+t);let s=!1,o=this.transformAttributes[t]??j;t.indexOf("data-")===0&&(t=t.slice(5),s=!0),t=F(t),s?this.options[t]=o(i):this[t]=o(i),this.fireEvents&&this[`${t}Changed`]&&this[`${t}Changed`]()}},mt=U;function X(n,t,e,i=!1){let s=document.createElement("option");s.value=""+t,i&&(s.selected=!0),s.label=e,n.appendChild(s)}function Y(n,t={}){Object.keys(t).forEach(e=>{Array.isArray(t[e])?Object.keys(t[e]).forEach(i=>n.searchParams.append(isNaN(i)?`${e}[${i}]`:e,t[e][i])):n.searchParams.append(e,t[e])})}function K(n){return typeof n=="string"?n[0]==="["?(n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(n)):n.split(","):Array.isArray(n)?n:(console.error("Invalid array",n),[])}function J(n){var t=n.getBoundingClientRect(),e=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+i,left:t.left+e}}function N(n,t){return n.replace(/\{([^}]+)?\}/g,function(e,i){return t[i]})}function O(n,t=document.body,e=!1){t||(t=document.createElement("div"));let i=window.getComputedStyle(t),s=i.getPropertyValue("font-weight")||"normal",o=i.getPropertyValue("font-size")||"1rem",r=i.getPropertyValue("font-family")||"Arial",l=0;if(e){let u=i.getPropertyValue("padding-left")||"0",g=i.getPropertyValue("padding-right")||"0";l=parseInt(u)+parseInt(g)}let c=(O.canvas||(O.canvas=document.createElement("canvas"))).getContext("2d");c.font=`${s} ${o} ${r}`;let h=c.measureText(n);return parseInt(h.width)+l}function G(n){return Math.random().toString(36).replace("0.",n||"")}var M={},C={itemsPerPage:"Items per page",gotoPage:"Go to page",gotoFirstPage:"Go to first page",gotoPrevPage:"Go to previous page",gotoNextPage:"Go to next page",gotoLastPage:"Go to last page",of:"of",items:"items",resizeColumn:"Resize column",noData:"No data",areYouSure:"Are you sure?",networkError:"Network response error"};function bt(n,t){t.width&&d(n,"width",t.width),t.class&&L(n,t.class),t.hidden&&(d(n,"hidden",""),t.responsiveHidden&&L(n,"dg-responsive-hidden"))}var Z=class n extends mt{#t="[id^=dg-filter]";_ready(){d(this,"id",this.options.id??G("el-"),!0),this.data=[],this.originalData,this.options=this.options||this.defaultOptions,this.fireEvents=!1,this.page=this.options.defaultPage||1,this.pages=0,this.meta,this.plugins={};for(let[t,e]of Object.entries(M))this.plugins[t]=new e(this);for(let t of n.observedAttributes)t.indexOf("data-")===0&&d(this,t,this.options[F(t.slice(5))]);this.options.showSpinner&&this.plugins.SpinnerSupport&&this.plugins.SpinnerSupport.add()}static template(){return` @@ -36,13 +36,13 @@ function H(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUppe
-`}get labels(){return C}static getLabels(){return C}static setLabels(t){C=Object.assign(C,t)}get defaultColumn(){return{field:"",title:"",width:0,class:"",attr:"",hidden:!1,editable:!1,noSort:!1,responsive:1,responsiveHidden:!1,format:"",transform:"",filterType:"text",firstFilterOption:{value:"",text:""}}}get defaultOptions(){return{id:null,url:null,perPage:10,debug:!1,filter:!1,menu:!1,sort:!1,server:!1,serverParams:{start:"start",length:"length",search:"search",sort:"sort",sortDir:"sortDir",dataKey:"data",metaKey:"meta",metaTotalKey:"total",metaFilteredKey:"filtered",optionsKey:"options",paramsKey:"params"},defaultSort:"",reorder:!1,dir:"ltr",perPageValues:[10,25,50,100,250],hidePerPage:!1,columns:[],actions:[],collapseActions:!1,selectable:!1,selectVisibleOnly:!0,defaultPage:1,resizable:!1,autosize:!0,expand:!1,autoheight:!0,autohidePager:!1,responsive:!1,responsiveToggle:!0,filterOnEnter:!0,showSpinner:!1,spinnerCssClasses:""}}static registerPlugins(t){B=t}static unregisterPlugins(t=null){t===null?B={}:delete B[t]}static registeredPlugins(){return B}convertColumns(t){let e=[];return typeof t=="object"&&!Array.isArray(t)?Object.keys(t).forEach(i=>{let s=Object.assign({},this.defaultColumn);s.title=t[i],s.field=i,e.push(s)}):t.forEach(i=>{let s=Object.assign({},this.defaultColumn);typeof i=="string"?(s.title=i,s.field=i):typeof i=="object"?(s=Object.assign(s,i),s.field||console.error("Invalid column definition",i),s.title||(s.title=s.field)):console.error("Column definition must be a string or an object"),e.push(s)}),e}static get observedAttributes(){return["page","data-filter","data-sort","data-debug","data-reorder","data-menu","data-selectable","data-url","data-per-page","data-responsive"]}get transformAttributes(){return{columns:t=>this.convertColumns(V(t)),actions:t=>V(t),defaultPage:t=>parseInt(t),perPage:t=>parseInt(t)}}get page(){return parseInt(this.getAttribute("page"))}set page(t){d(this,"page",this.constrainPageValue(t))}urlChanged(){this.loadData().then(()=>{this.configureUi()})}constrainPageValue(t){return this.pages1&&this.page*this.options.perPage>this.totalRecords();)t--;t!=this.page?this.page=t:this.reload(()=>{(!this.plugins.FixedHeight||!this.plugins.FixedHeight.hasFixedHeight)&&this.selectPerPage.scrollIntoView()})}dirChanged(){d(this,"dir",this.options.dir)}defaultSortChanged(){this.sortChanged()}perPageValuesChanged(){if(this.selectPerPage){for(;this.selectPerPage.lastChild;)this.selectPerPage.removeChild(this.selectPerPage.lastChild);this.options.perPageValues.forEach(t=>{U(this.selectPerPage,t,t,t===this.options.perPage)})}}_connected(){this.table=this.querySelector("table"),this.btnFirst=this.querySelector(".dg-btn-first"),this.btnPrev=this.querySelector(".dg-btn-prev"),this.btnNext=this.querySelector(".dg-btn-next"),this.btnLast=this.querySelector(".dg-btn-last"),this.selectPerPage=this.querySelector(".dg-select-per-page"),this.inputPage=this.querySelector(".dg-input-page"),this.getFirst=this.getFirst.bind(this),this.getPrev=this.getPrev.bind(this),this.getNext=this.getNext.bind(this),this.getLast=this.getLast.bind(this),this.changePerPage=this.changePerPage.bind(this),this.gotoPage=this.gotoPage.bind(this),this.btnFirst.addEventListener("click",this.getFirst),this.btnPrev.addEventListener("click",this.getPrev),this.btnNext.addEventListener("click",this.getNext),this.btnLast.addEventListener("click",this.getLast),this.selectPerPage.addEventListener("change",this.changePerPage),this.selectPerPage.toggleAttribute("hidden",this.options.hidePerPage),this.inputPage.addEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.connected()}),this.dirChanged(),this.perPageValuesChanged(),this.loadData().finally(()=>{this.configureUi(),this.sortChanged(),this.classList.add("dg-initialized"),this.filterChanged(),this.reorderChanged(),this.dirChanged(),this.perPageValuesChanged(),this.pageChanged(),this.fireEvents=!0,this.log("initialized")})}_disconnected(){this.btnFirst.removeEventListener("click",this.getFirst),this.btnPrev.removeEventListener("click",this.getPrev),this.btnNext.removeEventListener("click",this.getNext),this.btnLast.removeEventListener("click",this.getLast),this.selectPerPage.removeEventListener("change",this.changePerPage),this.inputPage.removeEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.disconnected()})}getCol(t){let e=null;return this.options.columns.forEach(i=>{i.field==t&&(e=i)}),e}getColProp(t,e){let i=this.getCol(t);return i?i[e]:null}setColProp(t,e,i){let s=this.getCol(t);s&&(s[e]=i)}visibleColumns(){return this.options.columns.filter(t=>!t.hidden)}hiddenColumns(){return this.options.columns.filter(t=>t.hidden===!0)}showColumn(t,e=!0){this.setColProp(t,"hidden",!1),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"visible"})}hideColumn(t,e=!0){this.setColProp(t,"hidden",!0),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"hidden"})}startColIndex(){let t=1;return this.options.selectable&&this.plugins.SelectableRows&&t++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&t++,t}isSticky(){return this.hasAttribute("sticky")}columnsLength(t=!1){let e=0;return this.options.columns.forEach(i=>{t&&i.hidden||i.attr||e++}),this.options.selectable&&this.plugins.SelectableRows&&e++,this.options.actions.length&&this.plugins.RowActions&&e++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&e++,e}configureUi(){if(d(this.querySelector("table"),"aria-rowcount",this.data.length),this.table.style.visibility="hidden",this.renderTable(),this.options.responsive&&this.plugins.ResponsiveGrid||(this.table.style.visibility="visible"),!this.rowHeight){let t=T(this,"tbody tr")||T(this,"table tr");t&&(this.rowHeight=t.offsetHeight)}}filterChanged(){let t=this.querySelector("thead tr.dg-head-filters");this.options.filter?S(t,"hidden"):(this.clearFilters(),d(t,"hidden",""))}reorderChanged(){f(this,"thead tr.dg-head-columns th").forEach(e=>{e.classList.contains("dg-selectable")||e.classList.contains("dg-actions")||(this.options.reorder&&this.plugins.DraggableHeaders?e.draggable=!0:e.removeAttribute("draggable"))})}sortChanged(){this.log("toggle sort"),this.querySelectorAll("thead tr.dg-head-columns th").forEach(t=>{let e=t.getAttribute("field");t.classList.contains("dg-not-sortable")||!this.fireEvents&&e==this.options.defaultSort||(this.options.sort&&!this.getColProp(e,"noSort")?d(t,"aria-sort","none"):S(t,"aria-sort"))})}selectableChanged(){this.renderTable()}addRow(t){Array.isArray(this.originalData)&&(this.log("Add row"),this.originalData.push(t),this.data=this.originalData.slice(),this.sortData())}removeRow(t=null,e=null){if(Array.isArray(this.originalData)){e===null&&(e=this.options.columns[0].field),t===null&&(t=this.originalData[this.originalData.length-1][e]),this.log("Removing "+e+":"+t);for(let i=0;i{this.options.server||e?this.renderBody():this.paginate(),t&&t()})}loadData(){let t=()=>!this.data.length&&this.classList.add("dg-empty"),e=this.querySelector("tbody");return(this.meta||this.originalData||this.classList.contains("dg-initialized"))&&(!this.options.server||this.options.server&&!this.fireEvents)?(this.log("skip loadData"),t(),new Promise(i=>{i()})):(this.log("loadData"),this.loading=!0,this.classList.add("dg-loading"),this.classList.remove("dg-empty","dg-network-error"),this.fetchData().then(i=>{if(Array.isArray(i))this.data=i;else{if(!i[this.options.serverParams.dataKey]){console.error("Invalid response, it should contain a data key with an array or be a plain array",i),this.options.url=null;return}this.options=Object.assign(this.options,i[this.options.serverParams.optionsKey]??{}),this.meta=i[this.options.serverParams.metaKey]??{},this.data=i[this.options.serverParams.dataKey]}this.originalData=this.data.slice(),this.fixPage(),this.options.columns.length===0&&this.originalData.length?this.options.columns=this.convertColumns(Object.keys(this.originalData[0])):this.options.columns=this.convertColumns(this.options.columns)}).catch(i=>{this.log(i),i.message&&e.setAttribute("data-empty",i.message.replace(/^\s+|\r\n|\n|\r$/g,"")),this.classList.add("dg-empty","dg-network-error")}).finally(()=>{t(),!this.classList.contains("dg-network-error")&&e.getAttribute("data-empty")!=this.labels.noData&&e.setAttribute("data-empty",this.labels.noData),this.classList.remove("dg-loading"),this.loading=!1}))}getFirst(){this.loading||(this.page=1)}getLast(){this.loading||(this.page=this.pages)}getPrev(){this.loading||(this.page=this.page-1)}getNext(){this.loading||(this.page=this.page+1)}gotoPage(t){if(t.type==="keypress"){let e=t.keyCode||t.key;if(e===13||e==="Enter")t.preventDefault();else return}this.page=parseInt(this.inputPage.value)}getSort(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t?t.getAttribute("field"):this.options.defaultSort}getSortDir(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t&&t.getAttribute("aria-sort")||""}getFilters(){let t=[];return f(this,this.#t).forEach(i=>{t[i.dataset.name]=i.value}),t}clearFilters(){f(this,this.#t).forEach(e=>{e.value=""}),this.filterData()}filterData(){if(this.log("filter data"),this.page=1,this.options.server)this.reload();else{this.data=this.originalData?.slice()??[],f(this,this.#t).forEach(i=>{let s=i.value;if(s){let o=i.dataset.name;this.data=this.data.filter(r=>(r[o]+"").toLowerCase().indexOf(s.toLowerCase())!==-1)}}),this.pageChanged();let e=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");this.options.sort&&e?this.sortData():this.renderBody()}}sortData(t=null){if(this.log("sort data"),t&&this.getColProp(t.getAttribute("field"),"noSort")){this.log("sorting prevented because column is not sortable");return}if(this.plugins.ColumnResizer&&this.plugins.ColumnResizer.isResizing){this.log("sorting prevented because resizing");return}if(this.loading){this.log("sorting prevented because loading");return}if(t!==null){let e=i=>["dg-selectable","dg-actions","dg-responsive-toggle"].includes(i);this.querySelectorAll("thead tr:first-child th").forEach(i=>{[...i.classList].some(e)||i!==t&&i.setAttribute("aria-sort","none")}),!t.hasAttribute("aria-sort")||t.getAttribute("aria-sort")==="none"?t.setAttribute("aria-sort","ascending"):t.getAttribute("aria-sort")==="ascending"?t.setAttribute("aria-sort","descending"):t.getAttribute("aria-sort")==="descending"&&t.setAttribute("aria-sort","none")}else t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");if(this.options.server)this.loadData().finally(()=>{this.renderBody()});else{let e=t?t.getAttribute("aria-sort"):"none";if(e==="none"){let i=[];this.originalData?.some(s=>(this.data.some(o=>JSON.stringify(s)===JSON.stringify(o)?(i.push(o),!0):!1),i.length===this.data.length)),this.data=i}else{let i=t.getAttribute("field");this.data.sort((s,o)=>{if(!isNaN(s[i])&&!isNaN(o[i]))return e==="ascending"?s[i]-o[i]:o[i]-s[i];let r=e==="ascending"?s[i].toUpperCase():o[i].toUpperCase(),l=e==="ascending"?o[i].toUpperCase():s[i].toUpperCase();switch(!0){case r>l:return 1;case ro("No url set"));let t=window.location.href;t.split("/").pop().includes(".")||(t+=t.endsWith("/")?"":"/");let e=new URL(this.options.url,t),i={r:Date.now()};return this.options.server&&(i[this.options.serverParams.start]=this.page-1,i[this.options.serverParams.length]=this.options.perPage,this.options.filter&&(i[this.options.serverParams.search]=this.getFilters()),i[this.options.serverParams.sort]=this.getSort()||"",i[this.options.serverParams.sortDir]=this.getSortDir(),this.meta?.[this.options.serverParams.paramsKey]&&(i=Object.assign(i,this.meta[this.options.serverParams.paramsKey]))),X(e,i),fetch(e).then(s=>{if(!s.ok)throw new Error(s.statusText||C.networkError);return s.json()})}renderTable(){this.log("render table"),this.options.menu&&this.plugins.ContextMenu&&this.plugins.ContextMenu.createMenu();let t;this.renderHeader(),this.options.defaultSort&&(t=this.querySelector("thead tr.dg-head-columns th[field='"+this.options.defaultSort+"']")),t?this.sortData(t):this.renderBody(),this.renderFooter()}renderHeader(){this.log("render header");let t=this.querySelector("thead");this.createColumnHeaders(t),this.createColumnFilters(t),this.options.resizable&&this.plugins.ColumnResizer&&this.plugins.ColumnResizer.renderResizer(C.resizeColumn),y(this,"headerRendered")}renderFooter(){this.log("render footer");let t=this.querySelector("tfoot"),e=t.querySelector("td");t.removeAttribute("hidden"),d(e,"colspan",this.columnsLength(!0)),t.style.display=""}createColumnHeaders(t){let e=this.clientWidth,i=Math.round(e/this.columnsLength(!0)*2),s=0,o;o=x("tr"),this.headerRow=o,o.setAttribute("role","row"),o.setAttribute("aria-rowindex","1"),o.setAttribute("class","dg-head-columns");let r=t.querySelector("tr.dg-head-columns th");r||(r=x("th"),t.querySelector("tr").appendChild(r)),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createHeaderCol(o),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createHeaderCol(o),s=0;let l=0;if(this.options.columns.forEach(a=>{if(a.attr)return;let c=s+this.startColIndex(),h=x("th");h.setAttribute("scope","col"),h.setAttribute("role","columnheader button"),h.setAttribute("aria-colindex",""+c),h.setAttribute("id",N("dg-col-")),this.options.sort&&h.setAttribute("aria-sort","none"),h.setAttribute("field",a.field),this.plugins.ResponsiveGrid&&this.options.responsive&&d(h,"data-responsive",a.responsive||"");let u=O(a.title,r,!0)+20;h.dataset.minWidth=""+u,mt(h,a),h.tabIndex=0,h.textContent=a.title;let g=0;if(this.options.autosize&&this.plugins.AutosizeColumn){let m=Math.min(e-l,i);g=this.plugins.AutosizeColumn.computeSize(h,a,parseInt(h.dataset.minWidth),m)}else g=Math.max(parseInt(h.dataset.minWidth),parseInt(h.getAttribute("width")));d(h,"width",g),a.hidden?h.setAttribute("hidden",""):l+=g,this.options.reorder&&this.plugins.DraggableHeaders&&this.plugins.DraggableHeaders.makeHeaderDraggable(h),o.appendChild(h),s++}),le){this.log(`adjust width to fix size, ${t.offsetWidth} > ${e}`);let a=this.offsetWidth-this.clientWidth,c=t.offsetWidth-e-a;this.options.responsive&&this.plugins.ResponsiveGrid&&(c+=a),f(o,"th[width]").forEach(u=>{if($(u,"dg-not-resizable")||c<=0)return;let g=parseInt(u.getAttribute("width")),m=u.dataset.minWidth?parseInt(u.dataset.minWidth):0;if(g>m){let v=g-c;v{a.addEventListener("click",()=>this.sortData(a))}),d(this.querySelector("table"),"aria-colcount",this.columnsLength(!0))}createColumnFilters(t){let e=0,i;i=x("tr"),this.filterRow=i,i.setAttribute("role","row"),i.setAttribute("aria-rowindex","2"),i.setAttribute("class","dg-head-filters"),this.options.filter||i.setAttribute("hidden",""),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createFilterCol(i),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createFilterCol(i),this.options.columns.forEach(s=>{if(s.attr)return;let o=e+this.startColIndex(),r=t.querySelector("tr.dg-head-columns th[aria-colindex='"+o+"']");if(!r){console.warn("Related th not found",o);return}let l=x("th");l.setAttribute("aria-colindex",""+o);let a=this.createFilterElement(s,r);this.options.filter?a.tabIndex=0:l.tabIndex=0,s.hidden&&l.setAttribute("hidden",""),l.appendChild(a),i.appendChild(l),e++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionFilter(i),t.replaceChild(i,t.querySelector("tr.dg-head-filters")),i.querySelectorAll(this.#t).forEach(s=>{let o=/select/i.test(s.tagName)?"change":"keyup";s.addEventListener(o,r=>{let l=r.keyCode||r.key;(l===13||l==="Enter"||!this.options.filterOnEnter||r.type=="change")&&this.filterData.call(this)})})}createFilterElement(t,e){let i=t.filterType=="select",s=i?x("select"):x("input");if(i){if(!Array.isArray(t.filterList)){let o=[...new Set((this.data??[]).map(r=>r[t.field]))].filter(r=>!!r).sort();t.filterList=[t.firstFilterOption||this.defaultColumn.firstFilterOption].concat(o.map(r=>({value:r,text:r})))}t.filterList.forEach(o=>{let r=x("option");r.value=o.value,r.text=o.text,s.add(r)})}else s.type="text",s.inputMode="search",s.autocomplete="off",s.spellcheck=!1;return s.dataset.name=t.field,s.id=N("dg-filter-"),s.setAttribute("aria-labelledby",e.getAttribute("id")),s}renderBody(){this.log("render body");let t,e,i,s=x("tbody");this.data.forEach((r,l)=>{t=x("tr"),d(t,"role","row"),d(t,"hidden",""),d(t,"aria-rowindex",l+1),t.tabIndex=0,this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createDataCol(t),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createDataCol(t),this.options.expand&&(t.classList.add("dg-expandable"),w(t,"click",a=>{this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.blockObserver(),gt(a.currentTarget,"dg-expanded"),this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.unblockObserver()})),i=0,this.options.columns.forEach(a=>{if(a||console.error("Empty column found!",this.options.columns),a.attr){r[a.field]&&(a.attr==="class"?L(t,r[a.field]):t.setAttribute(a.attr,r[a.field]));return}if(e=x("td"),e.setAttribute("role","gridcell"),e.setAttribute("aria-colindex",i+this.startColIndex()),mt(e,a),e.setAttribute("data-name",a.title),e.tabIndex=-1,a.editable&&this.plugins.EditableColumn)L(e,"dg-editable-col"),this.plugins.EditableColumn.makeEditableInput(e,a,r,l);else{let c=r[a.field]??"",h;switch(a.transform){case"uppercase":h=c.toUpperCase();break;case"lowercase":h=c.toLowerCase();break;default:h=c;break}if(a.format){if(a.defaultFormatValue!=null&&(h===""||h===null)&&(h=a.defaultFormatValue+""),typeof a.format=="string"&&h)e.innerHTML=q(a.format,Object.assign({_v:c,_tv:h},r));else if(a.format instanceof Function){let u=a.format.call(this,{column:a,rowData:r,cellData:h,td:e,tr:t});e.innerHTML=u||h||c}}else e.textContent=h}t.appendChild(e),i++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionRow(t,r),s.appendChild(t)}),s.setAttribute("role","rowgroup");let o=this.querySelector("tbody");s.setAttribute("data-empty",o.getAttribute("data-empty")),this.querySelector("table").replaceChild(s,o),this.plugins.FixedHeight&&this.plugins.FixedHeight.createFakeRow(),this.paginate(),this.plugins.SelectableRows&&this.plugins.SelectableRows.shouldSelectAll(s),this.data.length&&this.classList.remove("dg-empty"),y(this,"bodyRendered")}paginate(){this.log("paginate");let t=this.totalRecords(),e=this.page||1,i,s=e*this.options.perPage,o=s-this.options.perPage+1,r=this.querySelector("tbody"),l=this.querySelector("tfoot");s>t&&(s=t),t||(o=0),r.querySelectorAll("tr").forEach(a=>{if(this.options.server){S(a,"hidden");return}i=Number(k(a,"aria-rowindex")),i>s||i=this.pages,this.btnLast.disabled=this.page>=this.pages),l.querySelector(".dg-low").textContent=o.toString(),l.querySelector(".dg-high").textContent=s.toString(),l.querySelector(".dg-total").textContent=""+this.totalRecords(),l.toggleAttribute("hidden",this.options.autohidePager&&this.options.perPage>this.totalRecords())}totalPages(){return Math.ceil(this.totalRecords()/this.options.perPage)}totalRecords(){return this.options.server?this.meta?.[this.options.serverParams.metaFilteredKey]||0:this.data.length}},K=J;var Z=class{constructor(t){this.grid=t}connected(){}disconnected(){}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}},b=Z;var Q=class extends b{constructor(t){super(t),this.isResizing=!1}renderResizer(t){let e=this.grid,i=e.table,s=f(e,"thead tr.dg-head-columns th");s.forEach(o=>{if($(o,"dg-not-resizable"))return;let r=document.createElement("div");L(r,"dg-resizer"),r.ariaLabel=t,o.appendChild(r);let l=0,a=0,c=0,h=0,u=m=>{if(m.clientX>h)return;let v=a+(m.clientX-l);o.dataset.minWidth&&v>parseInt(o.dataset.minWidth)&&d(o,"width",v)},g=()=>{e.log("resized column"),setTimeout(()=>{this.isResizing=!1},0),F(r,"dg-resizer-active"),e.options.reorder&&(o.draggable=!0),o.style.overflow="hidden",W(document,"mousemove",u),W(document,"mouseup",g),y(e,"columnResized",{col:k(o,"field"),width:k(o,"width")})};w(r,"click",m=>{m.stopPropagation()}),w(r,"mousedown",m=>{m.stopPropagation(),this.isResizing=!0;let v=m.target,P=f(e,"dg-head-columns th").filter(p=>!p.hasAttribute("hidden")),A=P.findIndex(p=>p==v.parentNode);e.log("resize column"),L(r,"dg-resizer-active"),S(o,"draggable"),o.style.overflow="visible",r.style.height=i.offsetHeight-1+"px",l=m.clientX,a=o.offsetWidth,c=(P.length-A)*30,h=Y(v).left+e.offsetWidth-c,d(o,"width",a);for(let p=0;pA&&S(s[p],"width");w(document,"mousemove",u),w(document,"mouseup",g)})})}},bt=Q;function G(n,t,e="nodeName"){let i=n;for(;i[e]!=t;)i=i.parentElement;return i}var tt=class extends b{connected(){this.menu=this.grid.querySelector(".dg-menu")}disconnected(){this.grid.headerRow&&W(this.grid.headerRow,"contextmenu",this)}attachContextMenu(){let t=this.grid;w(t.headerRow,"contextmenu",this)}onchange(t){let e=this.grid,i=t.target,s=i.dataset.name;if(i.checked)e.showColumn(s);else{if(e.visibleColumns().length<=1){i.checked=!0;return}e.hideColumn(s)}}oncontextmenu(t){t.preventDefault();let e=this.grid,i=G(t.target,"THEAD"),s=this.menu,o=i.getBoundingClientRect(),r=t.clientX-o.left,l=t.clientY-o.top;s.style.top=`${l}px`,s.style.left=`${r}px`,S(s,"hidden"),r+150>o.width&&(r-=s.offsetWidth,s.style.left=`${r}px`);let a=c=>{s.contains(c.target)||(d(s,"hidden",""),W(document,"click",a))};w(document,"click",a)}createMenu(){let t=this.grid,e=this.menu;for(;e.lastChild;)e.removeChild(e.lastChild);e.addEventListener("change",this),t.options.columns.forEach(i=>{if(i.attr)return;let s=document.createElement("li"),o=document.createElement("label"),r=document.createElement("input");d(r,"type","checkbox"),d(r,"data-name",i.field),i.hidden||(r.checked=!0);let l=document.createTextNode(i.title);o.appendChild(r),o.appendChild(l),s.appendChild(o),e.appendChild(s)})}},vt=tt;var et=class extends b{makeHeaderDraggable(t){let e=this.grid;t.draggable=!0,w(t,"dragstart",i=>{if(e.plugins.ColumnResizer&&e.plugins.ColumnResizer.isResizing&&i.preventDefault){i.preventDefault();return}e.log("reorder col"),i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",i.target.getAttribute("aria-colindex"))}),w(t,"dragover",i=>(i.preventDefault&&i.preventDefault(),i.dataTransfer.dropEffect="move",!1)),w(t,"drop",i=>{i.stopPropagation&&i.stopPropagation();let s=i.target,o=G(s,"TH"),r=parseInt(i.dataTransfer.getData("text/plain")),l=parseInt(o.getAttribute("aria-colindex"));if(r===l){e.log("reordered col stayed the same");return}e.log("reordered col from "+r+" to "+l);let a=e.startColIndex(),c=e.options.columns[r-a];e.options.columns[r-a]=e.options.columns[l-a],e.options.columns[l-a]=c;let h=(u,g)=>{let m=g.parentNode.getAttribute("aria-rowindex"),v=e.querySelector(u+" tr[aria-rowindex='"+m+"'] [aria-colindex='"+l+"']");d(g,"aria-colindex",l),d(v,"aria-colindex",r);let R=document.createElement("th");g.parentNode.insertBefore(R,g),v.parentNode.replaceChild(g,v),R.parentNode.replaceChild(v,R)};return f(e,"thead th[aria-colindex='"+r+"']").forEach(u=>{h("thead",u)}),f(e,'tbody td[aria-colindex="'+r+'"]').forEach(u=>{h("tbody",u)}),e.options.columns=f(e,"thead tr.dg-head-columns th[field]").map(u=>e.options.columns.find(g=>g.field==k(u,"field"))),y(e,"columnReordered",{col:c.field,from:r,to:l}),!1})}},xt=et;var it=class extends b{constructor(t){super(t),this.touch=null}connected(){let t=this.grid;t.addEventListener("touchstart",this,{passive:!0}),t.addEventListener("touchmove",this,{passive:!0})}disconnected(){let t=this.grid;t.removeEventListener("touchstart",this),t.removeEventListener("touchmove",this)}ontouchstart(t){this.touch=t.touches[0]}ontouchmove(t){if(!this.touch)return;let e=this.grid,i=this.touch.clientX-t.touches[0].clientX,s=this.touch.clientY-t.touches[0].clientY;Math.abs(i)>Math.abs(s)&&(i>0?e.getNext():e.getPrev()),this.touch=null}},yt=it;var z="dg-selectable",Ct="dg-select-all",At="form-check-input",st=class extends b{disconnected(){this.selectAll&&this.selectAll.removeEventListener("change",this)}getSelection(t=null){let e=this.grid,i=[];return f(e,`tbody .${z} input:checked`).forEach(o=>{let r=parseInt(o.dataset.id),l=e.data[r-1];l||console.warn(`Item ${r} not found`),t?i.push(l[t]):i.push(l)}),i}clearCheckboxes(t){if(!this.grid.options.selectVisibleOnly)return;f(t,`tr[hidden] .${z} input`).forEach(s=>{s.checked=!1}),this.selectAll.checked=!1}colIndex(){return this.grid.startColIndex()-2}createHeaderCol(t){let e=document.createElement("th");d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0,this.selectAll=document.createElement("input"),this.selectAll.type="checkbox",this.selectAll.classList.add(Ct),this.selectAll.classList.add(At),this.selectAll.addEventListener("change",this);let i=document.createElement("label");i.appendChild(this.selectAll),e.appendChild(i),e.setAttribute("width","40"),t.appendChild(e)}createFilterCol(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z),e.tabIndex=0,t.appendChild(e)}shouldSelectAll(t){this.selectAll&&(t.addEventListener("change",this),t.dispatchEvent(new Event("change")))}createDataCol(t){let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z);let i=document.createElement("input");i.dataset.id=t.getAttribute("aria-rowindex"),i.type="checkbox",i.classList.add(At);let s=document.createElement("label");s.classList.add("dg-clickable-cell"),s.appendChild(i),e.appendChild(s),s.addEventListener("click",this),t.appendChild(e)}onclick(t){t.stopPropagation()}onchange(t){let e=this.grid;if($(t.target,Ct)){let i=e.options.selectVisibleOnly;f(e,`tbody .${z} input`).forEach(o=>{i&&!o.offsetWidth||(o.checked=this.selectAll.checked)}),y(e,"rowsSelected",{selection:this.getSelection()})}else{if(!t.target.closest(`.${z}`))return;let i=f(e,`tbody .${z} input[type=checkbox]`),s=i.filter(o=>o.checked);this.selectAll.checked=s.length==i.length,y(e,"rowsSelected",{selection:e.getSelection()})}}},Pt=st;var rt=class extends b{constructor(t){super(t),this.hasFixedHeight=!1,t.style.height&&(t.style.overflowY="auto",this.hasFixedHeight=!0)}createFakeRow(){let e=this.grid.querySelector("tbody"),i=document.createElement("tr");d(i,"role","row"),d(i,"hidden",""),i.classList.add("dg-fake-row"),i.tabIndex=0,e.appendChild(i)}get fakeRow(){return this.grid.querySelector(".dg-fake-row")}updateFakeRow(){let t=this.grid,e=this.fakeRow;if(!e||t.options.perPage>t.totalRecords()||t.page!==t.totalPages()||!t.options.autoheight)return;let i=t.options.perPage*t.rowHeight,s=t.querySelectorAll("tbody tr:not([hidden])").length,o=s>1?i-s*t.rowHeight:i;o>0?(d(e,"height",o),e.removeAttribute("hidden")):e.removeAttribute("height")}},wt=rt;var nt=class extends b{computeSize(t,e,i,s){let o=this.grid;if(j(t,"width"))return k(t,"width");if(!o.data.length)return;let r=o.data[0],l=o.data[o.data.length-1],a=r[e.field]?r[e.field].toString():"",c=l[e.field]?l[e.field].toString():"";c.length>a.length&&(a=c);let h=0;return a.length<=6?h=i:a.length>50?h=s:h=O(a+"0000",t),h>s&&(h=s),h{clearTimeout(e),e=setTimeout(()=>{e=null,n(...i)},t)}}var E="dg-responsive",at;function zt(n){return n.sort((t,e)=>{let i=parseInt(t.dataset.responsive)||1;return(parseInt(e.dataset.responsive)||1)-i})}var Ot=ot(n=>{for(let t of n){let e=t.target,i=e.table;if(e.plugins.ResponsiveGrid.observerBlocked)return;let s=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,o=parseInt(s.inlineSize),r=i.offsetWidth,l=f(e.headerRow,"th").reduce((P,A)=>P+A.offsetWidth,0),a=(l||r)-o-1,c=50,h=e.plugins.ResponsiveGrid.prevAction,u=zt(f(e.headerRow,"th[field]").reverse().filter(P=>P.dataset.responsive!=="0")),g=!1;if(e.log(`table is ${r}/${l} and available size is ${o}. Diff: ${a}`),a>0){if(h==="show")return;e.plugins.ResponsiveGrid.prevAction="hide";let P=a,A=u.filter(p=>!p.hasAttribute("hidden")&&p.hasAttribute("data-responsive"));if(A.length===0&&(A=u.filter(p=>!p.hasAttribute("hidden")),A.length===1))return;A.forEach(p=>{if(P<0)return;let I=p.offsetWidth,D=p.getAttribute("field");D&&(p.dataset.baseWidth=""+p.offsetWidth,e.hideColumn(D,!1),e.setColProp(D,"responsiveHidden",!0),g=!0,P-=I,P=Math.round(P))})}else{if(h==="hide")return;e.plugins.ResponsiveGrid.prevAction="show";let P=u.filter(p=>!p.hasAttribute("hidden")).reduce((p,I)=>{let D=I.dataset.minWidth?parseInt(I.dataset.minWidth):I.offsetWidth;return p+D},0)+c,A=o-P;u.slice().reverse().filter(p=>p.hasAttribute("hidden")).forEach(p=>{if(AA){A=-1;return}let D=p.getAttribute("field");D&&(e.showColumn(D,!1),e.setColProp(D,"responsiveHidden",!1),g=!0,A-=I,A=Math.round(A))})}let m=T(e.table,"tfoot"),v=f(e.table,".dg-footer > div").reduce((P,A)=>P+A.offsetWidth,0),R=m.offsetWidth-v;v>o?L(m,"dg-footer-compact"):R>250&&F(m,"dg-footer-compact"),g&&e.renderTable(),setTimeout(()=>{e.plugins.ResponsiveGrid.prevAction=null},1e3),e.table.style.visibility="visible"}},100),St=new ResizeObserver(Ot),lt=class extends b{constructor(t){super(t),this.observerBlocked=!1,this.prevAction=null}connected(){this.grid.options.responsive&&this.observe()}disconnected(){this.unobserve()}observe(){this.grid.options.responsive&&(St.observe(this.grid),this.grid.style.display="block",this.grid.style.overflowX="hidden")}unobserve(){St.unobserve(this.grid),this.grid.style.display="unset",this.grid.style.overflowX="unset"}blockObserver(){this.observerBlocked=!0,at&&clearTimeout(at)}unblockObserver(){at=setTimeout(()=>{this.observerBlocked=!1},200)}hasHiddenColumns(){let t=!1;return this.grid.options.columns.forEach(e=>{e.responsiveHidden&&(t=!0)}),t}colIndex(){return this.grid.startColIndex()-1}createHeaderCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),d(e,"width","40"),e.classList.add(`${E}-toggle`,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0}createFilterCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.tabIndex=0}createDataCol(t){if(!this.grid.options.responsiveToggle)return;let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.innerHTML=`
+`}get labels(){return C}static getLabels(){return C}static setLabels(t){C=Object.assign(C,t)}get defaultColumn(){return{field:"",title:"",width:0,class:"",attr:"",hidden:!1,editable:!1,noSort:!1,responsive:1,responsiveHidden:!1,format:"",transform:"",filterType:"text",firstFilterOption:{value:"",text:""}}}get defaultOptions(){return{id:null,url:null,perPage:10,debug:!1,filter:!1,menu:!1,sort:!1,server:!1,serverParams:{start:"start",length:"length",search:"search",sort:"sort",sortDir:"sortDir",dataKey:"data",metaKey:"meta",metaTotalKey:"total",metaFilteredKey:"filtered",optionsKey:"options",paramsKey:"params"},defaultSort:"",reorder:!1,dir:"ltr",perPageValues:[10,25,50,100,250],hidePerPage:!1,columns:[],actions:[],collapseActions:!1,selectable:!1,selectVisibleOnly:!0,defaultPage:1,resizable:!1,autosize:!0,expand:!1,autoheight:!0,autohidePager:!1,responsive:!1,responsiveToggle:!0,filterOnEnter:!0,showSpinner:!1,spinnerCssClasses:""}}static registerPlugins(t){M=t}static unregisterPlugins(t=null){t===null?M={}:delete M[t]}static registeredPlugins(){return M}convertColumns(t){let e=[];return typeof t=="object"&&!Array.isArray(t)?Object.keys(t).forEach(i=>{let s=Object.assign({},this.defaultColumn);s.title=t[i],s.field=i,e.push(s)}):t.forEach(i=>{let s=Object.assign({},this.defaultColumn);typeof i=="string"?(s.title=i,s.field=i):typeof i=="object"?(s=Object.assign(s,i),s.field||console.error("Invalid column definition",i),s.title||(s.title=s.field)):console.error("Column definition must be a string or an object"),e.push(s)}),e}static get observedAttributes(){return["page","data-filter","data-sort","data-debug","data-reorder","data-menu","data-selectable","data-url","data-per-page","data-responsive"]}get transformAttributes(){return{columns:t=>this.convertColumns(K(t)),actions:t=>K(t),defaultPage:t=>parseInt(t),perPage:t=>parseInt(t)}}get page(){return parseInt(this.getAttribute("page"))}set page(t){d(this,"page",this.constrainPageValue(t))}urlChanged(){this.loadData().then(()=>{this.configureUi()})}constrainPageValue(t){return this.pages1&&this.page*this.options.perPage>this.totalRecords();)t--;t!=this.page?this.page=t:this.reload(()=>{(!this.plugins.FixedHeight||!this.plugins.FixedHeight.hasFixedHeight)&&this.selectPerPage.scrollIntoView()})}dirChanged(){d(this,"dir",this.options.dir)}defaultSortChanged(){this.sortChanged()}perPageValuesChanged(){if(this.selectPerPage){for(;this.selectPerPage.lastChild;)this.selectPerPage.removeChild(this.selectPerPage.lastChild);this.options.perPageValues.forEach(t=>{X(this.selectPerPage,t,t,t===this.options.perPage)})}}_connected(){this.table=this.querySelector("table"),this.btnFirst=this.querySelector(".dg-btn-first"),this.btnPrev=this.querySelector(".dg-btn-prev"),this.btnNext=this.querySelector(".dg-btn-next"),this.btnLast=this.querySelector(".dg-btn-last"),this.selectPerPage=this.querySelector(".dg-select-per-page"),this.inputPage=this.querySelector(".dg-input-page"),this.getFirst=this.getFirst.bind(this),this.getPrev=this.getPrev.bind(this),this.getNext=this.getNext.bind(this),this.getLast=this.getLast.bind(this),this.changePerPage=this.changePerPage.bind(this),this.gotoPage=this.gotoPage.bind(this),this.btnFirst.addEventListener("click",this.getFirst),this.btnPrev.addEventListener("click",this.getPrev),this.btnNext.addEventListener("click",this.getNext),this.btnLast.addEventListener("click",this.getLast),this.selectPerPage.addEventListener("change",this.changePerPage),this.selectPerPage.toggleAttribute("hidden",this.options.hidePerPage),this.inputPage.addEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.connected()}),this.dirChanged(),this.perPageValuesChanged(),this.loadData().finally(()=>{this.configureUi(),this.sortChanged(),this.classList.add("dg-initialized"),this.filterChanged(),this.reorderChanged(),this.dirChanged(),this.perPageValuesChanged(),this.pageChanged(),this.fireEvents=!0,this.log("initialized")})}_disconnected(){this.btnFirst.removeEventListener("click",this.getFirst),this.btnPrev.removeEventListener("click",this.getPrev),this.btnNext.removeEventListener("click",this.getNext),this.btnLast.removeEventListener("click",this.getLast),this.selectPerPage.removeEventListener("change",this.changePerPage),this.inputPage.removeEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.disconnected()})}getCol(t){let e=null;return this.options.columns.forEach(i=>{i.field==t&&(e=i)}),e}getColProp(t,e){let i=this.getCol(t);return i?i[e]:null}setColProp(t,e,i){let s=this.getCol(t);s&&(s[e]=i)}visibleColumns(){return this.options.columns.filter(t=>!t.hidden)}hiddenColumns(){return this.options.columns.filter(t=>t.hidden===!0)}showColumn(t,e=!0){this.setColProp(t,"hidden",!1),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"visible"})}hideColumn(t,e=!0){this.setColProp(t,"hidden",!0),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"hidden"})}startColIndex(){let t=1;return this.options.selectable&&this.plugins.SelectableRows&&t++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&t++,t}isSticky(){return this.hasAttribute("sticky")}columnsLength(t=!1){let e=0;return this.options.columns.forEach(i=>{t&&i.hidden||i.attr||e++}),this.options.selectable&&this.plugins.SelectableRows&&e++,this.options.actions.length&&this.plugins.RowActions&&e++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&e++,e}configureUi(){if(d(this.querySelector("table"),"aria-rowcount",this.data.length),this.table.style.visibility="hidden",this.renderTable(),this.options.responsive&&this.plugins.ResponsiveGrid||(this.table.style.visibility="visible"),!this.rowHeight){let t=T(this,"tbody tr")||T(this,"table tr");t&&(this.rowHeight=t.offsetHeight)}}filterChanged(){let t=this.querySelector("thead tr.dg-head-filters");this.options.filter?S(t,"hidden"):(this.clearFilters(),d(t,"hidden",""))}reorderChanged(){f(this,"thead tr.dg-head-columns th").forEach(e=>{e.classList.contains("dg-selectable")||e.classList.contains("dg-actions")||(this.options.reorder&&this.plugins.DraggableHeaders?e.draggable=!0:e.removeAttribute("draggable"))})}sortChanged(){this.log("toggle sort"),this.querySelectorAll("thead tr.dg-head-columns th").forEach(t=>{let e=t.getAttribute("field");t.classList.contains("dg-not-sortable")||!this.fireEvents&&e==this.options.defaultSort||(this.options.sort&&!this.getColProp(e,"noSort")?d(t,"aria-sort","none"):S(t,"aria-sort"))})}selectableChanged(){this.renderTable()}addRow(t){Array.isArray(this.originalData)&&(this.log("Add row"),this.originalData.push(t),this.data=this.originalData.slice(),this.sortData())}removeRow(t=null,e=null){if(Array.isArray(this.originalData)){e===null&&(e=this.options.columns[0].field),t===null&&(t=this.originalData[this.originalData.length-1][e]),this.log("Removing "+e+":"+t);for(let i=0;i{this.options.server||e?this.renderBody():this.paginate(),t&&t()})}loadData(){let t=()=>!this.data.length&&this.classList.add("dg-empty"),e=this.querySelector("tbody");return(this.meta||this.originalData||this.classList.contains("dg-initialized"))&&(!this.options.server||this.options.server&&!this.fireEvents)?(this.log("skip loadData"),t(),new Promise(i=>{i()})):(this.log("loadData"),this.loading=!0,this.classList.add("dg-loading"),this.classList.remove("dg-empty","dg-network-error"),this.fetchData().then(i=>{if(Array.isArray(i))this.data=i;else{if(!i[this.options.serverParams.dataKey]){console.error("Invalid response, it should contain a data key with an array or be a plain array",i),this.options.url=null;return}this.options=Object.assign(this.options,i[this.options.serverParams.optionsKey]??{}),this.meta=i[this.options.serverParams.metaKey]??{},this.data=i[this.options.serverParams.dataKey]}this.originalData=this.data.slice(),this.fixPage(),this.options.columns.length===0&&this.originalData.length?this.options.columns=this.convertColumns(Object.keys(this.originalData[0])):this.options.columns=this.convertColumns(this.options.columns)}).catch(i=>{this.log(i),i.message&&e.setAttribute("data-empty",i.message.replace(/^\s+|\r\n|\n|\r$/g,"")),this.classList.add("dg-empty","dg-network-error")}).finally(()=>{t(),!this.classList.contains("dg-network-error")&&e.getAttribute("data-empty")!=this.labels.noData&&e.setAttribute("data-empty",this.labels.noData),this.classList.remove("dg-loading"),this.loading=!1}))}getFirst(){this.loading||(this.page=1)}getLast(){this.loading||(this.page=this.pages)}getPrev(){this.loading||(this.page=this.page-1)}getNext(){this.loading||(this.page=this.page+1)}gotoPage(t){if(t.type==="keypress"){let e=t.keyCode||t.key;if(e===13||e==="Enter")t.preventDefault();else return}this.page=parseInt(this.inputPage.value)}getSort(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t?t.getAttribute("field"):this.options.defaultSort}getSortDir(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t&&t.getAttribute("aria-sort")||""}getFilters(){let t=[];return f(this,this.#t).forEach(i=>{t[i.dataset.name]=i.value}),t}clearFilters(){f(this,this.#t).forEach(e=>{e.value=""}),this.filterData()}filterData(){if(this.log("filter data"),this.page=1,this.options.server)this.reload();else{this.data=this.originalData?.slice()??[],f(this,this.#t).forEach(i=>{let s=i.value;if(s){let o=i.dataset.name;this.data=this.data.filter(r=>(r[o]+"").toLowerCase().indexOf(s.toLowerCase())!==-1)}}),this.pageChanged();let e=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");this.options.sort&&e?this.sortData():this.renderBody()}}sortData(t=null){if(this.log("sort data"),t&&this.getColProp(t.getAttribute("field"),"noSort")){this.log("sorting prevented because column is not sortable");return}if(this.plugins.ColumnResizer&&this.plugins.ColumnResizer.isResizing){this.log("sorting prevented because resizing");return}if(this.loading){this.log("sorting prevented because loading");return}if(t!==null){let e=i=>["dg-selectable","dg-actions","dg-responsive-toggle"].includes(i);this.querySelectorAll("thead tr:first-child th").forEach(i=>{[...i.classList].some(e)||i!==t&&i.setAttribute("aria-sort","none")}),!t.hasAttribute("aria-sort")||t.getAttribute("aria-sort")==="none"?t.setAttribute("aria-sort","ascending"):t.getAttribute("aria-sort")==="ascending"?t.setAttribute("aria-sort","descending"):t.getAttribute("aria-sort")==="descending"&&t.setAttribute("aria-sort","none")}else t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");if(this.options.server)this.loadData().finally(()=>{this.renderBody()});else{let e=t?t.getAttribute("aria-sort"):"none";if(e==="none"){let i=[];this.originalData?.some(s=>(this.data.some(o=>JSON.stringify(s)===JSON.stringify(o)?(i.push(o),!0):!1),i.length===this.data.length)),this.data=i}else{let i=t.getAttribute("field");this.data.sort((s,o)=>{if(!isNaN(s[i])&&!isNaN(o[i]))return e==="ascending"?s[i]-o[i]:o[i]-s[i];let r=e==="ascending"?s[i].toUpperCase():o[i].toUpperCase(),l=e==="ascending"?o[i].toUpperCase():s[i].toUpperCase();switch(!0){case r>l:return 1;case ro("No url set"));let t=window.location.href;t.split("/").pop().includes(".")||(t+=t.endsWith("/")?"":"/");let e=new URL(this.options.url,t),i={r:Date.now()};return this.options.server&&(i[this.options.serverParams.start]=this.page-1,i[this.options.serverParams.length]=this.options.perPage,this.options.filter&&(i[this.options.serverParams.search]=this.getFilters()),i[this.options.serverParams.sort]=this.getSort()||"",i[this.options.serverParams.sortDir]=this.getSortDir(),this.meta?.[this.options.serverParams.paramsKey]&&(i=Object.assign(i,this.meta[this.options.serverParams.paramsKey]))),Y(e,i),fetch(e).then(s=>{if(!s.ok)throw new Error(s.statusText||C.networkError);return s.json()})}renderTable(){this.log("render table"),this.options.menu&&this.plugins.ContextMenu&&this.plugins.ContextMenu.createMenu();let t;this.renderHeader(),this.options.defaultSort&&(t=this.querySelector("thead tr.dg-head-columns th[field='"+this.options.defaultSort+"']")),t?this.sortData(t):this.renderBody(),this.renderFooter()}renderHeader(){this.log("render header");let t=this.querySelector("thead");this.createColumnHeaders(t),this.createColumnFilters(t),this.options.resizable&&this.plugins.ColumnResizer&&this.plugins.ColumnResizer.renderResizer(C.resizeColumn),y(this,"headerRendered")}renderFooter(){this.log("render footer");let t=this.querySelector("tfoot"),e=t.querySelector("td");t.removeAttribute("hidden"),d(e,"colspan",this.columnsLength(!0)),t.style.display=""}createColumnHeaders(t){let e=this.clientWidth,i=Math.round(e/this.columnsLength(!0)*2),s=0,o;o=x("tr"),this.headerRow=o,o.setAttribute("role","row"),o.setAttribute("aria-rowindex","1"),o.setAttribute("class","dg-head-columns");let r=t.querySelector("tr.dg-head-columns th");r||(r=x("th"),t.querySelector("tr").appendChild(r)),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createHeaderCol(o),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createHeaderCol(o),s=0;let l=0;if(this.options.columns.forEach(a=>{if(a.attr)return;let c=s+this.startColIndex(),h=x("th");h.setAttribute("scope","col"),h.setAttribute("role","columnheader button"),h.setAttribute("aria-colindex",""+c),h.setAttribute("id",G("dg-col-")),this.options.sort&&h.setAttribute("aria-sort","none"),h.setAttribute("field",a.field),this.plugins.ResponsiveGrid&&this.options.responsive&&d(h,"data-responsive",a.responsive||"");let u=O(a.title,r,!0)+20;h.dataset.minWidth=""+u,bt(h,a),h.tabIndex=0,h.textContent=a.title;let g=0;if(this.options.autosize&&this.plugins.AutosizeColumn){let m=Math.min(e-l,i);g=this.plugins.AutosizeColumn.computeSize(h,a,parseInt(h.dataset.minWidth),m)}else g=Math.max(parseInt(h.dataset.minWidth),parseInt(h.getAttribute("width")));d(h,"width",g),a.hidden?h.setAttribute("hidden",""):l+=g,this.options.reorder&&this.plugins.DraggableHeaders&&this.plugins.DraggableHeaders.makeHeaderDraggable(h),o.appendChild(h),s++}),le){this.log(`adjust width to fix size, ${t.offsetWidth} > ${e}`);let a=this.offsetWidth-this.clientWidth,c=t.offsetWidth-e-a;this.options.responsive&&this.plugins.ResponsiveGrid&&(c+=a),f(o,"th[width]").forEach(u=>{if(I(u,"dg-not-resizable")||c<=0)return;let g=parseInt(u.getAttribute("width")),m=u.dataset.minWidth?parseInt(u.dataset.minWidth):0;if(g>m){let v=g-c;v{a.addEventListener("click",()=>this.sortData(a))}),d(this.querySelector("table"),"aria-colcount",this.columnsLength(!0))}createColumnFilters(t){let e=0,i;i=x("tr"),this.filterRow=i,i.setAttribute("role","row"),i.setAttribute("aria-rowindex","2"),i.setAttribute("class","dg-head-filters"),this.options.filter||i.setAttribute("hidden",""),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createFilterCol(i),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createFilterCol(i),this.options.columns.forEach(s=>{if(s.attr)return;let o=e+this.startColIndex(),r=t.querySelector("tr.dg-head-columns th[aria-colindex='"+o+"']");if(!r){console.warn("Related th not found",o);return}let l=x("th");l.setAttribute("aria-colindex",""+o);let a=this.createFilterElement(s,r);this.options.filter?a.tabIndex=0:l.tabIndex=0,s.hidden&&l.setAttribute("hidden",""),l.appendChild(a),i.appendChild(l),e++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionFilter(i),t.replaceChild(i,t.querySelector("tr.dg-head-filters")),i.querySelectorAll(this.#t).forEach(s=>{let o=/select/i.test(s.tagName)?"change":"keyup";s.addEventListener(o,r=>{let l=r.keyCode||r.key;(l===13||l==="Enter"||!this.options.filterOnEnter||r.type=="change")&&this.filterData.call(this)})})}createFilterElement(t,e){let i=t.filterType=="select",s=i?x("select"):x("input");if(i){if(!Array.isArray(t.filterList)){let o=[...new Set((this.data??[]).map(r=>r[t.field]))].filter(r=>!!r).sort();t.filterList=[t.firstFilterOption||this.defaultColumn.firstFilterOption].concat(o.map(r=>({value:r,text:r})))}t.filterList.forEach(o=>{let r=x("option");r.value=o.value,r.text=o.text,s.add(r)})}else s.type="text",s.inputMode="search",s.autocomplete="off",s.spellcheck=!1;return s.dataset.name=t.field,s.id=G("dg-filter-"),s.setAttribute("aria-labelledby",e.getAttribute("id")),s}renderBody(){this.log("render body");let t,e,i,s=x("tbody");this.data.forEach((r,l)=>{t=x("tr"),d(t,"role","row"),d(t,"hidden",""),d(t,"aria-rowindex",l+1),t.tabIndex=0,this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createDataCol(t),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createDataCol(t),this.options.expand&&(t.classList.add("dg-expandable"),w(t,"click",a=>{this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.blockObserver(),pt(a.currentTarget,"dg-expanded"),this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.unblockObserver()})),i=0,this.options.columns.forEach(a=>{if(a||console.error("Empty column found!",this.options.columns),a.attr){r[a.field]&&(a.attr==="class"?L(t,r[a.field]):t.setAttribute(a.attr,r[a.field]));return}if(e=x("td"),e.setAttribute("role","gridcell"),e.setAttribute("aria-colindex",i+this.startColIndex()),bt(e,a),e.setAttribute("data-name",a.title),e.tabIndex=-1,a.editable&&this.plugins.EditableColumn)L(e,"dg-editable-col"),this.plugins.EditableColumn.makeEditableInput(e,a,r,l);else{let c=r[a.field]??"",h;switch(a.transform){case"uppercase":h=c.toUpperCase();break;case"lowercase":h=c.toLowerCase();break;default:h=c;break}if(a.format){if(a.defaultFormatValue!=null&&(h===""||h===null)&&(h=a.defaultFormatValue+""),typeof a.format=="string"&&h)e.innerHTML=N(a.format,Object.assign({_v:c,_tv:h},r));else if(a.format instanceof Function){let u=a.format.call(this,{column:a,rowData:r,cellData:h,td:e,tr:t});e.innerHTML=u||h||c}}else e.textContent=h}t.appendChild(e),i++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionRow(t,r),s.appendChild(t)}),s.setAttribute("role","rowgroup");let o=this.querySelector("tbody");s.setAttribute("data-empty",o.getAttribute("data-empty")),this.querySelector("table").replaceChild(s,o),this.plugins.FixedHeight&&this.plugins.FixedHeight.createFakeRow(),this.paginate(),this.plugins.SelectableRows&&this.plugins.SelectableRows.shouldSelectAll(s),this.data.length&&this.classList.remove("dg-empty"),y(this,"bodyRendered")}paginate(){this.log("paginate");let t=this.totalRecords(),e=this.page||1,i,s=e*this.options.perPage,o=s-this.options.perPage+1,r=this.querySelector("tbody"),l=this.querySelector("tfoot");s>t&&(s=t),t||(o=0),r.querySelectorAll("tr").forEach(a=>{if(this.options.server){S(a,"hidden");return}i=Number(k(a,"aria-rowindex")),i>s||i=this.pages,this.btnLast.disabled=this.page>=this.pages),l.querySelector(".dg-low").textContent=o.toString(),l.querySelector(".dg-high").textContent=s.toString(),l.querySelector(".dg-total").textContent=""+this.totalRecords(),l.toggleAttribute("hidden",this.options.autohidePager&&this.options.perPage>this.totalRecords())}totalPages(){return Math.ceil(this.totalRecords()/this.options.perPage)}totalRecords(){return this.options.server?this.meta?.[this.options.serverParams.metaFilteredKey]||0:this.data.length}},_=Z;var Q=class{constructor(t){this.grid=t}connected(){}disconnected(){}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}},b=Q;var tt=class extends b{constructor(t){super(t),this.isResizing=!1}renderResizer(t){let e=this.grid,i=e.table,s=f(e,"thead tr.dg-head-columns th");s.forEach(o=>{if(I(o,"dg-not-resizable"))return;let r=document.createElement("div");L(r,"dg-resizer"),r.ariaLabel=t,o.appendChild(r);let l=0,a=0,c=0,h=0,u=m=>{if(m.clientX>h)return;let v=a+(m.clientX-l);o.dataset.minWidth&&v>parseInt(o.dataset.minWidth)&&d(o,"width",v)},g=()=>{e.log("resized column"),setTimeout(()=>{this.isResizing=!1},0),q(r,"dg-resizer-active"),e.options.reorder&&(o.draggable=!0),o.style.overflow="hidden",W(document,"mousemove",u),W(document,"mouseup",g),y(e,"columnResized",{col:k(o,"field"),width:k(o,"width")})};w(r,"click",m=>{m.stopPropagation()}),w(r,"mousedown",m=>{m.stopPropagation(),this.isResizing=!0;let v=m.target,P=f(e,"dg-head-columns th").filter(p=>!p.hasAttribute("hidden")),A=P.findIndex(p=>p==v.parentNode);e.log("resize column"),L(r,"dg-resizer-active"),S(o,"draggable"),o.style.overflow="visible",r.style.height=i.offsetHeight-1+"px",l=m.clientX,a=o.offsetWidth,c=(P.length-A)*30,h=J(v).left+e.offsetWidth-c,d(o,"width",a);for(let p=0;pA&&S(s[p],"width");w(document,"mousemove",u),w(document,"mouseup",g)})})}},vt=tt;function B(n,t,e="nodeName"){let i=n;for(;i[e]!=t;)i=i.parentElement;return i}var et=class extends b{connected(){this.menu=this.grid.querySelector(".dg-menu")}disconnected(){this.grid.headerRow&&W(this.grid.headerRow,"contextmenu",this)}attachContextMenu(){let t=this.grid;w(t.headerRow,"contextmenu",this)}onchange(t){let e=this.grid,i=t.target,s=i.dataset.name;if(i.checked)e.showColumn(s);else{if(e.visibleColumns().length<=1){i.checked=!0;return}e.hideColumn(s)}}oncontextmenu(t){t.preventDefault();let e=this.grid,i=B(t.target,"THEAD"),s=this.menu,o=i.getBoundingClientRect(),r=t.clientX-o.left,l=t.clientY-o.top;s.style.top=`${l}px`,s.style.left=`${r}px`,S(s,"hidden"),r+150>o.width&&(r-=s.offsetWidth,s.style.left=`${r}px`);let a=c=>{s.contains(c.target)||(d(s,"hidden",""),W(document,"click",a))};w(document,"click",a)}createMenu(){let t=this.grid,e=this.menu;for(;e.lastChild;)e.removeChild(e.lastChild);e.addEventListener("change",this),t.options.columns.forEach(i=>{if(i.attr)return;let s=document.createElement("li"),o=document.createElement("label"),r=document.createElement("input");d(r,"type","checkbox"),d(r,"data-name",i.field),i.hidden||(r.checked=!0);let l=document.createTextNode(i.title);o.appendChild(r),o.appendChild(l),s.appendChild(o),e.appendChild(s)})}},xt=et;var it=class extends b{makeHeaderDraggable(t){let e=this.grid;t.draggable=!0,w(t,"dragstart",i=>{if(e.plugins.ColumnResizer&&e.plugins.ColumnResizer.isResizing&&i.preventDefault){i.preventDefault();return}e.log("reorder col"),i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",i.target.getAttribute("aria-colindex"))}),w(t,"dragover",i=>(i.preventDefault&&i.preventDefault(),i.dataTransfer.dropEffect="move",!1)),w(t,"drop",i=>{i.stopPropagation&&i.stopPropagation();let s=i.target,o=B(s,"TH"),r=parseInt(i.dataTransfer.getData("text/plain")),l=parseInt(o.getAttribute("aria-colindex"));if(r===l){e.log("reordered col stayed the same");return}e.log("reordered col from "+r+" to "+l);let a=e.startColIndex(),c=e.options.columns[r-a];e.options.columns[r-a]=e.options.columns[l-a],e.options.columns[l-a]=c;let h=(u,g)=>{let m=g.parentNode.getAttribute("aria-rowindex"),v=e.querySelector(u+" tr[aria-rowindex='"+m+"'] [aria-colindex='"+l+"']");d(g,"aria-colindex",l),d(v,"aria-colindex",r);let R=document.createElement("th");g.parentNode.insertBefore(R,g),v.parentNode.replaceChild(g,v),R.parentNode.replaceChild(v,R)};return f(e,"thead th[aria-colindex='"+r+"']").forEach(u=>{h("thead",u)}),f(e,'tbody td[aria-colindex="'+r+'"]').forEach(u=>{h("tbody",u)}),e.options.columns=f(e,"thead tr.dg-head-columns th[field]").map(u=>e.options.columns.find(g=>g.field==k(u,"field"))),y(e,"columnReordered",{col:c.field,from:r,to:l}),!1})}},yt=it;var st=class extends b{constructor(t){super(t),this.touch=null}connected(){let t=this.grid;t.addEventListener("touchstart",this,{passive:!0}),t.addEventListener("touchmove",this,{passive:!0})}disconnected(){let t=this.grid;t.removeEventListener("touchstart",this),t.removeEventListener("touchmove",this)}ontouchstart(t){this.touch=t.touches[0]}ontouchmove(t){if(!this.touch)return;let e=this.grid,i=this.touch.clientX-t.touches[0].clientX,s=this.touch.clientY-t.touches[0].clientY;Math.abs(i)>Math.abs(s)&&(i>0?e.getNext():e.getPrev()),this.touch=null}},Ct=st;var z="dg-selectable",At="dg-select-all",Pt="form-check-input",rt=class extends b{disconnected(){this.selectAll&&this.selectAll.removeEventListener("change",this)}getSelection(t=null){let e=this.grid,i=[];return f(e,`tbody .${z} input:checked`).forEach(o=>{let r=parseInt(o.dataset.id),l=e.data[r-1];l||console.warn(`Item ${r} not found`),t?i.push(l[t]):i.push(l)}),i}clearCheckboxes(t){if(!this.grid.options.selectVisibleOnly)return;f(t,`tr[hidden] .${z} input`).forEach(s=>{s.checked=!1}),this.selectAll.checked=!1}colIndex(){return this.grid.startColIndex()-2}createHeaderCol(t){let e=document.createElement("th");d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0,this.selectAll=document.createElement("input"),this.selectAll.type="checkbox",this.selectAll.classList.add(At),this.selectAll.classList.add(Pt),this.selectAll.addEventListener("change",this);let i=document.createElement("label");i.appendChild(this.selectAll),e.appendChild(i),e.setAttribute("width","40"),t.appendChild(e)}createFilterCol(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z),e.tabIndex=0,t.appendChild(e)}shouldSelectAll(t){this.selectAll&&(t.addEventListener("change",this),t.dispatchEvent(new Event("change")))}createDataCol(t){let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z);let i=document.createElement("input");i.dataset.id=t.getAttribute("aria-rowindex"),i.type="checkbox",i.classList.add(Pt);let s=document.createElement("label");s.classList.add("dg-clickable-cell"),s.appendChild(i),e.appendChild(s),s.addEventListener("click",this),t.appendChild(e)}onclick(t){t.stopPropagation()}onchange(t){let e=this.grid;if(I(t.target,At)){let i=e.options.selectVisibleOnly;f(e,`tbody .${z} input`).forEach(o=>{i&&!o.offsetWidth||(o.checked=this.selectAll.checked)}),y(e,"rowsSelected",{selection:this.getSelection()})}else{if(!t.target.closest(`.${z}`))return;let i=f(e,`tbody .${z} input[type=checkbox]`),s=i.filter(o=>o.checked);this.selectAll.checked=s.length==i.length,y(e,"rowsSelected",{selection:e.getSelection()})}}},wt=rt;var nt=class extends b{constructor(t){super(t),this.hasFixedHeight=!1,t.style.height&&(t.style.overflowY="auto",this.hasFixedHeight=!0)}createFakeRow(){let e=this.grid.querySelector("tbody"),i=document.createElement("tr");d(i,"role","row"),d(i,"hidden",""),i.classList.add("dg-fake-row"),i.tabIndex=0,e.appendChild(i)}get fakeRow(){return this.grid.querySelector(".dg-fake-row")}updateFakeRow(){let t=this.grid,e=this.fakeRow;if(!e||t.options.perPage>t.totalRecords()||t.page!==t.totalPages()||!t.options.autoheight)return;let i=t.options.perPage*t.rowHeight,s=t.querySelectorAll("tbody tr:not([hidden])").length,o=s>1?i-s*t.rowHeight:i;o>0?(d(e,"height",o),e.removeAttribute("hidden")):e.removeAttribute("height")}},Et=nt;var ot=class extends b{computeSize(t,e,i,s){let o=this.grid;if(V(t,"width"))return k(t,"width");if(!o.data.length)return;let r=o.data[0],l=o.data[o.data.length-1],a=r[e.field]?r[e.field].toString():"",c=l[e.field]?l[e.field].toString():"";c.length>a.length&&(a=c);let h=0;return a.length<=6?h=i:a.length>50?h=s:h=O(a+"0000",t),h>s&&(h=s),h{clearTimeout(e),e=setTimeout(()=>{e=null,n(...i)},t)}}var E="dg-responsive",lt;function zt(n){return n.sort((t,e)=>{let i=parseInt(t.dataset.responsive)||1;return(parseInt(e.dataset.responsive)||1)-i})}var Ot=at(n=>{for(let t of n){let e=t.target,i=e.table;if(e.plugins.ResponsiveGrid.observerBlocked)return;let s=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,o=parseInt(s.inlineSize),r=i.offsetWidth,l=f(e.headerRow,"th").reduce((P,A)=>P+A.offsetWidth,0),a=(l||r)-o-1,c=50,h=e.plugins.ResponsiveGrid.prevAction,u=zt(f(e.headerRow,"th[field]").reverse().filter(P=>P.dataset.responsive!=="0")),g=!1;if(e.log(`table is ${r}/${l} and available size is ${o}. Diff: ${a}`),a>0){if(h==="show")return;e.plugins.ResponsiveGrid.prevAction="hide";let P=a,A=u.filter(p=>!p.hasAttribute("hidden")&&p.hasAttribute("data-responsive"));if(A.length===0&&(A=u.filter(p=>!p.hasAttribute("hidden")),A.length===1))return;A.forEach(p=>{if(P<0)return;let $=p.offsetWidth,D=p.getAttribute("field");D&&(p.dataset.baseWidth=""+p.offsetWidth,e.hideColumn(D,!1),e.setColProp(D,"responsiveHidden",!0),g=!0,P-=$,P=Math.round(P))})}else{if(h==="hide")return;e.plugins.ResponsiveGrid.prevAction="show";let P=u.filter(p=>!p.hasAttribute("hidden")).reduce((p,$)=>{let D=$.dataset.minWidth?parseInt($.dataset.minWidth):$.offsetWidth;return p+D},0)+c,A=o-P;u.slice().reverse().filter(p=>p.hasAttribute("hidden")).forEach(p=>{if(AA){A=-1;return}let D=p.getAttribute("field");D&&(e.showColumn(D,!1),e.setColProp(D,"responsiveHidden",!1),g=!0,A-=$,A=Math.round(A))})}let m=T(e.table,"tfoot"),v=f(e.table,".dg-footer > div").reduce((P,A)=>P+A.offsetWidth,0),R=m.offsetWidth-v;v>o?L(m,"dg-footer-compact"):R>250&&q(m,"dg-footer-compact"),g&&e.renderTable(),setTimeout(()=>{e.plugins.ResponsiveGrid.prevAction=null},1e3),e.table.style.visibility="visible"}},100),Lt=new ResizeObserver(Ot),dt=class extends b{constructor(t){super(t),this.observerBlocked=!1,this.prevAction=null}connected(){this.grid.options.responsive&&this.observe()}disconnected(){this.unobserve()}observe(){this.grid.options.responsive&&(Lt.observe(this.grid),this.grid.style.display="block",this.grid.style.overflowX="hidden")}unobserve(){Lt.unobserve(this.grid),this.grid.style.display="unset",this.grid.style.overflowX="unset"}blockObserver(){this.observerBlocked=!0,lt&&clearTimeout(lt)}unblockObserver(){lt=setTimeout(()=>{this.observerBlocked=!1},200)}hasHiddenColumns(){let t=!1;return this.grid.options.columns.forEach(e=>{e.responsiveHidden&&(t=!0)}),t}colIndex(){return this.grid.startColIndex()-1}createHeaderCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),d(e,"width","40"),e.classList.add(`${E}-toggle`,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0}createFilterCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.tabIndex=0}createDataCol(t){if(!this.grid.options.responsiveToggle)return;let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.innerHTML=`
`,t.appendChild(e),e.addEventListener("click",this),e.addEventListener("mousedown",this)}computeLabelWidth(){let t=0,e=0;for(;t<120;){e++;let i=T(this.grid,`.dg-head-columns th[aria-colindex="${e}"]`);if(i)t+=i.offsetWidth;else break}return t}onmousedown(t){t.preventDefault()}onclick(t){t.stopPropagation();let e=t.currentTarget,i=e.parentElement,s=T(e,`.${E}-open`),o=T(e,`.${E}-close`);if(this.blockObserver(),$(i,`${E}-expanded`)){F(i,`${E}-expanded`),s.style.display="unset",o.style.display="none";let l=i.nextElementSibling;f(l,`.${E}-hidden`).forEach(c=>{i.appendChild(c),d(c,"hidden")}),l.parentElement.removeChild(l)}else{L(i,`${E}-expanded`),s.style.display="none",o.style.display="unset";let l=x("tr");pt(l,i),L(l,`${E}-child-row`);let a=x("td",l);d(a,"colspan",this.grid.columnsLength(!0));let c=x("table",a);L(c,`${E}-table`);let h=f(i,`.${E}-hidden`),u=this.computeLabelWidth();h.forEach(g=>{let m=x("tr",c),v=g.dataset.name,R=x("th",m);R.style.width=`${u}px`,R.innerHTML=v,m.appendChild(g),S(g,"hidden")})}this.unblockObserver()}},Lt=lt;var dt=class extends b{hasActions(){return this.grid.options.actions.length>0}makeActionHeader(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.grid.columnsLength(!0)),e.classList.add("dg-actions","dg-not-sortable","dg-not-resizable",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionFilter(t){let e=document.createElement("th");e.setAttribute("role","columnheader button"),e.setAttribute("aria-colindex",""+this.grid.columnsLength(!0)),e.classList.add("dg-actions",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionRow(t,e){let i=this.grid.labels,s=document.createElement("td");d(s,"role","gridcell"),d(s,"aria-colindex",this.grid.columnsLength(!0)),s.classList.add("dg-actions",this.actionClass),s.tabIndex=0;let o=document.createElement("button");o.classList.add("dg-actions-toggle"),o.innerHTML="\u2630",s.appendChild(o),w(o,"click",r=>{r.stopPropagation(),r.target.parentElement.classList.toggle("dg-actions-expand")}),this.grid.options.actions.forEach(r=>{let l=document.createElement("button");r.html?l.innerHTML=r.html:l.innerText=r.title??r.name,r.title&&(l.title=r.title),r.url&&(l.type="submit",l.formAction=q(r.url,e)),r.class&&l.classList.add(...r.class.split(" "));let a=c=>{if(c.stopPropagation(),r.confirm&&!confirm(i.areYouSure)){c.preventDefault();return}y(this.grid,"action",{data:e,action:r.name})};l.addEventListener("click",a),s.appendChild(l),r.default&&(t.classList.add("dg-actionable"),t.addEventListener("click",a))}),t.appendChild(s)}get actionClass(){return this.grid.options.actions.length<3&&!this.grid.options.collapseActions?"dg-actions-"+this.grid.options.actions.length:"dg-actions-more"}},kt=dt;var ht=class extends b{makeEditableInput(t,e,i,s){let o=this.grid.getAttribute("id"),r=document.createElement("input");r.type=e.editableType||"text",r.type=="email"&&(r.inputMode="email"),r.type=="decimal"&&(r.type="text",r.inputMode="decimal"),r.autocomplete="off",r.spellcheck=!1,r.tabIndex=0,r.classList.add("dg-editable"),r.name=o.replace("-","_")+"["+(s+1)+"]["+e.field+"]",r.value=i[e.field],r.dataset.field=e.field,r.addEventListener("click",l=>l.stopPropagation()),r.addEventListener("keypress",l=>{if(l.type==="keypress"){let a=l.keyCode||l.key;(a===13||a==="Enter")&&(r.blur(),l.preventDefault())}}),r.addEventListener("blur",()=>{r.value!=i[r.dataset.field]&&(i[r.dataset.field]=r.value,y(this.grid,"edit",{data:i,value:r.value}))}),t.appendChild(r)}},Rt=ht;var ct=class extends b{add(){let t=this.grid;if(!t.options.showSpinner)return;let i=t.options.spinnerCssClasses,s=i.split(" ").map(r=>`.${r}`).join(""),o=` +
`,t.appendChild(e),e.addEventListener("click",this),e.addEventListener("mousedown",this)}computeLabelWidth(){let t=0,e=0;for(;t<120;){e++;let i=T(this.grid,`.dg-head-columns th[aria-colindex="${e}"]`);if(i)t+=i.offsetWidth;else break}return t}onmousedown(t){t.preventDefault()}onclick(t){t.stopPropagation();let e=t.currentTarget,i=e.parentElement,s=T(e,`.${E}-open`),o=T(e,`.${E}-close`);if(this.blockObserver(),I(i,`${E}-expanded`)){q(i,`${E}-expanded`),s.style.display="unset",o.style.display="none";let l=i.nextElementSibling;f(l,`.${E}-hidden`).forEach(c=>{i.appendChild(c),d(c,"hidden")}),l.parentElement.removeChild(l)}else{L(i,`${E}-expanded`),s.style.display="none",o.style.display="unset";let l=x("tr");ft(l,i),L(l,`${E}-child-row`);let a=x("td",l);d(a,"colspan",this.grid.columnsLength(!0));let c=x("table",a);L(c,`${E}-table`);let h=f(i,`.${E}-hidden`),u=this.computeLabelWidth();h.forEach(g=>{let m=x("tr",c),v=g.dataset.name,R=x("th",m);R.style.width=`${u}px`,R.innerHTML=v,m.appendChild(g),S(g,"hidden")})}this.unblockObserver()}},kt=dt;var ht=class extends b{hasActions(){return this.grid.options.actions.length>0}makeActionHeader(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.grid.columnsLength(!0)),e.classList.add("dg-actions","dg-not-sortable","dg-not-resizable",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionFilter(t){let e=document.createElement("th");e.setAttribute("role","columnheader button"),e.setAttribute("aria-colindex",""+this.grid.columnsLength(!0)),e.classList.add("dg-actions",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionRow(t,e){let i=this.grid.labels,s=document.createElement("td");d(s,"role","gridcell"),d(s,"aria-colindex",this.grid.columnsLength(!0)),s.classList.add("dg-actions",this.actionClass),s.tabIndex=0;let o=document.createElement("button");o.classList.add("dg-actions-toggle"),o.innerHTML="\u2630",s.appendChild(o),w(o,"click",r=>{r.stopPropagation(),r.target.parentElement.classList.toggle("dg-actions-expand")}),this.grid.options.actions.forEach(r=>{let l=document.createElement("button");r.html?l.innerHTML=r.html:l.innerText=r.title??r.name,r.title&&(l.title=r.title),r.url&&(l.type="submit",l.formAction=N(r.url,e)),r.class&&l.classList.add(...r.class.split(" "));let a=c=>{if(c.stopPropagation(),r.confirm&&!confirm(i.areYouSure)){c.preventDefault();return}y(this.grid,"action",{data:e,action:r.name})};l.addEventListener("click",a),s.appendChild(l),r.default&&(t.classList.add("dg-actionable"),t.addEventListener("click",a))}),t.appendChild(s)}get actionClass(){return this.grid.options.actions.length<3&&!this.grid.options.collapseActions?"dg-actions-"+this.grid.options.actions.length:"dg-actions-more"}},Rt=ht;var ct=class extends b{makeEditableInput(t,e,i,s){let o=this.grid.getAttribute("id"),r=document.createElement("input");r.type=e.editableType||"text",r.type=="email"&&(r.inputMode="email"),r.type=="decimal"&&(r.type="text",r.inputMode="decimal"),r.autocomplete="off",r.spellcheck=!1,r.tabIndex=0,r.classList.add("dg-editable"),r.name=o.replace("-","_")+"["+(s+1)+"]["+e.field+"]",r.value=i[e.field],r.dataset.field=e.field,r.addEventListener("click",l=>l.stopPropagation()),r.addEventListener("keypress",l=>{if(l.type==="keypress"){let a=l.keyCode||l.key;(a===13||a==="Enter")&&(r.blur(),l.preventDefault())}}),r.addEventListener("blur",()=>{r.value!=i[r.dataset.field]&&(i[r.dataset.field]=r.value,y(this.grid,"edit",{data:i,value:r.value}))}),t.appendChild(r)}},Dt=ct;var ut=class extends b{add(){let t=this.grid;if(!t.options.showSpinner)return;let i=t.options.spinnerCssClasses,s=i.split(" ").map(r=>`.${r}`).join(""),o=` -`;if(!document.getElementById("dg-styles")){let r=document.querySelector("head")??document.querySelector("body"),l=/head/i.test(r.tagName)?"beforeend":"afterbegin";r.insertAdjacentHTML(l,o)}t.insertAdjacentHTML("afterbegin",``)}},Dt=ct;K.registerPlugins({ColumnResizer:bt,ContextMenu:vt,DraggableHeaders:xt,TouchSupport:yt,SelectableRows:Pt,FixedHeight:wt,AutosizeColumn:Et,ResponsiveGrid:Lt,RowActions:kt,EditableColumn:Rt,SpinnerSupport:Dt});customElements.get("data-grid")||customElements.define("data-grid",K);var ai=K;export{ai as default}; +`;if(!H("#dg-styles")){let r=H("head")??H("body"),l=/head/i.test(r.tagName)?"beforeend":"afterbegin";r.insertAdjacentHTML(l,o)}!H(`i${s}`,t)&&t.insertAdjacentHTML("afterbegin",``)}},$t=ut;_.registerPlugins({ColumnResizer:vt,ContextMenu:xt,DraggableHeaders:yt,TouchSupport:Ct,SelectableRows:wt,FixedHeight:Et,AutosizeColumn:St,ResponsiveGrid:kt,RowActions:Rt,EditableColumn:Dt,SpinnerSupport:$t});customElements.get("data-grid")||customElements.define("data-grid",_);var li=_;export{li as default}; //# sourceMappingURL=data-grid.min.js.map diff --git a/dist/data-grid.min.js.map b/dist/data-grid.min.js.map index 40d8bed..1038c73 100644 --- a/dist/data-grid.min.js.map +++ b/dist/data-grid.min.js.map @@ -1,7 +1,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/interpolate.js", "../src/utils/getTextWidth.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", "../src/plugins/row-actions.js", "../src/plugins/editable-column.js", "../src/plugins/spinner-support.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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading\r\n * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.showSpinner && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true,\r\n showSpinner: false,\r\n spinnerCssClasses: \"\"\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n show = grid.options.showSpinner;\r\n if (!show) return;\r\n const cssClasses = grid.options.spinnerCssClasses,\r\n cls = cssClasses.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!document.getElementById(\"dg-styles\")) {\r\n const styleParent = document.querySelector(\"head\") ?? document.querySelector(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], - "mappings": "AAIe,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,GAAK,CAAC,IAAK,GAAG,EAAE,SAASA,EAAE,UAAU,EAAG,CAAC,CAAC,EAC5C,GAAI,CAEF,OAAIA,EAAE,QAAQ,GAAG,IAAM,KACrBA,EAAIA,EAAE,QAAQ,KAAM,GAAG,GAElB,KAAK,MAAM,mBAAmBA,CAAC,CAAC,CACzC,MAAQ,CACN,eAAQ,MAAM,mBAAqBA,CAAC,EAC7B,CAAC,CACV,CAEF,OAAOA,CACT,CCUA,IAAMC,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,EAAI,GAAIC,EAAQ,GAAO,CACxDA,GAASH,EAAaF,EAAIC,CAAI,GAClCD,EAAG,aAAaC,EAAM,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,YAAYK,CAAK,CACtB,CACF,EAEOI,GAAQX,GC1Df,IAAMY,GAAN,cAA6BC,CAAW,CAItC,KAAM,CACJ,IAAMC,EAAO,KAAK,KAElB,GAAI,CADKA,EAAK,QAAQ,YACX,OACX,IAAMC,EAAaD,EAAK,QAAQ,kBAC9BE,EAAMD,EAAW,MAAM,GAAG,EAAE,IAAIE,GAAK,IAAIA,CAAC,EAAE,EAAE,KAAK,EAAE,EACrDC,EAAW;AAAA;AAAA,cAEHF,CAAG;AAAA,+BACcA,CAAG;AAAA,8CACYA,CAAG;AAAA;AAAA,4BAErBA,CAAG;AAAA;AAAA;AAAA,EAI3B,GAAI,CAAC,SAAS,eAAe,WAAW,EAAG,CACzC,IAAMG,EAAc,SAAS,cAAc,MAAM,GAAK,SAAS,cAAc,MAAM,EACjFC,EAAW,QAAQ,KAAKD,EAAY,OAAO,EAAI,YAAc,aAC/DA,EAAY,mBAAmBC,EAAUF,CAAQ,CACnD,CACAJ,EAAK,mBAAmB,aAAc,aAAaC,CAAU,QAAQ,CACvE,CACF,EAEOM,GAAQT,GCjBfU,EAAS,gBAAgB,CACvB,cAAAC,GACA,YAAAC,GACA,iBAAAC,GACA,aAAAC,GACA,eAAAC,GACA,YAAAC,GACA,eAAAC,GACA,eAAAC,GACA,WAAAC,GACA,eAAAC,GACA,eAAAC,EACF,CAAC,EAGI,eAAe,IAAI,WAAW,GACjC,eAAe,OAAO,YAAaX,CAAQ,EAG7C,IAAOA,GAAQA", - "names": ["camelize", "str", "m", "chr", "normalizeData", "v", "supportedPassiveTypes", "passiveOpts", "type", "getAttribute", "el", "name", "hasAttribute", "setAttribute", "v", "check", "removeAttribute", "on", "listener", "off", "dispatch", "el", "name", "data", "bubbles", "opts", "hasClass", "addClass", "removeClass", "toggleClass", "$", "selector", "base", "$$", "find", "findAll", "ce", "tagName", "parent", "el", "insertAfter", "newNode", "existingNode", "BaseElement", "options", "opt", "v", "setAttribute", "jsonConfig", "data", "key", "normalizeData", "message", "getAttribute", "event", "template", "dispatch", "attributeName", "oldValue", "newValue", "isOption", "transformer", "camelize", "base_element_default", "addSelectOption", "el", "value", "label", "checked", "opt", "appendParamsToUrl", "url", "params", "key", "k", "convertArray", "v", "elementOffset", "el", "rect", "scrollLeft", "scrollTop", "interpolate", "str", "data", "$1", "$2", "getTextWidth", "text", "el", "withPadding", "styles", "fontWeight", "fontSize", "fontFamily", "padding", "paddingLeft", "paddingRight", "context", "metrics", "randstr", "prefix", "plugins", "labels", "applyColumnDefinition", "el", "column", "setAttribute", "addClass", "DataGrid", "_DataGrid", "base_element_default", "#filterSelector", "randstr", "pluginName", "pluginClass", "attr", "camelize", "v", "list", "plugin", "columns", "cols", "key", "col", "item", "convertArray", "val", "updatePage", "addSelectOption", "field", "found", "prop", "c", "render", "dispatch", "start", "visibleOnly", "len", "tr", "find", "row", "removeAttribute", "findAll", "th", "fieldName", "value", "data", "metaKey", "dataKey", "cb", "needRender", "flagEmpty", "tbody", "resolve", "response", "err", "event", "filters", "input", "name", "haveClasses", "sort", "stack", "itemA", "itemB", "a", "b", "valA", "valB", "reject", "base", "url", "params", "appendParamsToUrl", "sortedColumn", "thead", "tfoot", "td", "availableWidth", "colMaxWidth", "idx", "ce", "sampleTh", "totalWidth", "colIdx", "computedWidth", "getTextWidth", "w", "colAvailableWidth", "visibleCols", "lastCol", "scrollbarWidth", "diff", "hasClass", "actualWidth", "minWidth", "newWidth", "sortableRow", "relatedTh", "filter", "eventName", "e", "isSelect", "uniqueValues", "opt", "i", "on", "ev", "toggleClass", "tv", "interpolate", "prev", "total", "p", "index", "high", "low", "getAttribute", "data_grid_default", "BasePlugin", "grid", "event", "base_plugin_default", "ColumnResizer", "base_plugin_default", "grid", "resizeLabel", "table", "cols", "findAll", "col", "hasClass", "resizer", "addClass", "startX", "startW", "remainingSpace", "max", "mouseMoveHandler", "e", "newWidth", "setAttribute", "mouseUpHandler", "removeClass", "off", "dispatch", "getAttribute", "on", "target", "visibleCols", "columnIndex", "column", "removeAttribute", "elementOffset", "j", "column_resizer_default", "getParentElement", "el", "type", "prop", "parent", "ContextMenu", "base_plugin_default", "off", "grid", "on", "e", "t", "field", "target", "getParentElement", "menu", "rect", "x", "y", "removeAttribute", "documentClickHandler", "setAttribute", "col", "li", "label", "checkbox", "text", "context_menu_default", "DraggableHeaders", "base_plugin_default", "th", "grid", "on", "e", "t", "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", "SELECTABLE_CLASS", "SELECT_ALL_CLASS", "CHECKBOX_CLASS", "SelectableRows", "base_plugin_default", "key", "grid", "selectedData", "findAll", "checkbox", "idx", "item", "tbody", "input", "tr", "th", "setAttribute", "label", "td", "selectOne", "e", "hasClass", "visibleOnly", "cb", "dispatch", "totalCheckboxes", "totalChecked", "n", "selectable_rows_default", "FixedHeight", "base_plugin_default", "grid", "tbody", "tr", "setAttribute", "fakeRow", "max", "visibleRows", "fakeHeight", "fixed_height_default", "AutosizeColumn", "base_plugin_default", "th", "column", "min", "max", "grid", "hasAttribute", "getAttribute", "firstVal", "lastVal", "v", "v2", "width", "getTextWidth", "setAttribute", "autosize_column_default", "debounce", "handler", "timeout", "timer", "args", "RESPONSIVE_CLASS", "obsTo", "sortByPriority", "list", "a", "b", "v1", "callback", "debounce", "entries", "entry", "grid", "table", "contentBoxSize", "size", "tableWidth", "realTableWidth", "findAll", "result", "th", "diff", "minWidth", "prevAction", "headerCols", "col", "changed", "remaining", "cols", "colWidth", "field", "requiredWidth", "width", "footer", "find", "realFooterWidth", "div", "availableFooterWidth", "addClass", "removeClass", "resizeObserver", "ResponsiveGrid", "base_plugin_default", "flag", "tr", "ce", "setAttribute", "td", "idealWidth", "consideredCol", "hCol", "ev", "open", "close", "hasClass", "childRow", "insertAfter", "childRowTd", "childTable", "hiddenCols", "childTableRow", "label", "labelCol", "removeAttribute", "responsive_grid_default", "RowActions", "base_plugin_default", "tr", "actionsTh", "setAttribute", "item", "labels", "td", "actionsToggle", "on", "ev", "action", "button", "interpolate", "actionHandler", "dispatch", "row_actions_default", "EditableColumn", "base_plugin_default", "td", "column", "item", "i", "gridId", "input", "ev", "key", "dispatch", "editable_column_default", "SpinnerSupport", "base_plugin_default", "grid", "cssClasses", "cls", "e", "template", "styleParent", "position", "spinner_support_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", "row_actions_default", "editable_column_default", "spinner_support_default"] + "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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading\r\n * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.showSpinner && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true,\r\n showSpinner: false,\r\n spinnerCssClasses: \"\"\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { $ } from \"../utils/shortcuts.js\"\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n show = grid.options.showSpinner;\r\n if (!show) return;\r\n const cssClasses = grid.options.spinnerCssClasses,\r\n cls = cssClasses.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!$(\"#dg-styles\")) {\r\n const styleParent = $(\"head\") ?? $(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n !$(`i${cls}`, grid) && grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], + "mappings": "AAIe,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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AKA,EAAE,MAAM,EACvCE,EAAW,QAAQ,KAAKD,EAAY,OAAO,EAAI,YAAc,aAC/DA,EAAY,mBAAmBC,EAAUH,CAAQ,CACnD,CACA,CAACC,EAAE,IAAIH,CAAG,GAAIF,CAAI,GAAKA,EAAK,mBAAmB,aAAc,aAAaC,CAAU,QAAQ,CAC9F,CACF,EAEOO,GAAQV,GClBfW,EAAS,gBAAgB,CACvB,cAAAC,GACA,YAAAC,GACA,iBAAAC,GACA,aAAAC,GACA,eAAAC,GACA,YAAAC,GACA,eAAAC,GACA,eAAAC,GACA,WAAAC,GACA,eAAAC,GACA,eAAAC,EACF,CAAC,EAGI,eAAe,IAAI,WAAW,GACjC,eAAe,OAAO,YAAaX,CAAQ,EAG7C,IAAOA,GAAQA", + "names": ["camelize", "str", "m", "chr", "normalizeData", "v", "supportedPassiveTypes", "passiveOpts", "type", "getAttribute", "el", "name", "hasAttribute", "setAttribute", "v", "check", "removeAttribute", "on", "listener", "off", "dispatch", "el", "name", "data", "bubbles", "opts", "hasClass", "addClass", "removeClass", "toggleClass", "$", "selector", "base", "$$", "find", "findAll", "ce", "tagName", "parent", "el", "insertAfter", "newNode", "existingNode", "BaseElement", "options", "opt", "v", "setAttribute", "jsonConfig", "data", "key", "normalizeData", "message", "getAttribute", "event", "template", "dispatch", "attributeName", "oldValue", "newValue", "isOption", "transformer", "camelize", "base_element_default", "addSelectOption", "el", "value", "label", "checked", "opt", "appendParamsToUrl", "url", "params", "key", "k", "convertArray", "v", "elementOffset", "el", "rect", "scrollLeft", "scrollTop", "interpolate", "str", "data", "$1", "$2", "getTextWidth", "text", "el", "withPadding", "styles", "fontWeight", "fontSize", "fontFamily", "padding", "paddingLeft", "paddingRight", "context", "metrics", "randstr", "prefix", "plugins", "labels", "applyColumnDefinition", "el", "column", "setAttribute", "addClass", "DataGrid", "_DataGrid", "base_element_default", "#filterSelector", "randstr", "pluginName", "pluginClass", "attr", "camelize", "v", "list", "plugin", "columns", "cols", "key", "col", "item", "convertArray", "val", "updatePage", "addSelectOption", "field", "found", "prop", "c", "render", "dispatch", "start", "visibleOnly", "len", "tr", "find", "row", "removeAttribute", "findAll", "th", "fieldName", "value", "data", "metaKey", "dataKey", "cb", "needRender", "flagEmpty", "tbody", "resolve", "response", "err", "event", "filters", "input", "name", "haveClasses", "sort", "stack", "itemA", "itemB", "a", "b", "valA", "valB", "reject", "base", "url", "params", "appendParamsToUrl", "sortedColumn", "thead", "tfoot", "td", "availableWidth", "colMaxWidth", "idx", "ce", "sampleTh", "totalWidth", "colIdx", "computedWidth", "getTextWidth", "w", "colAvailableWidth", "visibleCols", "lastCol", "scrollbarWidth", "diff", "hasClass", "actualWidth", "minWidth", "newWidth", "sortableRow", "relatedTh", "filter", "eventName", "e", "isSelect", "uniqueValues", "opt", "i", "on", "ev", "toggleClass", "tv", "interpolate", "prev", "total", "p", "index", "high", "low", "getAttribute", "data_grid_default", "BasePlugin", "grid", "event", "base_plugin_default", "ColumnResizer", "base_plugin_default", "grid", "resizeLabel", "table", "cols", "findAll", "col", "hasClass", "resizer", "addClass", "startX", "startW", "remainingSpace", "max", "mouseMoveHandler", "e", "newWidth", "setAttribute", "mouseUpHandler", "removeClass", "off", "dispatch", "getAttribute", "on", "target", "visibleCols", "columnIndex", "column", "removeAttribute", "elementOffset", "j", "column_resizer_default", "getParentElement", "el", "type", "prop", "parent", "ContextMenu", "base_plugin_default", "off", "grid", "on", "e", "t", "field", "target", "getParentElement", "menu", "rect", "x", "y", "removeAttribute", "documentClickHandler", "setAttribute", "col", "li", "label", "checkbox", "text", "context_menu_default", "DraggableHeaders", "base_plugin_default", "th", "grid", "on", "e", "t", "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", "SELECTABLE_CLASS", "SELECT_ALL_CLASS", "CHECKBOX_CLASS", "SelectableRows", "base_plugin_default", "key", "grid", "selectedData", "findAll", "checkbox", "idx", "item", "tbody", "input", "tr", "th", "setAttribute", "label", "td", "selectOne", "e", "hasClass", "visibleOnly", "cb", "dispatch", "totalCheckboxes", "totalChecked", "n", "selectable_rows_default", "FixedHeight", "base_plugin_default", "grid", "tbody", "tr", "setAttribute", "fakeRow", "max", "visibleRows", "fakeHeight", "fixed_height_default", "AutosizeColumn", "base_plugin_default", "th", "column", "min", "max", "grid", "hasAttribute", "getAttribute", "firstVal", "lastVal", "v", "v2", "width", "getTextWidth", "setAttribute", "autosize_column_default", "debounce", "handler", "timeout", "timer", "args", "RESPONSIVE_CLASS", "obsTo", "sortByPriority", "list", "a", "b", "v1", "callback", "debounce", "entries", "entry", "grid", "table", "contentBoxSize", "size", "tableWidth", "realTableWidth", "findAll", "result", "th", "diff", "minWidth", "prevAction", "headerCols", "col", "changed", "remaining", "cols", "colWidth", "field", "requiredWidth", "width", "footer", "find", "realFooterWidth", "div", "availableFooterWidth", "addClass", "removeClass", "resizeObserver", "ResponsiveGrid", "base_plugin_default", "flag", "tr", "ce", "setAttribute", "td", "idealWidth", "consideredCol", "hCol", "ev", "open", "close", "hasClass", "childRow", "insertAfter", "childRowTd", "childTable", "hiddenCols", "childTableRow", "label", "labelCol", "removeAttribute", "responsive_grid_default", "RowActions", "base_plugin_default", "tr", "actionsTh", "setAttribute", "item", "labels", "td", "actionsToggle", "on", "ev", "action", "button", "interpolate", "actionHandler", "dispatch", "row_actions_default", "EditableColumn", "base_plugin_default", "td", "column", "item", "i", "gridId", "input", "ev", "key", "dispatch", "editable_column_default", "SpinnerSupport", "base_plugin_default", "grid", "cssClasses", "cls", "e", "template", "$", "styleParent", "position", "spinner_support_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", "row_actions_default", "editable_column_default", "spinner_support_default"] } diff --git a/src/plugins/spinner-support.js b/src/plugins/spinner-support.js index b0faa79..af7fef7 100644 --- a/src/plugins/spinner-support.js +++ b/src/plugins/spinner-support.js @@ -1,4 +1,5 @@ import BasePlugin from "../core/base-plugin.js"; +import { $ } from "../utils/shortcuts.js" /** * Adds an element for showing a spinning icon on grid loading. @@ -23,12 +24,12 @@ class SpinnerSupport extends BasePlugin { } `; - if (!document.getElementById("dg-styles")) { - const styleParent = document.querySelector("head") ?? document.querySelector("body"), + if (!$("#dg-styles")) { + const styleParent = $("head") ?? $("body"), position = /head/i.test(styleParent.tagName) ? "beforeend" : "afterbegin"; styleParent.insertAdjacentHTML(position, template); } - grid.insertAdjacentHTML("afterbegin", ``); + !$(`i${cls}`, grid) && grid.insertAdjacentHTML("afterbegin", ``); } } From 1d12fa4d590f24562f4487020a887908e031959e Mon Sep 17 00:00:00 2001 From: Jack Hsu Date: Mon, 26 Feb 2024 23:40:54 -0500 Subject: [PATCH 3/3] Removed showSpinner, making spinnerClass the only grid option for showing spinner. --- dist/data-grid.js | 16 +++++++--------- dist/data-grid.js.map | 4 ++-- dist/data-grid.min.js | 16 ++++++++-------- dist/data-grid.min.js.map | 6 +++--- readme.md | 5 ++--- src/data-grid.js | 11 ++++------- src/plugins/spinner-support.js | 11 +++++------ 7 files changed, 31 insertions(+), 38 deletions(-) diff --git a/dist/data-grid.js b/dist/data-grid.js index 92222f4..568c815 100644 --- a/dist/data-grid.js +++ b/dist/data-grid.js @@ -398,7 +398,7 @@ var DataGrid = class _DataGrid extends base_element_default { setAttribute(this, attr, this.options[camelize(attr.slice(5))]); } } - if (this.options.showSpinner && this.plugins.SpinnerSupport) + if (this.options.spinnerClass && this.plugins.SpinnerSupport) this.plugins.SpinnerSupport.add(); } static template() { @@ -525,9 +525,7 @@ var DataGrid = class _DataGrid extends base_element_default { autohidePager: false, responsive: false, responsiveToggle: true, - filterOnEnter: true, - showSpinner: false, - spinnerCssClasses: "" + filterOnEnter: true }; } /** @@ -1453,7 +1451,7 @@ var DataGrid = class _DataGrid extends base_element_default { const isSelect = column.filterType == "select", filter = isSelect ? ce("select") : ce("input"); if (isSelect) { if (!Array.isArray(column.filterList)) { - const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter((v) => !!v).sort(); + const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter((v) => v).sort(); column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e }))); } column.filterList.forEach((e) => { @@ -2679,10 +2677,10 @@ var SpinnerSupport = class extends base_plugin_default { * Adds a spinner element with its associated css styles. */ add() { - const grid = this.grid, show = grid.options.showSpinner; - if (!show) + const grid = this.grid, classes = grid.options.spinnerClass; + if (!classes) return; - const cssClasses = grid.options.spinnerCssClasses, cls = cssClasses.split(" ").map((e) => `.${e}`).join(""), template = ` + const cls = classes.split(" ").map((e) => `.${e}`).join(""), template = ` \r\n`;\r\n if (!$(\"#dg-styles\")) {\r\n const styleParent = $(\"head\") ?? $(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n !$(`i${cls}`, grid) && grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], - "mappings": ";;;AAIe,SAAR,SAA0B,KAAK;AACpC,SAAO,IAAI,YAAY,EAAE,QAAQ,qBAAqB,CAAC,GAAG,QAAQ,IAAI,YAAY,CAAC;AACrF;;;ACDe,SAAR,cAA+B,GAAG;AAEvC,MAAI,MAAM,QAAQ;AAChB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,SAAS;AACjB,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,MAAM,MAAM,QAAQ;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,OAAO,CAAC,EAAE,SAAS,GAAG;AAC9B,WAAO,OAAO,CAAC;AAAA,EACjB;AAEA,MAAI,KAAK,CAAC,KAAK,GAAG,EAAE,SAAS,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG;AAC/C,QAAI;AAEF,UAAI,EAAE,QAAQ,GAAG,MAAM,IAAI;AACzB,YAAI,EAAE,QAAQ,MAAM,GAAG;AAAA,MACzB;AACA,aAAO,KAAK,MAAM,mBAAmB,CAAC,CAAC;AAAA,IACzC,QAAQ;AACN,cAAQ,MAAM,qBAAqB,CAAC;AACpC,aAAO,CAAC;AAAA,IACV;AAAA,EACF;AACA,SAAO;AACT;;;ACUA,IAAM,wBAAwB;AAAA,EAC5B;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AA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AA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAI,CAAC,eAAe,IAAI,WAAW,GAAG;AACpC,iBAAe,OAAO,aAAa,iBAAQ;AAC7C;AAEA,IAAOC,qBAAQ;", + "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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {String} spinnerClass Sets a space-delimited string of css classes for a spinner (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.spinnerClass && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter((v) => v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { $ } from \"../utils/shortcuts.js\"\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n classes = grid.options.spinnerClass;\r\n if (!classes) return;\r\n const cls = classes.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!$(\"#dg-styles\")) {\r\n const styleParent = $(\"head\") ?? $(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n !$(`i${cls}`, grid) && grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], + "mappings": ";;;AAIe,SAAR,SAA0B,KAAK;AACpC,SAAO,IAAI,YAAY,EAAE,QAAQ,qBAAqB,CAAC,GAAG,QAAQ,IAAI,YAAY,CAAC;AACrF;;;ACDe,SAAR,cAA+B,GAAG;AAEvC,MAAI,MAAM,QAAQ;AAChB,WAAO;AAAA,EACT;AACA,MAAI,MAAM,SAAS;AACjB,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,MAAM,MAAM,QAAQ;AAC5B,WAAO;AAAA,EACT;AAEA,MAAI,MAAM,OAAO,CAAC,EAAE,SAAS,GAAG;AAC9B,WAAO,OAAO,CAAC;AAAA,EACjB;AAEA,MAAI,KAAK,CAAC,KAAK,GAAG,EAAE,SAAS,EAAE,UAAU,GAAG,CAAC,CAAC,GAAG;AAC/C,QAAI;AAEF,UAAI,EAAE,QAAQ,GAAG,MAAM,IAAI;AACzB,YAAI,EAAE,QAAQ,MAAM,GAAG;AAAA,MACzB;AACA,aAAO,KAAK,MAAM,mBAAmB,CAAC,CAAC;AAAA,IACzC,QAAQ;AACN,cAAQ,MAAM,qBAAqB,CAAC;AACpC,aAAO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BAAS,gBAAgB;AAAA,EACvB;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF,CAAC;AAGD,IAAI,CAAC,eAAe,IAAI,WAAW,GAAG;AACpC,iBAAe,OAAO,aAAa,iBAAQ;AAC7C;AAEA,IAAOC,qBAAQ;", "names": ["col", "e", "th", "labels", "data_grid_default"] } diff --git a/dist/data-grid.min.js b/dist/data-grid.min.js index 0da5e12..473fe2c 100644 --- a/dist/data-grid.min.js +++ b/dist/data-grid.min.js @@ -1,4 +1,4 @@ -function F(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}function j(n){if(n==="true")return!0;if(n==="false")return!1;if(n===""||n==="null")return null;if(n===Number(n).toString())return Number(n);if(n&&["[","{"].includes(n.substring(0,1)))try{return n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(decodeURIComponent(n))}catch{return console.error("Failed to parse "+n),{}}return n}var It=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];function gt(n){return It.includes(n)?{passive:!0}:{}}function k(n,t){return n.getAttribute(t)}function V(n,t){return n.hasAttribute(t)}function d(n,t,e="",i=!1){i&&V(n,t)||n.setAttribute(t,""+e)}function S(n,t){V(n,t)&&n.removeAttribute(t)}function w(n,t,e){n.addEventListener(t,e,gt(t))}function W(n,t,e){n.removeEventListener(t,e,gt(t))}function y(n,t,e={},i=!1){let s={};i&&(s.bubbles=!0),e&&(s.detail=e),n.dispatchEvent(new CustomEvent(t,s))}function I(n,t){return n.classList.contains(t)}function L(n,t){n.classList.add(...t.split(" "))}function q(n,t){n.classList.remove(...t.split(" "))}function pt(n,t){n.classList.toggle(t)}function H(n,t=document){return n instanceof HTMLElement?n:t.querySelector(n)}function Tt(n,t=document){return Array.from(t.querySelectorAll(n))}function T(n,t){return H(t,n)}function f(n,t){return Tt(t,n)}function x(n,t=null){let e=document.createElement(n);return t&&t.appendChild(e),e}function ft(n,t){t.parentNode.insertBefore(n,t.nextSibling)}var U=class extends HTMLElement{constructor(t={}){super(),this.options=Object.assign({},this.defaultOptions,this.normalizedDataset,t),this.log("constructor"),this.fireEvents=!0,this._ready(),this.log("ready")}get defaultOptions(){return{}}getOption(t){return this.options[t]}setOption(t,e){d(this,`data-${t}`,e)}toggleOption(t){d(this,`data-${t}`,!this.getOption(t))}get normalizedDataset(){let t=this.dataset.config?JSON.parse(this.dataset.config):{},e={...this.dataset};for(var i in e)i!="config"&&(e[i]=j(e[i]));return Object.assign(e,t),e}static template(){return""}_ready(){}log(t){this.options.debug&&console.log("["+k(this,"id")+"] "+t)}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}_connected(){}connectedCallback(){setTimeout(()=>{this.log("connectedCallback");let t=document.createElement("template");t.innerHTML=this.constructor.template(),this.appendChild(t.content.cloneNode(!0)),this._connected(),y(this,"connected")},0)}_disconnected(){}disconnectedCallback(){this.log("disconnectedCallback"),this._disconnected(),y(this,"disconnected")}get transformAttributes(){return{}}attributeChangedCallback(t,e,i){if(e===i)return;this.log("attributeChangedCallback: "+t);let s=!1,o=this.transformAttributes[t]??j;t.indexOf("data-")===0&&(t=t.slice(5),s=!0),t=F(t),s?this.options[t]=o(i):this[t]=o(i),this.fireEvents&&this[`${t}Changed`]&&this[`${t}Changed`]()}},mt=U;function X(n,t,e,i=!1){let s=document.createElement("option");s.value=""+t,i&&(s.selected=!0),s.label=e,n.appendChild(s)}function Y(n,t={}){Object.keys(t).forEach(e=>{Array.isArray(t[e])?Object.keys(t[e]).forEach(i=>n.searchParams.append(isNaN(i)?`${e}[${i}]`:e,t[e][i])):n.searchParams.append(e,t[e])})}function K(n){return typeof n=="string"?n[0]==="["?(n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(n)):n.split(","):Array.isArray(n)?n:(console.error("Invalid array",n),[])}function J(n){var t=n.getBoundingClientRect(),e=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+i,left:t.left+e}}function N(n,t){return n.replace(/\{([^}]+)?\}/g,function(e,i){return t[i]})}function O(n,t=document.body,e=!1){t||(t=document.createElement("div"));let i=window.getComputedStyle(t),s=i.getPropertyValue("font-weight")||"normal",o=i.getPropertyValue("font-size")||"1rem",r=i.getPropertyValue("font-family")||"Arial",l=0;if(e){let u=i.getPropertyValue("padding-left")||"0",g=i.getPropertyValue("padding-right")||"0";l=parseInt(u)+parseInt(g)}let c=(O.canvas||(O.canvas=document.createElement("canvas"))).getContext("2d");c.font=`${s} ${o} ${r}`;let h=c.measureText(n);return parseInt(h.width)+l}function G(n){return Math.random().toString(36).replace("0.",n||"")}var M={},C={itemsPerPage:"Items per page",gotoPage:"Go to page",gotoFirstPage:"Go to first page",gotoPrevPage:"Go to previous page",gotoNextPage:"Go to next page",gotoLastPage:"Go to last page",of:"of",items:"items",resizeColumn:"Resize column",noData:"No data",areYouSure:"Are you sure?",networkError:"Network response error"};function bt(n,t){t.width&&d(n,"width",t.width),t.class&&L(n,t.class),t.hidden&&(d(n,"hidden",""),t.responsiveHidden&&L(n,"dg-responsive-hidden"))}var Z=class n extends mt{#t="[id^=dg-filter]";_ready(){d(this,"id",this.options.id??G("el-"),!0),this.data=[],this.originalData,this.options=this.options||this.defaultOptions,this.fireEvents=!1,this.page=this.options.defaultPage||1,this.pages=0,this.meta,this.plugins={};for(let[t,e]of Object.entries(M))this.plugins[t]=new e(this);for(let t of n.observedAttributes)t.indexOf("data-")===0&&d(this,t,this.options[F(t.slice(5))]);this.options.showSpinner&&this.plugins.SpinnerSupport&&this.plugins.SpinnerSupport.add()}static template(){return` +function F(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUpperCase())}function j(n){if(n==="true")return!0;if(n==="false")return!1;if(n===""||n==="null")return null;if(n===Number(n).toString())return Number(n);if(n&&["[","{"].includes(n.substring(0,1)))try{return n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(decodeURIComponent(n))}catch{return console.error("Failed to parse "+n),{}}return n}var It=["scroll","wheel","touchstart","touchmove","touchenter","touchend","touchleave","mouseout","mouseleave","mouseup","mousedown","mousemove","mouseenter","mousewheel","mouseover"];function gt(n){return It.includes(n)?{passive:!0}:{}}function k(n,t){return n.getAttribute(t)}function V(n,t){return n.hasAttribute(t)}function d(n,t,e="",i=!1){i&&V(n,t)||n.setAttribute(t,""+e)}function S(n,t){V(n,t)&&n.removeAttribute(t)}function w(n,t,e){n.addEventListener(t,e,gt(t))}function W(n,t,e){n.removeEventListener(t,e,gt(t))}function y(n,t,e={},i=!1){let s={};i&&(s.bubbles=!0),e&&(s.detail=e),n.dispatchEvent(new CustomEvent(t,s))}function I(n,t){return n.classList.contains(t)}function L(n,t){n.classList.add(...t.split(" "))}function q(n,t){n.classList.remove(...t.split(" "))}function pt(n,t){n.classList.toggle(t)}function H(n,t=document){return n instanceof HTMLElement?n:t.querySelector(n)}function Tt(n,t=document){return Array.from(t.querySelectorAll(n))}function T(n,t){return H(t,n)}function f(n,t){return Tt(t,n)}function x(n,t=null){let e=document.createElement(n);return t&&t.appendChild(e),e}function ft(n,t){t.parentNode.insertBefore(n,t.nextSibling)}var U=class extends HTMLElement{constructor(t={}){super(),this.options=Object.assign({},this.defaultOptions,this.normalizedDataset,t),this.log("constructor"),this.fireEvents=!0,this._ready(),this.log("ready")}get defaultOptions(){return{}}getOption(t){return this.options[t]}setOption(t,e){d(this,`data-${t}`,e)}toggleOption(t){d(this,`data-${t}`,!this.getOption(t))}get normalizedDataset(){let t=this.dataset.config?JSON.parse(this.dataset.config):{},e={...this.dataset};for(var i in e)i!="config"&&(e[i]=j(e[i]));return Object.assign(e,t),e}static template(){return""}_ready(){}log(t){this.options.debug&&console.log("["+k(this,"id")+"] "+t)}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}_connected(){}connectedCallback(){setTimeout(()=>{this.log("connectedCallback");let t=document.createElement("template");t.innerHTML=this.constructor.template(),this.appendChild(t.content.cloneNode(!0)),this._connected(),y(this,"connected")},0)}_disconnected(){}disconnectedCallback(){this.log("disconnectedCallback"),this._disconnected(),y(this,"disconnected")}get transformAttributes(){return{}}attributeChangedCallback(t,e,i){if(e===i)return;this.log("attributeChangedCallback: "+t);let s=!1,o=this.transformAttributes[t]??j;t.indexOf("data-")===0&&(t=t.slice(5),s=!0),t=F(t),s?this.options[t]=o(i):this[t]=o(i),this.fireEvents&&this[`${t}Changed`]&&this[`${t}Changed`]()}},mt=U;function X(n,t,e,i=!1){let s=document.createElement("option");s.value=""+t,i&&(s.selected=!0),s.label=e,n.appendChild(s)}function Y(n,t={}){Object.keys(t).forEach(e=>{Array.isArray(t[e])?Object.keys(t[e]).forEach(i=>n.searchParams.append(isNaN(i)?`${e}[${i}]`:e,t[e][i])):n.searchParams.append(e,t[e])})}function K(n){return typeof n=="string"?n[0]==="["?(n.indexOf('"')===-1&&(n=n.replace(/'/g,'"')),JSON.parse(n)):n.split(","):Array.isArray(n)?n:(console.error("Invalid array",n),[])}function J(n){var t=n.getBoundingClientRect(),e=window.pageXOffset||document.documentElement.scrollLeft,i=window.pageYOffset||document.documentElement.scrollTop;return{top:t.top+i,left:t.left+e}}function N(n,t){return n.replace(/\{([^}]+)?\}/g,function(e,i){return t[i]})}function O(n,t=document.body,e=!1){t||(t=document.createElement("div"));let i=window.getComputedStyle(t),s=i.getPropertyValue("font-weight")||"normal",o=i.getPropertyValue("font-size")||"1rem",r=i.getPropertyValue("font-family")||"Arial",l=0;if(e){let u=i.getPropertyValue("padding-left")||"0",g=i.getPropertyValue("padding-right")||"0";l=parseInt(u)+parseInt(g)}let c=(O.canvas||(O.canvas=document.createElement("canvas"))).getContext("2d");c.font=`${s} ${o} ${r}`;let h=c.measureText(n);return parseInt(h.width)+l}function G(n){return Math.random().toString(36).replace("0.",n||"")}var M={},C={itemsPerPage:"Items per page",gotoPage:"Go to page",gotoFirstPage:"Go to first page",gotoPrevPage:"Go to previous page",gotoNextPage:"Go to next page",gotoLastPage:"Go to last page",of:"of",items:"items",resizeColumn:"Resize column",noData:"No data",areYouSure:"Are you sure?",networkError:"Network response error"};function bt(n,t){t.width&&d(n,"width",t.width),t.class&&L(n,t.class),t.hidden&&(d(n,"hidden",""),t.responsiveHidden&&L(n,"dg-responsive-hidden"))}var Z=class n extends mt{#t="[id^=dg-filter]";_ready(){d(this,"id",this.options.id??G("el-"),!0),this.data=[],this.originalData,this.options=this.options||this.defaultOptions,this.fireEvents=!1,this.page=this.options.defaultPage||1,this.pages=0,this.meta,this.plugins={};for(let[t,e]of Object.entries(M))this.plugins[t]=new e(this);for(let t of n.observedAttributes)t.indexOf("data-")===0&&d(this,t,this.options[F(t.slice(5))]);this.options.spinnerClass&&this.plugins.SpinnerSupport&&this.plugins.SpinnerSupport.add()}static template(){return` @@ -36,20 +36,20 @@ function F(n){return n.toLowerCase().replace(/[^a-zA-Z0-9]+(.)/g,(t,e)=>e.toUppe
-`}get labels(){return C}static getLabels(){return C}static setLabels(t){C=Object.assign(C,t)}get defaultColumn(){return{field:"",title:"",width:0,class:"",attr:"",hidden:!1,editable:!1,noSort:!1,responsive:1,responsiveHidden:!1,format:"",transform:"",filterType:"text",firstFilterOption:{value:"",text:""}}}get defaultOptions(){return{id:null,url:null,perPage:10,debug:!1,filter:!1,menu:!1,sort:!1,server:!1,serverParams:{start:"start",length:"length",search:"search",sort:"sort",sortDir:"sortDir",dataKey:"data",metaKey:"meta",metaTotalKey:"total",metaFilteredKey:"filtered",optionsKey:"options",paramsKey:"params"},defaultSort:"",reorder:!1,dir:"ltr",perPageValues:[10,25,50,100,250],hidePerPage:!1,columns:[],actions:[],collapseActions:!1,selectable:!1,selectVisibleOnly:!0,defaultPage:1,resizable:!1,autosize:!0,expand:!1,autoheight:!0,autohidePager:!1,responsive:!1,responsiveToggle:!0,filterOnEnter:!0,showSpinner:!1,spinnerCssClasses:""}}static registerPlugins(t){M=t}static unregisterPlugins(t=null){t===null?M={}:delete M[t]}static registeredPlugins(){return M}convertColumns(t){let e=[];return typeof t=="object"&&!Array.isArray(t)?Object.keys(t).forEach(i=>{let s=Object.assign({},this.defaultColumn);s.title=t[i],s.field=i,e.push(s)}):t.forEach(i=>{let s=Object.assign({},this.defaultColumn);typeof i=="string"?(s.title=i,s.field=i):typeof i=="object"?(s=Object.assign(s,i),s.field||console.error("Invalid column definition",i),s.title||(s.title=s.field)):console.error("Column definition must be a string or an object"),e.push(s)}),e}static get observedAttributes(){return["page","data-filter","data-sort","data-debug","data-reorder","data-menu","data-selectable","data-url","data-per-page","data-responsive"]}get transformAttributes(){return{columns:t=>this.convertColumns(K(t)),actions:t=>K(t),defaultPage:t=>parseInt(t),perPage:t=>parseInt(t)}}get page(){return parseInt(this.getAttribute("page"))}set page(t){d(this,"page",this.constrainPageValue(t))}urlChanged(){this.loadData().then(()=>{this.configureUi()})}constrainPageValue(t){return this.pages1&&this.page*this.options.perPage>this.totalRecords();)t--;t!=this.page?this.page=t:this.reload(()=>{(!this.plugins.FixedHeight||!this.plugins.FixedHeight.hasFixedHeight)&&this.selectPerPage.scrollIntoView()})}dirChanged(){d(this,"dir",this.options.dir)}defaultSortChanged(){this.sortChanged()}perPageValuesChanged(){if(this.selectPerPage){for(;this.selectPerPage.lastChild;)this.selectPerPage.removeChild(this.selectPerPage.lastChild);this.options.perPageValues.forEach(t=>{X(this.selectPerPage,t,t,t===this.options.perPage)})}}_connected(){this.table=this.querySelector("table"),this.btnFirst=this.querySelector(".dg-btn-first"),this.btnPrev=this.querySelector(".dg-btn-prev"),this.btnNext=this.querySelector(".dg-btn-next"),this.btnLast=this.querySelector(".dg-btn-last"),this.selectPerPage=this.querySelector(".dg-select-per-page"),this.inputPage=this.querySelector(".dg-input-page"),this.getFirst=this.getFirst.bind(this),this.getPrev=this.getPrev.bind(this),this.getNext=this.getNext.bind(this),this.getLast=this.getLast.bind(this),this.changePerPage=this.changePerPage.bind(this),this.gotoPage=this.gotoPage.bind(this),this.btnFirst.addEventListener("click",this.getFirst),this.btnPrev.addEventListener("click",this.getPrev),this.btnNext.addEventListener("click",this.getNext),this.btnLast.addEventListener("click",this.getLast),this.selectPerPage.addEventListener("change",this.changePerPage),this.selectPerPage.toggleAttribute("hidden",this.options.hidePerPage),this.inputPage.addEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.connected()}),this.dirChanged(),this.perPageValuesChanged(),this.loadData().finally(()=>{this.configureUi(),this.sortChanged(),this.classList.add("dg-initialized"),this.filterChanged(),this.reorderChanged(),this.dirChanged(),this.perPageValuesChanged(),this.pageChanged(),this.fireEvents=!0,this.log("initialized")})}_disconnected(){this.btnFirst.removeEventListener("click",this.getFirst),this.btnPrev.removeEventListener("click",this.getPrev),this.btnNext.removeEventListener("click",this.getNext),this.btnLast.removeEventListener("click",this.getLast),this.selectPerPage.removeEventListener("change",this.changePerPage),this.inputPage.removeEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.disconnected()})}getCol(t){let e=null;return this.options.columns.forEach(i=>{i.field==t&&(e=i)}),e}getColProp(t,e){let i=this.getCol(t);return i?i[e]:null}setColProp(t,e,i){let s=this.getCol(t);s&&(s[e]=i)}visibleColumns(){return this.options.columns.filter(t=>!t.hidden)}hiddenColumns(){return this.options.columns.filter(t=>t.hidden===!0)}showColumn(t,e=!0){this.setColProp(t,"hidden",!1),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"visible"})}hideColumn(t,e=!0){this.setColProp(t,"hidden",!0),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"hidden"})}startColIndex(){let t=1;return this.options.selectable&&this.plugins.SelectableRows&&t++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&t++,t}isSticky(){return this.hasAttribute("sticky")}columnsLength(t=!1){let e=0;return this.options.columns.forEach(i=>{t&&i.hidden||i.attr||e++}),this.options.selectable&&this.plugins.SelectableRows&&e++,this.options.actions.length&&this.plugins.RowActions&&e++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&e++,e}configureUi(){if(d(this.querySelector("table"),"aria-rowcount",this.data.length),this.table.style.visibility="hidden",this.renderTable(),this.options.responsive&&this.plugins.ResponsiveGrid||(this.table.style.visibility="visible"),!this.rowHeight){let t=T(this,"tbody tr")||T(this,"table tr");t&&(this.rowHeight=t.offsetHeight)}}filterChanged(){let t=this.querySelector("thead tr.dg-head-filters");this.options.filter?S(t,"hidden"):(this.clearFilters(),d(t,"hidden",""))}reorderChanged(){f(this,"thead tr.dg-head-columns th").forEach(e=>{e.classList.contains("dg-selectable")||e.classList.contains("dg-actions")||(this.options.reorder&&this.plugins.DraggableHeaders?e.draggable=!0:e.removeAttribute("draggable"))})}sortChanged(){this.log("toggle sort"),this.querySelectorAll("thead tr.dg-head-columns th").forEach(t=>{let e=t.getAttribute("field");t.classList.contains("dg-not-sortable")||!this.fireEvents&&e==this.options.defaultSort||(this.options.sort&&!this.getColProp(e,"noSort")?d(t,"aria-sort","none"):S(t,"aria-sort"))})}selectableChanged(){this.renderTable()}addRow(t){Array.isArray(this.originalData)&&(this.log("Add row"),this.originalData.push(t),this.data=this.originalData.slice(),this.sortData())}removeRow(t=null,e=null){if(Array.isArray(this.originalData)){e===null&&(e=this.options.columns[0].field),t===null&&(t=this.originalData[this.originalData.length-1][e]),this.log("Removing "+e+":"+t);for(let i=0;i{this.options.server||e?this.renderBody():this.paginate(),t&&t()})}loadData(){let t=()=>!this.data.length&&this.classList.add("dg-empty"),e=this.querySelector("tbody");return(this.meta||this.originalData||this.classList.contains("dg-initialized"))&&(!this.options.server||this.options.server&&!this.fireEvents)?(this.log("skip loadData"),t(),new Promise(i=>{i()})):(this.log("loadData"),this.loading=!0,this.classList.add("dg-loading"),this.classList.remove("dg-empty","dg-network-error"),this.fetchData().then(i=>{if(Array.isArray(i))this.data=i;else{if(!i[this.options.serverParams.dataKey]){console.error("Invalid response, it should contain a data key with an array or be a plain array",i),this.options.url=null;return}this.options=Object.assign(this.options,i[this.options.serverParams.optionsKey]??{}),this.meta=i[this.options.serverParams.metaKey]??{},this.data=i[this.options.serverParams.dataKey]}this.originalData=this.data.slice(),this.fixPage(),this.options.columns.length===0&&this.originalData.length?this.options.columns=this.convertColumns(Object.keys(this.originalData[0])):this.options.columns=this.convertColumns(this.options.columns)}).catch(i=>{this.log(i),i.message&&e.setAttribute("data-empty",i.message.replace(/^\s+|\r\n|\n|\r$/g,"")),this.classList.add("dg-empty","dg-network-error")}).finally(()=>{t(),!this.classList.contains("dg-network-error")&&e.getAttribute("data-empty")!=this.labels.noData&&e.setAttribute("data-empty",this.labels.noData),this.classList.remove("dg-loading"),this.loading=!1}))}getFirst(){this.loading||(this.page=1)}getLast(){this.loading||(this.page=this.pages)}getPrev(){this.loading||(this.page=this.page-1)}getNext(){this.loading||(this.page=this.page+1)}gotoPage(t){if(t.type==="keypress"){let e=t.keyCode||t.key;if(e===13||e==="Enter")t.preventDefault();else return}this.page=parseInt(this.inputPage.value)}getSort(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t?t.getAttribute("field"):this.options.defaultSort}getSortDir(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t&&t.getAttribute("aria-sort")||""}getFilters(){let t=[];return f(this,this.#t).forEach(i=>{t[i.dataset.name]=i.value}),t}clearFilters(){f(this,this.#t).forEach(e=>{e.value=""}),this.filterData()}filterData(){if(this.log("filter data"),this.page=1,this.options.server)this.reload();else{this.data=this.originalData?.slice()??[],f(this,this.#t).forEach(i=>{let s=i.value;if(s){let o=i.dataset.name;this.data=this.data.filter(r=>(r[o]+"").toLowerCase().indexOf(s.toLowerCase())!==-1)}}),this.pageChanged();let e=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");this.options.sort&&e?this.sortData():this.renderBody()}}sortData(t=null){if(this.log("sort data"),t&&this.getColProp(t.getAttribute("field"),"noSort")){this.log("sorting prevented because column is not sortable");return}if(this.plugins.ColumnResizer&&this.plugins.ColumnResizer.isResizing){this.log("sorting prevented because resizing");return}if(this.loading){this.log("sorting prevented because loading");return}if(t!==null){let e=i=>["dg-selectable","dg-actions","dg-responsive-toggle"].includes(i);this.querySelectorAll("thead tr:first-child th").forEach(i=>{[...i.classList].some(e)||i!==t&&i.setAttribute("aria-sort","none")}),!t.hasAttribute("aria-sort")||t.getAttribute("aria-sort")==="none"?t.setAttribute("aria-sort","ascending"):t.getAttribute("aria-sort")==="ascending"?t.setAttribute("aria-sort","descending"):t.getAttribute("aria-sort")==="descending"&&t.setAttribute("aria-sort","none")}else t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");if(this.options.server)this.loadData().finally(()=>{this.renderBody()});else{let e=t?t.getAttribute("aria-sort"):"none";if(e==="none"){let i=[];this.originalData?.some(s=>(this.data.some(o=>JSON.stringify(s)===JSON.stringify(o)?(i.push(o),!0):!1),i.length===this.data.length)),this.data=i}else{let i=t.getAttribute("field");this.data.sort((s,o)=>{if(!isNaN(s[i])&&!isNaN(o[i]))return e==="ascending"?s[i]-o[i]:o[i]-s[i];let r=e==="ascending"?s[i].toUpperCase():o[i].toUpperCase(),l=e==="ascending"?o[i].toUpperCase():s[i].toUpperCase();switch(!0){case r>l:return 1;case ro("No url set"));let t=window.location.href;t.split("/").pop().includes(".")||(t+=t.endsWith("/")?"":"/");let e=new URL(this.options.url,t),i={r:Date.now()};return this.options.server&&(i[this.options.serverParams.start]=this.page-1,i[this.options.serverParams.length]=this.options.perPage,this.options.filter&&(i[this.options.serverParams.search]=this.getFilters()),i[this.options.serverParams.sort]=this.getSort()||"",i[this.options.serverParams.sortDir]=this.getSortDir(),this.meta?.[this.options.serverParams.paramsKey]&&(i=Object.assign(i,this.meta[this.options.serverParams.paramsKey]))),Y(e,i),fetch(e).then(s=>{if(!s.ok)throw new Error(s.statusText||C.networkError);return s.json()})}renderTable(){this.log("render table"),this.options.menu&&this.plugins.ContextMenu&&this.plugins.ContextMenu.createMenu();let t;this.renderHeader(),this.options.defaultSort&&(t=this.querySelector("thead tr.dg-head-columns th[field='"+this.options.defaultSort+"']")),t?this.sortData(t):this.renderBody(),this.renderFooter()}renderHeader(){this.log("render header");let t=this.querySelector("thead");this.createColumnHeaders(t),this.createColumnFilters(t),this.options.resizable&&this.plugins.ColumnResizer&&this.plugins.ColumnResizer.renderResizer(C.resizeColumn),y(this,"headerRendered")}renderFooter(){this.log("render footer");let t=this.querySelector("tfoot"),e=t.querySelector("td");t.removeAttribute("hidden"),d(e,"colspan",this.columnsLength(!0)),t.style.display=""}createColumnHeaders(t){let e=this.clientWidth,i=Math.round(e/this.columnsLength(!0)*2),s=0,o;o=x("tr"),this.headerRow=o,o.setAttribute("role","row"),o.setAttribute("aria-rowindex","1"),o.setAttribute("class","dg-head-columns");let r=t.querySelector("tr.dg-head-columns th");r||(r=x("th"),t.querySelector("tr").appendChild(r)),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createHeaderCol(o),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createHeaderCol(o),s=0;let l=0;if(this.options.columns.forEach(a=>{if(a.attr)return;let c=s+this.startColIndex(),h=x("th");h.setAttribute("scope","col"),h.setAttribute("role","columnheader button"),h.setAttribute("aria-colindex",""+c),h.setAttribute("id",G("dg-col-")),this.options.sort&&h.setAttribute("aria-sort","none"),h.setAttribute("field",a.field),this.plugins.ResponsiveGrid&&this.options.responsive&&d(h,"data-responsive",a.responsive||"");let u=O(a.title,r,!0)+20;h.dataset.minWidth=""+u,bt(h,a),h.tabIndex=0,h.textContent=a.title;let g=0;if(this.options.autosize&&this.plugins.AutosizeColumn){let m=Math.min(e-l,i);g=this.plugins.AutosizeColumn.computeSize(h,a,parseInt(h.dataset.minWidth),m)}else g=Math.max(parseInt(h.dataset.minWidth),parseInt(h.getAttribute("width")));d(h,"width",g),a.hidden?h.setAttribute("hidden",""):l+=g,this.options.reorder&&this.plugins.DraggableHeaders&&this.plugins.DraggableHeaders.makeHeaderDraggable(h),o.appendChild(h),s++}),le){this.log(`adjust width to fix size, ${t.offsetWidth} > ${e}`);let a=this.offsetWidth-this.clientWidth,c=t.offsetWidth-e-a;this.options.responsive&&this.plugins.ResponsiveGrid&&(c+=a),f(o,"th[width]").forEach(u=>{if(I(u,"dg-not-resizable")||c<=0)return;let g=parseInt(u.getAttribute("width")),m=u.dataset.minWidth?parseInt(u.dataset.minWidth):0;if(g>m){let v=g-c;v{a.addEventListener("click",()=>this.sortData(a))}),d(this.querySelector("table"),"aria-colcount",this.columnsLength(!0))}createColumnFilters(t){let e=0,i;i=x("tr"),this.filterRow=i,i.setAttribute("role","row"),i.setAttribute("aria-rowindex","2"),i.setAttribute("class","dg-head-filters"),this.options.filter||i.setAttribute("hidden",""),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createFilterCol(i),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createFilterCol(i),this.options.columns.forEach(s=>{if(s.attr)return;let o=e+this.startColIndex(),r=t.querySelector("tr.dg-head-columns th[aria-colindex='"+o+"']");if(!r){console.warn("Related th not found",o);return}let l=x("th");l.setAttribute("aria-colindex",""+o);let a=this.createFilterElement(s,r);this.options.filter?a.tabIndex=0:l.tabIndex=0,s.hidden&&l.setAttribute("hidden",""),l.appendChild(a),i.appendChild(l),e++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionFilter(i),t.replaceChild(i,t.querySelector("tr.dg-head-filters")),i.querySelectorAll(this.#t).forEach(s=>{let o=/select/i.test(s.tagName)?"change":"keyup";s.addEventListener(o,r=>{let l=r.keyCode||r.key;(l===13||l==="Enter"||!this.options.filterOnEnter||r.type=="change")&&this.filterData.call(this)})})}createFilterElement(t,e){let i=t.filterType=="select",s=i?x("select"):x("input");if(i){if(!Array.isArray(t.filterList)){let o=[...new Set((this.data??[]).map(r=>r[t.field]))].filter(r=>!!r).sort();t.filterList=[t.firstFilterOption||this.defaultColumn.firstFilterOption].concat(o.map(r=>({value:r,text:r})))}t.filterList.forEach(o=>{let r=x("option");r.value=o.value,r.text=o.text,s.add(r)})}else s.type="text",s.inputMode="search",s.autocomplete="off",s.spellcheck=!1;return s.dataset.name=t.field,s.id=G("dg-filter-"),s.setAttribute("aria-labelledby",e.getAttribute("id")),s}renderBody(){this.log("render body");let t,e,i,s=x("tbody");this.data.forEach((r,l)=>{t=x("tr"),d(t,"role","row"),d(t,"hidden",""),d(t,"aria-rowindex",l+1),t.tabIndex=0,this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createDataCol(t),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createDataCol(t),this.options.expand&&(t.classList.add("dg-expandable"),w(t,"click",a=>{this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.blockObserver(),pt(a.currentTarget,"dg-expanded"),this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.unblockObserver()})),i=0,this.options.columns.forEach(a=>{if(a||console.error("Empty column found!",this.options.columns),a.attr){r[a.field]&&(a.attr==="class"?L(t,r[a.field]):t.setAttribute(a.attr,r[a.field]));return}if(e=x("td"),e.setAttribute("role","gridcell"),e.setAttribute("aria-colindex",i+this.startColIndex()),bt(e,a),e.setAttribute("data-name",a.title),e.tabIndex=-1,a.editable&&this.plugins.EditableColumn)L(e,"dg-editable-col"),this.plugins.EditableColumn.makeEditableInput(e,a,r,l);else{let c=r[a.field]??"",h;switch(a.transform){case"uppercase":h=c.toUpperCase();break;case"lowercase":h=c.toLowerCase();break;default:h=c;break}if(a.format){if(a.defaultFormatValue!=null&&(h===""||h===null)&&(h=a.defaultFormatValue+""),typeof a.format=="string"&&h)e.innerHTML=N(a.format,Object.assign({_v:c,_tv:h},r));else if(a.format instanceof Function){let u=a.format.call(this,{column:a,rowData:r,cellData:h,td:e,tr:t});e.innerHTML=u||h||c}}else e.textContent=h}t.appendChild(e),i++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionRow(t,r),s.appendChild(t)}),s.setAttribute("role","rowgroup");let o=this.querySelector("tbody");s.setAttribute("data-empty",o.getAttribute("data-empty")),this.querySelector("table").replaceChild(s,o),this.plugins.FixedHeight&&this.plugins.FixedHeight.createFakeRow(),this.paginate(),this.plugins.SelectableRows&&this.plugins.SelectableRows.shouldSelectAll(s),this.data.length&&this.classList.remove("dg-empty"),y(this,"bodyRendered")}paginate(){this.log("paginate");let t=this.totalRecords(),e=this.page||1,i,s=e*this.options.perPage,o=s-this.options.perPage+1,r=this.querySelector("tbody"),l=this.querySelector("tfoot");s>t&&(s=t),t||(o=0),r.querySelectorAll("tr").forEach(a=>{if(this.options.server){S(a,"hidden");return}i=Number(k(a,"aria-rowindex")),i>s||i=this.pages,this.btnLast.disabled=this.page>=this.pages),l.querySelector(".dg-low").textContent=o.toString(),l.querySelector(".dg-high").textContent=s.toString(),l.querySelector(".dg-total").textContent=""+this.totalRecords(),l.toggleAttribute("hidden",this.options.autohidePager&&this.options.perPage>this.totalRecords())}totalPages(){return Math.ceil(this.totalRecords()/this.options.perPage)}totalRecords(){return this.options.server?this.meta?.[this.options.serverParams.metaFilteredKey]||0:this.data.length}},_=Z;var Q=class{constructor(t){this.grid=t}connected(){}disconnected(){}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}},b=Q;var tt=class extends b{constructor(t){super(t),this.isResizing=!1}renderResizer(t){let e=this.grid,i=e.table,s=f(e,"thead tr.dg-head-columns th");s.forEach(o=>{if(I(o,"dg-not-resizable"))return;let r=document.createElement("div");L(r,"dg-resizer"),r.ariaLabel=t,o.appendChild(r);let l=0,a=0,c=0,h=0,u=m=>{if(m.clientX>h)return;let v=a+(m.clientX-l);o.dataset.minWidth&&v>parseInt(o.dataset.minWidth)&&d(o,"width",v)},g=()=>{e.log("resized column"),setTimeout(()=>{this.isResizing=!1},0),q(r,"dg-resizer-active"),e.options.reorder&&(o.draggable=!0),o.style.overflow="hidden",W(document,"mousemove",u),W(document,"mouseup",g),y(e,"columnResized",{col:k(o,"field"),width:k(o,"width")})};w(r,"click",m=>{m.stopPropagation()}),w(r,"mousedown",m=>{m.stopPropagation(),this.isResizing=!0;let v=m.target,P=f(e,"dg-head-columns th").filter(p=>!p.hasAttribute("hidden")),A=P.findIndex(p=>p==v.parentNode);e.log("resize column"),L(r,"dg-resizer-active"),S(o,"draggable"),o.style.overflow="visible",r.style.height=i.offsetHeight-1+"px",l=m.clientX,a=o.offsetWidth,c=(P.length-A)*30,h=J(v).left+e.offsetWidth-c,d(o,"width",a);for(let p=0;pA&&S(s[p],"width");w(document,"mousemove",u),w(document,"mouseup",g)})})}},vt=tt;function B(n,t,e="nodeName"){let i=n;for(;i[e]!=t;)i=i.parentElement;return i}var et=class extends b{connected(){this.menu=this.grid.querySelector(".dg-menu")}disconnected(){this.grid.headerRow&&W(this.grid.headerRow,"contextmenu",this)}attachContextMenu(){let t=this.grid;w(t.headerRow,"contextmenu",this)}onchange(t){let e=this.grid,i=t.target,s=i.dataset.name;if(i.checked)e.showColumn(s);else{if(e.visibleColumns().length<=1){i.checked=!0;return}e.hideColumn(s)}}oncontextmenu(t){t.preventDefault();let e=this.grid,i=B(t.target,"THEAD"),s=this.menu,o=i.getBoundingClientRect(),r=t.clientX-o.left,l=t.clientY-o.top;s.style.top=`${l}px`,s.style.left=`${r}px`,S(s,"hidden"),r+150>o.width&&(r-=s.offsetWidth,s.style.left=`${r}px`);let a=c=>{s.contains(c.target)||(d(s,"hidden",""),W(document,"click",a))};w(document,"click",a)}createMenu(){let t=this.grid,e=this.menu;for(;e.lastChild;)e.removeChild(e.lastChild);e.addEventListener("change",this),t.options.columns.forEach(i=>{if(i.attr)return;let s=document.createElement("li"),o=document.createElement("label"),r=document.createElement("input");d(r,"type","checkbox"),d(r,"data-name",i.field),i.hidden||(r.checked=!0);let l=document.createTextNode(i.title);o.appendChild(r),o.appendChild(l),s.appendChild(o),e.appendChild(s)})}},xt=et;var it=class extends b{makeHeaderDraggable(t){let e=this.grid;t.draggable=!0,w(t,"dragstart",i=>{if(e.plugins.ColumnResizer&&e.plugins.ColumnResizer.isResizing&&i.preventDefault){i.preventDefault();return}e.log("reorder col"),i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",i.target.getAttribute("aria-colindex"))}),w(t,"dragover",i=>(i.preventDefault&&i.preventDefault(),i.dataTransfer.dropEffect="move",!1)),w(t,"drop",i=>{i.stopPropagation&&i.stopPropagation();let s=i.target,o=B(s,"TH"),r=parseInt(i.dataTransfer.getData("text/plain")),l=parseInt(o.getAttribute("aria-colindex"));if(r===l){e.log("reordered col stayed the same");return}e.log("reordered col from "+r+" to "+l);let a=e.startColIndex(),c=e.options.columns[r-a];e.options.columns[r-a]=e.options.columns[l-a],e.options.columns[l-a]=c;let h=(u,g)=>{let m=g.parentNode.getAttribute("aria-rowindex"),v=e.querySelector(u+" tr[aria-rowindex='"+m+"'] [aria-colindex='"+l+"']");d(g,"aria-colindex",l),d(v,"aria-colindex",r);let R=document.createElement("th");g.parentNode.insertBefore(R,g),v.parentNode.replaceChild(g,v),R.parentNode.replaceChild(v,R)};return f(e,"thead th[aria-colindex='"+r+"']").forEach(u=>{h("thead",u)}),f(e,'tbody td[aria-colindex="'+r+'"]').forEach(u=>{h("tbody",u)}),e.options.columns=f(e,"thead tr.dg-head-columns th[field]").map(u=>e.options.columns.find(g=>g.field==k(u,"field"))),y(e,"columnReordered",{col:c.field,from:r,to:l}),!1})}},yt=it;var st=class extends b{constructor(t){super(t),this.touch=null}connected(){let t=this.grid;t.addEventListener("touchstart",this,{passive:!0}),t.addEventListener("touchmove",this,{passive:!0})}disconnected(){let t=this.grid;t.removeEventListener("touchstart",this),t.removeEventListener("touchmove",this)}ontouchstart(t){this.touch=t.touches[0]}ontouchmove(t){if(!this.touch)return;let e=this.grid,i=this.touch.clientX-t.touches[0].clientX,s=this.touch.clientY-t.touches[0].clientY;Math.abs(i)>Math.abs(s)&&(i>0?e.getNext():e.getPrev()),this.touch=null}},Ct=st;var z="dg-selectable",At="dg-select-all",Pt="form-check-input",rt=class extends b{disconnected(){this.selectAll&&this.selectAll.removeEventListener("change",this)}getSelection(t=null){let e=this.grid,i=[];return f(e,`tbody .${z} input:checked`).forEach(o=>{let r=parseInt(o.dataset.id),l=e.data[r-1];l||console.warn(`Item ${r} not found`),t?i.push(l[t]):i.push(l)}),i}clearCheckboxes(t){if(!this.grid.options.selectVisibleOnly)return;f(t,`tr[hidden] .${z} input`).forEach(s=>{s.checked=!1}),this.selectAll.checked=!1}colIndex(){return this.grid.startColIndex()-2}createHeaderCol(t){let e=document.createElement("th");d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0,this.selectAll=document.createElement("input"),this.selectAll.type="checkbox",this.selectAll.classList.add(At),this.selectAll.classList.add(Pt),this.selectAll.addEventListener("change",this);let i=document.createElement("label");i.appendChild(this.selectAll),e.appendChild(i),e.setAttribute("width","40"),t.appendChild(e)}createFilterCol(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z),e.tabIndex=0,t.appendChild(e)}shouldSelectAll(t){this.selectAll&&(t.addEventListener("change",this),t.dispatchEvent(new Event("change")))}createDataCol(t){let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z);let i=document.createElement("input");i.dataset.id=t.getAttribute("aria-rowindex"),i.type="checkbox",i.classList.add(Pt);let s=document.createElement("label");s.classList.add("dg-clickable-cell"),s.appendChild(i),e.appendChild(s),s.addEventListener("click",this),t.appendChild(e)}onclick(t){t.stopPropagation()}onchange(t){let e=this.grid;if(I(t.target,At)){let i=e.options.selectVisibleOnly;f(e,`tbody .${z} input`).forEach(o=>{i&&!o.offsetWidth||(o.checked=this.selectAll.checked)}),y(e,"rowsSelected",{selection:this.getSelection()})}else{if(!t.target.closest(`.${z}`))return;let i=f(e,`tbody .${z} input[type=checkbox]`),s=i.filter(o=>o.checked);this.selectAll.checked=s.length==i.length,y(e,"rowsSelected",{selection:e.getSelection()})}}},wt=rt;var nt=class extends b{constructor(t){super(t),this.hasFixedHeight=!1,t.style.height&&(t.style.overflowY="auto",this.hasFixedHeight=!0)}createFakeRow(){let e=this.grid.querySelector("tbody"),i=document.createElement("tr");d(i,"role","row"),d(i,"hidden",""),i.classList.add("dg-fake-row"),i.tabIndex=0,e.appendChild(i)}get fakeRow(){return this.grid.querySelector(".dg-fake-row")}updateFakeRow(){let t=this.grid,e=this.fakeRow;if(!e||t.options.perPage>t.totalRecords()||t.page!==t.totalPages()||!t.options.autoheight)return;let i=t.options.perPage*t.rowHeight,s=t.querySelectorAll("tbody tr:not([hidden])").length,o=s>1?i-s*t.rowHeight:i;o>0?(d(e,"height",o),e.removeAttribute("hidden")):e.removeAttribute("height")}},Et=nt;var ot=class extends b{computeSize(t,e,i,s){let o=this.grid;if(V(t,"width"))return k(t,"width");if(!o.data.length)return;let r=o.data[0],l=o.data[o.data.length-1],a=r[e.field]?r[e.field].toString():"",c=l[e.field]?l[e.field].toString():"";c.length>a.length&&(a=c);let h=0;return a.length<=6?h=i:a.length>50?h=s:h=O(a+"0000",t),h>s&&(h=s),h{clearTimeout(e),e=setTimeout(()=>{e=null,n(...i)},t)}}var E="dg-responsive",lt;function zt(n){return n.sort((t,e)=>{let i=parseInt(t.dataset.responsive)||1;return(parseInt(e.dataset.responsive)||1)-i})}var Ot=at(n=>{for(let t of n){let e=t.target,i=e.table;if(e.plugins.ResponsiveGrid.observerBlocked)return;let s=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,o=parseInt(s.inlineSize),r=i.offsetWidth,l=f(e.headerRow,"th").reduce((P,A)=>P+A.offsetWidth,0),a=(l||r)-o-1,c=50,h=e.plugins.ResponsiveGrid.prevAction,u=zt(f(e.headerRow,"th[field]").reverse().filter(P=>P.dataset.responsive!=="0")),g=!1;if(e.log(`table is ${r}/${l} and available size is ${o}. Diff: ${a}`),a>0){if(h==="show")return;e.plugins.ResponsiveGrid.prevAction="hide";let P=a,A=u.filter(p=>!p.hasAttribute("hidden")&&p.hasAttribute("data-responsive"));if(A.length===0&&(A=u.filter(p=>!p.hasAttribute("hidden")),A.length===1))return;A.forEach(p=>{if(P<0)return;let $=p.offsetWidth,D=p.getAttribute("field");D&&(p.dataset.baseWidth=""+p.offsetWidth,e.hideColumn(D,!1),e.setColProp(D,"responsiveHidden",!0),g=!0,P-=$,P=Math.round(P))})}else{if(h==="hide")return;e.plugins.ResponsiveGrid.prevAction="show";let P=u.filter(p=>!p.hasAttribute("hidden")).reduce((p,$)=>{let D=$.dataset.minWidth?parseInt($.dataset.minWidth):$.offsetWidth;return p+D},0)+c,A=o-P;u.slice().reverse().filter(p=>p.hasAttribute("hidden")).forEach(p=>{if(AA){A=-1;return}let D=p.getAttribute("field");D&&(e.showColumn(D,!1),e.setColProp(D,"responsiveHidden",!1),g=!0,A-=$,A=Math.round(A))})}let m=T(e.table,"tfoot"),v=f(e.table,".dg-footer > div").reduce((P,A)=>P+A.offsetWidth,0),R=m.offsetWidth-v;v>o?L(m,"dg-footer-compact"):R>250&&q(m,"dg-footer-compact"),g&&e.renderTable(),setTimeout(()=>{e.plugins.ResponsiveGrid.prevAction=null},1e3),e.table.style.visibility="visible"}},100),Lt=new ResizeObserver(Ot),dt=class extends b{constructor(t){super(t),this.observerBlocked=!1,this.prevAction=null}connected(){this.grid.options.responsive&&this.observe()}disconnected(){this.unobserve()}observe(){this.grid.options.responsive&&(Lt.observe(this.grid),this.grid.style.display="block",this.grid.style.overflowX="hidden")}unobserve(){Lt.unobserve(this.grid),this.grid.style.display="unset",this.grid.style.overflowX="unset"}blockObserver(){this.observerBlocked=!0,lt&&clearTimeout(lt)}unblockObserver(){lt=setTimeout(()=>{this.observerBlocked=!1},200)}hasHiddenColumns(){let t=!1;return this.grid.options.columns.forEach(e=>{e.responsiveHidden&&(t=!0)}),t}colIndex(){return this.grid.startColIndex()-1}createHeaderCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),d(e,"width","40"),e.classList.add(`${E}-toggle`,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0}createFilterCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.tabIndex=0}createDataCol(t){if(!this.grid.options.responsiveToggle)return;let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.innerHTML=`
+`}get labels(){return C}static getLabels(){return C}static setLabels(t){C=Object.assign(C,t)}get defaultColumn(){return{field:"",title:"",width:0,class:"",attr:"",hidden:!1,editable:!1,noSort:!1,responsive:1,responsiveHidden:!1,format:"",transform:"",filterType:"text",firstFilterOption:{value:"",text:""}}}get defaultOptions(){return{id:null,url:null,perPage:10,debug:!1,filter:!1,menu:!1,sort:!1,server:!1,serverParams:{start:"start",length:"length",search:"search",sort:"sort",sortDir:"sortDir",dataKey:"data",metaKey:"meta",metaTotalKey:"total",metaFilteredKey:"filtered",optionsKey:"options",paramsKey:"params"},defaultSort:"",reorder:!1,dir:"ltr",perPageValues:[10,25,50,100,250],hidePerPage:!1,columns:[],actions:[],collapseActions:!1,selectable:!1,selectVisibleOnly:!0,defaultPage:1,resizable:!1,autosize:!0,expand:!1,autoheight:!0,autohidePager:!1,responsive:!1,responsiveToggle:!0,filterOnEnter:!0}}static registerPlugins(t){M=t}static unregisterPlugins(t=null){t===null?M={}:delete M[t]}static registeredPlugins(){return M}convertColumns(t){let e=[];return typeof t=="object"&&!Array.isArray(t)?Object.keys(t).forEach(i=>{let s=Object.assign({},this.defaultColumn);s.title=t[i],s.field=i,e.push(s)}):t.forEach(i=>{let s=Object.assign({},this.defaultColumn);typeof i=="string"?(s.title=i,s.field=i):typeof i=="object"?(s=Object.assign(s,i),s.field||console.error("Invalid column definition",i),s.title||(s.title=s.field)):console.error("Column definition must be a string or an object"),e.push(s)}),e}static get observedAttributes(){return["page","data-filter","data-sort","data-debug","data-reorder","data-menu","data-selectable","data-url","data-per-page","data-responsive"]}get transformAttributes(){return{columns:t=>this.convertColumns(K(t)),actions:t=>K(t),defaultPage:t=>parseInt(t),perPage:t=>parseInt(t)}}get page(){return parseInt(this.getAttribute("page"))}set page(t){d(this,"page",this.constrainPageValue(t))}urlChanged(){this.loadData().then(()=>{this.configureUi()})}constrainPageValue(t){return this.pages1&&this.page*this.options.perPage>this.totalRecords();)t--;t!=this.page?this.page=t:this.reload(()=>{(!this.plugins.FixedHeight||!this.plugins.FixedHeight.hasFixedHeight)&&this.selectPerPage.scrollIntoView()})}dirChanged(){d(this,"dir",this.options.dir)}defaultSortChanged(){this.sortChanged()}perPageValuesChanged(){if(this.selectPerPage){for(;this.selectPerPage.lastChild;)this.selectPerPage.removeChild(this.selectPerPage.lastChild);this.options.perPageValues.forEach(t=>{X(this.selectPerPage,t,t,t===this.options.perPage)})}}_connected(){this.table=this.querySelector("table"),this.btnFirst=this.querySelector(".dg-btn-first"),this.btnPrev=this.querySelector(".dg-btn-prev"),this.btnNext=this.querySelector(".dg-btn-next"),this.btnLast=this.querySelector(".dg-btn-last"),this.selectPerPage=this.querySelector(".dg-select-per-page"),this.inputPage=this.querySelector(".dg-input-page"),this.getFirst=this.getFirst.bind(this),this.getPrev=this.getPrev.bind(this),this.getNext=this.getNext.bind(this),this.getLast=this.getLast.bind(this),this.changePerPage=this.changePerPage.bind(this),this.gotoPage=this.gotoPage.bind(this),this.btnFirst.addEventListener("click",this.getFirst),this.btnPrev.addEventListener("click",this.getPrev),this.btnNext.addEventListener("click",this.getNext),this.btnLast.addEventListener("click",this.getLast),this.selectPerPage.addEventListener("change",this.changePerPage),this.selectPerPage.toggleAttribute("hidden",this.options.hidePerPage),this.inputPage.addEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.connected()}),this.dirChanged(),this.perPageValuesChanged(),this.loadData().finally(()=>{this.configureUi(),this.sortChanged(),this.classList.add("dg-initialized"),this.filterChanged(),this.reorderChanged(),this.dirChanged(),this.perPageValuesChanged(),this.pageChanged(),this.fireEvents=!0,this.log("initialized")})}_disconnected(){this.btnFirst.removeEventListener("click",this.getFirst),this.btnPrev.removeEventListener("click",this.getPrev),this.btnNext.removeEventListener("click",this.getNext),this.btnLast.removeEventListener("click",this.getLast),this.selectPerPage.removeEventListener("change",this.changePerPage),this.inputPage.removeEventListener("input",this.gotoPage),Object.values(this.plugins).forEach(t=>{t.disconnected()})}getCol(t){let e=null;return this.options.columns.forEach(i=>{i.field==t&&(e=i)}),e}getColProp(t,e){let i=this.getCol(t);return i?i[e]:null}setColProp(t,e,i){let s=this.getCol(t);s&&(s[e]=i)}visibleColumns(){return this.options.columns.filter(t=>!t.hidden)}hiddenColumns(){return this.options.columns.filter(t=>t.hidden===!0)}showColumn(t,e=!0){this.setColProp(t,"hidden",!1),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"visible"})}hideColumn(t,e=!0){this.setColProp(t,"hidden",!0),e&&this.renderTable(),y(this,"columnVisibility",{col:t,visibility:"hidden"})}startColIndex(){let t=1;return this.options.selectable&&this.plugins.SelectableRows&&t++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&t++,t}isSticky(){return this.hasAttribute("sticky")}columnsLength(t=!1){let e=0;return this.options.columns.forEach(i=>{t&&i.hidden||i.attr||e++}),this.options.selectable&&this.plugins.SelectableRows&&e++,this.options.actions.length&&this.plugins.RowActions&&e++,this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&e++,e}configureUi(){if(d(this.querySelector("table"),"aria-rowcount",this.data.length),this.table.style.visibility="hidden",this.renderTable(),this.options.responsive&&this.plugins.ResponsiveGrid||(this.table.style.visibility="visible"),!this.rowHeight){let t=T(this,"tbody tr")||T(this,"table tr");t&&(this.rowHeight=t.offsetHeight)}}filterChanged(){let t=this.querySelector("thead tr.dg-head-filters");this.options.filter?S(t,"hidden"):(this.clearFilters(),d(t,"hidden",""))}reorderChanged(){f(this,"thead tr.dg-head-columns th").forEach(e=>{e.classList.contains("dg-selectable")||e.classList.contains("dg-actions")||(this.options.reorder&&this.plugins.DraggableHeaders?e.draggable=!0:e.removeAttribute("draggable"))})}sortChanged(){this.log("toggle sort"),this.querySelectorAll("thead tr.dg-head-columns th").forEach(t=>{let e=t.getAttribute("field");t.classList.contains("dg-not-sortable")||!this.fireEvents&&e==this.options.defaultSort||(this.options.sort&&!this.getColProp(e,"noSort")?d(t,"aria-sort","none"):S(t,"aria-sort"))})}selectableChanged(){this.renderTable()}addRow(t){Array.isArray(this.originalData)&&(this.log("Add row"),this.originalData.push(t),this.data=this.originalData.slice(),this.sortData())}removeRow(t=null,e=null){if(Array.isArray(this.originalData)){e===null&&(e=this.options.columns[0].field),t===null&&(t=this.originalData[this.originalData.length-1][e]),this.log("Removing "+e+":"+t);for(let i=0;i{this.options.server||e?this.renderBody():this.paginate(),t&&t()})}loadData(){let t=()=>!this.data.length&&this.classList.add("dg-empty"),e=this.querySelector("tbody");return(this.meta||this.originalData||this.classList.contains("dg-initialized"))&&(!this.options.server||this.options.server&&!this.fireEvents)?(this.log("skip loadData"),t(),new Promise(i=>{i()})):(this.log("loadData"),this.loading=!0,this.classList.add("dg-loading"),this.classList.remove("dg-empty","dg-network-error"),this.fetchData().then(i=>{if(Array.isArray(i))this.data=i;else{if(!i[this.options.serverParams.dataKey]){console.error("Invalid response, it should contain a data key with an array or be a plain array",i),this.options.url=null;return}this.options=Object.assign(this.options,i[this.options.serverParams.optionsKey]??{}),this.meta=i[this.options.serverParams.metaKey]??{},this.data=i[this.options.serverParams.dataKey]}this.originalData=this.data.slice(),this.fixPage(),this.options.columns.length===0&&this.originalData.length?this.options.columns=this.convertColumns(Object.keys(this.originalData[0])):this.options.columns=this.convertColumns(this.options.columns)}).catch(i=>{this.log(i),i.message&&e.setAttribute("data-empty",i.message.replace(/^\s+|\r\n|\n|\r$/g,"")),this.classList.add("dg-empty","dg-network-error")}).finally(()=>{t(),!this.classList.contains("dg-network-error")&&e.getAttribute("data-empty")!=this.labels.noData&&e.setAttribute("data-empty",this.labels.noData),this.classList.remove("dg-loading"),this.loading=!1}))}getFirst(){this.loading||(this.page=1)}getLast(){this.loading||(this.page=this.pages)}getPrev(){this.loading||(this.page=this.page-1)}getNext(){this.loading||(this.page=this.page+1)}gotoPage(t){if(t.type==="keypress"){let e=t.keyCode||t.key;if(e===13||e==="Enter")t.preventDefault();else return}this.page=parseInt(this.inputPage.value)}getSort(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t?t.getAttribute("field"):this.options.defaultSort}getSortDir(){let t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");return t&&t.getAttribute("aria-sort")||""}getFilters(){let t=[];return f(this,this.#t).forEach(i=>{t[i.dataset.name]=i.value}),t}clearFilters(){f(this,this.#t).forEach(e=>{e.value=""}),this.filterData()}filterData(){if(this.log("filter data"),this.page=1,this.options.server)this.reload();else{this.data=this.originalData?.slice()??[],f(this,this.#t).forEach(i=>{let s=i.value;if(s){let o=i.dataset.name;this.data=this.data.filter(r=>(r[o]+"").toLowerCase().indexOf(s.toLowerCase())!==-1)}}),this.pageChanged();let e=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");this.options.sort&&e?this.sortData():this.renderBody()}}sortData(t=null){if(this.log("sort data"),t&&this.getColProp(t.getAttribute("field"),"noSort")){this.log("sorting prevented because column is not sortable");return}if(this.plugins.ColumnResizer&&this.plugins.ColumnResizer.isResizing){this.log("sorting prevented because resizing");return}if(this.loading){this.log("sorting prevented because loading");return}if(t!==null){let e=i=>["dg-selectable","dg-actions","dg-responsive-toggle"].includes(i);this.querySelectorAll("thead tr:first-child th").forEach(i=>{[...i.classList].some(e)||i!==t&&i.setAttribute("aria-sort","none")}),!t.hasAttribute("aria-sort")||t.getAttribute("aria-sort")==="none"?t.setAttribute("aria-sort","ascending"):t.getAttribute("aria-sort")==="ascending"?t.setAttribute("aria-sort","descending"):t.getAttribute("aria-sort")==="descending"&&t.setAttribute("aria-sort","none")}else t=this.querySelector("thead tr.dg-head-columns th[aria-sort$='scending']");if(this.options.server)this.loadData().finally(()=>{this.renderBody()});else{let e=t?t.getAttribute("aria-sort"):"none";if(e==="none"){let i=[];this.originalData?.some(s=>(this.data.some(o=>JSON.stringify(s)===JSON.stringify(o)?(i.push(o),!0):!1),i.length===this.data.length)),this.data=i}else{let i=t.getAttribute("field");this.data.sort((s,o)=>{if(!isNaN(s[i])&&!isNaN(o[i]))return e==="ascending"?s[i]-o[i]:o[i]-s[i];let r=e==="ascending"?s[i].toUpperCase():o[i].toUpperCase(),l=e==="ascending"?o[i].toUpperCase():s[i].toUpperCase();switch(!0){case r>l:return 1;case ro("No url set"));let t=window.location.href;t.split("/").pop().includes(".")||(t+=t.endsWith("/")?"":"/");let e=new URL(this.options.url,t),i={r:Date.now()};return this.options.server&&(i[this.options.serverParams.start]=this.page-1,i[this.options.serverParams.length]=this.options.perPage,this.options.filter&&(i[this.options.serverParams.search]=this.getFilters()),i[this.options.serverParams.sort]=this.getSort()||"",i[this.options.serverParams.sortDir]=this.getSortDir(),this.meta?.[this.options.serverParams.paramsKey]&&(i=Object.assign(i,this.meta[this.options.serverParams.paramsKey]))),Y(e,i),fetch(e).then(s=>{if(!s.ok)throw new Error(s.statusText||C.networkError);return s.json()})}renderTable(){this.log("render table"),this.options.menu&&this.plugins.ContextMenu&&this.plugins.ContextMenu.createMenu();let t;this.renderHeader(),this.options.defaultSort&&(t=this.querySelector("thead tr.dg-head-columns th[field='"+this.options.defaultSort+"']")),t?this.sortData(t):this.renderBody(),this.renderFooter()}renderHeader(){this.log("render header");let t=this.querySelector("thead");this.createColumnHeaders(t),this.createColumnFilters(t),this.options.resizable&&this.plugins.ColumnResizer&&this.plugins.ColumnResizer.renderResizer(C.resizeColumn),y(this,"headerRendered")}renderFooter(){this.log("render footer");let t=this.querySelector("tfoot"),e=t.querySelector("td");t.removeAttribute("hidden"),d(e,"colspan",this.columnsLength(!0)),t.style.display=""}createColumnHeaders(t){let e=this.clientWidth,i=Math.round(e/this.columnsLength(!0)*2),s=0,o;o=x("tr"),this.headerRow=o,o.setAttribute("role","row"),o.setAttribute("aria-rowindex","1"),o.setAttribute("class","dg-head-columns");let r=t.querySelector("tr.dg-head-columns th");r||(r=x("th"),t.querySelector("tr").appendChild(r)),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createHeaderCol(o),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createHeaderCol(o),s=0;let l=0;if(this.options.columns.forEach(a=>{if(a.attr)return;let c=s+this.startColIndex(),h=x("th");h.setAttribute("scope","col"),h.setAttribute("role","columnheader button"),h.setAttribute("aria-colindex",""+c),h.setAttribute("id",G("dg-col-")),this.options.sort&&h.setAttribute("aria-sort","none"),h.setAttribute("field",a.field),this.plugins.ResponsiveGrid&&this.options.responsive&&d(h,"data-responsive",a.responsive||"");let u=O(a.title,r,!0)+20;h.dataset.minWidth=""+u,bt(h,a),h.tabIndex=0,h.textContent=a.title;let g=0;if(this.options.autosize&&this.plugins.AutosizeColumn){let m=Math.min(e-l,i);g=this.plugins.AutosizeColumn.computeSize(h,a,parseInt(h.dataset.minWidth),m)}else g=Math.max(parseInt(h.dataset.minWidth),parseInt(h.getAttribute("width")));d(h,"width",g),a.hidden?h.setAttribute("hidden",""):l+=g,this.options.reorder&&this.plugins.DraggableHeaders&&this.plugins.DraggableHeaders.makeHeaderDraggable(h),o.appendChild(h),s++}),le){this.log(`adjust width to fix size, ${t.offsetWidth} > ${e}`);let a=this.offsetWidth-this.clientWidth,c=t.offsetWidth-e-a;this.options.responsive&&this.plugins.ResponsiveGrid&&(c+=a),f(o,"th[width]").forEach(u=>{if(I(u,"dg-not-resizable")||c<=0)return;let g=parseInt(u.getAttribute("width")),m=u.dataset.minWidth?parseInt(u.dataset.minWidth):0;if(g>m){let v=g-c;v{a.addEventListener("click",()=>this.sortData(a))}),d(this.querySelector("table"),"aria-colcount",this.columnsLength(!0))}createColumnFilters(t){let e=0,i;i=x("tr"),this.filterRow=i,i.setAttribute("role","row"),i.setAttribute("aria-rowindex","2"),i.setAttribute("class","dg-head-filters"),this.options.filter||i.setAttribute("hidden",""),this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createFilterCol(i),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createFilterCol(i),this.options.columns.forEach(s=>{if(s.attr)return;let o=e+this.startColIndex(),r=t.querySelector("tr.dg-head-columns th[aria-colindex='"+o+"']");if(!r){console.warn("Related th not found",o);return}let l=x("th");l.setAttribute("aria-colindex",""+o);let a=this.createFilterElement(s,r);this.options.filter?a.tabIndex=0:l.tabIndex=0,s.hidden&&l.setAttribute("hidden",""),l.appendChild(a),i.appendChild(l),e++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionFilter(i),t.replaceChild(i,t.querySelector("tr.dg-head-filters")),i.querySelectorAll(this.#t).forEach(s=>{let o=/select/i.test(s.tagName)?"change":"keyup";s.addEventListener(o,r=>{let l=r.keyCode||r.key;(l===13||l==="Enter"||!this.options.filterOnEnter||r.type=="change")&&this.filterData.call(this)})})}createFilterElement(t,e){let i=t.filterType=="select",s=i?x("select"):x("input");if(i){if(!Array.isArray(t.filterList)){let o=[...new Set((this.data??[]).map(r=>r[t.field]))].filter(r=>r).sort();t.filterList=[t.firstFilterOption||this.defaultColumn.firstFilterOption].concat(o.map(r=>({value:r,text:r})))}t.filterList.forEach(o=>{let r=x("option");r.value=o.value,r.text=o.text,s.add(r)})}else s.type="text",s.inputMode="search",s.autocomplete="off",s.spellcheck=!1;return s.dataset.name=t.field,s.id=G("dg-filter-"),s.setAttribute("aria-labelledby",e.getAttribute("id")),s}renderBody(){this.log("render body");let t,e,i,s=x("tbody");this.data.forEach((r,l)=>{t=x("tr"),d(t,"role","row"),d(t,"hidden",""),d(t,"aria-rowindex",l+1),t.tabIndex=0,this.options.selectable&&this.plugins.SelectableRows&&this.plugins.SelectableRows.createDataCol(t),this.options.responsive&&this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.hasHiddenColumns()&&this.plugins.ResponsiveGrid.createDataCol(t),this.options.expand&&(t.classList.add("dg-expandable"),w(t,"click",a=>{this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.blockObserver(),pt(a.currentTarget,"dg-expanded"),this.plugins.ResponsiveGrid&&this.plugins.ResponsiveGrid.unblockObserver()})),i=0,this.options.columns.forEach(a=>{if(a||console.error("Empty column found!",this.options.columns),a.attr){r[a.field]&&(a.attr==="class"?L(t,r[a.field]):t.setAttribute(a.attr,r[a.field]));return}if(e=x("td"),e.setAttribute("role","gridcell"),e.setAttribute("aria-colindex",i+this.startColIndex()),bt(e,a),e.setAttribute("data-name",a.title),e.tabIndex=-1,a.editable&&this.plugins.EditableColumn)L(e,"dg-editable-col"),this.plugins.EditableColumn.makeEditableInput(e,a,r,l);else{let c=r[a.field]??"",h;switch(a.transform){case"uppercase":h=c.toUpperCase();break;case"lowercase":h=c.toLowerCase();break;default:h=c;break}if(a.format){if(a.defaultFormatValue!=null&&(h===""||h===null)&&(h=a.defaultFormatValue+""),typeof a.format=="string"&&h)e.innerHTML=N(a.format,Object.assign({_v:c,_tv:h},r));else if(a.format instanceof Function){let u=a.format.call(this,{column:a,rowData:r,cellData:h,td:e,tr:t});e.innerHTML=u||h||c}}else e.textContent=h}t.appendChild(e),i++}),this.options.actions.length&&this.plugins.RowActions&&this.plugins.RowActions.makeActionRow(t,r),s.appendChild(t)}),s.setAttribute("role","rowgroup");let o=this.querySelector("tbody");s.setAttribute("data-empty",o.getAttribute("data-empty")),this.querySelector("table").replaceChild(s,o),this.plugins.FixedHeight&&this.plugins.FixedHeight.createFakeRow(),this.paginate(),this.plugins.SelectableRows&&this.plugins.SelectableRows.shouldSelectAll(s),this.data.length&&this.classList.remove("dg-empty"),y(this,"bodyRendered")}paginate(){this.log("paginate");let t=this.totalRecords(),e=this.page||1,i,s=e*this.options.perPage,o=s-this.options.perPage+1,r=this.querySelector("tbody"),l=this.querySelector("tfoot");s>t&&(s=t),t||(o=0),r.querySelectorAll("tr").forEach(a=>{if(this.options.server){S(a,"hidden");return}i=Number(k(a,"aria-rowindex")),i>s||i=this.pages,this.btnLast.disabled=this.page>=this.pages),l.querySelector(".dg-low").textContent=o.toString(),l.querySelector(".dg-high").textContent=s.toString(),l.querySelector(".dg-total").textContent=""+this.totalRecords(),l.toggleAttribute("hidden",this.options.autohidePager&&this.options.perPage>this.totalRecords())}totalPages(){return Math.ceil(this.totalRecords()/this.options.perPage)}totalRecords(){return this.options.server?this.meta?.[this.options.serverParams.metaFilteredKey]||0:this.data.length}},_=Z;var Q=class{constructor(t){this.grid=t}connected(){}disconnected(){}handleEvent(t){this[`on${t.type}`]&&this[`on${t.type}`](t)}},b=Q;var tt=class extends b{constructor(t){super(t),this.isResizing=!1}renderResizer(t){let e=this.grid,i=e.table,s=f(e,"thead tr.dg-head-columns th");s.forEach(o=>{if(I(o,"dg-not-resizable"))return;let r=document.createElement("div");L(r,"dg-resizer"),r.ariaLabel=t,o.appendChild(r);let l=0,a=0,c=0,h=0,u=m=>{if(m.clientX>h)return;let v=a+(m.clientX-l);o.dataset.minWidth&&v>parseInt(o.dataset.minWidth)&&d(o,"width",v)},g=()=>{e.log("resized column"),setTimeout(()=>{this.isResizing=!1},0),q(r,"dg-resizer-active"),e.options.reorder&&(o.draggable=!0),o.style.overflow="hidden",W(document,"mousemove",u),W(document,"mouseup",g),y(e,"columnResized",{col:k(o,"field"),width:k(o,"width")})};w(r,"click",m=>{m.stopPropagation()}),w(r,"mousedown",m=>{m.stopPropagation(),this.isResizing=!0;let v=m.target,P=f(e,"dg-head-columns th").filter(p=>!p.hasAttribute("hidden")),A=P.findIndex(p=>p==v.parentNode);e.log("resize column"),L(r,"dg-resizer-active"),S(o,"draggable"),o.style.overflow="visible",r.style.height=i.offsetHeight-1+"px",l=m.clientX,a=o.offsetWidth,c=(P.length-A)*30,h=J(v).left+e.offsetWidth-c,d(o,"width",a);for(let p=0;pA&&S(s[p],"width");w(document,"mousemove",u),w(document,"mouseup",g)})})}},vt=tt;function B(n,t,e="nodeName"){let i=n;for(;i[e]!=t;)i=i.parentElement;return i}var et=class extends b{connected(){this.menu=this.grid.querySelector(".dg-menu")}disconnected(){this.grid.headerRow&&W(this.grid.headerRow,"contextmenu",this)}attachContextMenu(){let t=this.grid;w(t.headerRow,"contextmenu",this)}onchange(t){let e=this.grid,i=t.target,s=i.dataset.name;if(i.checked)e.showColumn(s);else{if(e.visibleColumns().length<=1){i.checked=!0;return}e.hideColumn(s)}}oncontextmenu(t){t.preventDefault();let e=this.grid,i=B(t.target,"THEAD"),s=this.menu,o=i.getBoundingClientRect(),r=t.clientX-o.left,l=t.clientY-o.top;s.style.top=`${l}px`,s.style.left=`${r}px`,S(s,"hidden"),r+150>o.width&&(r-=s.offsetWidth,s.style.left=`${r}px`);let a=c=>{s.contains(c.target)||(d(s,"hidden",""),W(document,"click",a))};w(document,"click",a)}createMenu(){let t=this.grid,e=this.menu;for(;e.lastChild;)e.removeChild(e.lastChild);e.addEventListener("change",this),t.options.columns.forEach(i=>{if(i.attr)return;let s=document.createElement("li"),o=document.createElement("label"),r=document.createElement("input");d(r,"type","checkbox"),d(r,"data-name",i.field),i.hidden||(r.checked=!0);let l=document.createTextNode(i.title);o.appendChild(r),o.appendChild(l),s.appendChild(o),e.appendChild(s)})}},xt=et;var it=class extends b{makeHeaderDraggable(t){let e=this.grid;t.draggable=!0,w(t,"dragstart",i=>{if(e.plugins.ColumnResizer&&e.plugins.ColumnResizer.isResizing&&i.preventDefault){i.preventDefault();return}e.log("reorder col"),i.dataTransfer.effectAllowed="move",i.dataTransfer.setData("text/plain",i.target.getAttribute("aria-colindex"))}),w(t,"dragover",i=>(i.preventDefault&&i.preventDefault(),i.dataTransfer.dropEffect="move",!1)),w(t,"drop",i=>{i.stopPropagation&&i.stopPropagation();let s=i.target,o=B(s,"TH"),r=parseInt(i.dataTransfer.getData("text/plain")),l=parseInt(o.getAttribute("aria-colindex"));if(r===l){e.log("reordered col stayed the same");return}e.log("reordered col from "+r+" to "+l);let a=e.startColIndex(),c=e.options.columns[r-a];e.options.columns[r-a]=e.options.columns[l-a],e.options.columns[l-a]=c;let h=(u,g)=>{let m=g.parentNode.getAttribute("aria-rowindex"),v=e.querySelector(u+" tr[aria-rowindex='"+m+"'] [aria-colindex='"+l+"']");d(g,"aria-colindex",l),d(v,"aria-colindex",r);let R=document.createElement("th");g.parentNode.insertBefore(R,g),v.parentNode.replaceChild(g,v),R.parentNode.replaceChild(v,R)};return f(e,"thead th[aria-colindex='"+r+"']").forEach(u=>{h("thead",u)}),f(e,'tbody td[aria-colindex="'+r+'"]').forEach(u=>{h("tbody",u)}),e.options.columns=f(e,"thead tr.dg-head-columns th[field]").map(u=>e.options.columns.find(g=>g.field==k(u,"field"))),y(e,"columnReordered",{col:c.field,from:r,to:l}),!1})}},yt=it;var st=class extends b{constructor(t){super(t),this.touch=null}connected(){let t=this.grid;t.addEventListener("touchstart",this,{passive:!0}),t.addEventListener("touchmove",this,{passive:!0})}disconnected(){let t=this.grid;t.removeEventListener("touchstart",this),t.removeEventListener("touchmove",this)}ontouchstart(t){this.touch=t.touches[0]}ontouchmove(t){if(!this.touch)return;let e=this.grid,i=this.touch.clientX-t.touches[0].clientX,s=this.touch.clientY-t.touches[0].clientY;Math.abs(i)>Math.abs(s)&&(i>0?e.getNext():e.getPrev()),this.touch=null}},Ct=st;var z="dg-selectable",At="dg-select-all",Pt="form-check-input",rt=class extends b{disconnected(){this.selectAll&&this.selectAll.removeEventListener("change",this)}getSelection(t=null){let e=this.grid,i=[];return f(e,`tbody .${z} input:checked`).forEach(o=>{let r=parseInt(o.dataset.id),l=e.data[r-1];l||console.warn(`Item ${r} not found`),t?i.push(l[t]):i.push(l)}),i}clearCheckboxes(t){if(!this.grid.options.selectVisibleOnly)return;f(t,`tr[hidden] .${z} input`).forEach(s=>{s.checked=!1}),this.selectAll.checked=!1}colIndex(){return this.grid.startColIndex()-2}createHeaderCol(t){let e=document.createElement("th");d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0,this.selectAll=document.createElement("input"),this.selectAll.type="checkbox",this.selectAll.classList.add(At),this.selectAll.classList.add(Pt),this.selectAll.addEventListener("change",this);let i=document.createElement("label");i.appendChild(this.selectAll),e.appendChild(i),e.setAttribute("width","40"),t.appendChild(e)}createFilterCol(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z),e.tabIndex=0,t.appendChild(e)}shouldSelectAll(t){this.selectAll&&(t.addEventListener("change",this),t.dispatchEvent(new Event("change")))}createDataCol(t){let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(z);let i=document.createElement("input");i.dataset.id=t.getAttribute("aria-rowindex"),i.type="checkbox",i.classList.add(Pt);let s=document.createElement("label");s.classList.add("dg-clickable-cell"),s.appendChild(i),e.appendChild(s),s.addEventListener("click",this),t.appendChild(e)}onclick(t){t.stopPropagation()}onchange(t){let e=this.grid;if(I(t.target,At)){let i=e.options.selectVisibleOnly;f(e,`tbody .${z} input`).forEach(o=>{i&&!o.offsetWidth||(o.checked=this.selectAll.checked)}),y(e,"rowsSelected",{selection:this.getSelection()})}else{if(!t.target.closest(`.${z}`))return;let i=f(e,`tbody .${z} input[type=checkbox]`),s=i.filter(o=>o.checked);this.selectAll.checked=s.length==i.length,y(e,"rowsSelected",{selection:e.getSelection()})}}},wt=rt;var nt=class extends b{constructor(t){super(t),this.hasFixedHeight=!1,t.style.height&&(t.style.overflowY="auto",this.hasFixedHeight=!0)}createFakeRow(){let e=this.grid.querySelector("tbody"),i=document.createElement("tr");d(i,"role","row"),d(i,"hidden",""),i.classList.add("dg-fake-row"),i.tabIndex=0,e.appendChild(i)}get fakeRow(){return this.grid.querySelector(".dg-fake-row")}updateFakeRow(){let t=this.grid,e=this.fakeRow;if(!e||t.options.perPage>t.totalRecords()||t.page!==t.totalPages()||!t.options.autoheight)return;let i=t.options.perPage*t.rowHeight,s=t.querySelectorAll("tbody tr:not([hidden])").length,o=s>1?i-s*t.rowHeight:i;o>0?(d(e,"height",o),e.removeAttribute("hidden")):e.removeAttribute("height")}},Et=nt;var ot=class extends b{computeSize(t,e,i,s){let o=this.grid;if(V(t,"width"))return k(t,"width");if(!o.data.length)return;let r=o.data[0],l=o.data[o.data.length-1],a=r[e.field]?r[e.field].toString():"",c=l[e.field]?l[e.field].toString():"";c.length>a.length&&(a=c);let h=0;return a.length<=6?h=i:a.length>50?h=s:h=O(a+"0000",t),h>s&&(h=s),h{clearTimeout(e),e=setTimeout(()=>{e=null,n(...i)},t)}}var E="dg-responsive",lt;function zt(n){return n.sort((t,e)=>{let i=parseInt(t.dataset.responsive)||1;return(parseInt(e.dataset.responsive)||1)-i})}var Ot=at(n=>{for(let t of n){let e=t.target,i=e.table;if(e.plugins.ResponsiveGrid.observerBlocked)return;let s=Array.isArray(t.contentBoxSize)?t.contentBoxSize[0]:t.contentBoxSize,o=parseInt(s.inlineSize),r=i.offsetWidth,l=f(e.headerRow,"th").reduce((P,A)=>P+A.offsetWidth,0),a=(l||r)-o-1,c=50,h=e.plugins.ResponsiveGrid.prevAction,u=zt(f(e.headerRow,"th[field]").reverse().filter(P=>P.dataset.responsive!=="0")),g=!1;if(e.log(`table is ${r}/${l} and available size is ${o}. Diff: ${a}`),a>0){if(h==="show")return;e.plugins.ResponsiveGrid.prevAction="hide";let P=a,A=u.filter(p=>!p.hasAttribute("hidden")&&p.hasAttribute("data-responsive"));if(A.length===0&&(A=u.filter(p=>!p.hasAttribute("hidden")),A.length===1))return;A.forEach(p=>{if(P<0)return;let $=p.offsetWidth,D=p.getAttribute("field");D&&(p.dataset.baseWidth=""+p.offsetWidth,e.hideColumn(D,!1),e.setColProp(D,"responsiveHidden",!0),g=!0,P-=$,P=Math.round(P))})}else{if(h==="hide")return;e.plugins.ResponsiveGrid.prevAction="show";let P=u.filter(p=>!p.hasAttribute("hidden")).reduce((p,$)=>{let D=$.dataset.minWidth?parseInt($.dataset.minWidth):$.offsetWidth;return p+D},0)+c,A=o-P;u.slice().reverse().filter(p=>p.hasAttribute("hidden")).forEach(p=>{if(AA){A=-1;return}let D=p.getAttribute("field");D&&(e.showColumn(D,!1),e.setColProp(D,"responsiveHidden",!1),g=!0,A-=$,A=Math.round(A))})}let m=T(e.table,"tfoot"),v=f(e.table,".dg-footer > div").reduce((P,A)=>P+A.offsetWidth,0),R=m.offsetWidth-v;v>o?L(m,"dg-footer-compact"):R>250&&q(m,"dg-footer-compact"),g&&e.renderTable(),setTimeout(()=>{e.plugins.ResponsiveGrid.prevAction=null},1e3),e.table.style.visibility="visible"}},100),Lt=new ResizeObserver(Ot),dt=class extends b{constructor(t){super(t),this.observerBlocked=!1,this.prevAction=null}connected(){this.grid.options.responsive&&this.observe()}disconnected(){this.unobserve()}observe(){this.grid.options.responsive&&(Lt.observe(this.grid),this.grid.style.display="block",this.grid.style.overflowX="hidden")}unobserve(){Lt.unobserve(this.grid),this.grid.style.display="unset",this.grid.style.overflowX="unset"}blockObserver(){this.observerBlocked=!0,lt&&clearTimeout(lt)}unblockObserver(){lt=setTimeout(()=>{this.observerBlocked=!1},200)}hasHiddenColumns(){let t=!1;return this.grid.options.columns.forEach(e=>{e.responsiveHidden&&(t=!0)}),t}colIndex(){return this.grid.startColIndex()-1}createHeaderCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"scope","col"),d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),d(e,"width","40"),e.classList.add(`${E}-toggle`,"dg-not-resizable","dg-not-sortable"),e.tabIndex=0}createFilterCol(t){if(!this.grid.options.responsiveToggle)return;let e=x("th",t);d(e,"role","columnheader button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.tabIndex=0}createDataCol(t){if(!this.grid.options.responsiveToggle)return;let e=document.createElement("td");d(e,"role","gridcell button"),d(e,"aria-colindex",this.colIndex()),e.classList.add(`${E}-toggle`),e.innerHTML=`
`,t.appendChild(e),e.addEventListener("click",this),e.addEventListener("mousedown",this)}computeLabelWidth(){let t=0,e=0;for(;t<120;){e++;let i=T(this.grid,`.dg-head-columns th[aria-colindex="${e}"]`);if(i)t+=i.offsetWidth;else break}return t}onmousedown(t){t.preventDefault()}onclick(t){t.stopPropagation();let e=t.currentTarget,i=e.parentElement,s=T(e,`.${E}-open`),o=T(e,`.${E}-close`);if(this.blockObserver(),I(i,`${E}-expanded`)){q(i,`${E}-expanded`),s.style.display="unset",o.style.display="none";let l=i.nextElementSibling;f(l,`.${E}-hidden`).forEach(c=>{i.appendChild(c),d(c,"hidden")}),l.parentElement.removeChild(l)}else{L(i,`${E}-expanded`),s.style.display="none",o.style.display="unset";let l=x("tr");ft(l,i),L(l,`${E}-child-row`);let a=x("td",l);d(a,"colspan",this.grid.columnsLength(!0));let c=x("table",a);L(c,`${E}-table`);let h=f(i,`.${E}-hidden`),u=this.computeLabelWidth();h.forEach(g=>{let m=x("tr",c),v=g.dataset.name,R=x("th",m);R.style.width=`${u}px`,R.innerHTML=v,m.appendChild(g),S(g,"hidden")})}this.unblockObserver()}},kt=dt;var ht=class extends b{hasActions(){return this.grid.options.actions.length>0}makeActionHeader(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.grid.columnsLength(!0)),e.classList.add("dg-actions","dg-not-sortable","dg-not-resizable",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionFilter(t){let e=document.createElement("th");e.setAttribute("role","columnheader button"),e.setAttribute("aria-colindex",""+this.grid.columnsLength(!0)),e.classList.add("dg-actions",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionRow(t,e){let i=this.grid.labels,s=document.createElement("td");d(s,"role","gridcell"),d(s,"aria-colindex",this.grid.columnsLength(!0)),s.classList.add("dg-actions",this.actionClass),s.tabIndex=0;let o=document.createElement("button");o.classList.add("dg-actions-toggle"),o.innerHTML="\u2630",s.appendChild(o),w(o,"click",r=>{r.stopPropagation(),r.target.parentElement.classList.toggle("dg-actions-expand")}),this.grid.options.actions.forEach(r=>{let l=document.createElement("button");r.html?l.innerHTML=r.html:l.innerText=r.title??r.name,r.title&&(l.title=r.title),r.url&&(l.type="submit",l.formAction=N(r.url,e)),r.class&&l.classList.add(...r.class.split(" "));let a=c=>{if(c.stopPropagation(),r.confirm&&!confirm(i.areYouSure)){c.preventDefault();return}y(this.grid,"action",{data:e,action:r.name})};l.addEventListener("click",a),s.appendChild(l),r.default&&(t.classList.add("dg-actionable"),t.addEventListener("click",a))}),t.appendChild(s)}get actionClass(){return this.grid.options.actions.length<3&&!this.grid.options.collapseActions?"dg-actions-"+this.grid.options.actions.length:"dg-actions-more"}},Rt=ht;var ct=class extends b{makeEditableInput(t,e,i,s){let o=this.grid.getAttribute("id"),r=document.createElement("input");r.type=e.editableType||"text",r.type=="email"&&(r.inputMode="email"),r.type=="decimal"&&(r.type="text",r.inputMode="decimal"),r.autocomplete="off",r.spellcheck=!1,r.tabIndex=0,r.classList.add("dg-editable"),r.name=o.replace("-","_")+"["+(s+1)+"]["+e.field+"]",r.value=i[e.field],r.dataset.field=e.field,r.addEventListener("click",l=>l.stopPropagation()),r.addEventListener("keypress",l=>{if(l.type==="keypress"){let a=l.keyCode||l.key;(a===13||a==="Enter")&&(r.blur(),l.preventDefault())}}),r.addEventListener("blur",()=>{r.value!=i[r.dataset.field]&&(i[r.dataset.field]=r.value,y(this.grid,"edit",{data:i,value:r.value}))}),t.appendChild(r)}},Dt=ct;var ut=class extends b{add(){let t=this.grid;if(!t.options.showSpinner)return;let i=t.options.spinnerCssClasses,s=i.split(" ").map(r=>`.${r}`).join(""),o=` +
`,t.appendChild(e),e.addEventListener("click",this),e.addEventListener("mousedown",this)}computeLabelWidth(){let t=0,e=0;for(;t<120;){e++;let i=T(this.grid,`.dg-head-columns th[aria-colindex="${e}"]`);if(i)t+=i.offsetWidth;else break}return t}onmousedown(t){t.preventDefault()}onclick(t){t.stopPropagation();let e=t.currentTarget,i=e.parentElement,s=T(e,`.${E}-open`),o=T(e,`.${E}-close`);if(this.blockObserver(),I(i,`${E}-expanded`)){q(i,`${E}-expanded`),s.style.display="unset",o.style.display="none";let l=i.nextElementSibling;f(l,`.${E}-hidden`).forEach(c=>{i.appendChild(c),d(c,"hidden")}),l.parentElement.removeChild(l)}else{L(i,`${E}-expanded`),s.style.display="none",o.style.display="unset";let l=x("tr");ft(l,i),L(l,`${E}-child-row`);let a=x("td",l);d(a,"colspan",this.grid.columnsLength(!0));let c=x("table",a);L(c,`${E}-table`);let h=f(i,`.${E}-hidden`),u=this.computeLabelWidth();h.forEach(g=>{let m=x("tr",c),v=g.dataset.name,R=x("th",m);R.style.width=`${u}px`,R.innerHTML=v,m.appendChild(g),S(g,"hidden")})}this.unblockObserver()}},kt=dt;var ht=class extends b{hasActions(){return this.grid.options.actions.length>0}makeActionHeader(t){let e=document.createElement("th");d(e,"role","columnheader button"),d(e,"aria-colindex",this.grid.columnsLength(!0)),e.classList.add("dg-actions","dg-not-sortable","dg-not-resizable",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionFilter(t){let e=document.createElement("th");e.setAttribute("role","columnheader button"),e.setAttribute("aria-colindex",""+this.grid.columnsLength(!0)),e.classList.add("dg-actions",this.actionClass),e.tabIndex=0,t.appendChild(e)}makeActionRow(t,e){let i=this.grid.labels,s=document.createElement("td");d(s,"role","gridcell"),d(s,"aria-colindex",this.grid.columnsLength(!0)),s.classList.add("dg-actions",this.actionClass),s.tabIndex=0;let o=document.createElement("button");o.classList.add("dg-actions-toggle"),o.innerHTML="\u2630",s.appendChild(o),w(o,"click",r=>{r.stopPropagation(),r.target.parentElement.classList.toggle("dg-actions-expand")}),this.grid.options.actions.forEach(r=>{let l=document.createElement("button");r.html?l.innerHTML=r.html:l.innerText=r.title??r.name,r.title&&(l.title=r.title),r.url&&(l.type="submit",l.formAction=N(r.url,e)),r.class&&l.classList.add(...r.class.split(" "));let a=c=>{if(c.stopPropagation(),r.confirm&&!confirm(i.areYouSure)){c.preventDefault();return}y(this.grid,"action",{data:e,action:r.name})};l.addEventListener("click",a),s.appendChild(l),r.default&&(t.classList.add("dg-actionable"),t.addEventListener("click",a))}),t.appendChild(s)}get actionClass(){return this.grid.options.actions.length<3&&!this.grid.options.collapseActions?"dg-actions-"+this.grid.options.actions.length:"dg-actions-more"}},Rt=ht;var ct=class extends b{makeEditableInput(t,e,i,s){let o=this.grid.getAttribute("id"),r=document.createElement("input");r.type=e.editableType||"text",r.type=="email"&&(r.inputMode="email"),r.type=="decimal"&&(r.type="text",r.inputMode="decimal"),r.autocomplete="off",r.spellcheck=!1,r.tabIndex=0,r.classList.add("dg-editable"),r.name=o.replace("-","_")+"["+(s+1)+"]["+e.field+"]",r.value=i[e.field],r.dataset.field=e.field,r.addEventListener("click",l=>l.stopPropagation()),r.addEventListener("keypress",l=>{if(l.type==="keypress"){let a=l.keyCode||l.key;(a===13||a==="Enter")&&(r.blur(),l.preventDefault())}}),r.addEventListener("blur",()=>{r.value!=i[r.dataset.field]&&(i[r.dataset.field]=r.value,y(this.grid,"edit",{data:i,value:r.value}))}),t.appendChild(r)}},Dt=ct;var ut=class extends b{add(){let t=this.grid,e=t.options.spinnerClass;if(!e)return;let i=e.split(" ").map(o=>`.${o}`).join(""),s=` -`;if(!H("#dg-styles")){let r=H("head")??H("body"),l=/head/i.test(r.tagName)?"beforeend":"afterbegin";r.insertAdjacentHTML(l,o)}!H(`i${s}`,t)&&t.insertAdjacentHTML("afterbegin",``)}},$t=ut;_.registerPlugins({ColumnResizer:vt,ContextMenu:xt,DraggableHeaders:yt,TouchSupport:Ct,SelectableRows:wt,FixedHeight:Et,AutosizeColumn:St,ResponsiveGrid:kt,RowActions:Rt,EditableColumn:Dt,SpinnerSupport:$t});customElements.get("data-grid")||customElements.define("data-grid",_);var li=_;export{li as default}; +`;if(!H("#dg-styles")){let o=H("head")??H("body"),r=/head/i.test(o.tagName)?"beforeend":"afterbegin";o.insertAdjacentHTML(r,s)}!H(`i${i}`,t)&&t.insertAdjacentHTML("afterbegin",``)}},$t=ut;_.registerPlugins({ColumnResizer:vt,ContextMenu:xt,DraggableHeaders:yt,TouchSupport:Ct,SelectableRows:wt,FixedHeight:Et,AutosizeColumn:St,ResponsiveGrid:kt,RowActions:Rt,EditableColumn:Dt,SpinnerSupport:$t});customElements.get("data-grid")||customElements.define("data-grid",_);var li=_;export{li as default}; //# sourceMappingURL=data-grid.min.js.map diff --git a/dist/data-grid.min.js.map b/dist/data-grid.min.js.map index 1038c73..40a08ab 100644 --- a/dist/data-grid.min.js.map +++ b/dist/data-grid.min.js.map @@ -1,7 +1,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/interpolate.js", "../src/utils/getTextWidth.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", "../src/plugins/row-actions.js", "../src/plugins/editable-column.js", "../src/plugins/spinner-support.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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading\r\n * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.showSpinner && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true,\r\n showSpinner: false,\r\n spinnerCssClasses: \"\"\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { $ } from \"../utils/shortcuts.js\"\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n show = grid.options.showSpinner;\r\n if (!show) return;\r\n const cssClasses = grid.options.spinnerCssClasses,\r\n cls = cssClasses.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!$(\"#dg-styles\")) {\r\n const styleParent = $(\"head\") ?? $(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n !$(`i${cls}`, grid) && grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;\r\n", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get(\"data-grid\")) {\r\n customElements.define(\"data-grid\", DataGrid);\r\n}\r\n\r\nexport default DataGrid;\r\n"], - "mappings": "AAIe,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,GAAK,CAAC,IAAK,GAAG,EAAE,SAASA,EAAE,UAAU,EAAG,CAAC,CAAC,EAC5C,GAAI,CAEF,OAAIA,EAAE,QAAQ,GAAG,IAAM,KACrBA,EAAIA,EAAE,QAAQ,KAAM,GAAG,GAElB,KAAK,MAAM,mBAAmBA,CAAC,CAAC,CACzC,MAAQ,CACN,eAAQ,MAAM,mBAAqBA,CAAC,EAC7B,CAAC,CAC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,iBAAAC,GACA,aAAAC,GACA,eAAAC,GACA,YAAAC,GACA,eAAAC,GACA,eAAAC,GACA,WAAAC,GACA,eAAAC,GACA,eAAAC,EACF,CAAC,EAGI,eAAe,IAAI,WAAW,GACjC,eAAe,OAAO,YAAaX,CAAQ,EAG7C,IAAOA,GAAQA", - "names": ["camelize", "str", "m", "chr", "normalizeData", "v", "supportedPassiveTypes", "passiveOpts", "type", "getAttribute", "el", "name", "hasAttribute", "setAttribute", "v", "check", "removeAttribute", "on", "listener", "off", "dispatch", "el", "name", "data", "bubbles", "opts", "hasClass", "addClass", "removeClass", "toggleClass", "$", "selector", "base", "$$", "find", "findAll", "ce", "tagName", "parent", "el", "insertAfter", "newNode", "existingNode", "BaseElement", "options", "opt", "v", "setAttribute", "jsonConfig", "data", "key", "normalizeData", "message", "getAttribute", "event", "template", "dispatch", "attributeName", "oldValue", "newValue", "isOption", "transformer", "camelize", "base_element_default", "addSelectOption", "el", "value", "label", "checked", "opt", "appendParamsToUrl", "url", "params", "key", "k", "convertArray", "v", "elementOffset", "el", "rect", "scrollLeft", "scrollTop", "interpolate", "str", "data", "$1", "$2", "getTextWidth", "text", "el", "withPadding", "styles", "fontWeight", "fontSize", "fontFamily", "padding", "paddingLeft", "paddingRight", "context", "metrics", "randstr", "prefix", "plugins", "labels", "applyColumnDefinition", "el", "column", "setAttribute", "addClass", "DataGrid", "_DataGrid", "base_element_default", "#filterSelector", "randstr", "pluginName", "pluginClass", "attr", "camelize", "v", "list", "plugin", "columns", "cols", "key", "col", "item", "convertArray", "val", "updatePage", "addSelectOption", "field", "found", "prop", "c", "render", "dispatch", "start", "visibleOnly", "len", "tr", "find", "row", "removeAttribute", "findAll", "th", "fieldName", "value", "data", "metaKey", "dataKey", "cb", "needRender", "flagEmpty", "tbody", "resolve", "response", "err", "event", "filters", "input", "name", "haveClasses", "sort", "stack", "itemA", "itemB", "a", "b", "valA", "valB", "reject", "base", "url", "params", "appendParamsToUrl", "sortedColumn", "thead", "tfoot", "td", "availableWidth", "colMaxWidth", "idx", "ce", "sampleTh", "totalWidth", "colIdx", "computedWidth", "getTextWidth", "w", "colAvailableWidth", "visibleCols", "lastCol", "scrollbarWidth", "diff", "hasClass", "actualWidth", "minWidth", "newWidth", "sortableRow", "relatedTh", "filter", "eventName", "e", "isSelect", "uniqueValues", "opt", "i", "on", "ev", "toggleClass", "tv", "interpolate", "prev", "total", "p", "index", "high", "low", "getAttribute", "data_grid_default", "BasePlugin", "grid", "event", "base_plugin_default", "ColumnResizer", "base_plugin_default", "grid", "resizeLabel", "table", "cols", "findAll", "col", "hasClass", "resizer", "addClass", "startX", "startW", "remainingSpace", "max", "mouseMoveHandler", "e", "newWidth", "setAttribute", "mouseUpHandler", "removeClass", "off", "dispatch", "getAttribute", "on", "target", "visibleCols", "columnIndex", "column", "removeAttribute", "elementOffset", "j", "column_resizer_default", "getParentElement", "el", "type", "prop", "parent", "ContextMenu", "base_plugin_default", "off", "grid", "on", "e", "t", "field", "target", "getParentElement", "menu", "rect", "x", "y", "removeAttribute", "documentClickHandler", "setAttribute", "col", "li", "label", "checkbox", "text", "context_menu_default", "DraggableHeaders", "base_plugin_default", "th", "grid", "on", "e", "t", "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", "SELECTABLE_CLASS", "SELECT_ALL_CLASS", "CHECKBOX_CLASS", "SelectableRows", "base_plugin_default", "key", "grid", "selectedData", "findAll", "checkbox", "idx", "item", "tbody", "input", "tr", "th", "setAttribute", "label", "td", "selectOne", "e", "hasClass", "visibleOnly", "cb", "dispatch", "totalCheckboxes", "totalChecked", "n", "selectable_rows_default", "FixedHeight", "base_plugin_default", "grid", "tbody", "tr", "setAttribute", "fakeRow", "max", "visibleRows", "fakeHeight", "fixed_height_default", "AutosizeColumn", "base_plugin_default", "th", "column", "min", "max", "grid", "hasAttribute", "getAttribute", "firstVal", "lastVal", "v", "v2", "width", "getTextWidth", "setAttribute", "autosize_column_default", "debounce", "handler", "timeout", "timer", "args", "RESPONSIVE_CLASS", "obsTo", "sortByPriority", "list", "a", "b", "v1", "callback", "debounce", "entries", "entry", "grid", "table", "contentBoxSize", "size", "tableWidth", "realTableWidth", "findAll", "result", "th", "diff", "minWidth", "prevAction", "headerCols", "col", "changed", "remaining", "cols", "colWidth", "field", "requiredWidth", "width", "footer", "find", "realFooterWidth", "div", "availableFooterWidth", "addClass", "removeClass", "resizeObserver", "ResponsiveGrid", "base_plugin_default", "flag", "tr", "ce", "setAttribute", "td", "idealWidth", "consideredCol", "hCol", "ev", "open", "close", "hasClass", "childRow", "insertAfter", "childRowTd", "childTable", "hiddenCols", "childTableRow", "label", "labelCol", "removeAttribute", "responsive_grid_default", "RowActions", "base_plugin_default", "tr", "actionsTh", "setAttribute", "item", "labels", "td", "actionsToggle", "on", "ev", "action", "button", "interpolate", "actionHandler", "dispatch", "row_actions_default", "EditableColumn", "base_plugin_default", "td", "column", "item", "i", "gridId", "input", "ev", "key", "dispatch", "editable_column_default", "SpinnerSupport", "base_plugin_default", "grid", "cssClasses", "cls", "e", "template", "$", "styleParent", "position", "spinner_support_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", "row_actions_default", "editable_column_default", "spinner_support_default"] + "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 && [\"[\", \"{\"].includes(v.substring(0, 1))) {\r\n try {\r\n // In case we have only single quoted values, like ['one', 'two', 'three']\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.error(\"Failed to parse \" + v);\r\n return {};\r\n }\r\n }\r\n return v;\r\n}\r\n", "/**\r\n * @typedef FlexibleHTMLProps\r\n * @property {boolean} [checked] (HTMLInputElement)\r\n * @property {string} [value] (HTMLInputElement)\r\n * @property {number} [rowHeight] (HTMLTableRowElement)\r\n *\r\n * A flexible type HTMLElement type that does not require using instanceof all over the place\r\n * Make sure that your selector is indeed valid\r\n * Only includes most commons props\r\n * @typedef {HTMLElement & FlexibleHTMLProps} FlexibleHTMLElement\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {HTMLElement&HTMLInputElement&HTMLTableRowElement} MixedHTMLElement\r\n */\r\n\r\n/**\r\n * @typedef FlexibleEventProps\r\n * @property {FlexibleHTMLElement} target\r\n * @property {FlexibleHTMLElement} currentTarget\r\n * @property {DataTransfer} [dataTransfer] (DragEvent)\r\n * @property {number} [clientX] (MouseEvent)\r\n * @property {number} [clientY] (MouseEvent)\r\n *\r\n * @typedef {Event & FlexibleEventProps} FlexibleEvent\r\n */\r\n\r\n/**\r\n * Keep this as reference for easy documentation\r\n * @typedef {Event&MouseEvent&InputEvent&DragEvent&FocusEvent&KeyboardEvent&PointerEvent} MixedEvent\r\n */\r\n\r\n/**\r\n * @callback FlexibleListener\r\n * @param {FlexibleEvent} event\r\n */\r\n\r\nclass FlexibleEventListenerObject {\r\n /**\r\n * @param {FlexibleEvent} e\r\n */\r\n handleEvent(e) {}\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 * Automatically set passive options based on type\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 {EventListenerObject|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 {EventListenerObject|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 {EventListenerObject|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.split(\" \"));\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.split(\" \"));\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 {FlexibleHTMLElement|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}\r\n */\r\nexport function $$(selector, base = document) {\r\n return Array.from(base.querySelectorAll(selector));\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped element\r\n * For actual type, prefer use of el.querySelector\r\n * @param {HTMLElement} el\r\n * @param {String|HTMLElement} selector\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function find(el, selector) {\r\n return $(selector, el);\r\n}\r\n\r\n/**\r\n * Easily retrieve untyped elements\r\n * For actual type, prefer use of el.querySelectorAll\r\n * @param {Element} el\r\n * @param {String} selector\r\n * @returns {Array}\r\n */\r\nexport function findAll(el, selector) {\r\n return $$(selector, el);\r\n}\r\n\r\n/**\r\n * @param {*} el\r\n * @returns {FlexibleHTMLElement}\r\n */\r\nexport function el(el) {\r\n return el;\r\n}\r\n\r\n/**\r\n * @template {keyof HTMLElementTagNameMap} K\r\n * @param {K} tagName\r\n * @param {HTMLElement} parent\r\n * @returns {HTMLElementTagNameMap[K]}\r\n */\r\nexport function ce(tagName, parent = null) {\r\n const el = document.createElement(tagName);\r\n if (parent) {\r\n parent.appendChild(el);\r\n }\r\n return el;\r\n}\r\n\r\n/**\r\n * @param {HTMLElement} newNode\r\n * @param {HTMLElement} existingNode\r\n */\r\nexport function insertAfter(newNode, existingNode) {\r\n existingNode.parentNode.insertBefore(newNode, existingNode.nextSibling);\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 jsonConfig = this.dataset.config ? JSON.parse(this.dataset.config) : {};\r\n let data = { ...this.dataset };\r\n for (var key in data) {\r\n if (key == \"config\") {\r\n continue;\r\n }\r\n data[key] = normalizeData(data[key]);\r\n }\r\n // Once normalized, merge into json config\r\n Object.assign(data, jsonConfig);\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 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 * 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 * 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 * @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 interpolate from \"./utils/interpolate.js\";\r\nimport getTextWidth from \"./utils/getTextWidth.js\";\r\nimport randstr from \"./utils/randstr.js\";\r\nimport {\r\n dispatch,\r\n find,\r\n findAll,\r\n hasClass,\r\n removeAttribute,\r\n getAttribute,\r\n setAttribute,\r\n addClass,\r\n toggleClass,\r\n on,\r\n ce,\r\n} from \"./utils/shortcuts.js\";\r\n\r\n/**\r\n * Column definition\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} [noSort] - allow disabling sort for a given column\r\n * @property {String | Function} [format] - custom data formatting\r\n * @property {String} [defaultFormatValue] - default value to use for formatting\r\n * @property {String} [transform] - custom value transformation\r\n * @property {Boolean} [editable] - replace with input (EditableColumn module)\r\n * @property {String} [editableType] - type of input (EditableColumn module)\r\n * @property {Number} [responsive] - the higher the value, the sooner it will be hidden, disable with 0 (ResponsiveGrid module)\r\n * @property {Boolean} [responsiveHidden] - hidden through responsive module (ResponsiveGrid module)\r\n * @property {String} [filterType] - defines a filter field type (\"text\" or \"select\" - defaults to \"text\")\r\n * @property {Array} [filterList] - defines a custom array to populate a filter select field in the format of [{value: \"\", text: \"\"},...]. When defined, it overrides the default behaviour where the filter select elements are populated by the unique values from the corresponding column records.\r\n * @property {Object} [firstFilterOption] - defines an object for the first option element of the filter select field. defaults to {value: \"\", text: \"\"}\r\n */\r\n\r\n/**\r\n * Row action\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/** @typedef {import('./plugins/autosize-column').default} AutosizeColumn */\r\n/** @typedef {import('./plugins/column-resizer').default} ColumnResizer */\r\n/** @typedef {import('./plugins/context-menu').default} ContextMenu */\r\n/** @typedef {import('./plugins/draggable-headers').default} DraggableHeaders */\r\n/** @typedef {import('./plugins/editable-column').default} EditableColumn */\r\n/** @typedef {import('./plugins/fixed-height').default} FixedHeight */\r\n/** @typedef {import('./plugins/responsive-grid').default} ResponsiveGrid */\r\n/** @typedef {import('./plugins/row-actions').default} RowActions */\r\n/** @typedef {import('./plugins/selectable-rows').default} SelectableRows */\r\n/** @typedef {import('./plugins/touch-support').default} TouchSupport */\r\n/** @typedef {import('./plugins/spinner-support').default} SpinnerSupport */\r\n\r\n/**\r\n * These plugins are all optional\r\n * @typedef {Object} Plugins\r\n * @property {ColumnResizer} [ColumnResizer] resize handlers in the headers\r\n * @property {ContextMenu} [ContextMenu] menu to show/hide columns\r\n * @property {DraggableHeaders} [DraggableHeaders] draggable headers columns\r\n * @property {EditableColumn} [EditableColumn] draggable headers columns\r\n * @property {TouchSupport} [TouchSupport] touch swipe\r\n * @property {SelectableRows} [SelectableRows] create a column with checkboxes to select rows\r\n * @property {FixedHeight} [FixedHeight] allows having fixed height tables\r\n * @property {AutosizeColumn} [AutosizeColumn] compute ideal width based on column content\r\n * @property {ResponsiveGrid} [ResponsiveGrid] hide/show column on the fly\r\n * @property {RowActions} [RowActions] add action on rows\r\n * @property {SpinnerSupport} [SpinnerSupport] inserts a spinning icon element to indicate grid loading.\r\n */\r\n\r\n/**\r\n * Parameters to pass along or receive from the server\r\n * @typedef 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.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 */\r\n\r\n/**\r\n * Available data grid options, plugins included\r\n * @typedef Options\r\n * @property {?String} id Custom id for the grid\r\n * @property {?String} url An URL with data to display in JSON format\r\n * @property {Boolean} debug Log actions in DevTools console\r\n * @property {Boolean} filter Allows a filtering functionality\r\n * @property {Boolean} sort Allows a sort by column functionality\r\n * @property {String} defaultSort Default sort field if sorting is enabled\r\n * @property {Boolean} server Is a server side powered grid\r\n * @property {ServerParams} serverParams Describe keys passed to the server backend\r\n * @property {String} dir Dir\r\n * @property {Array} perPageValues Available per page options\r\n * @property {Boolean} hidePerPage Hides the page size select element\r\n * @property {Column[]} columns Available columns\r\n * @property {Number} defaultPage Starting page\r\n * @property {Number} perPage Number of records displayed per page (page size)\r\n * @property {Boolean} expand Allow cell content to spawn over multiple lines\r\n * @property {Action[]} actions Row actions (RowActions module)\r\n * @property {Boolean} collapseActions Group actions (RowActions module)\r\n * @property {Boolean} resizable Make columns resizable (ColumnResizer module)\r\n * @property {Boolean} selectable Allow selecting rows with a checkbox (SelectableRows module)\r\n * @property {Boolean} selectVisibleOnly Select all only selects visible rows (SelectableRows module)\r\n * @property {Boolean} autosize Compute column sizes based on given data (Autosize module)\r\n * @property {Boolean} autoheight Adjust height so that it matches table size (FixedHeight module)\r\n * @property {Boolean} autohidePager auto-hides the pager when number of records falls below the selected page size\r\n * @property {Boolean} menu Right click menu on column headers (ContextMenu module)\r\n * @property {Boolean} reorder Allows a column reordering functionality (DraggableHeaders module)\r\n * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module)\r\n * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module)\r\n * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key \r\n * @property {String} spinnerClass Sets a space-delimited string of css classes for a spinner (use spinner-border css class for bootstrap 5 spinner)\r\n */\r\n\r\n/**\r\n * Available labels that can be translated\r\n * @typedef Labels\r\n * @property {String} itemsPerPage\r\n * @property {String} gotoPage\r\n * @property {String} gotoFirstPage\r\n * @property {String} gotoPrevPage\r\n * @property {String} gotoNextPage\r\n * @property {String} gotoLastPage\r\n * @property {String} of\r\n * @property {String} items\r\n * @property {String} resizeColumn\r\n * @property {String} noData\r\n * @property {String} areYouSure\r\n * @property {String} networkError\r\n */\r\n\r\n/**\r\n * List of registered plugins\r\n * @type {Plugins}\r\n */\r\nlet plugins = {};\r\n\r\n/**\r\n * @type {Labels}\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 networkError: \"Network response error\",\r\n};\r\n\r\n/**\r\n * Column definition will update some props on the html element\r\n * @param {HTMLElement} el\r\n * @param {Column} column\r\n */\r\nfunction applyColumnDefinition(el, column) {\r\n if (column.width) {\r\n setAttribute(el, \"width\", column.width);\r\n }\r\n if (column.class) {\r\n addClass(el, column.class);\r\n }\r\n if (column.hidden) {\r\n setAttribute(el, \"hidden\", \"\");\r\n if (column.responsiveHidden) {\r\n addClass(el, \"dg-responsive-hidden\");\r\n }\r\n }\r\n}\r\n\r\n/**\r\n */\r\nclass DataGrid extends BaseElement {\r\n #filterSelector = \"[id^=dg-filter]\";\r\n\r\n _ready() {\r\n setAttribute(this, \"id\", this.options.id ?? randstr(\"el-\"), true);\r\n\r\n /**\r\n * The grid displays that data\r\n * @type {Array}\r\n */\r\n this.data = [];\r\n /**\r\n * We store the original data in this\r\n * @type {Array}\r\n */\r\n this.originalData; // declared uninitialized to allow data preloading before fetch.\r\n\r\n // Make the IDE happy\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.page = this.options.defaultPage || 1;\r\n this.pages = 0;\r\n this.meta; // declared uninitialized to allow data preloading before fetch.\r\n /**\r\n * @type {Plugins}\r\n */\r\n this.plugins = {};\r\n // Init plugins\r\n for (const [pluginName, pluginClass] of Object.entries(plugins)) {\r\n // @ts-ignore until we can set typeof import ...\r\n this.plugins[pluginName] = new pluginClass(this);\r\n }\r\n\r\n // Expose options as observed attributes in the dom\r\n // Do it when fireEvents is disabled to avoid firing change 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 // Inserts spinner\r\n if (this.options.spinnerClass && this.plugins.SpinnerSupport)\r\n this.plugins.SpinnerSupport.add();\r\n }\r\n\r\n static template() {\r\n return `\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
\r\n`;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n get labels() {\r\n return labels;\r\n }\r\n\r\n /**\r\n * @returns {Labels}\r\n */\r\n static getLabels() {\r\n return labels;\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 responsiveHidden: false,\r\n format: \"\",\r\n transform: \"\",\r\n filterType: \"text\",\r\n firstFilterOption: { value: \"\", text: \"\" }\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 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 hidePerPage: false,\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 autohidePager: false,\r\n responsive: false,\r\n responsiveToggle: true,\r\n filterOnEnter: true\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 /**\r\n * @param {String} plugin\r\n */\r\n static unregisterPlugins(plugin = null) {\r\n if (plugin === null) {\r\n plugins = {};\r\n } else {\r\n delete plugins[plugin];\r\n }\r\n }\r\n\r\n /**\r\n * @returns {Plugins}\r\n */\r\n static registeredPlugins() {\r\n return plugins;\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 = Object.assign({}, 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 = Object.assign({}, 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 = Object.assign(col, item);\r\n if (!col.field) {\r\n console.error(\"Invalid column definition\", item);\r\n }\r\n if (!col.title) {\r\n col.title = col.field;\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 setAttribute(this.inputPage, \"max\", this.pages);\r\n this.inputPage.value = \"\" + this.page;\r\n this.inputPage.disabled = this.pages < 2;\r\n }\r\n\r\n pageChanged() {\r\n this.reload();\r\n }\r\n\r\n responsiveChanged() {\r\n if (!this.plugins.ResponsiveGrid) {\r\n return;\r\n }\r\n if (this.options.responsive) {\r\n this.plugins.ResponsiveGrid.observe();\r\n } else {\r\n this.plugins.ResponsiveGrid.unobserve();\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 // Triggers pageChanged, which will trigger reload\r\n this.page = updatePage;\r\n } else {\r\n // Simply reload current page\r\n this.reload(() => {\r\n // Preserve distance between top of page and select control if no fixed height\r\n if (!this.plugins.FixedHeight || !this.plugins.FixedHeight.hasFixedHeight) {\r\n this.selectPerPage.scrollIntoView();\r\n }\r\n });\r\n }\r\n }\r\n\r\n dirChanged() {\r\n setAttribute(this, \"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 = this.querySelector(\"table\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnFirst = this.querySelector(\".dg-btn-first\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnPrev = this.querySelector(\".dg-btn-prev\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnNext = this.querySelector(\".dg-btn-next\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.btnLast = this.querySelector(\".dg-btn-last\");\r\n /**\r\n * @type {HTMLSelectElement}\r\n */\r\n this.selectPerPage = this.querySelector(\".dg-select-per-page\");\r\n /**\r\n * @type {HTMLInputElement}\r\n */\r\n this.inputPage = this.querySelector(\".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.selectPerPage.toggleAttribute(\"hidden\", this.options.hidePerPage);\r\n this.inputPage.addEventListener(\"input\", this.gotoPage);\r\n\r\n Object.values(this.plugins).forEach((plugin) => {\r\n plugin.connected();\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 // @ts-ignore\r\n this.loadData().finally(() => {\r\n this.configureUi();\r\n\r\n this.sortChanged();\r\n this.classList.add(\"dg-initialized\"); //acts as a flag to prevent unnecessary server calls down the chain.\r\n\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.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 Object.values(this.plugins).forEach((plugin) => {\r\n plugin.disconnected();\r\n });\r\n }\r\n\r\n /**\r\n * @param {string} field\r\n * @returns {Column}\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 let start = 1;\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n start++;\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n start++;\r\n }\r\n return start;\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n isSticky() {\r\n return this.hasAttribute(\"sticky\");\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 // One column per (visible) column\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 // Add one col for selectable checkbox at the beginning\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n len++;\r\n }\r\n // Add one col for actions at the end\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n len++;\r\n }\r\n // Add one col for the responsive toggle\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n len++;\r\n }\r\n return len;\r\n }\r\n\r\n /**\r\n * Global configuration and renderTable\r\n * This should be called after your data has been loaded\r\n */\r\n configureUi() {\r\n setAttribute(this.querySelector(\"table\"), \"aria-rowcount\", this.data.length);\r\n\r\n this.table.style.visibility = \"hidden\";\r\n this.renderTable();\r\n if (this.options.responsive && this.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 = find(this, \"tbody tr\") || find(this, \"table tr\");\r\n if (tr) {\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 removeAttribute(row, \"hidden\");\r\n } else {\r\n this.clearFilters();\r\n setAttribute(row, \"hidden\", \"\");\r\n }\r\n }\r\n\r\n reorderChanged() {\r\n const headers = findAll(this, \"thead tr.dg-head-columns th\");\r\n headers.forEach((th) => {\r\n if (th.classList.contains(\"dg-selectable\") || th.classList.contains(\"dg-actions\")) {\r\n return;\r\n }\r\n if (this.options.reorder && this.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 setAttribute(th, \"aria-sort\", \"none\");\r\n } else {\r\n removeAttribute(th, \"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 if (!Array.isArray(this.originalData)) return;\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 (!Array.isArray(this.originalData)) return;\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 (!this.plugins.SelectableRows) {\r\n return [];\r\n }\r\n return this.plugins.SelectableRows.getSelection(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 }\r\n\r\n /**\r\n * Preloads the data intended to bypass the initial fetch operation, allowing for faster intial page load time.\r\n * Subsequent grid actions after initialization will operate as normal.\r\n * @param {Object} data - an object with meta ({total, filtered, start}) and data (array of objects) properties.\r\n */\r\n preload(data) {\r\n const metaKey = this.options.serverParams.metaKey,\r\n dataKey = this.options.serverParams.dataKey;\r\n if (data?.[metaKey]) this.meta = data[metaKey];\r\n if (data?.[dataKey]) this.data = this.originalData = data[dataKey];\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;\r\n this.fixPage();\r\n // @ts-ignore\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 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 const flagEmpty = () => !this.data.length && this.classList.add(\"dg-empty\"),\r\n tbody = this.querySelector(\"tbody\");\r\n // We already have some data\r\n if (this.meta || this.originalData || this.classList.contains(\"dg-initialized\")) {\r\n // We don't use server side data\r\n if (!this.options.server || (this.options.server && !this.fireEvents)) {\r\n this.log(\"skip loadData\");\r\n flagEmpty();\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 this.classList.remove(\"dg-empty\", \"dg-network-error\");\r\n return (\r\n this.fetchData()\r\n .then((response) => {\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.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 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 } else {\r\n this.options.columns = this.convertColumns(this.options.columns);\r\n }\r\n })\r\n .catch((err) => {\r\n this.log(err);\r\n if (err.message) {\r\n tbody.setAttribute(\"data-empty\", err.message.replace(/^\\s+|\\r\\n|\\n|\\r$/g, \"\"));\r\n }\r\n this.classList.add(\"dg-empty\", \"dg-network-error\");\r\n })\r\n // @ts-ignore\r\n .finally(() => {\r\n flagEmpty();\r\n if (!this.classList.contains(\"dg-network-error\") && tbody.getAttribute(\"data-empty\") != this.labels.noData) {\r\n tbody.setAttribute(\"data-empty\", this.labels.noData);\r\n }\r\n this.classList.remove(\"dg-loading\");\r\n this.loading = false;\r\n })\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n filters[input.dataset.name] = input.value;\r\n });\r\n return filters;\r\n }\r\n\r\n clearFilters() {\r\n const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\r\n input.value = \"\";\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 const inputs = findAll(this, this.#filterSelector);\r\n inputs.forEach((input) => {\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.plugins.ColumnResizer && this.plugins.ColumnResizer.isResizing) {\r\n this.log(\"sorting prevented because resizing\");\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 const haveClasses = (c) => [\"dg-selectable\", \"dg-actions\", \"dg-responsive-toggle\"].includes(c);\r\n this.querySelectorAll(\"thead tr:first-child th\").forEach((th) => {\r\n // @ts-ignore\r\n if ([...th.classList].some(haveClasses)) {\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\r\n let base = window.location.href;\r\n // Fix trailing slash if no extension is present\r\n if (!base.split(\"/\").pop().includes(\".\")) {\r\n base += base.endsWith(\"/\") ? \"\" : \"/\";\r\n }\r\n let url = new URL(this.options.url, base);\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 if (this.options.filter) 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).then((response) => {\r\n if (!response.ok) {\r\n throw new Error(response.statusText || labels.networkError);\r\n }\r\n return response.json();\r\n });\r\n }\r\n\r\n renderTable() {\r\n this.log(\"render table\");\r\n\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.createMenu();\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 && this.plugins.ColumnResizer) {\r\n this.plugins.ColumnResizer.renderResizer(labels.resizeColumn);\r\n }\r\n\r\n dispatch(this, \"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 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 = ce(\"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 // 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 = ce(\"th\");\r\n thead.querySelector(\"tr\").appendChild(sampleTh);\r\n }\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createHeaderCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createHeaderCol(tr);\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 = ce(\"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 (this.plugins.ResponsiveGrid && this.options.responsive) {\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 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 && this.plugins.AutosizeColumn) {\r\n const colAvailableWidth = Math.min(availableWidth - totalWidth, colMaxWidth);\r\n w = this.plugins.AutosizeColumn.computeSize(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 && this.plugins.DraggableHeaders) {\r\n this.plugins.DraggableHeaders.makeHeaderDraggable(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],.dg-not-resizable)\");\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 && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionHeader(tr);\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, ${thead.offsetWidth} > ${availableWidth}`);\r\n const scrollbarWidth = this.offsetWidth - this.clientWidth;\r\n let diff = thead.offsetWidth - availableWidth - scrollbarWidth;\r\n if (this.options.responsive && this.plugins.ResponsiveGrid) {\r\n diff += scrollbarWidth;\r\n }\r\n // Remove diff for columns that can afford it\r\n const thWithWidth = findAll(tr, \"th[width]\");\r\n thWithWidth.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 actualWidth = parseInt(th.getAttribute(\"width\"));\r\n const minWidth = th.dataset.minWidth ? parseInt(th.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 setAttribute(th, \"width\", newWidth);\r\n }\r\n });\r\n }\r\n\r\n // Context menu\r\n if (this.options.menu && this.plugins.ContextMenu) {\r\n this.plugins.ContextMenu.attachContextMenu();\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 = ce(\"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 if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createFilterCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createFilterCol(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 = ce(\"th\");\r\n th.setAttribute(\"aria-colindex\", \"\" + colIdx);\r\n\r\n let filter = this.createFilterElement(column, relatedTh);\r\n if (!this.options.filter) {\r\n th.tabIndex = 0;\r\n } else {\r\n filter.tabIndex = 0;\r\n }\r\n\r\n if (column.hidden) {\r\n th.setAttribute(\"hidden\", \"\");\r\n }\r\n\r\n th.appendChild(filter);\r\n tr.appendChild(th);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionFilter(tr);\r\n }\r\n\r\n thead.replaceChild(tr, thead.querySelector(\"tr.dg-head-filters\"));\r\n\r\n // Filter content by field events\r\n tr.querySelectorAll(this.#filterSelector).forEach((el) => {\r\n const eventName = /select/i.test(el.tagName) ? \"change\" : \"keyup\";\r\n el.addEventListener(eventName, (e) => {\r\n const key = e.keyCode || e.key;\r\n if (key === 13 || key === \"Enter\" || !this.options.filterOnEnter || e.type == \"change\") {\r\n this.filterData.call(this);\r\n }\r\n });\r\n });\r\n }\r\n\r\n createFilterElement(column, relatedTh) {\r\n const isSelect = column.filterType == \"select\",\r\n filter = isSelect ? ce(\"select\") : ce(\"input\");\r\n if (isSelect) {\r\n if (!Array.isArray(column.filterList)) { // Gets unique values from column records\r\n const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter((v) => v).sort();\r\n column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e })));\r\n }\r\n column.filterList.forEach((e) => {\r\n const opt = ce(\"option\");\r\n opt.value = e.value;\r\n opt.text = e.text;\r\n filter.add(opt);\r\n });\r\n } else {\r\n filter.type = \"text\";\r\n filter.inputMode = \"search\";\r\n filter.autocomplete = \"off\";\r\n filter.spellcheck = false;\r\n }\r\n // Allows binding filter to this column\r\n filter.dataset.name = column.field;\r\n filter.id = randstr(\"dg-filter-\");\r\n // Don't use aria-label as it triggers autocomplete\r\n filter.setAttribute(\"aria-labelledby\", relatedTh.getAttribute(\"id\"));\r\n return filter;\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 = ce(\"tbody\");\r\n\r\n this.data.forEach((item, i) => {\r\n tr = ce(\"tr\");\r\n setAttribute(tr, \"role\", \"row\");\r\n setAttribute(tr, \"hidden\", \"\");\r\n setAttribute(tr, \"aria-rowindex\", i + 1);\r\n tr.tabIndex = 0;\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.createDataCol(tr);\r\n }\r\n if (this.options.responsive && this.plugins.ResponsiveGrid && this.plugins.ResponsiveGrid.hasHiddenColumns()) {\r\n this.plugins.ResponsiveGrid.createDataCol(tr);\r\n }\r\n\r\n // Expandable\r\n if (this.options.expand) {\r\n tr.classList.add(\"dg-expandable\");\r\n\r\n on(tr, \"click\", (ev) => {\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.blockObserver();\r\n }\r\n toggleClass(ev.currentTarget, \"dg-expanded\");\r\n if (this.plugins.ResponsiveGrid) {\r\n this.plugins.ResponsiveGrid.unblockObserver();\r\n }\r\n });\r\n }\r\n\r\n idx = 0;\r\n this.options.columns.forEach((column) => {\r\n if (!column) {\r\n console.error(\"Empty column found!\", this.options.columns);\r\n }\r\n // It should be applied as an attr of the row\r\n if (column.attr) {\r\n if (item[column.field]) {\r\n // Special case if we try to write over the class attr\r\n if (column.attr === \"class\") {\r\n addClass(tr, item[column.field]);\r\n } else {\r\n tr.setAttribute(column.attr, item[column.field]);\r\n }\r\n }\r\n return;\r\n }\r\n td = ce(\"td\");\r\n td.setAttribute(\"role\", \"gridcell\");\r\n td.setAttribute(\"aria-colindex\", idx + this.startColIndex());\r\n applyColumnDefinition(td, column);\r\n // This is required for pure css responsive layout\r\n td.setAttribute(\"data-name\", column.title);\r\n td.tabIndex = -1;\r\n\r\n // Inline editing ...\r\n if (column.editable && this.plugins.EditableColumn) {\r\n addClass(td, \"dg-editable-col\");\r\n this.plugins.EditableColumn.makeEditableInput(td, column, item, i);\r\n } else {\r\n // ... or formatting\r\n const v = item[column.field] ?? \"\";\r\n let tv;\r\n // TODO: make this modular\r\n switch (column.transform) {\r\n case \"uppercase\":\r\n tv = v.toUpperCase();\r\n break;\r\n case \"lowercase\":\r\n tv = v.toLowerCase();\r\n break;\r\n default:\r\n tv = v;\r\n break;\r\n }\r\n if (column.format) {\r\n // Only use formatting with values or if defaultFormatValue is set\r\n if (column.defaultFormatValue != undefined && (tv === \"\" || tv === null)) {\r\n tv = column.defaultFormatValue + \"\";\r\n }\r\n if (typeof column.format === \"string\" && tv) {\r\n td.innerHTML = interpolate(\r\n // @ts-ignore\r\n column.format,\r\n Object.assign(\r\n {\r\n _v: v,\r\n _tv: tv,\r\n },\r\n item\r\n )\r\n );\r\n } else if (column.format instanceof Function) {\r\n const val = column.format.call(this, { column, rowData: item, cellData: tv, td, tr });\r\n td.innerHTML = val || tv || v;\r\n }\r\n } else {\r\n td.textContent = tv;\r\n }\r\n }\r\n tr.appendChild(td);\r\n idx++;\r\n });\r\n\r\n // Actions\r\n if (this.options.actions.length && this.plugins.RowActions) {\r\n this.plugins.RowActions.makeActionRow(tr, item);\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 (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.createFakeRow();\r\n }\r\n\r\n this.paginate();\r\n\r\n if (this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.shouldSelectAll(tbody);\r\n }\r\n\r\n this.data.length && this.classList.remove(\"dg-empty\");\r\n\r\n dispatch(this, \"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 removeAttribute(tr, \"hidden\");\r\n return;\r\n }\r\n index = Number(getAttribute(tr, \"aria-rowindex\"));\r\n if (index > high || index < low) {\r\n setAttribute(tr, \"hidden\", \"\");\r\n } else {\r\n removeAttribute(tr, \"hidden\");\r\n }\r\n });\r\n\r\n if (this.options.selectable && this.plugins.SelectableRows) {\r\n this.plugins.SelectableRows.clearCheckboxes(tbody);\r\n }\r\n\r\n // Store default height and update styles if needed\r\n if (this.plugins.FixedHeight) {\r\n this.plugins.FixedHeight.updateFakeRow();\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 tfoot.toggleAttribute(\"hidden\", this.options.autohidePager && this.options.perPage > this.totalRecords());\r\n }\r\n\r\n /**\r\n * @returns {number}\r\n */\r\n totalPages() {\r\n return Math.ceil(this.totalRecords() / this.options.perPage);\r\n }\r\n\r\n /**\r\n * @returns {number}\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", "/** @typedef {import(\"../data-grid\").default} DataGrid */\r\n\r\nclass BasePlugin {\r\n /**\r\n * @param {DataGrid} grid\r\n */\r\n constructor(grid) {\r\n this.grid = grid;\r\n }\r\n\r\n connected() {}\r\n\r\n disconnected() {}\r\n\r\n /**\r\n * Handle events within the plugin\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\nexport default BasePlugin;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport elementOffset from \"../utils/elementOffset.js\";\r\nimport {\r\n addClass,\r\n dispatch,\r\n findAll,\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 constructor(grid) {\r\n super(grid);\r\n this.isResizing = false;\r\n }\r\n\r\n /**\r\n * @param {String} resizeLabel\r\n */\r\n renderResizer(resizeLabel) {\r\n const grid = this.grid;\r\n const table = grid.table;\r\n const cols = findAll(grid, \"thead tr.dg-head-columns th\");\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 // Prevent accidental sorting if mouse is not over resize handler\r\n setTimeout(() => {\r\n this.isResizing = false;\r\n }, 0);\r\n\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 // Remove handlers\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 this.isResizing = true;\r\n\r\n const target = e.target;\r\n const currentCols = findAll(grid, \"dg-head-columns th\");\r\n const visibleCols = currentCols.filter((col) => {\r\n return !col.hasAttribute(\"hidden\");\r\n });\r\n const columnIndex = visibleCols.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 { 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 connected() {\r\n /**\r\n * @type {HTMLUListElement}\r\n */\r\n this.menu = this.grid.querySelector(\".dg-menu\");\r\n }\r\n disconnected() {\r\n if (this.grid.headerRow) {\r\n off(this.grid.headerRow, \"contextmenu\", this);\r\n }\r\n }\r\n\r\n attachContextMenu() {\r\n const grid = this.grid;\r\n on(grid.headerRow, \"contextmenu\", this);\r\n }\r\n\r\n onchange(e) {\r\n const grid = this.grid;\r\n const t = e.target;\r\n const field = t.dataset.name;\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 oncontextmenu(e) {\r\n e.preventDefault();\r\n const grid = this.grid;\r\n const target = getParentElement(e.target, \"THEAD\");\r\n const menu = this.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 createMenu() {\r\n const grid = this.grid;\r\n const menu = this.menu;\r\n while (menu.lastChild) {\r\n menu.removeChild(menu.lastChild);\r\n }\r\n menu.addEventListener(\"change\", this);\r\n grid.options.columns.forEach((col) => {\r\n if (col.attr) {\r\n return;\r\n }\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 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 { 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 /**\r\n * @param {HTMLTableCellElement} th\r\n */\r\n makeHeaderDraggable(th) {\r\n const grid = this.grid;\r\n th.draggable = true;\r\n on(th, \"dragstart\", (e) => {\r\n if (grid.plugins.ColumnResizer && grid.plugins.ColumnResizer.isResizing && e.preventDefault) {\r\n e.preventDefault();\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 = 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 constructor(grid) {\r\n super(grid);\r\n this.touch = null;\r\n }\r\n connected() {\r\n const grid = this.grid;\r\n grid.addEventListener(\"touchstart\", this, { passive: true });\r\n grid.addEventListener(\"touchmove\", this, { passive: true });\r\n }\r\n\r\n disconnected() {\r\n const grid = this.grid;\r\n grid.removeEventListener(\"touchstart\", this);\r\n grid.removeEventListener(\"touchmove\", this);\r\n }\r\n\r\n ontouchstart(e) {\r\n this.touch = e.touches[0];\r\n }\r\n\r\n ontouchmove(e) {\r\n if (!this.touch) {\r\n return;\r\n }\r\n const grid = this.grid;\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 grid.getNext();\r\n } else {\r\n grid.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, findAll, hasClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst SELECTABLE_CLASS = \"dg-selectable\";\r\nconst SELECT_ALL_CLASS = \"dg-select-all\";\r\nconst CHECKBOX_CLASS = \"form-check-input\"; //bs5\r\n\r\n/**\r\n * Allows to select rows\r\n */\r\nclass SelectableRows extends BasePlugin {\r\n disconnected() {\r\n if (this.selectAll) {\r\n this.selectAll.removeEventListener(\"change\", this);\r\n }\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 const grid = this.grid;\r\n let selectedData = [];\r\n\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input:checked`);\r\n inputs.forEach((checkbox) => {\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 {HTMLTableSectionElement} tbody\r\n */\r\n clearCheckboxes(tbody) {\r\n const grid = this.grid;\r\n if (!grid.options.selectVisibleOnly) {\r\n return;\r\n }\r\n const inputs = findAll(tbody, `tr[hidden] .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((input) => {\r\n input.checked = false;\r\n });\r\n this.selectAll.checked = false;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 2;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(...[SELECTABLE_CLASS, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n\r\n this.selectAll = document.createElement(\"input\");\r\n this.selectAll.type = \"checkbox\";\r\n this.selectAll.classList.add(SELECT_ALL_CLASS);\r\n this.selectAll.classList.add(CHECKBOX_CLASS);\r\n this.selectAll.addEventListener(\"change\", this);\r\n\r\n let label = document.createElement(\"label\");\r\n label.appendChild(this.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 {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n let th = document.createElement(\"th\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(SELECTABLE_CLASS);\r\n th.tabIndex = 0;\r\n\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 on table body.\r\n * It should check selectAll if all is checked\r\n * It should uncheck selectAll if any is unchecked\r\n * @param {HTMLTableSectionElement} tbody\r\n */\r\n shouldSelectAll(tbody) {\r\n if (!this.selectAll) {\r\n return;\r\n }\r\n // Delegate listener for change events on input checkboxes\r\n tbody.addEventListener(\"change\", this);\r\n // Make sure state is up to date\r\n tbody.dispatchEvent(new Event(\"change\"));\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(SELECTABLE_CLASS);\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 selectOne.classList.add(CHECKBOX_CLASS);\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.classList.add(\"dg-clickable-cell\");\r\n label.appendChild(selectOne);\r\n td.appendChild(label);\r\n\r\n // Prevent unwanted click behaviour on row\r\n label.addEventListener(\"click\", this);\r\n\r\n tr.appendChild(td);\r\n }\r\n\r\n /**\r\n * @param {Event} e\r\n */\r\n onclick(e) {\r\n e.stopPropagation();\r\n }\r\n\r\n /**\r\n * Handle change event on select all or any select checkbox in the table body\r\n * @param {import(\"../utils/shortcuts.js\").FlexibleEvent} e\r\n */\r\n onchange(e) {\r\n const grid = this.grid;\r\n if (hasClass(e.target, SELECT_ALL_CLASS)) {\r\n const visibleOnly = grid.options.selectVisibleOnly;\r\n const inputs = findAll(grid, `tbody .${SELECTABLE_CLASS} input`);\r\n inputs.forEach((cb) => {\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(grid, \"rowsSelected\", {\r\n selection: this.getSelection(),\r\n });\r\n } else {\r\n if (!e.target.closest(`.${SELECTABLE_CLASS}`)) {\r\n return;\r\n }\r\n const totalCheckboxes = findAll(grid, `tbody .${SELECTABLE_CLASS} input[type=checkbox]`);\r\n // @ts-ignore\r\n const totalChecked = totalCheckboxes.filter((n) => n.checked);\r\n this.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}\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.hasFixedHeight = false;\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 this.hasFixedHeight = true;\r\n }\r\n }\r\n\r\n /**\r\n */\r\n createFakeRow() {\r\n const grid = this.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 get fakeRow() {\r\n return this.grid.querySelector(\".dg-fake-row\");\r\n }\r\n\r\n /**\r\n * On last page, use a fake row to push footer down\r\n */\r\n updateFakeRow() {\r\n const grid = this.grid;\r\n const fakeRow = this.fakeRow;\r\n if (!fakeRow) {\r\n return;\r\n }\r\n\r\n // We don't need a fake row if we display everything\r\n if (grid.options.perPage > grid.totalRecords()) {\r\n return;\r\n }\r\n // We are not on last page\r\n if (grid.page !== grid.totalPages()) {\r\n return;\r\n }\r\n if (!grid.options.autoheight) {\r\n return;\r\n }\r\n // Find remaining missing height\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 if (fakeHeight > 0) {\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 /**\r\n * Autosize col based on column data\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 computeSize(th, column, min, max) {\r\n const grid = this.grid;\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 const firstVal = grid.data[0];\r\n const lastVal = grid.data[grid.data.length - 1];\r\n let v = firstVal[column.field] ? firstVal[column.field].toString() : \"\";\r\n let v2 = lastVal[column.field] ? lastVal[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 > max) {\r\n width = max;\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 * Define a function that can be happily passed to addEventListener\r\n * @typedef {Function & EventListenerOrEventListenerObject} ExtendedFunction\r\n */\r\n\r\n/**\r\n * @param {Function} handler\r\n * @param {Number} timeout\r\n * @returns {ExtendedFunction}\r\n */\r\nexport default function debounce(handler, timeout = 300) {\r\n let timer = null;\r\n return (...args) => {\r\n clearTimeout(timer);\r\n timer = setTimeout(() => {\r\n timer = null;\r\n handler(...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, ce, find, findAll, hasClass, insertAfter, removeAttribute, removeClass, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\nconst RESPONSIVE_CLASS = \"dg-responsive\";\r\n\r\nlet obsTo;\r\n\r\n/**\r\n * @param {Array} list\r\n * @returns {Array}\r\n */\r\nfunction sortByPriority(list) {\r\n return list.sort((a, b) => {\r\n const v1 = parseInt(a.dataset.responsive) || 1;\r\n const v2 = parseInt(b.dataset.responsive) || 1;\r\n return v2 - v1;\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 if (grid.plugins.ResponsiveGrid.observerBlocked) {\r\n return;\r\n }\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 const prevAction = grid.plugins.ResponsiveGrid.prevAction;\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() // Order takes precedence if no priority is set\r\n .filter((col) => {\r\n // Leave out unresponsive columns\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}. Diff: ${diff}`);\r\n\r\n // The table is too big when diff has a high value, otherwise it will be like -1 or -2\r\n if (diff > 0) {\r\n if (prevAction === \"show\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"hide\";\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\r\n grid.hideColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", true);\r\n changed = true;\r\n\r\n remaining -= colWidth;\r\n remaining = Math.round(remaining);\r\n });\r\n } else {\r\n if (prevAction === \"hide\") {\r\n return;\r\n }\r\n grid.plugins.ResponsiveGrid.prevAction = \"show\";\r\n\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 const width = col.dataset.minWidth ? parseInt(col.dataset.minWidth) : col.offsetWidth;\r\n return result + width;\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 headerCols\r\n .slice()\r\n .reverse() // Reverse the array to restore the columns in the proper order\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 (colWidth > remaining) {\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\r\n grid.showColumn(field, false);\r\n grid.setColProp(field, \"responsiveHidden\", 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 = find(grid.table, \"tfoot\");\r\n const realFooterWidth = findAll(grid.table, \".dg-footer > div\").reduce((result, div) => {\r\n return result + div.offsetWidth;\r\n }, 0);\r\n const availableFooterWidth = footer.offsetWidth - realFooterWidth;\r\n if (realFooterWidth > size) {\r\n addClass(footer, \"dg-footer-compact\");\r\n } else if (availableFooterWidth > 250) {\r\n removeClass(footer, \"dg-footer-compact\");\r\n }\r\n if (changed) {\r\n grid.renderTable();\r\n }\r\n // Prevent resize loop\r\n setTimeout(() => {\r\n grid.plugins.ResponsiveGrid.prevAction = null;\r\n }, 1000);\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 constructor(grid) {\r\n super(grid);\r\n\r\n this.observerBlocked = false;\r\n this.prevAction = null;\r\n }\r\n\r\n connected() {\r\n if (this.grid.options.responsive) {\r\n this.observe();\r\n }\r\n }\r\n\r\n disconnected() {\r\n this.unobserve();\r\n }\r\n\r\n observe() {\r\n if (!this.grid.options.responsive) {\r\n return;\r\n }\r\n resizeObserver.observe(this.grid);\r\n this.grid.style.display = \"block\"; // Otherwise resize doesn't happen\r\n this.grid.style.overflowX = \"hidden\"; // Prevent scrollbars from appearing\r\n }\r\n\r\n unobserve() {\r\n resizeObserver.unobserve(this.grid);\r\n this.grid.style.display = \"unset\";\r\n this.grid.style.overflowX = \"unset\";\r\n }\r\n\r\n blockObserver() {\r\n this.observerBlocked = true;\r\n if (obsTo) {\r\n clearTimeout(obsTo);\r\n }\r\n }\r\n\r\n unblockObserver() {\r\n obsTo = setTimeout(() => {\r\n this.observerBlocked = false;\r\n }, 200); // more than debounce\r\n }\r\n\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasHiddenColumns() {\r\n let flag = false;\r\n this.grid.options.columns.forEach((col) => {\r\n if (col.responsiveHidden) {\r\n flag = true;\r\n }\r\n });\r\n return flag;\r\n }\r\n\r\n colIndex() {\r\n return this.grid.startColIndex() - 1;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createHeaderCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"scope\", \"col\");\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n setAttribute(th, \"width\", \"40\");\r\n th.classList.add(...[`${RESPONSIVE_CLASS}-toggle`, \"dg-not-resizable\", \"dg-not-sortable\"]);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createFilterCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n let th = ce(\"th\", tr);\r\n setAttribute(th, \"role\", \"columnheader button\");\r\n setAttribute(th, \"aria-colindex\", this.colIndex());\r\n th.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n th.tabIndex = 0;\r\n }\r\n\r\n /**\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n createDataCol(tr) {\r\n if (!this.grid.options.responsiveToggle) {\r\n return;\r\n }\r\n // Create col\r\n let td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell button\");\r\n setAttribute(td, \"aria-colindex\", this.colIndex());\r\n td.classList.add(`${RESPONSIVE_CLASS}-toggle`);\r\n\r\n // Create icon\r\n td.innerHTML = `
\r\n \r\n \r\n\r\n\r\n \r\n
`;\r\n tr.appendChild(td);\r\n\r\n td.addEventListener(\"click\", this);\r\n td.addEventListener(\"mousedown\", this);\r\n }\r\n\r\n computeLabelWidth() {\r\n let idealWidth = 0;\r\n let consideredCol = 0;\r\n while (idealWidth < 120) {\r\n consideredCol++;\r\n const hCol = find(this.grid, `.dg-head-columns th[aria-colindex=\"${consideredCol}\"]`);\r\n if (hCol) {\r\n idealWidth += hCol.offsetWidth;\r\n } else {\r\n break;\r\n }\r\n }\r\n return idealWidth;\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onmousedown(ev) {\r\n // Avoid selection through double click\r\n ev.preventDefault();\r\n }\r\n\r\n /**\r\n * @param {Event} ev\r\n */\r\n onclick(ev) {\r\n // Prevent expandable\r\n ev.stopPropagation();\r\n\r\n // target is the element that triggered the event (e.g., the user clicked on)\r\n // currentTarget is the element that the event listener is attached to.\r\n\r\n /**\r\n * @type {HTMLTableRowElement}\r\n */\r\n //@ts-ignore\r\n const td = ev.currentTarget;\r\n const tr = td.parentElement;\r\n const open = find(td, `.${RESPONSIVE_CLASS}-open`);\r\n const close = find(td, `.${RESPONSIVE_CLASS}-close`);\r\n\r\n this.blockObserver();\r\n\r\n const isExpanded = hasClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n if (isExpanded) {\r\n removeClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"unset\";\r\n close.style.display = \"none\";\r\n\r\n // Move back rows and cleanup row\r\n const childRow = tr.nextElementSibling;\r\n const hiddenCols = findAll(childRow, `.${RESPONSIVE_CLASS}-hidden`);\r\n hiddenCols.forEach((col) => {\r\n // We don't really need to care where we insert them since we are going to redraw anyway\r\n tr.appendChild(col);\r\n setAttribute(col, \"hidden\");\r\n });\r\n\r\n childRow.parentElement.removeChild(childRow);\r\n } else {\r\n addClass(tr, `${RESPONSIVE_CLASS}-expanded`);\r\n open.style.display = \"none\";\r\n close.style.display = \"unset\";\r\n\r\n // Create a child row and move rows into it\r\n const childRow = ce(\"tr\");\r\n insertAfter(childRow, tr);\r\n addClass(childRow, `${RESPONSIVE_CLASS}-child-row`);\r\n\r\n const childRowTd = ce(\"td\", childRow);\r\n setAttribute(childRowTd, \"colspan\", this.grid.columnsLength(true));\r\n\r\n const childTable = ce(\"table\", childRowTd);\r\n addClass(childTable, `${RESPONSIVE_CLASS}-table`);\r\n\r\n const hiddenCols = findAll(tr, `.${RESPONSIVE_CLASS}-hidden`);\r\n const idealWidth = this.computeLabelWidth();\r\n hiddenCols.forEach((col) => {\r\n const childTableRow = ce(\"tr\", childTable);\r\n\r\n // Add label\r\n const label = col.dataset.name;\r\n const labelCol = ce(\"th\", childTableRow);\r\n // It looks much better when aligned with an actual col\r\n labelCol.style.width = `${idealWidth}px`;\r\n labelCol.innerHTML = label;\r\n\r\n // Add actual row\r\n childTableRow.appendChild(col);\r\n removeAttribute(col, \"hidden\");\r\n });\r\n }\r\n\r\n this.unblockObserver();\r\n }\r\n}\r\n\r\nexport default ResponsiveGrid;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport interpolate from \"../utils/interpolate.js\";\r\nimport { dispatch, on, setAttribute } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Add action on rows\r\n */\r\nclass RowActions extends BasePlugin {\r\n /**\r\n * @returns {Boolean}\r\n */\r\n hasActions() {\r\n return this.grid.options.actions.length > 0;\r\n }\r\n\r\n /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionHeader(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n setAttribute(actionsTh, \"role\", \"columnheader button\");\r\n setAttribute(actionsTh, \"aria-colindex\", this.grid.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 /**\r\n *\r\n * @param {HTMLTableRowElement} tr\r\n */\r\n makeActionFilter(tr) {\r\n let actionsTh = document.createElement(\"th\");\r\n actionsTh.setAttribute(\"role\", \"columnheader button\");\r\n actionsTh.setAttribute(\"aria-colindex\", \"\" + this.grid.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 /**\r\n * @param {HTMLTableRowElement} tr\r\n * @param {Object} item\r\n */\r\n makeActionRow(tr, item) {\r\n const labels = this.grid.labels;\r\n const td = document.createElement(\"td\");\r\n setAttribute(td, \"role\", \"gridcell\");\r\n setAttribute(td, \"aria-colindex\", this.grid.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 on(actionsToggle, \"click\", (ev) => {\r\n ev.stopPropagation();\r\n ev.target.parentElement.classList.toggle(\"dg-actions-expand\");\r\n });\r\n\r\n this.grid.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.grid, \"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 get actionClass() {\r\n if (this.grid.options.actions.length < 3 && !this.grid.options.collapseActions) {\r\n return \"dg-actions-\" + this.grid.options.actions.length;\r\n }\r\n return \"dg-actions-more\";\r\n }\r\n}\r\n\r\nexport default RowActions;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { dispatch } from \"../utils/shortcuts.js\";\r\n\r\n/**\r\n * Make editable inputs in rows\r\n */\r\nclass EditableColumn extends BasePlugin {\r\n /**\r\n *\r\n * @param {HTMLTableCellElement} td\r\n * @param {import(\"../data-grid\").Column} column\r\n * @param {Object} item\r\n * @param {number} i\r\n */\r\n makeEditableInput(td, column, item, i) {\r\n const gridId = this.grid.getAttribute(\"id\");\r\n let input = document.createElement(\"input\");\r\n input.type = column.editableType || \"text\";\r\n if (input.type == \"email\") {\r\n input.inputMode = \"email\";\r\n }\r\n if (input.type == \"decimal\") {\r\n input.type = \"text\";\r\n input.inputMode = \"decimal\";\r\n }\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 = gridId.replace(\"-\", \"_\") + \"[\" + (i + 1) + \"]\" + \"[\" + column.field + \"]\";\r\n input.value = item[column.field];\r\n input.dataset.field = column.field;\r\n\r\n // Prevent row action\r\n input.addEventListener(\"click\", (ev) => ev.stopPropagation());\r\n // Enter validates edit\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 ev.preventDefault();\r\n }\r\n }\r\n });\r\n // Save on blur\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.grid, \"edit\", {\r\n data: item,\r\n value: input.value,\r\n });\r\n });\r\n td.appendChild(input);\r\n }\r\n}\r\n\r\nexport default EditableColumn;\r\n", "import BasePlugin from \"../core/base-plugin.js\";\r\nimport { $ } from \"../utils/shortcuts.js\"\r\n\r\n/**\r\n * Adds an element for showing a spinning icon on grid loading.\r\n */\r\nclass SpinnerSupport extends BasePlugin {\r\n /**\r\n * Adds a spinner element with its associated css styles.\r\n */\r\n add() {\r\n const grid = this.grid,\r\n classes = grid.options.spinnerClass;\r\n if (!classes) return;\r\n const cls = classes.split(\" \").map(e => `.${e}`).join(\"\"),\r\n template = `\r\n\r\n`;\r\n if (!$(\"#dg-styles\")) {\r\n const styleParent = $(\"head\") ?? $(\"body\"),\r\n position = /head/i.test(styleParent.tagName) ? \"beforeend\" : \"afterbegin\";\r\n styleParent.insertAdjacentHTML(position, template);\r\n }\r\n !$(`i${cls}`, grid) && grid.insertAdjacentHTML(\"afterbegin\", ``);\r\n }\r\n}\r\n\r\nexport default SpinnerSupport;", "import DataGrid from \"./src/data-grid.js\";\r\n// Optional plugins\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\nimport RowActions from \"./src/plugins/row-actions.js\";\r\nimport EditableColumn from \"./src/plugins/editable-column.js\";\r\nimport SpinnerSupport from \"./src/plugins/spinner-support.js\";\r\n\r\n// Using shorthand property names\r\n// This make them reserved and keys will be preserved\r\n// Actual class names are renamed\r\nDataGrid.registerPlugins({\r\n ColumnResizer,\r\n ContextMenu,\r\n DraggableHeaders,\r\n TouchSupport,\r\n SelectableRows,\r\n FixedHeight,\r\n AutosizeColumn,\r\n ResponsiveGrid,\r\n RowActions,\r\n EditableColumn,\r\n SpinnerSupport\r\n});\r\n\r\n// Prevent errors if included multiple times\r\nif (!customElements.get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AO,KAAK,KAChBC,EAAUD,EAAK,QAAQ,aACzB,GAAI,CAACC,EAAS,OACd,IAAMC,EAAMD,EAAQ,MAAM,GAAG,EAAE,IAAIE,GAAK,IAAIA,CAAC,EAAE,EAAE,KAAK,EAAE,EACtDC,EAAW;AAAA;AAAA,cAEHF,CAAG;AAAA,+BACcA,CAAG;AAAA,8CACYA,CAAG;AAAA;AAAA,4BAErBA,CAAG;AAAA;AAAA;AAAA,EAI3B,GAAI,CAACG,EAAE,YAAY,EAAG,CACpB,IAAMC,EAAcD,EAAE,MAAM,GAAKA,EAAE,MAAM,EACvCE,EAAW,QAAQ,KAAKD,EAAY,OAAO,EAAI,YAAc,aAC/DA,EAAY,mBAAmBC,EAAUH,CAAQ,CACnD,CACA,CAACC,EAAE,IAAIH,CAAG,GAAIF,CAAI,GAAKA,EAAK,mBAAmB,aAAc,aAAaC,CAAO,QAAQ,CAC3F,CACF,EAEOO,GAAQV,GCjBfW,EAAS,gBAAgB,CACvB,cAAAC,GACA,YAAAC,GACA,iBAAAC,GACA,aAAAC,GACA,eAAAC,GACA,YAAAC,GACA,eAAAC,GACA,eAAAC,GACA,WAAAC,GACA,eAAAC,GACA,eAAAC,EACF,CAAC,EAGI,eAAe,IAAI,WAAW,GACjC,eAAe,OAAO,YAAaX,CAAQ,EAG7C,IAAOA,GAAQA", + "names": ["camelize", "str", "m", "chr", "normalizeData", "v", "supportedPassiveTypes", "passiveOpts", "type", "getAttribute", "el", "name", "hasAttribute", "setAttribute", "v", "check", "removeAttribute", "on", "listener", "off", "dispatch", "el", "name", "data", "bubbles", "opts", "hasClass", "addClass", "removeClass", "toggleClass", "$", "selector", "base", "$$", "find", "findAll", "ce", "tagName", "parent", "el", "insertAfter", "newNode", "existingNode", "BaseElement", "options", "opt", "v", "setAttribute", "jsonConfig", "data", "key", "normalizeData", "message", "getAttribute", "event", "template", "dispatch", "attributeName", "oldValue", "newValue", "isOption", "transformer", "camelize", "base_element_default", "addSelectOption", "el", "value", "label", "checked", "opt", "appendParamsToUrl", "url", "params", "key", "k", "convertArray", "v", "elementOffset", "el", "rect", "scrollLeft", "scrollTop", "interpolate", "str", "data", "$1", "$2", "getTextWidth", "text", "el", "withPadding", "styles", "fontWeight", "fontSize", "fontFamily", "padding", "paddingLeft", "paddingRight", "context", "metrics", "randstr", "prefix", "plugins", "labels", "applyColumnDefinition", "el", "column", "setAttribute", "addClass", "DataGrid", "_DataGrid", "base_element_default", "#filterSelector", "randstr", "pluginName", "pluginClass", "attr", "camelize", "v", "list", "plugin", "columns", "cols", "key", "col", "item", "convertArray", "val", "updatePage", "addSelectOption", "field", "found", "prop", "c", "render", "dispatch", "start", "visibleOnly", "len", "tr", "find", "row", "removeAttribute", "findAll", "th", "fieldName", "value", "data", "metaKey", "dataKey", "cb", "needRender", "flagEmpty", "tbody", "resolve", "response", "err", "event", "filters", "input", "name", "haveClasses", "sort", "stack", "itemA", "itemB", "a", "b", "valA", "valB", "reject", "base", "url", "params", "appendParamsToUrl", "sortedColumn", "thead", "tfoot", "td", "availableWidth", "colMaxWidth", "idx", "ce", "sampleTh", "totalWidth", "colIdx", "computedWidth", "getTextWidth", "w", "colAvailableWidth", "visibleCols", "lastCol", "scrollbarWidth", "diff", "hasClass", "actualWidth", "minWidth", "newWidth", "sortableRow", "relatedTh", "filter", "eventName", "e", "isSelect", "uniqueValues", "opt", "i", "on", "ev", "toggleClass", "tv", "interpolate", "prev", "total", "p", "index", "high", "low", "getAttribute", "data_grid_default", "BasePlugin", "grid", "event", "base_plugin_default", "ColumnResizer", "base_plugin_default", "grid", "resizeLabel", "table", "cols", "findAll", "col", "hasClass", "resizer", "addClass", "startX", "startW", "remainingSpace", "max", "mouseMoveHandler", "e", "newWidth", "setAttribute", "mouseUpHandler", "removeClass", "off", "dispatch", "getAttribute", "on", "target", "visibleCols", "columnIndex", "column", "removeAttribute", "elementOffset", "j", "column_resizer_default", "getParentElement", "el", "type", "prop", "parent", "ContextMenu", "base_plugin_default", "off", "grid", "on", "e", "t", "field", "target", "getParentElement", "menu", "rect", "x", "y", "removeAttribute", "documentClickHandler", "setAttribute", "col", "li", "label", "checkbox", "text", "context_menu_default", "DraggableHeaders", "base_plugin_default", "th", "grid", "on", "e", "t", "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", "SELECTABLE_CLASS", "SELECT_ALL_CLASS", "CHECKBOX_CLASS", "SelectableRows", "base_plugin_default", "key", "grid", "selectedData", "findAll", "checkbox", "idx", "item", "tbody", "input", "tr", "th", "setAttribute", "label", "td", "selectOne", "e", "hasClass", "visibleOnly", "cb", "dispatch", "totalCheckboxes", "totalChecked", "n", "selectable_rows_default", "FixedHeight", "base_plugin_default", "grid", "tbody", "tr", "setAttribute", "fakeRow", "max", "visibleRows", "fakeHeight", "fixed_height_default", "AutosizeColumn", "base_plugin_default", "th", "column", "min", "max", "grid", "hasAttribute", "getAttribute", "firstVal", "lastVal", "v", "v2", "width", "getTextWidth", "setAttribute", "autosize_column_default", "debounce", "handler", "timeout", "timer", "args", "RESPONSIVE_CLASS", "obsTo", "sortByPriority", "list", "a", "b", "v1", "callback", "debounce", "entries", "entry", "grid", "table", "contentBoxSize", "size", "tableWidth", "realTableWidth", "findAll", "result", "th", "diff", "minWidth", "prevAction", "headerCols", "col", "changed", "remaining", "cols", "colWidth", "field", "requiredWidth", "width", "footer", "find", "realFooterWidth", "div", "availableFooterWidth", "addClass", "removeClass", "resizeObserver", "ResponsiveGrid", "base_plugin_default", "flag", "tr", "ce", "setAttribute", "td", "idealWidth", "consideredCol", "hCol", "ev", "open", "close", "hasClass", "childRow", "insertAfter", "childRowTd", "childTable", "hiddenCols", "childTableRow", "label", "labelCol", "removeAttribute", "responsive_grid_default", "RowActions", "base_plugin_default", "tr", "actionsTh", "setAttribute", "item", "labels", "td", "actionsToggle", "on", "ev", "action", "button", "interpolate", "actionHandler", "dispatch", "row_actions_default", "EditableColumn", "base_plugin_default", "td", "column", "item", "i", "gridId", "input", "ev", "key", "dispatch", "editable_column_default", "SpinnerSupport", "base_plugin_default", "grid", "classes", "cls", "e", "template", "$", "styleParent", "position", "spinner_support_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", "row_actions_default", "editable_column_default", "spinner_support_default"] } diff --git a/readme.md b/readme.md index 0ea36a5..4ede98c 100644 --- a/readme.md +++ b/readme.md @@ -112,9 +112,8 @@ You can also pass them as a json string in data-config. | reorder | Boolean | Allows a column reordering functionality (DraggableHeaders module) | | responsive | Boolean | Change display mode on small screens (ResponsiveGrid module) | | responsiveToggle | Boolean | Show toggle column (ResponsiveGrid module) | -| filterOnEnter | Boolean | Toggles the ability to filter column data by pressing the Enter or Return key. | -| showSpinner | Boolean | Shows or hides a spinning icon on grid loading | -| spinnerCssClasses | String | Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner) | +| filterOnEnter | Boolean | Toggles the ability to filter column data by pressing the Enter or Return key | +| spinnerClass | String | Sets a space-delimited string of css class(es) for a spinner (use spinner-border css class for bootstrap 5 spinner) | diff --git a/src/data-grid.js b/src/data-grid.js index 149f3f1..99dde2a 100644 --- a/src/data-grid.js +++ b/src/data-grid.js @@ -138,8 +138,7 @@ import { * @property {Boolean} responsive Change display mode on small screens (ResponsiveGrid module) * @property {Boolean} responsiveToggle Show toggle column (ResponsiveGrid module) * @property {Boolean} filterOnEnter Toggles the ability to filter column data by pressing the Enter or Return key - * @property {Boolean} showSpinner Shows or hides a spinning icon on grid loading - * @property {String} spinnerCssClasses Sets a space-delimited string of css classes for a spinner. (use spinner-border css class for bootstrap 5 spinner) + * @property {String} spinnerClass Sets a space-delimited string of css classes for a spinner (use spinner-border css class for bootstrap 5 spinner) */ /** @@ -252,7 +251,7 @@ class DataGrid extends BaseElement { } // Inserts spinner - if (this.options.showSpinner && this.plugins.SpinnerSupport) + if (this.options.spinnerClass && this.plugins.SpinnerSupport) this.plugins.SpinnerSupport.add(); } @@ -385,9 +384,7 @@ class DataGrid extends BaseElement { autohidePager: false, responsive: false, responsiveToggle: true, - filterOnEnter: true, - showSpinner: false, - spinnerCssClasses: "" + filterOnEnter: true }; } @@ -1529,7 +1526,7 @@ class DataGrid extends BaseElement { filter = isSelect ? ce("select") : ce("input"); if (isSelect) { if (!Array.isArray(column.filterList)) { // Gets unique values from column records - const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter(v => !!v).sort(); + const uniqueValues = [...new Set((this.data ?? []).map((e) => e[column.field]))].filter((v) => v).sort(); column.filterList = [column.firstFilterOption || this.defaultColumn.firstFilterOption].concat(uniqueValues.map((e) => ({ value: e, text: e }))); } column.filterList.forEach((e) => { diff --git a/src/plugins/spinner-support.js b/src/plugins/spinner-support.js index af7fef7..4ec7fc8 100644 --- a/src/plugins/spinner-support.js +++ b/src/plugins/spinner-support.js @@ -10,10 +10,9 @@ class SpinnerSupport extends BasePlugin { */ add() { const grid = this.grid, - show = grid.options.showSpinner; - if (!show) return; - const cssClasses = grid.options.spinnerCssClasses, - cls = cssClasses.split(" ").map(e => `.${e}`).join(""), + classes = grid.options.spinnerClass; + if (!classes) return; + const cls = classes.split(" ").map(e => `.${e}`).join(""), template = `