handsontable 14.0.0-next-07c0a60-20231107 → 14.0.0-next-7ee54cb-20231108
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3rdparty/SheetClip/SheetClip.js +2 -2
- package/3rdparty/SheetClip/SheetClip.mjs +2 -2
- package/3rdparty/autoResize/autoResize.js +2 -2
- package/3rdparty/autoResize/autoResize.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +108 -85
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +108 -85
- package/3rdparty/walkontable/src/calculator/viewportRows.js +60 -52
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +60 -52
- package/3rdparty/walkontable/src/cell/coords.js +7 -5
- package/3rdparty/walkontable/src/cell/coords.mjs +7 -5
- package/3rdparty/walkontable/src/core/clone.js +6 -0
- package/3rdparty/walkontable/src/core/clone.mjs +6 -0
- package/3rdparty/walkontable/src/event.js +125 -74
- package/3rdparty/walkontable/src/event.mjs +125 -74
- package/3rdparty/walkontable/src/filter/column.js +16 -0
- package/3rdparty/walkontable/src/filter/column.mjs +16 -0
- package/3rdparty/walkontable/src/filter/row.js +16 -0
- package/3rdparty/walkontable/src/filter/row.mjs +16 -0
- package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
- package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/_base.js +12 -5
- package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
- package/3rdparty/walkontable/src/renderer/cells.js +6 -2
- package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rows.js +5 -0
- package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
- package/3rdparty/walkontable/src/renderer/table.js +24 -17
- package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
- package/3rdparty/walkontable/src/scroll.js +2 -2
- package/3rdparty/walkontable/src/scroll.mjs +2 -2
- package/3rdparty/walkontable/src/selection/border/border.js +1 -1
- package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +10 -10
- package/3rdparty/walkontable/src/settings.mjs +10 -10
- package/3rdparty/walkontable/src/table.js +3 -3
- package/3rdparty/walkontable/src/table.mjs +3 -3
- package/3rdparty/walkontable/src/utils/column.js +19 -4
- package/3rdparty/walkontable/src/utils/column.mjs +19 -4
- package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
- package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
- package/3rdparty/walkontable/src/utils/row.js +14 -2
- package/3rdparty/walkontable/src/utils/row.mjs +14 -2
- package/3rdparty/walkontable/src/viewport.js +9 -9
- package/3rdparty/walkontable/src/viewport.mjs +9 -9
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +31 -26
- package/core.mjs +31 -26
- package/dataMap/dataMap.js +99 -90
- package/dataMap/dataMap.mjs +99 -90
- package/dataMap/dataSource.js +14 -8
- package/dataMap/dataSource.mjs +14 -8
- package/dataMap/metaManager/lazyFactoryMap.js +19 -7
- package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
- package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
- package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
- package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
- package/dataMap/metaManager/metaSchema.js +55 -55
- package/dataMap/metaManager/metaSchema.mjs +55 -55
- package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
- package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
- package/dataMap/metaManager/utils.js +2 -2
- package/dataMap/metaManager/utils.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7337 -6394
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +154 -154
- package/dist/handsontable.js +7336 -6393
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +28 -28
- package/editorManager.js +105 -95
- package/editorManager.mjs +105 -95
- package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
- package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
- package/editors/baseEditor/baseEditor.js +23 -26
- package/editors/baseEditor/baseEditor.mjs +23 -26
- package/editors/dateEditor/dateEditor.js +24 -15
- package/editors/dateEditor/dateEditor.mjs +24 -15
- package/editors/dropdownEditor/dropdownEditor.js +1 -1
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +4 -4
- package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
- package/editors/textEditor/textEditor.js +23 -17
- package/editors/textEditor/textEditor.mjs +24 -18
- package/eventManager.js +8 -0
- package/eventManager.mjs +8 -0
- package/helpers/array.js +2 -2
- package/helpers/array.mjs +2 -2
- package/helpers/dom/element.js +7 -7
- package/helpers/dom/element.mjs +7 -7
- package/helpers/function.js +1 -1
- package/helpers/function.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +4 -4
- package/helpers/object.mjs +4 -4
- package/helpers/string.js +1 -1
- package/helpers/string.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +0 -2
- package/pluginHooks.js +12 -3
- package/pluginHooks.mjs +12 -3
- package/plugins/autoColumnSize/autoColumnSize.js +141 -130
- package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
- package/plugins/autoRowSize/autoRowSize.js +112 -125
- package/plugins/autoRowSize/autoRowSize.mjs +110 -123
- package/plugins/autofill/autofill.js +98 -102
- package/plugins/autofill/autofill.mjs +97 -101
- package/plugins/base/base.js +61 -28
- package/plugins/base/base.mjs +60 -28
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
- package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
- package/plugins/columnSorting/columnSorting.js +107 -99
- package/plugins/columnSorting/columnSorting.mjs +106 -98
- package/plugins/columnSorting/columnStatesManager.js +12 -6
- package/plugins/columnSorting/columnStatesManager.mjs +12 -6
- package/plugins/columnSummary/columnSummary.js +71 -58
- package/plugins/columnSummary/columnSummary.mjs +70 -57
- package/plugins/columnSummary/endpoints.js +20 -14
- package/plugins/columnSummary/endpoints.mjs +20 -14
- package/plugins/comments/commentEditor.js +30 -2
- package/plugins/comments/commentEditor.mjs +30 -2
- package/plugins/comments/comments.js +158 -169
- package/plugins/comments/comments.mjs +157 -168
- package/plugins/comments/displaySwitch.js +7 -3
- package/plugins/comments/displaySwitch.mjs +7 -3
- package/plugins/contextMenu/commandExecutor.js +15 -2
- package/plugins/contextMenu/commandExecutor.mjs +15 -2
- package/plugins/contextMenu/contextMenu.js +96 -102
- package/plugins/contextMenu/contextMenu.mjs +95 -101
- package/plugins/contextMenu/itemsFactory.js +19 -4
- package/plugins/contextMenu/itemsFactory.mjs +19 -4
- package/plugins/contextMenu/menu/cursor.js +36 -0
- package/plugins/contextMenu/menu/cursor.mjs +36 -0
- package/plugins/contextMenu/menu/menu.js +57 -5
- package/plugins/contextMenu/menu/menu.mjs +57 -5
- package/plugins/contextMenu/predefinedItems/removeColumn.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.js +1 -1
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +1 -1
- package/plugins/copyPaste/copyPaste.js +74 -75
- package/plugins/copyPaste/copyPaste.mjs +74 -75
- package/plugins/customBorders/customBorders.js +57 -50
- package/plugins/customBorders/customBorders.mjs +56 -49
- package/plugins/dragToScroll/dragToScroll.js +50 -54
- package/plugins/dragToScroll/dragToScroll.mjs +49 -52
- package/plugins/dropdownMenu/dropdownMenu.js +136 -131
- package/plugins/dropdownMenu/dropdownMenu.mjs +136 -131
- package/plugins/exportFile/dataProvider.js +7 -2
- package/plugins/exportFile/dataProvider.mjs +7 -2
- package/plugins/exportFile/exportFile.js +1 -1
- package/plugins/exportFile/exportFile.mjs +1 -1
- package/plugins/exportFile/types/_base.js +14 -6
- package/plugins/exportFile/types/_base.mjs +14 -6
- package/plugins/filters/component/actionBar.js +9 -0
- package/plugins/filters/component/actionBar.mjs +9 -0
- package/plugins/filters/component/condition.js +13 -0
- package/plugins/filters/component/condition.mjs +13 -0
- package/plugins/filters/component/operators.js +9 -0
- package/plugins/filters/component/operators.mjs +9 -0
- package/plugins/filters/component/value.js +9 -0
- package/plugins/filters/component/value.mjs +9 -0
- package/plugins/filters/conditionCollection.js +9 -4
- package/plugins/filters/conditionCollection.mjs +9 -4
- package/plugins/filters/conditionUpdateObserver.js +53 -42
- package/plugins/filters/conditionUpdateObserver.mjs +53 -42
- package/plugins/filters/dataFilter.js +9 -3
- package/plugins/filters/dataFilter.mjs +9 -3
- package/plugins/filters/filters.js +184 -189
- package/plugins/filters/filters.mjs +182 -187
- package/plugins/filters/ui/_base.js +1 -1
- package/plugins/filters/ui/_base.mjs +1 -1
- package/plugins/filters/utils.js +1 -1
- package/plugins/filters/utils.mjs +1 -1
- package/plugins/formulas/engine/settings.js +1 -1
- package/plugins/formulas/engine/settings.mjs +1 -1
- package/plugins/formulas/formulas.js +684 -602
- package/plugins/formulas/formulas.mjs +682 -600
- package/plugins/hiddenColumns/hiddenColumns.js +174 -169
- package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
- package/plugins/hiddenRows/hiddenRows.js +170 -165
- package/plugins/hiddenRows/hiddenRows.mjs +169 -164
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +66 -53
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
- package/plugins/manualColumnMove/manualColumnMove.js +287 -232
- package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
- package/plugins/manualColumnMove/ui/_base.js +9 -3
- package/plugins/manualColumnMove/ui/_base.mjs +9 -3
- package/plugins/manualColumnResize/manualColumnResize.js +291 -246
- package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
- package/plugins/manualRowMove/manualRowMove.js +223 -208
- package/plugins/manualRowMove/manualRowMove.mjs +222 -207
- package/plugins/manualRowMove/ui/_base.js +10 -5
- package/plugins/manualRowMove/ui/_base.mjs +10 -5
- package/plugins/manualRowResize/manualRowResize.js +254 -209
- package/plugins/manualRowResize/manualRowResize.mjs +253 -207
- package/plugins/mergeCells/calculations/autofill.js +9 -3
- package/plugins/mergeCells/calculations/autofill.mjs +9 -3
- package/plugins/mergeCells/calculations/selection.js +10 -4
- package/plugins/mergeCells/calculations/selection.mjs +10 -4
- package/plugins/mergeCells/cellCoords.js +16 -6
- package/plugins/mergeCells/cellCoords.mjs +16 -6
- package/plugins/mergeCells/cellsCollection.js +10 -4
- package/plugins/mergeCells/cellsCollection.mjs +10 -4
- package/plugins/mergeCells/mergeCells.js +582 -502
- package/plugins/mergeCells/mergeCells.mjs +580 -500
- package/plugins/multiColumnSorting/multiColumnSorting.js +15 -11
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +15 -11
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
- package/plugins/nestedHeaders/nestedHeaders.js +542 -499
- package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
- package/plugins/nestedHeaders/stateManager/index.js +1 -1
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
- package/plugins/nestedRows/data/dataManager.js +21 -15
- package/plugins/nestedRows/data/dataManager.mjs +21 -15
- package/plugins/nestedRows/nestedRows.js +328 -279
- package/plugins/nestedRows/nestedRows.mjs +327 -278
- package/plugins/nestedRows/ui/_base.js +7 -1
- package/plugins/nestedRows/ui/_base.mjs +7 -1
- package/plugins/nestedRows/ui/collapsing.js +2 -2
- package/plugins/nestedRows/ui/collapsing.mjs +2 -2
- package/plugins/nestedRows/ui/contextMenu.js +28 -18
- package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
- package/plugins/nestedRows/utils/rowMoveController.js +12 -4
- package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
- package/plugins/persistentState/persistentState.js +14 -11
- package/plugins/persistentState/persistentState.mjs +14 -11
- package/plugins/persistentState/storage.js +11 -6
- package/plugins/persistentState/storage.mjs +11 -6
- package/plugins/registry.js +2 -2
- package/plugins/registry.mjs +2 -2
- package/plugins/search/search.js +57 -46
- package/plugins/search/search.mjs +56 -45
- package/plugins/touchScroll/touchScroll.js +102 -100
- package/plugins/touchScroll/touchScroll.mjs +100 -98
- package/plugins/trimRows/trimRows.js +33 -28
- package/plugins/trimRows/trimRows.mjs +32 -27
- package/plugins/undoRedo/undoRedo.js +2 -2
- package/plugins/undoRedo/undoRedo.mjs +2 -2
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
- package/renderers/baseRenderer/baseRenderer.js +2 -2
- package/renderers/baseRenderer/baseRenderer.mjs +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
- package/renderers/dateRenderer/dateRenderer.js +4 -4
- package/renderers/dateRenderer/dateRenderer.mjs +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
- package/renderers/htmlRenderer/htmlRenderer.js +4 -4
- package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
- package/renderers/numericRenderer/numericRenderer.js +3 -3
- package/renderers/numericRenderer/numericRenderer.mjs +3 -3
- package/renderers/passwordRenderer/passwordRenderer.js +3 -3
- package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
- package/renderers/selectRenderer/selectRenderer.js +4 -4
- package/renderers/selectRenderer/selectRenderer.mjs +4 -4
- package/renderers/textRenderer/textRenderer.js +5 -5
- package/renderers/textRenderer/textRenderer.mjs +5 -5
- package/renderers/timeRenderer/timeRenderer.js +3 -3
- package/renderers/timeRenderer/timeRenderer.mjs +3 -3
- package/selection/highlight/highlight.js +1 -4
- package/selection/highlight/highlight.mjs +1 -4
- package/selection/range.js +12 -2
- package/selection/range.mjs +12 -2
- package/selection/selection.js +28 -10
- package/selection/selection.mjs +28 -10
- package/selection/utils.js +24 -14
- package/selection/utils.mjs +25 -15
- package/shortcuts/manager.js +1 -1
- package/shortcuts/manager.mjs +1 -1
- package/tableView.js +208 -200
- package/tableView.mjs +208 -200
- package/translations/changesObservable/utils.js +2 -2
- package/translations/changesObservable/utils.mjs +2 -2
- package/translations/indexMapper.js +25 -22
- package/translations/indexMapper.mjs +25 -22
- package/translations/mapCollections/aggregatedCollection.js +8 -2
- package/translations/mapCollections/aggregatedCollection.mjs +8 -2
- package/translations/mapCollections/mapCollection.js +5 -2
- package/translations/mapCollections/mapCollection.mjs +5 -2
- package/translations/maps/indexMap.js +6 -1
- package/translations/maps/indexMap.mjs +6 -1
- package/translations/maps/utils/physicallyIndexed.js +2 -2
- package/translations/maps/utils/physicallyIndexed.mjs +2 -2
- package/utils/dataStructures/linkedList.js +10 -6
- package/utils/dataStructures/linkedList.mjs +10 -6
- package/utils/dataStructures/queue.js +1 -1
- package/utils/dataStructures/queue.mjs +1 -1
- package/utils/dataStructures/stack.js +1 -1
- package/utils/dataStructures/stack.mjs +1 -1
- package/utils/ghostTable.js +2 -2
- package/utils/ghostTable.mjs +2 -2
- package/utils/interval.js +73 -36
- package/utils/interval.mjs +73 -36
- package/utils/parseTable.js +1 -1
- package/utils/parseTable.mjs +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
- package/validators/dateValidator/dateValidator.js +1 -1
- package/validators/dateValidator/dateValidator.mjs +1 -1
- package/validators/numericValidator/numericValidator.js +1 -1
- package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -1,7 +1,7 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
require("core-js/modules/es.error.cause.js");
|
4
3
|
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.error.cause.js");
|
5
5
|
require("core-js/modules/es.array.push.js");
|
6
6
|
var _element = require("../../helpers/dom/element");
|
7
7
|
var _number = require("../../helpers/number");
|
@@ -13,6 +13,7 @@ var _base = require("../base");
|
|
13
13
|
var _stateManager2 = _interopRequireDefault(require("./stateManager"));
|
14
14
|
var _ghostTable = _interopRequireDefault(require("./utils/ghostTable"));
|
15
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
16
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
16
17
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
17
18
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
18
19
|
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
@@ -23,6 +24,7 @@ function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.
|
|
23
24
|
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
24
25
|
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
25
26
|
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
27
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
26
28
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'nestedHeaders';
|
27
29
|
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 280;
|
28
30
|
|
@@ -75,9 +77,166 @@ var _stateManager = /*#__PURE__*/new WeakMap();
|
|
75
77
|
var _hidingIndexMapObserver = /*#__PURE__*/new WeakMap();
|
76
78
|
var _focusInitialCoords = /*#__PURE__*/new WeakMap();
|
77
79
|
var _isColumnsSelectionInProgress = /*#__PURE__*/new WeakMap();
|
80
|
+
var _updateFocusHighlightPosition = /*#__PURE__*/new WeakSet();
|
81
|
+
var _onBeforeViewportScrollHorizontally = /*#__PURE__*/new WeakSet();
|
82
|
+
var _onBeforeHighlightingColumnHeader = /*#__PURE__*/new WeakSet();
|
83
|
+
var _onBeforeCopy = /*#__PURE__*/new WeakSet();
|
84
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
85
|
+
var _onAfterOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
86
|
+
var _onBeforeOnCellMouseOver = /*#__PURE__*/new WeakSet();
|
87
|
+
var _onBeforeOnCellMouseUp = /*#__PURE__*/new WeakSet();
|
88
|
+
var _onBeforeSelectionHighlightSet = /*#__PURE__*/new WeakSet();
|
89
|
+
var _onModifyTransformStart = /*#__PURE__*/new WeakSet();
|
90
|
+
var _onBeforeSelectColumns = /*#__PURE__*/new WeakSet();
|
91
|
+
var _onAfterGetColumnHeaderRenderers = /*#__PURE__*/new WeakSet();
|
92
|
+
var _onAfterViewportColumnCalculatorOverride = /*#__PURE__*/new WeakSet();
|
93
|
+
var _onModifyColWidth = /*#__PURE__*/new WeakSet();
|
94
|
+
var _onModifyColumnHeaderValue = /*#__PURE__*/new WeakSet();
|
95
|
+
var _onModifyFocusedElement = /*#__PURE__*/new WeakSet();
|
96
|
+
var _onInit = /*#__PURE__*/new WeakSet();
|
97
|
+
var _onAfterLoadData = /*#__PURE__*/new WeakSet();
|
78
98
|
class NestedHeaders extends _base.BasePlugin {
|
79
99
|
constructor() {
|
80
100
|
super(...arguments);
|
101
|
+
/**
|
102
|
+
* Updates the plugin state after new dataset load.
|
103
|
+
*
|
104
|
+
* @param {Array[]} sourceData Array of arrays or array of objects containing data.
|
105
|
+
* @param {boolean} initialLoad Flag that determines whether the data has been loaded
|
106
|
+
* during the initialization.
|
107
|
+
*/
|
108
|
+
_classPrivateMethodInitSpec(this, _onAfterLoadData);
|
109
|
+
/**
|
110
|
+
* Updates the plugin state after HoT initialization.
|
111
|
+
*/
|
112
|
+
_classPrivateMethodInitSpec(this, _onInit);
|
113
|
+
/**
|
114
|
+
* `modifyFocusedElement` hook callback.
|
115
|
+
*
|
116
|
+
* @param {number} row Row index.
|
117
|
+
* @param {number} column Column index.
|
118
|
+
* @returns {HTMLTableCellElement} The `TH` element to be focused.
|
119
|
+
*/
|
120
|
+
_classPrivateMethodInitSpec(this, _onModifyFocusedElement);
|
121
|
+
/**
|
122
|
+
* Listens the `modifyColumnHeaderValue` hook that overwrites the column headers values based on
|
123
|
+
* the internal state and settings of the plugin.
|
124
|
+
*
|
125
|
+
* @param {string} value The column header value.
|
126
|
+
* @param {number} visualColumnIndex The visual column index.
|
127
|
+
* @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
|
128
|
+
* and negative (-1 to -N) values. For positive values, 0 points to the
|
129
|
+
* top most header, and for negative direction, -1 points to the most bottom
|
130
|
+
* header (the header closest to the cells).
|
131
|
+
* @returns {string} Returns the column header value to update.
|
132
|
+
*/
|
133
|
+
_classPrivateMethodInitSpec(this, _onModifyColumnHeaderValue);
|
134
|
+
/**
|
135
|
+
* `modifyColWidth` hook callback - returns width from cache, when is greater than incoming from hook.
|
136
|
+
*
|
137
|
+
* @param {number} width Width from hook.
|
138
|
+
* @param {number} column Visual index of an column.
|
139
|
+
* @returns {number}
|
140
|
+
*/
|
141
|
+
_classPrivateMethodInitSpec(this, _onModifyColWidth);
|
142
|
+
/**
|
143
|
+
* Make the renderer render the first nested column in its entirety.
|
144
|
+
*
|
145
|
+
* @param {object} calc Viewport column calculator.
|
146
|
+
*/
|
147
|
+
_classPrivateMethodInitSpec(this, _onAfterViewportColumnCalculatorOverride);
|
148
|
+
/**
|
149
|
+
* `afterGetColumnHeader` hook callback - prepares the header structure.
|
150
|
+
*
|
151
|
+
* @param {Array} renderersArray Array of renderers.
|
152
|
+
*/
|
153
|
+
_classPrivateMethodInitSpec(this, _onAfterGetColumnHeaderRenderers);
|
154
|
+
/**
|
155
|
+
* The hook observes the column selection from the Selection API and modifies the column range to
|
156
|
+
* ensure that the whole nested column will be covered.
|
157
|
+
*
|
158
|
+
* @param {CellCoords} from The coords object where the selection starts.
|
159
|
+
* @param {CellCoords} to The coords object where the selection ends.
|
160
|
+
*/
|
161
|
+
_classPrivateMethodInitSpec(this, _onBeforeSelectColumns);
|
162
|
+
/**
|
163
|
+
* `modifyTransformStart` hook is called every time the keyboard navigation is used.
|
164
|
+
*
|
165
|
+
* @param {object} delta The transformation delta.
|
166
|
+
*/
|
167
|
+
_classPrivateMethodInitSpec(this, _onModifyTransformStart);
|
168
|
+
/**
|
169
|
+
* The hook checks and ensures that the focus position that depends on the selected columns
|
170
|
+
* range is always positioned within the range.
|
171
|
+
*/
|
172
|
+
_classPrivateMethodInitSpec(this, _onBeforeSelectionHighlightSet);
|
173
|
+
/**
|
174
|
+
* Switches internal flag about selection progress to `false`.
|
175
|
+
*/
|
176
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseUp);
|
177
|
+
/**
|
178
|
+
* Makes the header-selection properly select the nested headers.
|
179
|
+
*
|
180
|
+
* @param {MouseEvent} event Mouse event.
|
181
|
+
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
|
182
|
+
* @param {HTMLElement} TD The cell element.
|
183
|
+
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
184
|
+
* a boolean value that allows or disallows changing the selection for that particular area.
|
185
|
+
*/
|
186
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseOver);
|
187
|
+
/**
|
188
|
+
* Allows to control how the column selection based on the coordinates and the nested headers is made.
|
189
|
+
*
|
190
|
+
* @param {MouseEvent} event Mouse event.
|
191
|
+
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
|
192
|
+
*/
|
193
|
+
_classPrivateMethodInitSpec(this, _onAfterOnCellMouseDown);
|
194
|
+
/**
|
195
|
+
* Allows blocking the column selection that is controlled by the core Selection module.
|
196
|
+
*
|
197
|
+
* @param {MouseEvent} event Mouse event.
|
198
|
+
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
|
199
|
+
* @param {CellCoords} TD The table cell or header element.
|
200
|
+
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
201
|
+
* a boolean value that allows or disallows changing the selection for that particular area.
|
202
|
+
*/
|
203
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
204
|
+
/**
|
205
|
+
* Listens the `beforeCopy` hook that allows processing the copied column headers so that the
|
206
|
+
* merged column headers do not propagate the value for each column but only once at the beginning
|
207
|
+
* of the column.
|
208
|
+
*
|
209
|
+
* @private
|
210
|
+
* @param {Array[]} data An array of arrays which contains data to copied.
|
211
|
+
* @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
|
212
|
+
* which will copied.
|
213
|
+
* @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
|
214
|
+
* the number of copied headers.
|
215
|
+
*/
|
216
|
+
_classPrivateMethodInitSpec(this, _onBeforeCopy);
|
217
|
+
/**
|
218
|
+
* Allows to control which header DOM element will be used to highlight.
|
219
|
+
*
|
220
|
+
* @param {number} visualColumn A visual column index of the highlighted row header.
|
221
|
+
* @param {number} headerLevel A row header level that is currently highlighted.
|
222
|
+
* @param {object} highlightMeta An object with meta data that describes the highlight state.
|
223
|
+
* @returns {number}
|
224
|
+
*/
|
225
|
+
_classPrivateMethodInitSpec(this, _onBeforeHighlightingColumnHeader);
|
226
|
+
/**
|
227
|
+
* Allows to control to which column index the viewport will be scrolled. To ensure that the viewport
|
228
|
+
* is scrolled to the correct column for the nested header the most left and the most right visual column
|
229
|
+
* indexes are used.
|
230
|
+
*
|
231
|
+
* @param {number} visualColumn A visual column index to which the viewport will be scrolled.
|
232
|
+
* @returns {number}
|
233
|
+
*/
|
234
|
+
_classPrivateMethodInitSpec(this, _onBeforeViewportScrollHorizontally);
|
235
|
+
/**
|
236
|
+
* Updates the selection focus highlight position to point to the nested header root element (TH)
|
237
|
+
* even when the logical coordinates point in-between the header.
|
238
|
+
*/
|
239
|
+
_classPrivateMethodInitSpec(this, _updateFocusHighlightPosition);
|
81
240
|
/**
|
82
241
|
* The state manager for the nested headers.
|
83
242
|
*
|
@@ -161,56 +320,101 @@ class NestedHeaders extends _base.BasePlugin {
|
|
161
320
|
(0, _console.warn)((0, _templateLiteralTag.toSingleLine)`Your Nested Headers plugin configuration is invalid. The settings has to be\x20
|
162
321
|
passed as an array of arrays e.q. [['A1', { label: 'A2', colspan: 2 }]]`);
|
163
322
|
}
|
164
|
-
this.addHook('init', () => this.
|
323
|
+
this.addHook('init', () => _classPrivateMethodGet(this, _onInit, _onInit2).call(this));
|
165
324
|
this.addHook('afterLoadData', function () {
|
166
|
-
|
325
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
326
|
+
args[_key] = arguments[_key];
|
327
|
+
}
|
328
|
+
return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
|
167
329
|
});
|
168
330
|
this.addHook('beforeOnCellMouseDown', function () {
|
169
|
-
|
331
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
332
|
+
args[_key2] = arguments[_key2];
|
333
|
+
}
|
334
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
170
335
|
});
|
171
336
|
this.addHook('afterOnCellMouseDown', function () {
|
172
|
-
|
337
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
338
|
+
args[_key3] = arguments[_key3];
|
339
|
+
}
|
340
|
+
return _classPrivateMethodGet(_this, _onAfterOnCellMouseDown, _onAfterOnCellMouseDown2).call(_this, ...args);
|
173
341
|
});
|
174
342
|
this.addHook('beforeOnCellMouseOver', function () {
|
175
|
-
|
343
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
344
|
+
args[_key4] = arguments[_key4];
|
345
|
+
}
|
346
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseOver, _onBeforeOnCellMouseOver2).call(_this, ...args);
|
176
347
|
});
|
177
348
|
this.addHook('beforeOnCellMouseUp', function () {
|
178
|
-
|
349
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
350
|
+
args[_key5] = arguments[_key5];
|
351
|
+
}
|
352
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseUp, _onBeforeOnCellMouseUp2).call(_this, ...args);
|
179
353
|
});
|
180
354
|
this.addHook('beforeSelectionHighlightSet', function () {
|
181
|
-
|
355
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
356
|
+
args[_key6] = arguments[_key6];
|
357
|
+
}
|
358
|
+
return _classPrivateMethodGet(_this, _onBeforeSelectionHighlightSet, _onBeforeSelectionHighlightSet2).call(_this, ...args);
|
182
359
|
});
|
183
360
|
this.addHook('modifyTransformStart', function () {
|
184
|
-
|
361
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
362
|
+
args[_key7] = arguments[_key7];
|
363
|
+
}
|
364
|
+
return _classPrivateMethodGet(_this, _onModifyTransformStart, _onModifyTransformStart2).call(_this, ...args);
|
185
365
|
});
|
186
|
-
this.addHook('afterSelection', () => this.
|
366
|
+
this.addHook('afterSelection', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
|
187
367
|
this.addHook('beforeViewportScrollHorizontally', function () {
|
188
|
-
|
368
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
369
|
+
args[_key8] = arguments[_key8];
|
370
|
+
}
|
371
|
+
return _classPrivateMethodGet(_this, _onBeforeViewportScrollHorizontally, _onBeforeViewportScrollHorizontally2).call(_this, ...args);
|
189
372
|
});
|
190
|
-
this.addHook('afterGetColumnHeaderRenderers', array => this.
|
373
|
+
this.addHook('afterGetColumnHeaderRenderers', array => _classPrivateMethodGet(this, _onAfterGetColumnHeaderRenderers, _onAfterGetColumnHeaderRenderers2).call(this, array));
|
191
374
|
this.addHook('modifyColWidth', function () {
|
192
|
-
|
375
|
+
for (var _len9 = arguments.length, args = new Array(_len9), _key9 = 0; _key9 < _len9; _key9++) {
|
376
|
+
args[_key9] = arguments[_key9];
|
377
|
+
}
|
378
|
+
return _classPrivateMethodGet(_this, _onModifyColWidth, _onModifyColWidth2).call(_this, ...args);
|
193
379
|
});
|
194
380
|
this.addHook('modifyColumnHeaderValue', function () {
|
195
|
-
|
381
|
+
for (var _len10 = arguments.length, args = new Array(_len10), _key10 = 0; _key10 < _len10; _key10++) {
|
382
|
+
args[_key10] = arguments[_key10];
|
383
|
+
}
|
384
|
+
return _classPrivateMethodGet(_this, _onModifyColumnHeaderValue, _onModifyColumnHeaderValue2).call(_this, ...args);
|
196
385
|
});
|
197
386
|
this.addHook('beforeHighlightingColumnHeader', function () {
|
198
|
-
|
387
|
+
for (var _len11 = arguments.length, args = new Array(_len11), _key11 = 0; _key11 < _len11; _key11++) {
|
388
|
+
args[_key11] = arguments[_key11];
|
389
|
+
}
|
390
|
+
return _classPrivateMethodGet(_this, _onBeforeHighlightingColumnHeader, _onBeforeHighlightingColumnHeader2).call(_this, ...args);
|
199
391
|
});
|
200
392
|
this.addHook('beforeCopy', function () {
|
201
|
-
|
393
|
+
for (var _len12 = arguments.length, args = new Array(_len12), _key12 = 0; _key12 < _len12; _key12++) {
|
394
|
+
args[_key12] = arguments[_key12];
|
395
|
+
}
|
396
|
+
return _classPrivateMethodGet(_this, _onBeforeCopy, _onBeforeCopy2).call(_this, ...args);
|
202
397
|
});
|
203
398
|
this.addHook('beforeSelectColumns', function () {
|
204
|
-
|
399
|
+
for (var _len13 = arguments.length, args = new Array(_len13), _key13 = 0; _key13 < _len13; _key13++) {
|
400
|
+
args[_key13] = arguments[_key13];
|
401
|
+
}
|
402
|
+
return _classPrivateMethodGet(_this, _onBeforeSelectColumns, _onBeforeSelectColumns2).call(_this, ...args);
|
205
403
|
});
|
206
404
|
this.addHook('afterViewportColumnCalculatorOverride', function () {
|
207
|
-
|
405
|
+
for (var _len14 = arguments.length, args = new Array(_len14), _key14 = 0; _key14 < _len14; _key14++) {
|
406
|
+
args[_key14] = arguments[_key14];
|
407
|
+
}
|
408
|
+
return _classPrivateMethodGet(_this, _onAfterViewportColumnCalculatorOverride, _onAfterViewportColumnCalculatorOverride2).call(_this, ...args);
|
208
409
|
});
|
209
410
|
this.addHook('modifyFocusedElement', function () {
|
210
|
-
|
411
|
+
for (var _len15 = arguments.length, args = new Array(_len15), _key15 = 0; _key15 < _len15; _key15++) {
|
412
|
+
args[_key15] = arguments[_key15];
|
413
|
+
}
|
414
|
+
return _classPrivateMethodGet(_this, _onModifyFocusedElement, _onModifyFocusedElement2).call(_this, ...args);
|
211
415
|
});
|
212
|
-
this.hot.columnIndexMapper.addLocalHook('cacheUpdated', () => this.
|
213
|
-
this.hot.rowIndexMapper.addLocalHook('cacheUpdated', () => this.
|
416
|
+
this.hot.columnIndexMapper.addLocalHook('cacheUpdated', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
|
417
|
+
this.hot.rowIndexMapper.addLocalHook('cacheUpdated', () => _classPrivateMethodGet(this, _updateFocusHighlightPosition, _updateFocusHighlightPosition2).call(this));
|
214
418
|
super.enablePlugin();
|
215
419
|
this.updatePlugin(); // @TODO: Workaround for broken plugin initialization abstraction.
|
216
420
|
}
|
@@ -425,522 +629,361 @@ class NestedHeaders extends _base.BasePlugin {
|
|
425
629
|
}
|
426
630
|
return this.hot.getColHeader(visualColumnIndex, headerLevel);
|
427
631
|
}
|
428
|
-
|
429
632
|
/**
|
430
|
-
*
|
431
|
-
* even when the logical coordinates point in-between the header.
|
432
|
-
*
|
433
|
-
* @private
|
633
|
+
* Destroys the plugin instance.
|
434
634
|
*/
|
435
|
-
|
436
|
-
|
437
|
-
|
438
|
-
|
439
|
-
|
440
|
-
}
|
441
|
-
const {
|
442
|
-
highlight
|
443
|
-
} = selection;
|
444
|
-
const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
|
445
|
-
if (isNestedHeadersRange) {
|
446
|
-
const columnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
|
447
|
-
const focusHighlight = this.hot.selection.highlight.getFocus();
|
448
|
-
|
449
|
-
// Correct the highlight/focus selection to highlight the correct TH element
|
450
|
-
focusHighlight.visualCellRange.highlight.col = columnIndex;
|
451
|
-
focusHighlight.visualCellRange.from.col = columnIndex;
|
452
|
-
focusHighlight.visualCellRange.to.col = columnIndex;
|
453
|
-
focusHighlight.commit();
|
635
|
+
destroy() {
|
636
|
+
_classPrivateFieldSet(this, _stateManager, null);
|
637
|
+
if (_classPrivateFieldGet(this, _hidingIndexMapObserver) !== null) {
|
638
|
+
_classPrivateFieldGet(this, _hidingIndexMapObserver).unsubscribe();
|
639
|
+
_classPrivateFieldSet(this, _hidingIndexMapObserver, null);
|
454
640
|
}
|
641
|
+
super.destroy();
|
455
642
|
}
|
456
643
|
|
457
644
|
/**
|
458
|
-
*
|
459
|
-
* is scrolled to the correct column for the nested header the most left and the most right visual column
|
460
|
-
* indexes are used.
|
645
|
+
* Gets the tree data that belongs to the column headers pointed by the passed coordinates.
|
461
646
|
*
|
462
647
|
* @private
|
463
|
-
* @param {
|
464
|
-
* @returns {
|
648
|
+
* @param {CellCoords} coords The CellCoords instance.
|
649
|
+
* @returns {object|undefined}
|
465
650
|
*/
|
466
|
-
|
467
|
-
|
468
|
-
|
469
|
-
return visualColumn;
|
470
|
-
}
|
471
|
-
const {
|
472
|
-
highlight
|
473
|
-
} = selection;
|
474
|
-
const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
|
475
|
-
if (!isNestedHeadersRange) {
|
476
|
-
return visualColumn;
|
477
|
-
}
|
478
|
-
const firstColumn = this.hot.view.getFirstFullyVisibleColumn();
|
479
|
-
const lastColumn = this.hot.view.getLastFullyVisibleColumn();
|
480
|
-
const mostLeftColumnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
|
481
|
-
const mostRightColumnIndex = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(highlight.row, highlight.col);
|
482
|
-
|
483
|
-
// do not scroll the viewport when the header is wider than the viewport
|
484
|
-
if (mostLeftColumnIndex < firstColumn && mostRightColumnIndex > lastColumn) {
|
485
|
-
return visualColumn;
|
651
|
+
_getHeaderTreeNodeDataByCoords(coords) {
|
652
|
+
if (coords.row >= 0 || coords.col < 0) {
|
653
|
+
return;
|
486
654
|
}
|
487
|
-
return
|
655
|
+
return _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(coords.row, coords.col);
|
488
656
|
}
|
489
|
-
|
490
|
-
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
return headerNodeData.columnIndex;
|
516
|
-
}
|
517
|
-
} else if (selectionType === _selection.ACTIVE_HEADER_TYPE) {
|
518
|
-
if (colspan > selectionWidth - columnCursor || !isRoot) {
|
519
|
-
// Prevents adding any CSS class names to the TH element
|
520
|
-
return null;
|
521
|
-
}
|
522
|
-
}
|
657
|
+
}
|
658
|
+
exports.NestedHeaders = NestedHeaders;
|
659
|
+
function _updateFocusHighlightPosition2() {
|
660
|
+
var _this$hot;
|
661
|
+
const selection = (_this$hot = this.hot) === null || _this$hot === void 0 ? void 0 : _this$hot.getSelectedRangeLast();
|
662
|
+
if (!selection) {
|
663
|
+
return;
|
664
|
+
}
|
665
|
+
const {
|
666
|
+
highlight
|
667
|
+
} = selection;
|
668
|
+
const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
|
669
|
+
if (isNestedHeadersRange) {
|
670
|
+
const columnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
|
671
|
+
const focusHighlight = this.hot.selection.highlight.getFocus();
|
672
|
+
|
673
|
+
// Correct the highlight/focus selection to highlight the correct TH element
|
674
|
+
focusHighlight.visualCellRange.highlight.col = columnIndex;
|
675
|
+
focusHighlight.visualCellRange.from.col = columnIndex;
|
676
|
+
focusHighlight.visualCellRange.to.col = columnIndex;
|
677
|
+
focusHighlight.commit();
|
678
|
+
}
|
679
|
+
}
|
680
|
+
function _onBeforeViewportScrollHorizontally2(visualColumn) {
|
681
|
+
const selection = this.hot.getSelectedRangeLast();
|
682
|
+
if (!selection) {
|
523
683
|
return visualColumn;
|
524
684
|
}
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
* @private
|
532
|
-
* @param {Array[]} data An array of arrays which contains data to copied.
|
533
|
-
* @param {object[]} copyableRanges An array of objects with ranges of the visual indexes (`startRow`, `startCol`, `endRow`, `endCol`)
|
534
|
-
* which will copied.
|
535
|
-
* @param {{ columnHeadersCount: number }} copiedHeadersCount An object with keys that holds information with
|
536
|
-
* the number of copied headers.
|
537
|
-
*/
|
538
|
-
onBeforeCopy(data, copyableRanges, _ref2) {
|
539
|
-
let {
|
540
|
-
columnHeadersCount
|
541
|
-
} = _ref2;
|
542
|
-
if (columnHeadersCount === 0) {
|
543
|
-
return;
|
544
|
-
}
|
545
|
-
for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
|
546
|
-
const {
|
547
|
-
startRow,
|
548
|
-
startCol,
|
549
|
-
endRow,
|
550
|
-
endCol
|
551
|
-
} = copyableRanges[rangeIndex];
|
552
|
-
const rowsCount = endRow - startRow + 1;
|
553
|
-
const columnsCount = startCol - endCol + 1;
|
554
|
-
|
555
|
-
// do not process dataset ranges and column headers where only one column is copied
|
556
|
-
if (startRow >= 0 || columnsCount === 1) {
|
557
|
-
break;
|
558
|
-
}
|
559
|
-
for (let column = startCol; column <= endCol; column++) {
|
560
|
-
for (let row = startRow; row <= endRow; row++) {
|
561
|
-
var _classPrivateFieldGet4;
|
562
|
-
const zeroBasedColumnHeaderLevel = rowsCount + row;
|
563
|
-
const zeroBasedColumnIndex = column - startCol;
|
564
|
-
if (zeroBasedColumnIndex === 0) {
|
565
|
-
continue; // eslint-disable-line no-continue
|
566
|
-
}
|
567
|
-
|
568
|
-
const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
|
569
|
-
if (isRoot === false) {
|
570
|
-
data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
|
571
|
-
}
|
572
|
-
}
|
573
|
-
}
|
574
|
-
}
|
685
|
+
const {
|
686
|
+
highlight
|
687
|
+
} = selection;
|
688
|
+
const isNestedHeadersRange = highlight.isHeader() && highlight.col >= 0;
|
689
|
+
if (!isNestedHeadersRange) {
|
690
|
+
return visualColumn;
|
575
691
|
}
|
692
|
+
const firstColumn = this.hot.view.getFirstFullyVisibleColumn();
|
693
|
+
const lastColumn = this.hot.view.getLastFullyVisibleColumn();
|
694
|
+
const mostLeftColumnIndex = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(highlight.row, highlight.col);
|
695
|
+
const mostRightColumnIndex = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(highlight.row, highlight.col);
|
576
696
|
|
577
|
-
|
578
|
-
|
579
|
-
|
580
|
-
* @private
|
581
|
-
* @param {MouseEvent} event Mouse event.
|
582
|
-
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
|
583
|
-
* @param {CellCoords} TD The table cell or header element.
|
584
|
-
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
585
|
-
* a boolean value that allows or disallows changing the selection for that particular area.
|
586
|
-
*/
|
587
|
-
onBeforeOnCellMouseDown(event, coords, TD, controller) {
|
588
|
-
const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
|
589
|
-
if (headerNodeData) {
|
590
|
-
// Block the Selection module in controlling how the columns are selected. Pass the
|
591
|
-
// responsibility of the column selection to this plugin (see "onAfterOnCellMouseDown" hook).
|
592
|
-
controller.column = true;
|
593
|
-
}
|
697
|
+
// do not scroll the viewport when the header is wider than the viewport
|
698
|
+
if (mostLeftColumnIndex < firstColumn && mostRightColumnIndex > lastColumn) {
|
699
|
+
return visualColumn;
|
594
700
|
}
|
595
|
-
|
596
|
-
|
597
|
-
|
598
|
-
|
599
|
-
|
600
|
-
|
601
|
-
|
602
|
-
|
603
|
-
|
604
|
-
|
605
|
-
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
|
701
|
+
return mostLeftColumnIndex < firstColumn ? mostLeftColumnIndex : mostRightColumnIndex;
|
702
|
+
}
|
703
|
+
function _onBeforeHighlightingColumnHeader2(visualColumn, headerLevel, highlightMeta) {
|
704
|
+
const headerNodeData = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumn);
|
705
|
+
if (!headerNodeData) {
|
706
|
+
return visualColumn;
|
707
|
+
}
|
708
|
+
const {
|
709
|
+
columnCursor,
|
710
|
+
selectionType,
|
711
|
+
selectionWidth
|
712
|
+
} = highlightMeta;
|
713
|
+
const {
|
714
|
+
isRoot,
|
715
|
+
colspan
|
716
|
+
} = _classPrivateFieldGet(this, _stateManager).getHeaderSettings(headerLevel, visualColumn);
|
717
|
+
if (selectionType === _selection.HEADER_TYPE) {
|
718
|
+
if (!isRoot) {
|
719
|
+
return headerNodeData.columnIndex;
|
720
|
+
}
|
721
|
+
} else if (selectionType === _selection.ACTIVE_HEADER_TYPE) {
|
722
|
+
if (colspan > selectionWidth - columnCursor || !isRoot) {
|
723
|
+
// Prevents adding any CSS class names to the TH element
|
724
|
+
return null;
|
725
|
+
}
|
726
|
+
}
|
727
|
+
return visualColumn;
|
728
|
+
}
|
729
|
+
function _onBeforeCopy2(data, copyableRanges, _ref2) {
|
730
|
+
let {
|
731
|
+
columnHeadersCount
|
732
|
+
} = _ref2;
|
733
|
+
if (columnHeadersCount === 0) {
|
734
|
+
return;
|
735
|
+
}
|
736
|
+
for (let rangeIndex = 0; rangeIndex < copyableRanges.length; rangeIndex++) {
|
615
737
|
const {
|
616
|
-
|
617
|
-
|
618
|
-
|
738
|
+
startRow,
|
739
|
+
startCol,
|
740
|
+
endRow,
|
741
|
+
endCol
|
742
|
+
} = copyableRanges[rangeIndex];
|
743
|
+
const rowsCount = endRow - startRow + 1;
|
744
|
+
const columnsCount = startCol - endCol + 1;
|
745
|
+
|
746
|
+
// do not process dataset ranges and column headers where only one column is copied
|
747
|
+
if (startRow >= 0 || columnsCount === 1) {
|
748
|
+
break;
|
749
|
+
}
|
750
|
+
for (let column = startCol; column <= endCol; column++) {
|
751
|
+
for (let row = startRow; row <= endRow; row++) {
|
752
|
+
var _classPrivateFieldGet4;
|
753
|
+
const zeroBasedColumnHeaderLevel = rowsCount + row;
|
754
|
+
const zeroBasedColumnIndex = column - startCol;
|
755
|
+
if (zeroBasedColumnIndex === 0) {
|
756
|
+
continue; // eslint-disable-line no-continue
|
757
|
+
}
|
619
758
|
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
const allowRightClickSelection = !selection.inInSelection(coords);
|
625
|
-
if (event.shiftKey && currentSelection) {
|
626
|
-
if (coords.col < currentSelection.from.col) {
|
627
|
-
columnsToSelect.push(currentSelection.getTopEndCorner().col, columnIndex, coords.row);
|
628
|
-
} else if (coords.col > currentSelection.from.col) {
|
629
|
-
columnsToSelect.push(currentSelection.getTopStartCorner().col, columnIndex + origColspan - 1, coords.row);
|
630
|
-
} else {
|
631
|
-
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
|
759
|
+
const isRoot = (_classPrivateFieldGet4 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(row, column)) === null || _classPrivateFieldGet4 === void 0 ? void 0 : _classPrivateFieldGet4.isRoot;
|
760
|
+
if (isRoot === false) {
|
761
|
+
data[zeroBasedColumnHeaderLevel][zeroBasedColumnIndex] = '';
|
762
|
+
}
|
632
763
|
}
|
633
|
-
} else if ((0, _event.isLeftClick)(event) || (0, _event.isRightClick)(event) && allowRightClickSelection) {
|
634
|
-
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
|
635
764
|
}
|
636
|
-
|
637
|
-
// The plugin takes control of how the columns are selected.
|
638
|
-
selection.selectColumns(...columnsToSelect);
|
639
765
|
}
|
640
|
-
|
641
|
-
|
642
|
-
|
643
|
-
|
644
|
-
|
645
|
-
|
646
|
-
* @param {CellCoords} coords Cell coords object containing the visual coordinates of the clicked cell.
|
647
|
-
* @param {HTMLElement} TD The cell element.
|
648
|
-
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
649
|
-
* a boolean value that allows or disallows changing the selection for that particular area.
|
650
|
-
*/
|
651
|
-
onBeforeOnCellMouseOver(event, coords, TD, controller) {
|
652
|
-
if (!this.hot.view.isMouseDown()) {
|
653
|
-
return;
|
654
|
-
}
|
655
|
-
const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
|
656
|
-
if (!headerNodeData) {
|
657
|
-
return;
|
658
|
-
}
|
659
|
-
const {
|
660
|
-
columnIndex,
|
661
|
-
origColspan
|
662
|
-
} = headerNodeData;
|
663
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
664
|
-
const topStartCoords = selectedRange.getTopStartCorner();
|
665
|
-
const bottomEndCoords = selectedRange.getBottomEndCorner();
|
666
|
-
const {
|
667
|
-
from
|
668
|
-
} = selectedRange;
|
669
|
-
|
670
|
-
// Block the Selection module in controlling how the columns and cells are selected.
|
671
|
-
// From now on, the plugin is responsible for the selection.
|
766
|
+
}
|
767
|
+
function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
|
768
|
+
const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
|
769
|
+
if (headerNodeData) {
|
770
|
+
// Block the Selection module in controlling how the columns are selected. Pass the
|
771
|
+
// responsibility of the column selection to this plugin (see "onAfterOnCellMouseDown" hook).
|
672
772
|
controller.column = true;
|
673
|
-
|
674
|
-
|
675
|
-
|
676
|
-
|
677
|
-
|
678
|
-
|
679
|
-
|
773
|
+
}
|
774
|
+
}
|
775
|
+
function _onAfterOnCellMouseDown2(event, coords) {
|
776
|
+
const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
|
777
|
+
if (!headerNodeData) {
|
778
|
+
return;
|
779
|
+
}
|
780
|
+
_classPrivateFieldSet(this, _focusInitialCoords, coords.clone());
|
781
|
+
_classPrivateFieldSet(this, _isColumnsSelectionInProgress, true);
|
782
|
+
const {
|
783
|
+
selection
|
784
|
+
} = this.hot;
|
785
|
+
const currentSelection = selection.isSelected() ? selection.getSelectedRange().current() : null;
|
786
|
+
const columnsToSelect = [];
|
787
|
+
const {
|
788
|
+
columnIndex,
|
789
|
+
origColspan
|
790
|
+
} = headerNodeData;
|
791
|
+
|
792
|
+
// The Selection module doesn't allow it to extend its behavior easily. That's why here we need
|
793
|
+
// to re-implement the "click" and "shift" behavior. As a workaround, the logic for the nested
|
794
|
+
// headers must implement a similar logic as in the original Selection handler
|
795
|
+
// (see src/selection/mouseEventHandler.js).
|
796
|
+
const allowRightClickSelection = !selection.inInSelection(coords);
|
797
|
+
if (event.shiftKey && currentSelection) {
|
798
|
+
if (coords.col < currentSelection.from.col) {
|
799
|
+
columnsToSelect.push(currentSelection.getTopEndCorner().col, columnIndex, coords.row);
|
800
|
+
} else if (coords.col > currentSelection.from.col) {
|
801
|
+
columnsToSelect.push(currentSelection.getTopStartCorner().col, columnIndex + origColspan - 1, coords.row);
|
680
802
|
} else {
|
681
|
-
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1,
|
803
|
+
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
|
682
804
|
}
|
683
|
-
|
805
|
+
} else if ((0, _event.isLeftClick)(event) || (0, _event.isRightClick)(event) && allowRightClickSelection) {
|
806
|
+
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, coords.row);
|
684
807
|
}
|
685
808
|
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
691
|
-
|
692
|
-
|
809
|
+
// The plugin takes control of how the columns are selected.
|
810
|
+
selection.selectColumns(...columnsToSelect);
|
811
|
+
}
|
812
|
+
function _onBeforeOnCellMouseOver2(event, coords, TD, controller) {
|
813
|
+
if (!this.hot.view.isMouseDown()) {
|
814
|
+
return;
|
815
|
+
}
|
816
|
+
const headerNodeData = this._getHeaderTreeNodeDataByCoords(coords);
|
817
|
+
if (!headerNodeData) {
|
818
|
+
return;
|
819
|
+
}
|
820
|
+
const {
|
821
|
+
columnIndex,
|
822
|
+
origColspan
|
823
|
+
} = headerNodeData;
|
824
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
825
|
+
const topStartCoords = selectedRange.getTopStartCorner();
|
826
|
+
const bottomEndCoords = selectedRange.getBottomEndCorner();
|
827
|
+
const {
|
828
|
+
from
|
829
|
+
} = selectedRange;
|
830
|
+
|
831
|
+
// Block the Selection module in controlling how the columns and cells are selected.
|
832
|
+
// From now on, the plugin is responsible for the selection.
|
833
|
+
controller.column = true;
|
834
|
+
controller.cell = true;
|
835
|
+
const columnsToSelect = [];
|
836
|
+
const headerLevel = (0, _number.clamp)(coords.row, -Infinity, -1);
|
837
|
+
if (coords.col < from.col) {
|
838
|
+
columnsToSelect.push(bottomEndCoords.col, columnIndex, headerLevel);
|
839
|
+
} else if (coords.col > from.col) {
|
840
|
+
columnsToSelect.push(topStartCoords.col, columnIndex + origColspan - 1, headerLevel);
|
841
|
+
} else {
|
842
|
+
columnsToSelect.push(columnIndex, columnIndex + origColspan - 1, headerLevel);
|
843
|
+
}
|
844
|
+
this.hot.selection.selectColumns(...columnsToSelect);
|
845
|
+
}
|
846
|
+
function _onBeforeOnCellMouseUp2() {
|
847
|
+
_classPrivateFieldSet(this, _isColumnsSelectionInProgress, false);
|
848
|
+
}
|
849
|
+
function _onBeforeSelectionHighlightSet2() {
|
850
|
+
const {
|
851
|
+
navigableHeaders
|
852
|
+
} = this.hot.getSettings();
|
853
|
+
if (!this.hot.view.isMouseDown() || !_classPrivateFieldGet(this, _isColumnsSelectionInProgress) || !navigableHeaders) {
|
854
|
+
return;
|
855
|
+
}
|
856
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
857
|
+
const columnStart = selectedRange.getTopStartCorner().col;
|
858
|
+
const columnEnd = selectedRange.getBottomEndCorner().col;
|
859
|
+
const {
|
860
|
+
columnIndex,
|
861
|
+
origColspan
|
862
|
+
} = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(_classPrivateFieldGet(this, _focusInitialCoords).row, _classPrivateFieldGet(this, _focusInitialCoords).col);
|
863
|
+
selectedRange.setHighlight(_classPrivateFieldGet(this, _focusInitialCoords));
|
864
|
+
if (origColspan > selectedRange.getWidth() || columnIndex < columnStart || columnIndex + origColspan - 1 > columnEnd) {
|
865
|
+
const headerLevel = _classPrivateFieldGet(this, _stateManager).findTopMostEntireHeaderLevel((0, _number.clamp)(columnStart, columnIndex, columnIndex + origColspan - 1), (0, _number.clamp)(columnEnd, columnIndex, columnIndex + origColspan - 1));
|
866
|
+
selectedRange.highlight.row = headerLevel;
|
867
|
+
selectedRange.highlight.col = selectedRange.from.col;
|
693
868
|
}
|
694
|
-
|
695
|
-
|
696
|
-
|
697
|
-
|
698
|
-
|
699
|
-
|
700
|
-
|
701
|
-
|
702
|
-
|
703
|
-
|
704
|
-
|
705
|
-
|
706
|
-
|
707
|
-
|
708
|
-
const
|
709
|
-
|
710
|
-
|
711
|
-
|
712
|
-
|
713
|
-
|
714
|
-
|
715
|
-
|
716
|
-
|
717
|
-
|
718
|
-
|
719
|
-
|
869
|
+
}
|
870
|
+
function _onModifyTransformStart2(delta) {
|
871
|
+
const {
|
872
|
+
highlight
|
873
|
+
} = this.hot.getSelectedRangeLast();
|
874
|
+
const nextCoords = this.hot._createCellCoords(highlight.row + delta.row, highlight.col + delta.col);
|
875
|
+
const isNestedHeadersRange = nextCoords.isHeader() && nextCoords.col >= 0;
|
876
|
+
if (!isNestedHeadersRange) {
|
877
|
+
return;
|
878
|
+
}
|
879
|
+
const visualColumnIndexStart = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(nextCoords.row, nextCoords.col);
|
880
|
+
const visualColumnIndexEnd = _classPrivateFieldGet(this, _stateManager).findRightMostColumnIndex(nextCoords.row, nextCoords.col);
|
881
|
+
if (delta.col < 0) {
|
882
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexStart - 1 : visualColumnIndexEnd;
|
883
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, -1);
|
884
|
+
if (notHiddenColumnIndex === null) {
|
885
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
886
|
+
// be processed by the selection Transformer class as a move selection to the previous row (if autoWrapRow is enabled).
|
887
|
+
delta.col = -this.hot.view.countRenderableColumnsInRange(0, highlight.col);
|
888
|
+
} else {
|
889
|
+
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
890
|
+
}
|
891
|
+
} else if (delta.col > 0) {
|
892
|
+
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
893
|
+
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
894
|
+
if (notHiddenColumnIndex === null) {
|
895
|
+
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
896
|
+
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
897
|
+
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
898
|
+
} else {
|
899
|
+
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
720
900
|
}
|
721
901
|
}
|
722
|
-
|
723
|
-
|
724
|
-
|
725
|
-
|
726
|
-
|
727
|
-
|
728
|
-
|
729
|
-
|
730
|
-
|
731
|
-
|
732
|
-
|
733
|
-
|
734
|
-
|
735
|
-
if (
|
736
|
-
|
737
|
-
}
|
738
|
-
|
739
|
-
|
740
|
-
|
741
|
-
|
742
|
-
|
743
|
-
|
744
|
-
|
745
|
-
|
746
|
-
|
747
|
-
|
748
|
-
delta.col = -Math.max(this.hot.view.countRenderableColumnsInRange(notHiddenColumnIndex, highlight.col) - 1, 1);
|
749
|
-
}
|
750
|
-
} else if (delta.col > 0) {
|
751
|
-
const nextColumn = highlight.col >= visualColumnIndexStart && highlight.col <= visualColumnIndexEnd ? visualColumnIndexEnd + 1 : visualColumnIndexStart;
|
752
|
-
const notHiddenColumnIndex = this.hot.columnIndexMapper.getNearestNotHiddenIndex(nextColumn, 1);
|
753
|
-
if (notHiddenColumnIndex === null) {
|
754
|
-
// There are no visible columns anymore, so move the selection out of the table edge. This will
|
755
|
-
// be processed by the selection Transformer class as a move selection to the next row (if autoWrapRow is enabled).
|
756
|
-
delta.col = this.hot.view.countRenderableColumnsInRange(highlight.col, this.hot.countCols());
|
757
|
-
} else {
|
758
|
-
delta.col = Math.max(this.hot.view.countRenderableColumnsInRange(highlight.col, notHiddenColumnIndex) - 1, 1);
|
759
|
-
}
|
902
|
+
}
|
903
|
+
function _onBeforeSelectColumns2(from, to) {
|
904
|
+
const headerLevel = from.row;
|
905
|
+
const startNodeData = this._getHeaderTreeNodeDataByCoords({
|
906
|
+
row: headerLevel,
|
907
|
+
col: from.col
|
908
|
+
});
|
909
|
+
const endNodeData = this._getHeaderTreeNodeDataByCoords({
|
910
|
+
row: headerLevel,
|
911
|
+
col: to.col
|
912
|
+
});
|
913
|
+
if (to.col < from.col) {
|
914
|
+
// Column selection from right to left
|
915
|
+
if (startNodeData) {
|
916
|
+
from.col = startNodeData.columnIndex + startNodeData.origColspan - 1;
|
917
|
+
}
|
918
|
+
if (endNodeData) {
|
919
|
+
to.col = endNodeData.columnIndex;
|
920
|
+
}
|
921
|
+
} else if (to.col >= from.col) {
|
922
|
+
// Column selection from left to right or a single column selection
|
923
|
+
if (startNodeData) {
|
924
|
+
from.col = startNodeData.columnIndex;
|
925
|
+
}
|
926
|
+
if (endNodeData) {
|
927
|
+
to.col = endNodeData.columnIndex + endNodeData.origColspan - 1;
|
760
928
|
}
|
761
929
|
}
|
762
|
-
|
763
|
-
|
764
|
-
|
765
|
-
|
766
|
-
|
767
|
-
* @private
|
768
|
-
* @param {CellCoords} from The coords object where the selection starts.
|
769
|
-
* @param {CellCoords} to The coords object where the selection ends.
|
770
|
-
*/
|
771
|
-
onBeforeSelectColumns(from, to) {
|
772
|
-
const headerLevel = from.row;
|
773
|
-
const startNodeData = this._getHeaderTreeNodeDataByCoords({
|
774
|
-
row: headerLevel,
|
775
|
-
col: from.col
|
776
|
-
});
|
777
|
-
const endNodeData = this._getHeaderTreeNodeDataByCoords({
|
778
|
-
row: headerLevel,
|
779
|
-
col: to.col
|
780
|
-
});
|
781
|
-
if (to.col < from.col) {
|
782
|
-
// Column selection from right to left
|
783
|
-
if (startNodeData) {
|
784
|
-
from.col = startNodeData.columnIndex + startNodeData.origColspan - 1;
|
785
|
-
}
|
786
|
-
if (endNodeData) {
|
787
|
-
to.col = endNodeData.columnIndex;
|
788
|
-
}
|
789
|
-
} else if (to.col >= from.col) {
|
790
|
-
// Column selection from left to right or a single column selection
|
791
|
-
if (startNodeData) {
|
792
|
-
from.col = startNodeData.columnIndex;
|
793
|
-
}
|
794
|
-
if (endNodeData) {
|
795
|
-
to.col = endNodeData.columnIndex + endNodeData.origColspan - 1;
|
796
|
-
}
|
797
|
-
}
|
930
|
+
}
|
931
|
+
function _onAfterGetColumnHeaderRenderers2(renderersArray) {
|
932
|
+
renderersArray.length = 0;
|
933
|
+
for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(this, _stateManager).getLayersCount(); headerLayer++) {
|
934
|
+
renderersArray.push(this.headerRendererFactory(headerLayer));
|
798
935
|
}
|
936
|
+
}
|
937
|
+
function _onAfterViewportColumnCalculatorOverride2(calc) {
|
938
|
+
const headerLayersCount = _classPrivateFieldGet(this, _stateManager).getLayersCount();
|
939
|
+
let newStartColumn = calc.startColumn;
|
940
|
+
let nonRenderable = !!headerLayersCount;
|
941
|
+
for (let headerLayer = 0; headerLayer < headerLayersCount; headerLayer++) {
|
942
|
+
const startColumn = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(headerLayer, calc.startColumn);
|
943
|
+
const renderedStartColumn = this.hot.columnIndexMapper.getRenderableFromVisualIndex(startColumn);
|
799
944
|
|
800
|
-
|
801
|
-
|
802
|
-
|
803
|
-
|
804
|
-
* @param {Array} renderersArray Array of renderers.
|
805
|
-
*/
|
806
|
-
onAfterGetColumnHeaderRenderers(renderersArray) {
|
807
|
-
renderersArray.length = 0;
|
808
|
-
for (let headerLayer = 0; headerLayer < _classPrivateFieldGet(this, _stateManager).getLayersCount(); headerLayer++) {
|
809
|
-
renderersArray.push(this.headerRendererFactory(headerLayer));
|
945
|
+
// If any of the headers for that column index is rendered, all of them should be rendered properly, see
|
946
|
+
// comment below.
|
947
|
+
if (startColumn >= 0) {
|
948
|
+
nonRenderable = false;
|
810
949
|
}
|
811
|
-
}
|
812
950
|
|
813
|
-
|
814
|
-
|
815
|
-
|
816
|
-
|
817
|
-
|
818
|
-
*/
|
819
|
-
onAfterViewportColumnCalculatorOverride(calc) {
|
820
|
-
const headerLayersCount = _classPrivateFieldGet(this, _stateManager).getLayersCount();
|
821
|
-
let newStartColumn = calc.startColumn;
|
822
|
-
let nonRenderable = !!headerLayersCount;
|
823
|
-
for (let headerLayer = 0; headerLayer < headerLayersCount; headerLayer++) {
|
824
|
-
const startColumn = _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(headerLayer, calc.startColumn);
|
825
|
-
const renderedStartColumn = this.hot.columnIndexMapper.getRenderableFromVisualIndex(startColumn);
|
826
|
-
|
827
|
-
// If any of the headers for that column index is rendered, all of them should be rendered properly, see
|
828
|
-
// comment below.
|
829
|
-
if (startColumn >= 0) {
|
830
|
-
nonRenderable = false;
|
831
|
-
}
|
832
|
-
|
833
|
-
// `renderedStartColumn` can be `null` if the leftmost columns are hidden. In that case -> ignore that header
|
834
|
-
// level, as it should be handled by the "parent" header
|
835
|
-
if ((0, _number.isNumeric)(renderedStartColumn) && renderedStartColumn < calc.startColumn) {
|
836
|
-
newStartColumn = renderedStartColumn;
|
837
|
-
break;
|
838
|
-
}
|
951
|
+
// `renderedStartColumn` can be `null` if the leftmost columns are hidden. In that case -> ignore that header
|
952
|
+
// level, as it should be handled by the "parent" header
|
953
|
+
if ((0, _number.isNumeric)(renderedStartColumn) && renderedStartColumn < calc.startColumn) {
|
954
|
+
newStartColumn = renderedStartColumn;
|
955
|
+
break;
|
839
956
|
}
|
840
|
-
|
841
|
-
// If no headers for the provided column index are renderable, start rendering from the beginning of the upmost
|
842
|
-
// header for that position.
|
843
|
-
calc.startColumn = nonRenderable ? _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(0, newStartColumn).columnIndex : newStartColumn;
|
844
957
|
}
|
845
958
|
|
846
|
-
|
847
|
-
|
848
|
-
|
849
|
-
|
850
|
-
|
851
|
-
|
852
|
-
|
853
|
-
|
854
|
-
|
855
|
-
|
856
|
-
|
857
|
-
|
858
|
-
|
859
|
-
|
860
|
-
|
861
|
-
|
862
|
-
|
863
|
-
|
864
|
-
|
865
|
-
|
866
|
-
* @param {number} headerLevel The index of header level. The header level accepts positive (0 to N)
|
867
|
-
* and negative (-1 to -N) values. For positive values, 0 points to the
|
868
|
-
* top most header, and for negative direction, -1 points to the most bottom
|
869
|
-
* header (the header closest to the cells).
|
870
|
-
* @returns {string} Returns the column header value to update.
|
871
|
-
*/
|
872
|
-
onModifyColumnHeaderValue(value, visualColumnIndex, headerLevel) {
|
873
|
-
var _classPrivateFieldGet5;
|
874
|
-
const {
|
875
|
-
label
|
876
|
-
} = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
|
877
|
-
label: ''
|
878
|
-
};
|
879
|
-
return label;
|
880
|
-
}
|
881
|
-
|
882
|
-
/**
|
883
|
-
* `modifyFocusedElement` hook callback.
|
884
|
-
*
|
885
|
-
* @private
|
886
|
-
* @param {number} row Row index.
|
887
|
-
* @param {number} column Column index.
|
888
|
-
* @returns {HTMLTableCellElement} The `TH` element to be focused.
|
889
|
-
*/
|
890
|
-
onModifyFocusedElement(row, column) {
|
891
|
-
if (row < 0) {
|
892
|
-
return this.hot.getCell(row, _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(row, column), true);
|
893
|
-
}
|
959
|
+
// If no headers for the provided column index are renderable, start rendering from the beginning of the upmost
|
960
|
+
// header for that position.
|
961
|
+
calc.startColumn = nonRenderable ? _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(0, newStartColumn).columnIndex : newStartColumn;
|
962
|
+
}
|
963
|
+
function _onModifyColWidth2(width, column) {
|
964
|
+
const cachedWidth = this.ghostTable.getWidth(column);
|
965
|
+
return width > cachedWidth ? width : cachedWidth;
|
966
|
+
}
|
967
|
+
function _onModifyColumnHeaderValue2(value, visualColumnIndex, headerLevel) {
|
968
|
+
var _classPrivateFieldGet5;
|
969
|
+
const {
|
970
|
+
label
|
971
|
+
} = (_classPrivateFieldGet5 = _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(headerLevel, visualColumnIndex)) !== null && _classPrivateFieldGet5 !== void 0 ? _classPrivateFieldGet5 : {
|
972
|
+
label: ''
|
973
|
+
};
|
974
|
+
return label;
|
975
|
+
}
|
976
|
+
function _onModifyFocusedElement2(row, column) {
|
977
|
+
if (row < 0) {
|
978
|
+
return this.hot.getCell(row, _classPrivateFieldGet(this, _stateManager).findLeftMostColumnIndex(row, column), true);
|
894
979
|
}
|
895
|
-
|
896
|
-
|
897
|
-
|
898
|
-
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
// @TODO: Workaround for broken plugin initialization abstraction.
|
980
|
+
}
|
981
|
+
function _onInit2() {
|
982
|
+
// @TODO: Workaround for broken plugin initialization abstraction.
|
983
|
+
this.updatePlugin();
|
984
|
+
}
|
985
|
+
function _onAfterLoadData2(sourceData, initialLoad) {
|
986
|
+
if (!initialLoad) {
|
903
987
|
this.updatePlugin();
|
904
988
|
}
|
905
|
-
|
906
|
-
/**
|
907
|
-
* Updates the plugin state after new dataset load.
|
908
|
-
*
|
909
|
-
* @private
|
910
|
-
* @param {Array[]} sourceData Array of arrays or array of objects containing data.
|
911
|
-
* @param {boolean} initialLoad Flag that determines whether the data has been loaded
|
912
|
-
* during the initialization.
|
913
|
-
*/
|
914
|
-
onAfterLoadData(sourceData, initialLoad) {
|
915
|
-
if (!initialLoad) {
|
916
|
-
this.updatePlugin();
|
917
|
-
}
|
918
|
-
}
|
919
|
-
|
920
|
-
/**
|
921
|
-
* Destroys the plugin instance.
|
922
|
-
*/
|
923
|
-
destroy() {
|
924
|
-
_classPrivateFieldSet(this, _stateManager, null);
|
925
|
-
if (_classPrivateFieldGet(this, _hidingIndexMapObserver) !== null) {
|
926
|
-
_classPrivateFieldGet(this, _hidingIndexMapObserver).unsubscribe();
|
927
|
-
_classPrivateFieldSet(this, _hidingIndexMapObserver, null);
|
928
|
-
}
|
929
|
-
super.destroy();
|
930
|
-
}
|
931
|
-
|
932
|
-
/**
|
933
|
-
* Gets the tree data that belongs to the column headers pointed by the passed coordinates.
|
934
|
-
*
|
935
|
-
* @private
|
936
|
-
* @param {CellCoords} coords The CellCoords instance.
|
937
|
-
* @returns {object|undefined}
|
938
|
-
*/
|
939
|
-
_getHeaderTreeNodeDataByCoords(coords) {
|
940
|
-
if (coords.row >= 0 || coords.col < 0) {
|
941
|
-
return;
|
942
|
-
}
|
943
|
-
return _classPrivateFieldGet(this, _stateManager).getHeaderTreeNodeData(coords.row, coords.col);
|
944
|
-
}
|
945
|
-
}
|
946
|
-
exports.NestedHeaders = NestedHeaders;
|
989
|
+
}
|