From a6d614f552fca995161f5b61f064dcbecce0b628 Mon Sep 17 00:00:00 2001 From: volkanceylan Date: Thu, 18 Jan 2024 10:24:57 +0300 Subject: [PATCH] `[Breaking Change]` We'll no longer ship SleekGrid compat files (e.g. slick.core.js, slick.grid.js etc.) via Serenity.Assets. Replace their reference in your appsettings.bundles.json with ~/Serenity.SleekGrid/index.global.js --- packages/sleekgrid | 2 +- .../SlickGrid/Plugins/slick.autotooltips.js | 83 - .../Plugins/slick.autotooltips.min.js | 2 - .../SlickGrid/Plugins/slick.rowmovemanager.js | 125 - .../Plugins/slick.rowselectionmodel.js | 173 - .../SlickGrid/layouts/slick.frozenlayout.js | 667 --- .../wwwroot/Scripts/SlickGrid/slick.core.js | 567 --- .../Scripts/SlickGrid/slick.core.min.js | 2 - .../Scripts/SlickGrid/slick.editors.js | 428 -- .../Scripts/SlickGrid/slick.formatters.js | 91 - .../wwwroot/Scripts/SlickGrid/slick.grid.js | 4011 ----------------- .../Scripts/SlickGrid/slick.grid.min.js | 2 - .../slick.groupitemmetadataprovider.js | 199 - .../slick.groupitemmetadataprovider.min.js | 3 - 14 files changed, 1 insertion(+), 6354 deletions(-) delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.autotooltips.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.autotooltips.min.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.rowmovemanager.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.rowselectionmodel.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/layouts/slick.frozenlayout.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.core.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.core.min.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.editors.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.formatters.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.grid.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.grid.min.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.groupitemmetadataprovider.js delete mode 100644 src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.groupitemmetadataprovider.min.js diff --git a/packages/sleekgrid b/packages/sleekgrid index e972f6bcfd..7ca74b9170 160000 --- a/packages/sleekgrid +++ b/packages/sleekgrid @@ -1 +1 @@ -Subproject commit e972f6bcfd59b77fe2efa4f125f39f545b44233a +Subproject commit 7ca74b9170d6b9d7ee3f7f309b9a10517bf08c71 diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.autotooltips.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.autotooltips.js deleted file mode 100644 index d34dcf99a1..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.autotooltips.js +++ /dev/null @@ -1,83 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/plugins/autotooltips.ts - var autotooltips_exports = {}; - __export(autotooltips_exports, { - AutoTooltips: () => AutoTooltips - }); - var _AutoTooltips = class _AutoTooltips { - constructor(options) { - this.handleMouseEnter = (e) => { - var _a, _b; - var cell = this.grid.getCellFromEvent(e); - if (!cell) - return; - var node = this.grid.getCellNode(cell.row, cell.cell); - if (!node) - return; - var text; - if (!node.title || this.options.replaceExisting) { - if (node.clientWidth < node.scrollWidth) { - text = (_b = (_a = node.textContent) == null ? void 0 : _a.trim()) != null ? _b : ""; - if (this.options.maxToolTipLength && text.length > this.options.maxToolTipLength) { - text = text.substring(0, this.options.maxToolTipLength - 3) + "..."; - } - } else { - text = ""; - } - node.title = text; - } - node = null; - }; - this.handleHeaderMouseEnter = (e, args) => { - var column = args.column; - if (column && !column.toolTip) { - var node = e.target.closest(".slick-header-column"); - node && (node.title = node.clientWidth < node.scrollWidth ? column.name : ""); - } - }; - this.pluginName = "AutoTooltips"; - this.options = Object.assign({}, _AutoTooltips.defaults, options); - } - init(grid) { - this.grid = grid; - if (this.options.enableForCells) - this.grid.onMouseEnter.subscribe(this.handleMouseEnter); - if (this.options.enableForHeaderCells) - this.grid.onHeaderMouseEnter.subscribe(this.handleHeaderMouseEnter); - } - destroy() { - if (this.options.enableForCells) - this.grid.onMouseEnter.unsubscribe(this.handleMouseEnter); - if (this.options.enableForHeaderCells) - this.grid.onHeaderMouseEnter.unsubscribe(this.handleHeaderMouseEnter); - } - }; - _AutoTooltips.defaults = { - enableForCells: true, - enableForHeaderCells: false, - maxToolTipLength: null, - replaceExisting: true - }; - var AutoTooltips = _AutoTooltips; - return __toCommonJS(autotooltips_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.autotooltips.min.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.autotooltips.min.js deleted file mode 100644 index 725d5d5756..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.autotooltips.min.js +++ /dev/null @@ -1,2 +0,0 @@ -var Slick=Slick||{};Slick._=(()=>{var n=Object.defineProperty;var h=Object.getOwnPropertyDescriptor;var p=Object.getOwnPropertyNames;var d=Object.prototype.hasOwnProperty;var g=(s,e)=>{for(var o in e)n(s,o,{get:e[o],enumerable:!0})},c=(s,e,o,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let t of p(e))!d.call(s,t)&&t!==o&&n(s,t,{get:()=>e[t],enumerable:!(i=h(e,t))||i.enumerable});return s};var b=s=>c(n({},"__esModule",{value:!0}),s);var m={};g(m,{AutoTooltips:()=>r});var l=class l{constructor(e){this.handleMouseEnter=e=>{var a,u;var o=this.grid.getCellFromEvent(e);if(o){var i=this.grid.getCellNode(o.row,o.cell);if(i){var t;(!i.title||this.options.replaceExisting)&&(i.clientWidththis.options.maxToolTipLength&&(t=t.substring(0,this.options.maxToolTipLength-3)+"...")):t="",i.title=t),i=null}}};this.handleHeaderMouseEnter=(e,o)=>{var i=o.column;if(i&&!i.toolTip){var t=e.target.closest(".slick-header-column");t&&(t.title=t.clientWidth Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.rowmovemanager.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.rowmovemanager.js deleted file mode 100644 index f72925e6fe..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.rowmovemanager.js +++ /dev/null @@ -1,125 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/plugins/rowmovemanager.ts - var rowmovemanager_exports = {}; - __export(rowmovemanager_exports, { - RowMoveManager: () => RowMoveManager - }); - - // global-externals:_ - var { EventEmitter, EventSubscriber, H } = Slick; - - // src/plugins/rowmovemanager.ts - var _RowMoveManager = class _RowMoveManager { - constructor(options) { - this.handler = new EventSubscriber(); - this.onBeforeMoveRows = new EventEmitter(); - this.onMoveRows = new EventEmitter(); - this.options = Object.assign({}, _RowMoveManager.defaults, options); - } - init(grid) { - this.grid = grid; - this.handler.subscribe(grid.onDragInit, this.handleDragInit.bind(this)).subscribe(grid.onDragStart, this.handleDragStart.bind(this)).subscribe(grid.onDrag, this.handleDrag.bind(this)).subscribe(grid.onDragEnd, this.handleDragEnd.bind(this)); - } - destroy() { - var _a; - (_a = this.handler) == null ? void 0 : _a.unsubscribeAll(); - } - handleDragInit(e) { - e.stopImmediatePropagation(); - } - handleDragStart(e, dd) { - let cell = this.grid.getCellFromEvent(e); - if (this.options.cancelEditOnDrag && this.grid.getEditorLock().isActive()) { - this.grid.getEditorLock().cancelCurrentEdit(); - } - if (this.grid.getEditorLock().isActive() || !/move|selectAndMove/.test(this.grid.getColumns()[cell.cell].behavior)) { - return false; - } - this.dragging = true; - e.stopImmediatePropagation(); - let selectedRows = this.grid.getSelectedRows(); - if (selectedRows.length == 0 || selectedRows.indexOf(cell.row) == -1) { - selectedRows = [cell.row]; - this.grid.setSelectedRows(selectedRows); - } - let rowHeight = this.grid.getOptions().rowHeight; - dd.selectedRows = selectedRows; - let canvas = this.grid.getCanvasNode(); - dd.selectionProxy = canvas.appendChild(H("div", { - "class": "slick-reorder-proxy", - "style": `position: absolute; z-index: 9999; width: ${canvas.clientWidth}px; height: ${rowHeight * selectedRows.length}px` - })); - dd.guide = canvas.appendChild(H("div", { - "class": "slick-reorder-guide", - "style": `position: absolute; z-index: 99998; width: ${canvas.clientWidth}px; top: -1000` - })); - dd.insertBefore = -1; - } - handleDrag(e, dd) { - if (!this.dragging) - return; - e.stopImmediatePropagation(); - let canvas = this.grid.getCanvasNode(); - let box = canvas.getBoundingClientRect(); - let docElem = document.documentElement; - let canvasTop = box.top + window.scrollY - docElem.clientTop; - let top = e.pageY - canvasTop; - dd.selectionProxy.style.top = top - 5 + "px"; - let insertBefore = Math.max(0, Math.min(Math.round(top / this.grid.getOptions().rowHeight), this.grid.getDataLength())); - if (insertBefore !== dd.insertBefore) { - let eventData = { - rows: dd.selectedRows, - insertBefore - }; - if (this.onBeforeMoveRows.notify(eventData) === false) { - dd.guide.style.top = "-1000"; - dd.canMove = false; - } else { - dd.guide.style.top = insertBefore * this.grid.getOptions().rowHeight + "px"; - dd.canMove = true; - } - dd.insertBefore = insertBefore; - } - } - handleDragEnd(e, dd) { - if (!this.dragging) - return; - this.dragging = false; - e.stopImmediatePropagation(); - dd.guide.remove(); - dd.selectionProxy.remove(); - if (dd.canMove) { - let eventData = { - rows: dd.selectedRows, - insertBefore: dd.insertBefore - }; - this.onMoveRows.notify(eventData); - } - } - }; - _RowMoveManager.defaults = { - cancelEditOnDrag: false - }; - var RowMoveManager = _RowMoveManager; - return __toCommonJS(rowmovemanager_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.rowselectionmodel.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.rowselectionmodel.js deleted file mode 100644 index 62e10bc4b5..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/Plugins/slick.rowselectionmodel.js +++ /dev/null @@ -1,173 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/plugins/rowselectionmodel.ts - var rowselectionmodel_exports = {}; - __export(rowselectionmodel_exports, { - RowSelectionModel: () => RowSelectionModel - }); - - // global-externals:_ - var { EventEmitter, EventSubscriber, Range } = Slick; - - // src/plugins/rowselectionmodel.ts - function getRowsRange(from, to) { - let i, rows = []; - for (i = from; i <= to; i++) { - rows.push(i); - } - for (i = to; i < from; i++) { - rows.push(i); - } - return rows; - } - function rangesToRows(ranges) { - let rows = []; - for (let i = 0; i < ranges.length; i++) { - for (let j = ranges[i].fromRow; j <= ranges[i].toRow; j++) { - rows.push(j); - } - } - return rows; - } - var _RowSelectionModel = class _RowSelectionModel { - constructor(options) { - this.handler = new EventSubscriber(); - this.onSelectedRangesChanged = new EventEmitter(); - this.options = Object.assign({}, _RowSelectionModel.defaults, options); - } - init(grid) { - this.grid = grid; - this.handler.subscribe(grid.onActiveCellChanged, this.wrapHandler(this.handleActiveCellChange)); - this.handler.subscribe(grid.onKeyDown, this.wrapHandler(this.handleKeyDown)); - this.handler.subscribe(grid.onClick, this.wrapHandler(this.handleClick)); - } - destroy() { - var _a; - (_a = this.handler) == null ? void 0 : _a.unsubscribeAll(); - } - wrapHandler(handler) { - return function() { - if (!this.inHandler) { - this.inHandler = true; - handler.apply(this, arguments); - this.inHandler = false; - } - }.bind(this); - } - rowsToRanges(rows) { - let ranges = []; - let lastCell = this.grid.getColumns().length - 1; - for (let i = 0; i < rows.length; i++) { - ranges.push(new Range(rows[i], 0, rows[i], lastCell)); - } - return ranges; - } - getSelectedRows() { - return rangesToRows(this.ranges); - } - setSelectedRows(rows) { - this.setSelectedRanges(this.rowsToRanges(rows)); - } - setSelectedRanges(ranges) { - if ((!this.ranges || this.ranges.length === 0) && (!ranges || ranges.length === 0)) - return; - this.ranges = ranges; - this.onSelectedRangesChanged.notify(this.ranges); - } - getSelectedRanges() { - return this.ranges; - } - handleActiveCellChange(_, data) { - if (this.options.selectActiveRow && data.row != null) { - this.setSelectedRanges([new Range(data.row, 0, data.row, this.grid.getColumns().length - 1)]); - } - } - handleKeyDown(e) { - let activeRow = this.grid.getActiveCell(); - if (!(activeRow && e.shiftKey && !e.ctrlKey && !e.altKey && !e.metaKey && (e.which == 38 || e.which == 40))) - return; - let selectedRows = this.getSelectedRows(); - selectedRows.sort(function(x, y) { - return x - y; - }); - if (!selectedRows.length) { - selectedRows = [activeRow.row]; - } - let top = selectedRows[0]; - let bottom = selectedRows[selectedRows.length - 1]; - let active; - if (e.which == 40) { - active = activeRow.row < bottom || top == bottom ? ++bottom : ++top; - } else { - active = activeRow.row < bottom ? --bottom : --top; - } - if (active >= 0 && active < this.grid.getDataLength()) { - this.grid.scrollRowIntoView(active); - this.ranges = this.rowsToRanges(getRowsRange(top, bottom)); - this.setSelectedRanges(this.ranges); - } - e.preventDefault(); - e.stopPropagation(); - } - handleClick(e) { - let cell = this.grid.getCellFromEvent(e); - if (!cell || !this.grid.canCellBeActive(cell.row, cell.cell)) { - return false; - } - if (!this.grid.getOptions().multiSelect || !e.ctrlKey && !e.shiftKey && !e.metaKey) { - return false; - } - let selection = rangesToRows(this.ranges); - let idx = selection.indexOf(cell.row); - if (idx === -1 && (e.ctrlKey || e.metaKey)) { - selection.push(cell.row); - this.grid.setActiveCell(cell.row, cell.cell); - } else if (idx !== -1 && (e.ctrlKey || e.metaKey)) { - selection = selection.filter((o) => { - return o !== cell.row; - }); - this.grid.setActiveCell(cell.row, cell.cell); - } else if (selection.length && e.shiftKey) { - let last = selection.pop(); - let from = Math.min(cell.row, last); - let to = Math.max(cell.row, last); - selection = []; - for (let i = from; i <= to; i++) { - if (i !== last) { - selection.push(i); - } - } - selection.push(last); - this.grid.setActiveCell(cell.row, cell.cell); - } - this.ranges = this.rowsToRanges(selection); - this.setSelectedRanges(this.ranges); - e.stopImmediatePropagation(); - return true; - } - }; - _RowSelectionModel.defaults = { - selectActiveRow: true - }; - var RowSelectionModel = _RowSelectionModel; - return __toCommonJS(rowselectionmodel_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/layouts/slick.frozenlayout.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/layouts/slick.frozenlayout.js deleted file mode 100644 index 07209e6eaf..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/layouts/slick.frozenlayout.js +++ /dev/null @@ -1,667 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/layouts/frozenlayout.ts - var frozenlayout_exports = {}; - __export(frozenlayout_exports, { - FrozenLayout: () => FrozenLayout - }); - - // global-externals:_ - var { disableSelection, H, parsePx, spacerDiv } = Slick; - - // src/layouts/frozenlayout.ts - var FrozenLayout = function() { - var canvasWidth; - var canvasWidthL; - var canvasWidthR; - var frozenBottom; - var frozenRowIdx; - var frozenCols; - var frozenRows; - var headersWidthL; - var headersWidthR; - var viewportTopH; - var canvasBottomL; - var canvasBottomR; - var canvasTopL; - var canvasTopR; - var headerColsL; - var headerColsR; - var headerRowColsL; - var headerRowColsR; - var headerRowSpacerL; - var headerRowSpacerR; - var footerRowColsL; - var footerRowColsR; - var footerRowSpacerL; - var footerRowSpacerR; - var paneBottomL; - var paneBottomR; - var paneHeaderL; - var paneHeaderR; - var paneTopL; - var paneTopR; - var scrollContainerX; - var scrollContainerY; - var topPanelL; - var topPanelR; - var viewportBottomL; - var viewportBottomR; - var viewportTopL; - var viewportTopR; - function appendCachedRow(row, rowNodeL, rowNodeR) { - var bottom = frozenRows && row >= frozenRowIdx + (frozenBottom ? 0 : 1); - if (bottom) { - rowNodeL && canvasBottomL.appendChild(rowNodeL); - frozenCols && rowNodeR && canvasBottomR.appendChild(rowNodeR); - } else { - rowNodeL && canvasTopL.appendChild(rowNodeL); - frozenCols && rowNodeR && canvasTopR.appendChild(rowNodeR); - } - } - const calcCanvasWidth = () => { - var cols = host.getColumns(), i = cols.length; - canvasWidthL = canvasWidthR = 0; - while (i--) { - if (frozenCols > 0 && i >= frozenCols) { - canvasWidthR += cols[i].width; - } else { - canvasWidthL += cols[i].width; - } - } - var totalRowWidth = canvasWidthL + canvasWidthR; - return host.getOptions().fullWidthRows ? Math.max(totalRowWidth, host.getAvailableWidth()) : totalRowWidth; - }; - var host; - function init(hostGrid) { - host = hostGrid; - const spacerW = calcCanvasWidth() + host.getScrollDims().width + "px"; - const options = host.getOptions(); - const uisd = options.useLegacyUI ? " ui-state-default" : ""; - headerColsL = H("div", { class: "slick-header-columns slick-header-columns-left", style: (options.rtl ? "right" : "left") + ":-1000px" }); - paneHeaderL = H( - "div", - { class: "slick-pane slick-pane-header slick-pane-left", tabIndex: "0" }, - H("div", { class: "slick-header slick-header-left" + uisd, style: !options.showColumnHeader && "display: none" }, headerColsL) - ); - headerColsR = H("div", { class: "slick-header-columns slick-header-columns-right", style: (options.rtl ? "right" : "left") + ":-1000px" }); - paneHeaderR = H( - "div", - { class: "slick-pane slick-pane-header slick-pane-right", tabIndex: "0" }, - H("div", { class: "slick-header slick-header-right" + uisd, style: !options.showColumnHeader && "display: none" }, headerColsR) - ); - headerRowColsL = H("div", { class: "slick-headerrow-columns slick-headerrow-columns-left" }); - headerRowSpacerL = spacerDiv(spacerW); - var headerRowL = H("div", { class: "slick-headerrow" + uisd, style: !options.showHeaderRow && "display: none" }, headerRowColsL, headerRowSpacerL); - topPanelL = H("div", { class: "slick-top-panel", style: "width: 10000px" }); - var topPanelLS = H("div", { class: "slick-top-panel-scroller" + uisd, style: !options.showTopPanel && "display: none" }, topPanelL); - canvasTopL = H("div", { class: "grid-canvas grid-canvas-top grid-canvas-left", tabIndex: "0", hideFocus: "" }); - viewportTopL = H("div", { class: "slick-viewport slick-viewport-top slick-viewport-left", tabIndex: "0", hideFocus: "" }, canvasTopL); - footerRowColsL = H("div", { class: "slick-footerrow-columns slick-footerrow-columns-left" }); - footerRowSpacerL = spacerDiv(spacerW); - var footerRowL = H("div", { class: "slick-footerrow" + uisd, style: !options.showFooterRow && "display: none" }, footerRowColsL, footerRowSpacerL); - paneTopL = H("div", { class: "slick-pane slick-pane-top slick-pane-left", tabIndex: "0" }, headerRowL, topPanelLS, viewportTopL, footerRowL); - headerRowColsR = H("div", { class: "slick-headerrow-columns slick-headerrow-columns-right" }); - headerRowSpacerR = spacerDiv(spacerW); - var headerRowR = H("div", { class: "slick-headerrow" + uisd, style: !options.showHeaderRow && "display: none" }, headerRowColsR, headerRowSpacerR); - topPanelR = H("div", { class: "slick-top-panel", style: "width: 10000px" }); - var topPanelRS = H("div", { class: "slick-top-panel-scroller" + uisd, style: !options.showTopPanel && "display: none" }, topPanelR); - canvasTopR = H("div", { class: "grid-canvas grid-canvas-top grid-canvas-right", tabIndex: "0", hideFocus: "" }); - viewportTopR = H("div", { class: "slick-viewport slick-viewport-top slick-viewport-right", tabIndex: "0", hideFocus: "" }, canvasTopR); - footerRowColsR = H("div", { class: "slick-footerrow-columns slick-footerrow-columns-right" }); - footerRowSpacerR = H("div", { style: "display:block;height:1px;position:absolute;top:0;left:0;", width: spacerW }); - var footerRowR = H("div", { class: "slick-footer-row" + uisd, style: !options.showFooterRow && "display: none" }, footerRowColsR, footerRowSpacerR); - paneTopR = H("div", { class: "slick-pane slick-pane-top slick-pane-right", tabIndex: "0" }, headerRowR, topPanelRS, viewportTopR, footerRowR); - canvasBottomL = H("div", { class: "grid-canvas grid-canvas-bottom grid-canvas-left", tabIndex: "0", hideFocus: "" }); - viewportBottomL = H("div", { class: "slick-viewport slick-viewport-bottom slick-viewport-left", tabIndex: "0", hideFocus: "" }, canvasBottomL); - paneBottomL = H("div", { class: "slick-pane slick-pane-bottom slick-pane-left", tabIndex: "0" }, viewportBottomL); - canvasBottomR = H("div", { class: "grid-canvas grid-canvas-bottom grid-canvas-right", tabIndex: "0", hideFocus: "" }); - viewportBottomR = H("div", { class: "slick-viewport slick-viewport-bottom slick-viewport-right", tabIndex: "0", hideFocus: "" }); - paneBottomR = H("div", { class: "slick-pane slick-pane-bottom slick-pane-right", tabIndex: "0" }, viewportBottomR); - host.getContainerNode().append( - paneHeaderL, - paneHeaderR, - paneTopL, - paneTopR, - paneBottomL, - paneBottomR - ); - disableSelection(headerColsL); - disableSelection(headerColsR); - adjustFrozenRowOption(); - } - function getHeaderCols() { - return [headerColsL, headerColsR]; - } - function getHeaderRowCols() { - return [headerRowColsL, headerRowColsR]; - } - function getFooterRowCols() { - return [footerRowColsL, footerRowColsR]; - } - const getCanvasNodeFor = (cell, row) => { - if (row == null && cell == null) - return canvasTopL; - var rightSide = cell >= frozenCols; - if (frozenRows > 0 && row >= frozenRowIdx + (frozenBottom ? 0 : 1)) - return rightSide ? canvasBottomR : canvasBottomL; - return rightSide ? canvasTopR : canvasTopL; - }; - function getCanvasWidth() { - return canvasWidth; - } - function getCanvasNodes() { - return [canvasTopL, canvasTopR, canvasBottomL, canvasBottomR]; - } - function getScrollContainerX() { - return scrollContainerX; - } - function getScrollContainerY() { - return scrollContainerY; - } - function getViewportNodeFor(cell, row) { - if (row == null && cell == null) - return canvasTopL; - var rightSide = cell >= frozenCols; - if (frozenRows > 0 && row >= frozenRowIdx + (frozenBottom ? 0 : 1)) - return rightSide ? canvasBottomR : canvasBottomL; - return rightSide ? canvasTopR : canvasTopL; - } - function getViewportNodes() { - return [viewportTopL, viewportTopR, viewportBottomL, viewportBottomR]; - } - const updateCanvasWidth = () => { - var oldCanvasWidth = canvasWidth; - var oldCanvasWidthL = canvasWidthL; - var oldCanvasWidthR = canvasWidthR; - var widthChanged; - canvasWidth = calcCanvasWidth(); - var scrollWidth = host.getScrollDims().width; - widthChanged = canvasWidth !== oldCanvasWidth || canvasWidthL !== oldCanvasWidthL || canvasWidthR !== oldCanvasWidthR; - var vpi = host.getViewportInfo(); - if (widthChanged || frozenCols || frozenRows) { - var cwlPX = canvasWidthL + "px"; - var cwrPX = canvasWidthR + "px"; - canvasTopL.style.width = cwlPX; - calcHeaderWidths(); - if (frozenCols) { - var vpminusPX = vpi.width - canvasWidthL + "px"; - const rtl = host.getOptions().rtl; - canvasTopR.style.width = cwrPX; - paneHeaderL.style.width = cwlPX; - paneHeaderR.style[rtl ? "right" : "left"] = cwlPX; - paneHeaderR.style.width = vpminusPX; - paneTopL.style.width = cwlPX; - paneTopR.style[rtl ? "right" : "left"] = cwlPX; - paneTopR.style.width = vpminusPX; - headerRowColsL.style.width = cwlPX; - headerRowColsL.parentElement.style.width = cwlPX; - headerRowColsR.style.width = cwrPX; - headerRowColsR.parentElement.style.width = vpminusPX; - footerRowColsL.style.width = cwlPX; - footerRowColsL.parentElement.style.width = cwlPX; - footerRowColsR.style.width = cwrPX; - footerRowColsR.parentElement.style.width = vpminusPX; - viewportTopL.style.width = cwlPX; - viewportTopR.style.width = vpminusPX; - if (frozenRows) { - paneBottomL.style.width = cwlPX; - paneBottomR.style[rtl ? "right" : "left"] = cwlPX; - viewportBottomL.style.width = cwlPX; - viewportBottomR.style.width = vpminusPX; - canvasBottomL.style.width = cwlPX; - canvasBottomR.style.width = cwrPX; - } - } else { - paneHeaderL.style.width = "100%"; - paneTopL.style.width = "100%"; - headerRowColsL.parentElement.style.width = "100%"; - headerRowColsL.style.width = canvasWidth + "px"; - footerRowColsL.parentElement.style.width = "100%"; - footerRowColsL.style.width = canvasWidth + "px"; - viewportTopL.style.width = "100%"; - if (frozenRows) { - viewportBottomL.style.width = "100%"; - canvasBottomL.style.width = cwlPX; - } - } - vpi.hasHScroll = canvasWidth > vpi.width - scrollWidth; - } - var w = canvasWidth + (vpi.hasHScroll ? scrollWidth : 0) + "px"; - headerRowSpacerL.style.width = w; - headerRowSpacerR.style.width = w; - footerRowSpacerL.style.width = w; - footerRowSpacerR.style.width = w; - return widthChanged; - }; - const getHeaderColumn = (cell) => { - return frozenCols > 0 && cell >= frozenCols ? headerColsR.children.item(cell - frozenCols) : headerColsL.children.item(cell); - }; - const getHeaderRowColumn = (cell) => { - var target; - if (frozenCols <= 0 || cell < frozenCols) { - target = headerRowColsL; - } else { - target = headerRowColsR; - cell -= frozenCols; - } - return target.childNodes.item(cell); - }; - const getFooterRowColumn = (cell) => { - var target; - if (frozenCols <= 0 || cell < frozenCols) { - target = footerRowColsL; - } else { - target = footerRowColsR; - cell -= frozenCols; - } - return target.childNodes.item(cell); - }; - const getHeaderRowColsFor = (cell) => { - return frozenCols > 0 && cell >= frozenCols ? headerRowColsR : headerRowColsL; - }; - const getFooterRowColsFor = (cell) => { - return frozenCols > 0 && cell >= frozenCols ? footerRowColsR : footerRowColsL; - }; - const calcHeaderWidths = () => { - headersWidthL = headersWidthR = 0; - var scrollWidth = host.getScrollDims().width; - var cols = host.getColumns(); - for (var i = 0, ii = cols.length; i < ii; i++) { - var width = cols[i].width; - if (frozenCols > 0 && i >= frozenCols) { - headersWidthR += width; - } else { - headersWidthL += width; - } - } - const vs = host.getViewportInfo(); - if (frozenCols > 0) { - headersWidthL = headersWidthL + 1e3; - headersWidthR = Math.max(headersWidthR, vs.width) + headersWidthL; - headersWidthR += scrollWidth; - } else { - headersWidthL += scrollWidth; - headersWidthL = Math.max(headersWidthL, vs.width) + 1e3; - } - headerColsL.style.width = headersWidthL + "px"; - headerColsR.style.width = headersWidthR + "px"; - }; - const getHeaderColsFor = (cell) => { - return frozenCols > 0 && cell >= frozenCols ? headerColsR : headerColsL; - }; - const handleScrollH = () => { - const options = host.getOptions(); - const scrollLeft = host.getScrollLeft(); - if (frozenCols) { - options.showColumnHeader && (headerColsR.parentElement.scrollLeft = scrollLeft); - options.showTopPanel && (topPanelR.parentElement.scrollLeft = scrollLeft); - options.showHeaderRow && (headerRowColsR.parentElement.scrollLeft = scrollLeft); - options.showFooterRow && (footerRowColsR.parentElement.scrollLeft = scrollLeft); - if (frozenRows) { - viewportTopR.scrollLeft = scrollLeft; - } - } else { - options.showColumnHeader && (headerColsL.parentElement.scrollLeft = scrollLeft); - options.showTopPanel && (topPanelL.parentElement.scrollLeft = scrollLeft); - options.showHeaderRow && (headerRowColsL.parentElement.scrollLeft = scrollLeft); - options.showFooterRow && (footerRowColsL.parentElement.scrollLeft = scrollLeft); - if (frozenRows) { - viewportTopL.scrollLeft = scrollLeft; - } - } - }; - const handleScrollV = () => { - if (frozenCols) { - if (frozenRows && !frozenBottom) { - viewportBottomL.scrollTop = host.getScrollTop(); - } else { - viewportTopL.scrollTop = host.getScrollTop(); - } - } - }; - const setScroller = () => { - if (frozenCols) { - if (frozenRows) { - if (frozenBottom) { - scrollContainerX = viewportBottomR; - scrollContainerY = viewportTopR; - } else { - scrollContainerX = scrollContainerY = viewportBottomR; - } - } else { - scrollContainerX = scrollContainerY = viewportTopR; - } - } else { - if (frozenRows) { - if (frozenBottom) { - scrollContainerX = viewportBottomL; - scrollContainerY = viewportTopL; - } else { - scrollContainerX = scrollContainerY = viewportBottomL; - } - } else { - scrollContainerX = scrollContainerY = viewportTopL; - } - } - }; - const setPaneVisibility = () => { - paneHeaderR.style.display = paneTopR.style.display = frozenCols ? "" : "none"; - paneBottomL.style.display = frozenRows ? "" : "none"; - paneBottomR.style.display = frozenRows && frozenCols ? "" : "none"; - }; - const setOverflow = () => { - const options = host.getOptions(); - var alwaysHS = options.alwaysAllowHorizontalScroll; - var alwaysVS = options.alwaysShowVerticalScroll; - viewportTopL.style.overflowX = viewportTopR.style.overflowX = frozenRows && !alwaysHS ? "hidden" : frozenCols ? "scroll" : "auto"; - viewportTopL.style.overflowY = viewportBottomL.style.overflowY = !frozenCols && alwaysVS ? "scroll" : frozenCols ? "hidden" : frozenRows ? "scroll" : options.autoHeight ? "hidden" : "auto"; - viewportTopR.style.overflowY = alwaysVS || frozenRows ? "scroll" : options.autoHeight ? "hidden" : "auto"; - viewportBottomL.style.overflowX = viewportBottomR.style.overflowX = frozenCols && !alwaysHS ? "scroll" : "auto"; - viewportBottomR.style.overflowY = alwaysVS ? "scroll" : "auto"; - }; - const bindAncestorScrollEvents = () => { - var elem = frozenRows && !frozenBottom ? canvasBottomL : canvasTopL; - while ((elem = elem.parentNode) != document.body && elem != null) { - if (elem == viewportTopL || elem.scrollWidth != elem.clientWidth || elem.scrollHeight != elem.clientHeight) { - host.bindAncestorScroll(elem); - } - } - }; - const afterHeaderColumnDrag = () => { - const oldCanvasWidthL = canvasWidthL; - canvasWidth = calcCanvasWidth(); - if (frozenCols && canvasWidthL != oldCanvasWidthL) { - headerColsL.style.width = canvasWidthL + 1e3 + "px"; - paneHeaderR.style[host.getOptions().rtl ? "right" : "left"] = canvasWidthL + "px"; - } - }; - const applyColumnWidths = () => { - var x = 0, w, rule, cols = host.getColumns(), opts = host.getOptions(), rtl = opts.rtl, s = rtl ? "right" : "left", e = rtl ? "left" : "right"; - if (opts.useCssVars) { - var styles = host.getContainerNode().style; - for (var i = 0; i < cols.length; i++) { - if (frozenCols == i) - x = 0; - w = cols[i].width; - var prop = "--l" + i; - var oldVal = styles.getPropertyValue(prop); - var newVal = x + "px"; - if (oldVal !== newVal) - styles.setProperty(prop, newVal); - prop = "--r" + i; - oldVal = styles.getPropertyValue(prop); - newVal = (frozenCols > 0 && i >= frozenCols ? canvasWidthR : canvasWidthL) - x - w + "px"; - if (oldVal !== newVal) - styles.setProperty(prop, newVal); - x += w; - } - } else { - for (var i = 0; i < cols.length; i++) { - if (frozenCols == i) - x = 0; - w = cols[i].width; - rule = host.getColumnCssRules(i); - rule[s].style[s] = x + "px"; - rule[e].style[e] = (frozenCols > 0 && i >= frozenCols ? canvasWidthR : canvasWidthL) - x - w + "px"; - x += w; - } - } - }; - const getTopPanelFor = (cell) => { - return frozenCols > 0 && cell >= frozenCols ? topPanelR : topPanelL; - }; - const getTopPanelNodes = () => [topPanelL, topPanelR]; - const resizeCanvas = () => { - var _paneTopH = 0; - var _paneBottomH = 0; - const vs = host.getViewportInfo(); - const options = host.getOptions(); - if (frozenRows) { - const frozenRowsHeight = frozenRows * options.rowHeight; - if (frozenBottom) { - _paneTopH = vs.height - frozenRowsHeight; - _paneBottomH = frozenRowsHeight + host.getScrollDims().height; - } else { - _paneTopH = frozenRowsHeight; - _paneBottomH = vs.height - frozenRowsHeight; - } - } else { - _paneTopH = vs.height; - } - _paneTopH += vs.topPanelHeight + vs.headerRowHeight + vs.footerRowHeight; - viewportTopH = _paneTopH - vs.topPanelHeight - vs.headerRowHeight - vs.footerRowHeight; - if (options.autoHeight) { - host.getContainerNode().style.height = _paneTopH + vs.groupingPanelHeight + parsePx(getComputedStyle(headerColsL.parentElement).height) + "px"; - } - paneTopL.style.top = vs.groupingPanelHeight + (parsePx(getComputedStyle(paneHeaderL).height) || vs.headerHeight) + "px"; - paneTopL.style.height = _paneTopH + "px"; - var paneBottomTop = paneTopL.offsetTop + _paneTopH; - if (options.autoHeight) { - viewportTopL.style.height = ""; - } else { - viewportTopL.style.height = viewportTopH + "px"; - } - if (frozenCols) { - paneTopR.style.top = paneTopL.style.top; - paneTopR.style.height = paneTopL.style.height; - viewportTopR.style.height = viewportTopL.style.height; - if (frozenRows) { - paneBottomL.style.top = paneBottomR.style.top = paneBottomTop + "px"; - paneBottomL.style.height = paneBottomR.style.height = viewportBottomR.style.height = _paneBottomH + "px"; - } - } else { - if (frozenRows) { - paneBottomL.style.width = "100%"; - paneBottomL.style.height = _paneBottomH + "px"; - paneBottomL.style.top = paneBottomTop + "px"; - } - } - if (frozenRows) { - viewportBottomL.style.height = _paneBottomH + "px"; - const frozenRowsHeight = frozenRows * options.rowHeight; - if (frozenBottom) { - canvasBottomL.style.height = frozenRowsHeight + "px"; - if (frozenCols) { - canvasBottomR.style.height = frozenRowsHeight + "px"; - } - } else { - canvasTopL.style.height = frozenRowsHeight + "px"; - if (frozenCols) { - canvasTopR.style.height = frozenRowsHeight + "px"; - } - } - } else { - viewportTopR.style.height = viewportTopH + "px"; - } - }; - function reorderViewColumns(viewCols, options) { - options = options || (host == null ? void 0 : host.getOptions()); - if ((options == null ? void 0 : options.frozenColumns) == null) { - options == null ? true : delete options.frozenColumns; - } else { - var toFreeze = options.frozenColumns; - options.frozenColumns = 0; - var i = 0; - while (i < viewCols.length) { - var col = viewCols[i++]; - if (toFreeze > 0 && col.visible !== false) { - col.frozen = true; - options.frozenColumns++; - toFreeze--; - } else if (col.frozen !== void 0) - delete col.frozen; - } - } - var frozenColumns = viewCols.filter((x) => x.frozen); - frozenCols = frozenColumns.length; - if (frozenCols) - return frozenColumns.concat(viewCols.filter((x) => !x.frozen)); - return viewCols; - } - function afterSetOptions(arg) { - if (arg.frozenRows != null || arg.frozenBottom != null) - adjustFrozenRowOption(); - } - function adjustFrozenRowOption() { - const options = host.getOptions(); - if (options.autoHeight) { - frozenRows = 0; - return; - } - frozenRows = options.frozenRows > 0 && options.frozenRows <= host.getViewportInfo().numVisibleRows ? options.frozenRows : 0; - if (frozenRows) { - frozenRowIdx = options.frozenBottom ? host.getDataLength() - frozenRows : frozenRows - 1; - } - } - function getScrollCanvasY() { - return frozenRows && !frozenBottom ? canvasBottomL : canvasTopL; - } - function realScrollHeightChange() { - const h = host.getViewportInfo().realScrollHeight; - if (frozenRows && !frozenBottom) { - canvasBottomL.style.height = h + "px"; - if (frozenCols) { - canvasBottomR.style.height = h + "px"; - } - } else { - canvasTopL.style.height = h + "px"; - canvasTopR.style.height = h + "px"; - } - } - function isFrozenRow(row) { - return frozenRows && (frozenBottom && row >= frozenRowIdx || !frozenBottom && row <= frozenRowIdx); - } - function beforeCleanupAndRenderCells(rendered) { - if (frozenRows) { - var renderedFrozenRows = Object.assign({}, rendered); - if (frozenBottom) { - renderedFrozenRows.top = frozenRowIdx; - renderedFrozenRows.bottom = host.getDataLength() - 1; - } else { - renderedFrozenRows.top = 0; - renderedFrozenRows.bottom = frozenRowIdx; - } - host.cleanUpAndRenderCells(renderedFrozenRows); - } - } - function afterRenderRows(rendered) { - if (frozenRows) { - if (frozenBottom) { - host.renderRows({ - top: frozenRowIdx, - bottom: host.getDataLength() - 1, - leftPx: rendered.leftPx, - rightPx: rendered.rightPx - }); - } else { - host.renderRows({ - top: 0, - bottom: frozenRowIdx, - leftPx: rendered.leftPx, - rightPx: rendered.rightPx - }); - } - } - } - function getRowOffset(row) { - if (!frozenRows || frozenBottom && row < frozenRowIdx || !frozenBottom && row <= frozenRowIdx) - return 0; - if (!frozenBottom) - return frozenRows * host.getOptions().rowHeight; - var realScrollHeight = host.getViewportInfo().realScrollHeight; - if (realScrollHeight >= viewportTopH) - return realScrollHeight; - return frozenRowIdx * host.getOptions().rowHeight; - } - function getRowFromCellNode(cellNode, clientX, clientY) { - var row = host.getRowFromNode(cellNode.parentNode); - if (frozenRows) { - var bcr = cellNode.closest(".grid-canvas").getBoundingClientRect(); - var rowOffset = 0; - var isBottom = cellNode.closest(".grid-canvas-bottom") != null; - if (isBottom) { - rowOffset = frozenBottom ? Math.round(parsePx(getComputedStyle(canvasTopL).height)) : frozenRows * host.getOptions().rowHeight; - } - return host.getCellFromPoint(clientX - bcr[host.getOptions().rtl ? "right" : "left"] - document.body.scrollLeft, clientY - bcr.top + document.body.scrollTop + rowOffset + document.body.scrollTop).row; - } - return row; - } - function getFrozenCols() { - return frozenCols; - } - function getFrozenRows() { - return frozenRows; - } - function destroy() { - host = null; - } - return { - afterHeaderColumnDrag, - afterRenderRows, - afterSetOptions, - appendCachedRow, - applyColumnWidths, - bindAncestorScrollEvents, - beforeCleanupAndRenderCells, - calcCanvasWidth, - updateHeadersWidth: calcHeaderWidths, - isFrozenRow, - destroy, - getCanvasNodeFor, - getCanvasNodes, - getCanvasWidth, - getFooterRowCols, - getFooterRowColsFor, - getFooterRowColumn, - getFrozenCols, - getFrozenRows, - getHeaderCols, - getHeaderColsFor, - getHeaderColumn, - getHeaderRowCols, - getHeaderRowColsFor, - getHeaderRowColumn, - getRowFromCellNode, - getFrozenRowOffset: getRowOffset, - getScrollCanvasY, - getScrollContainerX, - getScrollContainerY, - getTopPanelFor, - getTopPanelNodes, - getViewportNodeFor, - getViewportNodes, - handleScrollH, - handleScrollV, - init, - layoutName: "frozen", - realScrollHeightChange, - reorderViewColumns, - resizeCanvas, - setPaneVisibility, - setScroller, - setOverflow, - updateCanvasWidth - }; - }; - return __toCommonJS(frozenlayout_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.core.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.core.js deleted file mode 100644 index e1c39d82c7..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.core.js +++ /dev/null @@ -1,567 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/core/index.ts - var core_exports = {}; - __export(core_exports, { - EditorLock: () => EditorLock, - EventData: () => EventData, - EventEmitter: () => EventEmitter, - EventSubscriber: () => EventSubscriber, - GlobalEditorLock: () => GlobalEditorLock, - Group: () => Group, - GroupTotals: () => GroupTotals, - H: () => H, - NonDataRow: () => NonDataRow, - Range: () => Range, - addClass: () => addClass, - applyFormatterResultToCellNode: () => applyFormatterResultToCellNode, - columnDefaults: () => columnDefaults, - convertCompatFormatter: () => convertCompatFormatter, - defaultColumnFormat: () => defaultColumnFormat, - disableSelection: () => disableSelection, - escape: () => escape, - initializeColumns: () => initializeColumns, - keyCode: () => keyCode, - parsePx: () => parsePx, - patchEvent: () => patchEvent, - preClickClassName: () => preClickClassName, - removeClass: () => removeClass, - spacerDiv: () => spacerDiv, - titleize: () => titleize - }); - - // src/core/base.ts - var NonDataRow = class { - constructor() { - this.__nonDataRow = true; - } - }; - var preClickClassName = "slick-edit-preclick"; - - // src/core/column.ts - var columnDefaults = { - nameIsHtml: false, - resizable: true, - sortable: false, - minWidth: 30, - rerenderOnResize: false, - defaultSortAsc: true, - focusable: true, - selectable: true - }; - function initializeColumns(columns, defaults) { - var _a; - var usedIds = {}; - for (var i = 0; i < columns.length; i++) { - var m = columns[i]; - if (defaults != null) { - for (var k in defaults) { - if (m[k] === void 0) - m[k] = defaults[k]; - } - } - if (m.minWidth && m.width < m.minWidth) - m.width = m.minWidth; - if (m.maxWidth && m.width > m.maxWidth) - m.width = m.maxWidth; - if (m.id == null || usedIds[m.id]) { - const prefix = m.id != null && m.id.length ? m.id : m.field != null ? m.field : "col"; - var x = 0; - while (usedIds[m.id = prefix + (x == 0 ? "" : "_" + x.toString())]) - x++; - } - usedIds[m.id] = true; - if (m.name === void 0) { - m.name = titleize((_a = m.field) != null ? _a : m.id); - delete m.nameIsHtml; - } - } - } - function titleize(str) { - if (!str) - return str; - str = ("" + str).replace(/([A-Z]+)([A-Z][a-z])/, "$1_$2").replace(/([a-z\d])([A-Z])/, "$1_$2").replace(/[-\s]/, "_").toLowerCase(); - return str.replace(/\s/, "_").split("_").filter((x) => x.length).map((x) => x.charAt(0).toUpperCase() + x.substring(1).toLowerCase()).join(" "); - } - - // src/core/event.ts - var EventData = class { - constructor() { - this._isPropagationStopped = false; - this._isImmediatePropagationStopped = false; - } - /*** - * Stops event from propagating up the DOM tree. - * @method stopPropagation - */ - stopPropagation() { - this._isPropagationStopped = true; - } - /*** - * Returns whether stopPropagation was called on this event object. - */ - isPropagationStopped() { - return this._isPropagationStopped; - } - /*** - * Prevents the rest of the handlers from being executed. - */ - stopImmediatePropagation() { - this._isImmediatePropagationStopped = true; - } - /*** - * Returns whether stopImmediatePropagation was called on this event object.\ - */ - isImmediatePropagationStopped() { - return this._isImmediatePropagationStopped; - } - }; - var EventEmitter = class { - constructor() { - this._handlers = []; - } - /*** - * Adds an event handler to be called when the event is fired. - *

