handsontable 0.0.0-next-7026906-20231107 → 0.0.0-next-7b93b7d-20231107
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- 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/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 +25 -25
- package/core.mjs +25 -25
- 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 +7244 -6347
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +120 -120
- package/dist/handsontable.js +7243 -6346
- 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 +97 -102
- package/plugins/autofill/autofill.mjs +96 -101
- package/plugins/base/base.js +57 -22
- package/plugins/base/base.mjs +56 -22
- 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 +105 -98
- package/plugins/columnSorting/columnSorting.mjs +104 -97
- 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 +91 -101
- package/plugins/contextMenu/contextMenu.mjs +90 -100
- 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/copyPaste/copyPaste.js +74 -75
- package/plugins/copyPaste/copyPaste.mjs +74 -75
- package/plugins/customBorders/customBorders.js +49 -48
- package/plugins/customBorders/customBorders.mjs +48 -47
- package/plugins/dragToScroll/dragToScroll.js +50 -54
- package/plugins/dragToScroll/dragToScroll.mjs +49 -52
- package/plugins/dropdownMenu/dropdownMenu.js +132 -129
- package/plugins/dropdownMenu/dropdownMenu.mjs +132 -129
- 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 +67 -54
- 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 +13 -10
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +13 -10
- 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 +326 -278
- package/plugins/nestedRows/nestedRows.mjs +325 -277
- 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/range.js +12 -2
- package/selection/range.mjs +12 -2
- package/selection/selection.js +3 -3
- package/selection/selection.mjs +3 -3
- 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
package/dataMap/dataMap.mjs
CHANGED
@@ -1,5 +1,8 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
import "core-js/modules/es.array.push.js";
|
3
|
+
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; }
|
4
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
5
|
+
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); }
|
3
6
|
import { stringify } from "../3rdparty/SheetClip/index.mjs";
|
4
7
|
import { countFirstRowKeys } from "../helpers/data.mjs";
|
5
8
|
import { createObjectPropListener, deepClone, deepExtend, deepObjectSize, duckSchema, hasOwnProperty, isObject, objectEach } from "../helpers/object.mjs";
|
@@ -52,56 +55,62 @@ class DataMap {
|
|
52
55
|
}
|
53
56
|
|
54
57
|
/**
|
55
|
-
*
|
58
|
+
* Instance of {@link Handsontable}.
|
59
|
+
*
|
60
|
+
* @private
|
61
|
+
* @type {Handsontable}
|
62
|
+
*/
|
63
|
+
|
64
|
+
/**
|
65
|
+
* @param {object} hotInstance Instance of Handsontable.
|
56
66
|
* @param {Array} data Array of arrays or array of objects containing data.
|
57
67
|
* @param {MetaManager} metaManager The meta manager instance.
|
58
68
|
*/
|
59
|
-
constructor(
|
60
|
-
|
61
|
-
* Instance of {@link Handsontable}.
|
62
|
-
*
|
63
|
-
* @private
|
64
|
-
* @type {Handsontable}
|
65
|
-
*/
|
66
|
-
this.instance = instance;
|
69
|
+
constructor(hotInstance, data, metaManager) {
|
70
|
+
_defineProperty(this, "hot", void 0);
|
67
71
|
/**
|
68
72
|
* Instance of {@link MetaManager}.
|
69
73
|
*
|
70
74
|
* @private
|
71
75
|
* @type {MetaManager}
|
72
76
|
*/
|
73
|
-
this
|
77
|
+
_defineProperty(this, "metaManager", void 0);
|
74
78
|
/**
|
75
79
|
* Instance of {@link TableMeta}.
|
76
80
|
*
|
77
81
|
* @private
|
78
82
|
* @type {TableMeta}
|
79
83
|
*/
|
80
|
-
this
|
84
|
+
_defineProperty(this, "tableMeta", void 0);
|
81
85
|
/**
|
82
86
|
* Reference to the original dataset.
|
83
87
|
*
|
84
88
|
* @type {*}
|
85
89
|
*/
|
86
|
-
this
|
90
|
+
_defineProperty(this, "dataSource", void 0);
|
87
91
|
/**
|
88
92
|
* Generated schema based on the first row from the source data.
|
89
93
|
*
|
90
94
|
* @type {object}
|
91
95
|
*/
|
92
|
-
this
|
96
|
+
_defineProperty(this, "duckSchema", void 0);
|
93
97
|
/**
|
94
98
|
* Cached array of properties to columns.
|
95
99
|
*
|
96
100
|
* @type {Array}
|
97
101
|
*/
|
98
|
-
this
|
102
|
+
_defineProperty(this, "colToPropCache", void 0);
|
99
103
|
/**
|
100
104
|
* Cached map of properties to columns.
|
101
105
|
*
|
102
106
|
* @type {Map}
|
103
107
|
*/
|
104
|
-
this
|
108
|
+
_defineProperty(this, "propToColCache", void 0);
|
109
|
+
this.hot = hotInstance;
|
110
|
+
this.metaManager = metaManager;
|
111
|
+
this.tableMeta = metaManager.getTableMeta();
|
112
|
+
this.dataSource = data;
|
113
|
+
this.duckSchema = this.createDuckSchema();
|
105
114
|
this.createMap();
|
106
115
|
}
|
107
116
|
|
@@ -197,7 +206,7 @@ class DataMap {
|
|
197
206
|
if (Number.isInteger(column) === false) {
|
198
207
|
return column;
|
199
208
|
}
|
200
|
-
const physicalColumn = this.
|
209
|
+
const physicalColumn = this.hot.toPhysicalColumn(column);
|
201
210
|
|
202
211
|
// Out of range, not visible column index.
|
203
212
|
if (physicalColumn === null) {
|
@@ -220,11 +229,11 @@ class DataMap {
|
|
220
229
|
propToCol(prop) {
|
221
230
|
const cachedPhysicalIndex = this.propToColCache.get(prop);
|
222
231
|
if (isDefined(cachedPhysicalIndex)) {
|
223
|
-
return this.
|
232
|
+
return this.hot.toVisualColumn(cachedPhysicalIndex);
|
224
233
|
}
|
225
234
|
|
226
235
|
// Property may be a physical column index.
|
227
|
-
const visualColumn = this.
|
236
|
+
const visualColumn = this.hot.toVisualColumn(prop);
|
228
237
|
if (visualColumn === null) {
|
229
238
|
return prop;
|
230
239
|
}
|
@@ -280,17 +289,17 @@ class DataMap {
|
|
280
289
|
source,
|
281
290
|
mode = 'above'
|
282
291
|
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
283
|
-
const sourceRowsCount = this.
|
292
|
+
const sourceRowsCount = this.hot.countSourceRows();
|
284
293
|
let physicalRowIndex = sourceRowsCount;
|
285
294
|
let numberOfCreatedRows = 0;
|
286
295
|
let rowIndex = index;
|
287
296
|
if (typeof rowIndex !== 'number' || rowIndex >= sourceRowsCount) {
|
288
297
|
rowIndex = sourceRowsCount;
|
289
298
|
}
|
290
|
-
if (rowIndex < this.
|
291
|
-
physicalRowIndex = this.
|
299
|
+
if (rowIndex < this.hot.countRows()) {
|
300
|
+
physicalRowIndex = this.hot.toPhysicalRow(rowIndex);
|
292
301
|
}
|
293
|
-
const continueProcess = this.
|
302
|
+
const continueProcess = this.hot.runHooks('beforeCreateRow', rowIndex, amount, source);
|
294
303
|
if (continueProcess === false || physicalRowIndex === null) {
|
295
304
|
return {
|
296
305
|
delta: 0
|
@@ -301,7 +310,7 @@ class DataMap {
|
|
301
310
|
const rowsToAdd = [];
|
302
311
|
while (numberOfCreatedRows < amount && sourceRowsCount + numberOfCreatedRows < maxRows) {
|
303
312
|
let row = null;
|
304
|
-
if (this.
|
313
|
+
if (this.hot.dataType === 'array') {
|
305
314
|
if (this.tableMeta.dataSchema) {
|
306
315
|
// Clone template array
|
307
316
|
row = deepClone(this.getSchema());
|
@@ -310,7 +319,7 @@ class DataMap {
|
|
310
319
|
/* eslint-disable no-loop-func */
|
311
320
|
rangeEach(columnCount - 1, () => row.push(null));
|
312
321
|
}
|
313
|
-
} else if (this.
|
322
|
+
} else if (this.hot.dataType === 'function') {
|
314
323
|
row = this.tableMeta.dataSchema(rowIndex + numberOfCreatedRows);
|
315
324
|
} else {
|
316
325
|
row = {};
|
@@ -319,20 +328,20 @@ class DataMap {
|
|
319
328
|
rowsToAdd.push(row);
|
320
329
|
numberOfCreatedRows += 1;
|
321
330
|
}
|
322
|
-
this.
|
331
|
+
this.hot.rowIndexMapper.insertIndexes(rowIndex, numberOfCreatedRows);
|
323
332
|
if (mode === 'below') {
|
324
333
|
physicalRowIndex = Math.min(physicalRowIndex + 1, sourceRowsCount);
|
325
334
|
}
|
326
335
|
this.spliceData(physicalRowIndex, 0, rowsToAdd);
|
327
|
-
const newVisualRowIndex = this.
|
336
|
+
const newVisualRowIndex = this.hot.toVisualRow(physicalRowIndex);
|
328
337
|
|
329
338
|
// In case the created rows are the only ones in the table, the column index mappers need to be rebuilt based on
|
330
339
|
// the number of columns created in the row or the schema.
|
331
|
-
if (this.
|
332
|
-
this.
|
340
|
+
if (this.hot.countSourceRows() === rowsToAdd.length) {
|
341
|
+
this.hot.columnIndexMapper.initToLength(this.hot.getInitialColumnCount());
|
333
342
|
}
|
334
343
|
if (numberOfCreatedRows > 0) {
|
335
|
-
if (index ===
|
344
|
+
if (index === undefined || index === null) {
|
336
345
|
// Creates the meta rows at the end of the rows collection without shifting the cells
|
337
346
|
// that were defined out of the range of the dataset.
|
338
347
|
this.metaManager.createRow(null, numberOfCreatedRows);
|
@@ -340,8 +349,8 @@ class DataMap {
|
|
340
349
|
this.metaManager.createRow(physicalRowIndex, amount);
|
341
350
|
}
|
342
351
|
}
|
343
|
-
this.
|
344
|
-
this.
|
352
|
+
this.hot.runHooks('afterCreateRow', newVisualRowIndex, numberOfCreatedRows, source);
|
353
|
+
this.hot.forceFullRender = true; // used when data was changed
|
345
354
|
|
346
355
|
return {
|
347
356
|
delta: numberOfCreatedRows,
|
@@ -367,28 +376,28 @@ class DataMap {
|
|
367
376
|
source,
|
368
377
|
mode = 'start'
|
369
378
|
} = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
370
|
-
if (!this.
|
379
|
+
if (!this.hot.isColumnModificationAllowed()) {
|
371
380
|
throw new Error('Cannot create new column. When data source in an object, ' + 'you can only have as much columns as defined in first data row, data schema or in the \'columns\' setting.' + 'If you want to be able to add new columns, you have to use array datasource.');
|
372
381
|
}
|
373
382
|
const dataSource = this.dataSource;
|
374
383
|
const maxCols = this.tableMeta.maxCols;
|
375
|
-
const countSourceCols = this.
|
384
|
+
const countSourceCols = this.hot.countSourceCols();
|
376
385
|
let columnIndex = index;
|
377
386
|
if (typeof columnIndex !== 'number' || columnIndex >= countSourceCols) {
|
378
387
|
columnIndex = countSourceCols;
|
379
388
|
}
|
380
|
-
const continueProcess = this.
|
389
|
+
const continueProcess = this.hot.runHooks('beforeCreateCol', columnIndex, amount, source);
|
381
390
|
if (continueProcess === false) {
|
382
391
|
return {
|
383
392
|
delta: 0
|
384
393
|
};
|
385
394
|
}
|
386
395
|
let physicalColumnIndex = countSourceCols;
|
387
|
-
if (columnIndex < this.
|
388
|
-
physicalColumnIndex = this.
|
396
|
+
if (columnIndex < this.hot.countCols()) {
|
397
|
+
physicalColumnIndex = this.hot.toPhysicalColumn(columnIndex);
|
389
398
|
}
|
390
|
-
const numberOfSourceRows = this.
|
391
|
-
let nrOfColumns = this.
|
399
|
+
const numberOfSourceRows = this.hot.countSourceRows();
|
400
|
+
let nrOfColumns = this.hot.countCols();
|
392
401
|
let numberOfCreatedCols = 0;
|
393
402
|
let currentIndex = physicalColumnIndex;
|
394
403
|
if (mode === 'end') {
|
@@ -416,9 +425,9 @@ class DataMap {
|
|
416
425
|
currentIndex += 1;
|
417
426
|
nrOfColumns += 1;
|
418
427
|
}
|
419
|
-
this.
|
428
|
+
this.hot.columnIndexMapper.insertIndexes(columnIndex, numberOfCreatedCols);
|
420
429
|
if (numberOfCreatedCols > 0) {
|
421
|
-
if (index ===
|
430
|
+
if (index === undefined || index === null) {
|
422
431
|
// Creates the meta columns at the end of the columns collection without shifting the cells
|
423
432
|
// that were defined out of the range of the dataset.
|
424
433
|
this.metaManager.createColumn(null, numberOfCreatedCols);
|
@@ -426,9 +435,9 @@ class DataMap {
|
|
426
435
|
this.metaManager.createColumn(startPhysicalIndex, amount);
|
427
436
|
}
|
428
437
|
}
|
429
|
-
const newVisualColumnIndex = this.
|
430
|
-
this.
|
431
|
-
this.
|
438
|
+
const newVisualColumnIndex = this.hot.toVisualColumn(startPhysicalIndex);
|
439
|
+
this.hot.runHooks('afterCreateCol', newVisualColumnIndex, numberOfCreatedCols, source);
|
440
|
+
this.hot.forceFullRender = true; // used when data was changed
|
432
441
|
|
433
442
|
this.refreshDuckSchema();
|
434
443
|
return {
|
@@ -452,11 +461,11 @@ class DataMap {
|
|
452
461
|
let source = arguments.length > 2 ? arguments[2] : undefined;
|
453
462
|
let rowIndex = Number.isInteger(index) ? index : -amount; // -amount = taking indexes from the end.
|
454
463
|
const removedPhysicalIndexes = this.visualRowsToPhysical(rowIndex, amount);
|
455
|
-
const sourceRowsLength = this.
|
464
|
+
const sourceRowsLength = this.hot.countSourceRows();
|
456
465
|
rowIndex = (sourceRowsLength + rowIndex) % sourceRowsLength;
|
457
466
|
|
458
467
|
// It handle also callback from the `NestedRows` plugin. Removing parent node has effect in removing children nodes.
|
459
|
-
const actionWasNotCancelled = this.
|
468
|
+
const actionWasNotCancelled = this.hot.runHooks('beforeRemoveRow', rowIndex, removedPhysicalIndexes.length, removedPhysicalIndexes, source);
|
460
469
|
if (actionWasNotCancelled === false) {
|
461
470
|
return false;
|
462
471
|
}
|
@@ -466,21 +475,21 @@ class DataMap {
|
|
466
475
|
this.filterData(rowIndex, numberOfRemovedIndexes, removedPhysicalIndexes);
|
467
476
|
|
468
477
|
// TODO: Function `removeRow` should validate fully, probably above.
|
469
|
-
if (rowIndex < this.
|
470
|
-
this.
|
478
|
+
if (rowIndex < this.hot.countRows()) {
|
479
|
+
this.hot.rowIndexMapper.removeIndexes(removedPhysicalIndexes);
|
471
480
|
const customDefinedColumns = isDefined(this.tableMeta.columns) || isDefined(this.tableMeta.dataSchema);
|
472
481
|
|
473
482
|
// All rows have been removed. There shouldn't be any columns.
|
474
|
-
if (this.
|
475
|
-
this.
|
483
|
+
if (this.hot.rowIndexMapper.getNotTrimmedIndexesLength() === 0 && customDefinedColumns === false) {
|
484
|
+
this.hot.columnIndexMapper.setIndexesSequence([]);
|
476
485
|
}
|
477
486
|
}
|
478
487
|
const descendingPhysicalRows = removedPhysicalIndexes.slice(0).sort((a, b) => b - a);
|
479
488
|
descendingPhysicalRows.forEach(rowPhysicalIndex => {
|
480
489
|
this.metaManager.removeRow(rowPhysicalIndex, 1);
|
481
490
|
});
|
482
|
-
this.
|
483
|
-
this.
|
491
|
+
this.hot.runHooks('afterRemoveRow', rowIndex, numberOfRemovedIndexes, removedPhysicalIndexes, source);
|
492
|
+
this.hot.forceFullRender = true; // used when data was changed
|
484
493
|
|
485
494
|
return true;
|
486
495
|
}
|
@@ -498,14 +507,14 @@ class DataMap {
|
|
498
507
|
removeCol(index) {
|
499
508
|
let amount = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;
|
500
509
|
let source = arguments.length > 2 ? arguments[2] : undefined;
|
501
|
-
if (this.
|
510
|
+
if (this.hot.dataType === 'object' || this.tableMeta.columns) {
|
502
511
|
throw new Error('cannot remove column with object data source or columns option specified');
|
503
512
|
}
|
504
513
|
let columnIndex = typeof index !== 'number' ? -amount : index;
|
505
|
-
columnIndex = (this.
|
514
|
+
columnIndex = (this.hot.countCols() + columnIndex) % this.hot.countCols();
|
506
515
|
const removedPhysicalIndexes = this.visualColumnsToPhysical(columnIndex, amount);
|
507
516
|
const descendingPhysicalColumns = removedPhysicalIndexes.slice(0).sort((a, b) => b - a);
|
508
|
-
const actionWasNotCancelled = this.
|
517
|
+
const actionWasNotCancelled = this.hot.runHooks('beforeRemoveCol', columnIndex, amount, removedPhysicalIndexes, source);
|
509
518
|
if (actionWasNotCancelled === false) {
|
510
519
|
return false;
|
511
520
|
}
|
@@ -518,14 +527,14 @@ class DataMap {
|
|
518
527
|
}
|
519
528
|
}
|
520
529
|
if (isTableUniform) {
|
521
|
-
for (let r = 0, rlen = this.
|
530
|
+
for (let r = 0, rlen = this.hot.countSourceRows(); r < rlen; r++) {
|
522
531
|
data[r].splice(removedPhysicalIndexes[0], amount);
|
523
532
|
if (r === 0) {
|
524
533
|
this.metaManager.removeColumn(removedPhysicalIndexes[0], amount);
|
525
534
|
}
|
526
535
|
}
|
527
536
|
} else {
|
528
|
-
for (let r = 0, rlen = this.
|
537
|
+
for (let r = 0, rlen = this.hot.countSourceRows(); r < rlen; r++) {
|
529
538
|
for (let c = 0; c < removedColumnsCount; c++) {
|
530
539
|
data[r].splice(descendingPhysicalColumns[c], 1);
|
531
540
|
if (r === 0) {
|
@@ -536,16 +545,16 @@ class DataMap {
|
|
536
545
|
}
|
537
546
|
|
538
547
|
// TODO: Function `removeCol` should validate fully, probably above.
|
539
|
-
if (columnIndex < this.
|
540
|
-
this.
|
548
|
+
if (columnIndex < this.hot.countCols()) {
|
549
|
+
this.hot.columnIndexMapper.removeIndexes(removedPhysicalIndexes);
|
541
550
|
|
542
551
|
// All columns have been removed. There shouldn't be any rows.
|
543
|
-
if (this.
|
544
|
-
this.
|
552
|
+
if (this.hot.columnIndexMapper.getNotTrimmedIndexesLength() === 0) {
|
553
|
+
this.hot.rowIndexMapper.setIndexesSequence([]);
|
545
554
|
}
|
546
555
|
}
|
547
|
-
this.
|
548
|
-
this.
|
556
|
+
this.hot.runHooks('afterRemoveCol', columnIndex, amount, removedPhysicalIndexes, source);
|
557
|
+
this.hot.forceFullRender = true; // used when data was changed
|
549
558
|
this.refreshDuckSchema();
|
550
559
|
return true;
|
551
560
|
}
|
@@ -560,7 +569,7 @@ class DataMap {
|
|
560
569
|
* @returns {Array} Returns removed portion of columns.
|
561
570
|
*/
|
562
571
|
spliceCol(col, index, amount) {
|
563
|
-
const colData = this.
|
572
|
+
const colData = this.hot.getDataAtCol(col);
|
564
573
|
const removed = colData.slice(index, index + amount);
|
565
574
|
const after = colData.slice(index + amount);
|
566
575
|
for (var _len = arguments.length, elements = new Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
@@ -573,7 +582,7 @@ class DataMap {
|
|
573
582
|
i += 1;
|
574
583
|
}
|
575
584
|
to2dArray(elements);
|
576
|
-
this.
|
585
|
+
this.hot.populateFromArray(index, col, elements, null, null, 'spliceCol');
|
577
586
|
return removed;
|
578
587
|
}
|
579
588
|
|
@@ -587,7 +596,7 @@ class DataMap {
|
|
587
596
|
* @returns {Array} Returns removed portion of rows.
|
588
597
|
*/
|
589
598
|
spliceRow(row, index, amount) {
|
590
|
-
const rowData = this.
|
599
|
+
const rowData = this.hot.getSourceDataAtRow(row);
|
591
600
|
const removed = rowData.slice(index, index + amount);
|
592
601
|
const after = rowData.slice(index + amount);
|
593
602
|
for (var _len2 = arguments.length, elements = new Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
|
@@ -599,7 +608,7 @@ class DataMap {
|
|
599
608
|
elements.push(null); // add null in place of removed elements
|
600
609
|
i += 1;
|
601
610
|
}
|
602
|
-
this.
|
611
|
+
this.hot.populateFromArray(row, index, [elements], null, null, 'spliceRow');
|
603
612
|
return removed;
|
604
613
|
}
|
605
614
|
|
@@ -611,7 +620,7 @@ class DataMap {
|
|
611
620
|
* @param {Array<object>} elements Row elements to be added.
|
612
621
|
*/
|
613
622
|
spliceData(index, deleteCount, elements) {
|
614
|
-
const continueSplicing = this.
|
623
|
+
const continueSplicing = this.hot.runHooks('beforeDataSplice', index, deleteCount, elements);
|
615
624
|
if (continueSplicing !== false) {
|
616
625
|
const newData = [...this.dataSource.slice(0, index), ...elements, ...this.dataSource.slice(index)];
|
617
626
|
|
@@ -633,7 +642,7 @@ class DataMap {
|
|
633
642
|
*/
|
634
643
|
filterData(index, amount, physicalRows) {
|
635
644
|
// Custom data filtering (run as a consequence of calling the below hook) provide an array containing new data.
|
636
|
-
let data = this.
|
645
|
+
let data = this.hot.runHooks('filterData', index, amount, physicalRows);
|
637
646
|
|
638
647
|
// Hooks by default returns first argument (when there is no callback changing execution result).
|
639
648
|
if (Array.isArray(data) === false) {
|
@@ -651,10 +660,10 @@ class DataMap {
|
|
651
660
|
* @returns {*}
|
652
661
|
*/
|
653
662
|
get(row, prop) {
|
654
|
-
const physicalRow = this.
|
663
|
+
const physicalRow = this.hot.toPhysicalRow(row);
|
655
664
|
let dataRow = this.dataSource[physicalRow];
|
656
665
|
// TODO: To remove, use 'modifyData' hook instead (see below)
|
657
|
-
const modifiedRowData = this.
|
666
|
+
const modifiedRowData = this.hot.runHooks('modifyRowData', physicalRow);
|
658
667
|
dataRow = isNaN(modifiedRowData) ? modifiedRowData : dataRow;
|
659
668
|
//
|
660
669
|
|
@@ -679,9 +688,9 @@ class DataMap {
|
|
679
688
|
} else if (typeof prop === 'function') {
|
680
689
|
value = prop(this.dataSource.slice(physicalRow, physicalRow + 1)[0]);
|
681
690
|
}
|
682
|
-
if (this.
|
691
|
+
if (this.hot.hasHook('modifyData')) {
|
683
692
|
const valueHolder = createObjectPropListener(value);
|
684
|
-
this.
|
693
|
+
this.hot.runHooks('modifyData', physicalRow, this.propToCol(prop), valueHolder, 'get');
|
685
694
|
if (valueHolder.isTouched()) {
|
686
695
|
value = valueHolder.value;
|
687
696
|
}
|
@@ -697,7 +706,7 @@ class DataMap {
|
|
697
706
|
* @returns {string}
|
698
707
|
*/
|
699
708
|
getCopyable(row, prop) {
|
700
|
-
if (this.
|
709
|
+
if (this.hot.getCellMeta(row, this.propToCol(prop)).copyable) {
|
701
710
|
return this.get(row, prop);
|
702
711
|
}
|
703
712
|
return '';
|
@@ -711,17 +720,17 @@ class DataMap {
|
|
711
720
|
* @param {string} value The value to set.
|
712
721
|
*/
|
713
722
|
set(row, prop, value) {
|
714
|
-
const physicalRow = this.
|
723
|
+
const physicalRow = this.hot.toPhysicalRow(row);
|
715
724
|
let newValue = value;
|
716
725
|
let dataRow = this.dataSource[physicalRow];
|
717
726
|
// TODO: To remove, use 'modifyData' hook instead (see below)
|
718
|
-
const modifiedRowData = this.
|
727
|
+
const modifiedRowData = this.hot.runHooks('modifyRowData', physicalRow);
|
719
728
|
dataRow = isNaN(modifiedRowData) ? modifiedRowData : dataRow;
|
720
729
|
//
|
721
730
|
|
722
|
-
if (this.
|
731
|
+
if (this.hot.hasHook('modifyData')) {
|
723
732
|
const valueHolder = createObjectPropListener(newValue);
|
724
|
-
this.
|
733
|
+
this.hot.runHooks('modifyData', physicalRow, this.propToCol(prop), valueHolder, 'set');
|
725
734
|
if (valueHolder.isTouched()) {
|
726
735
|
newValue = valueHolder.value;
|
727
736
|
}
|
@@ -759,13 +768,13 @@ class DataMap {
|
|
759
768
|
* @returns {number}
|
760
769
|
*/
|
761
770
|
visualRowsToPhysical(index, amount) {
|
762
|
-
const totalRows = this.
|
771
|
+
const totalRows = this.hot.countSourceRows();
|
763
772
|
const logicRows = [];
|
764
773
|
let physicRow = (totalRows + index) % totalRows;
|
765
774
|
let rowsToRemove = amount;
|
766
775
|
let row;
|
767
776
|
while (physicRow < totalRows && rowsToRemove) {
|
768
|
-
row = this.
|
777
|
+
row = this.hot.toPhysicalRow(physicRow);
|
769
778
|
logicRows.push(row);
|
770
779
|
rowsToRemove -= 1;
|
771
780
|
physicRow += 1;
|
@@ -780,12 +789,12 @@ class DataMap {
|
|
780
789
|
* @returns {Array}
|
781
790
|
*/
|
782
791
|
visualColumnsToPhysical(index, amount) {
|
783
|
-
const totalCols = this.
|
792
|
+
const totalCols = this.hot.countCols();
|
784
793
|
const visualCols = [];
|
785
794
|
let physicalCol = (totalCols + index) % totalCols;
|
786
795
|
let colsToRemove = amount;
|
787
796
|
while (physicalCol < totalCols && colsToRemove) {
|
788
|
-
const col = this.
|
797
|
+
const col = this.hot.toPhysicalColumn(physicalCol);
|
789
798
|
visualCols.push(col);
|
790
799
|
colsToRemove -= 1;
|
791
800
|
physicalCol += 1;
|
@@ -797,8 +806,8 @@ class DataMap {
|
|
797
806
|
* Clears the data array.
|
798
807
|
*/
|
799
808
|
clear() {
|
800
|
-
for (let r = 0; r < this.
|
801
|
-
for (let c = 0; c < this.
|
809
|
+
for (let r = 0; r < this.hot.countSourceRows(); r++) {
|
810
|
+
for (let c = 0; c < this.hot.countCols(); c++) {
|
802
811
|
this.set(r, this.colToProp(c), '');
|
803
812
|
}
|
804
813
|
}
|
@@ -817,7 +826,7 @@ class DataMap {
|
|
817
826
|
} else {
|
818
827
|
maxRows = maxRowsFromSettings || Infinity;
|
819
828
|
}
|
820
|
-
const length = this.
|
829
|
+
const length = this.hot.rowIndexMapper.getNotTrimmedIndexesLength();
|
821
830
|
return Math.min(length, maxRows);
|
822
831
|
}
|
823
832
|
|
@@ -832,10 +841,10 @@ class DataMap {
|
|
832
841
|
col: 0
|
833
842
|
};
|
834
843
|
const end = {
|
835
|
-
row: Math.max(this.
|
836
|
-
col: Math.max(this.
|
844
|
+
row: Math.max(this.hot.countRows() - 1, 0),
|
845
|
+
col: Math.max(this.hot.countCols() - 1, 0)
|
837
846
|
};
|
838
|
-
if (start.row - end.row === 0 && !this.
|
847
|
+
if (start.row - end.row === 0 && !this.hot.countSourceRows()) {
|
839
848
|
return [];
|
840
849
|
}
|
841
850
|
return this.getRange(start, end, DataMap.DESTINATION_RENDERER);
|
@@ -874,7 +883,7 @@ class DataMap {
|
|
874
883
|
for (r = Math.min(start.row, end.row); r <= rlen; r++) {
|
875
884
|
row = [];
|
876
885
|
// We just store indexes for rows without headers.
|
877
|
-
const physicalRow = r >= 0 ? this.
|
886
|
+
const physicalRow = r >= 0 ? this.hot.toPhysicalRow(r) : r;
|
878
887
|
for (c = Math.min(start.col, end.col); c <= clen; c++) {
|
879
888
|
if (physicalRow === null) {
|
880
889
|
break;
|
@@ -914,13 +923,13 @@ class DataMap {
|
|
914
923
|
* Destroy instance.
|
915
924
|
*/
|
916
925
|
destroy() {
|
917
|
-
this.
|
926
|
+
this.hot = null;
|
918
927
|
this.metaManager = null;
|
919
928
|
this.dataSource = null;
|
920
929
|
this.duckSchema = null;
|
921
930
|
this.colToPropCache.length = 0;
|
922
931
|
this.propToColCache.clear();
|
923
|
-
this.propToColCache =
|
932
|
+
this.propToColCache = undefined;
|
924
933
|
}
|
925
934
|
}
|
926
935
|
export default DataMap;
|
package/dataMap/dataSource.js
CHANGED
@@ -2,11 +2,15 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.array.push.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
5
6
|
var _object = require("../helpers/object");
|
6
7
|
var _data = require("../helpers/data");
|
7
8
|
var _array = require("../helpers/array");
|
8
9
|
var _number = require("../helpers/number");
|
9
10
|
var _function = require("../helpers/function");
|
11
|
+
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; }
|
12
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
13
|
+
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); }
|
10
14
|
/**
|
11
15
|
* @class DataSource
|
12
16
|
* @private
|
@@ -19,22 +23,24 @@ class DataSource {
|
|
19
23
|
*
|
20
24
|
* @type {Handsontable}
|
21
25
|
*/
|
22
|
-
this
|
26
|
+
_defineProperty(this, "hot", void 0);
|
23
27
|
/**
|
24
28
|
* Data source.
|
25
29
|
*
|
26
30
|
* @type {Array}
|
27
31
|
*/
|
28
|
-
this
|
32
|
+
_defineProperty(this, "data", void 0);
|
29
33
|
/**
|
30
34
|
* Type of data source.
|
31
35
|
*
|
32
36
|
* @type {string}
|
33
37
|
* @default 'array'
|
34
38
|
*/
|
35
|
-
this
|
36
|
-
this
|
37
|
-
this
|
39
|
+
_defineProperty(this, "dataType", 'array');
|
40
|
+
_defineProperty(this, "colToProp", () => {});
|
41
|
+
_defineProperty(this, "propToCol", () => {});
|
42
|
+
this.hot = hotInstance;
|
43
|
+
this.data = dataSource;
|
38
44
|
}
|
39
45
|
|
40
46
|
/**
|
@@ -49,7 +55,7 @@ class DataSource {
|
|
49
55
|
if (this.hot.hasHook('modifyRowData')) {
|
50
56
|
modifyRowData = this.hot.runHooks('modifyRowData', rowIndex);
|
51
57
|
}
|
52
|
-
return modifyRowData !==
|
58
|
+
return modifyRowData !== undefined && !Number.isInteger(modifyRowData) ? modifyRowData : this.data[rowIndex];
|
53
59
|
}
|
54
60
|
|
55
61
|
/**
|
@@ -103,7 +109,7 @@ class DataSource {
|
|
103
109
|
*/
|
104
110
|
getAtRow(row, startColumn, endColumn) {
|
105
111
|
let toArray = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
|
106
|
-
const getAllProps = startColumn ===
|
112
|
+
const getAllProps = startColumn === undefined && endColumn === undefined;
|
107
113
|
let dataRow = null;
|
108
114
|
let newDataRow = null;
|
109
115
|
dataRow = this.modifyRowData(row);
|
@@ -247,7 +253,7 @@ class DataSource {
|
|
247
253
|
}
|
248
254
|
const result = [];
|
249
255
|
(0, _number.rangeEach)(startRow, endRow, currentRow => {
|
250
|
-
result.push(getAllProps ? this.getAtRow(currentRow,
|
256
|
+
result.push(getAllProps ? this.getAtRow(currentRow, undefined, undefined, toArray) : this.getAtRow(currentRow, startCol, endCol, toArray));
|
251
257
|
});
|
252
258
|
return result;
|
253
259
|
}
|