slickgrid
Advanced tools
Comparing version 5.5.6 to 5.6.0
@@ -14,3 +14,3 @@ "use strict"; | ||
// public API | ||
__publicField(this, "onColumnsChanged", new SlickEvent()); | ||
__publicField(this, "onColumnsChanged", new SlickEvent("onColumnsChanged")); | ||
// -- | ||
@@ -38,3 +38,3 @@ // protected props | ||
var _a, _b; | ||
grid.onHeaderContextMenu.subscribe(this.handleHeaderContextMenu.bind(this)), grid.onColumnsReordered.subscribe(this.updateColumnOrder.bind(this)), this._menuElm = document.createElement("div"), this._menuElm.className = `slick-columnpicker ${this._gridUid}`, this._menuElm.style.display = "none", document.body.appendChild(this._menuElm); | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), grid.onHeaderContextMenu.subscribe(this.handleHeaderContextMenu.bind(this)), grid.onColumnsReordered.subscribe(this.updateColumnOrder.bind(this)), this._menuElm = document.createElement("div"), this._menuElm.className = `slick-columnpicker ${this._gridUid}`, this._menuElm.style.display = "none", document.body.appendChild(this._menuElm); | ||
let buttonElm = document.createElement("button"); | ||
@@ -41,0 +41,0 @@ buttonElm.type = "button", buttonElm.className = "close", buttonElm.dataset.dismiss = "slick-columnpicker", buttonElm.ariaLabel = "Close"; |
@@ -14,3 +14,3 @@ "use strict"; | ||
// public API | ||
__publicField(this, "onColumnsChanged", new SlickEvent()); | ||
__publicField(this, "onColumnsChanged", new SlickEvent("onColumnsChanged")); | ||
// -- | ||
@@ -38,3 +38,3 @@ // protected props | ||
var _a, _b; | ||
grid.onHeaderContextMenu.subscribe(this.handleHeaderContextMenu.bind(this)), grid.onColumnsReordered.subscribe(this.updateColumnOrder.bind(this)), this._menuElm = document.createElement("div"), this._menuElm.className = `slick-columnpicker ${this._gridUid}`, this._menuElm.style.display = "none", document.body.appendChild(this._menuElm); | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), grid.onHeaderContextMenu.subscribe(this.handleHeaderContextMenu.bind(this)), grid.onColumnsReordered.subscribe(this.updateColumnOrder.bind(this)), this._menuElm = document.createElement("div"), this._menuElm.className = `slick-columnpicker ${this._gridUid}`, this._menuElm.style.display = "none", document.body.appendChild(this._menuElm); | ||
let buttonElm = document.createElement("button"); | ||
@@ -41,0 +41,0 @@ buttonElm.type = "button", buttonElm.className = "close", buttonElm.dataset.dismiss = "slick-columnpicker", buttonElm.ariaLabel = "Close"; |
@@ -14,7 +14,7 @@ "use strict"; | ||
// public API | ||
__publicField(this, "onAfterMenuShow", new SlickEvent()); | ||
__publicField(this, "onBeforeMenuShow", new SlickEvent()); | ||
__publicField(this, "onMenuClose", new SlickEvent()); | ||
__publicField(this, "onCommand", new SlickEvent()); | ||
__publicField(this, "onColumnsChanged", new SlickEvent()); | ||
__publicField(this, "onAfterMenuShow", new SlickEvent("onAfterMenuShow")); | ||
__publicField(this, "onBeforeMenuShow", new SlickEvent("onBeforeMenuShow")); | ||
__publicField(this, "onMenuClose", new SlickEvent("onMenuClose")); | ||
__publicField(this, "onCommand", new SlickEvent("onCommand")); | ||
__publicField(this, "onColumnsChanged", new SlickEvent("onColumnsChanged")); | ||
// -- | ||
@@ -59,3 +59,3 @@ // protected props | ||
var _a, _b; | ||
this._gridOptions = grid.getOptions(), this.createGridMenu(), ((_a = this._gridMenuOptions) != null && _a.customItems || (_b = this._gridMenuOptions) != null && _b.customTitle) && console.warn('[SlickGrid] Grid Menu "customItems" and "customTitle" were deprecated to align with other Menu plugins, please use "commandItems" and "commandTitle" instead.'), grid.onBeforeDestroy.subscribe(this.destroy.bind(this)); | ||
this._gridOptions = grid.getOptions(), Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this.createGridMenu(), ((_a = this._gridMenuOptions) != null && _a.customItems || (_b = this._gridMenuOptions) != null && _b.customTitle) && console.warn('[SlickGrid] Grid Menu "customItems" and "customTitle" were deprecated to align with other Menu plugins, please use "commandItems" and "commandTitle" instead.'), grid.onBeforeDestroy.subscribe(this.destroy.bind(this)); | ||
} | ||
@@ -62,0 +62,0 @@ setOptions(newOptions) { |
@@ -13,5 +13,5 @@ "use strict"; | ||
__publicField(this, "pluginName", "CellCopyManager"); | ||
__publicField(this, "onCopyCells", new SlickEvent()); | ||
__publicField(this, "onCopyCancelled", new SlickEvent()); | ||
__publicField(this, "onPasteCells", new SlickEvent()); | ||
__publicField(this, "onCopyCells", new SlickEvent("onCopyCells")); | ||
__publicField(this, "onCopyCancelled", new SlickEvent("onCopyCancelled")); | ||
__publicField(this, "onPasteCells", new SlickEvent("onPasteCells")); | ||
// -- | ||
@@ -23,3 +23,3 @@ // protected props | ||
init(grid) { | ||
this._grid = grid, this._grid.onKeyDown.subscribe(this.handleKeyDown.bind(this)); | ||
this._grid = grid, Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._grid.onKeyDown.subscribe(this.handleKeyDown.bind(this)); | ||
} | ||
@@ -26,0 +26,0 @@ destroy() { |
@@ -13,5 +13,5 @@ "use strict"; | ||
__publicField(this, "pluginName", "CellExternalCopyManager"); | ||
__publicField(this, "onCopyCells", new SlickEvent()); | ||
__publicField(this, "onCopyCancelled", new SlickEvent()); | ||
__publicField(this, "onPasteCells", new SlickEvent()); | ||
__publicField(this, "onCopyCells", new SlickEvent("onCopyCells")); | ||
__publicField(this, "onCopyCancelled", new SlickEvent("onCopyCancelled")); | ||
__publicField(this, "onPasteCells", new SlickEvent("onPasteCells")); | ||
// -- | ||
@@ -37,3 +37,3 @@ // protected props | ||
init(grid) { | ||
this._grid = grid, this._grid.onKeyDown.subscribe(this.handleKeyDown.bind(this)); | ||
this._grid = grid, Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._grid.onKeyDown.subscribe(this.handleKeyDown.bind(this)); | ||
let cellSelectionModel = grid.getSelectionModel(); | ||
@@ -40,0 +40,0 @@ if (!cellSelectionModel) |
@@ -13,7 +13,7 @@ "use strict"; | ||
__publicField(this, "pluginName", "CellMenu"); | ||
__publicField(this, "onAfterMenuShow", new SlickEvent()); | ||
__publicField(this, "onBeforeMenuShow", new SlickEvent()); | ||
__publicField(this, "onBeforeMenuClose", new SlickEvent()); | ||
__publicField(this, "onCommand", new SlickEvent()); | ||
__publicField(this, "onOptionSelected", new SlickEvent()); | ||
__publicField(this, "onAfterMenuShow", new SlickEvent("onAfterMenuShow")); | ||
__publicField(this, "onBeforeMenuShow", new SlickEvent("onBeforeMenuShow")); | ||
__publicField(this, "onBeforeMenuClose", new SlickEvent("onBeforeMenuClose")); | ||
__publicField(this, "onCommand", new SlickEvent("onCommand")); | ||
__publicField(this, "onOptionSelected", new SlickEvent("onOptionSelected")); | ||
// -- | ||
@@ -49,3 +49,3 @@ // protected props | ||
init(grid) { | ||
this._grid = grid, this._gridOptions = grid.getOptions(), this._gridUid = (grid == null ? void 0 : grid.getUID()) || "", this._handler.subscribe(this._grid.onClick, this.handleCellClick.bind(this)), this._cellMenuProperties.hideMenuOnScroll && this._handler.subscribe(this._grid.onScroll, this.closeMenu.bind(this)); | ||
this._grid = grid, this._gridOptions = grid.getOptions(), Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._gridUid = (grid == null ? void 0 : grid.getUID()) || "", this._handler.subscribe(this._grid.onClick, this.handleCellClick.bind(this)), this._cellMenuProperties.hideMenuOnScroll && this._handler.subscribe(this._grid.onScroll, this.closeMenu.bind(this)); | ||
} | ||
@@ -52,0 +52,0 @@ setOptions(newOptions) { |
@@ -13,5 +13,5 @@ "use strict"; | ||
__publicField(this, "pluginName", "CellRangeSelector"); | ||
__publicField(this, "onBeforeCellRangeSelected", new SlickEvent()); | ||
__publicField(this, "onCellRangeSelected", new SlickEvent()); | ||
__publicField(this, "onCellRangeSelecting", new SlickEvent()); | ||
__publicField(this, "onBeforeCellRangeSelected", new SlickEvent("onBeforeCellRangeSelected")); | ||
__publicField(this, "onCellRangeSelected", new SlickEvent("onCellRangeSelected")); | ||
__publicField(this, "onCellRangeSelecting", new SlickEvent("onCellRangeSelecting")); | ||
// -- | ||
@@ -62,3 +62,3 @@ // protected props | ||
throw new Error('Slick.Draggable is undefined, make sure to import "slick.interactions.js"'); | ||
this._decorator = this._options.cellDecorator || new SlickCellRangeDecorator(grid, this._options), this._grid = grid, this._canvas = this._grid.getCanvasNode(), this._gridOptions = this._grid.getOptions(), this._handler.subscribe(this._grid.onScroll, this.handleScroll.bind(this)).subscribe(this._grid.onDragInit, this.handleDragInit.bind(this)).subscribe(this._grid.onDragStart, this.handleDragStart.bind(this)).subscribe(this._grid.onDrag, this.handleDrag.bind(this)).subscribe(this._grid.onDragEnd, this.handleDragEnd.bind(this)); | ||
this._decorator = this._options.cellDecorator || new SlickCellRangeDecorator(grid, this._options), this._grid = grid, Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._canvas = this._grid.getCanvasNode(), this._gridOptions = this._grid.getOptions(), this._handler.subscribe(this._grid.onScroll, this.handleScroll.bind(this)).subscribe(this._grid.onDragInit, this.handleDragInit.bind(this)).subscribe(this._grid.onDragStart, this.handleDragStart.bind(this)).subscribe(this._grid.onDrag, this.handleDrag.bind(this)).subscribe(this._grid.onDragEnd, this.handleDragEnd.bind(this)); | ||
} | ||
@@ -65,0 +65,0 @@ destroy() { |
@@ -13,3 +13,3 @@ "use strict"; | ||
__publicField(this, "pluginName", "CellSelectionModel"); | ||
__publicField(this, "onSelectedRangesChanged", new SlickEvent()); | ||
__publicField(this, "onSelectedRangesChanged", new SlickEvent("onSelectedRangesChanged")); | ||
// -- | ||
@@ -16,0 +16,0 @@ // protected props |
@@ -13,7 +13,7 @@ "use strict"; | ||
__publicField(this, "pluginName", "ContextMenu"); | ||
__publicField(this, "onAfterMenuShow", new SlickEvent()); | ||
__publicField(this, "onBeforeMenuShow", new SlickEvent()); | ||
__publicField(this, "onBeforeMenuClose", new SlickEvent()); | ||
__publicField(this, "onCommand", new SlickEvent()); | ||
__publicField(this, "onOptionSelected", new SlickEvent()); | ||
__publicField(this, "onAfterMenuShow", new SlickEvent("onAfterMenuShow")); | ||
__publicField(this, "onBeforeMenuShow", new SlickEvent("onBeforeMenuShow")); | ||
__publicField(this, "onBeforeMenuClose", new SlickEvent("onBeforeMenuClose")); | ||
__publicField(this, "onCommand", new SlickEvent("onCommand")); | ||
__publicField(this, "onOptionSelected", new SlickEvent("onOptionSelected")); | ||
// -- | ||
@@ -51,3 +51,3 @@ // protected props | ||
init(grid) { | ||
this._grid = grid, this._gridOptions = grid.getOptions(), this._gridUid = (grid == null ? void 0 : grid.getUID()) || "", this._handler.subscribe(this._grid.onContextMenu, this.handleOnContextMenu.bind(this)), this._contextMenuProperties.hideMenuOnScroll && this._handler.subscribe(this._grid.onScroll, this.destroyMenu.bind(this)); | ||
this._grid = grid, this._gridOptions = grid.getOptions(), this._gridUid = grid.getUID() || "", Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._handler.subscribe(this._grid.onContextMenu, this.handleOnContextMenu.bind(this)), this._contextMenuProperties.hideMenuOnScroll && this._handler.subscribe(this._grid.onScroll, this.destroyMenu.bind(this)); | ||
} | ||
@@ -54,0 +54,0 @@ setOptions(newOptions) { |
@@ -13,4 +13,4 @@ "use strict"; | ||
__publicField(this, "pluginName", "CrossGridRowMoveManager"); | ||
__publicField(this, "onBeforeMoveRows", new SlickEvent()); | ||
__publicField(this, "onMoveRows", new SlickEvent()); | ||
__publicField(this, "onBeforeMoveRows", new SlickEvent("onBeforeMoveRows")); | ||
__publicField(this, "onMoveRows", new SlickEvent("onMoveRows")); | ||
// -- | ||
@@ -44,3 +44,3 @@ // protected props | ||
var _a; | ||
this._grid = grid, this._canvas = this._grid.getCanvasNode(), this._toGrid = this._options.toGrid, this._toCanvas = this._toGrid.getCanvasNode(), typeof ((_a = this._options) == null ? void 0 : _a.usabilityOverride) == "function" && this.usabilityOverride(this._options.usabilityOverride), this._eventHandler.subscribe(this._grid.onDragInit, this.handleDragInit.bind(this)).subscribe(this._grid.onDragStart, this.handleDragStart.bind(this)).subscribe(this._grid.onDrag, this.handleDrag.bind(this)).subscribe(this._grid.onDragEnd, this.handleDragEnd.bind(this)); | ||
this._grid = grid, this._canvas = this._grid.getCanvasNode(), this._toGrid = this._options.toGrid, this._toCanvas = this._toGrid.getCanvasNode(), Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), typeof ((_a = this._options) == null ? void 0 : _a.usabilityOverride) == "function" && this.usabilityOverride(this._options.usabilityOverride), this._eventHandler.subscribe(this._grid.onDragInit, this.handleDragInit.bind(this)).subscribe(this._grid.onDragStart, this.handleDragStart.bind(this)).subscribe(this._grid.onDrag, this.handleDrag.bind(this)).subscribe(this._grid.onDragEnd, this.handleDragEnd.bind(this)); | ||
} | ||
@@ -47,0 +47,0 @@ destroy() { |
@@ -21,3 +21,3 @@ "use strict"; | ||
__publicField(this, "pluginName", "DraggableGrouping"); | ||
__publicField(this, "onGroupChanged", new SlickEvent()); | ||
__publicField(this, "onGroupChanged", new SlickEvent("onGroupChanged")); | ||
// -- | ||
@@ -52,3 +52,3 @@ // protected props | ||
init(grid) { | ||
this._grid = grid, this._gridUid = this._grid.getUID(), this._gridColumns = this._grid.getColumns(), this._dataView = this._grid.getData(), this._dropzoneElm = this._grid.getPreHeaderPanel(), this._dropzoneElm.classList.add("slick-dropzone"); | ||
this._grid = grid, Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._gridUid = this._grid.getUID(), this._gridColumns = this._grid.getColumns(), this._dataView = this._grid.getData(), this._dropzoneElm = this._grid.getPreHeaderPanel(), this._dropzoneElm.classList.add("slick-dropzone"); | ||
let dropPlaceHolderText = this._options.dropPlaceHolderText || "Drop a column header here to group by the column"; | ||
@@ -132,3 +132,4 @@ this._dropzonePlaceholder = document.createElement("div"), this._dropzonePlaceholder.className = "slick-placeholder", this._dropzonePlaceholder.textContent = dropPlaceHolderText, this._groupToggler = document.createElement("div"), this._groupToggler.className = "slick-group-toggle-all expanded", this._groupToggler.style.display = "none", this._dropzoneElm.appendChild(this._dropzonePlaceholder), this._dropzoneElm.appendChild(this._groupToggler), this.setupColumnDropbox(), this._handler.subscribe(this._grid.onHeaderCellRendered, (_e, args) => { | ||
destroy() { | ||
this.destroySortableInstances(), this.onGroupChanged.unsubscribe(), this._handler.unsubscribeAll(), this._bindingEventService.unbindAll(), Utils.emptyElement(document.querySelector(`.${this._gridUid} .slick-preheader-panel`)); | ||
var _a, _b; | ||
this.destroySortableInstances(), (_a = this._droppableInstance) != null && _a.el && ((_b = this._droppableInstance) == null || _b.destroy()), this.onGroupChanged.unsubscribe(), this._handler.unsubscribeAll(), this._bindingEventService.unbindAll(), Utils.emptyElement(document.querySelector(`.${this._gridUid} .slick-preheader-panel`)); | ||
} | ||
@@ -135,0 +136,0 @@ destroySortableInstances() { |
@@ -13,3 +13,3 @@ "use strict"; | ||
__publicField(this, "pluginName", "HeaderButtons"); | ||
__publicField(this, "onCommand", new SlickEvent()); | ||
__publicField(this, "onCommand", new SlickEvent("onCommand")); | ||
// -- | ||
@@ -27,3 +27,3 @@ // protected props | ||
init(grid) { | ||
this._grid = grid, this._handler.subscribe(this._grid.onHeaderCellRendered, this.handleHeaderCellRendered.bind(this)).subscribe(this._grid.onBeforeHeaderCellDestroy, this.handleBeforeHeaderCellDestroy.bind(this)), this._grid.setColumns(this._grid.getColumns()); | ||
this._grid = grid, Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._handler.subscribe(this._grid.onHeaderCellRendered, this.handleHeaderCellRendered.bind(this)).subscribe(this._grid.onBeforeHeaderCellDestroy, this.handleBeforeHeaderCellDestroy.bind(this)), this._grid.setColumns(this._grid.getColumns()); | ||
} | ||
@@ -30,0 +30,0 @@ destroy() { |
@@ -13,5 +13,5 @@ "use strict"; | ||
__publicField(this, "pluginName", "HeaderMenu"); | ||
__publicField(this, "onAfterMenuShow", new SlickEvent()); | ||
__publicField(this, "onBeforeMenuShow", new SlickEvent()); | ||
__publicField(this, "onCommand", new SlickEvent()); | ||
__publicField(this, "onAfterMenuShow", new SlickEvent("onAfterMenuShow")); | ||
__publicField(this, "onBeforeMenuShow", new SlickEvent("onBeforeMenuShow")); | ||
__publicField(this, "onCommand", new SlickEvent("onCommand")); | ||
// -- | ||
@@ -38,3 +38,3 @@ // protected props | ||
init(grid) { | ||
this._grid = grid, this._gridUid = (grid == null ? void 0 : grid.getUID()) || "", this._handler.subscribe(this._grid.onHeaderCellRendered, this.handleHeaderCellRendered.bind(this)).subscribe(this._grid.onBeforeHeaderCellDestroy, this.handleBeforeHeaderCellDestroy.bind(this)), this._grid.setColumns(this._grid.getColumns()), this._bindingEventService.bind(document.body, "click", this.handleBodyMouseDown.bind(this)); | ||
this._grid = grid, this._gridUid = (grid == null ? void 0 : grid.getUID()) || "", Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._handler.subscribe(this._grid.onHeaderCellRendered, this.handleHeaderCellRendered.bind(this)).subscribe(this._grid.onBeforeHeaderCellDestroy, this.handleBeforeHeaderCellDestroy.bind(this)), this._grid.setColumns(this._grid.getColumns()), this._bindingEventService.bind(document.body, "click", this.handleBodyMouseDown.bind(this)); | ||
} | ||
@@ -41,0 +41,0 @@ setOptions(newOptions) { |
@@ -13,4 +13,4 @@ "use strict"; | ||
__publicField(this, "pluginName", "Resizer"); | ||
__publicField(this, "onGridAfterResize", new SlickEvent()); | ||
__publicField(this, "onGridBeforeResize", new SlickEvent()); | ||
__publicField(this, "onGridAfterResize", new SlickEvent("onGridAfterResize")); | ||
__publicField(this, "onGridBeforeResize", new SlickEvent("onGridBeforeResize")); | ||
// -- | ||
@@ -44,3 +44,3 @@ // protected props | ||
init(grid) { | ||
this.setOptions(this._options), this._grid = grid, this._gridOptions = this._grid.getOptions(), this._gridUid = this._grid.getUID(), this._gridDomElm = this._grid.getContainerNode(), this._pageContainerElm = typeof this._options.container == "string" ? document.querySelector(this._options.container) : this._options.container, this._options.gridContainer && (this._gridContainerElm = this._options.gridContainer), this._gridOptions && this.bindAutoResizeDataGrid(); | ||
this.setOptions(this._options), this._grid = grid, this._gridOptions = this._grid.getOptions(), this._gridUid = this._grid.getUID(), this._gridDomElm = this._grid.getContainerNode(), this._pageContainerElm = typeof this._options.container == "string" ? document.querySelector(this._options.container) : this._options.container, this._options.gridContainer && (this._gridContainerElm = this._options.gridContainer), Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._gridOptions && this.bindAutoResizeDataGrid(); | ||
} | ||
@@ -47,0 +47,0 @@ /** Bind an auto resize trigger on the datagrid, if that is enable then it will resize itself to the available space |
@@ -14,8 +14,8 @@ "use strict"; | ||
__publicField(this, "pluginName", "RowDetailView"); | ||
__publicField(this, "onAsyncResponse", new SlickEvent()); | ||
__publicField(this, "onAsyncEndUpdate", new SlickEvent()); | ||
__publicField(this, "onAfterRowDetailToggle", new SlickEvent()); | ||
__publicField(this, "onBeforeRowDetailToggle", new SlickEvent()); | ||
__publicField(this, "onRowBackToViewportRange", new SlickEvent()); | ||
__publicField(this, "onRowOutOfViewportRange", new SlickEvent()); | ||
__publicField(this, "onAsyncResponse", new SlickEvent("onAsyncResponse")); | ||
__publicField(this, "onAsyncEndUpdate", new SlickEvent("onAsyncEndUpdate")); | ||
__publicField(this, "onAfterRowDetailToggle", new SlickEvent("onAfterRowDetailToggle")); | ||
__publicField(this, "onBeforeRowDetailToggle", new SlickEvent("onBeforeRowDetailToggle")); | ||
__publicField(this, "onRowBackToViewportRange", new SlickEvent("onRowBackToViewportRange")); | ||
__publicField(this, "onRowOutOfViewportRange", new SlickEvent("onRowOutOfViewportRange")); | ||
// -- | ||
@@ -64,3 +64,3 @@ // protected props | ||
throw new Error('RowDetailView Plugin requires the Grid instance to be passed as argument to the "init()" method'); | ||
this._grid = grid, this._gridUid = grid.getUID(), this._gridOptions = grid.getOptions() || {}, this._dataView = this._grid.getData(), this._keyPrefix = (_b = (_a = this._options) == null ? void 0 : _a.keyPrefix) != null ? _b : "_", this._gridRowBuffer = this._gridOptions.minRowBuffer || 0, this._gridOptions.minRowBuffer = this._options.panelRows + 3, this._eventHandler.subscribe(this._grid.onClick, this.handleClick.bind(this)).subscribe(this._grid.onScroll, this.handleScroll.bind(this)), this._options.collapseAllOnSort && (this._eventHandler.subscribe(this._grid.onSort, this.collapseAll.bind(this)), this._expandedRows = [], this._rowIdsOutOfViewport = []), this._eventHandler.subscribe(this._dataView.onRowCountChanged, () => { | ||
this._grid = grid, this._gridUid = grid.getUID(), this._gridOptions = grid.getOptions() || {}, this._dataView = this._grid.getData(), this._keyPrefix = (_b = (_a = this._options) == null ? void 0 : _a.keyPrefix) != null ? _b : "_", Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._gridRowBuffer = this._gridOptions.minRowBuffer || 0, this._gridOptions.minRowBuffer = this._options.panelRows + 3, this._eventHandler.subscribe(this._grid.onClick, this.handleClick.bind(this)).subscribe(this._grid.onScroll, this.handleScroll.bind(this)), this._options.collapseAllOnSort && (this._eventHandler.subscribe(this._grid.onSort, this.collapseAll.bind(this)), this._expandedRows = [], this._rowIdsOutOfViewport = []), this._eventHandler.subscribe(this._dataView.onRowCountChanged, () => { | ||
this._grid.updateRowCount(), this._grid.render(); | ||
@@ -67,0 +67,0 @@ }), this._eventHandler.subscribe(this._dataView.onRowsChanged, (_e, a) => { |
@@ -13,4 +13,4 @@ "use strict"; | ||
__publicField(this, "pluginName", "RowMoveManager"); | ||
__publicField(this, "onBeforeMoveRows", new SlickEvent()); | ||
__publicField(this, "onMoveRows", new SlickEvent()); | ||
__publicField(this, "onBeforeMoveRows", new SlickEvent("onBeforeMoveRows")); | ||
__publicField(this, "onMoveRows", new SlickEvent("onMoveRows")); | ||
// -- | ||
@@ -41,3 +41,3 @@ // protected props | ||
var _a; | ||
this._grid = grid, this._canvas = this._grid.getCanvasNode(), typeof ((_a = this._options) == null ? void 0 : _a.usabilityOverride) == "function" && this.usabilityOverride(this._options.usabilityOverride), this._eventHandler.subscribe(this._grid.onDragInit, this.handleDragInit.bind(this)).subscribe(this._grid.onDragStart, this.handleDragStart.bind(this)).subscribe(this._grid.onDrag, this.handleDrag.bind(this)).subscribe(this._grid.onDragEnd, this.handleDragEnd.bind(this)); | ||
this._grid = grid, this._canvas = this._grid.getCanvasNode(), Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), typeof ((_a = this._options) == null ? void 0 : _a.usabilityOverride) == "function" && this.usabilityOverride(this._options.usabilityOverride), this._eventHandler.subscribe(this._grid.onDragInit, this.handleDragInit.bind(this)).subscribe(this._grid.onDragStart, this.handleDragStart.bind(this)).subscribe(this._grid.onDrag, this.handleDrag.bind(this)).subscribe(this._grid.onDragEnd, this.handleDragEnd.bind(this)); | ||
} | ||
@@ -44,0 +44,0 @@ destroy() { |
@@ -13,3 +13,3 @@ "use strict"; | ||
__publicField(this, "pluginName", "RowSelectionModel"); | ||
__publicField(this, "onSelectedRangesChanged", new SlickEvent()); | ||
__publicField(this, "onSelectedRangesChanged", new SlickEvent("onSelectedRangesChanged")); | ||
// _handler, _inHandler, _isRowMoveManagerHandler, _options, wrapHandler | ||
@@ -36,3 +36,3 @@ // -- | ||
throw new Error('Slick.Draggable is undefined, make sure to import "slick.interactions.js"'); | ||
if (this._selector = this._options.cellRangeSelector, this._grid = grid, !this._selector && this._options.dragToSelect) { | ||
if (this._selector = this._options.cellRangeSelector, this._grid = grid, Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), !this._selector && this._options.dragToSelect) { | ||
if (!SlickCellRangeDecorator) | ||
@@ -39,0 +39,0 @@ throw new Error("Slick.CellRangeDecorator is required when option dragToSelect set to true"); |
@@ -37,3 +37,3 @@ "use strict"; | ||
__publicField(this, "pluginName", "State"); | ||
__publicField(this, "onStateChanged", new SlickEvent()); | ||
__publicField(this, "onStateChanged", new SlickEvent("onStateChanged")); | ||
// -- | ||
@@ -58,3 +58,3 @@ // protected props | ||
init(grid) { | ||
this._grid = grid, this._cid = grid.cid || this._options.cid, this._cid ? (this._grid.onColumnsResized.subscribe(this.save.bind(this)), this._grid.onColumnsReordered.subscribe(this.save.bind(this)), this._grid.onSort.subscribe(this.save.bind(this))) : console.warn("grid has no client id. state persisting is disabled."); | ||
this._grid = grid, this._cid = grid.cid || this._options.cid, Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this), this._cid ? (this._grid.onColumnsResized.subscribe(this.save.bind(this)), this._grid.onColumnsReordered.subscribe(this.save.bind(this)), this._grid.onSort.subscribe(this.save.bind(this))) : console.warn("grid has no client id. state persisting is disabled."); | ||
} | ||
@@ -61,0 +61,0 @@ destroy() { |
@@ -139,5 +139,17 @@ "use strict"; | ||
}, SlickEvent = class { | ||
constructor() { | ||
__publicField(this, "handlers", []); | ||
/** | ||
* Constructor | ||
* @param {String} [eventName] - event name that could be used for dispatching CustomEvent (when enabled) | ||
* @param {BasePubSub} [pubSubService] - event name that could be used for dispatching CustomEvent (when enabled) | ||
*/ | ||
constructor(eventName, pubSub) { | ||
this.eventName = eventName; | ||
this.pubSub = pubSub; | ||
__publicField(this, "_handlers", []); | ||
__publicField(this, "_pubSubService"); | ||
this._pubSubService = pubSub; | ||
} | ||
get subscriberCount() { | ||
return this._handlers.length; | ||
} | ||
/** | ||
@@ -148,6 +160,6 @@ * Adds an event handler to be called when the event is fired. | ||
* @method subscribe | ||
* @param fn {Function} Event handler. | ||
* @param {Function} fn - Event handler. | ||
*/ | ||
subscribe(fn) { | ||
this.handlers.push(fn); | ||
this._handlers.push(fn); | ||
} | ||
@@ -157,7 +169,7 @@ /** | ||
* @method unsubscribe | ||
* @param fn {Function} Event handler to be removed. | ||
* @param {Function} [fn] - Event handler to be removed. | ||
*/ | ||
unsubscribe(fn) { | ||
for (let i = this.handlers.length - 1; i >= 0; i--) | ||
this.handlers[i] === fn && this.handlers.splice(i, 1); | ||
for (let i = this._handlers.length - 1; i >= 0; i--) | ||
this._handlers[i] === fn && this._handlers.splice(i, 1); | ||
} | ||
@@ -167,21 +179,25 @@ /** | ||
* @method notify | ||
* @param args {Object} Additional data object to be passed to all handlers. | ||
* @param e {EventData} | ||
* Optional. | ||
* An <code>EventData</code> object to be passed to all handlers. | ||
* @param {Object} args Additional data object to be passed to all handlers. | ||
* @param {EventData} [event] - An <code>EventData</code> object to be passed to all handlers. | ||
* For DOM events, an existing W3C event object can be passed in. | ||
* @param scope {Object} | ||
* Optional. | ||
* The scope ("this") within which the handler will be executed. | ||
* @param {Object} [scope] - The scope ("this") within which the handler will be executed. | ||
* If not specified, the scope will be set to the <code>Event</code> instance. | ||
*/ | ||
notify(args, evt, scope) { | ||
var _a; | ||
let sed = evt instanceof SlickEventData ? evt : new SlickEventData(evt, args); | ||
scope = scope || this; | ||
for (let i = 0; i < this.handlers.length && !(sed.isPropagationStopped() || sed.isImmediatePropagationStopped()); i++) { | ||
let returnValue = this.handlers[i].call(scope, sed, args); | ||
for (let i = 0; i < this._handlers.length && !(sed.isPropagationStopped() || sed.isImmediatePropagationStopped()); i++) { | ||
let returnValue = this._handlers[i].call(scope, sed, args); | ||
sed.addReturnValue(returnValue); | ||
} | ||
if (typeof ((_a = this._pubSubService) == null ? void 0 : _a.publish) == "function" && this.eventName) { | ||
let ret = this._pubSubService.publish(this.eventName, { args, eventData: sed }); | ||
sed.addReturnValue(ret); | ||
} | ||
return sed; | ||
} | ||
setPubSubService(pubSub) { | ||
this._pubSubService = pubSub; | ||
} | ||
}, SlickEventHandler = class { | ||
@@ -585,5 +601,3 @@ constructor() { | ||
static hide(el) { | ||
Array.isArray(el) ? el.forEach(function(e) { | ||
e.style.display = "none"; | ||
}) : el.style.display = "none"; | ||
Array.isArray(el) ? el.forEach((e) => e.style.display = "none") : el.style.display = "none"; | ||
} | ||
@@ -607,2 +621,13 @@ static slideUp(el, callback) { | ||
} | ||
/** | ||
* User could optionally add PubSub Service to SlickEvent | ||
* When it is defined then a SlickEvent `notify()` call will also dispatch it by using the PubSub publish() method | ||
* @param {BasePubSub} [pubSubService] | ||
* @param {*} scope | ||
*/ | ||
static addSlickEventPubSubWhenDefined(pubSub, scope) { | ||
if (pubSub) | ||
for (let prop in scope) | ||
scope[prop] instanceof SlickEvent && typeof scope[prop].setPubSubService == "function" && scope[prop].setPubSubService(pubSub); | ||
} | ||
}; | ||
@@ -609,0 +634,0 @@ // jQuery's extend |
@@ -9,3 +9,4 @@ "use strict"; | ||
var SlickEvent = Slick.Event, SlickEventData = Slick.EventData, SlickGroup = Slick.Group, SlickGroupTotals = Slick.GroupTotals, Utils = Slick.Utils, _a, _b, SlickGroupItemMetadataProvider = (_b = (_a = Slick.Data) == null ? void 0 : _a.GroupItemMetadataProvider) != null ? _b : {}, SlickDataView = class { | ||
constructor(options) { | ||
constructor(options, externalPubSub) { | ||
this.externalPubSub = externalPubSub; | ||
__publicField(this, "defaults", { | ||
@@ -78,13 +79,14 @@ groupItemMetadataProvider: null, | ||
__publicField(this, "_options"); | ||
__publicField(this, "_container"); | ||
// public events | ||
__publicField(this, "onBeforePagingInfoChanged", new SlickEvent()); | ||
__publicField(this, "onGroupExpanded", new SlickEvent()); | ||
__publicField(this, "onGroupCollapsed", new SlickEvent()); | ||
__publicField(this, "onPagingInfoChanged", new SlickEvent()); | ||
__publicField(this, "onRowCountChanged", new SlickEvent()); | ||
__publicField(this, "onRowsChanged", new SlickEvent()); | ||
__publicField(this, "onRowsOrCountChanged", new SlickEvent()); | ||
__publicField(this, "onSelectedRowIdsChanged", new SlickEvent()); | ||
__publicField(this, "onSetItemsCalled", new SlickEvent()); | ||
this._options = Utils.extend(!0, {}, this.defaults, options); | ||
__publicField(this, "onBeforePagingInfoChanged"); | ||
__publicField(this, "onGroupExpanded"); | ||
__publicField(this, "onGroupCollapsed"); | ||
__publicField(this, "onPagingInfoChanged"); | ||
__publicField(this, "onRowCountChanged"); | ||
__publicField(this, "onRowsChanged"); | ||
__publicField(this, "onRowsOrCountChanged"); | ||
__publicField(this, "onSelectedRowIdsChanged"); | ||
__publicField(this, "onSetItemsCalled"); | ||
this.onBeforePagingInfoChanged = new SlickEvent("onBeforePagingInfoChanged", externalPubSub), this.onGroupExpanded = new SlickEvent("onGroupExpanded", externalPubSub), this.onGroupCollapsed = new SlickEvent("onGroupCollapsed", externalPubSub), this.onPagingInfoChanged = new SlickEvent("onPagingInfoChanged", externalPubSub), this.onRowCountChanged = new SlickEvent("onRowCountChanged", externalPubSub), this.onRowsChanged = new SlickEvent("onRowsChanged", externalPubSub), this.onRowsOrCountChanged = new SlickEvent("onRowsOrCountChanged", externalPubSub), this.onSelectedRowIdsChanged = new SlickEvent("onSelectedRowIdsChanged", externalPubSub), this.onSetItemsCalled = new SlickEvent("onSetItemsCalled", externalPubSub), this._options = Utils.extend(!0, {}, this.defaults, options); | ||
} | ||
@@ -108,5 +110,7 @@ /** | ||
} | ||
/** provide some refresh hints as to what to rows needs refresh */ | ||
setRefreshHints(hints) { | ||
this.refreshHints = hints; | ||
} | ||
/** add extra filter arguments to the filter method */ | ||
setFilterArgs(args) { | ||
@@ -512,2 +516,3 @@ this.filterArgs = args; | ||
} | ||
/** claculate Group Totals */ | ||
calculateTotals(totals) { | ||
@@ -640,6 +645,3 @@ var _a2, _b2, _c; | ||
try { | ||
Object.defineProperty(fn, "name", { | ||
writable: !0, | ||
value: fnName | ||
}); | ||
Object.defineProperty(fn, "name", { writable: !0, value: fnName }); | ||
} catch (err) { | ||
@@ -646,0 +648,0 @@ fn.name = fnName; |
@@ -17,4 +17,4 @@ "use strict"; | ||
// events | ||
__publicField(this, "onDataLoading", new Slick.Event()); | ||
__publicField(this, "onDataLoaded", new Slick.Event()); | ||
__publicField(this, "onDataLoading", new Slick.Event("onDataLoading")); | ||
__publicField(this, "onDataLoaded", new Slick.Event("onDataLoaded")); | ||
if (!(window.$ || window.jQuery) || !window.$.jsonp) | ||
@@ -21,0 +21,0 @@ throw new Error("SlickRemoteModel requires both jQuery and jQuery jsonp library to be loaded."); |
@@ -20,4 +20,4 @@ "use strict"; | ||
// events | ||
__publicField(this, "onDataLoading", new Slick.Event()); | ||
__publicField(this, "onDataLoaded", new Slick.Event()); | ||
__publicField(this, "onDataLoading", new Slick.Event("onDataLoading")); | ||
__publicField(this, "onDataLoaded", new Slick.Event("onDataLoaded")); | ||
if (!(window.$ || window.jQuery) || !window.$.jsonp) | ||
@@ -24,0 +24,0 @@ throw new Error("SlickRemoteModel requires both jQuery and jQuery jsonp library to be loaded."); |
import type { Column, DOMMouseOrTouchEvent, GridMenuCommandItemCallbackArgs, GridMenuEventWithElementCallbackArgs, GridMenuItem, GridMenuOption, GridOption, MenuCommandItem, onGridMenuColumnsChangedCallbackArgs } from '../models/index'; | ||
import { BindingEventService as BindingEventService_ } from '../slick.core'; | ||
import { BindingEventService as BindingEventService_, SlickEvent as SlickEvent_ } from '../slick.core'; | ||
import type { SlickGrid } from '../slick.grid'; | ||
@@ -119,7 +119,7 @@ /** | ||
protected readonly grid: SlickGrid; | ||
onAfterMenuShow: import("../slick.core").SlickEvent<GridMenuEventWithElementCallbackArgs>; | ||
onBeforeMenuShow: import("../slick.core").SlickEvent<GridMenuEventWithElementCallbackArgs>; | ||
onMenuClose: import("../slick.core").SlickEvent<GridMenuEventWithElementCallbackArgs>; | ||
onCommand: import("../slick.core").SlickEvent<GridMenuCommandItemCallbackArgs>; | ||
onColumnsChanged: import("../slick.core").SlickEvent<onGridMenuColumnsChangedCallbackArgs>; | ||
onAfterMenuShow: SlickEvent_<GridMenuEventWithElementCallbackArgs>; | ||
onBeforeMenuShow: SlickEvent_<GridMenuEventWithElementCallbackArgs>; | ||
onMenuClose: SlickEvent_<GridMenuEventWithElementCallbackArgs>; | ||
onCommand: SlickEvent_<GridMenuCommandItemCallbackArgs>; | ||
onColumnsChanged: SlickEvent_<onGridMenuColumnsChangedCallbackArgs>; | ||
protected _bindingEventService: BindingEventService_; | ||
@@ -126,0 +126,0 @@ protected _gridOptions: GridOption; |
@@ -82,2 +82,7 @@ import type { Column as BaseColumn, CellMenuOption, ColumnPickerOption, ColumnReorderFunction, ContextMenuOption, CustomTooltipOption, EditCommand, Editor, ExcelCopyBufferOption, Formatter, GridMenuOption, ItemMetadata } from './index'; | ||
defaultFormatter?: Formatter; | ||
/** Escape hatch geared towards testing Slickgrid in jsdom based environments to circumvent the lack of stylesheet.ownerNode and clientWidth calculations */ | ||
devMode?: false & { | ||
ownerNodeIndex?: number; | ||
containerClientWidth?: number; | ||
}; | ||
/** Do we have paging enabled? */ | ||
@@ -84,0 +89,0 @@ doPaging?: boolean; |
@@ -18,2 +18,3 @@ export * from './aggregator.interface'; | ||
export * from './dataViewEvents.interface'; | ||
export * from './dataViewHints.interface'; | ||
export * from './domEvent.interface'; | ||
@@ -64,3 +65,2 @@ export * from './drag.interface'; | ||
export * from './pagingInfo.interface'; | ||
export * from './plugin.interface'; | ||
export * from './positionMethod.type'; | ||
@@ -76,4 +76,5 @@ export * from './resizerOption.interface'; | ||
export * from './slickGridModel.interface'; | ||
export * from './slickPlugin.interface'; | ||
export * from './sortDirectionNumber.enum'; | ||
export * from './usabilityOverrideFn.type'; | ||
//# sourceMappingURL=index.d.ts.map |
@@ -7,2 +7,6 @@ /** | ||
import type { EditController, ElementEventListener, Handler, InferDOMType, MergeTypes } from './models/index'; | ||
export interface BasePubSub { | ||
publish<ArgType = any>(_eventName: string | any, _data?: ArgType): any; | ||
subscribe<ArgType = any>(_eventName: string | Function, _callback: (data: ArgType) => void): any; | ||
} | ||
/** | ||
@@ -14,5 +18,5 @@ * An event object for passing data to event handlers and letting them control propagation. | ||
*/ | ||
export declare class SlickEventData { | ||
export declare class SlickEventData<ArgType = any> { | ||
protected event?: Event | null | undefined; | ||
protected args?: any; | ||
protected args?: ArgType | undefined; | ||
protected _isPropagationStopped: boolean; | ||
@@ -25,4 +29,4 @@ protected _isImmediatePropagationStopped: boolean; | ||
protected nativeEvent?: Event | null; | ||
protected arguments_: any; | ||
constructor(event?: Event | null | undefined, args?: any); | ||
protected arguments_?: ArgType; | ||
constructor(event?: Event | null | undefined, args?: ArgType | undefined); | ||
/** | ||
@@ -55,3 +59,3 @@ * Stops event from propagating up the DOM tree. | ||
getReturnValue(): any; | ||
getArguments(): any; | ||
getArguments(): ArgType | undefined; | ||
} | ||
@@ -64,4 +68,14 @@ /** | ||
export declare class SlickEvent<ArgType = any> { | ||
protected handlers: Handler<ArgType>[]; | ||
protected readonly eventName?: string | undefined; | ||
protected readonly pubSub?: BasePubSub | undefined; | ||
protected _handlers: Handler<ArgType>[]; | ||
protected _pubSubService?: BasePubSub; | ||
get subscriberCount(): number; | ||
/** | ||
* Constructor | ||
* @param {String} [eventName] - event name that could be used for dispatching CustomEvent (when enabled) | ||
* @param {BasePubSub} [pubSubService] - event name that could be used for dispatching CustomEvent (when enabled) | ||
*/ | ||
constructor(eventName?: string | undefined, pubSub?: BasePubSub | undefined); | ||
/** | ||
* Adds an event handler to be called when the event is fired. | ||
@@ -71,3 +85,3 @@ * <p>Event handler will receive two arguments - an <code>EventData</code> and the <code>data</code> | ||
* @method subscribe | ||
* @param fn {Function} Event handler. | ||
* @param {Function} fn - Event handler. | ||
*/ | ||
@@ -78,3 +92,3 @@ subscribe(fn: Handler<ArgType>): void; | ||
* @method unsubscribe | ||
* @param fn {Function} Event handler to be removed. | ||
* @param {Function} [fn] - Event handler to be removed. | ||
*/ | ||
@@ -85,13 +99,10 @@ unsubscribe(fn?: Handler<ArgType>): void; | ||
* @method notify | ||
* @param args {Object} Additional data object to be passed to all handlers. | ||
* @param e {EventData} | ||
* Optional. | ||
* An <code>EventData</code> object to be passed to all handlers. | ||
* @param {Object} args Additional data object to be passed to all handlers. | ||
* @param {EventData} [event] - An <code>EventData</code> object to be passed to all handlers. | ||
* For DOM events, an existing W3C event object can be passed in. | ||
* @param scope {Object} | ||
* Optional. | ||
* The scope ("this") within which the handler will be executed. | ||
* @param {Object} [scope] - The scope ("this") within which the handler will be executed. | ||
* If not specified, the scope will be set to the <code>Event</code> instance. | ||
*/ | ||
notify(args: ArgType, evt?: SlickEventData | Event | MergeTypes<SlickEventData, Event> | null, scope?: any): SlickEventData; | ||
notify(args: ArgType, evt?: SlickEventData | Event | MergeTypes<SlickEventData, Event> | null, scope?: any): SlickEventData<any>; | ||
setPubSubService(pubSub: BasePubSub): void; | ||
} | ||
@@ -395,2 +406,9 @@ export declare class SlickEventHandler<ArgType = any> { | ||
static applyDefaults(targetObj: any, srcObj: any): void; | ||
/** | ||
* User could optionally add PubSub Service to SlickEvent | ||
* When it is defined then a SlickEvent `notify()` call will also dispatch it by using the PubSub publish() method | ||
* @param {BasePubSub} [pubSubService] | ||
* @param {*} scope | ||
*/ | ||
static addSlickEventPubSubWhenDefined<T = any>(pubSub?: BasePubSub, scope?: T): void; | ||
} | ||
@@ -397,0 +415,0 @@ export declare const SlickGlobalEditorLock: SlickEditorLock; |
@@ -1,4 +0,3 @@ | ||
import type { Aggregator, CustomDataView, Grouping, ItemMetadata, OnGroupCollapsedEventArgs, OnGroupExpandedEventArgs, OnRowCountChangedEventArgs, OnRowsChangedEventArgs, OnRowsOrCountChangedEventArgs, OnSelectedRowIdsChangedEventArgs, OnSetItemsCalledEventArgs, PagingInfo } from './models/index'; | ||
import { SlickEvent as SlickEvent_, SlickGroup as SlickGroup_, SlickGroupTotals as SlickGroupTotals_, SlickNonDataItem } from './slick.core'; | ||
import type { SlickGrid } from './slick.grid'; | ||
import type { Aggregator, CustomDataView, DataViewHints, Grouping, ItemMetadata, OnGroupCollapsedEventArgs, OnGroupExpandedEventArgs, OnRowCountChangedEventArgs, OnRowsChangedEventArgs, OnRowsOrCountChangedEventArgs, OnSelectedRowIdsChangedEventArgs, OnSetItemsCalledEventArgs, PagingInfo, SlickGridModel } from './models/index'; | ||
import { type BasePubSub, SlickEvent as SlickEvent_, SlickGroup as SlickGroup_, SlickGroupTotals as SlickGroupTotals_, SlickNonDataItem } from './slick.core'; | ||
import { SlickGroupItemMetadataProvider as SlickGroupItemMetadataProvider_ } from './slick.groupitemmetadataprovider'; | ||
@@ -24,2 +23,3 @@ export interface DataViewOption { | ||
export declare class SlickDataView<TData extends SlickDataItem = any> implements CustomDataView { | ||
protected externalPubSub?: BasePubSub | undefined; | ||
protected defaults: DataViewOption; | ||
@@ -44,4 +44,4 @@ protected idProperty: string; | ||
protected sortComparer: ((a: TData, b: TData) => number); | ||
protected refreshHints: any; | ||
protected prevRefreshHints: any; | ||
protected refreshHints: DataViewHints; | ||
protected prevRefreshHints: DataViewHints; | ||
protected filterArgs: any; | ||
@@ -54,3 +54,3 @@ protected filteredItems: TData[]; | ||
protected filterCache: any[]; | ||
protected _grid?: SlickGrid; | ||
protected _grid?: SlickGridModel; | ||
protected groupingInfoDefaults: Grouping; | ||
@@ -72,2 +72,3 @@ protected groupingInfos: Array<Grouping & { | ||
protected _options: DataViewOption; | ||
protected _container?: HTMLElement; | ||
onBeforePagingInfoChanged: SlickEvent_<PagingInfo>; | ||
@@ -82,3 +83,3 @@ onGroupExpanded: SlickEvent_<OnGroupExpandedEventArgs>; | ||
onSetItemsCalled: SlickEvent_<OnSetItemsCalledEventArgs>; | ||
constructor(options: Partial<DataViewOption>); | ||
constructor(options: Partial<DataViewOption>, externalPubSub?: BasePubSub | undefined); | ||
/** | ||
@@ -94,3 +95,5 @@ * Begins a bached update of the items in the data view. | ||
destroy(): void; | ||
setRefreshHints(hints: any): void; | ||
/** provide some refresh hints as to what to rows needs refresh */ | ||
setRefreshHints(hints: DataViewHints): void; | ||
/** add extra filter arguments to the filter method */ | ||
setFilterArgs(args: any): void; | ||
@@ -249,2 +252,3 @@ /** | ||
protected extractGroups(rows: any[], parentGroup?: SlickGroup_): SlickGroup_[]; | ||
/** claculate Group Totals */ | ||
protected calculateTotals(totals: SlickGroupTotals_): void; | ||
@@ -299,3 +303,3 @@ protected addGroupTotals(group: SlickGroup_): void; | ||
*/ | ||
syncGridSelection(grid: SlickGrid, preserveHidden: boolean, preserveHiddenOnSelectionChange?: boolean): SlickEvent_<OnSelectedRowIdsChangedEventArgs>; | ||
syncGridSelection(grid: SlickGridModel, preserveHidden: boolean, preserveHiddenOnSelectionChange?: boolean): SlickEvent_<OnSelectedRowIdsChangedEventArgs>; | ||
/** | ||
@@ -336,3 +340,3 @@ * Get all selected IDs | ||
getAllSelectedFilteredItems<T extends TData>(): T[]; | ||
syncGridCellCssStyles(grid: SlickGrid, key: string): void; | ||
syncGridCellCssStyles(grid: SlickGridModel, key: string): void; | ||
} | ||
@@ -339,0 +343,0 @@ export declare class AvgAggregator<T = any> implements Aggregator { |
import type SortableInstance from 'sortablejs'; | ||
import type { AutoSize, CellViewportRange, Column, ColumnSort, CssStyleHash, CustomDataView, DOMEvent, DragPosition, DragRowMove, Editor, EditController, Formatter, FormatterResultWithHtml, FormatterResultWithText, GridOption as BaseGridOption, InteractionBase, MultiColumnSort, OnActiveCellChangedEventArgs, OnAddNewRowEventArgs, OnAutosizeColumnsEventArgs, OnBeforeUpdateColumnsEventArgs, OnBeforeAppendCellEventArgs, OnBeforeCellEditorDestroyEventArgs, OnBeforeColumnsResizeEventArgs, OnBeforeEditCellEventArgs, OnBeforeHeaderCellDestroyEventArgs, OnBeforeHeaderRowCellDestroyEventArgs, OnBeforeFooterRowCellDestroyEventArgs, OnBeforeSetColumnsEventArgs, OnCellChangeEventArgs, OnCellCssStylesChangedEventArgs, OnColumnsDragEventArgs, OnColumnsReorderedEventArgs, OnColumnsResizedEventArgs, OnColumnsResizeDblClickEventArgs, OnCompositeEditorChangeEventArgs, OnClickEventArgs, OnDblClickEventArgs, OnFooterContextMenuEventArgs, OnFooterRowCellRenderedEventArgs, OnHeaderCellRenderedEventArgs, OnFooterClickEventArgs, OnHeaderClickEventArgs, OnHeaderContextMenuEventArgs, OnHeaderMouseEventArgs, OnHeaderRowCellRenderedEventArgs, OnKeyDownEventArgs, OnValidationErrorEventArgs, OnRenderedEventArgs, OnSelectedRowsChangedEventArgs, OnSetOptionsEventArgs, OnActivateChangedOptionsEventArgs, OnScrollEventArgs, PagingInfo, RowInfo, SelectionModel, SingleColumnSort, SlickGridEventData, SlickPlugin } from './models/index'; | ||
import { BindingEventService as BindingEventService_, type SlickEditorLock, SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickRange as SlickRange_ } from './slick.core'; | ||
import { type BasePubSub, BindingEventService as BindingEventService_, type SlickEditorLock, SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickRange as SlickRange_ } from './slick.core'; | ||
/** | ||
@@ -13,3 +13,3 @@ * @license | ||
* | ||
* SlickGrid v5.5.6 | ||
* SlickGrid v5.6.0 | ||
* | ||
@@ -33,2 +33,3 @@ * NOTES: | ||
protected options: Partial<O>; | ||
protected externalPubSub?: BasePubSub | undefined; | ||
slickGridVersion: string; | ||
@@ -278,2 +279,3 @@ /** optional grid state clientId */ | ||
protected logMessageMaxCount: number; | ||
protected _pubSubService?: BasePubSub; | ||
/** | ||
@@ -288,3 +290,3 @@ * Creates a new instance of the grid. | ||
**/ | ||
constructor(container: HTMLElement | string, data: CustomDataView<TData> | TData[], columns: C[], options: Partial<O>); | ||
constructor(container: HTMLElement | string, data: CustomDataView<TData> | TData[], columns: C[], options: Partial<O>, externalPubSub?: BasePubSub | undefined); | ||
/** Initializes the grid. */ | ||
@@ -369,2 +371,3 @@ init(): void; | ||
getAbsoluteColumnMinWidth(): number; | ||
getPubSubService(): BasePubSub | undefined; | ||
protected bindAncestorScrollEvents(): void; | ||
@@ -473,3 +476,3 @@ protected unbindAncestorScrollEvents(): void; | ||
getVisibleColumns(): C[]; | ||
protected trigger<ArgType = any>(evt: SlickEvent_, args?: ArgType, e?: Event | SlickEventData_): SlickEventData_; | ||
protected trigger<ArgType = any>(evt: SlickEvent_, args?: ArgType, e?: Event | SlickEventData_): SlickEventData_<any>; | ||
/** Get Editor lock */ | ||
@@ -527,3 +530,3 @@ getEditorLock(): SlickEditorLock; | ||
*/ | ||
setOptions(args: Partial<O>, suppressRender?: boolean, suppressColumnSet?: boolean, suppressSetOverflow?: boolean): void; | ||
setOptions(newOptions: Partial<O>, suppressRender?: boolean, suppressColumnSet?: boolean, suppressSetOverflow?: boolean): void; | ||
/** | ||
@@ -530,0 +533,0 @@ * If option.mixinDefaults is true then external code maintains a reference to the options object. In this case there is no need |
{ | ||
"name": "slickgrid", | ||
"version": "5.5.6", | ||
"version": "5.6.0", | ||
"description": "A lightning fast JavaScript grid/spreadsheet", | ||
@@ -5,0 +5,0 @@ "main": "./dist/browser/index.js", |
@@ -38,3 +38,3 @@ import { BindingEventService as BindingEventService_, Event as SlickEvent_, Utils as Utils_ } from '../slick.core'; | ||
// public API | ||
onColumnsChanged = new SlickEvent<OnColumnsChangedArgs>(); | ||
onColumnsChanged = new SlickEvent<OnColumnsChangedArgs>('onColumnsChanged'); | ||
@@ -68,2 +68,3 @@ // -- | ||
init(grid: SlickGrid) { | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
grid.onHeaderContextMenu.subscribe(this.handleHeaderContextMenu.bind(this)); | ||
@@ -70,0 +71,0 @@ grid.onColumnsReordered.subscribe(this.updateColumnOrder.bind(this)); |
@@ -39,3 +39,3 @@ import { BindingEventService as BindingEventService_, Event as SlickEvent_, Utils as Utils_ } from '../slick.core'; | ||
// public API | ||
onColumnsChanged = new SlickEvent<OnColumnsChangedArgs>(); | ||
onColumnsChanged = new SlickEvent<OnColumnsChangedArgs>('onColumnsChanged'); | ||
@@ -69,2 +69,3 @@ // -- | ||
init(grid: SlickGrid) { | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
grid.onHeaderContextMenu.subscribe(this.handleHeaderContextMenu.bind(this)); | ||
@@ -71,0 +72,0 @@ grid.onColumnsReordered.subscribe(this.updateColumnOrder.bind(this)); |
@@ -12,3 +12,3 @@ import type { | ||
} from '../models/index'; | ||
import { BindingEventService as BindingEventService_, Event as SlickEvent_, Utils as Utils_ } from '../slick.core'; | ||
import { BindingEventService as BindingEventService_, SlickEvent as SlickEvent_, Utils as Utils_ } from '../slick.core'; | ||
import type { SlickGrid } from '../slick.grid'; | ||
@@ -137,7 +137,7 @@ | ||
// public API | ||
onAfterMenuShow = new SlickEvent<GridMenuEventWithElementCallbackArgs>(); | ||
onBeforeMenuShow = new SlickEvent<GridMenuEventWithElementCallbackArgs>(); | ||
onMenuClose = new SlickEvent<GridMenuEventWithElementCallbackArgs>(); | ||
onCommand = new SlickEvent<GridMenuCommandItemCallbackArgs>(); | ||
onColumnsChanged = new SlickEvent<onGridMenuColumnsChangedCallbackArgs>(); | ||
onAfterMenuShow = new SlickEvent<GridMenuEventWithElementCallbackArgs>('onAfterMenuShow'); | ||
onBeforeMenuShow = new SlickEvent<GridMenuEventWithElementCallbackArgs>('onBeforeMenuShow'); | ||
onMenuClose = new SlickEvent<GridMenuEventWithElementCallbackArgs>('onMenuClose'); | ||
onCommand = new SlickEvent<GridMenuCommandItemCallbackArgs>('onCommand'); | ||
onColumnsChanged = new SlickEvent<onGridMenuColumnsChangedCallbackArgs>('onColumnsChanged'); | ||
@@ -197,2 +197,3 @@ // -- | ||
this._gridOptions = grid.getOptions(); | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this.createGridMenu(); | ||
@@ -199,0 +200,0 @@ |
@@ -111,2 +111,5 @@ import type { Column as BaseColumn, CellMenuOption, ColumnPickerOption, ColumnReorderFunction, ContextMenuOption, CustomTooltipOption, EditCommand, Editor, ExcelCopyBufferOption, Formatter, GridMenuOption, ItemMetadata, } from './index'; | ||
/** Escape hatch geared towards testing Slickgrid in jsdom based environments to circumvent the lack of stylesheet.ownerNode and clientWidth calculations */ | ||
devMode?: false & { ownerNodeIndex?: number; containerClientWidth?: number; }; | ||
/** Do we have paging enabled? */ | ||
@@ -113,0 +116,0 @@ doPaging?: boolean; |
@@ -18,2 +18,3 @@ export * from './aggregator.interface'; | ||
export * from './dataViewEvents.interface'; | ||
export * from './dataViewHints.interface'; | ||
export * from './domEvent.interface'; | ||
@@ -64,3 +65,2 @@ export * from './drag.interface'; | ||
export * from './pagingInfo.interface'; | ||
export * from './plugin.interface'; | ||
export * from './positionMethod.type'; | ||
@@ -76,3 +76,4 @@ export * from './resizerOption.interface'; | ||
export * from './slickGridModel.interface'; | ||
export * from './slickPlugin.interface'; | ||
export * from './sortDirectionNumber.enum'; | ||
export * from './usabilityOverrideFn.type'; |
@@ -17,5 +17,5 @@ import type { CssStyleHash, SlickPlugin } from '../models/index'; | ||
pluginName = 'CellCopyManager' as const; | ||
onCopyCells = new SlickEvent<{ ranges: SlickRange[] | null; }>(); | ||
onCopyCancelled = new SlickEvent<{ ranges: SlickRange[] | null; }>(); | ||
onPasteCells = new SlickEvent<{ from: SlickRange[] | undefined; to: SlickRange[] | undefined; }>(); | ||
onCopyCells = new SlickEvent<{ ranges: SlickRange[] | null; }>('onCopyCells'); | ||
onCopyCancelled = new SlickEvent<{ ranges: SlickRange[] | null; }>('onCopyCancelled'); | ||
onPasteCells = new SlickEvent<{ from: SlickRange[] | undefined; to: SlickRange[] | undefined; }>('onPasteCells'); | ||
@@ -29,2 +29,3 @@ // -- | ||
this._grid = grid; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this._grid.onKeyDown.subscribe(this.handleKeyDown.bind(this)); | ||
@@ -31,0 +32,0 @@ } |
@@ -39,5 +39,5 @@ import type { Column, CssStyleHash, ExcelCopyBufferOption, ExternalCopyClipCommand, SlickPlugin } from '../models/index'; | ||
pluginName = 'CellExternalCopyManager' as const; | ||
onCopyCells = new SlickEvent<{ ranges: SlickRange_[]; }>(); | ||
onCopyCancelled = new SlickEvent<{ ranges: SlickRange_[]; }>(); | ||
onPasteCells = new SlickEvent<{ ranges: SlickRange_[]; }>(); | ||
onCopyCells = new SlickEvent<{ ranges: SlickRange_[]; }>('onCopyCells'); | ||
onCopyCancelled = new SlickEvent<{ ranges: SlickRange_[]; }>('onCopyCancelled'); | ||
onPasteCells = new SlickEvent<{ ranges: SlickRange_[]; }>('onPasteCells'); | ||
@@ -74,2 +74,3 @@ // -- | ||
this._grid = grid; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this._grid.onKeyDown.subscribe(this.handleKeyDown.bind(this)); | ||
@@ -76,0 +77,0 @@ |
@@ -158,7 +158,7 @@ import { | ||
pluginName = 'CellMenu' as const; | ||
onAfterMenuShow = new SlickEvent<MenuFromCellCallbackArgs>(); | ||
onBeforeMenuShow = new SlickEvent<MenuFromCellCallbackArgs>(); | ||
onBeforeMenuClose = new SlickEvent<MenuFromCellCallbackArgs>(); | ||
onCommand = new SlickEvent<MenuCommandItemCallbackArgs>(); | ||
onOptionSelected = new SlickEvent<MenuOptionItemCallbackArgs>(); | ||
onAfterMenuShow = new SlickEvent<MenuFromCellCallbackArgs>('onAfterMenuShow'); | ||
onBeforeMenuShow = new SlickEvent<MenuFromCellCallbackArgs>('onBeforeMenuShow'); | ||
onBeforeMenuClose = new SlickEvent<MenuFromCellCallbackArgs>('onBeforeMenuClose'); | ||
onCommand = new SlickEvent<MenuCommandItemCallbackArgs>('onCommand'); | ||
onOptionSelected = new SlickEvent<MenuOptionItemCallbackArgs>('onOptionSelected'); | ||
@@ -198,2 +198,3 @@ // -- | ||
this._gridOptions = grid.getOptions(); | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this._gridUid = grid?.getUID() || ''; | ||
@@ -200,0 +201,0 @@ this._handler.subscribe(this._grid.onClick, this.handleCellClick.bind(this)); |
@@ -19,5 +19,5 @@ import { SlickEvent as SlickEvent_, SlickEventData, SlickEventHandler as SlickEventHandler_, SlickRange as SlickRange_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'CellRangeSelector' as const; | ||
onBeforeCellRangeSelected = new SlickEvent<{ row: number; cell: number; }>(); | ||
onCellRangeSelected = new SlickEvent<{ range: SlickRange_; }>(); | ||
onCellRangeSelecting = new SlickEvent<{ range: SlickRange_; }>(); | ||
onBeforeCellRangeSelected = new SlickEvent<{ row: number; cell: number; }>('onBeforeCellRangeSelected'); | ||
onCellRangeSelected = new SlickEvent<{ range: SlickRange_; }>('onCellRangeSelected'); | ||
onCellRangeSelecting = new SlickEvent<{ range: SlickRange_; }>('onCellRangeSelecting'); | ||
@@ -77,2 +77,3 @@ // -- | ||
this._grid = grid; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this._canvas = this._grid.getCanvasNode(); | ||
@@ -79,0 +80,0 @@ this._gridOptions = this._grid.getOptions(); |
@@ -23,3 +23,3 @@ import { SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickRange as SlickRange_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'CellSelectionModel' as const; | ||
onSelectedRangesChanged = new SlickEvent<SlickRange_[]>(); | ||
onSelectedRangesChanged = new SlickEvent<SlickRange_[]>('onSelectedRangesChanged'); | ||
@@ -26,0 +26,0 @@ // -- |
@@ -165,7 +165,7 @@ import { | ||
pluginName = 'ContextMenu' as const; | ||
onAfterMenuShow = new SlickEvent<MenuFromCellCallbackArgs>(); | ||
onBeforeMenuShow = new SlickEvent<MenuFromCellCallbackArgs>(); | ||
onBeforeMenuClose = new SlickEvent<MenuFromCellCallbackArgs>(); | ||
onCommand = new SlickEvent<MenuCommandItemCallbackArgs>(); | ||
onOptionSelected = new SlickEvent<MenuOptionItemCallbackArgs>(); | ||
onAfterMenuShow = new SlickEvent<MenuFromCellCallbackArgs>('onAfterMenuShow'); | ||
onBeforeMenuShow = new SlickEvent<MenuFromCellCallbackArgs>('onBeforeMenuShow'); | ||
onBeforeMenuClose = new SlickEvent<MenuFromCellCallbackArgs>('onBeforeMenuClose'); | ||
onCommand = new SlickEvent<MenuCommandItemCallbackArgs>('onCommand'); | ||
onOptionSelected = new SlickEvent<MenuOptionItemCallbackArgs>('onOptionSelected'); | ||
@@ -207,3 +207,4 @@ // -- | ||
this._gridOptions = grid.getOptions(); | ||
this._gridUid = grid?.getUID() || ''; | ||
this._gridUid = grid.getUID() || ''; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this._handler.subscribe(this._grid.onContextMenu, this.handleOnContextMenu.bind(this)); | ||
@@ -210,0 +211,0 @@ if (this._contextMenuProperties.hideMenuOnScroll) { |
@@ -30,4 +30,4 @@ import { SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickEventHandler as SlickEventHandler_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'CrossGridRowMoveManager' as const; | ||
onBeforeMoveRows = new SlickEvent<{ rows: number[]; insertBefore: number; fromGrid: SlickGrid; toGrid: SlickGrid; }>(); | ||
onMoveRows = new SlickEvent<{ rows: number[]; insertBefore: number; fromGrid: SlickGrid; toGrid: SlickGrid; }>(); | ||
onBeforeMoveRows = new SlickEvent<{ rows: number[]; insertBefore: number; fromGrid: SlickGrid; toGrid: SlickGrid; }>('onBeforeMoveRows'); | ||
onMoveRows = new SlickEvent<{ rows: number[]; insertBefore: number; fromGrid: SlickGrid; toGrid: SlickGrid; }>('onMoveRows'); | ||
@@ -69,2 +69,3 @@ // -- | ||
this._toCanvas = this._toGrid.getCanvasNode(); | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
@@ -71,0 +72,0 @@ // user could override the expandable icon logic from within the options or after instantiating the plugin |
@@ -45,3 +45,3 @@ // @ts-ignore | ||
pluginName = 'DraggableGrouping' as const; | ||
onGroupChanged = new SlickEvent<{ caller?: string; groupColumns: Grouping[]; }>(); | ||
onGroupChanged = new SlickEvent<{ caller?: string; groupColumns: Grouping[]; }>('onGroupChanged'); | ||
@@ -89,2 +89,4 @@ // -- | ||
this._grid = grid; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this._gridUid = this._grid.getUID(); | ||
@@ -257,2 +259,5 @@ this._gridColumns = this._grid.getColumns(); | ||
this.destroySortableInstances(); | ||
if (this._droppableInstance?.el) { | ||
this._droppableInstance?.destroy(); | ||
} | ||
this.onGroupChanged.unsubscribe(); | ||
@@ -259,0 +264,0 @@ this._handler.unsubscribeAll(); |
@@ -88,3 +88,3 @@ import type { | ||
pluginName = 'HeaderButtons' as const; | ||
onCommand = new SlickEvent<HeaderButtonOnCommandArgs>(); | ||
onCommand = new SlickEvent<HeaderButtonOnCommandArgs>('onCommand'); | ||
@@ -107,2 +107,3 @@ // -- | ||
this._grid = grid; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this._handler | ||
@@ -109,0 +110,0 @@ .subscribe(this._grid.onHeaderCellRendered, this.handleHeaderCellRendered.bind(this)) |
@@ -114,5 +114,5 @@ import { BindingEventService as BindingEventService_, Event as SlickEvent_, SlickEventHandler as SlickEventHandler_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'HeaderMenu' as const; | ||
onAfterMenuShow = new SlickEvent<HeaderMenuCommandItemCallbackArgs>(); | ||
onBeforeMenuShow = new SlickEvent<HeaderMenuCommandItemCallbackArgs>(); | ||
onCommand = new SlickEvent<MenuCommandItemCallbackArgs>(); | ||
onAfterMenuShow = new SlickEvent<HeaderMenuCommandItemCallbackArgs>('onAfterMenuShow'); | ||
onBeforeMenuShow = new SlickEvent<HeaderMenuCommandItemCallbackArgs>('onBeforeMenuShow'); | ||
onCommand = new SlickEvent<MenuCommandItemCallbackArgs>('onCommand'); | ||
@@ -145,2 +145,3 @@ // -- | ||
this._gridUid = grid?.getUID() || ''; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
this._handler | ||
@@ -147,0 +148,0 @@ .subscribe(this._grid.onHeaderCellRendered, this.handleHeaderCellRendered.bind(this)) |
@@ -67,4 +67,4 @@ import { BindingEventService as BindingEventService_, Event as SlickEvent_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'Resizer' as const; | ||
onGridAfterResize = new SlickEvent<{ grid: SlickGrid; dimensions: GridSize; }>(); | ||
onGridBeforeResize = new SlickEvent<{ grid: SlickGrid; }>(); | ||
onGridAfterResize = new SlickEvent<{ grid: SlickGrid; dimensions: GridSize; }>('onGridAfterResize'); | ||
onGridBeforeResize = new SlickEvent<{ grid: SlickGrid; }>('onGridBeforeResize'); | ||
@@ -121,2 +121,3 @@ // -- | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
if (this._gridOptions) { | ||
@@ -123,0 +124,0 @@ this.bindAutoResizeDataGrid(); |
@@ -96,8 +96,8 @@ import { SlickEvent as SlickEvent_, SlickEventHandler as SlickEventHandler_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'RowDetailView' as const; | ||
onAsyncResponse = new SlickEvent<OnRowDetailAsyncResponseArgs>(); | ||
onAsyncEndUpdate = new SlickEvent<OnRowDetailAsyncEndUpdateArgs>(); | ||
onAfterRowDetailToggle = new SlickEvent<OnAfterRowDetailToggleArgs>(); | ||
onBeforeRowDetailToggle = new SlickEvent<OnBeforeRowDetailToggleArgs>(); | ||
onRowBackToViewportRange = new SlickEvent<OnRowBackToViewportRangeArgs>(); | ||
onRowOutOfViewportRange = new SlickEvent<OnRowOutOfViewportRangeArgs>(); | ||
onAsyncResponse = new SlickEvent<OnRowDetailAsyncResponseArgs>('onAsyncResponse'); | ||
onAsyncEndUpdate = new SlickEvent<OnRowDetailAsyncEndUpdateArgs>('onAsyncEndUpdate'); | ||
onAfterRowDetailToggle = new SlickEvent<OnAfterRowDetailToggleArgs>('onAfterRowDetailToggle'); | ||
onBeforeRowDetailToggle = new SlickEvent<OnBeforeRowDetailToggleArgs>('onBeforeRowDetailToggle'); | ||
onRowBackToViewportRange = new SlickEvent<OnRowBackToViewportRangeArgs>('onRowBackToViewportRange'); | ||
onRowOutOfViewportRange = new SlickEvent<OnRowOutOfViewportRangeArgs>('onRowOutOfViewportRange'); | ||
@@ -162,2 +162,3 @@ // -- | ||
this._keyPrefix = this._options?.keyPrefix ?? '_'; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
@@ -164,0 +165,0 @@ // Update the minRowBuffer so that the view doesn't disappear when it's at top of screen + the original default 3 |
@@ -32,4 +32,4 @@ import { SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickEventHandler as SlickEventHandler_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'RowMoveManager' as const; | ||
onBeforeMoveRows = new SlickEvent<{ grid: SlickGrid; rows: number[]; insertBefore: number; }>(); | ||
onMoveRows = new SlickEvent<{ grid: SlickGrid; rows: number[]; insertBefore: number; }>(); | ||
onBeforeMoveRows = new SlickEvent<{ grid: SlickGrid; rows: number[]; insertBefore: number; }>('onBeforeMoveRows'); | ||
onMoveRows = new SlickEvent<{ grid: SlickGrid; rows: number[]; insertBefore: number; }>('onMoveRows'); | ||
@@ -67,2 +67,3 @@ // -- | ||
this._canvas = this._grid.getCanvasNode(); | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
@@ -69,0 +70,0 @@ // user could override the expandable icon logic from within the options or after instantiating the plugin |
@@ -25,3 +25,3 @@ import { keyCode as keyCode_, SlickEvent as SlickEvent_, SlickEventData as SlickEventData_, SlickEventHandler as SlickEventHandler_, SlickRange as SlickRange_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'RowSelectionModel' as const; | ||
onSelectedRangesChanged = new SlickEvent<SlickRange_[]>(); | ||
onSelectedRangesChanged = new SlickEvent<SlickRange_[]>('onSelectedRangesChanged'); | ||
// _handler, _inHandler, _isRowMoveManagerHandler, _options, wrapHandler | ||
@@ -55,2 +55,3 @@ // -- | ||
this._grid = grid; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
@@ -57,0 +58,0 @@ if (!this._selector && this._options.dragToSelect) { |
@@ -73,3 +73,3 @@ import { SlickEvent as SlickEvent_, Utils as Utils_ } from '../slick.core'; | ||
pluginName = 'State' as const; | ||
onStateChanged = new SlickEvent<CurrentState>(); | ||
onStateChanged = new SlickEvent<CurrentState>('onStateChanged'); | ||
@@ -101,2 +101,4 @@ // -- | ||
this._cid = grid.cid || this._options.cid; | ||
Utils.addSlickEventPubSubWhenDefined(grid.getPubSubService(), this); | ||
if (this._cid) { | ||
@@ -103,0 +105,0 @@ this._grid.onColumnsResized.subscribe(this.save.bind(this)); |
@@ -16,2 +16,7 @@ /** | ||
export interface BasePubSub { | ||
publish<ArgType = any>(_eventName: string | any, _data?: ArgType): any; | ||
subscribe<ArgType = any>(_eventName: string | Function, _callback: (data: ArgType) => void): any; | ||
} | ||
/** | ||
@@ -23,3 +28,3 @@ * An event object for passing data to event handlers and letting them control propagation. | ||
*/ | ||
export class SlickEventData { | ||
export class SlickEventData<ArgType = any> { | ||
protected _isPropagationStopped = false; | ||
@@ -32,5 +37,5 @@ protected _isImmediatePropagationStopped = false; | ||
protected nativeEvent?: Event | null; | ||
protected arguments_: any; | ||
protected arguments_?: ArgType; | ||
constructor(protected event?: Event | null, protected args?: any) { | ||
constructor(protected event?: Event | null, protected args?: ArgType) { | ||
this.nativeEvent = event; | ||
@@ -132,5 +137,19 @@ this.arguments_ = args; | ||
export class SlickEvent<ArgType = any> { | ||
protected handlers: Handler<ArgType>[] = []; | ||
protected _handlers: Handler<ArgType>[] = []; | ||
protected _pubSubService?: BasePubSub; | ||
get subscriberCount() { | ||
return this._handlers.length; | ||
} | ||
/** | ||
* Constructor | ||
* @param {String} [eventName] - event name that could be used for dispatching CustomEvent (when enabled) | ||
* @param {BasePubSub} [pubSubService] - event name that could be used for dispatching CustomEvent (when enabled) | ||
*/ | ||
constructor(protected readonly eventName?: string, protected readonly pubSub?: BasePubSub) { | ||
this._pubSubService = pubSub; | ||
} | ||
/** | ||
* Adds an event handler to be called when the event is fired. | ||
@@ -140,6 +159,6 @@ * <p>Event handler will receive two arguments - an <code>EventData</code> and the <code>data</code> | ||
* @method subscribe | ||
* @param fn {Function} Event handler. | ||
* @param {Function} fn - Event handler. | ||
*/ | ||
subscribe(fn: Handler<ArgType>) { | ||
this.handlers.push(fn); | ||
this._handlers.push(fn); | ||
} | ||
@@ -150,8 +169,8 @@ | ||
* @method unsubscribe | ||
* @param fn {Function} Event handler to be removed. | ||
* @param {Function} [fn] - Event handler to be removed. | ||
*/ | ||
unsubscribe(fn?: Handler<ArgType>) { | ||
for (let i = this.handlers.length - 1; i >= 0; i--) { | ||
if (this.handlers[i] === fn) { | ||
this.handlers.splice(i, 1); | ||
for (let i = this._handlers.length - 1; i >= 0; i--) { | ||
if (this._handlers[i] === fn) { | ||
this._handlers.splice(i, 1); | ||
} | ||
@@ -164,10 +183,6 @@ } | ||
* @method notify | ||
* @param args {Object} Additional data object to be passed to all handlers. | ||
* @param e {EventData} | ||
* Optional. | ||
* An <code>EventData</code> object to be passed to all handlers. | ||
* @param {Object} args Additional data object to be passed to all handlers. | ||
* @param {EventData} [event] - An <code>EventData</code> object to be passed to all handlers. | ||
* For DOM events, an existing W3C event object can be passed in. | ||
* @param scope {Object} | ||
* Optional. | ||
* The scope ("this") within which the handler will be executed. | ||
* @param {Object} [scope] - The scope ("this") within which the handler will be executed. | ||
* If not specified, the scope will be set to the <code>Event</code> instance. | ||
@@ -181,9 +196,18 @@ */ | ||
for (let i = 0; i < this.handlers.length && !(sed.isPropagationStopped() || sed.isImmediatePropagationStopped()); i++) { | ||
const returnValue = this.handlers[i].call(scope, sed as SlickEvent | SlickEventData, args); | ||
for (let i = 0; i < this._handlers.length && !(sed.isPropagationStopped() || sed.isImmediatePropagationStopped()); i++) { | ||
const returnValue = this._handlers[i].call(scope, sed as SlickEvent | SlickEventData, args); | ||
sed.addReturnValue(returnValue); | ||
} | ||
// user can optionally add a global PubSub Service which makes it easy to publish/subscribe to events | ||
if (typeof this._pubSubService?.publish === 'function' && this.eventName) { | ||
const ret = this._pubSubService.publish<{ args: ArgType; eventData?: Event | SlickEventData; nativeEvent?: Event; }>(this.eventName, { args, eventData: sed }); | ||
sed.addReturnValue(ret); | ||
} | ||
return sed; | ||
} | ||
setPubSubService(pubSub: BasePubSub) { | ||
this._pubSubService = pubSub; | ||
} | ||
} | ||
@@ -647,4 +671,3 @@ | ||
public static isFunction(obj: any) { | ||
return typeof obj === 'function' && typeof obj.nodeType !== 'number' && | ||
typeof obj.item !== 'function'; | ||
return typeof obj === 'function' && typeof obj.nodeType !== 'number' && typeof obj.item !== 'function'; | ||
} | ||
@@ -924,5 +947,3 @@ | ||
if (Array.isArray(el)) { | ||
el.forEach(function (e) { | ||
e.style.display = 'none'; | ||
}); | ||
el.forEach((e) => e.style.display = 'none'); | ||
} else { | ||
@@ -957,2 +978,18 @@ el.style.display = 'none'; | ||
} | ||
/** | ||
* User could optionally add PubSub Service to SlickEvent | ||
* When it is defined then a SlickEvent `notify()` call will also dispatch it by using the PubSub publish() method | ||
* @param {BasePubSub} [pubSubService] | ||
* @param {*} scope | ||
*/ | ||
public static addSlickEventPubSubWhenDefined<T = any>(pubSub?: BasePubSub, scope?: T) { | ||
if (pubSub) { | ||
for (const prop in scope) { | ||
if (scope[prop] instanceof SlickEvent && typeof (scope[prop] as SlickEvent).setPubSubService === 'function') { | ||
(scope[prop] as SlickEvent).setPubSubService(pubSub); | ||
} | ||
} | ||
} | ||
} | ||
} | ||
@@ -959,0 +996,0 @@ |
@@ -5,2 +5,3 @@ import type { | ||
CustomDataView, | ||
DataViewHints, | ||
Grouping, | ||
@@ -17,4 +18,6 @@ GroupingFormatterItem, | ||
PagingInfo, | ||
SlickGridModel, | ||
} from './models/index'; | ||
import { | ||
type BasePubSub, | ||
SlickEvent as SlickEvent_, | ||
@@ -27,3 +30,2 @@ SlickEventData as SlickEventData_, | ||
} from './slick.core'; | ||
import type { SlickGrid } from './slick.grid'; | ||
import { SlickGroupItemMetadataProvider as SlickGroupItemMetadataProvider_ } from './slick.groupitemmetadataprovider'; | ||
@@ -82,4 +84,4 @@ | ||
protected sortComparer!: ((a: TData, b: TData) => number); | ||
protected refreshHints: any = {}; | ||
protected prevRefreshHints: any = {}; | ||
protected refreshHints: DataViewHints = {}; | ||
protected prevRefreshHints: DataViewHints = {}; | ||
protected filterArgs: any; | ||
@@ -92,3 +94,3 @@ protected filteredItems: TData[] = []; | ||
protected filterCache: any[] = []; | ||
protected _grid?: SlickGrid; // grid object will be defined only after using "syncGridSelection()" method" | ||
protected _grid?: SlickGridModel; // grid object will be defined only after using "syncGridSelection()" method" | ||
@@ -120,15 +122,26 @@ // grouping | ||
protected _options: DataViewOption; | ||
protected _container?: HTMLElement; | ||
// public events | ||
onBeforePagingInfoChanged = new SlickEvent<PagingInfo>(); | ||
onGroupExpanded = new SlickEvent<OnGroupExpandedEventArgs>(); | ||
onGroupCollapsed = new SlickEvent<OnGroupCollapsedEventArgs>(); | ||
onPagingInfoChanged = new SlickEvent<PagingInfo>(); | ||
onRowCountChanged = new SlickEvent<OnRowCountChangedEventArgs>(); | ||
onRowsChanged = new SlickEvent<OnRowsChangedEventArgs>(); | ||
onRowsOrCountChanged = new SlickEvent<OnRowsOrCountChangedEventArgs>(); | ||
onSelectedRowIdsChanged = new SlickEvent<OnSelectedRowIdsChangedEventArgs>(); | ||
onSetItemsCalled = new SlickEvent<OnSetItemsCalledEventArgs>(); | ||
onBeforePagingInfoChanged: SlickEvent_<PagingInfo>; | ||
onGroupExpanded: SlickEvent_<OnGroupExpandedEventArgs>; | ||
onGroupCollapsed: SlickEvent_<OnGroupCollapsedEventArgs>; | ||
onPagingInfoChanged: SlickEvent_<PagingInfo>; | ||
onRowCountChanged: SlickEvent_<OnRowCountChangedEventArgs>; | ||
onRowsChanged: SlickEvent_<OnRowsChangedEventArgs>; | ||
onRowsOrCountChanged: SlickEvent_<OnRowsOrCountChangedEventArgs>; | ||
onSelectedRowIdsChanged: SlickEvent_<OnSelectedRowIdsChangedEventArgs>; | ||
onSetItemsCalled: SlickEvent_<OnSetItemsCalledEventArgs>; | ||
constructor(options: Partial<DataViewOption>) { | ||
constructor(options: Partial<DataViewOption>, protected externalPubSub?: BasePubSub) { | ||
this.onBeforePagingInfoChanged = new SlickEvent<PagingInfo>('onBeforePagingInfoChanged', externalPubSub); | ||
this.onGroupExpanded = new SlickEvent<OnGroupExpandedEventArgs>('onGroupExpanded', externalPubSub); | ||
this.onGroupCollapsed = new SlickEvent<OnGroupCollapsedEventArgs>('onGroupCollapsed', externalPubSub); | ||
this.onPagingInfoChanged = new SlickEvent<PagingInfo>('onPagingInfoChanged', externalPubSub); | ||
this.onRowCountChanged = new SlickEvent<OnRowCountChangedEventArgs>('onRowCountChanged', externalPubSub); | ||
this.onRowsChanged = new SlickEvent<OnRowsChangedEventArgs>('onRowsChanged', externalPubSub); | ||
this.onRowsOrCountChanged = new SlickEvent<OnRowsOrCountChangedEventArgs>('onRowsOrCountChanged', externalPubSub); | ||
this.onSelectedRowIdsChanged = new SlickEvent<OnSelectedRowIdsChangedEventArgs>('onSelectedRowIdsChanged', externalPubSub); | ||
this.onSetItemsCalled = new SlickEvent<OnSetItemsCalledEventArgs>('onSetItemsCalled', externalPubSub); | ||
this._options = Utils.extend(true, {}, this.defaults, options); | ||
@@ -184,6 +197,8 @@ } | ||
setRefreshHints(hints: any) { | ||
/** provide some refresh hints as to what to rows needs refresh */ | ||
setRefreshHints(hints: DataViewHints) { | ||
this.refreshHints = hints; | ||
} | ||
/** add extra filter arguments to the filter method */ | ||
setFilterArgs(args: any) { | ||
@@ -830,4 +845,4 @@ this.filterArgs = args; | ||
const arg0 = calledArgs[0]; | ||
let groupingKey; | ||
let level; | ||
let groupingKey: string; | ||
let level: number; | ||
@@ -855,4 +870,4 @@ if (args.length === 1 && arg0.indexOf(this.groupingDelimiter) !== -1) { | ||
const arg0 = calledArgs[0]; | ||
let groupingKey; | ||
let level; | ||
let groupingKey: string; | ||
let level: number; | ||
@@ -876,4 +891,4 @@ if (args.length === 1 && arg0.indexOf(this.groupingDelimiter) !== -1) { | ||
protected extractGroups(rows: any[], parentGroup?: SlickGroup_) { | ||
let group; | ||
let val; | ||
let group: SlickGroup_; | ||
let val: any; | ||
const groups: SlickGroup_[] = []; | ||
@@ -930,2 +945,3 @@ const groupsByVal: any = {}; | ||
/** claculate Group Totals */ | ||
protected calculateTotals(totals: SlickGroupTotals_) { | ||
@@ -1184,6 +1200,3 @@ const group = totals.group; | ||
try { | ||
Object.defineProperty(fn, 'name', { | ||
writable: true, | ||
value: fnName | ||
}); | ||
Object.defineProperty(fn, 'name', { writable: true, value: fnName }); | ||
} catch (err) { | ||
@@ -1268,3 +1281,3 @@ fn.name = fnName; | ||
protected getRowDiffs(rows: TData[], newRows: TData[]) { | ||
let item: any; | ||
let item: TData | SlickNonDataItem | SlickDataItem | SlickGroup_; | ||
let r; | ||
@@ -1400,3 +1413,3 @@ let eitherIsNonData; | ||
*/ | ||
syncGridSelection(grid: SlickGrid, preserveHidden: boolean, preserveHiddenOnSelectionChange?: boolean) { | ||
syncGridSelection(grid: SlickGridModel, preserveHidden: boolean, preserveHiddenOnSelectionChange?: boolean) { | ||
this._grid = grid; | ||
@@ -1577,3 +1590,3 @@ let inHandler: boolean; | ||
syncGridCellCssStyles(grid: SlickGrid, key: string) { | ||
syncGridCellCssStyles(grid: SlickGridModel, key: string) { | ||
let hashById: any; | ||
@@ -1580,0 +1593,0 @@ let inHandler: boolean; |
@@ -14,4 +14,4 @@ /*** | ||
// events | ||
protected onDataLoading = new Slick.Event(); | ||
protected onDataLoaded = new Slick.Event(); | ||
protected onDataLoading = new Slick.Event('onDataLoading'); | ||
protected onDataLoaded = new Slick.Event('onDataLoaded'); | ||
@@ -18,0 +18,0 @@ constructor() { |
@@ -19,4 +19,4 @@ import type { ColumnSort } from './models/index'; | ||
// events | ||
onDataLoading = new Slick.Event(); | ||
onDataLoaded = new Slick.Event(); | ||
onDataLoading = new Slick.Event('onDataLoading'); | ||
onDataLoaded = new Slick.Event('onDataLoaded'); | ||
@@ -23,0 +23,0 @@ constructor() { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
7020103
460
58400