handsontable 0.0.0-next-53a190b-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/overlay/inlineStart.js +1 -15
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -16
- package/3rdparty/walkontable/src/overlay/top.js +0 -11
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -12
- package/3rdparty/walkontable/src/overlays.js +4 -46
- package/3rdparty/walkontable/src/overlays.mjs +4 -46
- 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 +9121 -9062
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +292 -292
- package/dist/handsontable.js +6573 -6967
- 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 -23
- package/helpers/dom/element.mjs +1 -21
- 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,16 +6,18 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
6
6
|
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; }
|
7
7
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
8
8
|
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); }
|
9
|
-
function _classPrivateFieldGet(
|
10
|
-
function
|
11
|
-
function
|
9
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
10
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
11
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
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; } }
|
12
15
|
import { BasePlugin } from "../base/index.mjs";
|
13
16
|
import { arrayEach, arrayFilter, arrayUnique } from "../../helpers/array.mjs";
|
14
17
|
import { rangeEach } from "../../helpers/number.mjs";
|
15
18
|
import { warn } from "../../helpers/console.mjs";
|
16
19
|
import { addClass, hasClass, removeClass, fastInnerText, removeAttribute, setAttribute } from "../../helpers/dom/element.mjs";
|
17
20
|
import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
|
18
|
-
import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
|
19
21
|
import { A11Y_EXPANDED, A11Y_HIDDEN } from "../../helpers/a11y.mjs";
|
20
22
|
export const PLUGIN_KEY = 'collapsibleColumns';
|
21
23
|
export const PLUGIN_PRIORITY = 290;
|
@@ -104,10 +106,32 @@ const actionDictionary = new Map([['collapse', {
|
|
104
106
|
* :::
|
105
107
|
*/
|
106
108
|
var _collapsedColumnsMap = /*#__PURE__*/new WeakMap();
|
107
|
-
var
|
109
|
+
var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
|
110
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
111
|
+
var _onInit = /*#__PURE__*/new WeakSet();
|
112
|
+
var _onAfterLoadData = /*#__PURE__*/new WeakSet();
|
108
113
|
export class CollapsibleColumns extends BasePlugin {
|
109
114
|
constructor() {
|
110
115
|
super(...arguments);
|
116
|
+
/**
|
117
|
+
* Updates the plugin state after new dataset load.
|
118
|
+
*
|
119
|
+
* @param {Array[]} sourceData Array of arrays or array of objects containing data.
|
120
|
+
* @param {boolean} initialLoad Flag that determines whether the data has been loaded
|
121
|
+
* during the initialization.
|
122
|
+
*/
|
123
|
+
_classPrivateMethodInitSpec(this, _onAfterLoadData);
|
124
|
+
/**
|
125
|
+
* Updates the plugin state after HoT initialization.
|
126
|
+
*/
|
127
|
+
_classPrivateMethodInitSpec(this, _onInit);
|
128
|
+
/**
|
129
|
+
* Indicator mouse event callback.
|
130
|
+
*
|
131
|
+
* @param {object} event Mouse event.
|
132
|
+
* @param {object} coords Event coordinates.
|
133
|
+
*/
|
134
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
111
135
|
/**
|
112
136
|
* Adds the indicator to the headers.
|
113
137
|
*
|
@@ -116,7 +140,7 @@ export class CollapsibleColumns extends BasePlugin {
|
|
116
140
|
* @param {number} headerLevel The index of header level counting from the top (positive
|
117
141
|
* values counting from 0 to N).
|
118
142
|
*/
|
119
|
-
_classPrivateMethodInitSpec(this,
|
143
|
+
_classPrivateMethodInitSpec(this, _onAfterGetColHeader);
|
120
144
|
/**
|
121
145
|
* Cached reference to the NestedHeaders plugin.
|
122
146
|
*
|
@@ -137,7 +161,10 @@ export class CollapsibleColumns extends BasePlugin {
|
|
137
161
|
* @private
|
138
162
|
* @type {HidingMap|null}
|
139
163
|
*/
|
140
|
-
_classPrivateFieldInitSpec(this, _collapsedColumnsMap,
|
164
|
+
_classPrivateFieldInitSpec(this, _collapsedColumnsMap, {
|
165
|
+
writable: true,
|
166
|
+
value: null
|
167
|
+
});
|
141
168
|
}
|
142
169
|
static get PLUGIN_KEY() {
|
143
170
|
return PLUGIN_KEY;
|
@@ -175,23 +202,23 @@ export class CollapsibleColumns extends BasePlugin {
|
|
175
202
|
if (!nestedHeaders) {
|
176
203
|
warn('You need to configure the Nested Headers plugin in order to use collapsible headers.');
|
177
204
|
}
|
178
|
-
_classPrivateFieldSet(
|
205
|
+
_classPrivateFieldSet(this, _collapsedColumnsMap, this.hot.columnIndexMapper.createAndRegisterIndexMap(this.pluginName, 'hiding'));
|
179
206
|
this.nestedHeadersPlugin = this.hot.getPlugin('nestedHeaders');
|
180
207
|
this.headerStateManager = this.nestedHeadersPlugin.getStateManager();
|
181
|
-
this.addHook('init', () =>
|
208
|
+
this.addHook('init', () => _classPrivateMethodGet(this, _onInit, _onInit2).call(this));
|
182
209
|
this.addHook('afterLoadData', function () {
|
183
210
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
184
211
|
args[_key] = arguments[_key];
|
185
212
|
}
|
186
|
-
return
|
213
|
+
return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
|
187
214
|
});
|
188
215
|
this.addHook('afterGetColHeader', function () {
|
189
216
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
190
217
|
args[_key2] = arguments[_key2];
|
191
218
|
}
|
192
|
-
return
|
219
|
+
return _classPrivateMethodGet(_this, _onAfterGetColHeader, _onAfterGetColHeader2).call(_this, ...args);
|
193
220
|
});
|
194
|
-
this.addHook('beforeOnCellMouseDown', (event, coords, TD) =>
|
221
|
+
this.addHook('beforeOnCellMouseDown', (event, coords, TD) => _classPrivateMethodGet(this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(this, event, coords, TD));
|
195
222
|
this.registerShortcuts();
|
196
223
|
super.enablePlugin();
|
197
224
|
// @TODO: Workaround for broken plugin initialization abstraction (#6806).
|
@@ -238,7 +265,7 @@ export class CollapsibleColumns extends BasePlugin {
|
|
238
265
|
*/
|
239
266
|
disablePlugin() {
|
240
267
|
this.hot.columnIndexMapper.unregisterMap(this.pluginName);
|
241
|
-
_classPrivateFieldSet(
|
268
|
+
_classPrivateFieldSet(this, _collapsedColumnsMap, null);
|
242
269
|
this.nestedHeadersPlugin = null;
|
243
270
|
this.unregisterShortcuts();
|
244
271
|
this.clearButtons();
|
@@ -278,17 +305,12 @@ export class CollapsibleColumns extends BasePlugin {
|
|
278
305
|
col: columnIndex
|
279
306
|
});
|
280
307
|
}
|
281
|
-
|
282
|
-
// prevent default Enter behavior (move to the next row within a selection range)
|
283
|
-
return false;
|
284
308
|
},
|
285
309
|
runOnlyIf: () => {
|
286
|
-
var _this$hot$getSelected
|
287
|
-
return (
|
310
|
+
var _this$hot$getSelected;
|
311
|
+
return (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight.isHeader();
|
288
312
|
},
|
289
|
-
group: SHORTCUTS_GROUP
|
290
|
-
relativeToGroup: SHORTCUTS_GROUP_EDITOR,
|
291
|
-
position: 'before'
|
313
|
+
group: SHORTCUTS_GROUP
|
292
314
|
});
|
293
315
|
}
|
294
316
|
|
@@ -472,25 +494,10 @@ export class CollapsibleColumns extends BasePlugin {
|
|
472
494
|
}
|
473
495
|
this.hot.batchExecution(() => {
|
474
496
|
arrayEach(affectedColumnsIndexes, visualColumn => {
|
475
|
-
_classPrivateFieldGet(
|
497
|
+
_classPrivateFieldGet(this, _collapsedColumnsMap).setValueAtIndex(this.hot.toPhysicalColumn(visualColumn), actionTranslator.hideColumn);
|
476
498
|
});
|
477
499
|
}, true);
|
478
500
|
const isActionPerformed = this.getCollapsedColumns().length !== currentCollapsedColumns.length;
|
479
|
-
const selectionRange = this.hot.getSelectedRangeLast();
|
480
|
-
if (action === 'collapse' && isActionPerformed && selectionRange) {
|
481
|
-
const {
|
482
|
-
row,
|
483
|
-
col
|
484
|
-
} = selectionRange.highlight;
|
485
|
-
const isHidden = this.hot.rowIndexMapper.isHidden(row) || this.hot.columnIndexMapper.isHidden(col);
|
486
|
-
if (isHidden && affectedColumnsIndexes.includes(col)) {
|
487
|
-
const nextRow = row >= 0 ? this.hot.rowIndexMapper.getNearestNotHiddenIndex(row, 1, true) : row;
|
488
|
-
const nextColumn = col >= 0 ? this.hot.columnIndexMapper.getNearestNotHiddenIndex(col, 1, true) : col;
|
489
|
-
if (nextRow !== null && nextColumn !== null) {
|
490
|
-
this.hot.selectCell(nextRow, nextColumn);
|
491
|
-
}
|
492
|
-
}
|
493
|
-
}
|
494
501
|
this.hot.runHooks(actionTranslator.afterHook, currentCollapsedColumns, destinationCollapsedColumns, isActionPossible, isActionPerformed);
|
495
502
|
this.hot.render();
|
496
503
|
this.hot.view.adjustElementsSize(true);
|
@@ -503,17 +510,17 @@ export class CollapsibleColumns extends BasePlugin {
|
|
503
510
|
* @returns {number[]}
|
504
511
|
*/
|
505
512
|
getCollapsedColumns() {
|
506
|
-
return _classPrivateFieldGet(
|
513
|
+
return _classPrivateFieldGet(this, _collapsedColumnsMap).getHiddenIndexes();
|
507
514
|
}
|
508
515
|
/**
|
509
516
|
* Destroys the plugin instance.
|
510
517
|
*/
|
511
518
|
destroy() {
|
512
|
-
_classPrivateFieldSet(
|
519
|
+
_classPrivateFieldSet(this, _collapsedColumnsMap, null);
|
513
520
|
super.destroy();
|
514
521
|
}
|
515
522
|
}
|
516
|
-
function
|
523
|
+
function _onAfterGetColHeader2(column, TH, headerLevel) {
|
517
524
|
var _this$headerStateMana3;
|
518
525
|
const {
|
519
526
|
collapsible,
|
@@ -556,13 +563,7 @@ function _onAfterGetColHeader(column, TH, headerLevel) {
|
|
556
563
|
(_collapsibleElement = collapsibleElement) === null || _collapsibleElement === void 0 || _collapsibleElement.remove();
|
557
564
|
}
|
558
565
|
}
|
559
|
-
|
560
|
-
* Indicator mouse event callback.
|
561
|
-
*
|
562
|
-
* @param {object} event Mouse event.
|
563
|
-
* @param {object} coords Event coordinates.
|
564
|
-
*/
|
565
|
-
function _onBeforeOnCellMouseDown(event, coords) {
|
566
|
+
function _onBeforeOnCellMouseDown2(event, coords) {
|
566
567
|
if (hasClass(event.target, COLLAPSIBLE_ELEMENT_CLASS)) {
|
567
568
|
if (hasClass(event.target, 'expanded')) {
|
568
569
|
this.eventManager.fireEvent(event.target, 'mouseup');
|
@@ -574,21 +575,11 @@ function _onBeforeOnCellMouseDown(event, coords) {
|
|
574
575
|
stopImmediatePropagation(event);
|
575
576
|
}
|
576
577
|
}
|
577
|
-
|
578
|
-
* Updates the plugin state after HoT initialization.
|
579
|
-
*/
|
580
|
-
function _onInit() {
|
578
|
+
function _onInit2() {
|
581
579
|
// @TODO: Workaround for broken plugin initialization abstraction (#6806).
|
582
580
|
this.updatePlugin();
|
583
581
|
}
|
584
|
-
|
585
|
-
* Updates the plugin state after new dataset load.
|
586
|
-
*
|
587
|
-
* @param {Array[]} sourceData Array of arrays or array of objects containing data.
|
588
|
-
* @param {boolean} initialLoad Flag that determines whether the data has been loaded
|
589
|
-
* during the initialization.
|
590
|
-
*/
|
591
|
-
function _onAfterLoadData(sourceData, initialLoad) {
|
582
|
+
function _onAfterLoadData2(sourceData, initialLoad) {
|
592
583
|
if (!initialLoad) {
|
593
584
|
this.updatePlugin();
|
594
585
|
}
|
@@ -1,8 +1,8 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
require("core-js/modules/es.error.cause.js");
|
5
4
|
require("core-js/modules/es.array.push.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
6
6
|
var _element = require("../../helpers/dom/element");
|
7
7
|
var _mixed = require("../../helpers/mixed");
|
8
8
|
var _object = require("../../helpers/object");
|
@@ -12,7 +12,6 @@ var _base = require("../base");
|
|
12
12
|
var _translations = require("../../translations");
|
13
13
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
14
14
|
var _columnStatesManager = require("./columnStatesManager");
|
15
|
-
var _shortcutContexts = require("../../shortcutContexts");
|
16
15
|
var _utils = require("./utils");
|
17
16
|
var _domHelpers = require("./domHelpers");
|
18
17
|
var _rootComparator = require("./rootComparator");
|
@@ -24,7 +23,7 @@ function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollect
|
|
24
23
|
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; }
|
25
24
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
26
25
|
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); }
|
27
|
-
function
|
26
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
28
27
|
const PLUGIN_KEY = exports.PLUGIN_KEY = 'columnSorting';
|
29
28
|
const PLUGIN_PRIORITY = exports.PLUGIN_PRIORITY = 50;
|
30
29
|
const APPEND_COLUMN_CONFIG_STRATEGY = exports.APPEND_COLUMN_CONFIG_STRATEGY = 'append';
|
@@ -84,14 +83,40 @@ _pluginHooks.default.getSingleton().register('afterColumnSort');
|
|
84
83
|
* }]
|
85
84
|
* ```
|
86
85
|
*/
|
87
|
-
var
|
86
|
+
var _loadOrSortBySettings = /*#__PURE__*/new WeakSet();
|
87
|
+
var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
|
88
|
+
var _onAfterLoadData = /*#__PURE__*/new WeakSet();
|
89
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
88
90
|
class ColumnSorting extends _base.BasePlugin {
|
89
91
|
constructor() {
|
90
92
|
super(...arguments);
|
93
|
+
/**
|
94
|
+
* Changes the behavior of selection / dragging.
|
95
|
+
*
|
96
|
+
* @param {MouseEvent} event The `mousedown` event.
|
97
|
+
* @param {CellCoords} coords Visual coordinates.
|
98
|
+
* @param {HTMLElement} TD The cell element.
|
99
|
+
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
100
|
+
* a boolean value that allows or disallows changing the selection for that particular area.
|
101
|
+
*/
|
102
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
103
|
+
/**
|
104
|
+
* Callback for the `afterLoadData` hook.
|
105
|
+
*
|
106
|
+
* @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
|
107
|
+
*/
|
108
|
+
_classPrivateMethodInitSpec(this, _onAfterLoadData);
|
109
|
+
/**
|
110
|
+
* Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
|
111
|
+
*
|
112
|
+
* @param {number} column Visual column index.
|
113
|
+
* @param {Element} TH TH HTML element.
|
114
|
+
*/
|
115
|
+
_classPrivateMethodInitSpec(this, _onAfterGetColHeader);
|
91
116
|
/**
|
92
117
|
* Load saved settings or sort by predefined plugin configuration.
|
93
118
|
*/
|
94
|
-
_classPrivateMethodInitSpec(this,
|
119
|
+
_classPrivateMethodInitSpec(this, _loadOrSortBySettings);
|
95
120
|
/**
|
96
121
|
* Instance of column state manager.
|
97
122
|
*
|
@@ -154,25 +179,25 @@ class ColumnSorting extends _base.BasePlugin {
|
|
154
179
|
return this.getMergedPluginSettings(visualIndex);
|
155
180
|
});
|
156
181
|
this.hot.columnIndexMapper.registerMap(`${this.pluginKey}.columnMeta`, this.columnMetaCache);
|
157
|
-
this.addHook('afterGetColHeader', (column, TH) =>
|
182
|
+
this.addHook('afterGetColHeader', (column, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, column, TH));
|
158
183
|
this.addHook('beforeOnCellMouseDown', function () {
|
159
184
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
160
185
|
args[_key] = arguments[_key];
|
161
186
|
}
|
162
|
-
return
|
187
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
163
188
|
});
|
164
189
|
this.addHook('afterOnCellMouseDown', (event, target) => this.onAfterOnCellMouseDown(event, target));
|
165
|
-
this.addHook('afterInit', () =>
|
190
|
+
this.addHook('afterInit', () => _classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this));
|
166
191
|
this.addHook('afterLoadData', function () {
|
167
192
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
168
193
|
args[_key2] = arguments[_key2];
|
169
194
|
}
|
170
|
-
return
|
195
|
+
return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
|
171
196
|
});
|
172
197
|
|
173
198
|
// TODO: Workaround? It should be refactored / described.
|
174
199
|
if (this.hot.view) {
|
175
|
-
|
200
|
+
_classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this);
|
176
201
|
}
|
177
202
|
this.registerShortcuts();
|
178
203
|
super.enablePlugin();
|
@@ -221,18 +246,15 @@ class ColumnSorting extends _base.BasePlugin {
|
|
221
246
|
const {
|
222
247
|
highlight
|
223
248
|
} = this.hot.getSelectedRangeLast();
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
return false;
|
249
|
+
if (highlight.row === -1 && highlight.col >= 0) {
|
250
|
+
this.sort(this.getColumnNextConfig(highlight.col));
|
251
|
+
}
|
228
252
|
},
|
229
253
|
runOnlyIf: () => {
|
230
|
-
var _this$hot$getSelected
|
254
|
+
var _this$hot$getSelected;
|
231
255
|
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
232
|
-
return highlight &&
|
256
|
+
return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
|
233
257
|
},
|
234
|
-
relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
|
235
|
-
position: 'before',
|
236
258
|
group: SHORTCUTS_GROUP
|
237
259
|
});
|
238
260
|
}
|
@@ -632,14 +654,6 @@ class ColumnSorting extends _base.BasePlugin {
|
|
632
654
|
this.hot.render();
|
633
655
|
}
|
634
656
|
}
|
635
|
-
|
636
|
-
/**
|
637
|
-
* Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
|
638
|
-
*
|
639
|
-
* @param {number} column Visual column index.
|
640
|
-
* @param {Element} TH TH HTML element.
|
641
|
-
*/
|
642
|
-
|
643
657
|
/**
|
644
658
|
* Update header classes.
|
645
659
|
*
|
@@ -674,13 +688,6 @@ class ColumnSorting extends _base.BasePlugin {
|
|
674
688
|
this.sortBySettings(newSettings[this.pluginKey]);
|
675
689
|
}
|
676
690
|
}
|
677
|
-
|
678
|
-
/**
|
679
|
-
* Callback for the `afterLoadData` hook.
|
680
|
-
*
|
681
|
-
* @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
|
682
|
-
*/
|
683
|
-
|
684
691
|
/**
|
685
692
|
* Indicates if clickable header was clicked.
|
686
693
|
*
|
@@ -694,17 +701,6 @@ class ColumnSorting extends _base.BasePlugin {
|
|
694
701
|
const headerActionEnabled = pluginSettingsForColumn.headerAction;
|
695
702
|
return headerActionEnabled && (0, _element.hasClass)(event.target, _utils.HEADER_SPAN_CLASS);
|
696
703
|
}
|
697
|
-
|
698
|
-
/**
|
699
|
-
* Changes the behavior of selection / dragging.
|
700
|
-
*
|
701
|
-
* @param {MouseEvent} event The `mousedown` event.
|
702
|
-
* @param {CellCoords} coords Visual coordinates.
|
703
|
-
* @param {HTMLElement} TD The cell element.
|
704
|
-
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
705
|
-
* a boolean value that allows or disallows changing the selection for that particular area.
|
706
|
-
*/
|
707
|
-
|
708
704
|
/**
|
709
705
|
* Callback for the `onAfterOnCellMouseDown` hook.
|
710
706
|
*
|
@@ -737,7 +733,7 @@ class ColumnSorting extends _base.BasePlugin {
|
|
737
733
|
}
|
738
734
|
}
|
739
735
|
exports.ColumnSorting = ColumnSorting;
|
740
|
-
function
|
736
|
+
function _loadOrSortBySettings2() {
|
741
737
|
const storedAllSortSettings = this.getAllSavedSortSettings();
|
742
738
|
if ((0, _object.isObject)(storedAllSortSettings)) {
|
743
739
|
this.sortBySettings(storedAllSortSettings);
|
@@ -746,7 +742,7 @@ function _loadOrSortBySettings() {
|
|
746
742
|
this.sortBySettings(allSortSettings);
|
747
743
|
}
|
748
744
|
}
|
749
|
-
function
|
745
|
+
function _onAfterGetColHeader2(column, TH) {
|
750
746
|
const headerSpanElement = (0, _utils.getHeaderSpanElement)(TH);
|
751
747
|
if ((0, _utils.isFirstLevelColumnHeader)(column, TH) === false || headerSpanElement === null) {
|
752
748
|
return;
|
@@ -760,15 +756,15 @@ function _onAfterGetColHeader(column, TH) {
|
|
760
756
|
(0, _element.setAttribute)(TH, ...(0, _a11y.A11Y_SORT)(currentSortState ? `${currentSortState}ending` : 'none'));
|
761
757
|
}
|
762
758
|
}
|
763
|
-
function
|
759
|
+
function _onAfterLoadData2(initialLoad) {
|
764
760
|
if (initialLoad === true) {
|
765
761
|
// TODO: Workaround? It should be refactored / described.
|
766
762
|
if (this.hot.view) {
|
767
|
-
|
763
|
+
_classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this);
|
768
764
|
}
|
769
765
|
}
|
770
766
|
}
|
771
|
-
function
|
767
|
+
function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
|
772
768
|
if ((0, _utils.wasHeaderClickedProperly)(coords.row, coords.col, event) === false) {
|
773
769
|
return;
|
774
770
|
}
|
@@ -1,11 +1,11 @@
|
|
1
|
-
import "core-js/modules/es.error.cause.js";
|
2
1
|
import "core-js/modules/es.array.push.js";
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
3
3
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
4
4
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
5
5
|
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; }
|
6
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
7
7
|
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); }
|
8
|
-
function
|
8
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
9
9
|
import { addClass, hasClass, removeClass, setAttribute } from "../../helpers/dom/element.mjs";
|
10
10
|
import { isUndefined, isDefined } from "../../helpers/mixed.mjs";
|
11
11
|
import { isObject } from "../../helpers/object.mjs";
|
@@ -15,7 +15,6 @@ import { BasePlugin } from "../base/index.mjs";
|
|
15
15
|
import { IndexesSequence, PhysicalIndexToValueMap as IndexToValueMap } from "../../translations/index.mjs";
|
16
16
|
import Hooks from "../../pluginHooks.mjs";
|
17
17
|
import { ColumnStatesManager } from "./columnStatesManager.mjs";
|
18
|
-
import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
|
19
18
|
import { HEADER_SPAN_CLASS, getNextSortOrder, areValidSortStates, getHeaderSpanElement, isFirstLevelColumnHeader, wasHeaderClickedProperly } from "./utils.mjs";
|
20
19
|
import { getClassesToRemove, getClassesToAdd } from "./domHelpers.mjs";
|
21
20
|
import { rootComparator } from "./rootComparator.mjs";
|
@@ -80,14 +79,40 @@ Hooks.getSingleton().register('afterColumnSort');
|
|
80
79
|
* }]
|
81
80
|
* ```
|
82
81
|
*/
|
83
|
-
var
|
82
|
+
var _loadOrSortBySettings = /*#__PURE__*/new WeakSet();
|
83
|
+
var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
|
84
|
+
var _onAfterLoadData = /*#__PURE__*/new WeakSet();
|
85
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
84
86
|
export class ColumnSorting extends BasePlugin {
|
85
87
|
constructor() {
|
86
88
|
super(...arguments);
|
89
|
+
/**
|
90
|
+
* Changes the behavior of selection / dragging.
|
91
|
+
*
|
92
|
+
* @param {MouseEvent} event The `mousedown` event.
|
93
|
+
* @param {CellCoords} coords Visual coordinates.
|
94
|
+
* @param {HTMLElement} TD The cell element.
|
95
|
+
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
96
|
+
* a boolean value that allows or disallows changing the selection for that particular area.
|
97
|
+
*/
|
98
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
99
|
+
/**
|
100
|
+
* Callback for the `afterLoadData` hook.
|
101
|
+
*
|
102
|
+
* @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
|
103
|
+
*/
|
104
|
+
_classPrivateMethodInitSpec(this, _onAfterLoadData);
|
105
|
+
/**
|
106
|
+
* Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
|
107
|
+
*
|
108
|
+
* @param {number} column Visual column index.
|
109
|
+
* @param {Element} TH TH HTML element.
|
110
|
+
*/
|
111
|
+
_classPrivateMethodInitSpec(this, _onAfterGetColHeader);
|
87
112
|
/**
|
88
113
|
* Load saved settings or sort by predefined plugin configuration.
|
89
114
|
*/
|
90
|
-
_classPrivateMethodInitSpec(this,
|
115
|
+
_classPrivateMethodInitSpec(this, _loadOrSortBySettings);
|
91
116
|
/**
|
92
117
|
* Instance of column state manager.
|
93
118
|
*
|
@@ -150,25 +175,25 @@ export class ColumnSorting extends BasePlugin {
|
|
150
175
|
return this.getMergedPluginSettings(visualIndex);
|
151
176
|
});
|
152
177
|
this.hot.columnIndexMapper.registerMap(`${this.pluginKey}.columnMeta`, this.columnMetaCache);
|
153
|
-
this.addHook('afterGetColHeader', (column, TH) =>
|
178
|
+
this.addHook('afterGetColHeader', (column, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, column, TH));
|
154
179
|
this.addHook('beforeOnCellMouseDown', function () {
|
155
180
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
156
181
|
args[_key] = arguments[_key];
|
157
182
|
}
|
158
|
-
return
|
183
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
159
184
|
});
|
160
185
|
this.addHook('afterOnCellMouseDown', (event, target) => this.onAfterOnCellMouseDown(event, target));
|
161
|
-
this.addHook('afterInit', () =>
|
186
|
+
this.addHook('afterInit', () => _classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this));
|
162
187
|
this.addHook('afterLoadData', function () {
|
163
188
|
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
164
189
|
args[_key2] = arguments[_key2];
|
165
190
|
}
|
166
|
-
return
|
191
|
+
return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
|
167
192
|
});
|
168
193
|
|
169
194
|
// TODO: Workaround? It should be refactored / described.
|
170
195
|
if (this.hot.view) {
|
171
|
-
|
196
|
+
_classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this);
|
172
197
|
}
|
173
198
|
this.registerShortcuts();
|
174
199
|
super.enablePlugin();
|
@@ -217,18 +242,15 @@ export class ColumnSorting extends BasePlugin {
|
|
217
242
|
const {
|
218
243
|
highlight
|
219
244
|
} = this.hot.getSelectedRangeLast();
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
return false;
|
245
|
+
if (highlight.row === -1 && highlight.col >= 0) {
|
246
|
+
this.sort(this.getColumnNextConfig(highlight.col));
|
247
|
+
}
|
224
248
|
},
|
225
249
|
runOnlyIf: () => {
|
226
|
-
var _this$hot$getSelected
|
250
|
+
var _this$hot$getSelected;
|
227
251
|
const highlight = (_this$hot$getSelected = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected === void 0 ? void 0 : _this$hot$getSelected.highlight;
|
228
|
-
return highlight &&
|
252
|
+
return highlight && this.hot.selection.isCellVisible(highlight) && highlight.isHeader();
|
229
253
|
},
|
230
|
-
relativeToGroup: SHORTCUTS_GROUP_EDITOR,
|
231
|
-
position: 'before',
|
232
254
|
group: SHORTCUTS_GROUP
|
233
255
|
});
|
234
256
|
}
|
@@ -628,14 +650,6 @@ export class ColumnSorting extends BasePlugin {
|
|
628
650
|
this.hot.render();
|
629
651
|
}
|
630
652
|
}
|
631
|
-
|
632
|
-
/**
|
633
|
-
* Callback for the `onAfterGetColHeader` hook. Adds column sorting CSS classes.
|
634
|
-
*
|
635
|
-
* @param {number} column Visual column index.
|
636
|
-
* @param {Element} TH TH HTML element.
|
637
|
-
*/
|
638
|
-
|
639
653
|
/**
|
640
654
|
* Update header classes.
|
641
655
|
*
|
@@ -670,13 +684,6 @@ export class ColumnSorting extends BasePlugin {
|
|
670
684
|
this.sortBySettings(newSettings[this.pluginKey]);
|
671
685
|
}
|
672
686
|
}
|
673
|
-
|
674
|
-
/**
|
675
|
-
* Callback for the `afterLoadData` hook.
|
676
|
-
*
|
677
|
-
* @param {boolean} initialLoad Flag that determines whether the data has been loaded during the initialization.
|
678
|
-
*/
|
679
|
-
|
680
687
|
/**
|
681
688
|
* Indicates if clickable header was clicked.
|
682
689
|
*
|
@@ -690,17 +697,6 @@ export class ColumnSorting extends BasePlugin {
|
|
690
697
|
const headerActionEnabled = pluginSettingsForColumn.headerAction;
|
691
698
|
return headerActionEnabled && hasClass(event.target, HEADER_SPAN_CLASS);
|
692
699
|
}
|
693
|
-
|
694
|
-
/**
|
695
|
-
* Changes the behavior of selection / dragging.
|
696
|
-
*
|
697
|
-
* @param {MouseEvent} event The `mousedown` event.
|
698
|
-
* @param {CellCoords} coords Visual coordinates.
|
699
|
-
* @param {HTMLElement} TD The cell element.
|
700
|
-
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
701
|
-
* a boolean value that allows or disallows changing the selection for that particular area.
|
702
|
-
*/
|
703
|
-
|
704
700
|
/**
|
705
701
|
* Callback for the `onAfterOnCellMouseDown` hook.
|
706
702
|
*
|
@@ -732,7 +728,7 @@ export class ColumnSorting extends BasePlugin {
|
|
732
728
|
super.destroy();
|
733
729
|
}
|
734
730
|
}
|
735
|
-
function
|
731
|
+
function _loadOrSortBySettings2() {
|
736
732
|
const storedAllSortSettings = this.getAllSavedSortSettings();
|
737
733
|
if (isObject(storedAllSortSettings)) {
|
738
734
|
this.sortBySettings(storedAllSortSettings);
|
@@ -741,7 +737,7 @@ function _loadOrSortBySettings() {
|
|
741
737
|
this.sortBySettings(allSortSettings);
|
742
738
|
}
|
743
739
|
}
|
744
|
-
function
|
740
|
+
function _onAfterGetColHeader2(column, TH) {
|
745
741
|
const headerSpanElement = getHeaderSpanElement(TH);
|
746
742
|
if (isFirstLevelColumnHeader(column, TH) === false || headerSpanElement === null) {
|
747
743
|
return;
|
@@ -755,15 +751,15 @@ function _onAfterGetColHeader(column, TH) {
|
|
755
751
|
setAttribute(TH, ...A11Y_SORT(currentSortState ? `${currentSortState}ending` : 'none'));
|
756
752
|
}
|
757
753
|
}
|
758
|
-
function
|
754
|
+
function _onAfterLoadData2(initialLoad) {
|
759
755
|
if (initialLoad === true) {
|
760
756
|
// TODO: Workaround? It should be refactored / described.
|
761
757
|
if (this.hot.view) {
|
762
|
-
|
758
|
+
_classPrivateMethodGet(this, _loadOrSortBySettings, _loadOrSortBySettings2).call(this);
|
763
759
|
}
|
764
760
|
}
|
765
761
|
}
|
766
|
-
function
|
762
|
+
function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
|
767
763
|
if (wasHeaderClickedProperly(coords.row, coords.col, event) === false) {
|
768
764
|
return;
|
769
765
|
}
|