Event handler will receive two arguments - an EventData and the data - * object the event was fired with.

- * @method subscribe - * @param fn {Function} Event handler. - */ - subscribe(fn) { - this._handlers.push(fn); - } - /*** - * Removes an event handler added with subscribe(fn). - * @method unsubscribe - * @param fn {Function} Event handler to be removed. - */ - unsubscribe(fn) { - for (var i = this._handlers.length - 1; i >= 0; i--) { - if (this._handlers[i] === fn) { - this._handlers.splice(i, 1); - } - } - } - /*** - * Fires an event notifying all subscribers. - * @param args {Object} Additional data object to be passed to all handlers. - * @param e {EventData} - * Optional. - * An EventData object to be passed to all handlers. - * For DOM events, an existing W3C/jQuery event object can be passed in. - * @param scope {Object} - * Optional. - * The scope ("this") within which the handler will be executed. - * If not specified, the scope will be set to the Event instance. - */ - notify(args, e, scope) { - e = patchEvent(e) || new EventData(); - scope = scope || this; - var returnValue; - for (var i = 0; i < this._handlers.length && !(e.isPropagationStopped() || e.isImmediatePropagationStopped()); i++) { - returnValue = this._handlers[i].call(scope, e, args); - } - return returnValue; - } - clear() { - this._handlers = []; - } - }; - var EventSubscriber = class { - constructor() { - this._handlers = []; - } - subscribe(event, handler) { - this._handlers.push({ - event, - handler - }); - event.subscribe(handler); - return this; - } - unsubscribe(event, handler) { - var i = this._handlers.length; - while (i--) { - if (this._handlers[i].event === event && this._handlers[i].handler === handler) { - this._handlers.splice(i, 1); - event.unsubscribe(handler); - return this; - } - } - return this; - } - unsubscribeAll() { - var i = this._handlers.length; - while (i--) { - this._handlers[i].event.unsubscribe(this._handlers[i].handler); - } - this._handlers = []; - return this; - } - }; - var keyCode = { - BACKSPACE: 8, - DELETE: 46, - DOWN: 40, - END: 35, - ENTER: 13, - ESCAPE: 27, - HOME: 36, - INSERT: 45, - LEFT: 37, - PAGEDOWN: 34, - PAGEUP: 33, - RIGHT: 39, - TAB: 9, - UP: 38 - }; - function returnTrue() { - return true; - } - function returnFalse() { - return false; - } - function patchEvent(e) { - if (e == null) - return e; - if (!e.isDefaultPrevented && e.preventDefault) - e.isDefaultPrevented = function() { - return this.defaultPrevented; - }; - var org1, org2; - if (!e.isImmediatePropagationStopped && (org1 = e.stopImmediatePropagation)) { - e.isImmediatePropagationStopped = returnFalse; - e.stopImmediatePropagation = function() { - this.isImmediatePropagationStopped = returnTrue; - org1.call(this); - }; - } - if (!e.isPropagationStopped && (org2 = e.stopPropagation)) { - e.isPropagationStopped = returnFalse; - e.stopPropagation = function() { - this.isPropagationStopped = returnTrue; - org2.call(this); - }; - } - return e; - } - - // src/core/editing.ts - var EditorLock = class { - /*** - * Returns true if a specified edit controller is active (has the edit lock). - * If the parameter is not specified, returns true if any edit controller is active. - * @method isActive - * @param editController {EditController} - * @return {Boolean} - */ - isActive(editController) { - return editController ? this.activeEditController === editController : this.activeEditController != null; - } - /*** - * Sets the specified edit controller as the active edit controller (acquire edit lock). - * If another edit controller is already active, and exception will be thrown. - * @method activate - * @param editController {EditController} edit controller acquiring the lock - */ - activate(editController) { - if (editController === this.activeEditController) { - return; - } - if (this.activeEditController != null) { - throw "SleekGrid.EditorLock.activate: an editController is still active, can't activate another editController"; - } - if (!editController.commitCurrentEdit) { - throw "SleekGrid.EditorLock.activate: editController must implement .commitCurrentEdit()"; - } - if (!editController.cancelCurrentEdit) { - throw "SleekGrid.EditorLock.activate: editController must implement .cancelCurrentEdit()"; - } - this.activeEditController = editController; - } - /*** - * Unsets the specified edit controller as the active edit controller (release edit lock). - * If the specified edit controller is not the active one, an exception will be thrown. - * @method deactivate - * @param editController {EditController} edit controller releasing the lock - */ - deactivate(editController) { - if (this.activeEditController !== editController) { - throw "SleekGrid.EditorLock.deactivate: specified editController is not the currently active one"; - } - this.activeEditController = null; - } - /*** - * Attempts to commit the current edit by calling "commitCurrentEdit" method on the active edit - * controller and returns whether the commit attempt was successful (commit may fail due to validation - * errors, etc.). Edit controller's "commitCurrentEdit" must return true if the commit has succeeded - * and false otherwise. If no edit controller is active, returns true. - * @method commitCurrentEdit - * @return {Boolean} - */ - commitCurrentEdit() { - return this.activeEditController ? this.activeEditController.commitCurrentEdit() : true; - } - /*** - * Attempts to cancel the current edit by calling "cancelCurrentEdit" method on the active edit - * controller and returns whether the edit was successfully cancelled. If no edit controller is - * active, returns true. - * @method cancelCurrentEdit - * @return {Boolean} - */ - cancelCurrentEdit() { - return this.activeEditController ? this.activeEditController.cancelCurrentEdit() : true; - } - }; - var GlobalEditorLock = new EditorLock(); - - // src/core/util.ts - function addClass(el, cls) { - if (cls == null || !cls.length) - return; - if (cls.indexOf(" ") >= 0) { - var arr = cls.split(" ").map((x) => x.trim()).filter((x) => x.length); - for (var a of arr) - el.classList.add(a); - } else - el.classList.add(cls); - } - var esc = { - "<": "<", - ">": ">", - '"': """, - "'": "'", - "&": "&" - }; - function escFunc(a) { - return esc[a]; - } - function escape(s) { - if (!arguments.length) - s = this.value; - if (s == null) - return ""; - if (typeof s !== "string") - s = "" + s; - return s.replace(/[<>"'&]/g, escFunc); - } - function disableSelection(target) { - if (target) { - target.setAttribute("unselectable", "on"); - target.style.userSelect = "none"; - target.addEventListener("selectstart", () => false); - } - } - function removeClass(el, cls) { - if (cls == null || !cls.length) - return; - if (cls.indexOf(" ") >= 0) { - var arr = cls.split(" ").map((x) => x.trim()).filter((x) => x.length); - for (var a of arr) - el.classList.remove(a); - } else - el.classList.remove(cls); - } - function H(tag, attr, ...children) { - var el = document.createElement(tag); - var k, v, c; - if (attr) { - for (k in attr) { - v = attr[k]; - if (v != null && v !== false) { - if (k === "ref" && typeof v === "function") { - v(el); - continue; - } - var key = k === "className" ? "class" : k; - el.setAttribute(key, v === true ? "" : v); - } - } - } - if (children && children.length) - el.append(...children); - return el; - } - function spacerDiv(width) { - return H("div", { style: "display:block;height:1px;position:absolute;top:0;left:0;", width }); - } - function parsePx(str) { - var value = parseFloat(str); - if (isNaN(value)) - return 0; - return value; - } - - // src/core/formatting.ts - function defaultColumnFormat(ctx) { - return escape(ctx.value); - } - function convertCompatFormatter(compatFormatter) { - if (compatFormatter == null) - return null; - return function(ctx) { - var fmtResult = compatFormatter(ctx.row, ctx.cell, ctx.value, ctx.column, ctx.item, ctx.grid); - if (fmtResult != null && typeof fmtResult !== "string" && Object.prototype.toString.call(fmtResult) === "[object Object]") { - ctx.addClass = fmtResult.addClasses; - ctx.tooltip = fmtResult.toolTip; - return fmtResult.text; - } - return fmtResult; - }; - } - function applyFormatterResultToCellNode(ctx, html, node) { - var _a, _b; - var oldFmtAtt = node.dataset.fmtatt; - if ((oldFmtAtt == null ? void 0 : oldFmtAtt.length) > 0) { - for (var k of oldFmtAtt.split(",")) - node.removeAttribute(k); - delete node.dataset.fmtatt; - } - var oldFmtCls = node.dataset.fmtcls; - if ((oldFmtCls == null ? void 0 : oldFmtCls.length) && ctx.addClass != oldFmtCls) { - removeClass(node, oldFmtCls); - if (!((_a = ctx.addClass) == null ? void 0 : _a.length)) - delete node.dataset.fmtcls; - } - var oldTooltip = node.getAttribute("tooltip"); - if (oldTooltip != null && ctx.tooltip != oldTooltip) - node.removeAttribute("tooltip"); - if (ctx.tooltip !== void 0 && oldTooltip != ctx.tooltip) - node.setAttribute("tooltip", ctx.tooltip); - if (html == void 0) - node.innerHTML = ""; - else if (html instanceof Node) { - node.appendChild(html); - } else - node.innerHTML = "" + html; - if (ctx.addAttrs != null) { - var keys = Object.keys(ctx.addAttrs); - if (keys.length) { - for (var k of keys) { - node.setAttribute(k, ctx.addAttrs[k]); - } - node.dataset.fmtatt = keys.join(","); - } - } - if ((_b = ctx.addClass) == null ? void 0 : _b.length) { - addClass(node, ctx.addClass); - node.dataset.fmtcls = ctx.addClass; - } - } - - // src/core/group.ts - var Group = class extends NonDataRow { - constructor() { - super(...arguments); - this.__group = true; - /** - * Grouping level, starting with 0. - * @property level - * @type {Number} - */ - this.level = 0; - /*** - * Number of rows in the group. - * @property count - * @type {Number} - */ - this.count = 0; - /*** - * Whether a group is collapsed. - * @property collapsed - * @type {Boolean} - */ - this.collapsed = false; - /** - * Rows that are part of the group. - * @property rows - * @type {Array} - */ - this.rows = []; - } - /*** - * Compares two Group instances. - * @method equals - * @return {Boolean} - * @param group {Group} Group instance to compare to. - */ - equals(group) { - return this.value === group.value && this.count === group.count && this.collapsed === group.collapsed && this.title === group.title; - } - }; - var GroupTotals = class extends NonDataRow { - constructor() { - super(...arguments); - this.__groupTotals = true; - /*** - * Whether the totals have been fully initialized / calculated. - * Will be set to false for lazy-calculated group totals. - * @param initialized - * @type {Boolean} - */ - this.initialized = false; - } - }; - - // src/core/range.ts - var Range = class { - constructor(fromRow, fromCell, toRow, toCell) { - if (toRow === void 0 && toCell === void 0) { - toRow = fromRow; - toCell = fromCell; - } - this.fromRow = Math.min(fromRow, toRow); - this.fromCell = Math.min(fromCell, toCell); - this.toRow = Math.max(fromRow, toRow); - this.toCell = Math.max(fromCell, toCell); - } - /*** - * Returns whether a range represents a single row. - */ - isSingleRow() { - return this.fromRow == this.toRow; - } - /*** - * Returns whether a range represents a single cell. - */ - isSingleCell() { - return this.fromRow == this.toRow && this.fromCell == this.toCell; - } - /*** - * Returns whether a range contains a given cell. - */ - contains(row, cell) { - return row >= this.fromRow && row <= this.toRow && cell >= this.fromCell && cell <= this.toCell; - } - /*** - * Returns a readable representation of a range. - */ - toString() { - if (this.isSingleCell()) { - return "(" + this.fromRow + ":" + this.fromCell + ")"; - } else { - return "(" + this.fromRow + ":" + this.fromCell + " - " + this.toRow + ":" + this.toCell + ")"; - } - } - }; - return __toCommonJS(core_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; Slick.Event = Slick.EventEmitter; Slick.EventHandler = Slick.EventSubscriber; typeof Map !== 'undefined' && (Slick.Map = Map); diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.core.min.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.core.min.js deleted file mode 100644 index e479f592c5..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.core.min.js +++ /dev/null @@ -1,2 +0,0 @@ -var Slick=Slick||{};Slick._=(()=>{var p=Object.defineProperty;var D=Object.getOwnPropertyDescriptor;var w=Object.getOwnPropertyNames;var S=Object.prototype.hasOwnProperty;var F=(e,t)=>{for(var r in t)p(e,r,{get:t[r],enumerable:!0})},R=(e,t,r,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of w(t))!S.call(e,o)&&o!==r&&p(e,o,{get:()=>t[o],enumerable:!(n=D(t,o))||n.enumerable});return e};var _=e=>R(p({},"__esModule",{value:!0}),e);var U={};F(U,{EditorLock:()=>d,EventData:()=>m,EventEmitter:()=>c,EventSubscriber:()=>f,GlobalEditorLock:()=>k,Group:()=>E,GroupTotals:()=>b,H:()=>A,NonDataRow:()=>s,Range:()=>C,addClass:()=>v,applyFormatterResultToCellNode:()=>$,columnDefaults:()=>M,convertCompatFormatter:()=>j,defaultColumnFormat:()=>K,disableSelection:()=>G,escape:()=>g,initializeColumns:()=>H,keyCode:()=>N,parsePx:()=>W,patchEvent:()=>P,preClickClassName:()=>L,removeClass:()=>h,spacerDiv:()=>V,titleize:()=>y});var s=class{constructor(){this.__nonDataRow=!0}},L="slick-edit-preclick";var M={nameIsHtml:!1,resizable:!0,sortable:!1,minWidth:30,rerenderOnResize:!1,defaultSortAsc:!0,focusable:!0,selectable:!0};function H(e,t){var l;for(var r={},n=0;no.maxWidth&&(o.width=o.maxWidth),o.id==null||r[o.id]){let u=o.id!=null&&o.id.length?o.id:o.field!=null?o.field:"col";for(var i=0;r[o.id=u+(i==0?"":"_"+i.toString())];)i++}r[o.id]=!0,o.name===void 0&&(o.name=y((l=o.field)!=null?l:o.id),delete o.nameIsHtml)}}function y(e){return e&&(e=(""+e).replace(/([A-Z]+)([A-Z][a-z])/,"$1_$2").replace(/([a-z\d])([A-Z])/,"$1_$2").replace(/[-\s]/,"_").toLowerCase(),e.replace(/\s/,"_").split("_").filter(t=>t.length).map(t=>t.charAt(0).toUpperCase()+t.substring(1).toLowerCase()).join(" "))}var m=class{constructor(){this._isPropagationStopped=!1;this._isImmediatePropagationStopped=!1}stopPropagation(){this._isPropagationStopped=!0}isPropagationStopped(){return this._isPropagationStopped}stopImmediatePropagation(){this._isImmediatePropagationStopped=!0}isImmediatePropagationStopped(){return this._isImmediatePropagationStopped}},c=class{constructor(){this._handlers=[]}subscribe(t){this._handlers.push(t)}unsubscribe(t){for(var r=this._handlers.length-1;r>=0;r--)this._handlers[r]===t&&this._handlers.splice(r,1)}notify(t,r,n){r=P(r)||new m,n=n||this;for(var o,a=0;a=0){var r=t.split(" ").map(o=>o.trim()).filter(o=>o.length);for(var n of r)e.classList.add(n)}else e.classList.add(t)}var O={"<":"<",">":">",'"':""","'":"'","&":"&"};function z(e){return O[e]}function g(e){return arguments.length||(e=this.value),e==null?"":(typeof e!="string"&&(e=""+e),e.replace(/[<>"'&]/g,z))}function G(e){e&&(e.setAttribute("unselectable","on"),e.style.userSelect="none",e.addEventListener("selectstart",()=>!1))}function h(e,t){if(!(t==null||!t.length))if(t.indexOf(" ")>=0){var r=t.split(" ").map(o=>o.trim()).filter(o=>o.length);for(var n of r)e.classList.remove(n)}else e.classList.remove(t)}function A(e,t,...r){var n=document.createElement(e),o,a,i;if(t){for(o in t)if(a=t[o],a!=null&&a!==!1){if(o==="ref"&&typeof a=="function"){a(n);continue}var l=o==="className"?"class":o;n.setAttribute(l,a===!0?"":a)}}return r&&r.length&&n.append(...r),n}function V(e){return A("div",{style:"display:block;height:1px;position:absolute;top:0;left:0;",width:e})}function W(e){var t=parseFloat(e);return isNaN(t)?0:t}function K(e){return g(e.value)}function j(e){return e==null?null:function(t){var r=e(t.row,t.cell,t.value,t.column,t.item,t.grid);return r!=null&&typeof r!="string"&&Object.prototype.toString.call(r)==="[object Object]"?(t.addClass=r.addClasses,t.tooltip=r.toolTip,r.text):r}}function $(e,t,r){var u,T;var n=r.dataset.fmtatt;if((n==null?void 0:n.length)>0){for(var o of n.split(","))r.removeAttribute(o);delete r.dataset.fmtatt}var a=r.dataset.fmtcls;a!=null&&a.length&&e.addClass!=a&&(h(r,a),(u=e.addClass)!=null&&u.length||delete r.dataset.fmtcls);var i=r.getAttribute("tooltip");if(i!=null&&e.tooltip!=i&&r.removeAttribute("tooltip"),e.tooltip!==void 0&&i!=e.tooltip&&r.setAttribute("tooltip",e.tooltip),t==null?r.innerHTML="":t instanceof Node?r.appendChild(t):r.innerHTML=""+t,e.addAttrs!=null){var l=Object.keys(e.addAttrs);if(l.length){for(var o of l)r.setAttribute(o,e.addAttrs[o]);r.dataset.fmtatt=l.join(",")}}(T=e.addClass)!=null&&T.length&&(v(r,e.addClass),r.dataset.fmtcls=e.addClass)}var E=class extends s{constructor(){super(...arguments);this.__group=!0;this.level=0;this.count=0;this.collapsed=!1;this.rows=[]}equals(r){return this.value===r.value&&this.count===r.count&&this.collapsed===r.collapsed&&this.title===r.title}},b=class extends s{constructor(){super(...arguments);this.__groupTotals=!0;this.initialized=!1}};var C=class{constructor(t,r,n,o){n===void 0&&o===void 0&&(n=t,o=r),this.fromRow=Math.min(t,n),this.fromCell=Math.min(r,o),this.toRow=Math.max(t,n),this.toCell=Math.max(r,o)}isSingleRow(){return this.fromRow==this.toRow}isSingleCell(){return this.fromRow==this.toRow&&this.fromCell==this.toCell}contains(t,r){return t>=this.fromRow&&t<=this.toRow&&r>=this.fromCell&&r<=this.toCell}toString(){return this.isSingleCell()?"("+this.fromRow+":"+this.fromCell+")":"("+this.fromRow+":"+this.fromCell+" - "+this.toRow+":"+this.toCell+")"}};return _(U);})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; Slick.Event = Slick.EventEmitter; Slick.EventHandler = Slick.EventSubscriber; typeof Map !== 'undefined' && (Slick.Map = Map); diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.editors.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.editors.js deleted file mode 100644 index b8117a1edd..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.editors.js +++ /dev/null @@ -1,428 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/editors/index.ts - var editors_exports = {}; - __export(editors_exports, { - CheckboxEditor: () => CheckboxEditor, - DateEditor: () => DateEditor, - Editors: () => Editors, - FloatEditor: () => FloatEditor, - IntegerEditor: () => IntegerEditor, - LongTextEditor: () => LongTextEditor, - PercentCompleteEditor: () => PercentCompleteEditor, - TextEditor: () => TextEditor, - YesNoSelectEditor: () => YesNoSelectEditor - }); - - // global-externals:_ - var { escape, H, keyCode, parsePx } = Slick; - - // src/editors/editors.ts - var BaseEditor = class { - constructor(args) { - this._args = args; - this.init(); - } - destroy() { - this._input.remove(); - } - focus() { - this._input.focus(); - } - getValue() { - return this._input.value; - } - setValue(val) { - this._input.value = val != null ? val : ""; - } - loadValue(item) { - var _a; - this._defaultValue = (_a = item[this._args.column.field]) != null ? _a : ""; - this._input.value = this._defaultValue; - if (this._input.select) { - this._input.defaultValue = this._defaultValue; - this._input.select(); - } - } - serializeValue() { - return this._input.value; - } - applyValue(item, state) { - item[this._args.column.field] = state; - } - isValueChanged() { - return !(this._input.value === "" && this._defaultValue == null) && this._input.value != this._defaultValue; - } - validate() { - if (this._args.column.validator) { - var validationResults = this._args.column.validator(this._input.value, this._args); - if (!validationResults.valid) { - return validationResults; - } - } - return { - valid: true, - msg: null - }; - } - }; - var TextEditor = class extends BaseEditor { - init() { - const input = this._input = this._args.container.appendChild(H("input", { type: "text", class: "editor-text slick-editor-text" })); - input.addEventListener("keydown", this._args.editorCellNavOnLRKeys ? handleKeydownLRNav : handleKeydownLRNoNav); - input.focus(); - input.select(); - addCompositeChangeListener(this, this._args, input); - } - }; - var IntegerEditor = class extends TextEditor { - serializeValue() { - return parseInt(this._input.value, 10) || 0; - } - validate() { - if (isNaN(parseInt(this._input.value, 10))) { - return { - valid: false, - msg: "Please enter a valid integer" - }; - } - return super.validate(); - } - }; - var _FloatEditor = class _FloatEditor extends TextEditor { - getDecimalPlaces() { - var rtn = this._args.column.editorFixedDecimalPlaces; - if (typeof rtn === "undefined") { - rtn = _FloatEditor.DefaultDecimalPlaces; - } - return !rtn && rtn !== 0 ? null : rtn; - } - loadValue(item) { - this._defaultValue = item[this._args.column.field]; - var decPlaces = this.getDecimalPlaces(); - if (decPlaces !== null && (this._defaultValue || this._defaultValue === 0) && this._defaultValue.toFixed) { - this._defaultValue = this._defaultValue.toFixed(decPlaces); - } - this._input.value = this._defaultValue; - this._input.defaultValue = this._defaultValue; - this._input.select(); - } - serializeValue() { - var rtn = parseFloat(this._input.value); - if (_FloatEditor.AllowEmptyValue) { - if (!rtn && rtn !== 0) - rtn = ""; - } else { - rtn = rtn || 0; - } - var decPlaces = this.getDecimalPlaces(); - if (decPlaces !== null && (rtn || rtn === 0) && rtn.toFixed) { - rtn = parseFloat(rtn.toFixed(decPlaces)); - } - return rtn; - } - validate() { - if (isNaN(parseFloat(this._input.value))) { - return { - valid: false, - msg: "Please enter a valid number" - }; - } - return super.validate(); - } - }; - _FloatEditor.AllowEmptyValue = false; - _FloatEditor.DefaultDecimalPlaces = null; - var FloatEditor = _FloatEditor; - var DateEditor = class extends TextEditor { - constructor() { - super(...arguments); - this._calendarOpen = false; - } - init() { - super.init(); - $(this._input).datepicker({ - showOn: "button", - buttonText: "", - buttonImage: null, - buttonImageOnly: false, - beforeShow: () => { - this._calendarOpen = true; - }, - onClose: () => { - this._calendarOpen = false; - if (this._args.compositeEditorOptions) - triggerCompositeEditorChange(this, this._args); - } - }); - this._input.style.width = parsePx(getComputedStyle(this._input).width) - (!this._args.compositeEditorOptions ? 18 : 28) + "px"; - } - destroy() { - $.datepicker.dpDiv.stop(true, true); - $(this._input).datepicker("hide").datepicker("destroy"); - super.destroy(); - } - show() { - if (this._calendarOpen) { - $.datepicker.dpDiv.stop(true, true).show(); - } - } - hide() { - if (this._calendarOpen) { - $.datepicker.dpDiv.stop(true, true).hide(); - } - } - position(position) { - if (!this._calendarOpen) { - return; - } - $.datepicker.dpDiv.css("top", position.top + 30).css("left", position.left); - } - }; - var YesNoSelectEditor = class extends BaseEditor { - init() { - this._args.container.appendChild(this._input = H( - "select", - { tabIndex: "0", class: "editor-yesno slick-editor-yesno" }, - H("option", { value: "yes" }, "Yes"), - H("option", { value: "no" }, "No") - )); - this._input.focus(); - addCompositeChangeListener(this, this._args, this._input); - } - loadValue(item) { - this._input.value = (this._defaultValue = item[this._args.column.field]) ? "yes" : "no"; - } - serializeValue() { - return this._input.value === "yes"; - } - isValueChanged() { - return this._input.value != this._defaultValue; - } - validate() { - return { - valid: true, - msg: null - }; - } - }; - var CheckboxEditor = class extends BaseEditor { - init() { - this._input = this._args.container.appendChild(H("input", { type: "checkbox", value: "true", class: "editor-checkbox slick-editor-checkbox", hideFocus: true })); - this._input.focus(); - addCompositeChangeListener(this, this._args, this._input); - } - loadValue(item) { - this._defaultValue = !!item[this._args.column.field]; - this._input.checked = !!this._defaultValue; - } - preClick() { - this._input.checked = !this._input.checked; - } - serializeValue() { - return this._input.checked; - } - applyValue(item, state) { - item[this._args.column.field] = state; - } - isValueChanged() { - return this.serializeValue() !== this._defaultValue; - } - validate() { - return { - valid: true, - msg: null - }; - } - }; - var PercentCompleteEditor = class extends IntegerEditor { - init() { - super.init(); - this._input.classList.remove("editor-text", "slick-editor-text"); - this._input.classList.add("editor-percentcomplete", "slick-editor-percentcomplete"); - var slider; - this._picker = this._args.container.appendChild( - H( - "div", - { class: "slick-editor-percentcomplete-picker" }, - H( - "div", - { class: "slick-editor-percentcomplete-helper" }, - H( - "div", - { class: "slick-editor-percentcomplete-wrapper" }, - H("div", { class: "slick-editor-percentcomplete-slider", ref: (el) => slider = el }), - H( - "div", - { class: "slick-editor-percentcomplete-buttons" }, - H("button", { "data-val": 0 }, "Not started"), - H("button", { "data-val": 50 }, "In Progress"), - H("button", { "data-val": 100 }, "Complete") - ) - ) - ) - ) - ); - this._input.focus(); - this._input.select(); - $(slider).slider({ - orientation: "vertical", - range: "min", - value: this._defaultValue, - slide: (_, ui) => { - this._input.value = ui.value; - }, - stop: () => { - if (this._args.compositeEditorOptions) - triggerCompositeEditorChange(this, this._args); - } - }); - $(this._picker).find(".slick-editor-percentcomplete-buttons button").on("click", (e) => { - this._input.value = e.target.dataset.val; - $(slider).slider("value", e.target.dataset.val); - }); - } - destroy() { - super.destroy(); - this._picker.remove(); - } - }; - var LongTextEditor = class extends BaseEditor { - init() { - const isComposite = this._args.compositeEditorOptions; - this._container = isComposite ? this._args.container : document.body; - this._wrapper = this._container.appendChild(H( - "div", - { - class: "large-editor-text slick-large-editor-text", - style: `z-index:10000; background:white; padding:5px; border:3px solid gray; border-radius:10px;${isComposite ? "position: relative; padding: 0; border: 0" : "position: absolute"}` - }, - H("textarea", { hidefocus: true, rows: "5", style: "background:white; width:250px; height:80px; border:0; outline:0", ref: (el) => this._input = el }) - )); - if (isComposite) - addCompositeChangeListener(this, this._args, this._input); - else { - this._wrapper.appendChild(H( - "div", - { style: "text-align: right" }, - H("button", { ref: (el) => el.addEventListener("click", this.save.bind(this)) }, "Save"), - H("button", { ref: (el) => el.addEventListener("click", this.cancel.bind(this)) }, "Cancel") - )); - this._input.addEventListener("keydown", this.handleKeyDown.bind(this)); - this.position(this._args.position); - } - this._input.focus(); - this._input.select(); - } - handleKeyDown(e) { - if (e.key === "Enter" && e.ctrlKey) { - this.save(); - } else if (e.key === "Esc" || e.key == "Escape") { - e.preventDefault(); - this.cancel(); - } else if (e.key === "Tab" && e.shiftKey) { - e.preventDefault(); - this._args.grid.navigatePrev(); - } else if (e.key === "Tab") { - e.preventDefault(); - this._args.grid.navigateNext(); - } else if (e.key === "Left" || e.key === "ArrowLeft" || e.key === "Right" || e.key === "ArrowRight") { - if (this._args.editorCellNavOnLRKeys) { - var cursorPosition = e.target.selectionStart; - var textLength = e.target.value.length; - if ((e.key === "Left" || e.key === "ArrowLeft") && cursorPosition === 0) { - this._args.grid.navigatePrev(); - } - if ((e.key === "Right" || e.key === "ArrowRight") && cursorPosition >= textLength - 1) { - this._args.grid.navigateNext(); - } - } - } - } - save() { - this._args.commitChanges(); - } - cancel() { - this._input.value = this._defaultValue; - this._args.cancelChanges(); - } - hide() { - this._wrapper.style.display = "none"; - } - show() { - this._wrapper.style.display = null; - } - position(position) { - this._wrapper.style.top = position.top - 5 + "px"; - this._wrapper.style.left = position.left - 5 + "px"; - } - destroy() { - this._wrapper.remove(); - } - }; - function addCompositeChangeListener(editor, args, input) { - if (!args.compositeEditorOptions) - return; - input.addEventListener("change", () => { - triggerCompositeEditorChange(editor, args); - }); - } - function triggerCompositeEditorChange(editor, args) { - var activeCell = args.grid.getActiveCell(); - if (editor.validate().valid) - editor.applyValue(args.item, editor.serializeValue()); - editor.applyValue(args.compositeEditorOptions.formValues, editor.serializeValue()); - args.grid.onCompositeEditorChange.notify({ - row: activeCell.row, - cell: activeCell.cell, - item: args.item, - column: args.column, - formValues: args.compositeEditorOptions.formValues - }); - } - function handleKeydownLRNav(e) { - var cursorPosition = this.selectionStart; - var textLength = this.value.length; - if ((e.key === "Left" || e.key === "ArrowLeft") && cursorPosition > 0 || (e.key === "Right" || e.key === "ArrowRight") && cursorPosition < textLength - 1) { - e.stopImmediatePropagation(); - } - } - function handleKeydownLRNoNav(e) { - if (e.key === "Left" || e.key === "ArrowLeft" || e.key === "Right" || e.key === "ArrowRight") { - e.stopImmediatePropagation(); - } - } - - // src/editors/index.ts - var Editors; - ((Editors2) => { - Editors2.Text = TextEditor; - Editors2.Integer = IntegerEditor; - Editors2.Float = FloatEditor; - Editors2.Date = DateEditor; - Editors2.YesNoSelect = YesNoSelectEditor; - Editors2.Checkbox = CheckboxEditor; - Editors2.PercentComplete = PercentCompleteEditor; - Editors2.LongText = LongTextEditor; - })(Editors || (Editors = {})); - return __toCommonJS(editors_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.formatters.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.formatters.js deleted file mode 100644 index b8e89ad075..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.formatters.js +++ /dev/null @@ -1,91 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/formatters/index.ts - var formatters_exports = {}; - __export(formatters_exports, { - CheckboxFormatter: () => CheckboxFormatter, - CheckmarkFormatter: () => CheckmarkFormatter, - Formatters: () => Formatters, - PercentCompleteBarFormatter: () => PercentCompleteBarFormatter, - PercentCompleteFormatter: () => PercentCompleteFormatter, - YesNoFormatter: () => YesNoFormatter - }); - - // global-externals:_ - var { escape } = Slick; - - // src/formatters/formatters.ts - function PercentCompleteFormatter(ctx) { - if (ctx.value == null || ctx.value === "") - return "-"; - if (ctx.value < 50) - return "" + ctx.escape() + "%"; - return "" + escape(ctx.value) + "%"; - } - function PercentCompleteBarFormatter(ctx) { - if (ctx.value == null || ctx.value === "") - return ""; - var color; - if (ctx.value < 30) - color = "red"; - else if (ctx.value < 70) - color = "silver"; - else - color = "green"; - return ""; - } - function YesNoFormatter(ctx) { - return ctx.value ? "Yes" : "No"; - } - function CheckboxFormatter(ctx) { - return ``; - } - function CheckmarkFormatter(ctx) { - return ctx.value ? '' : ""; - } - - // src/formatters/index.ts - var Formatters; - ((Formatters2) => { - function PercentComplete(_row, _cell, value) { - return PercentCompleteFormatter({ escape, value }); - } - Formatters2.PercentComplete = PercentComplete; - function PercentCompleteBar(_row, _cell, value) { - return PercentCompleteBarFormatter({ escape, value }); - } - Formatters2.PercentCompleteBar = PercentCompleteBar; - function YesNo(_row, _cell, value) { - return YesNoFormatter({ escape, value }); - } - Formatters2.YesNo = YesNo; - function Checkbox(_row, _cell, value) { - return CheckboxFormatter({ escape, value }); - } - Formatters2.Checkbox = Checkbox; - function Checkmark(_row, _cell, value) { - return CheckmarkFormatter({ escape, value }); - } - Formatters2.Checkmark = Checkmark; - })(Formatters || (Formatters = {})); - return __toCommonJS(formatters_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.grid.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.grid.js deleted file mode 100644 index f670557a6a..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.grid.js +++ /dev/null @@ -1,4011 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/grid/index.ts - var grid_exports = {}; - __export(grid_exports, { - BasicLayout: () => BasicLayout, - Grid: () => Grid, - gridDefaults: () => gridDefaults - }); - - // global-externals:_ - var { addClass, applyFormatterResultToCellNode, columnDefaults, convertCompatFormatter, ensureUniqueColumnIds, escape, defaultColumnFormat, disableSelection, EventEmitter, EventData, GlobalEditorLock, initializeColumns, H, keyCode, NonDataRow, parsePx, preClickClassName, Range, removeClass, RowCell, spacerDiv, titleize } = Slick; - - // src/grid/gridoptions.ts - var gridDefaults = { - addNewRowCssClass: "new-row", - alwaysAllowHorizontalScroll: false, - alwaysShowVerticalScroll: false, - asyncEditorLoadDelay: 100, - asyncEditorLoading: false, - asyncPostCleanupDelay: 40, - asyncPostRenderDelay: -1, - autoEdit: true, - autoHeight: false, - cellFlashingCssClass: "flashing", - dataItemColumnValueExtractor: null, - defaultColumnWidth: 80, - defaultFormat: defaultColumnFormat, - editable: false, - editorFactory: null, - editorLock: GlobalEditorLock, - enableAddRow: false, - enableAsyncPostRender: false, - enableAsyncPostRenderCleanup: false, - enableCellNavigation: true, - enableColumnReorder: true, - enableTabKeyNavigation: true, - enableTextSelectionOnCells: false, - explicitInitialization: false, - footerRowHeight: 30, - forceFitColumns: false, - forceSyncScrolling: false, - forceSyncScrollInterval: 250, - formatterFactory: null, - fullWidthRows: false, - groupingPanel: false, - groupingPanelHeight: 30, - headerRowHeight: 30, - leaveSpaceForNewRows: false, - minBuffer: 3, - multiColumnSort: false, - multiSelect: true, - renderAllCells: false, - rowHeight: 30, - selectedCellCssClass: "selected", - showCellSelection: true, - showColumnHeader: true, - showFooterRow: false, - showGroupingPanel: true, - showHeaderRow: false, - showTopPanel: false, - suppressActiveCellChangeOnEdit: false, - topPanelHeight: 30, - useLegacyUI: true, - useCssVars: false - }; - - // src/grid/basiclayout.ts - var BasicLayout = function() { - var host; - var canvasWidth; - var headersWidth; - var canvas; - var headerCols; - var headerRowCols; - var headerRowSpacer; - var footerRowCols; - var footerRowSpacer; - var topPanel; - var viewport; - function init(hostGrid) { - host = hostGrid; - const spacerW = calcCanvasWidth() + host.getScrollDims().width + "px"; - const options = host.getOptions(); - const uisd = options.useLegacyUI ? " ui-state-default" : ""; - headerCols = H("div", { class: "slick-header-columns", style: (options.rtl ? "right" : "left") + ":-1000px" }); - var headerColsS = H("div", { class: "slick-header" + uisd, style: !options.showColumnHeader && "display: none" }, headerCols); - updateHeadersWidth(); - headerRowCols = H("div", { class: "slick-headerrow-columns" }); - headerRowSpacer = spacerDiv(spacerW); - var headerRow = H("div", { class: "slick-headerrow" + uisd, style: !options.showHeaderRow && "display: none" }, headerRowCols, headerRowSpacer); - topPanel = H("div", { class: "slick-top-panel", style: "width: 10000px" }); - var topPanelS = H("div", { class: "slick-top-panel-scroller" + uisd, style: !options.showTopPanel && "display: none" }, topPanel); - canvas = H("div", { class: "grid-canvas", tabIndex: "0", hideFocus: "" }); - viewport = H("div", { class: "slick-viewport", tabIndex: "0", hideFocus: "" }, canvas); - footerRowCols = H("div", { class: "slick-footerrow-columns" }); - footerRowSpacer = spacerDiv(spacerW); - var footerRow = H("div", { class: "slick-footerrow" + uisd, style: !options.showFooterRow && "display: none" }, footerRowCols, footerRowSpacer); - host.getContainerNode().append(headerColsS, headerRow, topPanelS, viewport, footerRow); - } - function appendCachedRow(_, rowNode) { - rowNode && canvas.appendChild(rowNode); - } - function applyColumnWidths() { - var x = 0, w, rule, cols = host.getColumns(), opts = host.getOptions(), rtl = opts.rtl; - if (opts.useCssVars) { - var styles = host.getContainerNode().style; - for (var i = 0; i < cols.length; i++) { - w = cols[i].width; - var prop = "--l" + i; - var oldVal = styles.getPropertyValue(prop); - var newVal = x + "px"; - if (oldVal !== newVal) - styles.setProperty(prop, newVal); - prop = "--r" + i; - oldVal = styles.getPropertyValue(prop); - newVal = canvasWidth - x - w + "px"; - if (oldVal !== newVal) - styles.setProperty(prop, newVal); - x += w; - } - } else { - for (var i = 0; i < cols.length; i++) { - w = cols[i].width; - rule = host.getColumnCssRules(i); - rule[rtl ? "right" : "left"].style[rtl ? "right" : "left"] = x + "px"; - rule[rtl ? "left" : "right"].style[rtl ? "left" : "right"] = canvasWidth - x - w + "px"; - x += w; - } - } - } - function bindAncestorScrollEvents() { - var elem = canvas; - while ((elem = elem.parentNode) != document.body && elem != null) { - if (elem == viewport || elem.scrollWidth != elem.clientWidth || elem.scrollHeight != elem.clientHeight) { - host.bindAncestorScroll(elem); - } - } - } - function calcCanvasWidth() { - var cols = host.getColumns(), i = cols.length; - var rowWidth = 0; - while (i--) { - rowWidth += cols[i].width; - } - return host.getOptions().fullWidthRows ? Math.max( - rowWidth, - host.getAvailableWidth() - ) : rowWidth; - } - function updateHeadersWidth() { - headersWidth = 0; - var scrollWidth = host.getScrollDims().width; - var cols = host.getColumns(); - for (var i = 0, ii = cols.length; i < ii; i++) { - headersWidth += cols[i].width; - } - headersWidth += scrollWidth; - headersWidth = Math.max(headersWidth, host.getViewportInfo().width) + 1e3; - headerCols.style.width = headersWidth + "px"; - } - const destroy = () => { - host = null; - }; - function getCanvasNodeFor() { - return canvas; - } - function getCanvasNodes() { - return [canvas]; - } - function getCanvasWidth() { - return canvasWidth; - } - function getHeaderCols() { - return [headerCols]; - } - function getHeaderColumn(cell) { - return headerCols.children.item(cell); - } - function getHeaderRowCols() { - return [headerRowCols]; - } - function getHeaderRowColumn(cell) { - return headerRowCols.childNodes.item(cell); - } - function getHeaderRowColsFor() { - return headerRowCols; - } - function getFooterRowColumn(cell) { - return footerRowCols.childNodes.item(cell); - } - function getFooterRowColsFor() { - return footerRowCols; - } - function getHeaderColsFor() { - return headerCols; - } - function getFooterRowCols() { - return [footerRowCols]; - } - function getRowFromCellNode(cellNode) { - return host.getRowFromNode(cellNode.parentElement); - } - function getTopPanelFor() { - return topPanel; - } - function getTopPanelNodes() { - return [topPanel]; - } - function getViewportNodeFor() { - return viewport; - } - function getViewportNodes() { - return [viewport]; - } - function handleScrollH() { - headerCols.parentElement.scrollLeft = host.getScrollLeft(); - topPanel.parentElement.scrollLeft = host.getScrollLeft(); - headerRowCols.parentElement.scrollLeft = host.getScrollLeft(); - footerRowCols.parentElement.scrollLeft = host.getScrollLeft(); - } - function noop() { - } - function realScrollHeightChange() { - canvas.style.height = host.getViewportInfo().realScrollHeight + "px"; - } - function reorderViewColumns(viewCols) { - return viewCols; - } - function returnFalse() { - return false; - } - function setOverflow() { - var alwaysVS = host.getOptions().alwaysShowVerticalScroll; - viewport.style.overflowX = "auto"; - viewport.style.overflowY = alwaysVS ? "scroll" : host.getOptions().autoHeight ? "hidden" : "auto"; - } - function updateCanvasWidth() { - var oldCanvasWidth = canvasWidth; - canvasWidth = calcCanvasWidth(); - var scrollWidth = host.getScrollDims().width; - const vpi = host.getViewportInfo(); - var canvasWidthPx = canvasWidth + "px"; - canvas.style.width = canvasWidthPx; - headerRowCols.style.width = canvasWidthPx; - footerRowCols.style.width = canvasWidthPx; - updateHeadersWidth(); - vpi.hasHScroll = canvasWidth > host.getViewportInfo().width - scrollWidth; - var spacerWidthPx = canvasWidth + (vpi.hasVScroll ? scrollWidth : 0) + "px"; - headerRowSpacer.style.width = spacerWidthPx; - footerRowSpacer.style.width = spacerWidthPx; - return canvasWidth != oldCanvasWidth; - } - const resizeCanvas = () => { - var vs = host.getViewportInfo(); - var _paneTopH = vs.height + vs.topPanelHeight + vs.headerRowHeight + vs.footerRowHeight; - const options = host.getOptions(); - if (options.autoHeight) { - host.getContainerNode().style.height = _paneTopH + vs.groupingPanelHeight + parsePx(getComputedStyle(headerCols.parentElement).height) + "px"; - viewport.style.height = ""; - } else - viewport.style.height = vs.height + "px"; - }; - function returnZero() { - return 0; - } - var intf = { - afterHeaderColumnDrag: noop, - afterRenderRows: noop, - afterSetOptions: noop, - appendCachedRow, - applyColumnWidths, - beforeCleanupAndRenderCells: noop, - bindAncestorScrollEvents, - calcCanvasWidth, - updateHeadersWidth, - isFrozenRow: returnFalse, - destroy, - getCanvasNodeFor, - getCanvasNodes, - getCanvasWidth, - getFooterRowCols, - getFooterRowColsFor, - getFooterRowColumn, - getHeaderCols, - getHeaderColsFor, - getHeaderColumn, - getHeaderRowCols, - getHeaderRowColsFor, - getHeaderRowColumn, - getRowFromCellNode, - getFrozenCols: returnZero, - getFrozenRowOffset: returnZero, - getFrozenRows: returnZero, - getScrollCanvasY: getCanvasNodeFor, - getScrollContainerX: getViewportNodeFor, - getScrollContainerY: getViewportNodeFor, - getTopPanelFor, - getTopPanelNodes, - getViewportNodeFor, - getViewportNodes, - handleScrollH, - handleScrollV: noop, - init, - layoutName: "basic", - realScrollHeightChange, - reorderViewColumns, - resizeCanvas, - setOverflow, - setPaneVisibility: noop, - setScroller: noop, - updateCanvasWidth - }; - return intf; - }; - - // src/grid/cellnavigator.ts - var CellNavigator = class { - constructor(h) { - this.host = h; - } - findFirstFocusableCell(row) { - var cell = 0; - var cols = this.host.getColumnCount(); - while (cell < cols) { - if (this.host.canCellBeActive(row, cell)) { - return cell; - } - cell += this.host.getColspan(row, cell); - } - return null; - } - findLastFocusableCell(row) { - var cell = 0; - var lastFocusableCell = null; - var cols = this.host.getColumnCount(); - while (cell < cols) { - if (this.host.canCellBeActive(row, cell)) { - lastFocusableCell = cell; - } - cell += this.host.getColspan(row, cell); - } - return lastFocusableCell; - } - gotoRight(row, cell) { - var cols = this.host.getColumnCount(); - if (cell >= cols) { - return null; - } - do { - cell += this.host.getColspan(row, cell); - } while (cell < cols && !this.host.canCellBeActive(row, cell)); - if (cell < cols) { - return { - row, - cell, - posX: cell - }; - } - return null; - } - gotoLeft(row, cell) { - if (cell <= 0) { - return null; - } - var firstFocusableCell = this.findFirstFocusableCell(row); - if (firstFocusableCell === null || firstFocusableCell >= cell) { - return null; - } - var prev = { - row, - cell: firstFocusableCell, - posX: firstFocusableCell - }; - var pos; - while (true) { - pos = this.gotoRight(prev.row, prev.cell); - if (!pos) { - return null; - } - if (pos.cell >= cell) { - return prev; - } - prev = pos; - } - } - gotoDown(row, cell, posX) { - var prevCell; - var rowCount = this.host.getRowCount(); - while (true) { - if (++row >= rowCount) { - return null; - } - prevCell = cell = 0; - while (cell <= posX) { - prevCell = cell; - cell += this.host.getColspan(row, cell); - } - if (this.host.canCellBeActive(row, prevCell)) { - return { - row, - cell: prevCell, - posX - }; - } - } - } - gotoUp(row, cell, posX) { - var prevCell; - while (true) { - if (--row < 0) { - return null; - } - prevCell = cell = 0; - while (cell <= posX) { - prevCell = cell; - cell += this.host.getColspan(row, cell); - } - if (this.host.canCellBeActive(row, prevCell)) { - return { - row, - cell: prevCell, - posX - }; - } - } - } - gotoNext(row, cell, posX) { - if (row == null && cell == null) { - row = cell = posX = 0; - if (this.host.canCellBeActive(row, cell)) { - return { - row, - cell, - posX: cell - }; - } - } - var pos = this.gotoRight(row, cell); - if (pos) { - return pos; - } - var firstFocusableCell = null; - var dataLengthIncludingAddNew = this.host.getRowCount(); - while (++row < dataLengthIncludingAddNew) { - firstFocusableCell = this.findFirstFocusableCell(row); - if (firstFocusableCell != null) { - return { - row, - cell: firstFocusableCell, - posX: firstFocusableCell - }; - } - } - return null; - } - gotoPrev(row, cell, posX) { - var cols = this.host.getColumnCount(); - if (row == null && cell == null) { - row = this.host.getRowCount() - 1; - cell = posX = cols - 1; - if (this.host.canCellBeActive(row, cell)) { - return { - row, - cell, - posX: cell - }; - } - } - var pos; - var lastSelectableCell; - while (!pos) { - pos = this.gotoLeft(row, cell); - if (pos) { - break; - } - if (--row < 0) { - return null; - } - cell = 0; - lastSelectableCell = this.findLastFocusableCell(row); - if (lastSelectableCell != null) { - pos = { - row, - cell: lastSelectableCell, - posX: lastSelectableCell - }; - } - } - return pos; - } - gotoRowStart(row) { - var newCell = this.findFirstFocusableCell(row); - if (newCell === null) - return null; - return { - row, - cell: newCell, - posX: newCell - }; - } - gotoRowEnd(row) { - var newCell = this.findLastFocusableCell(row); - if (newCell === null) - return null; - return { - row, - cell: newCell, - posX: newCell - }; - } - /** - * @param {string} dir Navigation direction. - * @return {boolean} Whether navigation resulted in a change of active cell. - */ - navigate(dir, activeRow, activeCell, activePosX) { - var tabbingDirections = { - up: -1, - down: 1, - prev: -1, - next: 1, - home: -1, - end: 1 - }; - const rtl = this.host.isRTL(); - tabbingDirections[rtl ? "right" : "left"] = -1; - tabbingDirections[rtl ? "left" : "right"] = 1; - this.host.setTabbingDirection(tabbingDirections[dir]); - var stepFunctions = { - up: this.gotoUp, - down: this.gotoDown, - prev: this.gotoPrev, - next: this.gotoNext, - home: this.gotoRowStart, - end: this.gotoRowEnd - }; - stepFunctions[rtl ? "right" : "left"] = this.gotoLeft; - stepFunctions[rtl ? "left" : "right"] = this.gotoRight; - var stepFn = stepFunctions[dir].bind(this); - return stepFn(activeRow, activeCell, activePosX); - } - }; - - // src/grid/internal.ts - var maxSupportedCssHeight; - var scrollbarDimensions; - function absBox(elem) { - var box = { - top: elem.offsetTop, - left: elem.offsetLeft, - bottom: 0, - right: 0, - width: elem.offsetWidth, - height: elem.offsetHeight, - visible: true - }; - box.bottom = box.top + box.height; - box.right = box.left + box.width; - var offsetParent = elem.offsetParent; - while ((elem = elem.parentNode) != document.body && elem != null) { - if (box.visible && elem.scrollHeight != elem.offsetHeight && getComputedStyle(elem).overflowY !== "visible") { - box.visible = box.bottom > elem.scrollTop && box.top < elem.scrollTop + elem.clientHeight; - } - if (box.visible && elem.scrollWidth != elem.offsetWidth && getComputedStyle(elem).overflowX != "visible") { - box.visible = box.right > elem.scrollLeft && box.left < elem.scrollLeft + elem.clientWidth; - } - box.left -= elem.scrollLeft; - box.top -= elem.scrollTop; - if (elem === offsetParent) { - box.left += elem.offsetLeft; - box.top += elem.offsetTop; - offsetParent = elem.offsetParent; - } - box.bottom = box.top + box.height; - box.right = box.left + box.width; - } - return box; - } - function autosizeColumns(cols, availWidth, absoluteColMinWidth) { - var i, c, widths = [], shrinkLeeway = 0, total = 0, prevTotal; - for (i = 0; i < cols.length; i++) { - c = cols[i]; - widths.push(c.width); - total += c.width; - if (c.resizable) { - shrinkLeeway += c.width - Math.max(c.minWidth, absoluteColMinWidth); - } - } - prevTotal = total; - while (total > availWidth && shrinkLeeway) { - var shrinkProportion = (total - availWidth) / shrinkLeeway; - for (i = 0; i < cols.length && total > availWidth; i++) { - c = cols[i]; - var width = widths[i]; - if (!c.resizable || width <= c.minWidth || width <= absoluteColMinWidth) { - continue; - } - var absMinWidth = Math.max(c.minWidth, absoluteColMinWidth); - var shrinkSize = Math.floor(shrinkProportion * (width - absMinWidth)) || 1; - shrinkSize = Math.min(shrinkSize, width - absMinWidth); - total -= shrinkSize; - shrinkLeeway -= shrinkSize; - widths[i] -= shrinkSize; - } - if (prevTotal <= total) { - break; - } - prevTotal = total; - } - prevTotal = total; - while (total < availWidth) { - var growProportion = availWidth / total; - for (i = 0; i < cols.length && total < availWidth; i++) { - c = cols[i]; - var currentWidth = widths[i]; - var growSize; - if (!c.resizable || c.maxWidth <= currentWidth) { - growSize = 0; - } else { - growSize = Math.min(Math.floor(growProportion * currentWidth) - currentWidth, c.maxWidth - currentWidth || 1e6) || 1; - } - total += growSize; - widths[i] += total <= availWidth ? growSize : 0; - } - if (prevTotal >= total) { - break; - } - prevTotal = total; - } - var reRender = false; - for (i = 0; i < cols.length; i++) { - if (cols[i].rerenderOnResize && cols[i].width != widths[i]) { - reRender = true; - } - cols[i].width = widths[i]; - } - return reRender; - } - function getMaxSupportedCssHeight() { - return maxSupportedCssHeight != null ? maxSupportedCssHeight : navigator.userAgent.toLowerCase().match(/gecko\//) ? 4e6 : 32e6; - } - function getScrollBarDimensions(recalc) { - if (!scrollbarDimensions || recalc) { - var c = document.body.appendChild(H("div", { - style: "position:absolute;top:-10000px;left:-10000px;width:100px;height:100px;overflow: scroll;border:0" - })); - scrollbarDimensions = { - width: Math.round(c.offsetWidth - c.clientWidth), - height: Math.round(c.offsetWidth - c.clientHeight) - }; - c.remove(); - } - return scrollbarDimensions; - } - function simpleArrayEquals(arr1, arr2) { - if (!Array.isArray(arr1) || !Array.isArray(arr2) || arr1.length !== arr2.length) - return false; - arr1 = arr1.slice().sort(); - arr2 = arr2.slice().sort(); - for (var i = 0; i < arr1.length; i++) { - if (arr1[i] !== arr2[i]) - return false; - } - return true; - } - function sortToDesiredOrderAndKeepRest(columns, idOrder) { - if (idOrder.length == 0) - return columns; - var orderById = {}, colIdxById = {}, result = []; - for (var i = 0; i < idOrder.length; i++) - orderById[idOrder[i]] = i; - for (i = 0; i < columns.length; i++) - colIdxById[columns[i].id] = i; - function takeFrom(i2) { - for (var j = i2; j < columns.length; j++) { - var c2 = columns[j]; - if (i2 != j && orderById[c2.id] != null) - break; - result.push(c2); - colIdxById[c2.id] = null; - } - } - if (orderById[columns[0].id] == null) - takeFrom(0); - for (var id of idOrder) { - i = colIdxById[id]; - if (i != null) - takeFrom(i); - } - for (i = 0; i < columns.length; i++) { - var c = columns[i]; - if (colIdxById[c.id] != null) { - result.push(c); - colIdxById[c.id] = null; - } - } - return result; - } - function calcMinMaxPageXOnDragStart(cols, colIdx, pageX, forceFit, absoluteColMinWidth) { - var shrinkLeewayOnRight = null, stretchLeewayOnRight = null, j, c; - if (forceFit) { - shrinkLeewayOnRight = 0; - stretchLeewayOnRight = 0; - for (j = colIdx + 1; j < cols.length; j++) { - c = cols[j]; - if (c.resizable) { - if (stretchLeewayOnRight != null) { - if (c.maxWidth) { - stretchLeewayOnRight += c.maxWidth - c.previousWidth; - } else { - stretchLeewayOnRight = null; - } - } - shrinkLeewayOnRight += c.previousWidth - Math.max(c.minWidth || 0, absoluteColMinWidth); - } - } - } - var shrinkLeewayOnLeft = 0, stretchLeewayOnLeft = 0; - for (j = 0; j <= colIdx; j++) { - c = cols[j]; - if (c.resizable) { - if (stretchLeewayOnLeft != null) { - if (c.maxWidth) { - stretchLeewayOnLeft += c.maxWidth - c.previousWidth; - } else { - stretchLeewayOnLeft = null; - } - } - shrinkLeewayOnLeft += c.previousWidth - Math.max(c.minWidth || 0, absoluteColMinWidth); - } - } - if (shrinkLeewayOnRight === null) { - shrinkLeewayOnRight = 1e5; - } - if (shrinkLeewayOnLeft === null) { - shrinkLeewayOnLeft = 1e5; - } - if (stretchLeewayOnRight === null) { - stretchLeewayOnRight = 1e5; - } - if (stretchLeewayOnLeft === null) { - stretchLeewayOnLeft = 1e5; - } - return { - maxPageX: pageX + Math.min(shrinkLeewayOnRight, stretchLeewayOnLeft), - minPageX: pageX - Math.min(shrinkLeewayOnLeft, stretchLeewayOnRight) - }; - } - function shrinkOrStretchColumn(cols, colIdx, d, forceFit, absoluteColMinWidth) { - var c, j, x, actualMinWidth; - if (d < 0) { - x = d; - for (j = colIdx; j >= 0; j--) { - c = cols[j]; - if (c.resizable) { - actualMinWidth = Math.max(c.minWidth || 0, absoluteColMinWidth); - if (x && c.previousWidth + x < actualMinWidth) { - x += c.previousWidth - actualMinWidth; - c.width = actualMinWidth; - } else { - c.width = c.previousWidth + x; - x = 0; - } - } - } - if (forceFit) { - x = -d; - for (j = colIdx + 1; j < cols.length; j++) { - c = cols[j]; - if (c.resizable) { - if (x && c.maxWidth && c.maxWidth - c.previousWidth < x) { - x -= c.maxWidth - c.previousWidth; - c.width = c.maxWidth; - } else { - c.width = c.previousWidth + x; - x = 0; - } - } - } - } - } else { - x = d; - for (j = colIdx; j >= 0; j--) { - c = cols[j]; - if (c.resizable) { - if (x && c.maxWidth && c.maxWidth - c.previousWidth < x) { - x -= c.maxWidth - c.previousWidth; - c.width = c.maxWidth; - } else { - c.width = c.previousWidth + x; - x = 0; - } - } - } - if (forceFit) { - x = -d; - for (j = colIdx + 1; j < cols.length; j++) { - c = cols[j]; - if (c.resizable) { - actualMinWidth = Math.max(c.minWidth || 0, absoluteColMinWidth); - if (x && c.previousWidth + x < actualMinWidth) { - x += c.previousWidth - actualMinWidth; - c.width = actualMinWidth; - } else { - c.width = c.previousWidth + x; - x = 0; - } - } - } - } - } - } - function addUiStateHover() { - this == null ? void 0 : this.classList.add("ui-state-hover"); - } - function removeUiStateHover() { - this == null ? void 0 : this.classList.remove("ui-state-hover"); - } - function getVBoxDelta(el) { - if (!el) - return 0; - var style = getComputedStyle(el); - if (style.boxSizing === "border-box") - return 0; - var p = ["border-top-width", "border-bottom-width", "padding-top", "padding-bottom"]; - var delta = 0; - for (var val of p) - delta += parsePx(style.getPropertyValue(val)) || 0; - return delta; - } - function getInnerWidth(el) { - var _a; - var style = getComputedStyle(el); - var width = (_a = parsePx(style.width)) != null ? _a : 0; - if (style.boxSizing != "border-box") - return Math.max(0, width); - var p = ["border-left-width", "border-right-width", "padding-left", "padding-right"]; - for (var val of p) - width -= parsePx(style.getPropertyValue(val)) || 0; - return Math.max(width, 0); - } - - // src/grid/grid.ts - var Grid = class _Grid { - constructor(container, data, columns, options) { - this._activeCellNode = null; - this._cellCssClasses = {}; - this._cellHeightDiff = 0; - this._cellWidthDiff = 0; - this._colLeft = []; - this._colRight = []; - this._currentEditor = null; - this._headerColumnWidthDiff = 0; - this._hEditorLoader = null; - this._hPostRender = null; - this._hPostRenderCleanup = null; - this._hRender = null; - this._ignoreScrollUntil = 0; - this._initialized = false; - this._page = 0; - this._pageOffset = 0; - this._pagingActive = false; - this._pagingIsLastPage = false; - this._plugins = []; - this._postProcessCleanupQueue = []; - this._postProcessedRows = {}; - this._postProcessFromRow = null; - this._postProcessGroupId = 0; - this._postProcessToRow = null; - this._rowsCache = {}; - this._scrollLeft = 0; - this._scrollLeftPrev = 0; - this._scrollLeftRendered = 0; - this._scrollTop = 0; - this._scrollTopPrev = 0; - this._scrollTopRendered = 0; - this._selectedRows = []; - this._sortColumns = []; - this._tabbingDirection = 1; - this._uid = "sleekgrid_" + Math.round(1e6 * Math.random()); - this._viewportInfo = {}; - this._vScrollDir = 1; - this._boundAncestorScroll = []; - this.onActiveCellChanged = new EventEmitter(); - this.onActiveCellPositionChanged = new EventEmitter(); - this.onAddNewRow = new EventEmitter(); - this.onBeforeCellEditorDestroy = new EventEmitter(); - this.onBeforeDestroy = new EventEmitter(); - this.onBeforeEditCell = new EventEmitter(); - this.onBeforeFooterRowCellDestroy = new EventEmitter(); - this.onBeforeHeaderCellDestroy = new EventEmitter(); - this.onBeforeHeaderRowCellDestroy = new EventEmitter(); - this.onCellChange = new EventEmitter(); - this.onCellCssStylesChanged = new EventEmitter(); - this.onClick = new EventEmitter(); - this.onColumnsReordered = new EventEmitter(); - this.onColumnsResized = new EventEmitter(); - this.onCompositeEditorChange = new EventEmitter(); - this.onContextMenu = new EventEmitter(); - this.onDblClick = new EventEmitter(); - this.onDrag = new EventEmitter(); - this.onDragEnd = new EventEmitter(); - this.onDragInit = new EventEmitter(); - this.onDragStart = new EventEmitter(); - this.onFooterRowCellRendered = new EventEmitter(); - this.onHeaderCellRendered = new EventEmitter(); - this.onHeaderClick = new EventEmitter(); - this.onHeaderContextMenu = new EventEmitter(); - this.onHeaderMouseEnter = new EventEmitter(); - this.onHeaderMouseLeave = new EventEmitter(); - this.onHeaderRowCellRendered = new EventEmitter(); - this.onKeyDown = new EventEmitter(); - this.onMouseEnter = new EventEmitter(); - this.onMouseLeave = new EventEmitter(); - this.onScroll = new EventEmitter(); - this.onSelectedRowsChanged = new EventEmitter(); - this.onSort = new EventEmitter(); - this.onValidationError = new EventEmitter(); - this.onViewportChanged = new EventEmitter(); - this.handleSelectedRangesChanged = (e, ranges) => { - var previousSelectedRows = this._selectedRows.slice(0); - this._selectedRows = []; - var hash = {}, cols = this._cols; - for (var i = 0; i < ranges.length; i++) { - for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) { - if (!hash[j]) { - this._selectedRows.push(j); - hash[j] = {}; - } - for (var k = ranges[i].fromCell; k <= ranges[i].toCell; k++) { - if (this.canCellBeSelected(j, k)) { - hash[j][cols[k].id] = this._options.selectedCellCssClass; - } - } - } - } - this.setCellCssStyles(this._options.selectedCellCssClass, hash); - if (!simpleArrayEquals(previousSelectedRows, this._selectedRows)) { - var caller = e && e.detail && e.detail.caller || "click"; - var newSelectedAdditions = this._selectedRows.filter((i2) => previousSelectedRows.indexOf(i2) < 0); - var newSelectedDeletions = previousSelectedRows.filter((i2) => this._selectedRows.indexOf(i2) < 0); - this.trigger(this.onSelectedRowsChanged, { - rows: this.getSelectedRows(), - previousSelectedRows, - caller, - changedSelectedRows: newSelectedAdditions, - changedUnselectedRows: newSelectedDeletions - }, e); - } - this._selectedRows = []; - hash = {}, cols = this._cols; - for (var i = 0; i < ranges.length; i++) { - for (var j = ranges[i].fromRow; j <= ranges[i].toRow; j++) { - if (!hash[j]) { - this._selectedRows.push(j); - hash[j] = {}; - } - for (var k = ranges[i].fromCell; k <= ranges[i].toCell; k++) { - if (this.canCellBeSelected(j, k)) { - hash[j][cols[k].id] = this._options.selectedCellCssClass; - } - } - } - } - }; - this.viewOnRowCountChanged = () => { - this.updateRowCount(); - this.render(); - }; - this.viewOnRowsChanged = (_, args) => { - this.invalidateRows(args.rows); - this.render(); - this.updateGrandTotals(); - }; - this.viewOnDataChanged = () => { - this.invalidate(); - this.render(); - }; - this.resizeCanvas = () => { - if (!this._initialized) { - return; - } - this.calcViewportSize(); - this._layout.resizeCanvas(); - if (!this._scrollDims || !this._scrollDims.width) { - this._scrollDims = getScrollBarDimensions(true); - } - if (this._options.forceFitColumns) { - this.autosizeColumns(); - } - this.updateRowCount(); - this.handleScroll(); - this._scrollLeftRendered = -1; - this.render(); - }; - this.render = () => { - if (!this._initialized) { - return; - } - var visible = this.getVisibleRange(); - var rendered = this.getRenderedRange(); - this.cleanupRows(rendered); - if (this._scrollLeftRendered != this._scrollLeft) { - this._layout.beforeCleanupAndRenderCells(rendered); - this.cleanUpAndRenderCells(rendered); - } - this.renderRows(rendered); - this._layout.afterRenderRows(rendered); - this._postProcessFromRow = visible.top; - this._postProcessToRow = Math.min(this.getDataLengthIncludingAddNew() - 1, visible.bottom); - this.startPostProcessing(); - this._scrollTopRendered = this._scrollTop; - this._scrollLeftRendered = this._scrollLeft; - this._lastRenderTime = (/* @__PURE__ */ new Date()).getTime(); - this._hRender = null; - }; - this.handleHeaderRowScroll = (e) => { - if (this._ignoreScrollUntil >= (/* @__PURE__ */ new Date()).getTime()) - return; - var scrollLeft = e.target.scrollLeft; - if (scrollLeft != this._layout.getScrollContainerX().scrollLeft) { - this._layout.getScrollContainerX().scrollLeft = scrollLeft; - } - }; - this.handleFooterRowScroll = (e) => { - if (this._ignoreScrollUntil >= (/* @__PURE__ */ new Date()).getTime()) - return; - var scrollLeft = e.target.scrollLeft; - if (scrollLeft != this._layout.getScrollContainerX().scrollLeft) { - this._layout.getScrollContainerX().scrollLeft = scrollLeft; - } - }; - this.asyncPostProcessRows = () => { - var dataLength = this.getDataLength(); - var cols = this._cols; - while (this._postProcessFromRow <= this._postProcessToRow) { - var row = this._vScrollDir >= 0 ? this._postProcessFromRow++ : this._postProcessToRow--; - var cacheEntry = this._rowsCache[row]; - if (!cacheEntry || row >= dataLength) { - continue; - } - if (!this._postProcessedRows[row]) { - this._postProcessedRows[row] = {}; - } - this.ensureCellNodesInRowsCache(row); - for (var x in cacheEntry.cellNodesByColumnIdx) { - var columnIdx = parseInt(x, 10); - var m = cols[columnIdx]; - var processedStatus = this._postProcessedRows[row][columnIdx]; - if (processedStatus !== "R") { - if (m.asyncPostRender || m.asyncPostRenderCleanup) { - var node = cacheEntry.cellNodesByColumnIdx[columnIdx]; - if (node) { - m.asyncPostRender && m.asyncPostRender(node, row, this.getDataItem(row), m, processedStatus === "C"); - } - } - this._postProcessedRows[row][columnIdx] = "R"; - } - } - if (this._options.asyncPostRenderDelay >= 0) { - this._hPostRender = setTimeout(this.asyncPostProcessRows, this._options.asyncPostRenderDelay); - return; - } - } - }; - this.handleActiveCellPositionChange = () => { - if (!this._activeCellNode) { - return; - } - this.trigger(this.onActiveCellPositionChanged, {}); - if (this._currentEditor) { - var cellBox = this.getActiveCellPosition(); - if (this._currentEditor.show && this._currentEditor.hide) { - if (!cellBox.visible) { - this._currentEditor.hide(); - } else { - this._currentEditor.show(); - } - } - if (this._currentEditor.position) { - this._currentEditor.position(cellBox); - } - } - }; - var _a, _b, _c, _d; - this._data = data; - this._colDefaults = Object.assign({}, columnDefaults); - this._options = options = Object.assign({}, gridDefaults, options); - options.jQuery = this._jQuery = options.jQuery === void 0 ? typeof jQuery !== "undefined" ? jQuery : void 0 : options.jQuery; - if (this._jQuery && container instanceof this._jQuery) - this._container = container[0]; - else if (container instanceof Element) - this._container = container; - else if (typeof container === "string") - this._container = document.querySelector(container); - else if (container.length) - container = container[0]; - if (this._container == null) { - throw new Error("SleekGrid requires a valid container, " + container + " does not exist in the DOM."); - } - this._container.classList.add("slick-container"); - this._emptyNode = (_a = options.emptyNode) != null ? _a : this._jQuery ? function(node) { - this(node).empty(); - }.bind(this._jQuery) : function(node) { - node.innerHTML = ""; - }; - this._removeNode = (_b = options.removeNode) != null ? _b : this._jQuery ? function(node) { - this(node).remove(); - }.bind(this._jQuery) : function(node) { - node.remove(); - }; - if (options == null ? void 0 : options.createPreHeaderPanel) { - if (options.groupingPanel == null) - options.groupingPanel = true; - if (options.groupingPanelHeight == null && options.preHeaderPanelHeight != null) - options.groupingPanelHeight = options.preHeaderPanelHeight; - if (options.showGroupingPanel == null && options.showPreHeaderPanel != null) - options.showGroupingPanel = options.showPreHeaderPanel; - } - this._options.rtl = (_c = this._options.rtl) != null ? _c : document.body.classList.contains("rtl") || typeof getComputedStyle != "undefined" && getComputedStyle(this._container).direction == "rtl"; - if (this._options.rtl) - this._container.classList.add("rtl"); - else - this._container.classList.add("ltr"); - this.validateAndEnforceOptions(); - this._colDefaults.width = options.defaultColumnWidth; - this._editController = { - "commitCurrentEdit": this.commitCurrentEdit.bind(this), - "cancelCurrentEdit": this.cancelCurrentEdit.bind(this) - }; - if (this._jQuery) - this._jQuery(this._container).empty(); - else - this._container.innerHTML = ""; - this._container.style.overflow = "hidden"; - this._container.style.outline = "0"; - this._container.classList.add(this._uid); - if (this._options.useLegacyUI) - this._container.classList.add("ui-widget"); - if (!/relative|absolute|fixed/.test(getComputedStyle(this._container).position)) { - this._container.style.position = "relative"; - } - this._container.appendChild(this._focusSink1 = H("div", { - class: "slick-focus-sink", - hideFocus: "", - style: "position:fixed;width:0!important;height:0!important;top:0;left:0;outline:0!important;", - tabIndex: "0" - })); - this._layout = (_d = options.layoutEngine) != null ? _d : new BasicLayout(); - this.setInitialCols(columns); - this._scrollDims = getScrollBarDimensions(); - if (options.groupingPanel) { - this.createGroupingPanel(); - } - this._layout.init({ - cleanUpAndRenderCells: this.cleanUpAndRenderCells.bind(this), - bindAncestorScroll: this.bindAncestorScroll.bind(this), - getAvailableWidth: this.getAvailableWidth.bind(this), - getCellFromPoint: this.getCellFromPoint.bind(this), - getColumnCssRules: this.getColumnCssRules.bind(this), - getColumns: this.getColumns.bind(this), - getContainerNode: this.getContainerNode.bind(this), - getDataLength: this.getDataLength.bind(this), - getOptions: this.getOptions.bind(this), - getRowFromNode: this.getRowFromNode.bind(this), - getScrollDims: this.getScrollBarDimensions.bind(this), - getScrollLeft: () => this._scrollLeft, - getScrollTop: () => this._scrollTop, - getViewportInfo: () => this._viewportInfo, - renderRows: this.renderRows.bind(this) - }); - this._container.append(this._focusSink2 = this._focusSink1.cloneNode()); - if (options.viewportClass) - this.getViewports().forEach((vp) => addClass(vp, options.viewportClass)); - if (!options.explicitInitialization) { - this.init(); - } - this.bindToData(); - } - createGroupingPanel() { - if (this._groupingPanel || !this._focusSink1) - return; - this._focusSink1.insertAdjacentElement("afterend", this._groupingPanel = H("div", { - class: "slick-grouping-panel", - style: !this._options.showGroupingPanel ? "display: none" : null - })); - if (this._options.createPreHeaderPanel) { - this._groupingPanel.appendChild(H("div", { class: "slick-preheader-panel" })); - } - } - bindAncestorScroll(elem) { - if (this._jQuery) - this._jQuery(elem).on("scroll", this.handleActiveCellPositionChange); - else - elem.addEventListener("scroll", this.handleActiveCellPositionChange); - this._boundAncestorScroll.push(elem); - } - init() { - if (this._initialized) - return; - this._initialized = true; - this.calcViewportSize(); - this.measureCellPaddingAndBorder(); - var viewports = this.getViewports(); - if (this._jQuery && !this._options.enableTextSelectionOnCells) { - this._jQuery(viewports).on("selectstart.ui", () => { - return this._jQuery(this).is("input,textarea"); - }); - } - this._layout.setPaneVisibility(); - this._layout.setScroller(); - this.setOverflow(); - this.updateViewColLeftRight(); - this.createColumnHeaders(); - this.createColumnFooters(); - this.setupColumnSort(); - this.createCssRules(); - this.resizeCanvas(); - this._layout.bindAncestorScrollEvents(); - const onEvent = (el, type, listener) => { - if (this._jQuery) - this._jQuery(el).on(type, listener); - else - el.addEventListener(type, listener); - }; - onEvent(this._container, "resize", this.resizeCanvas); - viewports.forEach((vp) => { - var scrollTicking = false; - onEvent(vp, "scroll", (e) => { - if (!scrollTicking) { - scrollTicking = true; - window.requestAnimationFrame(() => { - this.handleScroll(); - scrollTicking = false; - }); - } - }); - }); - if (this._jQuery && this._jQuery.fn.mousewheel && (this.hasFrozenColumns() || this.hasFrozenRows())) { - this._jQuery(viewports).on("mousewheel", this.handleMouseWheel.bind(this)); - } - this._layout.getHeaderCols().forEach((hs) => { - disableSelection(hs); - onEvent(hs, "contextmenu", this.handleHeaderContextMenu.bind(this)); - onEvent(hs, "click", this.handleHeaderClick.bind(this)); - if (this._jQuery) { - this._jQuery(hs).on("mouseenter", ".slick-header-column", this.handleHeaderMouseEnter.bind(this)).on("mouseleave", ".slick-header-column", this.handleHeaderMouseLeave.bind(this)); - } else { - hs.addEventListener("mouseenter", (e) => e.target.closest(".slick-header-column") && this.handleHeaderMouseEnter(e)); - hs.addEventListener("mouseleave", (e) => e.target.closest(".slick-header-column") && this.handleHeaderMouseLeave(e)); - } - }); - this._layout.getHeaderRowCols().forEach((el) => { - onEvent(el.parentElement, "scroll", this.handleHeaderRowScroll); - }); - this._layout.getFooterRowCols().forEach((el) => { - onEvent(el.parentElement, "scroll", this.handleFooterRowScroll); - }); - [this._focusSink1, this._focusSink2].forEach((fs) => onEvent(fs, "keydown", this.handleKeyDown.bind(this))); - var canvases = Array.from(this.getCanvases()); - canvases.forEach((canvas) => { - onEvent(canvas, "keydown", this.handleKeyDown.bind(this)); - onEvent(canvas, "click", this.handleClick.bind(this)); - onEvent(canvas, "dblclick", this.handleDblClick.bind(this)); - onEvent(canvas, "contextmenu", this.handleContextMenu.bind(this)); - }); - if (this._jQuery && this._jQuery.fn.drag) { - this._jQuery(canvases).on("draginit", this.handleDragInit.bind(this)).on("dragstart", { distance: 3 }, this.handleDragStart.bind(this)).on("drag", this.handleDrag.bind(this)).on("dragend", this.handleDragEnd.bind(this)); - } - canvases.forEach((canvas) => { - if (this._jQuery) { - this._jQuery(canvas).on("mouseenter", ".slick-cell", this.handleMouseEnter.bind(this)).on("mouseleave", ".slick-cell", this.handleMouseLeave.bind(this)); - } else { - canvas.addEventListener("mouseenter", (e) => e.target.closest(".slick-cell") && this.handleMouseEnter(e)); - canvas.addEventListener("mouseleave", (e) => e.target.closest(".slick-cell") && this.handleMouseLeave(e)); - } - }); - if (navigator.userAgent.toLowerCase().match(/webkit/) && navigator.userAgent.toLowerCase().match(/macintosh/) && this._jQuery) { - this._jQuery(canvases).on("mousewheel", this.handleMouseWheel.bind(this)); - } - } - hasFrozenColumns() { - return this._layout.getFrozenCols() > 0; - } - hasFrozenRows() { - return this._layout.getFrozenRows() > 0; - } - registerPlugin(plugin) { - this._plugins.unshift(plugin); - plugin.init(this); - } - unregisterPlugin(plugin) { - for (var i = this._plugins.length; i >= 0; i--) { - if (this._plugins[i] === plugin) { - if (this._plugins[i].destroy) { - this._plugins[i].destroy(); - } - this._plugins.splice(i, 1); - break; - } - } - } - getPluginByName(name) { - for (var i = this._plugins.length - 1; i >= 0; i--) { - if (this._plugins[i].pluginName === name) - return this._plugins[i]; - } - } - setSelectionModel(model) { - this.unregisterSelectionModel(); - this._selectionModel = model; - if (this._selectionModel) { - this._selectionModel.init(this); - this._selectionModel.onSelectedRangesChanged.subscribe(this.handleSelectedRangesChanged); - } - } - unregisterSelectionModel() { - var _a, _b; - if (!this._selectionModel) - return; - this._selectionModel.onSelectedRangesChanged.unsubscribe(this.handleSelectedRangesChanged); - (_b = (_a = this._selectionModel).destroy) == null ? void 0 : _b.call(_a); - } - getScrollBarDimensions() { - return this._scrollDims; - } - getDisplayedScrollbarDimensions() { - return { - width: this._viewportInfo.hasVScroll ? this._scrollDims.width : 0, - height: this._viewportInfo.hasHScroll ? this._scrollDims.height : 0 - }; - } - getAbsoluteColumnMinWidth() { - return this._absoluteColMinWidth; - } - getSelectionModel() { - return this._selectionModel; - } - colIdOrIdxToCell(columnIdOrIdx) { - if (columnIdOrIdx == null) - return null; - if (typeof columnIdOrIdx !== "number") - return this.getColumnIndex(columnIdOrIdx); - return columnIdOrIdx; - } - getCanvasNode(columnIdOrIdx, row) { - return this._layout.getCanvasNodeFor(this.colIdOrIdxToCell(columnIdOrIdx || 0), row || 0); - } - getCanvases() { - var canvases = this._layout.getCanvasNodes(); - return this._jQuery ? this._jQuery(canvases) : canvases; - } - getActiveCanvasNode(e) { - if (e) { - this._activeCanvasNode = e.target.closest(".grid-canvas"); - } - return this._activeCanvasNode; - } - getViewportNode(columnIdOrIdx, row) { - return this._layout.getViewportNodeFor(this.colIdOrIdxToCell(columnIdOrIdx || 0), row || 0); - } - getViewports() { - return this._layout.getViewportNodes(); - } - getActiveViewportNode(e) { - if (e) { - this._activeViewportNode = e.target.closest(".slick-viewport"); - } - return this._activeViewportNode; - } - getAvailableWidth() { - return this._viewportInfo.hasVScroll ? this._viewportInfo.width - this._scrollDims.width : this._viewportInfo.width; - } - updateCanvasWidth(forceColumnWidthsUpdate) { - const widthChanged = this._layout.updateCanvasWidth(); - if (widthChanged || forceColumnWidthsUpdate) { - this._layout.applyColumnWidths(); - } - } - unbindAncestorScrollEvents() { - if (this._boundAncestorScroll) { - for (var x of this._boundAncestorScroll) - x.removeEventListener("scroll", this.handleActiveCellPositionChange); - } - this._boundAncestorScroll = []; - } - updateColumnHeader(columnId, title, toolTip) { - if (!this._initialized) { - return; - } - var idx = this.getColumnIndex(columnId); - if (idx == null) { - return; - } - var columnDef = this._cols[idx]; - var header = this._layout.getHeaderColumn(idx); - if (!header) - return; - if (title !== void 0) { - columnDef.name = title; - } - if (toolTip !== void 0) { - columnDef.toolTip = toolTip; - } - this.trigger(this.onBeforeHeaderCellDestroy, { - node: header, - column: columnDef - }); - if (toolTip !== void 0) - header.title = toolTip || ""; - if (title !== void 0) { - var child = header.firstElementChild; - if (columnDef.nameIsHtml) - child && (child.innerHTML = title != null ? title : ""); - else - child && (child.textContent = title != null ? title : ""); - } - this.trigger(this.onHeaderCellRendered, { - node: header, - column: columnDef - }); - } - getHeader() { - return this._layout.getHeaderCols()[0]; - } - getHeaderColumn(columnIdOrIdx) { - var cell = this.colIdOrIdxToCell(columnIdOrIdx); - if (cell == null) - return null; - return this._layout.getHeaderColumn(cell); - } - getGroupingPanel() { - return this._groupingPanel; - } - getPreHeaderPanel() { - var _a; - return (_a = this._groupingPanel) == null ? void 0 : _a.querySelector(".slick-preheader-panel"); - } - getHeaderRow() { - return this._layout.getHeaderRowCols()[0]; - } - getHeaderRowColumn(columnIdOrIdx) { - var cell = this.colIdOrIdxToCell(columnIdOrIdx); - if (cell == null) - return; - return this._layout.getHeaderRowColumn(cell); - } - getFooterRow() { - return this._layout.getFooterRowCols()[0]; - } - getFooterRowColumn(columnIdOrIdx) { - var cell = this.colIdOrIdxToCell(columnIdOrIdx); - if (cell == null) - return null; - return this._layout.getFooterRowColumn(cell); - } - createColumnFooters() { - var footerRowCols = this._layout.getFooterRowCols(); - footerRowCols.forEach((frc) => { - frc.querySelectorAll(".slick-footerrow-column").forEach((el) => { - var columnDef = this.getColumnFromNode(el); - if (columnDef) { - this.trigger(this.onBeforeFooterRowCellDestroy, { - node: el, - column: columnDef - }); - } - }); - if (this._jQuery) { - this._jQuery(frc).empty(); - } else - frc.innerHTML = ""; - }); - var cols = this._cols; - for (var i = 0; i < cols.length; i++) { - var m = cols[i]; - var footerRowCell = H("div", { class: "slick-footerrow-column l" + i + " r" + i + (this._options.useLegacyUI ? " ui-state-default" : "") }); - footerRowCell.dataset.c = i.toString(); - this._jQuery && this._jQuery(footerRowCell).data("column", m); - if (m.footerCssClass) - addClass(footerRowCell, m.footerCssClass); - else if (m.cssClass) - addClass(footerRowCell, m.cssClass); - this._layout.getFooterRowColsFor(i).appendChild(footerRowCell); - this.trigger(this.onFooterRowCellRendered, { - node: footerRowCell, - column: m - }); - } - } - createColumnHeaders() { - var _a, _b; - const headerCols = this._layout.getHeaderCols(); - headerCols.forEach((hc) => { - hc.querySelectorAll(".slick-header-column").forEach((el) => { - var columnDef = this.getColumnFromNode(el); - if (columnDef) { - this.trigger(this.onBeforeHeaderCellDestroy, { - node: el, - column: columnDef - }); - } - }); - this._emptyNode(hc); - }); - this._layout.updateHeadersWidth(); - const headerRowCols = this._layout.getHeaderRowCols(); - headerRowCols.forEach((hrc) => { - hrc.querySelectorAll(".slick-headerrow-column").forEach((el) => { - var columnDef = this.getColumnFromNode(el); - if (columnDef) { - this.trigger(this.onBeforeHeaderRowCellDestroy, { - node: el, - column: columnDef, - grid: this - }); - } - }); - if (this._jQuery) { - this._jQuery(hrc).empty(); - } else { - hrc.innerHTML = ""; - } - }); - var cols = this._cols, frozenCols = this._layout.getFrozenCols(); - for (var i = 0; i < cols.length; i++) { - var m = cols[i]; - var headerTarget = this._layout.getHeaderColsFor(i); - var name = document.createElement("span"); - name.className = "slick-column-name"; - if (m.nameIsHtml) - name.innerHTML = (_a = m.name) != null ? _a : ""; - else - name.textContent = (_b = m.name) != null ? _b : ""; - var header = H("div", { - class: "slick-header-column" + (this._options.useLegacyUI ? " ui-state-default " : ""), - ["data-id"]: m.id, - id: "" + this._uid + m.id, - title: m.toolTip || "", - style: "width: " + (m.width - this._headerColumnWidthDiff) + "px" - }, name); - header.dataset.c = i.toString(); - this._jQuery && this._jQuery(header).data("column", m); - m.headerCssClass && addClass(header, m.headerCssClass); - i < frozenCols && header.classList.add("frozen"); - headerTarget.appendChild(header); - if ((this._options.enableColumnReorder || m.sortable) && this._options.useLegacyUI) { - if (this._jQuery) { - this._jQuery(header).on("mouseenter", addUiStateHover); - this._jQuery(header).on("mouseleave", removeUiStateHover); - } else { - header.addEventListener("mouseenter", addUiStateHover); - header.addEventListener("mouseleave", removeUiStateHover); - } - } - if (m.sortable) { - header.classList.add("slick-header-sortable"); - header.appendChild(H("span", { class: "slick-sort-indicator" })); - } - this.trigger(this.onHeaderCellRendered, { - node: header, - column: m - }); - if (this._options.showHeaderRow) { - var headerRowTarget = this._layout.getHeaderRowColsFor(i); - var headerRowCell = H("div", { class: "slick-headerrow-column l" + i + " r" + i + (this._options.useLegacyUI ? " ui-state-default" : "") }); - headerRowCell.dataset.c = i.toString(); - this._jQuery && this._jQuery(headerRowCell).data("column", m); - headerRowTarget.appendChild(headerRowCell); - this.trigger(this.onHeaderRowCellRendered, { - node: headerRowCell, - column: m - }); - } - } - this.setSortColumns(this._sortColumns); - this.setupColumnResize(); - if (this._options.enableColumnReorder) - this.setupColumnReorder(); - } - setupColumnSort() { - const handler = (e) => { - var tgt = e.target; - if (tgt.classList.contains("slick-resizable-handle")) { - return; - } - var colNode = tgt.closest(".slick-header-column"); - if (!colNode) { - return; - } - var column = this.getColumnFromNode(colNode); - if (column.sortable) { - if (!this.getEditorLock().commitCurrentEdit()) { - return; - } - var sortOpts = null; - var i = 0; - for (; i < this._sortColumns.length; i++) { - if (this._sortColumns[i].columnId == column.id) { - sortOpts = this._sortColumns[i]; - sortOpts.sortAsc = !sortOpts.sortAsc; - break; - } - } - if (e.metaKey && this._options.multiColumnSort) { - if (sortOpts) { - this._sortColumns.splice(i, 1); - } - } else { - if (!e.shiftKey && !e.metaKey || !this._options.multiColumnSort) { - this._sortColumns = []; - } - if (!sortOpts) { - sortOpts = { columnId: column.id, sortAsc: column.defaultSortAsc }; - this._sortColumns.push(sortOpts); - } else if (this._sortColumns.length == 0) { - this._sortColumns.push(sortOpts); - } - } - this.setSortColumns(this._sortColumns); - if (!this._options.multiColumnSort) { - this.trigger(this.onSort, { - multiColumnSort: false, - sortCol: column, - sortAsc: sortOpts.sortAsc - }, e); - } else { - var cols = this._initCols; - this.trigger(this.onSort, { - multiColumnSort: true, - sortCols: this._sortColumns.map((col) => ({ sortCol: cols[this.getInitialColumnIndex(col.columnId)], sortAsc: col.sortAsc })) - }, e); - } - } - }; - this._layout.getHeaderCols().forEach((el) => { - if (this._jQuery) - this._jQuery(el).on("click", handler); - else - el.addEventListener("click", handler); - }); - } - static offset(el) { - if (!el || !el.getBoundingClientRect) - return; - const box = el.getBoundingClientRect(); - const docElem = document.documentElement; - return { - top: box.top + window.scrollY - docElem.clientTop, - left: box.left + window.scrollX - docElem.clientLeft - }; - } - setupColumnReorder() { - var _a; - if (typeof Sortable === "undefined") - return; - (_a = this.sortableColInstances) == null ? void 0 : _a.forEach((x) => x.destroy()); - let columnScrollTimer = null; - const scrollColumnsLeft = () => this._layout.getScrollContainerX().scrollLeft = this._layout.getScrollContainerX().scrollLeft + 10; - const scrollColumnsRight = () => this._layout.getScrollContainerX().scrollLeft = this._layout.getScrollContainerX().scrollLeft - 10; - let canDragScroll; - const sortableOptions = { - animation: 50, - direction: "horizontal", - chosenClass: "slick-header-column-active", - ghostClass: "slick-sortable-placeholder", - draggable: ".slick-header-column", - filter: ".slick-resizable-handle", - preventOnFilter: false, - dragoverBubble: false, - revertClone: true, - scroll: !this.hasFrozenColumns(), - // enable auto-scroll - onStart: (e) => { - canDragScroll = !this.hasFrozenColumns() || _Grid.offset(e.item).left > _Grid.offset(this._layout.getScrollContainerX()).left; - if (canDragScroll && e.originalEvent && e.originalEvent.pageX > this._container.clientWidth) { - if (!columnScrollTimer) { - columnScrollTimer = setInterval(scrollColumnsRight, 100); - } - } else if (canDragScroll && e.originalEvent && e.originalEvent.pageX < _Grid.offset(this._layout.getScrollContainerX()).left) { - if (!columnScrollTimer) { - columnScrollTimer = setInterval(scrollColumnsLeft, 100); - } - } else { - clearInterval(columnScrollTimer); - columnScrollTimer = null; - } - }, - onEnd: (e) => { - var _a2; - const cancel = false; - clearInterval(columnScrollTimer); - columnScrollTimer = null; - if (cancel || !((_a2 = this.getEditorLock()) == null ? void 0 : _a2.commitCurrentEdit())) { - return; - } - var reorderedCols; - this._layout.getHeaderCols().forEach((el, i) => { - var _a3, _b, _c; - return reorderedCols = sortToDesiredOrderAndKeepRest( - this._initCols, - (_c = (_b = (_a3 = this.sortableColInstances[i]) == null ? void 0 : _a3.toArray) == null ? void 0 : _b.call(_a3)) != null ? _c : [] - ); - }); - this.setColumns(reorderedCols); - this.trigger(this.onColumnsReordered, {}); - e.stopPropagation(); - this.setupColumnResize(); - if (this._activeCellNode) { - this.setFocus(); - } - } - }; - this.sortableColInstances = this._layout.getHeaderCols().map((x) => Sortable.create(x, sortableOptions)); - } - setupColumnResize() { - var minPageX, pageX, maxPageX, cols = this._cols; - var columnElements = []; - this._layout.getHeaderCols().forEach((el) => { - columnElements = columnElements.concat(Array.from(el.children)); - }); - var j, c, pageX, minPageX, maxPageX, firstResizable, lastResizable, cols = this._cols; - var firstResizable, lastResizable; - columnElements.forEach((el, i) => { - var handle = el.querySelector(".slick-resizable-handle"); - handle && this._removeNode(handle); - if (cols[i].resizable) { - if (firstResizable === void 0) { - firstResizable = i; - } - lastResizable = i; - } - }); - if (firstResizable === void 0) { - return; - } - const noJQueryDrag = !this._jQuery || !this._jQuery.fn || !this._jQuery.fn.drag; - columnElements.forEach((el, colIdx) => { - if (colIdx < firstResizable || this._options.forceFitColumns && colIdx >= lastResizable) { - return; - } - const handle = el.appendChild(document.createElement("div")); - handle.classList.add("slick-resizable-handle"); - handle.draggable = true; - var docDragOver = null; - const dragStart = (e) => { - var _a; - if (!this.getEditorLock().commitCurrentEdit()) { - !noJQueryDrag && e.preventDefault(); - return; - } - if (noJQueryDrag) { - docDragOver = (z) => z.preventDefault(); - document.addEventListener("dragover", docDragOver); - } - pageX = e.pageX; - (_a = e.target.parentElement) == null ? void 0 : _a.classList.add("slick-header-column-active"); - columnElements.forEach((e2, z) => { - cols[z].previousWidth = e2.offsetWidth; - }); - const minMax = calcMinMaxPageXOnDragStart(cols, colIdx, pageX, this._options.forceFitColumns, this._absoluteColMinWidth); - maxPageX = minMax.maxPageX; - minPageX = minMax.minPageX; - noJQueryDrag && (e.dataTransfer.effectAllowed = "move"); - }; - const drag = (e) => { - if (noJQueryDrag) { - if (!e.pageX && !e.clientX && !e.pageY && !e.clientY) - return; - e.dataTransfer.effectAllowed = "none"; - e.preventDefault(); - } - shrinkOrStretchColumn(cols, colIdx, Math.min(maxPageX, Math.max(minPageX, e.pageX)) - pageX, this._options.forceFitColumns, this._absoluteColMinWidth); - this._layout.afterHeaderColumnDrag(); - this.applyColumnHeaderWidths(); - if (this._options.syncColumnCellResize) { - this._layout.applyColumnWidths(); - } - }; - const dragEnd = (e) => { - var _a; - if (docDragOver) { - document.removeEventListener("dragover", docDragOver); - docDragOver = null; - } - (_a = e.target.parentElement) == null ? void 0 : _a.classList.remove("slick-header-column-active"); - for (j = 0; j < columnElements.length; j++) { - c = cols[j]; - var newWidth = columnElements[j].offsetWidth; - if (c.previousWidth !== newWidth && c.rerenderOnResize) { - this.invalidateAllRows(); - } - } - this.columnsResized(false); - }; - if (noJQueryDrag) { - handle.addEventListener("dragstart", dragStart); - handle.addEventListener("drag", drag); - handle.addEventListener("dragend", dragEnd); - handle.addEventListener("dragover", (e) => { - e.preventDefault(); - e.dataTransfer.effectAllowed = "move"; - }); - } else { - this._jQuery(handle).on("dragstart", dragStart).on("drag", drag).on("dragend", dragEnd); - } - }); - } - columnsResized(invalidate = true) { - this.applyColumnHeaderWidths(); - this._layout.applyColumnWidths(); - invalidate && this.invalidateAllRows(); - this.updateCanvasWidth(true); - this.render(); - this.trigger(this.onColumnsResized); - } - setOverflow() { - this._layout.setOverflow(); - if (this._options.viewportClass) - this.getViewports().forEach((vp) => addClass(vp, this._options.viewportClass)); - } - measureCellPaddingAndBorder() { - const h = ["border-left-width", "border-right-width", "padding-left", "padding-right"]; - const v = ["border-top-width", "border-bottom-width", "padding-top", "padding-bottom"]; - var el = this._layout.getHeaderColsFor(0).appendChild(H("div", { class: "slick-header-column" + (this._options.useLegacyUI ? " ui-state-default" : ""), style: "visibility:hidden" })); - this._headerColumnWidthDiff = 0; - var cs = getComputedStyle(el); - if (cs.boxSizing != "border-box") - h.forEach((val) => this._headerColumnWidthDiff += parsePx(cs.getPropertyValue(val)) || 0); - el.remove(); - var r = this._layout.getCanvasNodeFor(0, 0).appendChild(H( - "div", - { class: "slick-row" }, - el = H("div", { class: "slick-cell", id: "", style: "visibility: hidden" }) - )); - el.innerHTML = "-"; - this._cellWidthDiff = this._cellHeightDiff = 0; - cs = getComputedStyle(el); - if (cs.boxSizing != "border-box") { - h.forEach((val) => this._cellWidthDiff += parsePx(cs.getPropertyValue(val)) || 0); - v.forEach((val) => this._cellHeightDiff += parsePx(cs.getPropertyValue(val)) || 0); - } - r.remove(); - this._absoluteColMinWidth = Math.max(this._headerColumnWidthDiff, this._cellWidthDiff); - } - createCssRules() { - var cellHeight = this._options.rowHeight - this._cellHeightDiff; - if (this._options.useCssVars && this.getColumns().length > 50) - this._options.useCssVars = false; - this._container.classList.toggle("sleek-vars", !!this._options.useCssVars); - if (this._options.useCssVars) { - var style = this._container.style; - style.setProperty("--sleek-row-height", this._options.rowHeight + "px"); - style.setProperty("--sleek-cell-height", cellHeight + "px"); - style.setProperty("--sleek-top-panel-height", this._options.topPanelHeight + "px"); - style.setProperty("--sleek-grouping-panel-height", this._options.groupingPanelHeight + "px"); - style.setProperty("--sleek-headerrow-height", this._options.headerRowHeight + "px"); - style.setProperty("--sleek-footerrow-height", this._options.footerRowHeight + "px"); - return; - } - var el = this._styleNode = document.createElement("style"); - el.dataset.uid = this._uid; - var rules = [ - "." + this._uid + " { --slick-cell-height: " + this._options.rowHeight + "px; }", - "." + this._uid + " .slick-group-header-column { " + (this._options.rtl ? "right" : "left") + ": 1000px; }", - "." + this._uid + " .slick-header-column { " + (this._options.rtl ? "right" : "left") + ": 1000px; }", - "." + this._uid + " .slick-top-panel { height:" + this._options.topPanelHeight + "px; }", - "." + this._uid + " .slick-grouping-panel { height:" + this._options.groupingPanelHeight + "px; }", - "." + this._uid + " .slick-headerrow-columns { height:" + this._options.headerRowHeight + "px; }", - "." + this._uid + " .slick-cell { height:" + cellHeight + "px; }", - "." + this._uid + " .slick-row { height:" + this._options.rowHeight + "px; }", - "." + this._uid + " .slick-footerrow-columns { height:" + this._options.footerRowHeight + "px; }" - ]; - var cols = this._cols; - for (var i = 0; i < cols.length; i++) { - rules.push("." + this._uid + " .l" + i + " { }"); - rules.push("." + this._uid + " .r" + i + " { }"); - } - el.appendChild(document.createTextNode(rules.join(" "))); - document.head.appendChild(el); - } - getColumnCssRules(idx) { - if (this._options.useCssVars) - return null; - if (!this._stylesheet) { - var stylesheetFromUid = document.querySelector("style[data-uid='" + this._uid + "']"); - if (stylesheetFromUid && stylesheetFromUid.sheet) { - this._stylesheet = stylesheetFromUid.sheet; - } else { - var sheets = document.styleSheets; - for (var i = 0; i < sheets.length; i++) { - if ((sheets[i].ownerNode || sheets[i].owningElement) == this._styleNode) { - this._stylesheet = sheets[i]; - break; - } - } - } - if (!this._stylesheet) { - throw new Error("Cannot find stylesheet."); - } - this._columnCssRulesL = []; - this._columnCssRulesR = []; - var cssRules = this._stylesheet.cssRules || this._stylesheet.rules; - var matches, columnIdx; - for (var i = 0; i < cssRules.length; i++) { - var selector = cssRules[i].selectorText; - if (matches = /\.l\d+/.exec(selector)) { - columnIdx = parseInt(matches[0].substring(2, matches[0].length), 10); - this._columnCssRulesL[columnIdx] = cssRules[i]; - } else if (matches = /\.r\d+/.exec(selector)) { - columnIdx = parseInt(matches[0].substring(2, matches[0].length), 10); - this._columnCssRulesR[columnIdx] = cssRules[i]; - } - } - } - return this._options.rtl ? { - "right": this._columnCssRulesL[idx], - "left": this._columnCssRulesR[idx] - } : { - "left": this._columnCssRulesL[idx], - "right": this._columnCssRulesR[idx] - }; - } - removeCssRules() { - var _a; - (_a = this._styleNode) == null ? void 0 : _a.remove(); - this._styleNode = null; - this._stylesheet = null; - } - destroy() { - var _a; - this.getEditorLock().cancelCurrentEdit(); - this.trigger(this.onBeforeDestroy); - var i = this._plugins.length; - while (i--) { - this.unregisterPlugin(this._plugins[i]); - } - if (this._options.enableColumnReorder && this._jQuery && this._jQuery.fn.sortable) { - this._jQuery(this._layout.getHeaderCols()).filter(":ui-sortable").sortable("destroy"); - } - this.unbindAncestorScrollEvents(); - this.unbindFromData(); - this.unregisterSelectionModel(); - (_a = this._jQuery) == null ? void 0 : _a.call(this, this._container).off(".slickgrid"); - this.removeCssRules(); - var canvasNodes = this._layout.getCanvasNodes(); - if (this._jQuery) - this._jQuery(canvasNodes).off("draginit dragstart dragend drag"); - else - canvasNodes.forEach((el) => this._removeNode(el)); - for (var k in this) { - if (!Object.prototype.hasOwnProperty.call(this, k)) - continue; - if (k.startsWith("on")) { - var ev = this[k]; - if ((ev == null ? void 0 : ev.clear) && (ev == null ? void 0 : ev.subscribe)) - ev == null ? void 0 : ev.clear(); - } - delete this[k]; - } - } - ////////////////////////////////////////////////////////////////////////////////////////////// - // General - trigger(evt, args, e) { - e = e || new EventData(); - args = args || {}; - args.grid = this; - return evt.notify(args, e, this); - } - getEditorLock() { - return this._options.editorLock; - } - getEditController() { - return this._editController; - } - /** Gets a column by its ID. May also return non visible columns */ - getColumnById(id) { - return id ? this._cols[this._colById[id]] : null; - } - /** Returns a column's index in the visible columns list by its column ID */ - getColumnIndex(id) { - return id ? this._colById[id] : null; - } - /** Gets index of a column in the initial column list passed to the grid, or setColumns method. May include invisible cols and index does not have to match visible column order. */ - getInitialColumnIndex(id) { - return id ? this._initColById[id] : null; - } - /** Gets a view (e.g. visible) column by its column ID */ - getVisibleColumnById(id) { - return id ? this._cols[this._colById[id]] : null; - } - autosizeColumns() { - var vpi = this._viewportInfo, availWidth = vpi.hasVScroll ? vpi.width - this._scrollDims.width : vpi.width; - var reRender = autosizeColumns(this._cols, availWidth, this._absoluteColMinWidth); - this.applyColumnHeaderWidths(); - this.updateCanvasWidth(true); - if (reRender) { - this.invalidateAllRows(); - this.render(); - } - } - applyColumnHeaderWidths() { - if (!this._initialized) { - return; - } - var h; - for (var i = 0, cols = this._cols, colCount = cols.length, diff = this._headerColumnWidthDiff; i < colCount; i++) { - h = this._layout.getHeaderColumn(i); - if (h) { - var target = cols[i].width - diff; - if (h.offsetWidth !== target) { - h.style.width = target + "px"; - } - } - } - this.updateViewColLeftRight(); - } - setSortColumn(columnId, ascending) { - this.setSortColumns([{ columnId, sortAsc: ascending }]); - } - setSortColumns(cols) { - this._sortColumns = cols || []; - var headerColumnEls = []; - this._layout.getHeaderCols().forEach((el) => headerColumnEls = headerColumnEls.concat(Array.from(el.children))); - headerColumnEls.forEach((hel) => { - hel.classList.remove("slick-header-column-sorted"); - var si = hel.querySelector(".slick-sort-indicator"); - si && si.classList.remove("slick-sort-indicator-asc", "slick-sort-indicator-desc"); - }); - this._sortColumns.forEach((col) => { - if (col.sortAsc == null) { - col.sortAsc = true; - } - var columnIndex = this.getColumnIndex(col.columnId); - if (columnIndex != null) { - var header = headerColumnEls[columnIndex]; - if (header) { - header.classList.add("slick-header-column-sorted"); - var si = header.querySelector(".slick-sort-indicator"); - si && si.classList.add(col.sortAsc ? "slick-sort-indicator-asc" : "slick-sort-indicator-desc"); - } - } - }); - } - getSortColumns() { - return this._sortColumns; - } - /** Returns only the visible columns in order */ - getColumns() { - return this._cols; - } - /** Returns list of columns passed to the grid constructor, or setColumns method. May include invisible columns and order does not match visible column order. */ - getInitialColumns() { - return this._initCols; - } - updateViewColLeftRight() { - this._colLeft = []; - this._colRight = []; - var x = 0, r, cols = this._cols, i, l = cols.length, frozenCols = this._layout.getFrozenCols(); - for (var i = 0; i < l; i++) { - if (frozenCols === i) - x = 0; - r = x + cols[i].width; - this._colLeft[i] = x; - this._colRight[i] = r; - x = r; - } - } - setInitialCols(initCols) { - var _a, _b; - initializeColumns(initCols, this._colDefaults); - var initColById = {}; - var viewCols = []; - var viewColById = {}; - var i, m; - for (i = 0; i < initCols.length; i++) { - m = initCols[i]; - initColById[m.id] = i; - if (m.visible !== false) - viewCols.push(m); - } - viewCols = this._layout.reorderViewColumns(viewCols, this._options); - this._postRenderActive = (_a = this._options.enableAsyncPostRender) != null ? _a : false; - this._postCleanupActive = (_b = this._options.enableAsyncPostRenderCleanup) != null ? _b : false; - for (i = 0; i < viewCols.length; i++) { - m = viewCols[i]; - viewColById[m.id] = i; - if (m.asyncPostRenderCleanup != null) - this._postCleanupActive = true; - if (m.asyncPostRender != null) - this._postRenderActive = true; - } - this._initCols = initCols; - this._initColById = initColById; - this._cols = viewCols; - this._colById = viewColById; - } - setColumns(columns) { - var _a, _b; - if (columns && this._initCols && this._cols && columns.length === this._cols.length && this._initCols.length > this._cols.length && !columns.some((x) => this._cols.indexOf(x) < 0) && !this._cols.some((x) => columns.indexOf(x) < 0)) { - sortToDesiredOrderAndKeepRest( - this._initCols, - columns.map((x) => x.id) - ); - columns = this._initCols; - } - this.setInitialCols(columns); - this.updateViewColLeftRight(); - if (this._initialized) { - this._layout.setPaneVisibility(); - this.setOverflow(); - this.invalidateAllRows(); - this.createColumnHeaders(); - this.createColumnFooters(); - this.updateGrandTotals(); - this.removeCssRules(); - this.createCssRules(); - this.resizeCanvas(); - this.updateCanvasWidth(); - this._layout.applyColumnWidths(); - this.handleScroll(); - (_b = (_a = this.getSelectionModel()) == null ? void 0 : _a.refreshSelections) == null ? void 0 : _b.call(_a); - } - } - getOptions() { - return this._options; - } - setOptions(args, suppressRender, suppressColumnSet, suppressSetOverflow) { - var _a; - if (!this.getEditorLock().commitCurrentEdit()) { - return; - } - this.makeActiveCellNormal(); - if (args.groupingPanel && !this._options.groupingPanel) - this.createGroupingPanel(); - else if (args.groupingPanel != void 0 && !args.groupingPanel && this._groupingPanel) - this._removeNode(this._groupingPanel); - if (args.showColumnHeader !== void 0) { - this.setColumnHeaderVisibility(args.showColumnHeader); - } - if (this._options.enableAddRow !== args.enableAddRow) { - this.invalidateRow(this.getDataLength()); - } - this._options = Object.assign(this._options, args); - this.validateAndEnforceOptions(); - this._layout.afterSetOptions(args); - if (args.columns && !suppressColumnSet) { - this.setColumns((_a = args.columns) != null ? _a : this._initCols); - } - if (!suppressSetOverflow) { - this.setOverflow(); - } - this._layout.setScroller(); - if (!suppressRender) - this.render(); - } - validateAndEnforceOptions() { - if (this._options.autoHeight) { - this._options.leaveSpaceForNewRows = false; - } - } - bindToData() { - if (this._data) { - this._data.onRowCountChanged && this._data.onRowCountChanged.subscribe(this.viewOnRowCountChanged); - this._data.onRowsChanged && this._data.onRowsChanged.subscribe(this.viewOnRowsChanged); - this._data.onDataChanged && this._data.onDataChanged.subscribe(this.viewOnDataChanged); - } - } - unbindFromData() { - if (this._data) { - this._data.onRowCountChanged && this._data.onRowCountChanged.unsubscribe(this.viewOnRowCountChanged); - this._data.onRowsChanged && this._data.onRowsChanged.unsubscribe(this.viewOnRowsChanged); - this._data.onDataChanged && this._data.onDataChanged.unsubscribe(this.viewOnDataChanged); - } - } - setData(newData, scrollToTop) { - this.unbindFromData(); - this._data = newData; - this.bindToData(); - this.invalidateAllRows(); - this.updateRowCount(); - if (scrollToTop) { - this.scrollTo(0); - } - } - getData() { - return this._data; - } - getDataLength() { - if (this._data.getLength) { - return this._data.getLength(); - } else { - return this._data.length; - } - } - getDataLengthIncludingAddNew() { - return this.getDataLength() + (!this._options.enableAddRow ? 0 : !this._pagingActive || this._pagingIsLastPage ? 1 : 0); - } - getDataItem(i) { - if (this._data.getItem) { - return this._data.getItem(i); - } else { - return this._data[i]; - } - } - getTopPanel() { - return this._layout.getTopPanelFor(0); - } - setTopPanelVisibility(visible) { - if (this._options.showTopPanel != visible) { - this._options.showTopPanel = !!visible; - this._layout.getTopPanelNodes().forEach((el) => { - if (this._jQuery) - this._jQuery(el)[visible ? "slideDown" : "slideUp"]("fast", this.resizeCanvas); - else { - el.style.display = visible ? "" : "none"; - this.resizeCanvas(); - } - }); - } - } - setColumnHeaderVisibility(visible, animate) { - if (this._options.showColumnHeader != visible) { - this._options.showColumnHeader = visible; - this._layout.getHeaderCols().forEach((n) => { - const el = n.parentElement; - if (animate && this._jQuery) - this._jQuery(el)[visible ? "slideDown" : "slideUp"]("fast", this.resizeCanvas); - else { - el.style.display = visible ? "" : "none"; - this.resizeCanvas(); - } - }); - } - } - setFooterRowVisibility(visible) { - if (this._options.showFooterRow != visible) { - this._options.showFooterRow = !!visible; - this._layout.getFooterRowCols().forEach((n) => { - const el = n.parentElement; - if (this._jQuery) - this._jQuery(el)[visible ? "slideDown" : "slideUp"]("fast", this.resizeCanvas); - else { - el.style.display = visible ? "" : "none"; - this.resizeCanvas(); - } - }); - } - } - setGroupingPanelVisibility(visible) { - if (this._options.showGroupingPanel != visible) { - this._options.showGroupingPanel = visible; - if (!this._options.groupingPanel) - return; - const el = this._groupingPanel; - if (this._jQuery) - this._jQuery(el)[visible ? "slideDown" : "slideUp"]("fast", this.resizeCanvas); - else { - el.style.display = visible ? "" : "none"; - this.resizeCanvas(); - } - } - } - setPreHeaderPanelVisibility(visible) { - this.setGroupingPanelVisibility(visible); - } - setHeaderRowVisibility(visible) { - if (this._options.showHeaderRow != visible) { - this._options.showHeaderRow = visible; - this._layout.getHeaderRowCols().forEach((n) => { - const el = n.parentElement; - if (this._jQuery) - this._jQuery(el)[visible ? "slideDown" : "slideUp"]("fast", this.resizeCanvas); - else { - el.style.display = visible ? "" : "none"; - this.resizeCanvas(); - } - }); - } - } - getContainerNode() { - return this._container; - } - getUID() { - return this._uid; - } - ////////////////////////////////////////////////////////////////////////////////////////////// - // Rendering / Scrolling - getRowTop(row) { - return this._options.rowHeight * row - this._pageOffset; - } - getRowFromPosition(y) { - return Math.floor((y + this._pageOffset) / this._options.rowHeight); - } - scrollTo(y) { - const vpi = this._viewportInfo; - y = Math.max(y, 0); - y = Math.min(y, vpi.virtualHeight - Math.round(this._layout.getScrollContainerY().clientHeight) + (vpi.hasHScroll || this.hasFrozenColumns() ? this._scrollDims.height : 0)); - var oldOffset = this._pageOffset; - this._page = Math.min(this._numberOfPages - 1, Math.floor(y / this._pageHeight)); - this._pageOffset = Math.round(this._page * this._jumpinessCoefficient); - var newScrollTop = y - this._pageOffset; - if (this._pageOffset != oldOffset) { - var range = this.getVisibleRange(newScrollTop); - this.cleanupRows(range); - this.updateRowPositions(); - } - if (this._scrollTopPrev != newScrollTop) { - this._vScrollDir = this._scrollTopPrev + oldOffset < newScrollTop + this._pageOffset ? 1 : -1; - this._scrollTopRendered = this._scrollTop = this._scrollTopPrev = newScrollTop; - this._layout.handleScrollV(); - this._layout.getScrollContainerY().scrollTop = newScrollTop; - this.trigger(this.onViewportChanged); - } - } - getFormatter(row, column) { - var data = this._data; - if (data.getItemMetadata) { - const itemMetadata = data.getItemMetadata(row); - if (itemMetadata) { - const colsMetadata = itemMetadata.columns; - if (colsMetadata) { - var columnMetadata = colsMetadata[column.id] || colsMetadata[this.getColumnIndex(column.id)]; - if (columnMetadata) { - if (columnMetadata.format) - return columnMetadata.format; - if (columnMetadata.formatter) - return convertCompatFormatter(columnMetadata.formatter); - } - } - if (itemMetadata.format) - return itemMetadata.format; - if (itemMetadata.formatter) - return convertCompatFormatter(itemMetadata.formatter); - } - } - if (column.format) - return column.format; - if (column.formatter) - return convertCompatFormatter(column.formatter); - var opt = this._options; - var factory = opt.formatterFactory; - if (factory) { - if (factory.getFormat) { - var format = factory.getFormat(column); - if (format) - return format; - } else if (factory.getFormatter) { - var compat = factory.getFormatter(column); - if (compat) - return convertCompatFormatter(compat); - } - } - if (opt.defaultFormat) - return opt.defaultFormat; - if (opt.defaultFormatter) - return convertCompatFormatter(opt.defaultFormatter); - return defaultColumnFormat; - } - getFormatterContext(row, cell) { - var column = this._cols[cell]; - var item = this.getDataItem(row); - const ctx = { - cell, - column, - grid: this, - escape, - item, - row - }; - if (item) - ctx.value = this.getDataItemValueForColumn(item, column); - return ctx; - } - getEditor(row, cell) { - var column = this._cols[cell]; - var itemMetadata = this._data.getItemMetadata && this._data.getItemMetadata(row); - var colsMetadata = itemMetadata && itemMetadata.columns; - if (colsMetadata && colsMetadata[column.id] && colsMetadata[column.id].editor !== void 0) { - return colsMetadata[column.id].editor; - } - if (colsMetadata && colsMetadata[cell] && colsMetadata[cell].editor !== void 0) { - return colsMetadata[cell].editor; - } - return column.editor || this._options.editorFactory && this._options.editorFactory.getEditor(column, row); - } - getDataItemValueForColumn(item, columnDef) { - if (this._options.dataItemColumnValueExtractor) - return this._options.dataItemColumnValueExtractor(item, columnDef); - return item[columnDef.field]; - } - appendRowHtml(stringArrayL, stringArrayR, row, range, dataLength) { - var _a, _b; - var d = this.getDataItem(row); - var dataLoading = row < dataLength && !d; - var rowCss = "slick-row" + (this._layout.isFrozenRow(row) ? " frozen" : "") + (dataLoading ? " loading" : "") + (row === this._activeRow ? " active" : "") + (row % 2 == 1 ? " odd" : " even"); - if (!d) { - rowCss += " " + this._options.addNewRowCssClass; - } - var itemMetadata = (_b = (_a = this._data).getItemMetadata) == null ? void 0 : _b.call(_a, row); - if (itemMetadata && itemMetadata.cssClasses) { - rowCss += " " + itemMetadata.cssClasses; - } - var rowOffset = this._layout.getFrozenRowOffset(row); - var rowHtml = "

