handsontable 0.0.0-next-bfb0e3a-20240403 → 0.0.0-next-5a535ed-20240403
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.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +17 -12
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +17 -12
- package/3rdparty/walkontable/src/calculator/viewportRows.js +15 -10
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +15 -10
- package/3rdparty/walkontable/src/cell/coords.js +17 -12
- package/3rdparty/walkontable/src/cell/coords.mjs +17 -12
- package/3rdparty/walkontable/src/cell/range.d.ts +1 -2
- package/3rdparty/walkontable/src/cell/range.js +28 -40
- package/3rdparty/walkontable/src/cell/range.mjs +28 -40
- package/3rdparty/walkontable/src/core/_base.js +1 -1
- package/3rdparty/walkontable/src/core/_base.mjs +1 -1
- package/3rdparty/walkontable/src/event.js +104 -72
- package/3rdparty/walkontable/src/event.mjs +104 -72
- package/3rdparty/walkontable/src/overlays.js +1 -1
- package/3rdparty/walkontable/src/overlays.mjs +1 -1
- package/3rdparty/walkontable/src/scroll.js +17 -15
- package/3rdparty/walkontable/src/scroll.mjs +17 -15
- package/3rdparty/walkontable/src/selection/manager.js +69 -48
- package/3rdparty/walkontable/src/selection/manager.mjs +69 -48
- package/3rdparty/walkontable/src/selection/scanner.js +42 -33
- package/3rdparty/walkontable/src/selection/scanner.mjs +42 -33
- package/3rdparty/walkontable/src/utils/columnStretching.js +44 -27
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +44 -27
- package/3rdparty/walkontable/src/utils/orderView/view.js +1 -1
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +1 -1
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/viewportScroll/index.js +1 -4
- package/core/viewportScroll/index.mjs +1 -4
- package/core.d.ts +3 -4
- package/core.js +22 -77
- package/core.mjs +22 -77
- package/dataMap/dataSource.js +1 -1
- package/dataMap/dataSource.mjs +1 -1
- package/dataMap/metaManager/metaLayers/cellMeta.js +1 -1
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +1 -1
- package/dataMap/metaManager/metaSchema.js +1 -1
- package/dataMap/metaManager/metaSchema.mjs +1 -1
- package/dataMap/replaceData.js +1 -1
- package/dataMap/replaceData.mjs +1 -1
- package/dist/handsontable.css +4 -4
- package/dist/handsontable.full.css +4 -4
- package/dist/handsontable.full.js +9117 -8969
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +292 -292
- package/dist/handsontable.js +6569 -6874
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +25 -25
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/ar-AR.min.js +1 -1
- package/dist/languages/cs-CZ.min.js +1 -1
- package/dist/languages/de-CH.min.js +1 -1
- package/dist/languages/de-DE.min.js +1 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/es-MX.min.js +1 -1
- package/dist/languages/fr-FR.min.js +1 -1
- package/dist/languages/hr-HR.min.js +1 -1
- package/dist/languages/it-IT.min.js +1 -1
- package/dist/languages/ja-JP.min.js +1 -1
- package/dist/languages/ko-KR.min.js +1 -1
- package/dist/languages/lv-LV.min.js +1 -1
- package/dist/languages/nb-NO.min.js +1 -1
- package/dist/languages/nl-NL.min.js +1 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/dist/languages/pt-BR.min.js +1 -1
- package/dist/languages/ru-RU.min.js +1 -1
- package/dist/languages/sr-SP.min.js +1 -1
- package/dist/languages/zh-CN.min.js +1 -1
- package/dist/languages/zh-TW.min.js +1 -1
- package/editorManager.js +23 -25
- package/editorManager.mjs +23 -25
- package/editors/autocompleteEditor/autocompleteEditor.js +10 -6
- package/editors/autocompleteEditor/autocompleteEditor.mjs +10 -6
- package/editors/selectEditor/selectEditor.js +19 -20
- package/editors/selectEditor/selectEditor.mjs +19 -20
- package/eventManager.js +1 -1
- package/eventManager.mjs +1 -1
- package/focusManager.js +82 -64
- package/focusManager.mjs +82 -64
- package/helpers/dom/element.js +1 -1
- package/helpers/dom/element.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +2 -2
- package/helpers/object.mjs +2 -2
- package/index.d.ts +0 -10
- package/package.json +2 -7
- package/pluginHooks.d.ts +3 -4
- package/pluginHooks.js +38 -99
- package/pluginHooks.mjs +38 -99
- package/plugins/autoColumnSize/autoColumnSize.js +65 -49
- package/plugins/autoColumnSize/autoColumnSize.mjs +65 -49
- package/plugins/autoRowSize/autoRowSize.js +34 -28
- package/plugins/autoRowSize/autoRowSize.mjs +34 -28
- package/plugins/autofill/autofill.js +38 -30
- package/plugins/autofill/autofill.mjs +38 -30
- package/plugins/base/base.js +17 -12
- package/plugins/base/base.mjs +17 -12
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +5 -5
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +5 -5
- package/plugins/collapsibleColumns/collapsibleColumns.js +50 -59
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +50 -59
- package/plugins/columnSorting/columnSorting.js +45 -49
- package/plugins/columnSorting/columnSorting.mjs +45 -49
- package/plugins/columnSummary/columnSummary.js +26 -22
- package/plugins/columnSummary/columnSummary.mjs +26 -22
- package/plugins/comments/comments.js +158 -116
- package/plugins/comments/comments.mjs +158 -116
- package/plugins/contextMenu/contextMenu.js +26 -20
- package/plugins/contextMenu/contextMenu.mjs +26 -20
- package/plugins/contextMenu/itemsFactory.js +1 -1
- package/plugins/contextMenu/itemsFactory.mjs +1 -1
- package/plugins/contextMenu/menu/defaultShortcutsList.js +10 -26
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +10 -26
- package/plugins/contextMenu/menu/menu.js +21 -13
- package/plugins/contextMenu/menu/menu.mjs +21 -13
- package/plugins/contextMenu/menu/positioner.js +58 -41
- package/plugins/contextMenu/menu/positioner.mjs +58 -41
- package/plugins/copyPaste/copyPaste.js +157 -116
- package/plugins/copyPaste/copyPaste.mjs +157 -116
- package/plugins/copyPaste/copyableRanges.js +66 -43
- package/plugins/copyPaste/copyableRanges.mjs +66 -43
- package/plugins/customBorders/customBorders.js +13 -11
- package/plugins/customBorders/customBorders.mjs +13 -11
- package/plugins/dragToScroll/dragToScroll.js +6 -6
- package/plugins/dragToScroll/dragToScroll.mjs +6 -6
- package/plugins/dropdownMenu/dropdownMenu.js +106 -80
- package/plugins/dropdownMenu/dropdownMenu.mjs +106 -80
- package/plugins/exportFile/dataProvider.js +1 -1
- package/plugins/exportFile/dataProvider.mjs +1 -1
- package/plugins/filters/component/actionBar.js +9 -9
- package/plugins/filters/component/actionBar.mjs +8 -8
- package/plugins/filters/component/condition.js +15 -13
- package/plugins/filters/component/condition.mjs +15 -13
- package/plugins/filters/component/operators.js +6 -6
- package/plugins/filters/component/operators.mjs +6 -6
- package/plugins/filters/component/value.js +28 -24
- package/plugins/filters/component/value.mjs +28 -24
- package/plugins/filters/conditionUpdateObserver.js +24 -22
- package/plugins/filters/conditionUpdateObserver.mjs +24 -22
- package/plugins/filters/dataFilter.js +1 -1
- package/plugins/filters/dataFilter.mjs +1 -1
- package/plugins/filters/filters.js +95 -81
- package/plugins/filters/filters.mjs +95 -81
- package/plugins/filters/ui/input.js +19 -13
- package/plugins/filters/ui/input.mjs +19 -13
- package/plugins/filters/ui/link.js +13 -8
- package/plugins/filters/ui/link.mjs +13 -8
- package/plugins/filters/ui/multipleSelect.js +112 -85
- package/plugins/filters/ui/multipleSelect.mjs +112 -85
- package/plugins/filters/ui/radioInput.js +20 -12
- package/plugins/filters/ui/radioInput.mjs +20 -12
- package/plugins/filters/ui/select.js +72 -50
- package/plugins/filters/ui/select.mjs +71 -49
- package/plugins/formulas/formulas.js +326 -268
- package/plugins/formulas/formulas.mjs +327 -269
- package/plugins/formulas/indexSyncer/axisSyncer.js +61 -38
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +61 -38
- package/plugins/formulas/indexSyncer/index.js +48 -25
- package/plugins/formulas/indexSyncer/index.mjs +48 -25
- package/plugins/hiddenColumns/hiddenColumns.js +83 -64
- package/plugins/hiddenColumns/hiddenColumns.mjs +83 -64
- package/plugins/hiddenRows/hiddenRows.js +82 -63
- package/plugins/hiddenRows/hiddenRows.mjs +82 -63
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +32 -24
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +33 -25
- package/plugins/manualColumnMove/manualColumnMove.js +170 -126
- package/plugins/manualColumnMove/manualColumnMove.mjs +170 -126
- package/plugins/manualColumnResize/manualColumnResize.js +230 -169
- package/plugins/manualColumnResize/manualColumnResize.mjs +230 -169
- package/plugins/manualRowMove/manualRowMove.js +128 -99
- package/plugins/manualRowMove/manualRowMove.mjs +128 -99
- package/plugins/manualRowResize/manualRowResize.js +209 -150
- package/plugins/manualRowResize/manualRowResize.mjs +209 -150
- package/plugins/mergeCells/calculations/selection.js +71 -2
- package/plugins/mergeCells/calculations/selection.mjs +71 -2
- package/plugins/mergeCells/cellsCollection.js +1 -117
- package/plugins/mergeCells/cellsCollection.mjs +1 -117
- package/plugins/mergeCells/contextMenuItem/toggleMerge.js +1 -11
- package/plugins/mergeCells/contextMenuItem/toggleMerge.mjs +1 -11
- package/plugins/mergeCells/mergeCells.js +397 -499
- package/plugins/mergeCells/mergeCells.mjs +397 -499
- package/plugins/multiColumnSorting/multiColumnSorting.js +2 -8
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +2 -8
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +1 -1
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +1 -1
- package/plugins/nestedHeaders/nestedHeaders.js +253 -205
- package/plugins/nestedHeaders/nestedHeaders.mjs +254 -206
- package/plugins/nestedHeaders/stateManager/headersTree.js +32 -21
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +32 -21
- package/plugins/nestedHeaders/stateManager/index.js +41 -30
- package/plugins/nestedHeaders/stateManager/index.mjs +41 -30
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +30 -19
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +30 -19
- package/plugins/nestedRows/data/dataManager.js +1 -1
- package/plugins/nestedRows/data/dataManager.mjs +1 -1
- package/plugins/nestedRows/nestedRows.js +182 -151
- package/plugins/nestedRows/nestedRows.mjs +183 -152
- package/plugins/nestedRows/ui/contextMenu.js +15 -11
- package/plugins/nestedRows/ui/contextMenu.mjs +14 -10
- package/plugins/nestedRows/utils/rowMoveController.js +1 -1
- package/plugins/nestedRows/utils/rowMoveController.mjs +1 -1
- package/plugins/persistentState/storage.js +2 -2
- package/plugins/persistentState/storage.mjs +2 -2
- package/plugins/search/search.js +7 -7
- package/plugins/search/search.mjs +7 -7
- package/plugins/touchScroll/touchScroll.js +19 -15
- package/plugins/touchScroll/touchScroll.mjs +20 -16
- package/plugins/trimRows/trimRows.js +6 -6
- package/plugins/trimRows/trimRows.mjs +6 -6
- package/renderers/checkboxRenderer/checkboxRenderer.js +5 -8
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +5 -8
- package/selection/highlight/highlight.js +14 -14
- package/selection/highlight/highlight.mjs +13 -13
- package/selection/highlight/visualSelection.js +0 -2
- package/selection/highlight/visualSelection.mjs +0 -2
- package/selection/selection.js +67 -225
- package/selection/selection.mjs +66 -224
- package/selection/transformation.js +118 -149
- package/selection/transformation.mjs +118 -149
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -2
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -2
- package/shortcutContexts/commands/editor/open.js +3 -18
- package/shortcutContexts/commands/editor/open.mjs +3 -18
- package/shortcutContexts/commands/extendCellsSelection/down.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +3 -9
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +3 -9
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +3 -10
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +3 -10
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +1 -3
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.js +1 -1
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +1 -1
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +1 -6
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +1 -6
- package/shortcutContexts/grid.js +3 -9
- package/shortcutContexts/grid.mjs +3 -9
- package/shortcuts/context.js +1 -2
- package/shortcuts/context.mjs +1 -2
- package/tableView.js +78 -52
- package/tableView.mjs +78 -52
- package/translations/changesObservable/observable.js +38 -21
- package/translations/changesObservable/observable.mjs +38 -21
- package/translations/changesObservable/observer.js +12 -7
- package/translations/changesObservable/observer.mjs +11 -6
- package/translations/mapCollections/aggregatedCollection.js +1 -1
- package/translations/mapCollections/aggregatedCollection.mjs +1 -1
- package/translations/maps/indexMap.js +1 -1
- package/translations/maps/indexMap.mjs +1 -1
- package/utils/dataStructures/linkedList.js +1 -6
- package/utils/dataStructures/linkedList.mjs +1 -6
- package/utils/dataStructures/tree.js +1 -1
- package/utils/dataStructures/tree.mjs +1 -1
- package/utils/interval.js +44 -26
- package/utils/interval.mjs +44 -26
- package/core/viewportScroll/scrollStrategies/focusScroll.js +0 -15
- package/core/viewportScroll/scrollStrategies/focusScroll.mjs +0 -11
- package/i18n/languages/ar-AR.d.ts +0 -5
- package/i18n/languages/cs-CZ.d.ts +0 -5
- package/i18n/languages/hr-HR.d.ts +0 -5
- package/i18n/languages/sr-SP.d.ts +0 -5
- package/plugins/mergeCells/focusOrder.js +0 -305
- package/plugins/mergeCells/focusOrder.mjs +0 -300
@@ -6,9 +6,12 @@ var _element = require("../../../../helpers/dom/element");
|
|
6
6
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
7
7
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
8
8
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
9
|
-
function
|
10
|
-
function
|
11
|
-
function
|
9
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
10
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
11
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
12
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
13
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
14
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } } /* eslint-disable no-continue */
|
12
15
|
/**
|
13
16
|
* Selection scanner module scans the rendered cells and headers and if it finds an intersection with
|
14
17
|
* the coordinates of the Selection class (highlight) it returns the DOM elements.
|
@@ -17,7 +20,7 @@ function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.h
|
|
17
20
|
*/
|
18
21
|
var _selection = /*#__PURE__*/new WeakMap();
|
19
22
|
var _activeOverlaysWot = /*#__PURE__*/new WeakMap();
|
20
|
-
var
|
23
|
+
var _scanCellsRange = /*#__PURE__*/new WeakSet();
|
21
24
|
class SelectionScanner {
|
22
25
|
constructor() {
|
23
26
|
/**
|
@@ -25,19 +28,25 @@ class SelectionScanner {
|
|
25
28
|
*
|
26
29
|
* @param {function(number, number): void} callback The callback function to trigger.
|
27
30
|
*/
|
28
|
-
_classPrivateMethodInitSpec(this,
|
31
|
+
_classPrivateMethodInitSpec(this, _scanCellsRange);
|
29
32
|
/**
|
30
33
|
* Active Selection instance to process.
|
31
34
|
*
|
32
35
|
* @type {Selection}
|
33
36
|
*/
|
34
|
-
_classPrivateFieldInitSpec(this, _selection,
|
37
|
+
_classPrivateFieldInitSpec(this, _selection, {
|
38
|
+
writable: true,
|
39
|
+
value: void 0
|
40
|
+
});
|
35
41
|
/**
|
36
42
|
* The Walkontable instance that the scans depends on.
|
37
43
|
*
|
38
44
|
* @type {Walkontable}
|
39
45
|
*/
|
40
|
-
_classPrivateFieldInitSpec(this, _activeOverlaysWot,
|
46
|
+
_classPrivateFieldInitSpec(this, _activeOverlaysWot, {
|
47
|
+
writable: true,
|
48
|
+
value: void 0
|
49
|
+
});
|
41
50
|
}
|
42
51
|
/**
|
43
52
|
* Sets the Walkontable instance that will be taking into account while scanning the table.
|
@@ -46,7 +55,7 @@ class SelectionScanner {
|
|
46
55
|
* @returns {SelectionScanner}
|
47
56
|
*/
|
48
57
|
setActiveOverlay(activeOverlaysWot) {
|
49
|
-
_classPrivateFieldSet(
|
58
|
+
_classPrivateFieldSet(this, _activeOverlaysWot, activeOverlaysWot);
|
50
59
|
return this;
|
51
60
|
}
|
52
61
|
|
@@ -57,7 +66,7 @@ class SelectionScanner {
|
|
57
66
|
* @returns {SelectionScanner}
|
58
67
|
*/
|
59
68
|
setActiveSelection(selection) {
|
60
|
-
_classPrivateFieldSet(
|
69
|
+
_classPrivateFieldSet(this, _selection, selection);
|
61
70
|
return this;
|
62
71
|
}
|
63
72
|
|
@@ -68,7 +77,7 @@ class SelectionScanner {
|
|
68
77
|
* @returns {HTMLTableElement[]}
|
69
78
|
*/
|
70
79
|
scan() {
|
71
|
-
const selectionType = _classPrivateFieldGet(
|
80
|
+
const selectionType = _classPrivateFieldGet(this, _selection).settings.selectionType;
|
72
81
|
const elements = new Set();
|
73
82
|
|
74
83
|
// TODO(improvement): use heuristics from coords to detect what type of scan
|
@@ -104,10 +113,10 @@ class SelectionScanner {
|
|
104
113
|
* @param {function(HTMLTableElement): void} callback The callback function to trigger.
|
105
114
|
*/
|
106
115
|
scanColumnsInHeadersRange(callback) {
|
107
|
-
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(
|
116
|
+
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(this, _selection).getCorners();
|
108
117
|
const {
|
109
118
|
wtTable
|
110
|
-
} = _classPrivateFieldGet(
|
119
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
111
120
|
const renderedColumnsCount = wtTable.getRenderedColumnsCount();
|
112
121
|
const columnHeadersCount = wtTable.getColumnHeadersCount();
|
113
122
|
let cursor = 0;
|
@@ -122,8 +131,8 @@ class SelectionScanner {
|
|
122
131
|
}
|
123
132
|
const positiveBasedHeaderLevel = headerLevel + columnHeadersCount;
|
124
133
|
let TH = wtTable.getColumnHeader(sourceColumn, positiveBasedHeaderLevel);
|
125
|
-
const newSourceCol = _classPrivateFieldGet(
|
126
|
-
selectionType: _classPrivateFieldGet(
|
134
|
+
const newSourceCol = _classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onBeforeHighlightingColumnHeader', sourceColumn, positiveBasedHeaderLevel, {
|
135
|
+
selectionType: _classPrivateFieldGet(this, _selection).settings.selectionType,
|
127
136
|
columnCursor: cursor,
|
128
137
|
selectionWidth: bottomColumn - topColumn + 1
|
129
138
|
});
|
@@ -146,10 +155,10 @@ class SelectionScanner {
|
|
146
155
|
* @param {function(HTMLTableElement): void} callback The callback function to trigger.
|
147
156
|
*/
|
148
157
|
scanRowsInHeadersRange(callback) {
|
149
|
-
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(
|
158
|
+
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(this, _selection).getCorners();
|
150
159
|
const {
|
151
160
|
wtTable
|
152
|
-
} = _classPrivateFieldGet(
|
161
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
153
162
|
const renderedRowsCount = wtTable.getRenderedRowsCount();
|
154
163
|
const rowHeadersCount = wtTable.getRowHeadersCount();
|
155
164
|
let cursor = 0;
|
@@ -164,8 +173,8 @@ class SelectionScanner {
|
|
164
173
|
}
|
165
174
|
const positiveBasedHeaderLevel = headerLevel + rowHeadersCount;
|
166
175
|
let TH = wtTable.getRowHeader(sourceRow, positiveBasedHeaderLevel);
|
167
|
-
const newSourceRow = _classPrivateFieldGet(
|
168
|
-
selectionType: _classPrivateFieldGet(
|
176
|
+
const newSourceRow = _classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onBeforeHighlightingRowHeader', sourceRow, positiveBasedHeaderLevel, {
|
177
|
+
selectionType: _classPrivateFieldGet(this, _selection).settings.selectionType,
|
169
178
|
rowCursor: cursor,
|
170
179
|
selectionHeight: bottomRow - topRow + 1
|
171
180
|
});
|
@@ -188,16 +197,16 @@ class SelectionScanner {
|
|
188
197
|
* @param {function(HTMLTableElement): void} callback The callback function to trigger.
|
189
198
|
*/
|
190
199
|
scanCellsRange(callback) {
|
191
|
-
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(
|
200
|
+
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(this, _selection).getCorners();
|
192
201
|
const {
|
193
202
|
wtTable
|
194
|
-
} = _classPrivateFieldGet(
|
195
|
-
|
203
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
204
|
+
_classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, (sourceRow, sourceColumn) => {
|
196
205
|
if (sourceRow >= topRow && sourceRow <= bottomRow && sourceColumn >= topColumn && sourceColumn <= bottomColumn) {
|
197
|
-
const cell = wtTable.getCell(_classPrivateFieldGet(
|
206
|
+
const cell = wtTable.getCell(_classPrivateFieldGet(this, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
|
198
207
|
|
199
208
|
// support for old API
|
200
|
-
const additionalSelectionClass = _classPrivateFieldGet(
|
209
|
+
const additionalSelectionClass = _classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onAfterDrawSelection', sourceRow, sourceColumn, _classPrivateFieldGet(this, _selection).settings.layerLevel);
|
201
210
|
if (typeof additionalSelectionClass === 'string') {
|
202
211
|
(0, _element.addClass)(cell, additionalSelectionClass);
|
203
212
|
}
|
@@ -214,13 +223,13 @@ class SelectionScanner {
|
|
214
223
|
*/
|
215
224
|
scanRowsInCellsRange(callback) {
|
216
225
|
// eslint-disable-next-line comma-spacing
|
217
|
-
const [topRow,, bottomRow] = _classPrivateFieldGet(
|
226
|
+
const [topRow,, bottomRow] = _classPrivateFieldGet(this, _selection).getCorners();
|
218
227
|
const {
|
219
228
|
wtTable
|
220
|
-
} = _classPrivateFieldGet(
|
221
|
-
|
229
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
230
|
+
_classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, (sourceRow, sourceColumn) => {
|
222
231
|
if (sourceRow >= topRow && sourceRow <= bottomRow) {
|
223
|
-
const cell = wtTable.getCell(_classPrivateFieldGet(
|
232
|
+
const cell = wtTable.getCell(_classPrivateFieldGet(this, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
|
224
233
|
callback(cell);
|
225
234
|
}
|
226
235
|
});
|
@@ -233,23 +242,23 @@ class SelectionScanner {
|
|
233
242
|
* @param {function(HTMLTableElement): void} callback The callback function to trigger.
|
234
243
|
*/
|
235
244
|
scanColumnsInCellsRange(callback) {
|
236
|
-
const [, topColumn,, bottomColumn] = _classPrivateFieldGet(
|
245
|
+
const [, topColumn,, bottomColumn] = _classPrivateFieldGet(this, _selection).getCorners();
|
237
246
|
const {
|
238
247
|
wtTable
|
239
|
-
} = _classPrivateFieldGet(
|
240
|
-
|
248
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
249
|
+
_classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, (sourceRow, sourceColumn) => {
|
241
250
|
if (sourceColumn >= topColumn && sourceColumn <= bottomColumn) {
|
242
|
-
const cell = wtTable.getCell(_classPrivateFieldGet(
|
251
|
+
const cell = wtTable.getCell(_classPrivateFieldGet(this, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
|
243
252
|
callback(cell);
|
244
253
|
}
|
245
254
|
});
|
246
255
|
}
|
247
256
|
}
|
248
257
|
exports.SelectionScanner = SelectionScanner;
|
249
|
-
function
|
258
|
+
function _scanCellsRange2(callback) {
|
250
259
|
const {
|
251
260
|
wtTable
|
252
|
-
} = _classPrivateFieldGet(
|
261
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
253
262
|
const renderedRowsCount = wtTable.getRenderedRowsCount();
|
254
263
|
const renderedColumnsCount = wtTable.getRenderedColumnsCount();
|
255
264
|
for (let row = 0; row < renderedRowsCount; row += 1) {
|
@@ -2,9 +2,12 @@ import "core-js/modules/es.error.cause.js";
|
|
2
2
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
3
3
|
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
4
4
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
5
|
-
function
|
6
|
-
function
|
7
|
-
function
|
5
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
6
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
7
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
8
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
9
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
10
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
8
11
|
/* eslint-disable no-continue */
|
9
12
|
import { addClass } from "../../../../helpers/dom/element.mjs";
|
10
13
|
/**
|
@@ -15,7 +18,7 @@ import { addClass } from "../../../../helpers/dom/element.mjs";
|
|
15
18
|
*/
|
16
19
|
var _selection = /*#__PURE__*/new WeakMap();
|
17
20
|
var _activeOverlaysWot = /*#__PURE__*/new WeakMap();
|
18
|
-
var
|
21
|
+
var _scanCellsRange = /*#__PURE__*/new WeakSet();
|
19
22
|
export class SelectionScanner {
|
20
23
|
constructor() {
|
21
24
|
/**
|
@@ -23,19 +26,25 @@ export class SelectionScanner {
|
|
23
26
|
*
|
24
27
|
* @param {function(number, number): void} callback The callback function to trigger.
|
25
28
|
*/
|
26
|
-
_classPrivateMethodInitSpec(this,
|
29
|
+
_classPrivateMethodInitSpec(this, _scanCellsRange);
|
27
30
|
/**
|
28
31
|
* Active Selection instance to process.
|
29
32
|
*
|
30
33
|
* @type {Selection}
|
31
34
|
*/
|
32
|
-
_classPrivateFieldInitSpec(this, _selection,
|
35
|
+
_classPrivateFieldInitSpec(this, _selection, {
|
36
|
+
writable: true,
|
37
|
+
value: void 0
|
38
|
+
});
|
33
39
|
/**
|
34
40
|
* The Walkontable instance that the scans depends on.
|
35
41
|
*
|
36
42
|
* @type {Walkontable}
|
37
43
|
*/
|
38
|
-
_classPrivateFieldInitSpec(this, _activeOverlaysWot,
|
44
|
+
_classPrivateFieldInitSpec(this, _activeOverlaysWot, {
|
45
|
+
writable: true,
|
46
|
+
value: void 0
|
47
|
+
});
|
39
48
|
}
|
40
49
|
/**
|
41
50
|
* Sets the Walkontable instance that will be taking into account while scanning the table.
|
@@ -44,7 +53,7 @@ export class SelectionScanner {
|
|
44
53
|
* @returns {SelectionScanner}
|
45
54
|
*/
|
46
55
|
setActiveOverlay(activeOverlaysWot) {
|
47
|
-
_classPrivateFieldSet(
|
56
|
+
_classPrivateFieldSet(this, _activeOverlaysWot, activeOverlaysWot);
|
48
57
|
return this;
|
49
58
|
}
|
50
59
|
|
@@ -55,7 +64,7 @@ export class SelectionScanner {
|
|
55
64
|
* @returns {SelectionScanner}
|
56
65
|
*/
|
57
66
|
setActiveSelection(selection) {
|
58
|
-
_classPrivateFieldSet(
|
67
|
+
_classPrivateFieldSet(this, _selection, selection);
|
59
68
|
return this;
|
60
69
|
}
|
61
70
|
|
@@ -66,7 +75,7 @@ export class SelectionScanner {
|
|
66
75
|
* @returns {HTMLTableElement[]}
|
67
76
|
*/
|
68
77
|
scan() {
|
69
|
-
const selectionType = _classPrivateFieldGet(
|
78
|
+
const selectionType = _classPrivateFieldGet(this, _selection).settings.selectionType;
|
70
79
|
const elements = new Set();
|
71
80
|
|
72
81
|
// TODO(improvement): use heuristics from coords to detect what type of scan
|
@@ -102,10 +111,10 @@ export class SelectionScanner {
|
|
102
111
|
* @param {function(HTMLTableElement): void} callback The callback function to trigger.
|
103
112
|
*/
|
104
113
|
scanColumnsInHeadersRange(callback) {
|
105
|
-
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(
|
114
|
+
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(this, _selection).getCorners();
|
106
115
|
const {
|
107
116
|
wtTable
|
108
|
-
} = _classPrivateFieldGet(
|
117
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
109
118
|
const renderedColumnsCount = wtTable.getRenderedColumnsCount();
|
110
119
|
const columnHeadersCount = wtTable.getColumnHeadersCount();
|
111
120
|
let cursor = 0;
|
@@ -120,8 +129,8 @@ export class SelectionScanner {
|
|
120
129
|
}
|
121
130
|
const positiveBasedHeaderLevel = headerLevel + columnHeadersCount;
|
122
131
|
let TH = wtTable.getColumnHeader(sourceColumn, positiveBasedHeaderLevel);
|
123
|
-
const newSourceCol = _classPrivateFieldGet(
|
124
|
-
selectionType: _classPrivateFieldGet(
|
132
|
+
const newSourceCol = _classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onBeforeHighlightingColumnHeader', sourceColumn, positiveBasedHeaderLevel, {
|
133
|
+
selectionType: _classPrivateFieldGet(this, _selection).settings.selectionType,
|
125
134
|
columnCursor: cursor,
|
126
135
|
selectionWidth: bottomColumn - topColumn + 1
|
127
136
|
});
|
@@ -144,10 +153,10 @@ export class SelectionScanner {
|
|
144
153
|
* @param {function(HTMLTableElement): void} callback The callback function to trigger.
|
145
154
|
*/
|
146
155
|
scanRowsInHeadersRange(callback) {
|
147
|
-
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(
|
156
|
+
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(this, _selection).getCorners();
|
148
157
|
const {
|
149
158
|
wtTable
|
150
|
-
} = _classPrivateFieldGet(
|
159
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
151
160
|
const renderedRowsCount = wtTable.getRenderedRowsCount();
|
152
161
|
const rowHeadersCount = wtTable.getRowHeadersCount();
|
153
162
|
let cursor = 0;
|
@@ -162,8 +171,8 @@ export class SelectionScanner {
|
|
162
171
|
}
|
163
172
|
const positiveBasedHeaderLevel = headerLevel + rowHeadersCount;
|
164
173
|
let TH = wtTable.getRowHeader(sourceRow, positiveBasedHeaderLevel);
|
165
|
-
const newSourceRow = _classPrivateFieldGet(
|
166
|
-
selectionType: _classPrivateFieldGet(
|
174
|
+
const newSourceRow = _classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onBeforeHighlightingRowHeader', sourceRow, positiveBasedHeaderLevel, {
|
175
|
+
selectionType: _classPrivateFieldGet(this, _selection).settings.selectionType,
|
167
176
|
rowCursor: cursor,
|
168
177
|
selectionHeight: bottomRow - topRow + 1
|
169
178
|
});
|
@@ -186,16 +195,16 @@ export class SelectionScanner {
|
|
186
195
|
* @param {function(HTMLTableElement): void} callback The callback function to trigger.
|
187
196
|
*/
|
188
197
|
scanCellsRange(callback) {
|
189
|
-
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(
|
198
|
+
const [topRow, topColumn, bottomRow, bottomColumn] = _classPrivateFieldGet(this, _selection).getCorners();
|
190
199
|
const {
|
191
200
|
wtTable
|
192
|
-
} = _classPrivateFieldGet(
|
193
|
-
|
201
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
202
|
+
_classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, (sourceRow, sourceColumn) => {
|
194
203
|
if (sourceRow >= topRow && sourceRow <= bottomRow && sourceColumn >= topColumn && sourceColumn <= bottomColumn) {
|
195
|
-
const cell = wtTable.getCell(_classPrivateFieldGet(
|
204
|
+
const cell = wtTable.getCell(_classPrivateFieldGet(this, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
|
196
205
|
|
197
206
|
// support for old API
|
198
|
-
const additionalSelectionClass = _classPrivateFieldGet(
|
207
|
+
const additionalSelectionClass = _classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onAfterDrawSelection', sourceRow, sourceColumn, _classPrivateFieldGet(this, _selection).settings.layerLevel);
|
199
208
|
if (typeof additionalSelectionClass === 'string') {
|
200
209
|
addClass(cell, additionalSelectionClass);
|
201
210
|
}
|
@@ -212,13 +221,13 @@ export class SelectionScanner {
|
|
212
221
|
*/
|
213
222
|
scanRowsInCellsRange(callback) {
|
214
223
|
// eslint-disable-next-line comma-spacing
|
215
|
-
const [topRow,, bottomRow] = _classPrivateFieldGet(
|
224
|
+
const [topRow,, bottomRow] = _classPrivateFieldGet(this, _selection).getCorners();
|
216
225
|
const {
|
217
226
|
wtTable
|
218
|
-
} = _classPrivateFieldGet(
|
219
|
-
|
227
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
228
|
+
_classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, (sourceRow, sourceColumn) => {
|
220
229
|
if (sourceRow >= topRow && sourceRow <= bottomRow) {
|
221
|
-
const cell = wtTable.getCell(_classPrivateFieldGet(
|
230
|
+
const cell = wtTable.getCell(_classPrivateFieldGet(this, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
|
222
231
|
callback(cell);
|
223
232
|
}
|
224
233
|
});
|
@@ -231,22 +240,22 @@ export class SelectionScanner {
|
|
231
240
|
* @param {function(HTMLTableElement): void} callback The callback function to trigger.
|
232
241
|
*/
|
233
242
|
scanColumnsInCellsRange(callback) {
|
234
|
-
const [, topColumn,, bottomColumn] = _classPrivateFieldGet(
|
243
|
+
const [, topColumn,, bottomColumn] = _classPrivateFieldGet(this, _selection).getCorners();
|
235
244
|
const {
|
236
245
|
wtTable
|
237
|
-
} = _classPrivateFieldGet(
|
238
|
-
|
246
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
247
|
+
_classPrivateMethodGet(this, _scanCellsRange, _scanCellsRange2).call(this, (sourceRow, sourceColumn) => {
|
239
248
|
if (sourceColumn >= topColumn && sourceColumn <= bottomColumn) {
|
240
|
-
const cell = wtTable.getCell(_classPrivateFieldGet(
|
249
|
+
const cell = wtTable.getCell(_classPrivateFieldGet(this, _activeOverlaysWot).createCellCoords(sourceRow, sourceColumn));
|
241
250
|
callback(cell);
|
242
251
|
}
|
243
252
|
});
|
244
253
|
}
|
245
254
|
}
|
246
|
-
function
|
255
|
+
function _scanCellsRange2(callback) {
|
247
256
|
const {
|
248
257
|
wtTable
|
249
|
-
} = _classPrivateFieldGet(
|
258
|
+
} = _classPrivateFieldGet(this, _activeOverlaysWot);
|
250
259
|
const renderedRowsCount = wtTable.getRenderedRowsCount();
|
251
260
|
const renderedColumnsCount = wtTable.getRenderedColumnsCount();
|
252
261
|
for (let row = 0; row < renderedRowsCount; row += 1) {
|
@@ -7,9 +7,11 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
7
7
|
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; }
|
8
8
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
9
9
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
10
|
-
function _classPrivateFieldGet(
|
11
|
-
function
|
12
|
-
function
|
10
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
11
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
12
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
13
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
14
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
13
15
|
var _totalTargetWidth = /*#__PURE__*/new WeakMap();
|
14
16
|
var _totalColumns = /*#__PURE__*/new WeakMap();
|
15
17
|
var _stretchingColumnWidthFn = /*#__PURE__*/new WeakMap();
|
@@ -61,7 +63,10 @@ class ColumnStretching {
|
|
61
63
|
/**
|
62
64
|
* @type {number}
|
63
65
|
*/
|
64
|
-
_classPrivateFieldInitSpec(this, _totalTargetWidth,
|
66
|
+
_classPrivateFieldInitSpec(this, _totalTargetWidth, {
|
67
|
+
writable: true,
|
68
|
+
value: 0
|
69
|
+
});
|
65
70
|
/**
|
66
71
|
* @type {boolean}
|
67
72
|
*/
|
@@ -71,29 +76,41 @@ class ColumnStretching {
|
|
71
76
|
*
|
72
77
|
* @type {function(): number}
|
73
78
|
*/
|
74
|
-
_classPrivateFieldInitSpec(this, _totalColumns,
|
79
|
+
_classPrivateFieldInitSpec(this, _totalColumns, {
|
80
|
+
writable: true,
|
81
|
+
value: () => 0
|
82
|
+
});
|
75
83
|
/**
|
76
84
|
* Function that returns the width of the stretched column at a given index (in px).
|
77
85
|
*
|
78
86
|
* @type {function(): number}
|
79
87
|
*/
|
80
|
-
_classPrivateFieldInitSpec(this, _stretchingColumnWidthFn,
|
88
|
+
_classPrivateFieldInitSpec(this, _stretchingColumnWidthFn, {
|
89
|
+
writable: true,
|
90
|
+
value: width => width
|
91
|
+
});
|
81
92
|
/**
|
82
93
|
* Function that returns the width of the column at a given index (in px).
|
83
94
|
*
|
84
95
|
* @type {function(): number}
|
85
96
|
*/
|
86
|
-
_classPrivateFieldInitSpec(this, _columnWidthFn,
|
97
|
+
_classPrivateFieldInitSpec(this, _columnWidthFn, {
|
98
|
+
writable: true,
|
99
|
+
value: width => width
|
100
|
+
});
|
87
101
|
/**
|
88
102
|
* Stretch mode.
|
89
103
|
*
|
90
104
|
* @type {function(): 'all' | 'last' | 'none'}
|
91
105
|
*/
|
92
|
-
_classPrivateFieldInitSpec(this, _stretchMode,
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
_classPrivateFieldSet(
|
106
|
+
_classPrivateFieldInitSpec(this, _stretchMode, {
|
107
|
+
writable: true,
|
108
|
+
value: () => 'none'
|
109
|
+
});
|
110
|
+
_classPrivateFieldSet(this, _totalColumns, totalColumns);
|
111
|
+
_classPrivateFieldSet(this, _stretchMode, stretchMode);
|
112
|
+
_classPrivateFieldSet(this, _stretchingColumnWidthFn, stretchingColumnWidthFn !== null && stretchingColumnWidthFn !== void 0 ? stretchingColumnWidthFn : _classPrivateFieldGet(this, _stretchingColumnWidthFn));
|
113
|
+
_classPrivateFieldSet(this, _columnWidthFn, columnWidthFn !== null && columnWidthFn !== void 0 ? columnWidthFn : _classPrivateFieldGet(this, _columnWidthFn));
|
97
114
|
}
|
98
115
|
|
99
116
|
/**
|
@@ -102,14 +119,14 @@ class ColumnStretching {
|
|
102
119
|
* @param {number} totalWidth The total width of the table.
|
103
120
|
*/
|
104
121
|
refreshStretching(totalWidth) {
|
105
|
-
if (_classPrivateFieldGet(
|
122
|
+
if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'none') {
|
106
123
|
return;
|
107
124
|
}
|
108
|
-
_classPrivateFieldSet(
|
125
|
+
_classPrivateFieldSet(this, _totalTargetWidth, totalWidth);
|
109
126
|
let sumAll = 0;
|
110
|
-
for (let i = 0; i < _classPrivateFieldGet(
|
127
|
+
for (let i = 0; i < _classPrivateFieldGet(this, _totalColumns).call(this); i++) {
|
111
128
|
const columnWidth = this._getColumnWidth(i);
|
112
|
-
const permanentColumnWidth = _classPrivateFieldGet(
|
129
|
+
const permanentColumnWidth = _classPrivateFieldGet(this, _stretchingColumnWidthFn).call(this, undefined, i);
|
113
130
|
if (typeof permanentColumnWidth === 'number') {
|
114
131
|
totalWidth -= permanentColumnWidth;
|
115
132
|
} else {
|
@@ -117,12 +134,12 @@ class ColumnStretching {
|
|
117
134
|
}
|
118
135
|
}
|
119
136
|
const remainingSize = totalWidth - sumAll;
|
120
|
-
if (_classPrivateFieldGet(
|
137
|
+
if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'all' && remainingSize > 0) {
|
121
138
|
this.stretchAllRatio = totalWidth / sumAll;
|
122
139
|
this.stretchAllColumnsWidth = [];
|
123
140
|
this.needVerifyLastColumnWidth = true;
|
124
|
-
} else if (_classPrivateFieldGet(
|
125
|
-
const columnWidth = this._getColumnWidth(_classPrivateFieldGet(
|
141
|
+
} else if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'last' && totalWidth !== Infinity) {
|
142
|
+
const columnWidth = this._getColumnWidth(_classPrivateFieldGet(this, _totalColumns).call(this) - 1);
|
126
143
|
const lastColumnWidth = remainingSize + columnWidth;
|
127
144
|
this.stretchLastWidth = lastColumnWidth >= 0 ? lastColumnWidth : columnWidth;
|
128
145
|
}
|
@@ -137,9 +154,9 @@ class ColumnStretching {
|
|
137
154
|
*/
|
138
155
|
getStretchedColumnWidth(column, baseWidth) {
|
139
156
|
let result = null;
|
140
|
-
if (_classPrivateFieldGet(
|
157
|
+
if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'all' && this.stretchAllRatio !== 0) {
|
141
158
|
result = this._getStretchedAllColumnWidth(column, baseWidth);
|
142
|
-
} else if (_classPrivateFieldGet(
|
159
|
+
} else if (_classPrivateFieldGet(this, _stretchMode).call(this) === 'last' && this.stretchLastWidth !== 0) {
|
143
160
|
result = this._getStretchedLastColumnWidth(column);
|
144
161
|
}
|
145
162
|
return result;
|
@@ -155,20 +172,20 @@ class ColumnStretching {
|
|
155
172
|
let sumRatioWidth = 0;
|
156
173
|
if (!this.stretchAllColumnsWidth[column]) {
|
157
174
|
const stretchedWidth = Math.round(baseWidth * this.stretchAllRatio);
|
158
|
-
const newStretchedWidth = _classPrivateFieldGet(
|
175
|
+
const newStretchedWidth = _classPrivateFieldGet(this, _stretchingColumnWidthFn).call(this, stretchedWidth, column);
|
159
176
|
if (newStretchedWidth === undefined) {
|
160
177
|
this.stretchAllColumnsWidth[column] = stretchedWidth;
|
161
178
|
} else {
|
162
179
|
this.stretchAllColumnsWidth[column] = isNaN(newStretchedWidth) ? this._getColumnWidth(column) : newStretchedWidth;
|
163
180
|
}
|
164
181
|
}
|
165
|
-
if (this.stretchAllColumnsWidth.length === _classPrivateFieldGet(
|
182
|
+
if (this.stretchAllColumnsWidth.length === _classPrivateFieldGet(this, _totalColumns).call(this) && this.needVerifyLastColumnWidth) {
|
166
183
|
this.needVerifyLastColumnWidth = false;
|
167
184
|
for (let i = 0; i < this.stretchAllColumnsWidth.length; i++) {
|
168
185
|
sumRatioWidth += this.stretchAllColumnsWidth[i];
|
169
186
|
}
|
170
|
-
if (sumRatioWidth !== _classPrivateFieldGet(
|
171
|
-
this.stretchAllColumnsWidth[this.stretchAllColumnsWidth.length - 1] += _classPrivateFieldGet(
|
187
|
+
if (sumRatioWidth !== _classPrivateFieldGet(this, _totalTargetWidth)) {
|
188
|
+
this.stretchAllColumnsWidth[this.stretchAllColumnsWidth.length - 1] += _classPrivateFieldGet(this, _totalTargetWidth) - sumRatioWidth;
|
172
189
|
}
|
173
190
|
}
|
174
191
|
return this.stretchAllColumnsWidth[column];
|
@@ -180,7 +197,7 @@ class ColumnStretching {
|
|
180
197
|
* @private
|
181
198
|
*/
|
182
199
|
_getStretchedLastColumnWidth(column) {
|
183
|
-
if (column === _classPrivateFieldGet(
|
200
|
+
if (column === _classPrivateFieldGet(this, _totalColumns).call(this) - 1) {
|
184
201
|
return this.stretchLastWidth;
|
185
202
|
}
|
186
203
|
return null;
|
@@ -192,7 +209,7 @@ class ColumnStretching {
|
|
192
209
|
* @private
|
193
210
|
*/
|
194
211
|
_getColumnWidth(column) {
|
195
|
-
let width = _classPrivateFieldGet(
|
212
|
+
let width = _classPrivateFieldGet(this, _columnWidthFn).call(this, column);
|
196
213
|
if (isNaN(width)) {
|
197
214
|
width = ColumnStretching.DEFAULT_WIDTH;
|
198
215
|
}
|