handsontable 0.0.0-next-7026906-20231107 → 0.0.0-next-7b93b7d-20231107
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/3rdparty/SheetClip/SheetClip.js +2 -2
- package/3rdparty/SheetClip/SheetClip.mjs +2 -2
- package/3rdparty/autoResize/autoResize.js +2 -2
- package/3rdparty/autoResize/autoResize.mjs +2 -2
- package/3rdparty/walkontable/src/calculator/viewportColumns.js +108 -85
- package/3rdparty/walkontable/src/calculator/viewportColumns.mjs +108 -85
- package/3rdparty/walkontable/src/calculator/viewportRows.js +60 -52
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +60 -52
- package/3rdparty/walkontable/src/core/clone.js +6 -0
- package/3rdparty/walkontable/src/core/clone.mjs +6 -0
- package/3rdparty/walkontable/src/event.js +125 -74
- package/3rdparty/walkontable/src/event.mjs +125 -74
- package/3rdparty/walkontable/src/filter/column.js +16 -0
- package/3rdparty/walkontable/src/filter/column.mjs +16 -0
- package/3rdparty/walkontable/src/filter/row.js +16 -0
- package/3rdparty/walkontable/src/filter/row.mjs +16 -0
- package/3rdparty/walkontable/src/overlay/bottom.js +1 -1
- package/3rdparty/walkontable/src/overlay/bottom.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/top.js +1 -1
- package/3rdparty/walkontable/src/overlay/top.mjs +1 -1
- package/3rdparty/walkontable/src/renderer/_base.js +12 -5
- package/3rdparty/walkontable/src/renderer/_base.mjs +12 -5
- package/3rdparty/walkontable/src/renderer/cells.js +6 -2
- package/3rdparty/walkontable/src/renderer/cells.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.js +6 -2
- package/3rdparty/walkontable/src/renderer/rowHeaders.mjs +6 -2
- package/3rdparty/walkontable/src/renderer/rows.js +5 -0
- package/3rdparty/walkontable/src/renderer/rows.mjs +5 -0
- package/3rdparty/walkontable/src/renderer/table.js +24 -17
- package/3rdparty/walkontable/src/renderer/table.mjs +24 -17
- package/3rdparty/walkontable/src/scroll.js +2 -2
- package/3rdparty/walkontable/src/scroll.mjs +2 -2
- package/3rdparty/walkontable/src/selection/border/border.js +1 -1
- package/3rdparty/walkontable/src/selection/border/border.mjs +1 -1
- package/3rdparty/walkontable/src/settings.js +10 -10
- package/3rdparty/walkontable/src/settings.mjs +10 -10
- package/3rdparty/walkontable/src/table.js +3 -3
- package/3rdparty/walkontable/src/table.mjs +3 -3
- package/3rdparty/walkontable/src/utils/column.js +19 -4
- package/3rdparty/walkontable/src/utils/column.mjs +19 -4
- package/3rdparty/walkontable/src/utils/nodesPool.js +5 -0
- package/3rdparty/walkontable/src/utils/nodesPool.mjs +5 -0
- package/3rdparty/walkontable/src/utils/orderView/view.js +13 -6
- package/3rdparty/walkontable/src/utils/orderView/view.mjs +13 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.js +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSize.mjs +9 -6
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.js +7 -4
- package/3rdparty/walkontable/src/utils/orderView/viewSizeSet.mjs +7 -4
- package/3rdparty/walkontable/src/utils/row.js +14 -2
- package/3rdparty/walkontable/src/utils/row.mjs +14 -2
- package/3rdparty/walkontable/src/viewport.js +9 -9
- package/3rdparty/walkontable/src/viewport.mjs +9 -9
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.js +25 -25
- package/core.mjs +25 -25
- package/dataMap/dataMap.js +99 -90
- package/dataMap/dataMap.mjs +99 -90
- package/dataMap/dataSource.js +14 -8
- package/dataMap/dataSource.mjs +14 -8
- package/dataMap/metaManager/lazyFactoryMap.js +19 -7
- package/dataMap/metaManager/lazyFactoryMap.mjs +19 -7
- package/dataMap/metaManager/metaLayers/cellMeta.js +8 -3
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +8 -3
- package/dataMap/metaManager/metaLayers/columnMeta.js +7 -1
- package/dataMap/metaManager/metaLayers/columnMeta.mjs +7 -1
- package/dataMap/metaManager/metaLayers/globalMeta.js +6 -1
- package/dataMap/metaManager/metaLayers/globalMeta.mjs +6 -1
- package/dataMap/metaManager/metaLayers/tableMeta.js +6 -2
- package/dataMap/metaManager/metaLayers/tableMeta.mjs +6 -2
- package/dataMap/metaManager/metaSchema.js +55 -55
- package/dataMap/metaManager/metaSchema.mjs +55 -55
- package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -2
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -2
- package/dataMap/metaManager/mods/extendMetaProperties.js +8 -4
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +8 -4
- package/dataMap/metaManager/utils.js +2 -2
- package/dataMap/metaManager/utils.mjs +2 -2
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7244 -6347
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +120 -120
- package/dist/handsontable.js +7243 -6346
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +28 -28
- package/editorManager.js +105 -95
- package/editorManager.mjs +105 -95
- package/editors/autocompleteEditor/autocompleteEditor.js +47 -46
- package/editors/autocompleteEditor/autocompleteEditor.mjs +46 -45
- package/editors/baseEditor/baseEditor.js +23 -26
- package/editors/baseEditor/baseEditor.mjs +23 -26
- package/editors/dateEditor/dateEditor.js +24 -15
- package/editors/dateEditor/dateEditor.mjs +24 -15
- package/editors/dropdownEditor/dropdownEditor.js +1 -1
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +4 -4
- package/editors/handsontableEditor/handsontableEditor.mjs +4 -4
- package/editors/textEditor/textEditor.js +23 -17
- package/editors/textEditor/textEditor.mjs +24 -18
- package/eventManager.js +8 -0
- package/eventManager.mjs +8 -0
- package/helpers/array.js +2 -2
- package/helpers/array.mjs +2 -2
- package/helpers/dom/element.js +7 -7
- package/helpers/dom/element.mjs +7 -7
- package/helpers/function.js +1 -1
- package/helpers/function.mjs +1 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/object.js +4 -4
- package/helpers/object.mjs +4 -4
- package/helpers/string.js +1 -1
- package/helpers/string.mjs +1 -1
- package/package.json +1 -1
- package/pluginHooks.d.ts +0 -2
- package/pluginHooks.js +12 -3
- package/pluginHooks.mjs +12 -3
- package/plugins/autoColumnSize/autoColumnSize.js +141 -130
- package/plugins/autoColumnSize/autoColumnSize.mjs +140 -129
- package/plugins/autoRowSize/autoRowSize.js +112 -125
- package/plugins/autoRowSize/autoRowSize.mjs +110 -123
- package/plugins/autofill/autofill.js +97 -102
- package/plugins/autofill/autofill.mjs +96 -101
- package/plugins/base/base.js +57 -22
- package/plugins/base/base.mjs +56 -22
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.js +29 -24
- package/plugins/bindRowsWithHeaders/bindRowsWithHeaders.mjs +28 -23
- package/plugins/collapsibleColumns/collapsibleColumns.js +104 -107
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +102 -104
- package/plugins/columnSorting/columnSorting.js +105 -98
- package/plugins/columnSorting/columnSorting.mjs +104 -97
- package/plugins/columnSorting/columnStatesManager.js +12 -6
- package/plugins/columnSorting/columnStatesManager.mjs +12 -6
- package/plugins/columnSummary/columnSummary.js +71 -58
- package/plugins/columnSummary/columnSummary.mjs +70 -57
- package/plugins/columnSummary/endpoints.js +20 -14
- package/plugins/columnSummary/endpoints.mjs +20 -14
- package/plugins/comments/commentEditor.js +30 -2
- package/plugins/comments/commentEditor.mjs +30 -2
- package/plugins/comments/comments.js +158 -169
- package/plugins/comments/comments.mjs +157 -168
- package/plugins/comments/displaySwitch.js +7 -3
- package/plugins/comments/displaySwitch.mjs +7 -3
- package/plugins/contextMenu/commandExecutor.js +15 -2
- package/plugins/contextMenu/commandExecutor.mjs +15 -2
- package/plugins/contextMenu/contextMenu.js +91 -101
- package/plugins/contextMenu/contextMenu.mjs +90 -100
- package/plugins/contextMenu/itemsFactory.js +19 -4
- package/plugins/contextMenu/itemsFactory.mjs +19 -4
- package/plugins/contextMenu/menu/cursor.js +36 -0
- package/plugins/contextMenu/menu/cursor.mjs +36 -0
- package/plugins/contextMenu/menu/menu.js +57 -5
- package/plugins/contextMenu/menu/menu.mjs +57 -5
- package/plugins/copyPaste/copyPaste.js +74 -75
- package/plugins/copyPaste/copyPaste.mjs +74 -75
- package/plugins/customBorders/customBorders.js +49 -48
- package/plugins/customBorders/customBorders.mjs +48 -47
- package/plugins/dragToScroll/dragToScroll.js +50 -54
- package/plugins/dragToScroll/dragToScroll.mjs +49 -52
- package/plugins/dropdownMenu/dropdownMenu.js +132 -129
- package/plugins/dropdownMenu/dropdownMenu.mjs +132 -129
- package/plugins/exportFile/dataProvider.js +7 -2
- package/plugins/exportFile/dataProvider.mjs +7 -2
- package/plugins/exportFile/exportFile.js +1 -1
- package/plugins/exportFile/exportFile.mjs +1 -1
- package/plugins/exportFile/types/_base.js +14 -6
- package/plugins/exportFile/types/_base.mjs +14 -6
- package/plugins/filters/component/actionBar.js +9 -0
- package/plugins/filters/component/actionBar.mjs +9 -0
- package/plugins/filters/component/condition.js +13 -0
- package/plugins/filters/component/condition.mjs +13 -0
- package/plugins/filters/component/operators.js +9 -0
- package/plugins/filters/component/operators.mjs +9 -0
- package/plugins/filters/component/value.js +9 -0
- package/plugins/filters/component/value.mjs +9 -0
- package/plugins/filters/conditionCollection.js +9 -4
- package/plugins/filters/conditionCollection.mjs +9 -4
- package/plugins/filters/conditionUpdateObserver.js +53 -42
- package/plugins/filters/conditionUpdateObserver.mjs +53 -42
- package/plugins/filters/dataFilter.js +9 -3
- package/plugins/filters/dataFilter.mjs +9 -3
- package/plugins/filters/filters.js +184 -189
- package/plugins/filters/filters.mjs +182 -187
- package/plugins/filters/ui/_base.js +1 -1
- package/plugins/filters/ui/_base.mjs +1 -1
- package/plugins/filters/utils.js +1 -1
- package/plugins/filters/utils.mjs +1 -1
- package/plugins/formulas/engine/settings.js +1 -1
- package/plugins/formulas/engine/settings.mjs +1 -1
- package/plugins/formulas/formulas.js +684 -602
- package/plugins/formulas/formulas.mjs +682 -600
- package/plugins/hiddenColumns/hiddenColumns.js +174 -169
- package/plugins/hiddenColumns/hiddenColumns.mjs +173 -168
- package/plugins/hiddenRows/hiddenRows.js +170 -165
- package/plugins/hiddenRows/hiddenRows.mjs +169 -164
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/manualColumnFreeze.js +67 -54
- package/plugins/manualColumnFreeze/manualColumnFreeze.mjs +64 -51
- package/plugins/manualColumnMove/manualColumnMove.js +287 -232
- package/plugins/manualColumnMove/manualColumnMove.mjs +286 -231
- package/plugins/manualColumnMove/ui/_base.js +9 -3
- package/plugins/manualColumnMove/ui/_base.mjs +9 -3
- package/plugins/manualColumnResize/manualColumnResize.js +291 -246
- package/plugins/manualColumnResize/manualColumnResize.mjs +290 -244
- package/plugins/manualRowMove/manualRowMove.js +223 -208
- package/plugins/manualRowMove/manualRowMove.mjs +222 -207
- package/plugins/manualRowMove/ui/_base.js +10 -5
- package/plugins/manualRowMove/ui/_base.mjs +10 -5
- package/plugins/manualRowResize/manualRowResize.js +254 -209
- package/plugins/manualRowResize/manualRowResize.mjs +253 -207
- package/plugins/mergeCells/calculations/autofill.js +9 -3
- package/plugins/mergeCells/calculations/autofill.mjs +9 -3
- package/plugins/mergeCells/calculations/selection.js +10 -4
- package/plugins/mergeCells/calculations/selection.mjs +10 -4
- package/plugins/mergeCells/cellCoords.js +16 -6
- package/plugins/mergeCells/cellCoords.mjs +16 -6
- package/plugins/mergeCells/cellsCollection.js +10 -4
- package/plugins/mergeCells/cellsCollection.mjs +10 -4
- package/plugins/mergeCells/mergeCells.js +582 -502
- package/plugins/mergeCells/mergeCells.mjs +580 -500
- package/plugins/multiColumnSorting/multiColumnSorting.js +13 -10
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +13 -10
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.js +16 -28
- package/plugins/multipleSelectionHandles/multipleSelectionHandles.mjs +16 -27
- package/plugins/nestedHeaders/nestedHeaders.js +542 -499
- package/plugins/nestedHeaders/nestedHeaders.mjs +554 -511
- package/plugins/nestedHeaders/stateManager/index.js +1 -1
- package/plugins/nestedHeaders/stateManager/index.mjs +1 -1
- package/plugins/nestedRows/data/dataManager.js +21 -15
- package/plugins/nestedRows/data/dataManager.mjs +21 -15
- package/plugins/nestedRows/nestedRows.js +326 -278
- package/plugins/nestedRows/nestedRows.mjs +325 -277
- package/plugins/nestedRows/ui/_base.js +7 -1
- package/plugins/nestedRows/ui/_base.mjs +7 -1
- package/plugins/nestedRows/ui/collapsing.js +2 -2
- package/plugins/nestedRows/ui/collapsing.mjs +2 -2
- package/plugins/nestedRows/ui/contextMenu.js +28 -18
- package/plugins/nestedRows/ui/contextMenu.mjs +28 -18
- package/plugins/nestedRows/utils/rowMoveController.js +12 -4
- package/plugins/nestedRows/utils/rowMoveController.mjs +12 -4
- package/plugins/persistentState/persistentState.js +14 -11
- package/plugins/persistentState/persistentState.mjs +14 -11
- package/plugins/persistentState/storage.js +11 -6
- package/plugins/persistentState/storage.mjs +11 -6
- package/plugins/registry.js +2 -2
- package/plugins/registry.mjs +2 -2
- package/plugins/search/search.js +57 -46
- package/plugins/search/search.mjs +56 -45
- package/plugins/touchScroll/touchScroll.js +102 -100
- package/plugins/touchScroll/touchScroll.mjs +100 -98
- package/plugins/trimRows/trimRows.js +33 -28
- package/plugins/trimRows/trimRows.mjs +32 -27
- package/plugins/undoRedo/undoRedo.js +2 -2
- package/plugins/undoRedo/undoRedo.mjs +2 -2
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +11 -11
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +11 -11
- package/renderers/baseRenderer/baseRenderer.js +2 -2
- package/renderers/baseRenderer/baseRenderer.mjs +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.js +23 -23
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +23 -23
- package/renderers/dateRenderer/dateRenderer.js +4 -4
- package/renderers/dateRenderer/dateRenderer.mjs +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.js +4 -4
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +4 -4
- package/renderers/htmlRenderer/htmlRenderer.js +4 -4
- package/renderers/htmlRenderer/htmlRenderer.mjs +4 -4
- package/renderers/numericRenderer/numericRenderer.js +3 -3
- package/renderers/numericRenderer/numericRenderer.mjs +3 -3
- package/renderers/passwordRenderer/passwordRenderer.js +3 -3
- package/renderers/passwordRenderer/passwordRenderer.mjs +3 -3
- package/renderers/selectRenderer/selectRenderer.js +4 -4
- package/renderers/selectRenderer/selectRenderer.mjs +4 -4
- package/renderers/textRenderer/textRenderer.js +5 -5
- package/renderers/textRenderer/textRenderer.mjs +5 -5
- package/renderers/timeRenderer/timeRenderer.js +3 -3
- package/renderers/timeRenderer/timeRenderer.mjs +3 -3
- package/selection/range.js +12 -2
- package/selection/range.mjs +12 -2
- package/selection/selection.js +3 -3
- package/selection/selection.mjs +3 -3
- package/tableView.js +208 -200
- package/tableView.mjs +208 -200
- package/translations/changesObservable/utils.js +2 -2
- package/translations/changesObservable/utils.mjs +2 -2
- package/translations/indexMapper.js +25 -22
- package/translations/indexMapper.mjs +25 -22
- package/translations/mapCollections/aggregatedCollection.js +8 -2
- package/translations/mapCollections/aggregatedCollection.mjs +8 -2
- package/translations/mapCollections/mapCollection.js +5 -2
- package/translations/mapCollections/mapCollection.mjs +5 -2
- package/translations/maps/indexMap.js +6 -1
- package/translations/maps/indexMap.mjs +6 -1
- package/translations/maps/utils/physicallyIndexed.js +2 -2
- package/translations/maps/utils/physicallyIndexed.mjs +2 -2
- package/utils/dataStructures/linkedList.js +10 -6
- package/utils/dataStructures/linkedList.mjs +10 -6
- package/utils/dataStructures/queue.js +1 -1
- package/utils/dataStructures/queue.mjs +1 -1
- package/utils/dataStructures/stack.js +1 -1
- package/utils/dataStructures/stack.mjs +1 -1
- package/utils/ghostTable.js +2 -2
- package/utils/ghostTable.mjs +2 -2
- package/utils/interval.js +73 -36
- package/utils/interval.mjs +73 -36
- package/utils/parseTable.js +1 -1
- package/utils/parseTable.mjs +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.js +1 -1
- package/validators/autocompleteValidator/autocompleteValidator.mjs +1 -1
- package/validators/dateValidator/dateValidator.js +1 -1
- package/validators/dateValidator/dateValidator.mjs +1 -1
- package/validators/numericValidator/numericValidator.js +1 -1
- package/validators/numericValidator/numericValidator.mjs +1 -1
@@ -2,23 +2,34 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.array.push.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
5
6
|
var _base = require("../base");
|
6
7
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
7
8
|
var _array = require("../../helpers/array");
|
8
9
|
var _element = require("../../helpers/dom/element");
|
9
10
|
var _event = require("../../helpers/dom/event");
|
10
11
|
var _number = require("../../helpers/number");
|
11
|
-
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
12
12
|
var _backlight = _interopRequireDefault(require("./ui/backlight"));
|
13
13
|
var _guideline = _interopRequireDefault(require("./ui/guideline"));
|
14
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
16
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
17
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
18
|
+
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; }
|
19
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
20
|
+
function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
21
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
22
|
+
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; } }
|
23
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
24
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
25
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
26
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
15
27
|
_pluginHooks.default.getSingleton().register('beforeColumnMove');
|
16
28
|
_pluginHooks.default.getSingleton().register('afterColumnMove');
|
17
29
|
const PLUGIN_KEY = 'manualColumnMove';
|
18
30
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
19
31
|
const PLUGIN_PRIORITY = 120;
|
20
32
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
21
|
-
const privatePool = new WeakMap();
|
22
33
|
const CSS_PLUGIN = 'ht__manualColumnMove';
|
23
34
|
const CSS_SHOW_UI = 'show-ui';
|
24
35
|
const CSS_ON_MOVING = 'on-moving--columns';
|
@@ -51,56 +62,148 @@ const CSS_AFTER_SELECTION = 'after-selection--columns';
|
|
51
62
|
* @class ManualColumnMove
|
52
63
|
* @plugin ManualColumnMove
|
53
64
|
*/
|
65
|
+
var _columnsToMove = /*#__PURE__*/new WeakMap();
|
66
|
+
var _countCols = /*#__PURE__*/new WeakMap();
|
67
|
+
var _pressed = /*#__PURE__*/new WeakMap();
|
68
|
+
var _target = /*#__PURE__*/new WeakMap();
|
69
|
+
var _cachedDropIndex = /*#__PURE__*/new WeakMap();
|
70
|
+
var _hoveredColumn = /*#__PURE__*/new WeakMap();
|
71
|
+
var _rootElementOffset = /*#__PURE__*/new WeakMap();
|
72
|
+
var _hasRowHeaders = /*#__PURE__*/new WeakMap();
|
73
|
+
var _fixedColumnsStart = /*#__PURE__*/new WeakMap();
|
74
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
75
|
+
var _onMouseMove = /*#__PURE__*/new WeakSet();
|
76
|
+
var _onBeforeOnCellMouseOver = /*#__PURE__*/new WeakSet();
|
77
|
+
var _onMouseUp = /*#__PURE__*/new WeakSet();
|
78
|
+
var _onAfterScrollVertically = /*#__PURE__*/new WeakSet();
|
79
|
+
var _onAfterLoadData = /*#__PURE__*/new WeakSet();
|
54
80
|
class ManualColumnMove extends _base.BasePlugin {
|
55
|
-
|
56
|
-
|
57
|
-
}
|
58
|
-
static get PLUGIN_PRIORITY() {
|
59
|
-
return PLUGIN_PRIORITY;
|
60
|
-
}
|
61
|
-
constructor(hotInstance) {
|
62
|
-
super(hotInstance);
|
63
|
-
|
81
|
+
constructor() {
|
82
|
+
super(...arguments);
|
64
83
|
/**
|
65
|
-
*
|
84
|
+
* Callback for the `afterLoadData` hook.
|
85
|
+
*
|
86
|
+
* @private
|
66
87
|
*/
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
target: {
|
73
|
-
eventPageX: void 0,
|
74
|
-
coords: void 0,
|
75
|
-
TD: void 0,
|
76
|
-
col: void 0
|
77
|
-
},
|
78
|
-
cachedDropIndex: void 0
|
79
|
-
});
|
80
|
-
|
88
|
+
_classPrivateMethodInitSpec(this, _onAfterLoadData);
|
89
|
+
/**
|
90
|
+
* `afterScrollHorizontally` hook callback. Fired the table was scrolled horizontally.
|
91
|
+
*/
|
92
|
+
_classPrivateMethodInitSpec(this, _onAfterScrollVertically);
|
81
93
|
/**
|
82
|
-
*
|
94
|
+
* `onMouseUp` hook callback.
|
95
|
+
*/
|
96
|
+
_classPrivateMethodInitSpec(this, _onMouseUp);
|
97
|
+
/**
|
98
|
+
* 'beforeOnCellMouseOver' hook callback. Fired when pointer was over cell.
|
83
99
|
*
|
84
|
-
* @
|
85
|
-
* @
|
100
|
+
* @param {MouseEvent} event `mouseover` event properties.
|
101
|
+
* @param {CellCoords} coords Visual cell coordinates where was fired event.
|
102
|
+
* @param {HTMLElement} TD Cell represented as HTMLElement.
|
103
|
+
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
104
|
+
* a boolean value that allows or disallows changing the selection for that particular area.
|
86
105
|
*/
|
87
|
-
this
|
106
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseOver);
|
107
|
+
/**
|
108
|
+
* 'mouseMove' event callback. Fired when pointer move on document.documentElement.
|
109
|
+
*
|
110
|
+
* @param {MouseEvent} event `mousemove` event properties.
|
111
|
+
*/
|
112
|
+
_classPrivateMethodInitSpec(this, _onMouseMove);
|
113
|
+
/**
|
114
|
+
* Change the behavior of selection / dragging.
|
115
|
+
*
|
116
|
+
* @param {MouseEvent} event `mousedown` event properties.
|
117
|
+
* @param {CellCoords} coords Visual cell coordinates where was fired event.
|
118
|
+
* @param {HTMLElement} TD Cell represented as HTMLElement.
|
119
|
+
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
120
|
+
* a boolean value that allows or disallows changing the selection for that particular area.
|
121
|
+
*/
|
122
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
88
123
|
/**
|
89
124
|
* Backlight UI object.
|
90
125
|
*
|
91
126
|
* @private
|
92
127
|
* @type {object}
|
93
128
|
*/
|
94
|
-
this
|
129
|
+
_defineProperty(this, "backlight", new _backlight.default(this.hot));
|
95
130
|
/**
|
96
131
|
* Guideline UI object.
|
97
132
|
*
|
98
133
|
* @private
|
99
134
|
* @type {object}
|
100
135
|
*/
|
101
|
-
this
|
136
|
+
_defineProperty(this, "guideline", new _guideline.default(this.hot));
|
137
|
+
/**
|
138
|
+
* @type {number[]}
|
139
|
+
*/
|
140
|
+
_classPrivateFieldInitSpec(this, _columnsToMove, {
|
141
|
+
writable: true,
|
142
|
+
value: []
|
143
|
+
});
|
144
|
+
/**
|
145
|
+
* @type {number}
|
146
|
+
*/
|
147
|
+
_classPrivateFieldInitSpec(this, _countCols, {
|
148
|
+
writable: true,
|
149
|
+
value: 0
|
150
|
+
});
|
151
|
+
/**
|
152
|
+
* @type {boolean}
|
153
|
+
*/
|
154
|
+
_classPrivateFieldInitSpec(this, _pressed, {
|
155
|
+
writable: true,
|
156
|
+
value: false
|
157
|
+
});
|
158
|
+
/**
|
159
|
+
* @type {object}
|
160
|
+
*/
|
161
|
+
_classPrivateFieldInitSpec(this, _target, {
|
162
|
+
writable: true,
|
163
|
+
value: {}
|
164
|
+
});
|
165
|
+
/**
|
166
|
+
* @type {number}
|
167
|
+
*/
|
168
|
+
_classPrivateFieldInitSpec(this, _cachedDropIndex, {
|
169
|
+
writable: true,
|
170
|
+
value: void 0
|
171
|
+
});
|
172
|
+
/**
|
173
|
+
* @type {number}
|
174
|
+
*/
|
175
|
+
_classPrivateFieldInitSpec(this, _hoveredColumn, {
|
176
|
+
writable: true,
|
177
|
+
value: void 0
|
178
|
+
});
|
179
|
+
/**
|
180
|
+
* @type {number}
|
181
|
+
*/
|
182
|
+
_classPrivateFieldInitSpec(this, _rootElementOffset, {
|
183
|
+
writable: true,
|
184
|
+
value: void 0
|
185
|
+
});
|
186
|
+
/**
|
187
|
+
* @type {boolean}
|
188
|
+
*/
|
189
|
+
_classPrivateFieldInitSpec(this, _hasRowHeaders, {
|
190
|
+
writable: true,
|
191
|
+
value: void 0
|
192
|
+
});
|
193
|
+
/**
|
194
|
+
* @type {number}
|
195
|
+
*/
|
196
|
+
_classPrivateFieldInitSpec(this, _fixedColumnsStart, {
|
197
|
+
writable: true,
|
198
|
+
value: void 0
|
199
|
+
});
|
200
|
+
}
|
201
|
+
static get PLUGIN_KEY() {
|
202
|
+
return PLUGIN_KEY;
|
203
|
+
}
|
204
|
+
static get PLUGIN_PRIORITY() {
|
205
|
+
return PLUGIN_PRIORITY;
|
102
206
|
}
|
103
|
-
|
104
207
|
/**
|
105
208
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
106
209
|
* hook and if it returns `true` then the {@link ManualColumnMove#enablePlugin} method is called.
|
@@ -120,14 +223,23 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
120
223
|
return;
|
121
224
|
}
|
122
225
|
this.addHook('beforeOnCellMouseDown', function () {
|
123
|
-
|
226
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
227
|
+
args[_key] = arguments[_key];
|
228
|
+
}
|
229
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
124
230
|
});
|
125
231
|
this.addHook('beforeOnCellMouseOver', function () {
|
126
|
-
|
232
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
233
|
+
args[_key2] = arguments[_key2];
|
234
|
+
}
|
235
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseOver, _onBeforeOnCellMouseOver2).call(_this, ...args);
|
127
236
|
});
|
128
|
-
this.addHook('afterScrollVertically', () => this.
|
237
|
+
this.addHook('afterScrollVertically', () => _classPrivateMethodGet(this, _onAfterScrollVertically, _onAfterScrollVertically2).call(this));
|
129
238
|
this.addHook('afterLoadData', function () {
|
130
|
-
|
239
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
240
|
+
args[_key3] = arguments[_key3];
|
241
|
+
}
|
242
|
+
return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
|
131
243
|
});
|
132
244
|
this.buildPluginUI();
|
133
245
|
this.registerEvents();
|
@@ -186,11 +298,10 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
186
298
|
* @returns {boolean}
|
187
299
|
*/
|
188
300
|
moveColumns(columns, finalIndex) {
|
189
|
-
const
|
190
|
-
const dropIndex = priv.cachedDropIndex;
|
301
|
+
const dropIndex = _classPrivateFieldGet(this, _cachedDropIndex);
|
191
302
|
const movePossible = this.isMovePossible(columns, finalIndex);
|
192
303
|
const beforeMoveHook = this.hot.runHooks('beforeColumnMove', columns, finalIndex, dropIndex, movePossible);
|
193
|
-
|
304
|
+
_classPrivateFieldSet(this, _cachedDropIndex, undefined);
|
194
305
|
if (beforeMoveHook === false) {
|
195
306
|
return;
|
196
307
|
}
|
@@ -228,8 +339,7 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
228
339
|
*/
|
229
340
|
dragColumns(columns, dropIndex) {
|
230
341
|
const finalIndex = this.countFinalIndex(columns, dropIndex);
|
231
|
-
|
232
|
-
priv.cachedDropIndex = dropIndex;
|
342
|
+
_classPrivateFieldSet(this, _cachedDropIndex, dropIndex);
|
233
343
|
return this.moveColumns(columns, finalIndex);
|
234
344
|
}
|
235
345
|
|
@@ -320,7 +430,7 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
320
430
|
const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
|
321
431
|
if (Array.isArray(pluginSettings)) {
|
322
432
|
this.moveColumns(pluginSettings, 0);
|
323
|
-
} else if (pluginSettings !==
|
433
|
+
} else if (pluginSettings !== undefined) {
|
324
434
|
const persistentState = this.persistentStateLoad();
|
325
435
|
if (persistentState.length) {
|
326
436
|
this.moveColumns(persistentState, 0);
|
@@ -384,9 +494,8 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
384
494
|
* @private
|
385
495
|
*/
|
386
496
|
refreshPositions() {
|
387
|
-
const priv = privatePool.get(this);
|
388
497
|
const firstVisible = this.hot.view.getFirstFullyVisibleColumn();
|
389
|
-
if (this.isFixedColumnsStart(
|
498
|
+
if (this.isFixedColumnsStart(_classPrivateFieldGet(this, _hoveredColumn)) && firstVisible > 0) {
|
390
499
|
this.hot.scrollViewportTo({
|
391
500
|
col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(firstVisible - 1, -1)
|
392
501
|
});
|
@@ -394,7 +503,7 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
394
503
|
const wtTable = this.hot.view._wt.wtTable;
|
395
504
|
const scrollableElement = this.hot.view._wt.wtOverlays.scrollableElement;
|
396
505
|
const scrollStart = typeof scrollableElement.scrollX === 'number' ? scrollableElement.scrollX : scrollableElement.scrollLeft;
|
397
|
-
let tdOffsetStart = this.hot.view.THEAD.offsetLeft + this.getColumnsWidth(0,
|
506
|
+
let tdOffsetStart = this.hot.view.THEAD.offsetLeft + this.getColumnsWidth(0, _classPrivateFieldGet(this, _hoveredColumn) - 1);
|
398
507
|
const hiderWidth = wtTable.hider.offsetWidth;
|
399
508
|
const tbodyOffsetLeft = wtTable.TBODY.offsetLeft;
|
400
509
|
const backlightElemMarginStart = this.backlight.getOffset().start;
|
@@ -404,35 +513,35 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
404
513
|
if (this.hot.isRtl()) {
|
405
514
|
const rootWindow = this.hot.rootWindow;
|
406
515
|
const containerWidth = (0, _element.outerWidth)(this.hot.rootElement);
|
407
|
-
const gridMostRightPos = rootWindow.innerWidth -
|
408
|
-
mouseOffsetStart = rootWindow.innerWidth -
|
516
|
+
const gridMostRightPos = rootWindow.innerWidth - _classPrivateFieldGet(this, _rootElementOffset) - containerWidth;
|
517
|
+
mouseOffsetStart = rootWindow.innerWidth - _classPrivateFieldGet(this, _target).eventPageX - gridMostRightPos - (scrollableElement.scrollX === undefined ? scrollStart : 0);
|
409
518
|
} else {
|
410
|
-
mouseOffsetStart =
|
519
|
+
mouseOffsetStart = _classPrivateFieldGet(this, _target).eventPageX - (_classPrivateFieldGet(this, _rootElementOffset) - (scrollableElement.scrollX === undefined ? scrollStart : 0));
|
411
520
|
}
|
412
|
-
if (
|
521
|
+
if (_classPrivateFieldGet(this, _hasRowHeaders)) {
|
413
522
|
rowHeaderWidth = this.hot.view._wt.wtOverlays.inlineStartOverlay.clone.wtTable.getColumnHeader(-1).offsetWidth;
|
414
523
|
}
|
415
|
-
if (this.isFixedColumnsStart(
|
524
|
+
if (this.isFixedColumnsStart(_classPrivateFieldGet(this, _hoveredColumn))) {
|
416
525
|
tdOffsetStart += scrollStart;
|
417
526
|
}
|
418
527
|
tdOffsetStart += rowHeaderWidth;
|
419
|
-
if (
|
528
|
+
if (_classPrivateFieldGet(this, _hoveredColumn) < 0) {
|
420
529
|
// if hover on rowHeader
|
421
|
-
if (
|
422
|
-
|
530
|
+
if (_classPrivateFieldGet(this, _fixedColumnsStart) > 0) {
|
531
|
+
_classPrivateFieldGet(this, _target).col = 0;
|
423
532
|
} else {
|
424
|
-
|
533
|
+
_classPrivateFieldGet(this, _target).col = firstVisible > 0 ? firstVisible - 1 : firstVisible;
|
425
534
|
}
|
426
|
-
} else if (
|
427
|
-
const newCoordsCol =
|
535
|
+
} else if (_classPrivateFieldGet(this, _target).TD.offsetWidth / 2 + tdOffsetStart <= mouseOffsetStart) {
|
536
|
+
const newCoordsCol = _classPrivateFieldGet(this, _hoveredColumn) >= _classPrivateFieldGet(this, _countCols) ? _classPrivateFieldGet(this, _countCols) - 1 : _classPrivateFieldGet(this, _hoveredColumn);
|
428
537
|
|
429
538
|
// if hover on right part of TD
|
430
|
-
|
539
|
+
_classPrivateFieldGet(this, _target).col = newCoordsCol + 1;
|
431
540
|
// unfortunately first column is bigger than rest
|
432
|
-
tdOffsetStart +=
|
541
|
+
tdOffsetStart += _classPrivateFieldGet(this, _target).TD.offsetWidth;
|
433
542
|
} else {
|
434
543
|
// elsewhere on table
|
435
|
-
|
544
|
+
_classPrivateFieldGet(this, _target).col = _classPrivateFieldGet(this, _hoveredColumn);
|
436
545
|
}
|
437
546
|
let backlightStart = mouseOffsetStart;
|
438
547
|
let guidelineStart = tdOffsetStart;
|
@@ -449,8 +558,8 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
449
558
|
} else if (guidelineStart === 0) {
|
450
559
|
// guideline has got `margin-left: -1px` as default
|
451
560
|
guidelineStart = 1;
|
452
|
-
} else if (scrollableElement.scrollX !==
|
453
|
-
guidelineStart -=
|
561
|
+
} else if (scrollableElement.scrollX !== undefined && _classPrivateFieldGet(this, _hoveredColumn) < _classPrivateFieldGet(this, _fixedColumnsStart)) {
|
562
|
+
guidelineStart -= _classPrivateFieldGet(this, _rootElementOffset) <= scrollableElement.scrollX ? _classPrivateFieldGet(this, _rootElementOffset) : 0;
|
454
563
|
}
|
455
564
|
this.backlight.setPosition(null, backlightStart);
|
456
565
|
this.guideline.setPosition(null, guidelineStart);
|
@@ -465,8 +574,8 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
465
574
|
const {
|
466
575
|
documentElement
|
467
576
|
} = this.hot.rootDocument;
|
468
|
-
this.eventManager.addEventListener(documentElement, 'mousemove', event => this.
|
469
|
-
this.eventManager.addEventListener(documentElement, 'mouseup', () => this.
|
577
|
+
this.eventManager.addEventListener(documentElement, 'mousemove', event => _classPrivateMethodGet(this, _onMouseMove, _onMouseMove2).call(this, event));
|
578
|
+
this.eventManager.addEventListener(documentElement, 'mouseup', () => _classPrivateMethodGet(this, _onMouseUp, _onMouseUp2).call(this));
|
470
579
|
}
|
471
580
|
|
472
581
|
/**
|
@@ -477,163 +586,6 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
477
586
|
unregisterEvents() {
|
478
587
|
this.eventManager.clear();
|
479
588
|
}
|
480
|
-
|
481
|
-
/**
|
482
|
-
* Change the behavior of selection / dragging.
|
483
|
-
*
|
484
|
-
* @private
|
485
|
-
* @param {MouseEvent} event `mousedown` event properties.
|
486
|
-
* @param {CellCoords} coords Visual cell coordinates where was fired event.
|
487
|
-
* @param {HTMLElement} TD Cell represented as HTMLElement.
|
488
|
-
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
489
|
-
* a boolean value that allows or disallows changing the selection for that particular area.
|
490
|
-
*/
|
491
|
-
onBeforeOnCellMouseDown(event, coords, TD, controller) {
|
492
|
-
const wtTable = this.hot.view._wt.wtTable;
|
493
|
-
const isHeaderSelection = this.hot.selection.isSelectedByColumnHeader();
|
494
|
-
const selection = this.hot.getSelectedRangeLast();
|
495
|
-
const priv = privatePool.get(this);
|
496
|
-
// This block action shouldn't be handled below.
|
497
|
-
const isSortingElement = (0, _element.hasClass)(event.target, 'sortAction');
|
498
|
-
if (!selection || !isHeaderSelection || priv.pressed || event.button !== 0 || isSortingElement) {
|
499
|
-
priv.pressed = false;
|
500
|
-
priv.columnsToMove.length = 0;
|
501
|
-
(0, _element.removeClass)(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI]);
|
502
|
-
return;
|
503
|
-
}
|
504
|
-
const guidelineIsNotReady = this.guideline.isBuilt() && !this.guideline.isAppended();
|
505
|
-
const backlightIsNotReady = this.backlight.isBuilt() && !this.backlight.isAppended();
|
506
|
-
if (guidelineIsNotReady && backlightIsNotReady) {
|
507
|
-
this.guideline.appendTo(wtTable.hider);
|
508
|
-
this.backlight.appendTo(wtTable.hider);
|
509
|
-
}
|
510
|
-
const {
|
511
|
-
from,
|
512
|
-
to
|
513
|
-
} = selection;
|
514
|
-
const start = Math.min(from.col, to.col);
|
515
|
-
const end = Math.max(from.col, to.col);
|
516
|
-
if (coords.row < 0 && coords.col >= start && coords.col <= end) {
|
517
|
-
controller.column = true;
|
518
|
-
priv.pressed = true;
|
519
|
-
const eventOffsetX = TD.firstChild ? (0, _event.offsetRelativeTo)(event, TD.firstChild).x : event.offsetX;
|
520
|
-
priv.target.eventPageX = event.pageX;
|
521
|
-
priv.hoveredColumn = coords.col;
|
522
|
-
priv.target.TD = TD;
|
523
|
-
priv.target.col = coords.col;
|
524
|
-
priv.columnsToMove = this.prepareColumnsToMoving(start, end);
|
525
|
-
priv.hasRowHeaders = !!this.hot.getSettings().rowHeaders;
|
526
|
-
priv.countCols = this.hot.countCols();
|
527
|
-
priv.fixedColumnsStart = this.hot.getSettings().fixedColumnsStart;
|
528
|
-
priv.rootElementOffset = (0, _element.offset)(this.hot.rootElement).left;
|
529
|
-
const countColumnsFrom = priv.hasRowHeaders ? -1 : 0;
|
530
|
-
const topPos = wtTable.holder.scrollTop + wtTable.getColumnHeaderHeight(0) + 1;
|
531
|
-
const fixedColumnsStart = coords.col < priv.fixedColumnsStart;
|
532
|
-
const horizontalScrollPosition = this.hot.view._wt.wtOverlays.inlineStartOverlay.getOverlayOffset();
|
533
|
-
const offsetX = Math.abs(eventOffsetX - (this.hot.isRtl() ? TD.offsetWidth : 0));
|
534
|
-
const inlineOffset = this.getColumnsWidth(start, coords.col - 1) + offsetX;
|
535
|
-
const inlinePos = this.getColumnsWidth(countColumnsFrom, start - 1) + (fixedColumnsStart ? horizontalScrollPosition : 0) + inlineOffset;
|
536
|
-
this.backlight.setPosition(topPos, inlinePos);
|
537
|
-
this.backlight.setSize(this.getColumnsWidth(start, end), wtTable.hider.offsetHeight - topPos);
|
538
|
-
this.backlight.setOffset(null, -inlineOffset);
|
539
|
-
(0, _element.addClass)(this.hot.rootElement, CSS_ON_MOVING);
|
540
|
-
} else {
|
541
|
-
(0, _element.removeClass)(this.hot.rootElement, CSS_AFTER_SELECTION);
|
542
|
-
priv.pressed = false;
|
543
|
-
priv.columnsToMove.length = 0;
|
544
|
-
}
|
545
|
-
}
|
546
|
-
|
547
|
-
/**
|
548
|
-
* 'mouseMove' event callback. Fired when pointer move on document.documentElement.
|
549
|
-
*
|
550
|
-
* @private
|
551
|
-
* @param {MouseEvent} event `mousemove` event properties.
|
552
|
-
*/
|
553
|
-
onMouseMove(event) {
|
554
|
-
const priv = privatePool.get(this);
|
555
|
-
if (!priv.pressed) {
|
556
|
-
return;
|
557
|
-
}
|
558
|
-
priv.target.eventPageX = event.pageX;
|
559
|
-
this.refreshPositions();
|
560
|
-
}
|
561
|
-
|
562
|
-
/**
|
563
|
-
* 'beforeOnCellMouseOver' hook callback. Fired when pointer was over cell.
|
564
|
-
*
|
565
|
-
* @private
|
566
|
-
* @param {MouseEvent} event `mouseover` event properties.
|
567
|
-
* @param {CellCoords} coords Visual cell coordinates where was fired event.
|
568
|
-
* @param {HTMLElement} TD Cell represented as HTMLElement.
|
569
|
-
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
570
|
-
* a boolean value that allows or disallows changing the selection for that particular area.
|
571
|
-
*/
|
572
|
-
onBeforeOnCellMouseOver(event, coords, TD, controller) {
|
573
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
574
|
-
const priv = privatePool.get(this);
|
575
|
-
if (!selectedRange || !priv.pressed) {
|
576
|
-
return;
|
577
|
-
}
|
578
|
-
if (priv.columnsToMove.indexOf(coords.col) > -1) {
|
579
|
-
(0, _element.removeClass)(this.hot.rootElement, CSS_SHOW_UI);
|
580
|
-
} else {
|
581
|
-
(0, _element.addClass)(this.hot.rootElement, CSS_SHOW_UI);
|
582
|
-
}
|
583
|
-
controller.row = true;
|
584
|
-
controller.column = true;
|
585
|
-
controller.cell = true;
|
586
|
-
priv.hoveredColumn = coords.col;
|
587
|
-
priv.target.TD = TD;
|
588
|
-
}
|
589
|
-
|
590
|
-
/**
|
591
|
-
* `onMouseUp` hook callback.
|
592
|
-
*
|
593
|
-
* @private
|
594
|
-
*/
|
595
|
-
onMouseUp() {
|
596
|
-
const priv = privatePool.get(this);
|
597
|
-
const target = priv.target.col;
|
598
|
-
const columnsLen = priv.columnsToMove.length;
|
599
|
-
priv.hoveredColumn = void 0;
|
600
|
-
priv.pressed = false;
|
601
|
-
priv.backlightWidth = 0;
|
602
|
-
(0, _element.removeClass)(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI, CSS_AFTER_SELECTION]);
|
603
|
-
if (this.hot.selection.isSelectedByColumnHeader()) {
|
604
|
-
(0, _element.addClass)(this.hot.rootElement, CSS_AFTER_SELECTION);
|
605
|
-
}
|
606
|
-
if (columnsLen < 1 || target === void 0) {
|
607
|
-
return;
|
608
|
-
}
|
609
|
-
const firstMovedVisualColumn = priv.columnsToMove[0];
|
610
|
-
const firstMovedPhysicalColumn = this.hot.toPhysicalColumn(firstMovedVisualColumn);
|
611
|
-
const movePerformed = this.dragColumns(priv.columnsToMove, target);
|
612
|
-
priv.columnsToMove.length = 0;
|
613
|
-
if (movePerformed === true) {
|
614
|
-
this.persistentStateSave();
|
615
|
-
this.hot.render();
|
616
|
-
this.hot.view.adjustElementsSize(true);
|
617
|
-
const selectionStart = this.hot.toVisualColumn(firstMovedPhysicalColumn);
|
618
|
-
const selectionEnd = selectionStart + columnsLen - 1;
|
619
|
-
this.hot.selectColumns(selectionStart, selectionEnd);
|
620
|
-
}
|
621
|
-
}
|
622
|
-
|
623
|
-
/**
|
624
|
-
* `afterScrollHorizontally` hook callback. Fired the table was scrolled horizontally.
|
625
|
-
*
|
626
|
-
* @private
|
627
|
-
*/
|
628
|
-
onAfterScrollVertically() {
|
629
|
-
const wtTable = this.hot.view._wt.wtTable;
|
630
|
-
const headerHeight = wtTable.getColumnHeaderHeight(0) + 1;
|
631
|
-
const scrollTop = wtTable.holder.scrollTop;
|
632
|
-
const posTop = headerHeight + scrollTop;
|
633
|
-
this.backlight.setPosition(posTop);
|
634
|
-
this.backlight.setSize(null, wtTable.hider.offsetHeight - posTop);
|
635
|
-
}
|
636
|
-
|
637
589
|
/**
|
638
590
|
* Builds the plugin's UI.
|
639
591
|
*
|
@@ -643,16 +595,6 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
643
595
|
this.backlight.build();
|
644
596
|
this.guideline.build();
|
645
597
|
}
|
646
|
-
|
647
|
-
/**
|
648
|
-
* Callback for the `afterLoadData` hook.
|
649
|
-
*
|
650
|
-
* @private
|
651
|
-
*/
|
652
|
-
onAfterLoadData() {
|
653
|
-
this.moveBySettingsOrLoad();
|
654
|
-
}
|
655
|
-
|
656
598
|
/**
|
657
599
|
* Destroys the plugin instance.
|
658
600
|
*/
|
@@ -662,4 +604,117 @@ class ManualColumnMove extends _base.BasePlugin {
|
|
662
604
|
super.destroy();
|
663
605
|
}
|
664
606
|
}
|
665
|
-
exports.ManualColumnMove = ManualColumnMove;
|
607
|
+
exports.ManualColumnMove = ManualColumnMove;
|
608
|
+
function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
|
609
|
+
const wtTable = this.hot.view._wt.wtTable;
|
610
|
+
const isHeaderSelection = this.hot.selection.isSelectedByColumnHeader();
|
611
|
+
const selection = this.hot.getSelectedRangeLast();
|
612
|
+
// This block action shouldn't be handled below.
|
613
|
+
const isSortingElement = (0, _element.hasClass)(event.target, 'sortAction');
|
614
|
+
if (!selection || !isHeaderSelection || _classPrivateFieldGet(this, _pressed) || event.button !== 0 || isSortingElement) {
|
615
|
+
_classPrivateFieldSet(this, _pressed, false);
|
616
|
+
_classPrivateFieldGet(this, _columnsToMove).length = 0;
|
617
|
+
(0, _element.removeClass)(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI]);
|
618
|
+
return;
|
619
|
+
}
|
620
|
+
const guidelineIsNotReady = this.guideline.isBuilt() && !this.guideline.isAppended();
|
621
|
+
const backlightIsNotReady = this.backlight.isBuilt() && !this.backlight.isAppended();
|
622
|
+
if (guidelineIsNotReady && backlightIsNotReady) {
|
623
|
+
this.guideline.appendTo(wtTable.hider);
|
624
|
+
this.backlight.appendTo(wtTable.hider);
|
625
|
+
}
|
626
|
+
const {
|
627
|
+
from,
|
628
|
+
to
|
629
|
+
} = selection;
|
630
|
+
const start = Math.min(from.col, to.col);
|
631
|
+
const end = Math.max(from.col, to.col);
|
632
|
+
if (coords.row < 0 && coords.col >= start && coords.col <= end) {
|
633
|
+
controller.column = true;
|
634
|
+
_classPrivateFieldSet(this, _pressed, true);
|
635
|
+
const eventOffsetX = TD.firstChild ? (0, _event.offsetRelativeTo)(event, TD.firstChild).x : event.offsetX;
|
636
|
+
_classPrivateFieldGet(this, _target).eventPageX = event.pageX;
|
637
|
+
_classPrivateFieldSet(this, _hoveredColumn, coords.col);
|
638
|
+
_classPrivateFieldGet(this, _target).TD = TD;
|
639
|
+
_classPrivateFieldGet(this, _target).col = coords.col;
|
640
|
+
_classPrivateFieldSet(this, _columnsToMove, this.prepareColumnsToMoving(start, end));
|
641
|
+
_classPrivateFieldSet(this, _hasRowHeaders, !!this.hot.getSettings().rowHeaders);
|
642
|
+
_classPrivateFieldSet(this, _countCols, this.hot.countCols());
|
643
|
+
_classPrivateFieldSet(this, _fixedColumnsStart, this.hot.getSettings().fixedColumnsStart);
|
644
|
+
_classPrivateFieldSet(this, _rootElementOffset, (0, _element.offset)(this.hot.rootElement).left);
|
645
|
+
const countColumnsFrom = _classPrivateFieldGet(this, _hasRowHeaders) ? -1 : 0;
|
646
|
+
const topPos = wtTable.holder.scrollTop + wtTable.getColumnHeaderHeight(0) + 1;
|
647
|
+
const fixedColumnsStart = coords.col < _classPrivateFieldGet(this, _fixedColumnsStart);
|
648
|
+
const horizontalScrollPosition = this.hot.view._wt.wtOverlays.inlineStartOverlay.getOverlayOffset();
|
649
|
+
const offsetX = Math.abs(eventOffsetX - (this.hot.isRtl() ? TD.offsetWidth : 0));
|
650
|
+
const inlineOffset = this.getColumnsWidth(start, coords.col - 1) + offsetX;
|
651
|
+
const inlinePos = this.getColumnsWidth(countColumnsFrom, start - 1) + (fixedColumnsStart ? horizontalScrollPosition : 0) + inlineOffset;
|
652
|
+
this.backlight.setPosition(topPos, inlinePos);
|
653
|
+
this.backlight.setSize(this.getColumnsWidth(start, end), wtTable.hider.offsetHeight - topPos);
|
654
|
+
this.backlight.setOffset(null, -inlineOffset);
|
655
|
+
(0, _element.addClass)(this.hot.rootElement, CSS_ON_MOVING);
|
656
|
+
} else {
|
657
|
+
(0, _element.removeClass)(this.hot.rootElement, CSS_AFTER_SELECTION);
|
658
|
+
_classPrivateFieldSet(this, _pressed, false);
|
659
|
+
_classPrivateFieldGet(this, _columnsToMove).length = 0;
|
660
|
+
}
|
661
|
+
}
|
662
|
+
function _onMouseMove2(event) {
|
663
|
+
if (!_classPrivateFieldGet(this, _pressed)) {
|
664
|
+
return;
|
665
|
+
}
|
666
|
+
_classPrivateFieldGet(this, _target).eventPageX = event.pageX;
|
667
|
+
this.refreshPositions();
|
668
|
+
}
|
669
|
+
function _onBeforeOnCellMouseOver2(event, coords, TD, controller) {
|
670
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
671
|
+
if (!selectedRange || !_classPrivateFieldGet(this, _pressed)) {
|
672
|
+
return;
|
673
|
+
}
|
674
|
+
if (_classPrivateFieldGet(this, _columnsToMove).indexOf(coords.col) > -1) {
|
675
|
+
(0, _element.removeClass)(this.hot.rootElement, CSS_SHOW_UI);
|
676
|
+
} else {
|
677
|
+
(0, _element.addClass)(this.hot.rootElement, CSS_SHOW_UI);
|
678
|
+
}
|
679
|
+
controller.row = true;
|
680
|
+
controller.column = true;
|
681
|
+
controller.cell = true;
|
682
|
+
_classPrivateFieldSet(this, _hoveredColumn, coords.col);
|
683
|
+
_classPrivateFieldGet(this, _target).TD = TD;
|
684
|
+
}
|
685
|
+
function _onMouseUp2() {
|
686
|
+
const target = _classPrivateFieldGet(this, _target).col;
|
687
|
+
const columnsLen = _classPrivateFieldGet(this, _columnsToMove).length;
|
688
|
+
_classPrivateFieldSet(this, _hoveredColumn, undefined);
|
689
|
+
_classPrivateFieldSet(this, _pressed, false);
|
690
|
+
(0, _element.removeClass)(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI, CSS_AFTER_SELECTION]);
|
691
|
+
if (this.hot.selection.isSelectedByColumnHeader()) {
|
692
|
+
(0, _element.addClass)(this.hot.rootElement, CSS_AFTER_SELECTION);
|
693
|
+
}
|
694
|
+
if (columnsLen < 1 || target === undefined) {
|
695
|
+
return;
|
696
|
+
}
|
697
|
+
const firstMovedVisualColumn = _classPrivateFieldGet(this, _columnsToMove)[0];
|
698
|
+
const firstMovedPhysicalColumn = this.hot.toPhysicalColumn(firstMovedVisualColumn);
|
699
|
+
const movePerformed = this.dragColumns(_classPrivateFieldGet(this, _columnsToMove), target);
|
700
|
+
_classPrivateFieldGet(this, _columnsToMove).length = 0;
|
701
|
+
if (movePerformed === true) {
|
702
|
+
this.persistentStateSave();
|
703
|
+
this.hot.render();
|
704
|
+
this.hot.view.adjustElementsSize(true);
|
705
|
+
const selectionStart = this.hot.toVisualColumn(firstMovedPhysicalColumn);
|
706
|
+
const selectionEnd = selectionStart + columnsLen - 1;
|
707
|
+
this.hot.selectColumns(selectionStart, selectionEnd);
|
708
|
+
}
|
709
|
+
}
|
710
|
+
function _onAfterScrollVertically2() {
|
711
|
+
const wtTable = this.hot.view._wt.wtTable;
|
712
|
+
const headerHeight = wtTable.getColumnHeaderHeight(0) + 1;
|
713
|
+
const scrollTop = wtTable.holder.scrollTop;
|
714
|
+
const posTop = headerHeight + scrollTop;
|
715
|
+
this.backlight.setPosition(posTop);
|
716
|
+
this.backlight.setSize(null, wtTable.hider.offsetHeight - posTop);
|
717
|
+
}
|
718
|
+
function _onAfterLoadData2() {
|
719
|
+
this.moveBySettingsOrLoad();
|
720
|
+
}
|