"; - stringArrayL.push(rowHtml); - const frozenCols = this._layout.getFrozenCols(); - if (frozenCols) { - stringArrayR.push(rowHtml); - } - var colspan, m, cols = this._cols; - for (var i = 0, ii = cols.length; i < ii; i++) { - var columnData = null; - m = cols[i]; - colspan = 1; - if (itemMetadata && itemMetadata.columns) { - columnData = itemMetadata.columns[m.id] || itemMetadata.columns[i]; - colspan = columnData && columnData.colspan || 1; - if (colspan === "*") { - colspan = ii - i; - } - } - if (this._colRight[Math.min(ii - 1, i + colspan - 1)] > range.leftPx) { - if (this._colLeft[i] > range.rightPx) { - break; - } - this.appendCellHtml(frozenCols > 0 && i >= frozenCols ? stringArrayR : stringArrayL, row, i, colspan, d, columnData); - } - if (colspan > 1) { - i += colspan - 1; - } - } - stringArrayL.push("
"); - if (frozenCols) { - stringArrayR.push(""); - } - } - appendCellHtml(sb, row, cell, colspan, item, metadata) { - var _a, _b, _c, _d, _e; - var cols = this._cols, frozenCols = this._layout.getFrozenCols(), column = cols[cell]; - var klass = "slick-cell l" + cell + " r" + Math.min(cols.length - 1, cell + colspan - 1) + (column.cssClass ? " " + column.cssClass : ""); - if (cell < frozenCols) - klass += " frozen"; - if (row === this._activeRow && cell === this._activeCell) - klass += " active"; - if (metadata && metadata.cssClasses) { - klass += " " + metadata.cssClasses; - } - for (var key in this._cellCssClasses) { - if (this._cellCssClasses[key][row] && this._cellCssClasses[key][row][column.id]) { - klass += " " + this._cellCssClasses[key][row][column.id]; - } - } - var formatResult; - const ctx = { - cell, - column, - escape, - grid: this, - item, - row - }; - if (item) { - ctx.value = this.getDataItemValueForColumn(item, column); - formatResult = this.getFormatter(row, column)(ctx); - } - klass = escape(klass); - if (((_a = ctx.addClass) == null ? void 0 : _a.length) || ((_b = ctx.addAttrs) == null ? void 0 : _b.length) || ((_c = ctx.tooltip) == null ? void 0 : _c.length)) { - if ((_d = ctx.addClass) == null ? void 0 : _d.length) - klass += " " + escape(ctx.addClass); - sb.push('
" + formatResult + "
"); - else - sb.push(">"); - } else if (formatResult != null && !(formatResult instanceof Node)) - sb.push('
' + formatResult + "
"); - else - sb.push('
'); - var cache = this._rowsCache[row]; - cache.cellRenderQueue.push(cell); - cache.cellRenderContent.push(formatResult instanceof Node ? formatResult : void 0); - this._rowsCache[row].cellColSpans[cell] = colspan; - } - cleanupRows(rangeToKeep) { - var i; - for (var x in this._rowsCache) { - i = parseInt(x, 10); - if (i !== this._activeRow && (i < rangeToKeep.top || i > rangeToKeep.bottom) && !this._layout.isFrozenRow(i)) - this.removeRowFromCache(i); - } - this.startPostProcessingCleanup(); - } - invalidate() { - this.updateRowCount(); - this.invalidateAllRows(); - this.render(); - this.updateGrandTotals(); - } - invalidateAllRows() { - if (this._currentEditor) { - this.makeActiveCellNormal(); - } - for (var row in this._rowsCache) { - this.removeRowFromCache(parseInt(row, 10)); - } - this.startPostProcessingCleanup(); - } - queuePostProcessedRowForCleanup(cacheEntry, row) { - var _a, _b; - var postProcessedRow = this._postProcessedRows[row]; - if (!postProcessedRow) - return; - this._postProcessGroupId++; - for (var x in postProcessedRow) { - var columnIdx = parseInt(x, 10); - this._postProcessCleanupQueue.push({ - groupId: this._postProcessGroupId, - cellNode: cacheEntry.cellNodesByColumnIdx[columnIdx | 0], - columnIdx: columnIdx | 0, - rowIdx: row - }); - } - this._postProcessCleanupQueue.push({ - groupId: this._postProcessGroupId, - rowNodeL: cacheEntry.rowNodeL, - rowNodeR: cacheEntry.rowNodeR - }); - (_a = cacheEntry.rowNodeL) == null ? void 0 : _a.remove(); - (_b = cacheEntry.rowNodeR) == null ? void 0 : _b.remove(); - } - queuePostProcessedCellForCleanup(cellnode, columnIdx, rowIdx) { - this._postProcessCleanupQueue.push({ - groupId: this._postProcessGroupId, - cellNode: cellnode, - columnIdx, - rowIdx - }); - cellnode.remove(); - } - removeRowFromCache(row) { - var _a, _b, _c, _d; - var cacheEntry = this._rowsCache[row]; - if (!cacheEntry) { - return; - } - if (this._postCleanupActive && this._postProcessedRows[row]) { - this.queuePostProcessedRowForCleanup(cacheEntry, row); - } else { - (_b = (_a = cacheEntry.rowNodeL) == null ? void 0 : _a.parentElement) == null ? void 0 : _b.removeChild(cacheEntry.rowNodeL); - (_d = (_c = cacheEntry.rowNodeR) == null ? void 0 : _c.parentElement) == null ? void 0 : _d.removeChild(cacheEntry.rowNodeR); - } - delete this._rowsCache[row]; - delete this._postProcessedRows[row]; - } - invalidateRows(rows) { - var i, rl; - if (!rows || !rows.length) { - return; - } - this._vScrollDir = 0; - for (i = 0, rl = rows.length; i < rl; i++) { - if (this._currentEditor && this._activeRow === rows[i]) { - this.makeActiveCellNormal(); - } - if (this._rowsCache[rows[i]]) { - this.removeRowFromCache(rows[i]); - } - } - this.startPostProcessingCleanup(); - } - invalidateRow(row) { - this.invalidateRows([row]); - } - updateCell(row, cell) { - var cellNode = this.getCellNode(row, cell); - if (!cellNode) - return; - if (this._currentEditor && this._activeRow === row && this._activeCell === cell) { - this._currentEditor.loadValue(this.getDataItem(row)); - } else { - this.updateCellWithFormatter(cellNode, row, cell); - this.invalidatePostProcessingResults(row); - } - } - updateCellWithFormatter(cellNode, row, cell) { - var formatResult; - const ctx = this.getFormatterContext(row, cell); - if (ctx.item) - formatResult = this.getFormatter(row, ctx.column)(ctx); - this._emptyNode(cellNode); - applyFormatterResultToCellNode(ctx, formatResult, cellNode); - } - updateRow(row) { - var cacheEntry = this._rowsCache[row]; - if (!cacheEntry) { - return; - } - this.ensureCellNodesInRowsCache(row); - var d = this.getDataItem(row); - for (var x in cacheEntry.cellNodesByColumnIdx) { - var cell = parseInt(x, 10); - if (row === this._activeRow && cell === this._activeCell && this._currentEditor) { - this._currentEditor.loadValue(d); - } else { - this.updateCellWithFormatter(cacheEntry.cellNodesByColumnIdx[cell], row, cell); - } - } - this.invalidatePostProcessingResults(row); - } - calcViewportSize() { - const layout = this._layout; - const vs = this._viewportInfo; - vs.width = getInnerWidth(this._container); - vs.groupingPanelHeight = this._options.groupingPanel && this._options.showGroupingPanel ? this._options.groupingPanelHeight + getVBoxDelta(this._groupingPanel) : 0; - vs.topPanelHeight = this._options.showTopPanel ? this._options.topPanelHeight + getVBoxDelta(layout.getTopPanelFor(0).parentElement) : 0; - vs.headerRowHeight = this._options.showHeaderRow ? this._options.headerRowHeight + getVBoxDelta(layout.getHeaderRowColsFor(0).parentElement) : 0; - vs.footerRowHeight = this._options.showFooterRow ? this._options.footerRowHeight + getVBoxDelta(layout.getFooterRowColsFor(0).parentElement) : 0; - vs.headerHeight = this._options.showColumnHeader ? parsePx(getComputedStyle(layout.getHeaderColsFor(0).parentElement).height) + getVBoxDelta(layout.getHeaderColsFor(0).parentElement) : 0; - if (this._options.autoHeight) { - vs.height = this._options.rowHeight * this.getDataLengthIncludingAddNew(); - if (this._layout.calcCanvasWidth() > vs.width) - vs.height += this._scrollDims.height; - } else { - var style = getComputedStyle(this._container); - vs.height = parsePx(style.height) - parsePx(style.paddingTop) - parsePx(style.paddingBottom) - vs.headerHeight - vs.topPanelHeight - vs.headerRowHeight - vs.footerRowHeight - vs.groupingPanelHeight; - } - vs.numVisibleRows = Math.ceil(vs.height / this._options.rowHeight); - } - updatePagingStatusFromView(pagingInfo) { - this._pagingActive = pagingInfo.pageSize !== 0; - this._pagingIsLastPage = pagingInfo.pageNum == pagingInfo.totalPages - 1; - } - updateRowCount() { - if (!this._initialized) { - return; - } - var dataLengthIncludingAddNew = this.getDataLengthIncludingAddNew(); - var scrollCanvas = this._layout.getScrollCanvasY(); - var oldH = Math.round(parsePx(getComputedStyle(scrollCanvas).height)); - var numberOfRows; - const frozenRows = this._layout.getFrozenRows(); - if (frozenRows) { - numberOfRows = this.getDataLength() - frozenRows; - } else { - numberOfRows = dataLengthIncludingAddNew + (this._options.leaveSpaceForNewRows ? this._viewportInfo.numVisibleRows - 1 : 0); - } - var tempViewportH = Math.round(parsePx(getComputedStyle(this._layout.getScrollContainerY()).height)); - const vpi = this._viewportInfo; - var oldViewportHasVScroll = vpi.hasVScroll; - vpi.hasVScroll = !this._options.autoHeight && numberOfRows * this._options.rowHeight > tempViewportH; - this.makeActiveCellNormal(); - var l = dataLengthIncludingAddNew - 1; - for (var x in this._rowsCache) { - var i = parseInt(x, 10); - if (i >= l) { - this.removeRowFromCache(i); - } - } - this.startPostProcessingCleanup(); - vpi.virtualHeight = Math.max(this._options.rowHeight * numberOfRows, tempViewportH - this._scrollDims.height); - if (this._activeCellNode && this._activeRow > l) { - this.resetActiveCell(); - } - if (vpi.virtualHeight < getMaxSupportedCssHeight()) { - vpi.realScrollHeight = this._pageHeight = vpi.virtualHeight; - this._numberOfPages = 1; - this._jumpinessCoefficient = 0; - } else { - vpi.realScrollHeight = getMaxSupportedCssHeight(); - this._pageHeight = vpi.realScrollHeight / 100; - this._numberOfPages = Math.floor(vpi.virtualHeight / this._pageHeight); - this._jumpinessCoefficient = (vpi.virtualHeight - vpi.realScrollHeight) / (this._numberOfPages - 1); - } - if (vpi.realScrollHeight !== oldH) { - this._layout.realScrollHeightChange(); - this._scrollTop = this._layout.getScrollContainerY().scrollTop; - } - var oldScrollTopInRange = this._scrollTop + this._pageOffset <= vpi.virtualHeight - tempViewportH; - if (vpi.virtualHeight == 0 || this._scrollTop == 0) { - this._page = this._pageOffset = 0; - } else if (oldScrollTopInRange) { - this.scrollTo(this._scrollTop + this._pageOffset); - } else { - this.scrollTo(vpi.virtualHeight - tempViewportH); - } - if (vpi.realScrollHeight != oldH && this._options.autoHeight) { - this.resizeCanvas(); - } - if (this._options.forceFitColumns && oldViewportHasVScroll != vpi.hasVScroll) { - this.autosizeColumns(); - } - this.updateCanvasWidth(false); - } - /** - * @param viewportTop optional viewport top - * @param viewportLeft optional viewport left - * @returns viewport range - */ - getViewport(viewportTop, viewportLeft) { - return this.getVisibleRange(viewportTop, viewportLeft); - } - getVisibleRange(viewportTop, viewportLeft) { - if (viewportTop == null) { - viewportTop = this._scrollTop; - } - if (viewportLeft == null) { - viewportLeft = this._scrollLeft; - } - if (this._options.rtl) { - viewportLeft = Math.abs(viewportLeft); - } - return { - top: this.getRowFromPosition(viewportTop), - bottom: this.getRowFromPosition(viewportTop + this._viewportInfo.height) + 1, - leftPx: viewportLeft, - rightPx: viewportLeft + this._viewportInfo.width - }; - } - getRenderedRange(viewportTop, viewportLeft) { - var range = this.getVisibleRange(viewportTop, viewportLeft); - var buffer = Math.round(this._viewportInfo.height / this._options.rowHeight); - var minBuffer = this._options.minBuffer || 3; - if (this._vScrollDir == -1) { - range.top -= buffer; - range.bottom += minBuffer; - } else if (this._vScrollDir == 1) { - range.top -= minBuffer; - range.bottom += buffer; - } else { - range.top -= minBuffer; - range.bottom += minBuffer; - } - range.top = Math.max(0, range.top); - range.bottom = Math.min(this.getDataLengthIncludingAddNew() - 1, range.bottom); - if (this._options.renderAllCells) { - range.leftPx = 0; - range.rightPx = this._layout.getCanvasWidth(); - } else { - range.leftPx -= this._viewportInfo.width; - range.rightPx += this._viewportInfo.width; - range.leftPx = Math.max(0, range.leftPx); - range.rightPx = Math.min(this._layout.getCanvasWidth(), range.rightPx); - } - return range; - } - ensureCellNodesInRowsCache(row) { - var _a, _b, _c, _d; - var cacheEntry = this._rowsCache[row]; - if (cacheEntry) { - if (cacheEntry.cellRenderQueue.length) { - var lastChild = (_c = (_a = cacheEntry.rowNodeR) == null ? void 0 : _a.lastElementChild) != null ? _c : (_b = cacheEntry.rowNodeL) == null ? void 0 : _b.lastElementChild; - while (lastChild && cacheEntry.cellRenderQueue.length) { - var columnIdx = cacheEntry.cellRenderQueue.pop(); - var element = cacheEntry.cellRenderContent.pop(); - cacheEntry.cellNodesByColumnIdx[columnIdx] = lastChild; - if (element instanceof Node) - lastChild.appendChild(element); - lastChild = lastChild.previousElementSibling; - if (lastChild == null) - lastChild = (_d = cacheEntry.rowNodeL) == null ? void 0 : _d.lastElementChild; - } - } - } - } - cleanUpCells(rangeToKeep, row) { - if (this._layout.isFrozenRow(row)) - return; - var cacheEntry = this._rowsCache[row]; - var cellsToRemove = [], frozenCols = this._layout.getFrozenCols(); - for (var x in cacheEntry.cellNodesByColumnIdx) { - var i = parseInt(x, 10); - if (i < frozenCols) { - continue; - } - var colspan = cacheEntry.cellColSpans[i], cols = this._cols; - if (this._colLeft[i] > rangeToKeep.rightPx || this._colRight[Math.min(cols.length - 1, i + colspan - 1)] < rangeToKeep.leftPx) { - if (!(row == this._activeRow && i === this._activeCell)) { - cellsToRemove.push(i); - } - } - } - var cellToRemove, node; - this._postProcessGroupId++; - while ((cellToRemove = cellsToRemove.pop()) != null) { - node = cacheEntry.cellNodesByColumnIdx[cellToRemove]; - if (this._postCleanupActive && this._postProcessedRows[row] && this._postProcessedRows[row][cellToRemove]) { - this.queuePostProcessedCellForCleanup(node, cellToRemove, row); - } else { - this._removeNode(node); - } - delete cacheEntry.cellColSpans[cellToRemove]; - delete cacheEntry.cellNodesByColumnIdx[cellToRemove]; - if (this._postProcessedRows[row]) { - delete this._postProcessedRows[row][cellToRemove]; - } - } - } - cleanUpAndRenderCells(range) { - var cacheEntry; - var stringArray = []; - var processedRows = []; - var cellsAdded; - var colspan; - var cols = this._cols; - var cellContents = []; - for (var row = range.top, btm = range.bottom; row <= btm; row++) { - cacheEntry = this._rowsCache[row]; - if (!cacheEntry) { - continue; - } - this.ensureCellNodesInRowsCache(row); - this.cleanUpCells(range, row); - cellsAdded = 0; - var itemMetadata = this._data.getItemMetadata && this._data.getItemMetadata(row); - var colsMetadata = itemMetadata && itemMetadata.columns; - var d = this.getDataItem(row); - for (var i = 0, ii = cols.length; i < ii; i++) { - if (this._colLeft[i] > range.rightPx) { - break; - } - if ((colspan = cacheEntry.cellColSpans[i]) != null) { - i += colspan > 1 ? colspan - 1 : 0; - continue; - } - var columnData = null; - colspan = 1; - if (colsMetadata) { - columnData = colsMetadata[cols[i].id] || colsMetadata[i]; - colspan = columnData && columnData.colspan || 1; - if (colspan === "*") { - colspan = ii - i; - } - } - if (this._colRight[Math.min(ii - 1, i + colspan - 1)] > range.leftPx) { - this.appendCellHtml(stringArray, row, i, colspan, d, columnData); - cellsAdded++; - } - i += colspan > 1 ? colspan - 1 : 0; - } - if (cellsAdded) { - processedRows.push(row); - } - } - if (!stringArray.length) { - return; - } - var x = document.createElement("div"); - x.innerHTML = stringArray.join(""); - var processedRow; - var node, frozenCols = this._layout.getFrozenCols(); - while ((processedRow = processedRows.pop()) != null) { - cacheEntry = this._rowsCache[processedRow]; - var columnIdx; - while ((columnIdx = cacheEntry.cellRenderQueue.pop()) != null) { - var element = cacheEntry.cellRenderContent.pop(); - node = x.lastElementChild; - if (element instanceof Node) - node.appendChild(element); - if (frozenCols > 0 && columnIdx >= frozenCols) { - cacheEntry.rowNodeR.appendChild(node); - } else { - cacheEntry.rowNodeL.appendChild(node); - } - cacheEntry.cellNodesByColumnIdx[columnIdx] = node; - } - } - } - renderRows(range) { - var stringArrayL = [], stringArrayR = [], rows = [], needToReselectCell = false, dataLength = this.getDataLength(); - for (var i = range.top, ii = range.bottom; i <= ii; i++) { - if (this._rowsCache[i] || this.hasFrozenRows() && this._options.frozenBottom && i == dataLength) { - continue; - } - rows.push(i); - this._rowsCache[i] = { - rowNodeL: null, - rowNodeR: null, - // ColSpans of rendered cells (by column idx). - // Can also be used for checking whether a cell has been rendered. - cellColSpans: [], - // Cell nodes (by column idx). Lazy-populated by ensureCellNodesInRowsCache(). - cellNodesByColumnIdx: [], - // Column indices of cell nodes that have been rendered, but not yet indexed in - // cellNodesByColumnIdx. These are in the same order as cell nodes added at the - // end of the row. - cellRenderQueue: [], - cellRenderContent: [] - }; - this.appendRowHtml(stringArrayL, stringArrayR, i, range, dataLength); - if (this._activeCellNode && this._activeRow === i) { - needToReselectCell = true; - } - } - if (!rows.length) { - return; - } - var l = document.createElement("div"), r = document.createElement("div"); - l.innerHTML = stringArrayL.join(""); - r.innerHTML = stringArrayR.join(""); - const layout = this._layout; - for (var i = 0, ii = rows.length; i < ii; i++) { - var row = rows[i]; - var cache = this._rowsCache[row]; - cache.rowNodeL = l.firstElementChild; - cache.rowNodeR = r.firstElementChild; - layout.appendCachedRow(row, cache.rowNodeL, cache.rowNodeR); - if (cache.cellRenderContent.some((x) => x instanceof Node)) - this.ensureCellNodesInRowsCache(row); - } - if (needToReselectCell) { - this._activeCellNode = this.getCellNode(this._activeRow, this._activeCell); - } - } - startPostProcessing() { - if (!this._postRenderActive) { - return; - } - clearTimeout(this._hPostRender); - if (this._options.asyncPostRenderDelay < 0) { - this.asyncPostProcessRows(); - } else { - this._hPostRender = setTimeout(this.asyncPostProcessRows, this._options.asyncPostRenderDelay); - } - } - startPostProcessingCleanup() { - if (!this._postCleanupActive) { - return; - } - clearTimeout(this._hPostRenderCleanup); - if (this._options.asyncPostCleanupDelay < 0) { - this.asyncPostProcessCleanupRows(); - } else { - this._hPostRenderCleanup = setTimeout(this.asyncPostProcessCleanupRows.bind(this), this._options.asyncPostCleanupDelay); - } - } - invalidatePostProcessingResults(row) { - if (this._options.enableAsyncPostRenderCleanup) { - var postProcessed = this._postProcessedRows[row]; - if (postProcessed) { - for (var columnIdx in postProcessed) { - postProcessed[columnIdx] = "C"; - } - } - } else { - delete this._postProcessedRows[row]; - } - this._postProcessFromRow = Math.min(this._postProcessFromRow, row); - this._postProcessToRow = Math.max(this._postProcessToRow, row); - this.startPostProcessing(); - } - updateRowPositions() { - for (var row in this._rowsCache) { - var c = this._rowsCache[row]; - var p = this.getRowTop(parseInt(row, 10)) + "px"; - c.rowNodeL && (c.rowNodeL.style.top = p); - c.rowNodeR && (c.rowNodeR.style.top = p); - } - } - updateGrandTotals() { - var _a, _b; - if (!this._options.showFooterRow || !this._initialized) - return; - var totals; - if (this._data && this._data.getGrandTotals) - totals = this._data.getGrandTotals(); - totals = totals != null ? totals : {}; - var cols = this._cols; - for (var m of cols) { - if (m.id != void 0) { - var formatter = (_a = m.groupTotalsFormatter) != null ? _a : this._options.groupTotalsFormatter; - if (!formatter) - continue; - var content = (_b = formatter(totals, m, this)) != null ? _b : ""; - this.getFooterRowColumn(m.id).innerHTML = content; - } - } - } - // for usage as fallback by the groupmetadataitemprovider - groupTotalsFormatter(p1, p2, grid) { - return this._options.groupTotalsFormatter ? this._options.groupTotalsFormatter(p1, p2, grid != null ? grid : this) : ""; - } - handleMouseWheel(e, delta, deltaX, deltaY) { - var _a, _b; - deltaX = (typeof deltaX == "undefined" ? (_a = e.originalEvent) == null ? void 0 : _a.deltaX : deltaX) || 0; - deltaY = (typeof deltaY == "undefined" ? (_b = e.originalEvent) == null ? void 0 : _b.deltaY : deltaY) || 0; - this._scrollTop = Math.max(0, this._layout.getScrollContainerY().scrollTop - deltaY * this._options.rowHeight); - this._scrollLeft = this._layout.getScrollContainerX().scrollLeft + deltaX * 10; - this.handleScroll(true); - } - handleScroll(isMouseWheel) { - this._scrollTop = this._layout.getScrollContainerY().scrollTop; - this._scrollLeft = this._layout.getScrollContainerX().scrollLeft; - var vScrollDist = Math.abs(this._scrollTop - this._scrollTopPrev); - var hScrollDist = Math.abs(this._scrollLeft - this._scrollLeftPrev); - if (hScrollDist || vScrollDist) - this._ignoreScrollUntil = (/* @__PURE__ */ new Date()).getTime() + 100; - if (hScrollDist) { - this._scrollLeftPrev = this._scrollLeft; - this._layout.getScrollContainerX().scrollLeft = this._scrollLeft; - this._layout.handleScrollH(); - } - const vpi = this._viewportInfo; - if (vScrollDist) { - this._vScrollDir = this._scrollTopPrev < this._scrollTop ? 1 : -1; - this._scrollTopPrev = this._scrollTop; - if (isMouseWheel === true) { - this._layout.getScrollContainerY().scrollTop = this._scrollTop; - } - this._layout.handleScrollV(); - if (vScrollDist < this._viewportInfo.height) { - this.scrollTo(this._scrollTop + this._pageOffset); - } else { - var oldOffset = this._pageOffset; - if (vpi.realScrollHeight == vpi.height) { - this._page = 0; - } else { - this._page = Math.min(this._numberOfPages - 1, Math.floor(this._scrollTop * ((vpi.virtualHeight - this._viewportInfo.height) / (vpi.realScrollHeight - this._viewportInfo.height)) * (1 / this._pageHeight))); - } - this._pageOffset = Math.round(this._page * this._jumpinessCoefficient); - if (oldOffset != this._pageOffset) { - this.invalidateAllRows(); - } - } - } - if (hScrollDist || vScrollDist) { - if (this._hRender) { - clearTimeout(this._hRender); - } - if (Math.abs(this._scrollTopRendered - this._scrollTop) > 20 || Math.abs(this._scrollLeftRendered - this._scrollLeft) > 20) { - if (this._options.forceSyncScrolling || this._options.forceSyncScrollInterval && this._lastRenderTime < (/* @__PURE__ */ new Date()).getTime() - this._options.forceSyncScrollInterval) { - this.render(); - } else { - this._hRender = setTimeout(this.render, 50); - } - this.trigger(this.onViewportChanged); - } - } - this.trigger(this.onScroll, { scrollLeft: this._scrollLeft, scrollTop: this._scrollTop }); - return !!(hScrollDist || vScrollDist); - } - asyncPostProcessCleanupRows() { - var _a; - var cols = this._cols; - while (((_a = this._postProcessCleanupQueue) == null ? void 0 : _a.length) > 0) { - var groupId = this._postProcessCleanupQueue[0].groupId; - while (this._postProcessCleanupQueue.length > 0 && this._postProcessCleanupQueue[0].groupId == groupId) { - var entry = this._postProcessCleanupQueue.shift(); - entry.rowNodeL && entry.rowNodeL.remove(); - entry.rowNodeR && entry.rowNodeR.remove(); - if (entry.cellNode != null) { - var column = cols[entry.columnIdx]; - if (column && column.asyncPostRenderCleanup) { - column.asyncPostRenderCleanup(entry.cellNode, entry.rowIdx, column); - this._removeNode(entry.cellNode); - } - } - } - if (this._options.asyncPostRenderDelay >= 0) { - this._hPostRenderCleanup = setTimeout(this.asyncPostProcessCleanupRows.bind(this), this._options.asyncPostCleanupDelay); - return; - } - } - } - updateCellCssStylesOnRenderedRows(addedHash, removedHash) { - var node, columnId, addedRowHash, removedRowHash; - for (var row in this._rowsCache) { - removedRowHash = removedHash && removedHash[row]; - addedRowHash = addedHash && addedHash[row]; - if (removedRowHash) { - for (columnId in removedRowHash) { - if (!addedRowHash || removedRowHash[columnId] != addedRowHash[columnId]) { - node = this.getCellNode(parseInt(row, 10), this.getColumnIndex(columnId)); - if (node) { - const r = removedRowHash[columnId]; - removeClass(node, r); - } - } - } - } - if (addedRowHash) { - for (columnId in addedRowHash) { - if (!removedRowHash || removedRowHash[columnId] != addedRowHash[columnId]) { - node = this.getCellNode(parseInt(row, 10), this.getColumnIndex(columnId)); - if (node) { - const a = addedRowHash[columnId]; - addClass(node, a); - } - } - } - } - } - } - addCellCssStyles(key, hash) { - if (this._cellCssClasses[key]) { - throw "addCellCssStyles: cell CSS hash with key '" + key + "' already exists."; - } - this._cellCssClasses[key] = hash; - this.updateCellCssStylesOnRenderedRows(hash, null); - this.trigger(this.onCellCssStylesChanged, { key, hash }); - } - removeCellCssStyles(key) { - if (!this._cellCssClasses[key]) { - return; - } - this.updateCellCssStylesOnRenderedRows(null, this._cellCssClasses[key]); - delete this._cellCssClasses[key]; - this.trigger(this.onCellCssStylesChanged, { key, hash: null }); - } - setCellCssStyles(key, hash) { - var prevHash = this._cellCssClasses[key]; - this._cellCssClasses[key] = hash; - this.updateCellCssStylesOnRenderedRows(hash, prevHash); - this.trigger(this.onCellCssStylesChanged, { key, hash }); - } - getCellCssStyles(key) { - return this._cellCssClasses[key]; - } - flashCell(row, cell, speed) { - speed = speed || 100; - if (this._rowsCache[row]) { - var cellEl = this._jQuery(this.getCellNode(row, cell)); - toggleCellClass(4); - } - var klass = this._options.cellFlashingCssClass; - function toggleCellClass(times) { - if (!times) { - return; - } - setTimeout(function() { - cellEl.queue(function() { - cellEl.toggleClass(klass).dequeue(); - toggleCellClass(times - 1); - }); - }, speed); - } - } - ////////////////////////////////////////////////////////////////////////////////////////////// - // Interactivity - handleDragInit(e, dd) { - var cell = this.getCellFromEvent(e); - if (!cell || !this.cellExists(cell.row, cell.cell)) { - return false; - } - var retval = this.trigger(this.onDragInit, dd, e); - if (e.isImmediatePropagationStopped && e.isImmediatePropagationStopped()) { - return retval; - } - return false; - } - handleDragStart(e, dd) { - var cell = this.getCellFromEvent(e); - if (!cell || !this.cellExists(cell.row, cell.cell)) { - return false; - } - var retval = this.trigger(this.onDragStart, dd, e); - if (e.isImmediatePropagationStopped && e.isImmediatePropagationStopped()) { - return retval; - } - return false; - } - handleDrag(e, dd) { - return this.trigger(this.onDrag, dd, e); - } - handleDragEnd(e, dd) { - this.trigger(this.onDragEnd, dd, e); - } - handleKeyDown(e) { - this.trigger(this.onKeyDown, { row: this._activeRow, cell: this._activeCell }, e); - var handled = e.isImmediatePropagationStopped && e.isImmediatePropagationStopped(); - if (!handled) { - if (!e.shiftKey && !e.altKey) { - if (this._options.editable && this._currentEditor && this._currentEditor.keyCaptureList) { - if (this._currentEditor.keyCaptureList.indexOf(e.which) >= 0) { - return; - } - } - if (e.key === "Home") { - if (e.ctrlKey) { - this.navigateTop(); - handled = true; - } else - handled = this.navigateRowStart(); - } else if (e.key === "End") { - if (e.ctrlKey) { - this.navigateBottom(); - handled = true; - } else - handled = this.navigateRowEnd(); - } - } - } - if (!handled) { - if (!e.shiftKey && !e.altKey && !e.ctrlKey) { - if (this._options.editable && this._currentEditor && this._currentEditor.keyCaptureList) { - if (this._currentEditor.keyCaptureList.indexOf(e.which) >= 0) { - return; - } - } - if (e.key === "Esc" || e.key === "Escape") { - if (!this.getEditorLock().isActive()) { - return; - } - this.cancelEditAndSetFocus(); - } else if (e.key === "PageDown") { - this.navigatePageDown(); - handled = true; - } else if (e.key === "PageUp") { - this.navigatePageUp(); - handled = true; - } else if (e.key === "Left" || e.key === "ArrowLeft") { - handled = this.navigateLeft(); - } else if (e.key === "Right" || e.key === "ArrowRight") { - handled = this.navigateRight(); - } else if (e.key === "Up" || e.key === "ArrowUp") { - handled = this.navigateUp(); - } else if (e.key === "Down" || e.key === "ArrowDown") { - handled = this.navigateDown(); - } else if (e.key === "Tab") { - if (this._options.enableTabKeyNavigation) - handled = this.navigateNext(); - } else if (e.key === "Enter") { - if (this._options.editable) { - if (this._currentEditor) { - if (this._activeRow === this.getDataLength()) { - this.navigateDown(); - } else { - this.commitEditAndSetFocus(); - } - } else { - if (this.getEditorLock().commitCurrentEdit()) { - this.makeActiveCellEditable(); - } - } - } - handled = true; - } - } else if (e.key === "Tab" && e.shiftKey && !e.ctrlKey && !e.altKey) { - handled = this.navigatePrev(); - } - } - if (handled) { - e.stopPropagation(); - e.preventDefault(); - try { - e.originalEvent.keyCode = 0; - } catch (error) { - } - } - } - handleClick(e) { - var _a, _b, _c; - if (!this._currentEditor) { - if (e.target != document.activeElement || ((_c = (_b = (_a = e.target) == null ? void 0 : _a.classList) == null ? void 0 : _b.contains) == null ? void 0 : _c.call(_b, "slick-cell"))) { - this.setFocus(); - } - } - var cell = this.getCellFromEvent(e); - if (!cell || this._currentEditor != null && this._activeRow == cell.row && this._activeCell == cell.cell) { - return; - } - this.trigger(this.onClick, { row: cell.row, cell: cell.cell }, e); - if (e.isImmediatePropagationStopped && e.isImmediatePropagationStopped()) { - return; - } - if (this.canCellBeActive(cell.row, cell.cell)) { - if (!this.getEditorLock().isActive() || this.getEditorLock().commitCurrentEdit()) { - var preClickModeOn = e.target && e.target.classList.contains(preClickClassName); - var column = this._cols[cell.cell]; - var suppressActiveCellChangedEvent = !!(this._options.editable && column && column.editor && this._options.suppressActiveCellChangeOnEdit); - this.setActiveCellInternal(this.getCellNode(cell.row, cell.cell), null, preClickModeOn, suppressActiveCellChangedEvent, e); - } - } - } - handleContextMenu(e) { - var cellEl = e.target.closest(".slick-cell"); - if (!cellEl) { - return; - } - if (this._activeCellNode === cellEl && this._currentEditor != null) { - return; - } - this.trigger(this.onContextMenu, {}, e); - } - handleDblClick(e) { - var cell = this.getCellFromEvent(e); - if (!cell || this._currentEditor != null && this._activeRow == cell.row && this._activeCell == cell.cell) { - return; - } - this.trigger(this.onDblClick, { row: cell.row, cell: cell.cell }, e); - if (e.isImmediatePropagationStopped && e.isImmediatePropagationStopped()) { - return; - } - if (this._options.editable) { - this.gotoCell(cell.row, cell.cell, true); - } - } - handleHeaderMouseEnter(e) { - const column = this.getColumnFromNode(e.target); - column && this.trigger(this.onHeaderMouseEnter, { column }, e); - } - handleHeaderMouseLeave(e) { - const column = this.getColumnFromNode(e.target); - column && this.trigger(this.onHeaderMouseLeave, { column }, e); - } - handleHeaderContextMenu(e) { - var header = e.target.closest(".slick-header-column"); - var column = this.getColumnFromNode(header); - column && this.trigger(this.onHeaderContextMenu, { column }, e); - } - handleHeaderClick(e) { - var header = e.target.closest(".slick-header-column"); - var column = this.getColumnFromNode(header); - column && this.trigger(this.onHeaderClick, { column }, e); - } - handleMouseEnter(e) { - this.trigger(this.onMouseEnter, {}, e); - } - handleMouseLeave(e) { - this.trigger(this.onMouseLeave, {}, e); - } - cellExists(row, cell) { - return !(row < 0 || row >= this.getDataLength() || cell < 0 || cell >= this._cols.length); - } - getCellFromPoint(x, y) { - var row = this.getRowFromPosition(y); - var cell = 0; - var cols = this._cols; - var w = 0; - for (var i = 0; i < cols.length && w < x; i++) { - w += cols[i].width; - cell++; - } - if (cell < 0) { - cell = 0; - } - return { row, cell: cell - 1 }; - } - getCellFromNode(cellNode) { - if (cellNode == null) - return null; - var c = cellNode.dataset.c; - if (c != null) - return parseInt(c, 10); - var cls = /\sl(\d+)\s/.exec(" " + cellNode.className + " "); - if (!cls) { - return null; - } - return parseInt(cls[1], 10); - } - getColumnFromNode(cellNode) { - if (cellNode == null) - return null; - var cell = this.getCellFromNode(cellNode); - if (cell === null && this._jQuery) - return this._jQuery(cell).data("column"); - return this._cols[cell]; - } - getRowFromNode(rowNode) { - if (rowNode != null) { - for (var row in this._rowsCache) { - var c = this._rowsCache[row]; - if (c.rowNodeL === rowNode || c.rowNodeR === rowNode) - return parseInt(row, 10); - } - } - return null; - } - getCellFromEvent(e) { - var row, cell; - var cellEl = e.target.closest(".slick-cell"); - if (!cellEl) { - return null; - } - row = this._layout.getRowFromCellNode(cellEl, e.clientX, e.clientY); - cell = this.getCellFromNode(cellEl); - if (row == null || cell == null) { - return null; - } else { - return { - "row": row, - "cell": cell - }; - } - } - getCellNodeBox(row, cell) { - if (!this.cellExists(row, cell)) { - return null; - } - var rowOffset = this._layout.getFrozenRowOffset(row); - var cols = this._cols, frozenCols = this._layout.getFrozenCols(); - var y1 = this.getRowTop(row) - rowOffset; - var y2 = y1 + this._options.rowHeight - 1; - var x1 = 0; - for (var i = 0; i < cell; i++) { - x1 += cols[i].width; - if (i == frozenCols - 1) { - x1 = 0; - } - } - var x2 = x1 + cols[cell].width; - return this._options.rtl ? { - top: y1, - right: x1, - bottom: y2, - left: x2 - } : { - top: y1, - left: x1, - bottom: y2, - right: x2 - }; - } - ////////////////////////////////////////////////////////////////////////////////////////////// - // Cell switching - resetActiveCell() { - this.setActiveCellInternal(null, false); - } - focus() { - this.setFocus(); - } - setFocus() { - if (this._tabbingDirection == -1) { - this._focusSink1.focus(); - } else { - this._focusSink2.focus(); - } - } - scrollCellIntoView(row, cell, doPaging) { - this.scrollRowIntoView(row, doPaging); - if (cell < this._layout.getFrozenCols()) - return; - var colspan = this.getColspan(row, cell); - this.internalScrollColumnIntoView(this._colLeft[cell], this._colRight[cell + (colspan > 1 ? colspan - 1 : 0)]); - } - scrollColumnIntoView(cell) { - this.internalScrollColumnIntoView(this._colLeft[cell], this._colRight[cell]); - } - internalScrollColumnIntoView(left, right) { - var scrollRight = this._scrollLeft + parsePx(getComputedStyle(this._layout.getScrollContainerX()).width) - (this._viewportInfo.hasVScroll ? this._scrollDims.width : 0); - var target; - if (left < this._scrollLeft) - target = left; - else if (right > scrollRight) - target = Math.min(left, right - this._layout.getScrollContainerX().clientWidth); - else - return; - this._layout.getScrollContainerX().scrollLeft = target; - this.handleScroll(); - this.render(); - } - setActiveCellInternal(newCell, opt_editMode, preClickModeOn, suppressActiveCellChangedEvent, e) { - var _a, _b; - if (this._activeCellNode != null) { - this.makeActiveCellNormal(); - this._activeCellNode.classList.remove("active"); - var c = this._rowsCache[this._activeRow]; - if (c) { - c.rowNodeL && c.rowNodeL.classList.remove("active"); - c.rowNodeR && c.rowNodeR.classList.remove("active"); - } - } - this._activeCellNode = newCell; - if (this._activeCellNode != null) { - var bcl = this._activeCellNode.getBoundingClientRect(); - var rowOffset = Math.floor((_b = (_a = this._activeCellNode.closest(".grid-canvas")) == null ? void 0 : _a.getBoundingClientRect().top) != null ? _b : 0 + document.body.scrollTop); - var isBottom = this._activeCellNode.closest(".grid-canvas-bottom") != null; - if (this.hasFrozenRows() && isBottom) { - rowOffset -= this._options.frozenBottom ? Math.round(parsePx(getComputedStyle(this._layout.getCanvasNodeFor(0, 0)).height)) : this._layout.getFrozenRows() * this._options.rowHeight; - } - var cell = this.getCellFromPoint(bcl[this._options.rtl ? "right" : "left"] + document.body.scrollLeft, Math.ceil(bcl.top + document.body.scrollTop) - rowOffset); - this._activeRow = cell.row; - this._activeCell = this._activePosX = this.getCellFromNode(this._activeCellNode); - if (this._options.showCellSelection) { - this._activeCellNode.classList.add("active"); - var c = this._rowsCache[this._activeRow]; - if (c) { - c.rowNodeL && c.rowNodeL.classList.add("active"); - c.rowNodeR && c.rowNodeR.classList.add("active"); - } - } - if (opt_editMode == null) { - opt_editMode = this._activeRow == this.getDataLength() || this._options.autoEdit; - } - if (this._options.editable && opt_editMode && this.isCellPotentiallyEditable(this._activeRow, this._activeCell)) { - clearTimeout(this._hEditorLoader); - if (this._options.asyncEditorLoading) { - this._hEditorLoader = setTimeout(() => { - this.makeActiveCellEditable(void 0, preClickModeOn, e); - }, this._options.asyncEditorLoadDelay); - } else { - this.makeActiveCellEditable(void 0, preClickModeOn, e); - } - } - } else { - this._activeRow = this._activeCell = null; - } - if (!suppressActiveCellChangedEvent) { - this.trigger(this.onActiveCellChanged, this.getActiveCell()); - } - } - clearTextSelection() { - if (document.selection && document.selection.empty) { - try { - document.selection.empty(); - } catch (e) { - } - } else if (window.getSelection) { - var sel = window.getSelection(); - if (sel && sel.removeAllRanges) { - sel.removeAllRanges(); - } - } - } - isCellPotentiallyEditable(row, cell) { - var dataLength = this.getDataLength(); - if (row < dataLength && !this.getDataItem(row)) { - return false; - } - if (this._cols[cell].cannotTriggerInsert && row >= dataLength) { - return false; - } - if (!this.getEditor(row, cell)) { - return false; - } - return true; - } - makeActiveCellNormal() { - if (!this._currentEditor) { - return; - } - this.trigger(this.onBeforeCellEditorDestroy, { editor: this._currentEditor }); - this._currentEditor.destroy(); - this._currentEditor = null; - if (this._activeCellNode) { - this._activeCellNode.classList.remove("editable", "invalid"); - this.updateCellWithFormatter(this._activeCellNode, this._activeRow, this._activeCell); - this.invalidatePostProcessingResults(this._activeRow); - } - if (navigator.userAgent.toLowerCase().match(/msie/)) { - this.clearTextSelection(); - } - this.getEditorLock().deactivate(this._editController); - } - editActiveCell(editor) { - this.makeActiveCellEditable(editor); - } - makeActiveCellEditable(editor, preClickModeOn, e) { - if (!this._activeCellNode) { - return; - } - if (!this._options.editable) { - throw "Grid : makeActiveCellEditable : should never get called when options.editable is false"; - } - clearTimeout(this._hEditorLoader); - if (!this.isCellPotentiallyEditable(this._activeRow, this._activeCell)) { - return; - } - var columnDef = this._cols[this._activeCell]; - var item = this.getDataItem(this._activeRow); - if (this.trigger(this.onBeforeEditCell, { row: this._activeRow, cell: this._activeCell, item, column: columnDef }) === false) { - this.setFocus(); - return; - } - this.getEditorLock().activate(this._editController); - this._activeCellNode.classList.add("editable"); - var useEditor = editor || this.getEditor(this._activeRow, this._activeCell); - if (!editor && !useEditor.suppressClearOnEdit) { - this._activeCellNode.innerHTML = ""; - } - var itemMetadata = this._data.getItemMetadata && this._data.getItemMetadata(this._activeRow); - var colsMetadata = itemMetadata && itemMetadata.columns; - var columnMetadata = colsMetadata && (colsMetadata[columnDef.id] || colsMetadata[this._activeCell]); - this._currentEditor = new useEditor({ - grid: this, - gridPosition: absBox(this._container), - position: absBox(this._activeCellNode), - container: this._activeCellNode, - column: columnDef, - columnMetaData: columnMetadata, - item: item || {}, - event: e, - editorCellNavOnLRKeys: this._options.editorCellNavOnLRKeys, - commitChanges: this.commitEditAndSetFocus.bind(this), - cancelChanges: this.cancelEditAndSetFocus.bind(this) - }); - if (item) { - this._currentEditor.loadValue(item); - if (preClickModeOn && this._currentEditor.preClick) { - this._currentEditor.preClick(); - } - } - this._serializedEditorValue = this._currentEditor.serializeValue(); - if (this._currentEditor.position) { - this.handleActiveCellPositionChange(); - } - } - commitEditAndSetFocus() { - if (this.getEditorLock().commitCurrentEdit()) { - this.setFocus(); - if (this._options.autoEdit) { - this.navigateDown(); - } - } - } - cancelEditAndSetFocus() { - if (this.getEditorLock().cancelCurrentEdit()) { - this.setFocus(); - } - } - getActiveCellPosition() { - return absBox(this._activeCellNode); - } - getGridPosition() { - return absBox(this._container); - } - getCellEditor() { - return this._currentEditor; - } - getActiveCell() { - if (!this._activeCellNode) { - return null; - } else { - return { row: this._activeRow, cell: this._activeCell }; - } - } - getActiveCellNode() { - return this._activeCellNode; - } - scrollActiveCellIntoView() { - if (this._activeRow != null && this._activeCell != null) { - this.scrollCellIntoView(this._activeRow, this._activeCell); - } - } - scrollRowIntoView(row, doPaging) { - if (!this._layout.isFrozenRow(row)) { - var viewportScrollH = Math.round(parsePx(getComputedStyle(this._layout.getScrollContainerY()).height)); - var rowNumber = this.hasFrozenRows() && !this._options.frozenBottom ? row - this._layout.getFrozenRows() + 1 : row; - var rowAtTop = rowNumber * this._options.rowHeight; - var rowAtBottom = (rowNumber + 1) * this._options.rowHeight - viewportScrollH + (this._viewportInfo.hasHScroll ? this._scrollDims.height : 0); - if ((rowNumber + 1) * this._options.rowHeight > this._scrollTop + viewportScrollH + this._pageOffset) { - this.scrollTo(doPaging ? rowAtTop : rowAtBottom); - this.render(); - } else if (rowNumber * this._options.rowHeight < this._scrollTop + this._pageOffset) { - this.scrollTo(doPaging ? rowAtBottom : rowAtTop); - this.render(); - } - } - } - scrollRowToTop(row) { - this.scrollTo(row * this._options.rowHeight); - this.render(); - } - scrollPage(dir) { - var deltaRows = dir * this._viewportInfo.numVisibleRows; - this.scrollTo((this.getRowFromPosition(this._scrollTop) + deltaRows) * this._options.rowHeight); - this.render(); - if (this._options.enableCellNavigation && this._activeRow != null) { - var row = this._activeRow + deltaRows; - var dataLengthIncludingAddNew = this.getDataLengthIncludingAddNew(); - if (row >= dataLengthIncludingAddNew) { - row = dataLengthIncludingAddNew - 1; - } - if (row < 0) { - row = 0; - } - var cell = 0, prevCell = null; - var prevActivePosX = this._activePosX; - while (cell <= this._activePosX) { - if (this.canCellBeActive(row, cell)) { - prevCell = cell; - } - cell += this.getColspan(row, cell); - } - if (prevCell != null) { - this.setActiveCellInternal(this.getCellNode(row, prevCell)); - this._activePosX = prevActivePosX; - } else { - this.resetActiveCell(); - } - } - } - navigatePageDown() { - this.scrollPage(1); - } - navigatePageUp() { - this.scrollPage(-1); - } - navigateTop() { - this.navigateToRow(0); - } - navigateBottom() { - this.navigateToRow(this.getDataLength() - 1); - } - navigateToRow(row) { - var dataLength = this.getDataLength(); - if (!dataLength) { - return true; - } - if (row < 0) - row = 0; - else if (row >= dataLength) - row = dataLength - 1; - this.scrollCellIntoView(row, 0, true); - if (this._options.enableCellNavigation && this._activeRow != null) { - var cell = 0, prevCell = null; - var prevActivePosX = this._activePosX; - while (cell <= this._activePosX) { - if (this.canCellBeActive(row, cell)) - prevCell = cell; - cell += this.getColspan(row, cell); - } - if (prevCell != null) { - this.setActiveCellInternal(this.getCellNode(row, prevCell)); - this._activePosX = prevActivePosX; - } else - this.resetActiveCell(); - } - return true; - } - getColspan(row, cell) { - var itemMetadata = this._data.getItemMetadata && this._data.getItemMetadata(row); - if (!itemMetadata || !itemMetadata.columns) { - return 1; - } - var cols = this._cols; - var columnData = cols[cell] && (itemMetadata.columns[cols[cell].id] || itemMetadata.columns[cell]); - var colspan = columnData && columnData.colspan; - if (colspan === "*") { - colspan = cols.length - cell; - } else { - colspan = colspan || 1; - } - return colspan; - } - navigateRight() { - return this.navigate("right"); - } - navigateLeft() { - return this.navigate("left"); - } - navigateDown() { - return this.navigate("down"); - } - navigateUp() { - return this.navigate("up"); - } - navigateNext() { - return this.navigate("next"); - } - navigatePrev() { - return this.navigate("prev"); - } - navigateRowStart() { - return this.navigate("home"); - } - navigateRowEnd() { - return this.navigate("end"); - } - /** - * @param {string} dir Navigation direction. - * @return {boolean} Whether navigation resulted in a change of active cell. - */ - navigate(dir) { - if (!this._options.enableCellNavigation) { - return false; - } - if (!this._activeCellNode && dir != "prev" && dir != "next") { - return false; - } - if (!this.getEditorLock().commitCurrentEdit()) { - return true; - } - this.setFocus(); - if (!this._cellNavigator) { - this._cellNavigator = new CellNavigator({ - getColumnCount: () => this._cols.length, - getRowCount: () => this.getDataLengthIncludingAddNew(), - getColspan: this.getColspan.bind(this), - canCellBeActive: this.canCellBeActive.bind(this), - setTabbingDirection: (dir2) => this._tabbingDirection = dir2, - isRTL: () => this._options.rtl - }); - } - var pos = this._cellNavigator.navigate(dir, this._activeRow, this._activeCell, this._activePosX); - if (pos) { - if (this.hasFrozenRows() && this._options.frozenBottom && pos.row == this.getDataLength()) { - return; - } - var isAddNewRow = pos.row == this.getDataLength(); - if (!this._layout.isFrozenRow(pos.row)) { - this.scrollCellIntoView(pos.row, pos.cell, !isAddNewRow); - } - this.setActiveCellInternal(this.getCellNode(pos.row, pos.cell)); - this._activePosX = pos.posX; - return true; - } else { - this.setActiveCellInternal(this.getCellNode(this._activeRow, this._activeCell)); - return false; - } - } - getCellNode(row, cell) { - if (this._rowsCache[row]) { - this.ensureCellNodesInRowsCache(row); - return this._rowsCache[row].cellNodesByColumnIdx[cell]; - } - return null; - } - setActiveCell(row, cell) { - if (!this._initialized) { - return; - } - var cols = this._cols; - if (row > this.getDataLength() || row < 0 || cell >= cols.length || cell < 0) { - return; - } - if (!this._options.enableCellNavigation) { - return; - } - this.scrollCellIntoView(row, cell, false); - this.setActiveCellInternal(this.getCellNode(row, cell), false); - } - setActiveRow(row, cell, suppressScrollIntoView) { - if (!this._initialized) - return; - if (row > this.getDataLength() || row < 0 || cell >= this._cols.length || cell < 0) - return; - this._activeRow = row; - if (!suppressScrollIntoView) - this.scrollCellIntoView(row, cell || 0, false); - } - canCellBeActive(row, cell) { - var cols = this._cols; - if (!this._options.enableCellNavigation || row >= this.getDataLengthIncludingAddNew() || row < 0 || cell >= cols.length || cell < 0) { - return false; - } - var rowMetadata = this._data.getItemMetadata && this._data.getItemMetadata(row); - if (rowMetadata && typeof rowMetadata.focusable === "boolean") { - return rowMetadata.focusable; - } - var colsMetadata = rowMetadata && rowMetadata.columns; - if (colsMetadata && cols[cell] && colsMetadata[cols[cell].id] && typeof colsMetadata[cols[cell].id].focusable === "boolean") { - return colsMetadata[cols[cell].id].focusable; - } - if (colsMetadata && colsMetadata[cell] && typeof colsMetadata[cell].focusable === "boolean") { - return colsMetadata[cell].focusable; - } - return cols[cell].focusable; - } - canCellBeSelected(row, cell) { - var cols = this._cols; - if (row >= this.getDataLength() || row < 0 || cell >= cols.length || cell < 0) { - return false; - } - var itemMetadata = this._data.getItemMetadata && this._data.getItemMetadata(row); - if (itemMetadata && typeof itemMetadata.selectable === "boolean") { - return itemMetadata.selectable; - } - var columnMetadata = itemMetadata && itemMetadata.columns && (itemMetadata.columns[cols[cell].id] || itemMetadata.columns[cell]); - if (columnMetadata && typeof columnMetadata.selectable === "boolean") { - return columnMetadata.selectable; - } - return cols[cell].selectable; - } - gotoCell(row, cell, forceEdit) { - if (!this._initialized) { - return; - } - if (!this.canCellBeActive(row, cell)) { - return; - } - if (!this.getEditorLock().commitCurrentEdit()) { - return; - } - this.scrollCellIntoView(row, cell, false); - var newCell = this.getCellNode(row, cell); - this.setActiveCellInternal(newCell, forceEdit || row === this.getDataLength() || this._options.autoEdit); - if (!this._currentEditor) { - this.setFocus(); - } - } - ////////////////////////////////////////////////////////////////////////////////////////////// - // IEditor implementation for the editor lock - commitCurrentEdit() { - var item = this.getDataItem(this._activeRow); - var column = this._cols[this._activeCell]; - var self = this; - if (this._currentEditor) { - if (this._currentEditor.isValueChanged()) { - var validationResults = this._currentEditor.validate(); - if (validationResults.valid) { - if (this._activeRow < this.getDataLength()) { - var editCommand = { - row: this._activeRow, - cell: self._activeCell, - editor: this._currentEditor, - serializedValue: this._currentEditor.serializeValue(), - prevSerializedValue: this._serializedEditorValue, - execute: function() { - this.editor.applyValue(item, this.serializedValue); - self.updateRow(this.row); - self.trigger(self.onCellChange, { - row: this.activeRow, - cell: self._activeCell, - item - }); - }, - undo: function() { - this.editor.applyValue(item, this.prevSerializedValue); - self.updateRow(this.row); - self.trigger(self.onCellChange, { - row: this.activeRow, - cell: self._activeCell, - item - }); - } - }; - if (this._options.editCommandHandler) { - this.makeActiveCellNormal(); - this._options.editCommandHandler(item, column, editCommand); - } else { - editCommand.execute(); - this.makeActiveCellNormal(); - } - } else { - var newItem = {}; - this._currentEditor.applyValue(newItem, this._currentEditor.serializeValue()); - this.makeActiveCellNormal(); - this.trigger(this.onAddNewRow, { item: newItem, column }); - } - return !this.getEditorLock().isActive(); - } else { - this._activeCellNode.classList.remove("invalid"); - this._activeCellNode.offsetWidth; - this._activeCellNode.classList.add("invalid"); - this.trigger(this.onValidationError, { - editor: this._currentEditor, - cellNode: this._activeCellNode, - validationResults, - row: this._activeRow, - cell: this._activeCell, - column - }); - this._currentEditor.focus(); - return false; - } - } - this.makeActiveCellNormal(); - } - return true; - } - cancelCurrentEdit() { - this.makeActiveCellNormal(); - return true; - } - rowsToRanges(rows) { - var ranges = []; - var lastCell = this._cols.length - 1; - for (var i = 0; i < rows.length; i++) { - ranges.push(new Range(rows[i], 0, rows[i], lastCell)); - } - return ranges; - } - getSelectedRows() { - if (!this._selectionModel) { - throw "Selection model is not set"; - } - return this._selectedRows; - } - setSelectedRows(rows) { - if (!this._selectionModel) { - throw "Selection model is not set"; - } - this._selectionModel.setSelectedRanges(this.rowsToRanges(rows)); - } - }; - return __toCommonJS(grid_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.grid.min.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.grid.min.js deleted file mode 100644 index a49c0b3f57..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.grid.min.js +++ /dev/null @@ -1,2 +0,0 @@ -var Slick=Slick||{};Slick._=(()=>{var q=Object.defineProperty;var ze=Object.getOwnPropertyDescriptor;var Ve=Object.getOwnPropertyNames;var We=Object.prototype.hasOwnProperty;var Oe=(a,e)=>{for(var t in e)q(a,t,{get:e[t],enumerable:!0})},Qe=(a,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let o of Ve(e))!We.call(a,o)&&o!==t&&q(a,o,{get:()=>e[o],enumerable:!(i=ze(e,o))||i.enumerable});return a};var Be=a=>Qe(q({},"__esModule",{value:!0}),a);var je={};Oe(je,{BasicLayout:()=>j,Grid:()=>re,gridDefaults:()=>J});var{addClass:A,applyFormatterResultToCellNode:ne,columnDefaults:le,convertCompatFormatter:k,ensureUniqueColumnIds:Xe,escape:M,defaultColumnFormat:B,disableSelection:ae,EventEmitter:p,EventData:he,GlobalEditorLock:de,initializeColumns:ue,H:w,keyCode:Ue,NonDataRow:Ke,parsePx:R,preClickClassName:ce,Range:ge,removeClass:ve,RowCell:qe,spacerDiv:Y,titleize:Ye}=Slick;var J={addNewRowCssClass:"new-row",alwaysAllowHorizontalScroll:!1,alwaysShowVerticalScroll:!1,asyncEditorLoadDelay:100,asyncEditorLoading:!1,asyncPostCleanupDelay:40,asyncPostRenderDelay:-1,autoEdit:!0,autoHeight:!1,cellFlashingCssClass:"flashing",dataItemColumnValueExtractor:null,defaultColumnWidth:80,defaultFormat:B,editable:!1,editorFactory:null,editorLock:de,enableAddRow:!1,enableAsyncPostRender:!1,enableAsyncPostRenderCleanup:!1,enableCellNavigation:!0,enableColumnReorder:!0,enableTabKeyNavigation:!0,enableTextSelectionOnCells:!1,explicitInitialization:!1,footerRowHeight:30,forceFitColumns:!1,forceSyncScrolling:!1,forceSyncScrollInterval:250,formatterFactory:null,fullWidthRows:!1,groupingPanel:!1,groupingPanelHeight:30,headerRowHeight:30,leaveSpaceForNewRows:!1,minBuffer:3,multiColumnSort:!1,multiSelect:!0,renderAllCells:!1,rowHeight:30,selectedCellCssClass:"selected",showCellSelection:!0,showColumnHeader:!0,showFooterRow:!1,showGroupingPanel:!0,showHeaderRow:!1,showTopPanel:!1,suppressActiveCellChangeOnEdit:!1,topPanelHeight:30,useLegacyUI:!0,useCssVars:!1};var j=function(){var a,e,t,i,o,s,r,n,l,h,d;function v(g){a=g;let y=_()+a.getScrollDims().width+"px",b=a.getOptions(),P=b.useLegacyUI?" ui-state-default":"";o=w("div",{class:"slick-header-columns",style:(b.rtl?"right":"left")+":-1000px"});var D=w("div",{class:"slick-header"+P,style:!b.showColumnHeader&&"display: none"},o);f(),s=w("div",{class:"slick-headerrow-columns"}),r=Y(y);var F=w("div",{class:"slick-headerrow"+P,style:!b.showHeaderRow&&"display: none"},s,r);h=w("div",{class:"slick-top-panel",style:"width: 10000px"});var x=w("div",{class:"slick-top-panel-scroller"+P,style:!b.showTopPanel&&"display: none"},h);i=w("div",{class:"grid-canvas",tabIndex:"0",hideFocus:""}),d=w("div",{class:"slick-viewport",tabIndex:"0",hideFocus:""},i),n=w("div",{class:"slick-footerrow-columns"}),l=Y(y);var T=w("div",{class:"slick-footerrow"+P,style:!b.showFooterRow&&"display: none"},n,l);a.getContainerNode().append(D,F,x,d,T)}function u(g,y){y&&i.appendChild(y)}function c(){var g=0,y,b,P=a.getColumns(),D=a.getOptions(),F=D.rtl;if(D.useCssVars)for(var x=a.getContainerNode().style,T=0;T{a=null};function C(){return i}function E(){return[i]}function L(){return e}function S(){return[o]}function I(g){return o.children.item(g)}function Q(){return[s]}function we(g){return s.childNodes.item(g)}function ye(){return s}function be(g){return n.childNodes.item(g)}function Re(){return n}function Ee(){return o}function Le(){return[n]}function He(g){return a.getRowFromNode(g.parentElement)}function Pe(){return h}function Se(){return[h]}function X(){return d}function Te(){return[d]}function Ie(){o.parentElement.scrollLeft=a.getScrollLeft(),h.parentElement.scrollLeft=a.getScrollLeft(),s.parentElement.scrollLeft=a.getScrollLeft(),n.parentElement.scrollLeft=a.getScrollLeft()}function N(){}function Me(){i.style.height=a.getViewportInfo().realScrollHeight+"px"}function Ne(g){return g}function De(){return!1}function Ae(){var g=a.getOptions().alwaysShowVerticalScroll;d.style.overflowX="auto",d.style.overflowY=g?"scroll":a.getOptions().autoHeight?"hidden":"auto"}function Fe(){var g=e;e=_();var y=a.getScrollDims().width;let b=a.getViewportInfo();var P=e+"px";i.style.width=P,s.style.width=P,n.style.width=P,f(),b.hasHScroll=e>a.getViewportInfo().width-y;var D=e+(b.hasVScroll?y:0)+"px";return r.style.width=D,l.style.width=D,e!=g}let xe=()=>{var g=a.getViewportInfo(),y=g.height+g.topPanelHeight+g.headerRowHeight+g.footerRowHeight;a.getOptions().autoHeight?(a.getContainerNode().style.height=y+g.groupingPanelHeight+R(getComputedStyle(o.parentElement).height)+"px",d.style.height=""):d.style.height=g.height+"px"};function U(){return 0}var ke={afterHeaderColumnDrag:N,afterRenderRows:N,afterSetOptions:N,appendCachedRow:u,applyColumnWidths:c,beforeCleanupAndRenderCells:N,bindAncestorScrollEvents:m,calcCanvasWidth:_,updateHeadersWidth:f,isFrozenRow:De,destroy:H,getCanvasNodeFor:C,getCanvasNodes:E,getCanvasWidth:L,getFooterRowCols:Le,getFooterRowColsFor:Re,getFooterRowColumn:be,getHeaderCols:S,getHeaderColsFor:Ee,getHeaderColumn:I,getHeaderRowCols:Q,getHeaderRowColsFor:ye,getHeaderRowColumn:we,getRowFromCellNode:He,getFrozenCols:U,getFrozenRowOffset:U,getFrozenRows:U,getScrollCanvasY:C,getScrollContainerX:X,getScrollContainerY:X,getTopPanelFor:Pe,getTopPanelNodes:Se,getViewportNodeFor:X,getViewportNodes:Te,handleScrollH:Ie,handleScrollV:N,init:v,layoutName:"basic",realScrollHeightChange:Me,reorderViewColumns:Ne,resizeCanvas:xe,setOverflow:Ae,setPaneVisibility:N,setScroller:N,updateCanvasWidth:Fe};return ke};var G=class{constructor(e){this.host=e}findFirstFocusableCell(e){for(var t=0,i=this.host.getColumnCount();t=i)return null;do t+=this.host.getColspan(e,t);while(t=t)return null;for(var o={row:e,cell:i,posX:i},s;;){if(s=this.gotoRight(o.row,o.cell),!s)return null;if(s.cell>=t)return o;o=s}}gotoDown(e,t,i){for(var o,s=this.host.getRowCount();;){if(++e>=s)return null;for(o=t=0;t<=i;)o=t,t+=this.host.getColspan(e,t);if(this.host.canCellBeActive(e,o))return{row:e,cell:o,posX:i}}}gotoUp(e,t,i){for(var o;;){if(--e<0)return null;for(o=t=0;t<=i;)o=t,t+=this.host.getColspan(e,t);if(this.host.canCellBeActive(e,o))return{row:e,cell:o,posX:i}}}gotoNext(e,t,i){if(e==null&&t==null&&(e=t=i=0,this.host.canCellBeActive(e,t)))return{row:e,cell:t,posX:t};var o=this.gotoRight(e,t);if(o)return o;for(var s=null,r=this.host.getRowCount();++ea.scrollTop&&e.topa.scrollLeft&&e.lefte&&r;){var h=(n-e)/r;for(i=0;ie;i++){o=a[i];var d=s[i];if(!(!o.resizable||d<=o.minWidth||d<=t)){var v=Math.max(o.minWidth,t),u=Math.floor(h*(d-v))||1;u=Math.min(u,d-v),n-=u,r-=u,s[i]-=u}}if(l<=n)break;l=n}for(l=n;n=n)break;l=n}var f=!1;for(i=0;i=0;r--)s=a[r],s.resizable&&(l=Math.max(s.minWidth||0,o),n&&s.previousWidth+n=0;r--)s=a[r],s.resizable&&(n&&s.maxWidth&&s.maxWidth-s.previousWidth{var i=this._selectedRows.slice(0);this._selectedRows=[];for(var o={},s=this._cols,r=0;ri.indexOf(u)<0),v=i.filter(u=>this._selectedRows.indexOf(u)<0);this.trigger(this.onSelectedRowsChanged,{rows:this.getSelectedRows(),previousSelectedRows:i,caller:h,changedSelectedRows:d,changedUnselectedRows:v},e)}this._selectedRows=[],o={},s=this._cols;for(var r=0;r{this.updateRowCount(),this.render()};this.viewOnRowsChanged=(e,t)=>{this.invalidateRows(t.rows),this.render(),this.updateGrandTotals()};this.viewOnDataChanged=()=>{this.invalidate(),this.render()};this.resizeCanvas=()=>{this._initialized&&(this.calcViewportSize(),this._layout.resizeCanvas(),(!this._scrollDims||!this._scrollDims.width)&&(this._scrollDims=te(!0)),this._options.forceFitColumns&&this.autosizeColumns(),this.updateRowCount(),this.handleScroll(),this._scrollLeftRendered=-1,this.render())};this.render=()=>{if(this._initialized){var e=this.getVisibleRange(),t=this.getRenderedRange();this.cleanupRows(t),this._scrollLeftRendered!=this._scrollLeft&&(this._layout.beforeCleanupAndRenderCells(t),this.cleanUpAndRenderCells(t)),this.renderRows(t),this._layout.afterRenderRows(t),this._postProcessFromRow=e.top,this._postProcessToRow=Math.min(this.getDataLengthIncludingAddNew()-1,e.bottom),this.startPostProcessing(),this._scrollTopRendered=this._scrollTop,this._scrollLeftRendered=this._scrollLeft,this._lastRenderTime=new Date().getTime(),this._hRender=null}};this.handleHeaderRowScroll=e=>{if(!(this._ignoreScrollUntil>=new Date().getTime())){var t=e.target.scrollLeft;t!=this._layout.getScrollContainerX().scrollLeft&&(this._layout.getScrollContainerX().scrollLeft=t)}};this.handleFooterRowScroll=e=>{if(!(this._ignoreScrollUntil>=new Date().getTime())){var t=e.target.scrollLeft;t!=this._layout.getScrollContainerX().scrollLeft&&(this._layout.getScrollContainerX().scrollLeft=t)}};this.asyncPostProcessRows=()=>{for(var e=this.getDataLength(),t=this._cols;this._postProcessFromRow<=this._postProcessToRow;){var i=this._vScrollDir>=0?this._postProcessFromRow++:this._postProcessToRow--,o=this._rowsCache[i];if(!(!o||i>=e)){this._postProcessedRows[i]||(this._postProcessedRows[i]={}),this.ensureCellNodesInRowsCache(i);for(var s in o.cellNodesByColumnIdx){var r=parseInt(s,10),n=t[r],l=this._postProcessedRows[i][r];if(l!=="R"){if(n.asyncPostRender||n.asyncPostRenderCleanup){var h=o.cellNodesByColumnIdx[r];h&&n.asyncPostRender&&n.asyncPostRender(h,i,this.getDataItem(i),n,l==="C")}this._postProcessedRows[i][r]="R"}}if(this._options.asyncPostRenderDelay>=0){this._hPostRender=setTimeout(this.asyncPostProcessRows,this._options.asyncPostRenderDelay);return}}}};this.handleActiveCellPositionChange=()=>{if(this._activeCellNode&&(this.trigger(this.onActiveCellPositionChanged,{}),this._currentEditor)){var e=this.getActiveCellPosition();this._currentEditor.show&&this._currentEditor.hide&&(e.visible?this._currentEditor.show():this._currentEditor.hide()),this._currentEditor.position&&this._currentEditor.position(e)}};var s,r,n,l;if(this._data=t,this._colDefaults=Object.assign({},le),this._options=o=Object.assign({},J,o),o.jQuery=this._jQuery=o.jQuery===void 0?typeof jQuery!="undefined"?jQuery:void 0:o.jQuery,this._jQuery&&e instanceof this._jQuery?this._container=e[0]:e instanceof Element?this._container=e:typeof e=="string"?this._container=document.querySelector(e):e.length&&(e=e[0]),this._container==null)throw new Error("SleekGrid requires a valid container, "+e+" does not exist in the DOM.");this._container.classList.add("slick-container"),this._emptyNode=(s=o.emptyNode)!=null?s:this._jQuery?function(h){this(h).empty()}.bind(this._jQuery):function(h){h.innerHTML=""},this._removeNode=(r=o.removeNode)!=null?r:this._jQuery?function(h){this(h).remove()}.bind(this._jQuery):function(h){h.remove()},o!=null&&o.createPreHeaderPanel&&(o.groupingPanel==null&&(o.groupingPanel=!0),o.groupingPanelHeight==null&&o.preHeaderPanelHeight!=null&&(o.groupingPanelHeight=o.preHeaderPanelHeight),o.showGroupingPanel==null&&o.showPreHeaderPanel!=null&&(o.showGroupingPanel=o.showPreHeaderPanel)),this._options.rtl=(n=this._options.rtl)!=null?n:document.body.classList.contains("rtl")||typeof getComputedStyle!="undefined"&&getComputedStyle(this._container).direction=="rtl",this._options.rtl?this._container.classList.add("rtl"):this._container.classList.add("ltr"),this.validateAndEnforceOptions(),this._colDefaults.width=o.defaultColumnWidth,this._editController={commitCurrentEdit:this.commitCurrentEdit.bind(this),cancelCurrentEdit:this.cancelCurrentEdit.bind(this)},this._jQuery?this._jQuery(this._container).empty():this._container.innerHTML="",this._container.style.overflow="hidden",this._container.style.outline="0",this._container.classList.add(this._uid),this._options.useLegacyUI&&this._container.classList.add("ui-widget"),/relative|absolute|fixed/.test(getComputedStyle(this._container).position)||(this._container.style.position="relative"),this._container.appendChild(this._focusSink1=w("div",{class:"slick-focus-sink",hideFocus:"",style:"position:fixed;width:0!important;height:0!important;top:0;left:0;outline:0!important;",tabIndex:"0"})),this._layout=(l=o.layoutEngine)!=null?l:new j,this.setInitialCols(i),this._scrollDims=te(),o.groupingPanel&&this.createGroupingPanel(),this._layout.init({cleanUpAndRenderCells:this.cleanUpAndRenderCells.bind(this),bindAncestorScroll:this.bindAncestorScroll.bind(this),getAvailableWidth:this.getAvailableWidth.bind(this),getCellFromPoint:this.getCellFromPoint.bind(this),getColumnCssRules:this.getColumnCssRules.bind(this),getColumns:this.getColumns.bind(this),getContainerNode:this.getContainerNode.bind(this),getDataLength:this.getDataLength.bind(this),getOptions:this.getOptions.bind(this),getRowFromNode:this.getRowFromNode.bind(this),getScrollDims:this.getScrollBarDimensions.bind(this),getScrollLeft:()=>this._scrollLeft,getScrollTop:()=>this._scrollTop,getViewportInfo:()=>this._viewportInfo,renderRows:this.renderRows.bind(this)}),this._container.append(this._focusSink2=this._focusSink1.cloneNode()),o.viewportClass&&this.getViewports().forEach(h=>A(h,o.viewportClass)),o.explicitInitialization||this.init(),this.bindToData()}createGroupingPanel(){this._groupingPanel||!this._focusSink1||(this._focusSink1.insertAdjacentElement("afterend",this._groupingPanel=w("div",{class:"slick-grouping-panel",style:this._options.showGroupingPanel?null:"display: none"})),this._options.createPreHeaderPanel&&this._groupingPanel.appendChild(w("div",{class:"slick-preheader-panel"})))}bindAncestorScroll(e){this._jQuery?this._jQuery(e).on("scroll",this.handleActiveCellPositionChange):e.addEventListener("scroll",this.handleActiveCellPositionChange),this._boundAncestorScroll.push(e)}init(){if(this._initialized)return;this._initialized=!0,this.calcViewportSize(),this.measureCellPaddingAndBorder();var e=this.getViewports();this._jQuery&&!this._options.enableTextSelectionOnCells&&this._jQuery(e).on("selectstart.ui",()=>this._jQuery(this).is("input,textarea")),this._layout.setPaneVisibility(),this._layout.setScroller(),this.setOverflow(),this.updateViewColLeftRight(),this.createColumnHeaders(),this.createColumnFooters(),this.setupColumnSort(),this.createCssRules(),this.resizeCanvas(),this._layout.bindAncestorScrollEvents();let t=(o,s,r)=>{this._jQuery?this._jQuery(o).on(s,r):o.addEventListener(s,r)};t(this._container,"resize",this.resizeCanvas),e.forEach(o=>{var s=!1;t(o,"scroll",r=>{s||(s=!0,window.requestAnimationFrame(()=>{this.handleScroll(),s=!1}))})}),this._jQuery&&this._jQuery.fn.mousewheel&&(this.hasFrozenColumns()||this.hasFrozenRows())&&this._jQuery(e).on("mousewheel",this.handleMouseWheel.bind(this)),this._layout.getHeaderCols().forEach(o=>{ae(o),t(o,"contextmenu",this.handleHeaderContextMenu.bind(this)),t(o,"click",this.handleHeaderClick.bind(this)),this._jQuery?this._jQuery(o).on("mouseenter",".slick-header-column",this.handleHeaderMouseEnter.bind(this)).on("mouseleave",".slick-header-column",this.handleHeaderMouseLeave.bind(this)):(o.addEventListener("mouseenter",s=>s.target.closest(".slick-header-column")&&this.handleHeaderMouseEnter(s)),o.addEventListener("mouseleave",s=>s.target.closest(".slick-header-column")&&this.handleHeaderMouseLeave(s)))}),this._layout.getHeaderRowCols().forEach(o=>{t(o.parentElement,"scroll",this.handleHeaderRowScroll)}),this._layout.getFooterRowCols().forEach(o=>{t(o.parentElement,"scroll",this.handleFooterRowScroll)}),[this._focusSink1,this._focusSink2].forEach(o=>t(o,"keydown",this.handleKeyDown.bind(this)));var i=Array.from(this.getCanvases());i.forEach(o=>{t(o,"keydown",this.handleKeyDown.bind(this)),t(o,"click",this.handleClick.bind(this)),t(o,"dblclick",this.handleDblClick.bind(this)),t(o,"contextmenu",this.handleContextMenu.bind(this))}),this._jQuery&&this._jQuery.fn.drag&&this._jQuery(i).on("draginit",this.handleDragInit.bind(this)).on("dragstart",{distance:3},this.handleDragStart.bind(this)).on("drag",this.handleDrag.bind(this)).on("dragend",this.handleDragEnd.bind(this)),i.forEach(o=>{this._jQuery?this._jQuery(o).on("mouseenter",".slick-cell",this.handleMouseEnter.bind(this)).on("mouseleave",".slick-cell",this.handleMouseLeave.bind(this)):(o.addEventListener("mouseenter",s=>s.target.closest(".slick-cell")&&this.handleMouseEnter(s)),o.addEventListener("mouseleave",s=>s.target.closest(".slick-cell")&&this.handleMouseLeave(s)))}),navigator.userAgent.toLowerCase().match(/webkit/)&&navigator.userAgent.toLowerCase().match(/macintosh/)&&this._jQuery&&this._jQuery(i).on("mousewheel",this.handleMouseWheel.bind(this))}hasFrozenColumns(){return this._layout.getFrozenCols()>0}hasFrozenRows(){return this._layout.getFrozenRows()>0}registerPlugin(e){this._plugins.unshift(e),e.init(this)}unregisterPlugin(e){for(var t=this._plugins.length;t>=0;t--)if(this._plugins[t]===e){this._plugins[t].destroy&&this._plugins[t].destroy(),this._plugins.splice(t,1);break}}getPluginByName(e){for(var t=this._plugins.length-1;t>=0;t--)if(this._plugins[t].pluginName===e)return this._plugins[t]}setSelectionModel(e){this.unregisterSelectionModel(),this._selectionModel=e,this._selectionModel&&(this._selectionModel.init(this),this._selectionModel.onSelectedRangesChanged.subscribe(this.handleSelectedRangesChanged))}unregisterSelectionModel(){var e,t;this._selectionModel&&(this._selectionModel.onSelectedRangesChanged.unsubscribe(this.handleSelectedRangesChanged),(t=(e=this._selectionModel).destroy)==null||t.call(e))}getScrollBarDimensions(){return this._scrollDims}getDisplayedScrollbarDimensions(){return{width:this._viewportInfo.hasVScroll?this._scrollDims.width:0,height:this._viewportInfo.hasHScroll?this._scrollDims.height:0}}getAbsoluteColumnMinWidth(){return this._absoluteColMinWidth}getSelectionModel(){return this._selectionModel}colIdOrIdxToCell(e){return e==null?null:typeof e!="number"?this.getColumnIndex(e):e}getCanvasNode(e,t){return this._layout.getCanvasNodeFor(this.colIdOrIdxToCell(e||0),t||0)}getCanvases(){var e=this._layout.getCanvasNodes();return this._jQuery?this._jQuery(e):e}getActiveCanvasNode(e){return e&&(this._activeCanvasNode=e.target.closest(".grid-canvas")),this._activeCanvasNode}getViewportNode(e,t){return this._layout.getViewportNodeFor(this.colIdOrIdxToCell(e||0),t||0)}getViewports(){return this._layout.getViewportNodes()}getActiveViewportNode(e){return e&&(this._activeViewportNode=e.target.closest(".slick-viewport")),this._activeViewportNode}getAvailableWidth(){return this._viewportInfo.hasVScroll?this._viewportInfo.width-this._scrollDims.width:this._viewportInfo.width}updateCanvasWidth(e){(this._layout.updateCanvasWidth()||e)&&this._layout.applyColumnWidths()}unbindAncestorScrollEvents(){if(this._boundAncestorScroll)for(var e of this._boundAncestorScroll)e.removeEventListener("scroll",this.handleActiveCellPositionChange);this._boundAncestorScroll=[]}updateColumnHeader(e,t,i){if(this._initialized){var o=this.getColumnIndex(e);if(o!=null){var s=this._cols[o],r=this._layout.getHeaderColumn(o);if(r){if(t!==void 0&&(s.name=t),i!==void 0&&(s.toolTip=i),this.trigger(this.onBeforeHeaderCellDestroy,{node:r,column:s}),i!==void 0&&(r.title=i||""),t!==void 0){var n=r.firstElementChild;s.nameIsHtml?n&&(n.innerHTML=t!=null?t:""):n&&(n.textContent=t!=null?t:"")}this.trigger(this.onHeaderCellRendered,{node:r,column:s})}}}}getHeader(){return this._layout.getHeaderCols()[0]}getHeaderColumn(e){var t=this.colIdOrIdxToCell(e);return t==null?null:this._layout.getHeaderColumn(t)}getGroupingPanel(){return this._groupingPanel}getPreHeaderPanel(){var e;return(e=this._groupingPanel)==null?void 0:e.querySelector(".slick-preheader-panel")}getHeaderRow(){return this._layout.getHeaderRowCols()[0]}getHeaderRowColumn(e){var t=this.colIdOrIdxToCell(e);if(t!=null)return this._layout.getHeaderRowColumn(t)}getFooterRow(){return this._layout.getFooterRowCols()[0]}getFooterRowColumn(e){var t=this.colIdOrIdxToCell(e);return t==null?null:this._layout.getFooterRowColumn(t)}createColumnFooters(){var e=this._layout.getFooterRowCols();e.forEach(r=>{r.querySelectorAll(".slick-footerrow-column").forEach(n=>{var l=this.getColumnFromNode(n);l&&this.trigger(this.onBeforeFooterRowCellDestroy,{node:n,column:l})}),this._jQuery?this._jQuery(r).empty():r.innerHTML=""});for(var t=this._cols,i=0;i{m.querySelectorAll(".slick-header-column").forEach(_=>{var f=this.getColumnFromNode(_);f&&this.trigger(this.onBeforeHeaderCellDestroy,{node:_,column:f})}),this._emptyNode(m)}),this._layout.updateHeadersWidth(),this._layout.getHeaderRowCols().forEach(m=>{m.querySelectorAll(".slick-headerrow-column").forEach(_=>{var f=this.getColumnFromNode(_);f&&this.trigger(this.onBeforeHeaderRowCellDestroy,{node:_,column:f,grid:this})}),this._jQuery?this._jQuery(m).empty():m.innerHTML=""});for(var i=this._cols,o=this._layout.getFrozenCols(),s=0;s{var i=t.target;if(!i.classList.contains("slick-resizable-handle")){var o=i.closest(".slick-header-column");if(o){var s=this.getColumnFromNode(o);if(s.sortable){if(!this.getEditorLock().commitCurrentEdit())return;for(var r=null,n=0;n({sortCol:l[this.getInitialColumnIndex(h.columnId)],sortAsc:h.sortAsc}))},t)}}}}};this._layout.getHeaderCols().forEach(t=>{this._jQuery?this._jQuery(t).on("click",e):t.addEventListener("click",e)})}static offset(e){if(!e||!e.getBoundingClientRect)return;let t=e.getBoundingClientRect(),i=document.documentElement;return{top:t.top+window.scrollY-i.clientTop,left:t.left+window.scrollX-i.clientLeft}}setupColumnReorder(){var r;if(typeof Sortable=="undefined")return;(r=this.sortableColInstances)==null||r.forEach(n=>n.destroy());let e=null,t=()=>this._layout.getScrollContainerX().scrollLeft=this._layout.getScrollContainerX().scrollLeft+10,i=()=>this._layout.getScrollContainerX().scrollLeft=this._layout.getScrollContainerX().scrollLeft-10,o,s={animation:50,direction:"horizontal",chosenClass:"slick-header-column-active",ghostClass:"slick-sortable-placeholder",draggable:".slick-header-column",filter:".slick-resizable-handle",preventOnFilter:!1,dragoverBubble:!1,revertClone:!0,scroll:!this.hasFrozenColumns(),onStart:n=>{o=!this.hasFrozenColumns()||a.offset(n.item).left>a.offset(this._layout.getScrollContainerX()).left,o&&n.originalEvent&&n.originalEvent.pageX>this._container.clientWidth?e||(e=setInterval(i,100)):o&&n.originalEvent&&n.originalEvent.pageX{var d;if(clearInterval(e),e=null,!!((d=this.getEditorLock())!=null&&d.commitCurrentEdit())){var h;this._layout.getHeaderCols().forEach((v,u)=>{var c,m,_;return h=ie(this._initCols,(_=(m=(c=this.sortableColInstances[u])==null?void 0:c.toArray)==null?void 0:m.call(c))!=null?_:[])}),this.setColumns(h),this.trigger(this.onColumnsReordered,{}),n.stopPropagation(),this.setupColumnResize(),this._activeCellNode&&this.setFocus()}}};this.sortableColInstances=this._layout.getHeaderCols().map(n=>Sortable.create(n,s))}setupColumnResize(){var s,o,r,n=this._cols,e=[];this._layout.getHeaderCols().forEach(v=>{e=e.concat(Array.from(v.children))});var t,i,o,s,r,l,h,n=this._cols,l,h;if(e.forEach((v,u)=>{var c=v.querySelector(".slick-resizable-handle");c&&this._removeNode(c),n[u].resizable&&(l===void 0&&(l=u),h=u)}),l===void 0)return;let d=!this._jQuery||!this._jQuery.fn||!this._jQuery.fn.drag;e.forEach((v,u)=>{if(u=h)return;let c=v.appendChild(document.createElement("div"));c.classList.add("slick-resizable-handle"),c.draggable=!0;var m=null;let _=C=>{var L;if(!this.getEditorLock().commitCurrentEdit()){!d&&C.preventDefault();return}d&&(m=S=>S.preventDefault(),document.addEventListener("dragover",m)),o=C.pageX,(L=C.target.parentElement)==null||L.classList.add("slick-header-column-active"),e.forEach((S,I)=>{n[I].previousWidth=S.offsetWidth});let E=pe(n,u,o,this._options.forceFitColumns,this._absoluteColMinWidth);r=E.maxPageX,s=E.minPageX,d&&(C.dataTransfer.effectAllowed="move")},f=C=>{if(d){if(!C.pageX&&!C.clientX&&!C.pageY&&!C.clientY)return;C.dataTransfer.effectAllowed="none",C.preventDefault()}Ce(n,u,Math.min(r,Math.max(s,C.pageX))-o,this._options.forceFitColumns,this._absoluteColMinWidth),this._layout.afterHeaderColumnDrag(),this.applyColumnHeaderWidths(),this._options.syncColumnCellResize&&this._layout.applyColumnWidths()},H=C=>{var L;for(m&&(document.removeEventListener("dragover",m),m=null),(L=C.target.parentElement)==null||L.classList.remove("slick-header-column-active"),t=0;t{C.preventDefault(),C.dataTransfer.effectAllowed="move"})):this._jQuery(c).on("dragstart",_).on("drag",f).on("dragend",H)})}columnsResized(e=!0){this.applyColumnHeaderWidths(),this._layout.applyColumnWidths(),e&&this.invalidateAllRows(),this.updateCanvasWidth(!0),this.render(),this.trigger(this.onColumnsResized)}setOverflow(){this._layout.setOverflow(),this._options.viewportClass&&this.getViewports().forEach(e=>A(e,this._options.viewportClass))}measureCellPaddingAndBorder(){let e=["border-left-width","border-right-width","padding-left","padding-right"],t=["border-top-width","border-bottom-width","padding-top","padding-bottom"];var i=this._layout.getHeaderColsFor(0).appendChild(w("div",{class:"slick-header-column"+(this._options.useLegacyUI?" ui-state-default":""),style:"visibility:hidden"}));this._headerColumnWidthDiff=0;var o=getComputedStyle(i);o.boxSizing!="border-box"&&e.forEach(r=>this._headerColumnWidthDiff+=R(o.getPropertyValue(r))||0),i.remove();var s=this._layout.getCanvasNodeFor(0,0).appendChild(w("div",{class:"slick-row"},i=w("div",{class:"slick-cell",id:"",style:"visibility: hidden"})));i.innerHTML="-",this._cellWidthDiff=this._cellHeightDiff=0,o=getComputedStyle(i),o.boxSizing!="border-box"&&(e.forEach(r=>this._cellWidthDiff+=R(o.getPropertyValue(r))||0),t.forEach(r=>this._cellHeightDiff+=R(o.getPropertyValue(r))||0)),s.remove(),this._absoluteColMinWidth=Math.max(this._headerColumnWidthDiff,this._cellWidthDiff)}createCssRules(){var e=this._options.rowHeight-this._cellHeightDiff;if(this._options.useCssVars&&this.getColumns().length>50&&(this._options.useCssVars=!1),this._container.classList.toggle("sleek-vars",!!this._options.useCssVars),this._options.useCssVars){var t=this._container.style;t.setProperty("--sleek-row-height",this._options.rowHeight+"px"),t.setProperty("--sleek-cell-height",e+"px"),t.setProperty("--sleek-top-panel-height",this._options.topPanelHeight+"px"),t.setProperty("--sleek-grouping-panel-height",this._options.groupingPanelHeight+"px"),t.setProperty("--sleek-headerrow-height",this._options.headerRowHeight+"px"),t.setProperty("--sleek-footerrow-height",this._options.footerRowHeight+"px");return}var i=this._styleNode=document.createElement("style");i.dataset.uid=this._uid;for(var o=["."+this._uid+" { --slick-cell-height: "+this._options.rowHeight+"px; }","."+this._uid+" .slick-group-header-column { "+(this._options.rtl?"right":"left")+": 1000px; }","."+this._uid+" .slick-header-column { "+(this._options.rtl?"right":"left")+": 1000px; }","."+this._uid+" .slick-top-panel { height:"+this._options.topPanelHeight+"px; }","."+this._uid+" .slick-grouping-panel { height:"+this._options.groupingPanelHeight+"px; }","."+this._uid+" .slick-headerrow-columns { height:"+this._options.headerRowHeight+"px; }","."+this._uid+" .slick-cell { height:"+e+"px; }","."+this._uid+" .slick-row { height:"+this._options.rowHeight+"px; }","."+this._uid+" .slick-footerrow-columns { height:"+this._options.footerRowHeight+"px; }"],s=this._cols,r=0;rthis._removeNode(r));for(var i in this)if(Object.prototype.hasOwnProperty.call(this,i)){if(i.startsWith("on")){var o=this[i];o!=null&&o.clear&&(o!=null&&o.subscribe)&&(o==null||o.clear())}delete this[i]}}trigger(e,t,i){return i=i||new he,t=t||{},t.grid=this,e.notify(t,i,this)}getEditorLock(){return this._options.editorLock}getEditController(){return this._editController}getColumnById(e){return e?this._cols[this._colById[e]]:null}getColumnIndex(e){return e?this._colById[e]:null}getInitialColumnIndex(e){return e?this._initColById[e]:null}getVisibleColumnById(e){return e?this._cols[this._colById[e]]:null}autosizeColumns(){var e=this._viewportInfo,t=e.hasVScroll?e.width-this._scrollDims.width:e.width,i=me(this._cols,t,this._absoluteColMinWidth);this.applyColumnHeaderWidths(),this.updateCanvasWidth(!0),i&&(this.invalidateAllRows(),this.render())}applyColumnHeaderWidths(){if(this._initialized){for(var e,t=0,i=this._cols,o=i.length,s=this._headerColumnWidthDiff;tt=t.concat(Array.from(i.children))),t.forEach(i=>{i.classList.remove("slick-header-column-sorted");var o=i.querySelector(".slick-sort-indicator");o&&o.classList.remove("slick-sort-indicator-asc","slick-sort-indicator-desc")}),this._sortColumns.forEach(i=>{i.sortAsc==null&&(i.sortAsc=!0);var o=this.getColumnIndex(i.columnId);if(o!=null){var s=t[o];if(s){s.classList.add("slick-header-column-sorted");var r=s.querySelector(".slick-sort-indicator");r&&r.classList.add(i.sortAsc?"slick-sort-indicator-asc":"slick-sort-indicator-desc")}}})}getSortColumns(){return this._sortColumns}getColumns(){return this._cols}getInitialColumns(){return this._initCols}updateViewColLeftRight(){this._colLeft=[],this._colRight=[];for(var e=0,t,i=this._cols,o,s=i.length,r=this._layout.getFrozenCols(),o=0;othis._cols.length&&!e.some(o=>this._cols.indexOf(o)<0)&&!this._cols.some(o=>e.indexOf(o)<0)&&(ie(this._initCols,e.map(o=>o.id)),e=this._initCols),this.setInitialCols(e),this.updateViewColLeftRight(),this._initialized&&(this._layout.setPaneVisibility(),this.setOverflow(),this.invalidateAllRows(),this.createColumnHeaders(),this.createColumnFooters(),this.updateGrandTotals(),this.removeCssRules(),this.createCssRules(),this.resizeCanvas(),this.updateCanvasWidth(),this._layout.applyColumnWidths(),this.handleScroll(),(i=(t=this.getSelectionModel())==null?void 0:t.refreshSelections)==null||i.call(t))}getOptions(){return this._options}setOptions(e,t,i,o){var s;this.getEditorLock().commitCurrentEdit()&&(this.makeActiveCellNormal(),e.groupingPanel&&!this._options.groupingPanel?this.createGroupingPanel():e.groupingPanel!=null&&!e.groupingPanel&&this._groupingPanel&&this._removeNode(this._groupingPanel),e.showColumnHeader!==void 0&&this.setColumnHeaderVisibility(e.showColumnHeader),this._options.enableAddRow!==e.enableAddRow&&this.invalidateRow(this.getDataLength()),this._options=Object.assign(this._options,e),this.validateAndEnforceOptions(),this._layout.afterSetOptions(e),e.columns&&!i&&this.setColumns((s=e.columns)!=null?s:this._initCols),o||this.setOverflow(),this._layout.setScroller(),t||this.render())}validateAndEnforceOptions(){this._options.autoHeight&&(this._options.leaveSpaceForNewRows=!1)}bindToData(){this._data&&(this._data.onRowCountChanged&&this._data.onRowCountChanged.subscribe(this.viewOnRowCountChanged),this._data.onRowsChanged&&this._data.onRowsChanged.subscribe(this.viewOnRowsChanged),this._data.onDataChanged&&this._data.onDataChanged.subscribe(this.viewOnDataChanged))}unbindFromData(){this._data&&(this._data.onRowCountChanged&&this._data.onRowCountChanged.unsubscribe(this.viewOnRowCountChanged),this._data.onRowsChanged&&this._data.onRowsChanged.unsubscribe(this.viewOnRowsChanged),this._data.onDataChanged&&this._data.onDataChanged.unsubscribe(this.viewOnDataChanged))}setData(e,t){this.unbindFromData(),this._data=e,this.bindToData(),this.invalidateAllRows(),this.updateRowCount(),t&&this.scrollTo(0)}getData(){return this._data}getDataLength(){return this._data.getLength?this._data.getLength():this._data.length}getDataLengthIncludingAddNew(){return this.getDataLength()+(this._options.enableAddRow&&(!this._pagingActive||this._pagingIsLastPage)?1:0)}getDataItem(e){return this._data.getItem?this._data.getItem(e):this._data[e]}getTopPanel(){return this._layout.getTopPanelFor(0)}setTopPanelVisibility(e){this._options.showTopPanel!=e&&(this._options.showTopPanel=!!e,this._layout.getTopPanelNodes().forEach(t=>{this._jQuery?this._jQuery(t)[e?"slideDown":"slideUp"]("fast",this.resizeCanvas):(t.style.display=e?"":"none",this.resizeCanvas())}))}setColumnHeaderVisibility(e,t){this._options.showColumnHeader!=e&&(this._options.showColumnHeader=e,this._layout.getHeaderCols().forEach(i=>{let o=i.parentElement;t&&this._jQuery?this._jQuery(o)[e?"slideDown":"slideUp"]("fast",this.resizeCanvas):(o.style.display=e?"":"none",this.resizeCanvas())}))}setFooterRowVisibility(e){this._options.showFooterRow!=e&&(this._options.showFooterRow=!!e,this._layout.getFooterRowCols().forEach(t=>{let i=t.parentElement;this._jQuery?this._jQuery(i)[e?"slideDown":"slideUp"]("fast",this.resizeCanvas):(i.style.display=e?"":"none",this.resizeCanvas())}))}setGroupingPanelVisibility(e){if(this._options.showGroupingPanel!=e){if(this._options.showGroupingPanel=e,!this._options.groupingPanel)return;let t=this._groupingPanel;this._jQuery?this._jQuery(t)[e?"slideDown":"slideUp"]("fast",this.resizeCanvas):(t.style.display=e?"":"none",this.resizeCanvas())}}setPreHeaderPanelVisibility(e){this.setGroupingPanelVisibility(e)}setHeaderRowVisibility(e){this._options.showHeaderRow!=e&&(this._options.showHeaderRow=e,this._layout.getHeaderRowCols().forEach(t=>{let i=t.parentElement;this._jQuery?this._jQuery(i)[e?"slideDown":"slideUp"]("fast",this.resizeCanvas):(i.style.display=e?"":"none",this.resizeCanvas())}))}getContainerNode(){return this._container}getUID(){return this._uid}getRowTop(e){return this._options.rowHeight*e-this._pageOffset}getRowFromPosition(e){return Math.floor((e+this._pageOffset)/this._options.rowHeight)}scrollTo(e){let t=this._viewportInfo;e=Math.max(e,0),e=Math.min(e,t.virtualHeight-Math.round(this._layout.getScrollContainerY().clientHeight)+(t.hasHScroll||this.hasFrozenColumns()?this._scrollDims.height:0));var i=this._pageOffset;this._page=Math.min(this._numberOfPages-1,Math.floor(e/this._pageHeight)),this._pageOffset=Math.round(this._page*this._jumpinessCoefficient);var o=e-this._pageOffset;if(this._pageOffset!=i){var s=this.getVisibleRange(o);this.cleanupRows(s),this.updateRowPositions()}this._scrollTopPrev!=o&&(this._vScrollDir=this._scrollTopPrev+i";e.push(v);let u=this._layout.getFrozenCols();u&&t.push(v);for(var c,m,_=this._cols,f=0,H=_.length;fo.leftPx){if(this._colLeft[f]>o.rightPx)break;this.appendCellHtml(u>0&&f>=u?t:e,i,f,c,r,C)}c>1&&(f+=c-1)}e.push(""),u&&t.push("")}appendCellHtml(e,t,i,o,s,r){var E,L,S,I,Q;var n=this._cols,l=this._layout.getFrozenCols(),h=n[i],d="slick-cell l"+i+" r"+Math.min(n.length-1,i+o-1)+(h.cssClass?" "+h.cssClass:"");i"+u+""):e.push(">")}else u!=null&&!(u instanceof Node)?e.push('
'+u+"
"):e.push('
');var C=this._rowsCache[t];C.cellRenderQueue.push(i),C.cellRenderContent.push(u instanceof Node?u:void 0),this._rowsCache[t].cellColSpans[i]=o}cleanupRows(e){var t;for(var i in this._rowsCache)t=parseInt(i,10),t!==this._activeRow&&(te.bottom)&&!this._layout.isFrozenRow(t)&&this.removeRowFromCache(t);this.startPostProcessingCleanup()}invalidate(){this.updateRowCount(),this.invalidateAllRows(),this.render(),this.updateGrandTotals()}invalidateAllRows(){this._currentEditor&&this.makeActiveCellNormal();for(var e in this._rowsCache)this.removeRowFromCache(parseInt(e,10));this.startPostProcessingCleanup()}queuePostProcessedRowForCleanup(e,t){var r,n;var i=this._postProcessedRows[t];if(i){this._postProcessGroupId++;for(var o in i){var s=parseInt(o,10);this._postProcessCleanupQueue.push({groupId:this._postProcessGroupId,cellNode:e.cellNodesByColumnIdx[s|0],columnIdx:s|0,rowIdx:t})}this._postProcessCleanupQueue.push({groupId:this._postProcessGroupId,rowNodeL:e.rowNodeL,rowNodeR:e.rowNodeR}),(r=e.rowNodeL)==null||r.remove(),(n=e.rowNodeR)==null||n.remove()}}queuePostProcessedCellForCleanup(e,t,i){this._postProcessCleanupQueue.push({groupId:this._postProcessGroupId,cellNode:e,columnIdx:t,rowIdx:i}),e.remove()}removeRowFromCache(e){var i,o,s,r;var t=this._rowsCache[e];t&&(this._postCleanupActive&&this._postProcessedRows[e]?this.queuePostProcessedRowForCleanup(t,e):((o=(i=t.rowNodeL)==null?void 0:i.parentElement)==null||o.removeChild(t.rowNodeL),(r=(s=t.rowNodeR)==null?void 0:s.parentElement)==null||r.removeChild(t.rowNodeR)),delete this._rowsCache[e],delete this._postProcessedRows[e])}invalidateRows(e){var t,i;if(!(!e||!e.length)){for(this._vScrollDir=0,t=0,i=e.length;tt.width&&(t.height+=this._scrollDims.height);else{var i=getComputedStyle(this._container);t.height=R(i.height)-R(i.paddingTop)-R(i.paddingBottom)-t.headerHeight-t.topPanelHeight-t.headerRowHeight-t.footerRowHeight-t.groupingPanelHeight}t.numVisibleRows=Math.ceil(t.height/this._options.rowHeight)}updatePagingStatusFromView(e){this._pagingActive=e.pageSize!==0,this._pagingIsLastPage=e.pageNum==e.totalPages-1}updateRowCount(){if(!this._initialized)return;var e=this.getDataLengthIncludingAddNew(),t=this._layout.getScrollCanvasY(),i=Math.round(R(getComputedStyle(t).height)),o;let s=this._layout.getFrozenRows();s?o=this.getDataLength()-s:o=e+(this._options.leaveSpaceForNewRows?this._viewportInfo.numVisibleRows-1:0);var r=Math.round(R(getComputedStyle(this._layout.getScrollContainerY()).height));let n=this._viewportInfo;var l=n.hasVScroll;n.hasVScroll=!this._options.autoHeight&&o*this._options.rowHeight>r,this.makeActiveCellNormal();var h=e-1;for(var d in this._rowsCache){var v=parseInt(d,10);v>=h&&this.removeRowFromCache(v)}this.startPostProcessingCleanup(),n.virtualHeight=Math.max(this._options.rowHeight*o,r-this._scrollDims.height),this._activeCellNode&&this._activeRow>h&&this.resetActiveCell(),n.virtualHeighte.rightPx||this._colRight[Math.min(h.length-1,n+l-1)]e.rightPx);m++){if((r=t.cellColSpans[m])!=null){m+=r>1?r-1:0;continue}var f=null;r=1,u&&(f=u[n[m].id]||u[m],r=f&&f.colspan||1,r==="*"&&(r=_-m)),this._colRight[Math.min(_-1,m+r-1)]>e.leftPx&&(this.appendCellHtml(i,h,m,r,c,f),s++),m+=r>1?r-1:0}s&&o.push(h)}if(i.length){var H=document.createElement("div");H.innerHTML=i.join("");for(var C,E,L=this._layout.getFrozenCols();(C=o.pop())!=null;){t=this._rowsCache[C];for(var S;(S=t.cellRenderQueue.pop())!=null;){var I=t.cellRenderContent.pop();E=H.lastElementChild,I instanceof Node&&E.appendChild(I),L>0&&S>=L?t.rowNodeR.appendChild(E):t.rowNodeL.appendChild(E),t.cellNodesByColumnIdx[S]=E}}}}renderRows(e){for(var t=[],i=[],o=[],s=!1,r=this.getDataLength(),n=e.top,l=e.bottom;n<=l;n++)this._rowsCache[n]||this.hasFrozenRows()&&this._options.frozenBottom&&n==r||(o.push(n),this._rowsCache[n]={rowNodeL:null,rowNodeR:null,cellColSpans:[],cellNodesByColumnIdx:[],cellRenderQueue:[],cellRenderContent:[]},this.appendRowHtml(t,i,n,e,r),this._activeCellNode&&this._activeRow===n&&(s=!0));if(!o.length)return;var h=document.createElement("div"),d=document.createElement("div");h.innerHTML=t.join(""),d.innerHTML=i.join("");let v=this._layout;for(var n=0,l=o.length;nf instanceof Node)&&this.ensureCellNodesInRowsCache(u)}s&&(this._activeCellNode=this.getCellNode(this._activeRow,this._activeCell))}startPostProcessing(){this._postRenderActive&&(clearTimeout(this._hPostRender),this._options.asyncPostRenderDelay<0?this.asyncPostProcessRows():this._hPostRender=setTimeout(this.asyncPostProcessRows,this._options.asyncPostRenderDelay))}startPostProcessingCleanup(){this._postCleanupActive&&(clearTimeout(this._hPostRenderCleanup),this._options.asyncPostCleanupDelay<0?this.asyncPostProcessCleanupRows():this._hPostRenderCleanup=setTimeout(this.asyncPostProcessCleanupRows.bind(this),this._options.asyncPostCleanupDelay))}invalidatePostProcessingResults(e){if(this._options.enableAsyncPostRenderCleanup){var t=this._postProcessedRows[e];if(t)for(var i in t)t[i]="C"}else delete this._postProcessedRows[e];this._postProcessFromRow=Math.min(this._postProcessFromRow,e),this._postProcessToRow=Math.max(this._postProcessToRow,e),this.startPostProcessing()}updateRowPositions(){for(var e in this._rowsCache){var t=this._rowsCache[e],i=this.getRowTop(parseInt(e,10))+"px";t.rowNodeL&&(t.rowNodeL.style.top=i),t.rowNodeR&&(t.rowNodeR.style.top=i)}}updateGrandTotals(){var r,n;if(!(!this._options.showFooterRow||!this._initialized)){var e;this._data&&this._data.getGrandTotals&&(e=this._data.getGrandTotals()),e=e!=null?e:{};var t=this._cols;for(var i of t)if(i.id!=null){var o=(r=i.groupTotalsFormatter)!=null?r:this._options.groupTotalsFormatter;if(!o)continue;var s=(n=o(e,i,this))!=null?n:"";this.getFooterRowColumn(i.id).innerHTML=s}}}groupTotalsFormatter(e,t,i){return this._options.groupTotalsFormatter?this._options.groupTotalsFormatter(e,t,i!=null?i:this):""}handleMouseWheel(e,t,i,o){var s,r;i=(typeof i=="undefined"?(s=e.originalEvent)==null?void 0:s.deltaX:i)||0,o=(typeof o=="undefined"?(r=e.originalEvent)==null?void 0:r.deltaY:o)||0,this._scrollTop=Math.max(0,this._layout.getScrollContainerY().scrollTop-o*this._options.rowHeight),this._scrollLeft=this._layout.getScrollContainerX().scrollLeft+i*10,this.handleScroll(!0)}handleScroll(e){this._scrollTop=this._layout.getScrollContainerY().scrollTop,this._scrollLeft=this._layout.getScrollContainerX().scrollLeft;var t=Math.abs(this._scrollTop-this._scrollTopPrev),i=Math.abs(this._scrollLeft-this._scrollLeftPrev);(i||t)&&(this._ignoreScrollUntil=new Date().getTime()+100),i&&(this._scrollLeftPrev=this._scrollLeft,this._layout.getScrollContainerX().scrollLeft=this._scrollLeft,this._layout.handleScrollH());let o=this._viewportInfo;if(t)if(this._vScrollDir=this._scrollTopPrev20||Math.abs(this._scrollLeftRendered-this._scrollLeft)>20)&&(this._options.forceSyncScrolling||this._options.forceSyncScrollInterval&&this._lastRenderTime0;){for(var t=this._postProcessCleanupQueue[0].groupId;this._postProcessCleanupQueue.length>0&&this._postProcessCleanupQueue[0].groupId==t;){var i=this._postProcessCleanupQueue.shift();if(i.rowNodeL&&i.rowNodeL.remove(),i.rowNodeR&&i.rowNodeR.remove(),i.cellNode!=null){var o=e[i.columnIdx];o&&o.asyncPostRenderCleanup&&(o.asyncPostRenderCleanup(i.cellNode,i.rowIdx,o),this._removeNode(i.cellNode))}}if(this._options.asyncPostRenderDelay>=0){this._hPostRenderCleanup=setTimeout(this.asyncPostProcessCleanupRows.bind(this),this._options.asyncPostCleanupDelay);return}}}updateCellCssStylesOnRenderedRows(e,t){var i,o,s,r;for(var n in this._rowsCache){if(r=t&&t[n],s=e&&e[n],r){for(o in r)if((!s||r[o]!=s[o])&&(i=this.getCellNode(parseInt(n,10),this.getColumnIndex(o)),i)){let l=r[o];ve(i,l)}}if(s){for(o in s)if((!r||r[o]!=s[o])&&(i=this.getCellNode(parseInt(n,10),this.getColumnIndex(o)),i)){let l=s[o];A(i,l)}}}}addCellCssStyles(e,t){if(this._cellCssClasses[e])throw"addCellCssStyles: cell CSS hash with key '"+e+"' already exists.";this._cellCssClasses[e]=t,this.updateCellCssStylesOnRenderedRows(t,null),this.trigger(this.onCellCssStylesChanged,{key:e,hash:t})}removeCellCssStyles(e){this._cellCssClasses[e]&&(this.updateCellCssStylesOnRenderedRows(null,this._cellCssClasses[e]),delete this._cellCssClasses[e],this.trigger(this.onCellCssStylesChanged,{key:e,hash:null}))}setCellCssStyles(e,t){var i=this._cellCssClasses[e];this._cellCssClasses[e]=t,this.updateCellCssStylesOnRenderedRows(t,i),this.trigger(this.onCellCssStylesChanged,{key:e,hash:t})}getCellCssStyles(e){return this._cellCssClasses[e]}flashCell(e,t,i){if(i=i||100,this._rowsCache[e]){var o=this._jQuery(this.getCellNode(e,t));r(4)}var s=this._options.cellFlashingCssClass;function r(n){n&&setTimeout(function(){o.queue(function(){o.toggleClass(s).dequeue(),r(n-1)})},i)}}handleDragInit(e,t){var i=this.getCellFromEvent(e);if(!i||!this.cellExists(i.row,i.cell))return!1;var o=this.trigger(this.onDragInit,t,e);return e.isImmediatePropagationStopped&&e.isImmediatePropagationStopped()?o:!1}handleDragStart(e,t){var i=this.getCellFromEvent(e);if(!i||!this.cellExists(i.row,i.cell))return!1;var o=this.trigger(this.onDragStart,t,e);return e.isImmediatePropagationStopped&&e.isImmediatePropagationStopped()?o:!1}handleDrag(e,t){return this.trigger(this.onDrag,t,e)}handleDragEnd(e,t){this.trigger(this.onDragEnd,t,e)}handleKeyDown(e){this.trigger(this.onKeyDown,{row:this._activeRow,cell:this._activeCell},e);var t=e.isImmediatePropagationStopped&&e.isImmediatePropagationStopped();if(!t&&!e.shiftKey&&!e.altKey){if(this._options.editable&&this._currentEditor&&this._currentEditor.keyCaptureList&&this._currentEditor.keyCaptureList.indexOf(e.which)>=0)return;e.key==="Home"?e.ctrlKey?(this.navigateTop(),t=!0):t=this.navigateRowStart():e.key==="End"&&(e.ctrlKey?(this.navigateBottom(),t=!0):t=this.navigateRowEnd())}if(!t)if(!e.shiftKey&&!e.altKey&&!e.ctrlKey){if(this._options.editable&&this._currentEditor&&this._currentEditor.keyCaptureList&&this._currentEditor.keyCaptureList.indexOf(e.which)>=0)return;if(e.key==="Esc"||e.key==="Escape"){if(!this.getEditorLock().isActive())return;this.cancelEditAndSetFocus()}else e.key==="PageDown"?(this.navigatePageDown(),t=!0):e.key==="PageUp"?(this.navigatePageUp(),t=!0):e.key==="Left"||e.key==="ArrowLeft"?t=this.navigateLeft():e.key==="Right"||e.key==="ArrowRight"?t=this.navigateRight():e.key==="Up"||e.key==="ArrowUp"?t=this.navigateUp():e.key==="Down"||e.key==="ArrowDown"?t=this.navigateDown():e.key==="Tab"?this._options.enableTabKeyNavigation&&(t=this.navigateNext()):e.key==="Enter"&&(this._options.editable&&(this._currentEditor?this._activeRow===this.getDataLength()?this.navigateDown():this.commitEditAndSetFocus():this.getEditorLock().commitCurrentEdit()&&this.makeActiveCellEditable()),t=!0)}else e.key==="Tab"&&e.shiftKey&&!e.ctrlKey&&!e.altKey&&(t=this.navigatePrev());if(t){e.stopPropagation(),e.preventDefault();try{e.originalEvent.keyCode=0}catch(i){}}}handleClick(e){var r,n,l;this._currentEditor||(e.target!=document.activeElement||(l=(n=(r=e.target)==null?void 0:r.classList)==null?void 0:n.contains)!=null&&l.call(n,"slick-cell"))&&this.setFocus();var t=this.getCellFromEvent(e);if(!(!t||this._currentEditor!=null&&this._activeRow==t.row&&this._activeCell==t.cell)&&(this.trigger(this.onClick,{row:t.row,cell:t.cell},e),!(e.isImmediatePropagationStopped&&e.isImmediatePropagationStopped())&&this.canCellBeActive(t.row,t.cell)&&(!this.getEditorLock().isActive()||this.getEditorLock().commitCurrentEdit()))){var i=e.target&&e.target.classList.contains(ce),o=this._cols[t.cell],s=!!(this._options.editable&&o&&o.editor&&this._options.suppressActiveCellChangeOnEdit);this.setActiveCellInternal(this.getCellNode(t.row,t.cell),null,i,s,e)}}handleContextMenu(e){var t=e.target.closest(".slick-cell");t&&(this._activeCellNode===t&&this._currentEditor!=null||this.trigger(this.onContextMenu,{},e))}handleDblClick(e){var t=this.getCellFromEvent(e);!t||this._currentEditor!=null&&this._activeRow==t.row&&this._activeCell==t.cell||(this.trigger(this.onDblClick,{row:t.row,cell:t.cell},e),!(e.isImmediatePropagationStopped&&e.isImmediatePropagationStopped())&&this._options.editable&&this.gotoCell(t.row,t.cell,!0))}handleHeaderMouseEnter(e){let t=this.getColumnFromNode(e.target);t&&this.trigger(this.onHeaderMouseEnter,{column:t},e)}handleHeaderMouseLeave(e){let t=this.getColumnFromNode(e.target);t&&this.trigger(this.onHeaderMouseLeave,{column:t},e)}handleHeaderContextMenu(e){var t=e.target.closest(".slick-header-column"),i=this.getColumnFromNode(t);i&&this.trigger(this.onHeaderContextMenu,{column:i},e)}handleHeaderClick(e){var t=e.target.closest(".slick-header-column"),i=this.getColumnFromNode(t);i&&this.trigger(this.onHeaderClick,{column:i},e)}handleMouseEnter(e){this.trigger(this.onMouseEnter,{},e)}handleMouseLeave(e){this.trigger(this.onMouseLeave,{},e)}cellExists(e,t){return!(e<0||e>=this.getDataLength()||t<0||t>=this._cols.length)}getCellFromPoint(e,t){for(var i=this.getRowFromPosition(t),o=0,s=this._cols,r=0,n=0;n1?o-1:0)])}}scrollColumnIntoView(e){this.internalScrollColumnIntoView(this._colLeft[e],this._colRight[e])}internalScrollColumnIntoView(e,t){var i=this._scrollLeft+R(getComputedStyle(this._layout.getScrollContainerX()).width)-(this._viewportInfo.hasVScroll?this._scrollDims.width:0),o;if(ei)o=Math.min(e,t-this._layout.getScrollContainerX().clientWidth);else return;this._layout.getScrollContainerX().scrollLeft=o,this.handleScroll(),this.render()}setActiveCellInternal(e,t,i,o,s){var v,u;if(this._activeCellNode!=null){this.makeActiveCellNormal(),this._activeCellNode.classList.remove("active");var r=this._rowsCache[this._activeRow];r&&(r.rowNodeL&&r.rowNodeL.classList.remove("active"),r.rowNodeR&&r.rowNodeR.classList.remove("active"))}if(this._activeCellNode=e,this._activeCellNode!=null){var n=this._activeCellNode.getBoundingClientRect(),l=Math.floor((u=(v=this._activeCellNode.closest(".grid-canvas"))==null?void 0:v.getBoundingClientRect().top)!=null?u:0+document.body.scrollTop),h=this._activeCellNode.closest(".grid-canvas-bottom")!=null;this.hasFrozenRows()&&h&&(l-=this._options.frozenBottom?Math.round(R(getComputedStyle(this._layout.getCanvasNodeFor(0,0)).height)):this._layout.getFrozenRows()*this._options.rowHeight);var d=this.getCellFromPoint(n[this._options.rtl?"right":"left"]+document.body.scrollLeft,Math.ceil(n.top+document.body.scrollTop)-l);if(this._activeRow=d.row,this._activeCell=this._activePosX=this.getCellFromNode(this._activeCellNode),this._options.showCellSelection){this._activeCellNode.classList.add("active");var r=this._rowsCache[this._activeRow];r&&(r.rowNodeL&&r.rowNodeL.classList.add("active"),r.rowNodeR&&r.rowNodeR.classList.add("active"))}t==null&&(t=this._activeRow==this.getDataLength()||this._options.autoEdit),this._options.editable&&t&&this.isCellPotentiallyEditable(this._activeRow,this._activeCell)&&(clearTimeout(this._hEditorLoader),this._options.asyncEditorLoading?this._hEditorLoader=setTimeout(()=>{this.makeActiveCellEditable(void 0,i,s)},this._options.asyncEditorLoadDelay):this.makeActiveCellEditable(void 0,i,s))}else this._activeRow=this._activeCell=null;o||this.trigger(this.onActiveCellChanged,this.getActiveCell())}clearTextSelection(){if(document.selection&&document.selection.empty)try{document.selection.empty()}catch(t){}else if(window.getSelection){var e=window.getSelection();e&&e.removeAllRanges&&e.removeAllRanges()}}isCellPotentiallyEditable(e,t){var i=this.getDataLength();return!(e=i||!this.getEditor(e,t))}makeActiveCellNormal(){this._currentEditor&&(this.trigger(this.onBeforeCellEditorDestroy,{editor:this._currentEditor}),this._currentEditor.destroy(),this._currentEditor=null,this._activeCellNode&&(this._activeCellNode.classList.remove("editable","invalid"),this.updateCellWithFormatter(this._activeCellNode,this._activeRow,this._activeCell),this.invalidatePostProcessingResults(this._activeRow)),navigator.userAgent.toLowerCase().match(/msie/)&&this.clearTextSelection(),this.getEditorLock().deactivate(this._editController))}editActiveCell(e){this.makeActiveCellEditable(e)}makeActiveCellEditable(e,t,i){if(this._activeCellNode){if(!this._options.editable)throw"Grid : makeActiveCellEditable : should never get called when options.editable is false";if(clearTimeout(this._hEditorLoader),!!this.isCellPotentiallyEditable(this._activeRow,this._activeCell)){var o=this._cols[this._activeCell],s=this.getDataItem(this._activeRow);if(this.trigger(this.onBeforeEditCell,{row:this._activeRow,cell:this._activeCell,item:s,column:o})===!1){this.setFocus();return}this.getEditorLock().activate(this._editController),this._activeCellNode.classList.add("editable");var r=e||this.getEditor(this._activeRow,this._activeCell);!e&&!r.suppressClearOnEdit&&(this._activeCellNode.innerHTML="");var n=this._data.getItemMetadata&&this._data.getItemMetadata(this._activeRow),l=n&&n.columns,h=l&&(l[o.id]||l[this._activeCell]);this._currentEditor=new r({grid:this,gridPosition:O(this._container),position:O(this._activeCellNode),container:this._activeCellNode,column:o,columnMetaData:h,item:s||{},event:i,editorCellNavOnLRKeys:this._options.editorCellNavOnLRKeys,commitChanges:this.commitEditAndSetFocus.bind(this),cancelChanges:this.cancelEditAndSetFocus.bind(this)}),s&&(this._currentEditor.loadValue(s),t&&this._currentEditor.preClick&&this._currentEditor.preClick()),this._serializedEditorValue=this._currentEditor.serializeValue(),this._currentEditor.position&&this.handleActiveCellPositionChange()}}}commitEditAndSetFocus(){this.getEditorLock().commitCurrentEdit()&&(this.setFocus(),this._options.autoEdit&&this.navigateDown())}cancelEditAndSetFocus(){this.getEditorLock().cancelCurrentEdit()&&this.setFocus()}getActiveCellPosition(){return O(this._activeCellNode)}getGridPosition(){return O(this._container)}getCellEditor(){return this._currentEditor}getActiveCell(){return this._activeCellNode?{row:this._activeRow,cell:this._activeCell}:null}getActiveCellNode(){return this._activeCellNode}scrollActiveCellIntoView(){this._activeRow!=null&&this._activeCell!=null&&this.scrollCellIntoView(this._activeRow,this._activeCell)}scrollRowIntoView(e,t){if(!this._layout.isFrozenRow(e)){var i=Math.round(R(getComputedStyle(this._layout.getScrollContainerY()).height)),o=this.hasFrozenRows()&&!this._options.frozenBottom?e-this._layout.getFrozenRows()+1:e,s=o*this._options.rowHeight,r=(o+1)*this._options.rowHeight-i+(this._viewportInfo.hasHScroll?this._scrollDims.height:0);(o+1)*this._options.rowHeight>this._scrollTop+i+this._pageOffset?(this.scrollTo(t?s:r),this.render()):o*this._options.rowHeight=o&&(i=o-1),i<0&&(i=0);for(var s=0,r=null,n=this._activePosX;s<=this._activePosX;)this.canCellBeActive(i,s)&&(r=s),s+=this.getColspan(i,s);r!=null?(this.setActiveCellInternal(this.getCellNode(i,r)),this._activePosX=n):this.resetActiveCell()}}navigatePageDown(){this.scrollPage(1)}navigatePageUp(){this.scrollPage(-1)}navigateTop(){this.navigateToRow(0)}navigateBottom(){this.navigateToRow(this.getDataLength()-1)}navigateToRow(e){var t=this.getDataLength();if(!t)return!0;if(e<0?e=0:e>=t&&(e=t-1),this.scrollCellIntoView(e,0,!0),this._options.enableCellNavigation&&this._activeRow!=null){for(var i=0,o=null,s=this._activePosX;i<=this._activePosX;)this.canCellBeActive(e,i)&&(o=i),i+=this.getColspan(e,i);o!=null?(this.setActiveCellInternal(this.getCellNode(e,o)),this._activePosX=s):this.resetActiveCell()}return!0}getColspan(e,t){var i=this._data.getItemMetadata&&this._data.getItemMetadata(e);if(!i||!i.columns)return 1;var o=this._cols,s=o[t]&&(i.columns[o[t].id]||i.columns[t]),r=s&&s.colspan;return r==="*"?r=o.length-t:r=r||1,r}navigateRight(){return this.navigate("right")}navigateLeft(){return this.navigate("left")}navigateDown(){return this.navigate("down")}navigateUp(){return this.navigate("up")}navigateNext(){return this.navigate("next")}navigatePrev(){return this.navigate("prev")}navigateRowStart(){return this.navigate("home")}navigateRowEnd(){return this.navigate("end")}navigate(e){if(!this._options.enableCellNavigation||!this._activeCellNode&&e!="prev"&&e!="next")return!1;if(!this.getEditorLock().commitCurrentEdit())return!0;this.setFocus(),this._cellNavigator||(this._cellNavigator=new G({getColumnCount:()=>this._cols.length,getRowCount:()=>this.getDataLengthIncludingAddNew(),getColspan:this.getColspan.bind(this),canCellBeActive:this.canCellBeActive.bind(this),setTabbingDirection:o=>this._tabbingDirection=o,isRTL:()=>this._options.rtl}));var t=this._cellNavigator.navigate(e,this._activeRow,this._activeCell,this._activePosX);if(t){if(this.hasFrozenRows()&&this._options.frozenBottom&&t.row==this.getDataLength())return;var i=t.row==this.getDataLength();return this._layout.isFrozenRow(t.row)||this.scrollCellIntoView(t.row,t.cell,!i),this.setActiveCellInternal(this.getCellNode(t.row,t.cell)),this._activePosX=t.posX,!0}else return this.setActiveCellInternal(this.getCellNode(this._activeRow,this._activeCell)),!1}getCellNode(e,t){return this._rowsCache[e]?(this.ensureCellNodesInRowsCache(e),this._rowsCache[e].cellNodesByColumnIdx[t]):null}setActiveCell(e,t){if(this._initialized){var i=this._cols;e>this.getDataLength()||e<0||t>=i.length||t<0||this._options.enableCellNavigation&&(this.scrollCellIntoView(e,t,!1),this.setActiveCellInternal(this.getCellNode(e,t),!1))}}setActiveRow(e,t,i){this._initialized&&(e>this.getDataLength()||e<0||t>=this._cols.length||t<0||(this._activeRow=e,i||this.scrollCellIntoView(e,t||0,!1)))}canCellBeActive(e,t){var i=this._cols;if(!this._options.enableCellNavigation||e>=this.getDataLengthIncludingAddNew()||e<0||t>=i.length||t<0)return!1;var o=this._data.getItemMetadata&&this._data.getItemMetadata(e);if(o&&typeof o.focusable=="boolean")return o.focusable;var s=o&&o.columns;return s&&i[t]&&s[i[t].id]&&typeof s[i[t].id].focusable=="boolean"?s[i[t].id].focusable:s&&s[t]&&typeof s[t].focusable=="boolean"?s[t].focusable:i[t].focusable}canCellBeSelected(e,t){var i=this._cols;if(e>=this.getDataLength()||e<0||t>=i.length||t<0)return!1;var o=this._data.getItemMetadata&&this._data.getItemMetadata(e);if(o&&typeof o.selectable=="boolean")return o.selectable;var s=o&&o.columns&&(o.columns[i[t].id]||o.columns[t]);return s&&typeof s.selectable=="boolean"?s.selectable:i[t].selectable}gotoCell(e,t,i){if(this._initialized&&this.canCellBeActive(e,t)&&this.getEditorLock().commitCurrentEdit()){this.scrollCellIntoView(e,t,!1);var o=this.getCellNode(e,t);this.setActiveCellInternal(o,i||e===this.getDataLength()||this._options.autoEdit),this._currentEditor||this.setFocus()}}commitCurrentEdit(){var e=this.getDataItem(this._activeRow),t=this._cols[this._activeCell],i=this;if(this._currentEditor){if(this._currentEditor.isValueChanged()){var o=this._currentEditor.validate();if(o.valid){if(this._activeRow Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.groupitemmetadataprovider.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.groupitemmetadataprovider.js deleted file mode 100644 index b432e048ad..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.groupitemmetadataprovider.js +++ /dev/null @@ -1,199 +0,0 @@ -var Slick = Slick || {}; -Slick._ = (() => { - var __defProp = Object.defineProperty; - var __getOwnPropDesc = Object.getOwnPropertyDescriptor; - var __getOwnPropNames = Object.getOwnPropertyNames; - var __hasOwnProp = Object.prototype.hasOwnProperty; - var __export = (target, all) => { - for (var name in all) - __defProp(target, name, { get: all[name], enumerable: true }); - }; - var __copyProps = (to, from, except, desc) => { - if (from && typeof from === "object" || typeof from === "function") { - for (let key of __getOwnPropNames(from)) - if (!__hasOwnProp.call(to, key) && key !== except) - __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable }); - } - return to; - }; - var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod); - - // src/data/groupitemmetadataprovider.ts - var groupitemmetadataprovider_exports = {}; - __export(groupitemmetadataprovider_exports, { - GroupItemMetadataProvider: () => GroupItemMetadataProvider - }); - - // global-externals:_ - var { convertCompatFormatter, Group } = Slick; - - // src/data/groupitemmetadataprovider.ts - var _GroupItemMetadataProvider = class _GroupItemMetadataProvider { - constructor(opt) { - this.pluginName = "GroupItemMetadataProvider"; - this.handleGridClick = (e, args) => { - var _a, _b, _c, _d, _e, _f, _g; - let grid = (_a = args == null ? void 0 : args.grid) != null ? _a : this.grid; - if (!grid) - return; - var item = grid.getDataItem(args.row); - if (!item || !(item instanceof Group) || !this.options.toggleCssClass || !e.target.classList.contains(this.options.toggleCssClass)) - return; - e.stopImmediatePropagation(); - e.preventDefault(); - var range = grid.getRenderedRange(); - (_c = (_b = grid.getData()).setRefreshHints) == null ? void 0 : _c.call(_b, { - ignoreDiffsBefore: range.top, - ignoreDiffsAfter: range.bottom + 1 - }); - if (item.collapsed) - (_e = (_d = grid.getData()).expandGroup) == null ? void 0 : _e.call(_d, item.groupingKey); - else - (_g = (_f = grid.getData()).collapseGroup) == null ? void 0 : _g.call(_f, item.groupingKey); - }; - this.handleGridKeyDown = (e, args) => { - var _a, _b, _c, _d, _e, _f, _g; - if (!this.options.enableExpandCollapse || e.key !== " " && e.key !== "-" && e.key !== "+") - return; - let grid = (_a = args == null ? void 0 : args.grid) != null ? _a : this.grid; - if (!grid) - return; - var activeCell = grid.getActiveCell(); - if (!activeCell) - return; - var item = grid.getDataItem(activeCell.row); - if (!item || !(item instanceof Group)) - return; - e.stopImmediatePropagation(); - e.preventDefault(); - if (e.key == "+" && !item.collapsed || e.key == "-" && item.collapsed) - return; - var range = grid.getRenderedRange(); - (_c = (_b = grid.getData()).setRefreshHints) == null ? void 0 : _c.call(_b, { - ignoreDiffsBefore: range.top, - ignoreDiffsAfter: range.bottom + 1 - }); - if (item.collapsed) - (_e = (_d = grid.getData()).expandGroup) == null ? void 0 : _e.call(_d, item.groupingKey); - else - (_g = (_f = grid.getData()).collapseGroup) == null ? void 0 : _g.call(_f, item.groupingKey); - }; - this.groupCellPosition = () => { - var _a, _b, _c, _d; - const result = { - cell: 0, - colspan: "*" - }; - if (!this.options.groupRowTotals || !this.grid) { - return result; - } - var cols = this.grid.getColumns(); - var col1; - for (var idx = 0; idx < cols.length; idx++) { - col1 = cols[idx]; - if (!((_b = (_a = this.options).hasSummaryType) == null ? void 0 : _b.call(_a, cols[idx]))) { - result.cell = idx; - break; - } - } - result.colspan = 0; - for (var idx = result.cell + 1; idx < cols.length; idx++) { - var col2 = cols[idx]; - if (!((_d = (_c = this.options).hasSummaryType) == null ? void 0 : _d.call(_c, col2)) && !!(col1 == null ? void 0 : col1.frozen) === !!(col2 == null ? void 0 : col2.frozen)) { - result.colspan++; - } else - break; - } - result.colspan = Math.max(1, result.colspan); - return result; - }; - this.getGroupRowMetadata = (item) => { - const opt = this.options; - const gcp = this.groupCellPosition(); - const result = { - selectable: false, - focusable: opt.groupFocusable, - cssClasses: opt.groupCssClass + " " + opt.groupLevelPrefix + (item == null ? void 0 : item.level), - columns: { - [gcp.cell]: { - colspan: gcp.colspan, - cssClasses: opt.groupCellCssClass, - format: opt.groupFormat, - editor: null - } - } - }; - if (opt.groupRowTotals) - result.format = opt.totalsFormat; - return result; - }; - this.getTotalsRowMetadata = (item) => { - var _a; - const opt = this.options; - return { - selectable: false, - focusable: opt.totalsFocusable, - cssClasses: opt.totalsCssClass + " " + opt.groupLevelPrefix + ((_a = item == null ? void 0 : item.group) == null ? void 0 : _a.level), - format: opt.totalsFormat, - editor: null - }; - }; - var _a, _b, _c, _d; - this.options = Object.assign({}, _GroupItemMetadataProvider.defaults, opt); - (_b = (_a = this.options).groupFormat) != null ? _b : _a.groupFormat = (opt == null ? void 0 : opt.groupFormatter) ? convertCompatFormatter(opt.groupFormatter) : (ctx) => _GroupItemMetadataProvider.defaultGroupFormat(ctx, this.options); - (_d = (_c = this.options).totalsFormat) != null ? _d : _c.totalsFormat = (opt == null ? void 0 : opt.totalsFormatter) ? convertCompatFormatter(opt.totalsFormatter) : (ctx) => _GroupItemMetadataProvider.defaultTotalsFormat(ctx, this.grid); - } - static defaultGroupFormat(ctx, opt) { - opt != null ? opt : opt = _GroupItemMetadataProvider.defaults; - let item = ctx.item; - if (!opt.enableExpandCollapse) - return item == null ? void 0 : item.title; - let indentation = item.level * opt.groupIndentation; - return ` -${item.title}`; - } - static defaultTotalsFormat(ctx, grid) { - var _a, _b, _c, _d, _e, _f; - var item = ctx.item; - if (!item.__groupTotals && item.totals) - item = item.totals; - return (_f = (_e = (_b = (_a = ctx.column) == null ? void 0 : _a.groupTotalsFormatter) == null ? void 0 : _b.call(_a, item, ctx.column)) != null ? _e : (_d = (_c = grid != null ? grid : ctx.grid) == null ? void 0 : _c.groupTotalsFormatter) == null ? void 0 : _d.call(_c, item, ctx.column)) != null ? _f : ""; - } - init(grid) { - this.grid = grid; - grid.onClick.subscribe(this.handleGridClick); - grid.onKeyDown.subscribe(this.handleGridKeyDown); - } - destroy() { - var _a, _b; - if (this.grid) { - (_a = this.grid.onClick) == null ? void 0 : _a.unsubscribe(this.handleGridClick); - (_b = this.grid.onKeyDown) == null ? void 0 : _b.unsubscribe(this.handleGridKeyDown); - } - } - getOptions() { - return this.options; - } - setOptions(value) { - Object.assign(this.options, value); - } - }; - _GroupItemMetadataProvider.defaults = { - enableExpandCollapse: true, - groupCellCssClass: "slick-group-cell", - groupCssClass: "slick-group", - groupFocusable: true, - groupIndentation: 15, - groupLevelPrefix: "slick-group-level-", - groupTitleCssClass: "slick-group-title", - hasSummaryType: (col) => col.summaryType && col.summaryType != -1, - totalsCssClass: "slick-group-totals", - toggleCssClass: "slick-group-toggle", - toggleCollapsedCssClass: "collapsed", - toggleExpandedCssClass: "expanded", - totalsFocusable: false - }; - var GroupItemMetadataProvider = _GroupItemMetadataProvider; - return __toCommonJS(groupitemmetadataprovider_exports); -})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; Slick.Data = Slick.Data || {}; Slick.Data.GroupItemMetadataProvider = Slick.GroupItemMetadataProvider; diff --git a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.groupitemmetadataprovider.min.js b/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.groupitemmetadataprovider.min.js deleted file mode 100644 index 8b7691408a..0000000000 --- a/src/Serenity.Assets/wwwroot/Scripts/SlickGrid/slick.groupitemmetadataprovider.min.js +++ /dev/null @@ -1,3 +0,0 @@ -var Slick=Slick||{};Slick._=(()=>{var d=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var F=Object.getOwnPropertyNames;var v=Object.prototype.hasOwnProperty;var G=(p,t)=>{for(var e in t)d(p,e,{get:t[e],enumerable:!0})},T=(p,t,e,s)=>{if(t&&typeof t=="object"||typeof t=="function")for(let o of F(t))!v.call(p,o)&&o!==e&&d(p,o,{get:()=>t[o],enumerable:!(s=y(t,o))||s.enumerable});return p};var D=p=>T(d({},"__esModule",{value:!0}),p);var k={};G(k,{GroupItemMetadataProvider:()=>h});var{convertCompatFormatter:c,Group:f}=Slick;var u=class u{constructor(t){this.pluginName="GroupItemMetadataProvider";this.handleGridClick=(t,e)=>{var r,l,n,i,g,m,C;let s=(r=e==null?void 0:e.grid)!=null?r:this.grid;if(s){var o=s.getDataItem(e.row);if(!(!o||!(o instanceof f)||!this.options.toggleCssClass||!t.target.classList.contains(this.options.toggleCssClass))){t.stopImmediatePropagation(),t.preventDefault();var a=s.getRenderedRange();(n=(l=s.getData()).setRefreshHints)==null||n.call(l,{ignoreDiffsBefore:a.top,ignoreDiffsAfter:a.bottom+1}),o.collapsed?(g=(i=s.getData()).expandGroup)==null||g.call(i,o.groupingKey):(C=(m=s.getData()).collapseGroup)==null||C.call(m,o.groupingKey)}}};this.handleGridKeyDown=(t,e)=>{var l,n,i,g,m,C,b;if(!this.options.enableExpandCollapse||t.key!==" "&&t.key!=="-"&&t.key!=="+")return;let s=(l=e==null?void 0:e.grid)!=null?l:this.grid;if(s){var o=s.getActiveCell();if(o){var a=s.getDataItem(o.row);if(!(!a||!(a instanceof f))&&(t.stopImmediatePropagation(),t.preventDefault(),!(t.key=="+"&&!a.collapsed||t.key=="-"&&a.collapsed))){var r=s.getRenderedRange();(i=(n=s.getData()).setRefreshHints)==null||i.call(n,{ignoreDiffsBefore:r.top,ignoreDiffsAfter:r.bottom+1}),a.collapsed?(m=(g=s.getData()).expandGroup)==null||m.call(g,a.groupingKey):(b=(C=s.getData()).collapseGroup)==null||b.call(C,a.groupingKey)}}}};this.groupCellPosition=()=>{var r,l,n,i;let t={cell:0,colspan:"*"};if(!this.options.groupRowTotals||!this.grid)return t;for(var e=this.grid.getColumns(),s,o=0;o{let e=this.options,s=this.groupCellPosition(),o={selectable:!1,focusable:e.groupFocusable,cssClasses:e.groupCssClass+" "+e.groupLevelPrefix+(t==null?void 0:t.level),columns:{[s.cell]:{colspan:s.colspan,cssClasses:e.groupCellCssClass,format:e.groupFormat,editor:null}}};return e.groupRowTotals&&(o.format=e.totalsFormat),o};this.getTotalsRowMetadata=t=>{var s;let e=this.options;return{selectable:!1,focusable:e.totalsFocusable,cssClasses:e.totalsCssClass+" "+e.groupLevelPrefix+((s=t==null?void 0:t.group)==null?void 0:s.level),format:e.totalsFormat,editor:null}};var e,s,o,a;this.options=Object.assign({},u.defaults,t),(s=(e=this.options).groupFormat)!=null||(e.groupFormat=t!=null&&t.groupFormatter?c(t.groupFormatter):r=>u.defaultGroupFormat(r,this.options)),(a=(o=this.options).totalsFormat)!=null||(o.totalsFormat=t!=null&&t.totalsFormatter?c(t.totalsFormatter):r=>u.defaultTotalsFormat(r,this.grid))}static defaultGroupFormat(t,e){e!=null||(e=u.defaults);let s=t.item;if(!e.enableExpandCollapse)return s==null?void 0:s.title;let o=s.level*e.groupIndentation;return` -${s.title}`}static defaultTotalsFormat(t,e){var o,a,r,l,n,i;var s=t.item;return!s.__groupTotals&&s.totals&&(s=s.totals),(i=(n=(a=(o=t.column)==null?void 0:o.groupTotalsFormatter)==null?void 0:a.call(o,s,t.column))!=null?n:(l=(r=e!=null?e:t.grid)==null?void 0:r.groupTotalsFormatter)==null?void 0:l.call(r,s,t.column))!=null?i:""}init(t){this.grid=t,t.onClick.subscribe(this.handleGridClick),t.onKeyDown.subscribe(this.handleGridKeyDown)}destroy(){var t,e;this.grid&&((t=this.grid.onClick)==null||t.unsubscribe(this.handleGridClick),(e=this.grid.onKeyDown)==null||e.unsubscribe(this.handleGridKeyDown))}getOptions(){return this.options}setOptions(t){Object.assign(this.options,t)}};u.defaults={enableExpandCollapse:!0,groupCellCssClass:"slick-group-cell",groupCssClass:"slick-group",groupFocusable:!0,groupIndentation:15,groupLevelPrefix:"slick-group-level-",groupTitleCssClass:"slick-group-title",hasSummaryType:t=>t.summaryType&&t.summaryType!=-1,totalsCssClass:"slick-group-totals",toggleCssClass:"slick-group-toggle",toggleCollapsedCssClass:"collapsed",toggleExpandedCssClass:"expanded",totalsFocusable:!1};var h=u;return D(k);})(); -["Data", "Editors", "Formatters", "Plugins"].forEach(ns => Slick._[ns] && (Slick[ns] = Object.assign(Slick[ns] || {}, Slick._[ns])) && delete Slick._[ns]); Object.assign(Slick, Slick._); delete Slick._; Slick.Data = Slick.Data || {}; Slick.Data.GroupItemMetadataProvider = Slick.GroupItemMetadataProvider;