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
@@ -1,18 +1,29 @@
|
|
1
1
|
import "core-js/modules/es.array.push.js";
|
2
|
+
import "core-js/modules/es.error.cause.js";
|
3
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
4
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
5
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
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
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
|
8
|
+
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); }
|
9
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
10
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
11
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
12
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
13
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
14
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
2
15
|
import { BasePlugin } from "../base/index.mjs";
|
3
16
|
import Hooks from "../../pluginHooks.mjs";
|
4
17
|
import { arrayReduce } from "../../helpers/array.mjs";
|
5
18
|
import { addClass, removeClass, offset, hasClass, outerWidth } from "../../helpers/dom/element.mjs";
|
6
19
|
import { offsetRelativeTo } from "../../helpers/dom/event.mjs";
|
7
20
|
import { rangeEach } from "../../helpers/number.mjs";
|
8
|
-
import EventManager from "../../eventManager.mjs";
|
9
21
|
import BacklightUI from "./ui/backlight.mjs";
|
10
22
|
import GuidelineUI from "./ui/guideline.mjs";
|
11
23
|
Hooks.getSingleton().register('beforeColumnMove');
|
12
24
|
Hooks.getSingleton().register('afterColumnMove');
|
13
25
|
export const PLUGIN_KEY = 'manualColumnMove';
|
14
26
|
export const PLUGIN_PRIORITY = 120;
|
15
|
-
const privatePool = new WeakMap();
|
16
27
|
const CSS_PLUGIN = 'ht__manualColumnMove';
|
17
28
|
const CSS_SHOW_UI = 'show-ui';
|
18
29
|
const CSS_ON_MOVING = 'on-moving--columns';
|
@@ -45,56 +56,148 @@ const CSS_AFTER_SELECTION = 'after-selection--columns';
|
|
45
56
|
* @class ManualColumnMove
|
46
57
|
* @plugin ManualColumnMove
|
47
58
|
*/
|
59
|
+
var _columnsToMove = /*#__PURE__*/new WeakMap();
|
60
|
+
var _countCols = /*#__PURE__*/new WeakMap();
|
61
|
+
var _pressed = /*#__PURE__*/new WeakMap();
|
62
|
+
var _target = /*#__PURE__*/new WeakMap();
|
63
|
+
var _cachedDropIndex = /*#__PURE__*/new WeakMap();
|
64
|
+
var _hoveredColumn = /*#__PURE__*/new WeakMap();
|
65
|
+
var _rootElementOffset = /*#__PURE__*/new WeakMap();
|
66
|
+
var _hasRowHeaders = /*#__PURE__*/new WeakMap();
|
67
|
+
var _fixedColumnsStart = /*#__PURE__*/new WeakMap();
|
68
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
69
|
+
var _onMouseMove = /*#__PURE__*/new WeakSet();
|
70
|
+
var _onBeforeOnCellMouseOver = /*#__PURE__*/new WeakSet();
|
71
|
+
var _onMouseUp = /*#__PURE__*/new WeakSet();
|
72
|
+
var _onAfterScrollVertically = /*#__PURE__*/new WeakSet();
|
73
|
+
var _onAfterLoadData = /*#__PURE__*/new WeakSet();
|
48
74
|
export class ManualColumnMove extends BasePlugin {
|
49
|
-
|
50
|
-
|
51
|
-
}
|
52
|
-
static get PLUGIN_PRIORITY() {
|
53
|
-
return PLUGIN_PRIORITY;
|
54
|
-
}
|
55
|
-
constructor(hotInstance) {
|
56
|
-
super(hotInstance);
|
57
|
-
|
75
|
+
constructor() {
|
76
|
+
super(...arguments);
|
58
77
|
/**
|
59
|
-
*
|
78
|
+
* Callback for the `afterLoadData` hook.
|
79
|
+
*
|
80
|
+
* @private
|
60
81
|
*/
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
target: {
|
67
|
-
eventPageX: void 0,
|
68
|
-
coords: void 0,
|
69
|
-
TD: void 0,
|
70
|
-
col: void 0
|
71
|
-
},
|
72
|
-
cachedDropIndex: void 0
|
73
|
-
});
|
74
|
-
|
82
|
+
_classPrivateMethodInitSpec(this, _onAfterLoadData);
|
83
|
+
/**
|
84
|
+
* `afterScrollHorizontally` hook callback. Fired the table was scrolled horizontally.
|
85
|
+
*/
|
86
|
+
_classPrivateMethodInitSpec(this, _onAfterScrollVertically);
|
75
87
|
/**
|
76
|
-
*
|
88
|
+
* `onMouseUp` hook callback.
|
89
|
+
*/
|
90
|
+
_classPrivateMethodInitSpec(this, _onMouseUp);
|
91
|
+
/**
|
92
|
+
* 'beforeOnCellMouseOver' hook callback. Fired when pointer was over cell.
|
77
93
|
*
|
78
|
-
* @
|
79
|
-
* @
|
94
|
+
* @param {MouseEvent} event `mouseover` event properties.
|
95
|
+
* @param {CellCoords} coords Visual cell coordinates where was fired event.
|
96
|
+
* @param {HTMLElement} TD Cell represented as HTMLElement.
|
97
|
+
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
98
|
+
* a boolean value that allows or disallows changing the selection for that particular area.
|
80
99
|
*/
|
81
|
-
this
|
100
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseOver);
|
101
|
+
/**
|
102
|
+
* 'mouseMove' event callback. Fired when pointer move on document.documentElement.
|
103
|
+
*
|
104
|
+
* @param {MouseEvent} event `mousemove` event properties.
|
105
|
+
*/
|
106
|
+
_classPrivateMethodInitSpec(this, _onMouseMove);
|
107
|
+
/**
|
108
|
+
* Change the behavior of selection / dragging.
|
109
|
+
*
|
110
|
+
* @param {MouseEvent} event `mousedown` event properties.
|
111
|
+
* @param {CellCoords} coords Visual cell coordinates where was fired event.
|
112
|
+
* @param {HTMLElement} TD Cell represented as HTMLElement.
|
113
|
+
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
114
|
+
* a boolean value that allows or disallows changing the selection for that particular area.
|
115
|
+
*/
|
116
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
82
117
|
/**
|
83
118
|
* Backlight UI object.
|
84
119
|
*
|
85
120
|
* @private
|
86
121
|
* @type {object}
|
87
122
|
*/
|
88
|
-
this
|
123
|
+
_defineProperty(this, "backlight", new BacklightUI(this.hot));
|
89
124
|
/**
|
90
125
|
* Guideline UI object.
|
91
126
|
*
|
92
127
|
* @private
|
93
128
|
* @type {object}
|
94
129
|
*/
|
95
|
-
this
|
130
|
+
_defineProperty(this, "guideline", new GuidelineUI(this.hot));
|
131
|
+
/**
|
132
|
+
* @type {number[]}
|
133
|
+
*/
|
134
|
+
_classPrivateFieldInitSpec(this, _columnsToMove, {
|
135
|
+
writable: true,
|
136
|
+
value: []
|
137
|
+
});
|
138
|
+
/**
|
139
|
+
* @type {number}
|
140
|
+
*/
|
141
|
+
_classPrivateFieldInitSpec(this, _countCols, {
|
142
|
+
writable: true,
|
143
|
+
value: 0
|
144
|
+
});
|
145
|
+
/**
|
146
|
+
* @type {boolean}
|
147
|
+
*/
|
148
|
+
_classPrivateFieldInitSpec(this, _pressed, {
|
149
|
+
writable: true,
|
150
|
+
value: false
|
151
|
+
});
|
152
|
+
/**
|
153
|
+
* @type {object}
|
154
|
+
*/
|
155
|
+
_classPrivateFieldInitSpec(this, _target, {
|
156
|
+
writable: true,
|
157
|
+
value: {}
|
158
|
+
});
|
159
|
+
/**
|
160
|
+
* @type {number}
|
161
|
+
*/
|
162
|
+
_classPrivateFieldInitSpec(this, _cachedDropIndex, {
|
163
|
+
writable: true,
|
164
|
+
value: void 0
|
165
|
+
});
|
166
|
+
/**
|
167
|
+
* @type {number}
|
168
|
+
*/
|
169
|
+
_classPrivateFieldInitSpec(this, _hoveredColumn, {
|
170
|
+
writable: true,
|
171
|
+
value: void 0
|
172
|
+
});
|
173
|
+
/**
|
174
|
+
* @type {number}
|
175
|
+
*/
|
176
|
+
_classPrivateFieldInitSpec(this, _rootElementOffset, {
|
177
|
+
writable: true,
|
178
|
+
value: void 0
|
179
|
+
});
|
180
|
+
/**
|
181
|
+
* @type {boolean}
|
182
|
+
*/
|
183
|
+
_classPrivateFieldInitSpec(this, _hasRowHeaders, {
|
184
|
+
writable: true,
|
185
|
+
value: void 0
|
186
|
+
});
|
187
|
+
/**
|
188
|
+
* @type {number}
|
189
|
+
*/
|
190
|
+
_classPrivateFieldInitSpec(this, _fixedColumnsStart, {
|
191
|
+
writable: true,
|
192
|
+
value: void 0
|
193
|
+
});
|
194
|
+
}
|
195
|
+
static get PLUGIN_KEY() {
|
196
|
+
return PLUGIN_KEY;
|
197
|
+
}
|
198
|
+
static get PLUGIN_PRIORITY() {
|
199
|
+
return PLUGIN_PRIORITY;
|
96
200
|
}
|
97
|
-
|
98
201
|
/**
|
99
202
|
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
100
203
|
* hook and if it returns `true` then the {@link ManualColumnMove#enablePlugin} method is called.
|
@@ -114,14 +217,23 @@ export class ManualColumnMove extends BasePlugin {
|
|
114
217
|
return;
|
115
218
|
}
|
116
219
|
this.addHook('beforeOnCellMouseDown', function () {
|
117
|
-
|
220
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
221
|
+
args[_key] = arguments[_key];
|
222
|
+
}
|
223
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
118
224
|
});
|
119
225
|
this.addHook('beforeOnCellMouseOver', function () {
|
120
|
-
|
226
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
227
|
+
args[_key2] = arguments[_key2];
|
228
|
+
}
|
229
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseOver, _onBeforeOnCellMouseOver2).call(_this, ...args);
|
121
230
|
});
|
122
|
-
this.addHook('afterScrollVertically', () => this.
|
231
|
+
this.addHook('afterScrollVertically', () => _classPrivateMethodGet(this, _onAfterScrollVertically, _onAfterScrollVertically2).call(this));
|
123
232
|
this.addHook('afterLoadData', function () {
|
124
|
-
|
233
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
234
|
+
args[_key3] = arguments[_key3];
|
235
|
+
}
|
236
|
+
return _classPrivateMethodGet(_this, _onAfterLoadData, _onAfterLoadData2).call(_this, ...args);
|
125
237
|
});
|
126
238
|
this.buildPluginUI();
|
127
239
|
this.registerEvents();
|
@@ -180,11 +292,10 @@ export class ManualColumnMove extends BasePlugin {
|
|
180
292
|
* @returns {boolean}
|
181
293
|
*/
|
182
294
|
moveColumns(columns, finalIndex) {
|
183
|
-
const
|
184
|
-
const dropIndex = priv.cachedDropIndex;
|
295
|
+
const dropIndex = _classPrivateFieldGet(this, _cachedDropIndex);
|
185
296
|
const movePossible = this.isMovePossible(columns, finalIndex);
|
186
297
|
const beforeMoveHook = this.hot.runHooks('beforeColumnMove', columns, finalIndex, dropIndex, movePossible);
|
187
|
-
|
298
|
+
_classPrivateFieldSet(this, _cachedDropIndex, undefined);
|
188
299
|
if (beforeMoveHook === false) {
|
189
300
|
return;
|
190
301
|
}
|
@@ -222,8 +333,7 @@ export class ManualColumnMove extends BasePlugin {
|
|
222
333
|
*/
|
223
334
|
dragColumns(columns, dropIndex) {
|
224
335
|
const finalIndex = this.countFinalIndex(columns, dropIndex);
|
225
|
-
|
226
|
-
priv.cachedDropIndex = dropIndex;
|
336
|
+
_classPrivateFieldSet(this, _cachedDropIndex, dropIndex);
|
227
337
|
return this.moveColumns(columns, finalIndex);
|
228
338
|
}
|
229
339
|
|
@@ -314,7 +424,7 @@ export class ManualColumnMove extends BasePlugin {
|
|
314
424
|
const pluginSettings = this.hot.getSettings()[PLUGIN_KEY];
|
315
425
|
if (Array.isArray(pluginSettings)) {
|
316
426
|
this.moveColumns(pluginSettings, 0);
|
317
|
-
} else if (pluginSettings !==
|
427
|
+
} else if (pluginSettings !== undefined) {
|
318
428
|
const persistentState = this.persistentStateLoad();
|
319
429
|
if (persistentState.length) {
|
320
430
|
this.moveColumns(persistentState, 0);
|
@@ -378,9 +488,8 @@ export class ManualColumnMove extends BasePlugin {
|
|
378
488
|
* @private
|
379
489
|
*/
|
380
490
|
refreshPositions() {
|
381
|
-
const priv = privatePool.get(this);
|
382
491
|
const firstVisible = this.hot.view.getFirstFullyVisibleColumn();
|
383
|
-
if (this.isFixedColumnsStart(
|
492
|
+
if (this.isFixedColumnsStart(_classPrivateFieldGet(this, _hoveredColumn)) && firstVisible > 0) {
|
384
493
|
this.hot.scrollViewportTo({
|
385
494
|
col: this.hot.columnIndexMapper.getNearestNotHiddenIndex(firstVisible - 1, -1)
|
386
495
|
});
|
@@ -388,7 +497,7 @@ export class ManualColumnMove extends BasePlugin {
|
|
388
497
|
const wtTable = this.hot.view._wt.wtTable;
|
389
498
|
const scrollableElement = this.hot.view._wt.wtOverlays.scrollableElement;
|
390
499
|
const scrollStart = typeof scrollableElement.scrollX === 'number' ? scrollableElement.scrollX : scrollableElement.scrollLeft;
|
391
|
-
let tdOffsetStart = this.hot.view.THEAD.offsetLeft + this.getColumnsWidth(0,
|
500
|
+
let tdOffsetStart = this.hot.view.THEAD.offsetLeft + this.getColumnsWidth(0, _classPrivateFieldGet(this, _hoveredColumn) - 1);
|
392
501
|
const hiderWidth = wtTable.hider.offsetWidth;
|
393
502
|
const tbodyOffsetLeft = wtTable.TBODY.offsetLeft;
|
394
503
|
const backlightElemMarginStart = this.backlight.getOffset().start;
|
@@ -398,35 +507,35 @@ export class ManualColumnMove extends BasePlugin {
|
|
398
507
|
if (this.hot.isRtl()) {
|
399
508
|
const rootWindow = this.hot.rootWindow;
|
400
509
|
const containerWidth = outerWidth(this.hot.rootElement);
|
401
|
-
const gridMostRightPos = rootWindow.innerWidth -
|
402
|
-
mouseOffsetStart = rootWindow.innerWidth -
|
510
|
+
const gridMostRightPos = rootWindow.innerWidth - _classPrivateFieldGet(this, _rootElementOffset) - containerWidth;
|
511
|
+
mouseOffsetStart = rootWindow.innerWidth - _classPrivateFieldGet(this, _target).eventPageX - gridMostRightPos - (scrollableElement.scrollX === undefined ? scrollStart : 0);
|
403
512
|
} else {
|
404
|
-
mouseOffsetStart =
|
513
|
+
mouseOffsetStart = _classPrivateFieldGet(this, _target).eventPageX - (_classPrivateFieldGet(this, _rootElementOffset) - (scrollableElement.scrollX === undefined ? scrollStart : 0));
|
405
514
|
}
|
406
|
-
if (
|
515
|
+
if (_classPrivateFieldGet(this, _hasRowHeaders)) {
|
407
516
|
rowHeaderWidth = this.hot.view._wt.wtOverlays.inlineStartOverlay.clone.wtTable.getColumnHeader(-1).offsetWidth;
|
408
517
|
}
|
409
|
-
if (this.isFixedColumnsStart(
|
518
|
+
if (this.isFixedColumnsStart(_classPrivateFieldGet(this, _hoveredColumn))) {
|
410
519
|
tdOffsetStart += scrollStart;
|
411
520
|
}
|
412
521
|
tdOffsetStart += rowHeaderWidth;
|
413
|
-
if (
|
522
|
+
if (_classPrivateFieldGet(this, _hoveredColumn) < 0) {
|
414
523
|
// if hover on rowHeader
|
415
|
-
if (
|
416
|
-
|
524
|
+
if (_classPrivateFieldGet(this, _fixedColumnsStart) > 0) {
|
525
|
+
_classPrivateFieldGet(this, _target).col = 0;
|
417
526
|
} else {
|
418
|
-
|
527
|
+
_classPrivateFieldGet(this, _target).col = firstVisible > 0 ? firstVisible - 1 : firstVisible;
|
419
528
|
}
|
420
|
-
} else if (
|
421
|
-
const newCoordsCol =
|
529
|
+
} else if (_classPrivateFieldGet(this, _target).TD.offsetWidth / 2 + tdOffsetStart <= mouseOffsetStart) {
|
530
|
+
const newCoordsCol = _classPrivateFieldGet(this, _hoveredColumn) >= _classPrivateFieldGet(this, _countCols) ? _classPrivateFieldGet(this, _countCols) - 1 : _classPrivateFieldGet(this, _hoveredColumn);
|
422
531
|
|
423
532
|
// if hover on right part of TD
|
424
|
-
|
533
|
+
_classPrivateFieldGet(this, _target).col = newCoordsCol + 1;
|
425
534
|
// unfortunately first column is bigger than rest
|
426
|
-
tdOffsetStart +=
|
535
|
+
tdOffsetStart += _classPrivateFieldGet(this, _target).TD.offsetWidth;
|
427
536
|
} else {
|
428
537
|
// elsewhere on table
|
429
|
-
|
538
|
+
_classPrivateFieldGet(this, _target).col = _classPrivateFieldGet(this, _hoveredColumn);
|
430
539
|
}
|
431
540
|
let backlightStart = mouseOffsetStart;
|
432
541
|
let guidelineStart = tdOffsetStart;
|
@@ -443,8 +552,8 @@ export class ManualColumnMove extends BasePlugin {
|
|
443
552
|
} else if (guidelineStart === 0) {
|
444
553
|
// guideline has got `margin-left: -1px` as default
|
445
554
|
guidelineStart = 1;
|
446
|
-
} else if (scrollableElement.scrollX !==
|
447
|
-
guidelineStart -=
|
555
|
+
} else if (scrollableElement.scrollX !== undefined && _classPrivateFieldGet(this, _hoveredColumn) < _classPrivateFieldGet(this, _fixedColumnsStart)) {
|
556
|
+
guidelineStart -= _classPrivateFieldGet(this, _rootElementOffset) <= scrollableElement.scrollX ? _classPrivateFieldGet(this, _rootElementOffset) : 0;
|
448
557
|
}
|
449
558
|
this.backlight.setPosition(null, backlightStart);
|
450
559
|
this.guideline.setPosition(null, guidelineStart);
|
@@ -459,8 +568,8 @@ export class ManualColumnMove extends BasePlugin {
|
|
459
568
|
const {
|
460
569
|
documentElement
|
461
570
|
} = this.hot.rootDocument;
|
462
|
-
this.eventManager.addEventListener(documentElement, 'mousemove', event => this.
|
463
|
-
this.eventManager.addEventListener(documentElement, 'mouseup', () => this.
|
571
|
+
this.eventManager.addEventListener(documentElement, 'mousemove', event => _classPrivateMethodGet(this, _onMouseMove, _onMouseMove2).call(this, event));
|
572
|
+
this.eventManager.addEventListener(documentElement, 'mouseup', () => _classPrivateMethodGet(this, _onMouseUp, _onMouseUp2).call(this));
|
464
573
|
}
|
465
574
|
|
466
575
|
/**
|
@@ -471,163 +580,6 @@ export class ManualColumnMove extends BasePlugin {
|
|
471
580
|
unregisterEvents() {
|
472
581
|
this.eventManager.clear();
|
473
582
|
}
|
474
|
-
|
475
|
-
/**
|
476
|
-
* Change the behavior of selection / dragging.
|
477
|
-
*
|
478
|
-
* @private
|
479
|
-
* @param {MouseEvent} event `mousedown` event properties.
|
480
|
-
* @param {CellCoords} coords Visual cell coordinates where was fired event.
|
481
|
-
* @param {HTMLElement} TD Cell represented as HTMLElement.
|
482
|
-
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
483
|
-
* a boolean value that allows or disallows changing the selection for that particular area.
|
484
|
-
*/
|
485
|
-
onBeforeOnCellMouseDown(event, coords, TD, controller) {
|
486
|
-
const wtTable = this.hot.view._wt.wtTable;
|
487
|
-
const isHeaderSelection = this.hot.selection.isSelectedByColumnHeader();
|
488
|
-
const selection = this.hot.getSelectedRangeLast();
|
489
|
-
const priv = privatePool.get(this);
|
490
|
-
// This block action shouldn't be handled below.
|
491
|
-
const isSortingElement = hasClass(event.target, 'sortAction');
|
492
|
-
if (!selection || !isHeaderSelection || priv.pressed || event.button !== 0 || isSortingElement) {
|
493
|
-
priv.pressed = false;
|
494
|
-
priv.columnsToMove.length = 0;
|
495
|
-
removeClass(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI]);
|
496
|
-
return;
|
497
|
-
}
|
498
|
-
const guidelineIsNotReady = this.guideline.isBuilt() && !this.guideline.isAppended();
|
499
|
-
const backlightIsNotReady = this.backlight.isBuilt() && !this.backlight.isAppended();
|
500
|
-
if (guidelineIsNotReady && backlightIsNotReady) {
|
501
|
-
this.guideline.appendTo(wtTable.hider);
|
502
|
-
this.backlight.appendTo(wtTable.hider);
|
503
|
-
}
|
504
|
-
const {
|
505
|
-
from,
|
506
|
-
to
|
507
|
-
} = selection;
|
508
|
-
const start = Math.min(from.col, to.col);
|
509
|
-
const end = Math.max(from.col, to.col);
|
510
|
-
if (coords.row < 0 && coords.col >= start && coords.col <= end) {
|
511
|
-
controller.column = true;
|
512
|
-
priv.pressed = true;
|
513
|
-
const eventOffsetX = TD.firstChild ? offsetRelativeTo(event, TD.firstChild).x : event.offsetX;
|
514
|
-
priv.target.eventPageX = event.pageX;
|
515
|
-
priv.hoveredColumn = coords.col;
|
516
|
-
priv.target.TD = TD;
|
517
|
-
priv.target.col = coords.col;
|
518
|
-
priv.columnsToMove = this.prepareColumnsToMoving(start, end);
|
519
|
-
priv.hasRowHeaders = !!this.hot.getSettings().rowHeaders;
|
520
|
-
priv.countCols = this.hot.countCols();
|
521
|
-
priv.fixedColumnsStart = this.hot.getSettings().fixedColumnsStart;
|
522
|
-
priv.rootElementOffset = offset(this.hot.rootElement).left;
|
523
|
-
const countColumnsFrom = priv.hasRowHeaders ? -1 : 0;
|
524
|
-
const topPos = wtTable.holder.scrollTop + wtTable.getColumnHeaderHeight(0) + 1;
|
525
|
-
const fixedColumnsStart = coords.col < priv.fixedColumnsStart;
|
526
|
-
const horizontalScrollPosition = this.hot.view._wt.wtOverlays.inlineStartOverlay.getOverlayOffset();
|
527
|
-
const offsetX = Math.abs(eventOffsetX - (this.hot.isRtl() ? TD.offsetWidth : 0));
|
528
|
-
const inlineOffset = this.getColumnsWidth(start, coords.col - 1) + offsetX;
|
529
|
-
const inlinePos = this.getColumnsWidth(countColumnsFrom, start - 1) + (fixedColumnsStart ? horizontalScrollPosition : 0) + inlineOffset;
|
530
|
-
this.backlight.setPosition(topPos, inlinePos);
|
531
|
-
this.backlight.setSize(this.getColumnsWidth(start, end), wtTable.hider.offsetHeight - topPos);
|
532
|
-
this.backlight.setOffset(null, -inlineOffset);
|
533
|
-
addClass(this.hot.rootElement, CSS_ON_MOVING);
|
534
|
-
} else {
|
535
|
-
removeClass(this.hot.rootElement, CSS_AFTER_SELECTION);
|
536
|
-
priv.pressed = false;
|
537
|
-
priv.columnsToMove.length = 0;
|
538
|
-
}
|
539
|
-
}
|
540
|
-
|
541
|
-
/**
|
542
|
-
* 'mouseMove' event callback. Fired when pointer move on document.documentElement.
|
543
|
-
*
|
544
|
-
* @private
|
545
|
-
* @param {MouseEvent} event `mousemove` event properties.
|
546
|
-
*/
|
547
|
-
onMouseMove(event) {
|
548
|
-
const priv = privatePool.get(this);
|
549
|
-
if (!priv.pressed) {
|
550
|
-
return;
|
551
|
-
}
|
552
|
-
priv.target.eventPageX = event.pageX;
|
553
|
-
this.refreshPositions();
|
554
|
-
}
|
555
|
-
|
556
|
-
/**
|
557
|
-
* 'beforeOnCellMouseOver' hook callback. Fired when pointer was over cell.
|
558
|
-
*
|
559
|
-
* @private
|
560
|
-
* @param {MouseEvent} event `mouseover` event properties.
|
561
|
-
* @param {CellCoords} coords Visual cell coordinates where was fired event.
|
562
|
-
* @param {HTMLElement} TD Cell represented as HTMLElement.
|
563
|
-
* @param {object} controller An object with properties `row`, `column` and `cell`. Each property contains
|
564
|
-
* a boolean value that allows or disallows changing the selection for that particular area.
|
565
|
-
*/
|
566
|
-
onBeforeOnCellMouseOver(event, coords, TD, controller) {
|
567
|
-
const selectedRange = this.hot.getSelectedRangeLast();
|
568
|
-
const priv = privatePool.get(this);
|
569
|
-
if (!selectedRange || !priv.pressed) {
|
570
|
-
return;
|
571
|
-
}
|
572
|
-
if (priv.columnsToMove.indexOf(coords.col) > -1) {
|
573
|
-
removeClass(this.hot.rootElement, CSS_SHOW_UI);
|
574
|
-
} else {
|
575
|
-
addClass(this.hot.rootElement, CSS_SHOW_UI);
|
576
|
-
}
|
577
|
-
controller.row = true;
|
578
|
-
controller.column = true;
|
579
|
-
controller.cell = true;
|
580
|
-
priv.hoveredColumn = coords.col;
|
581
|
-
priv.target.TD = TD;
|
582
|
-
}
|
583
|
-
|
584
|
-
/**
|
585
|
-
* `onMouseUp` hook callback.
|
586
|
-
*
|
587
|
-
* @private
|
588
|
-
*/
|
589
|
-
onMouseUp() {
|
590
|
-
const priv = privatePool.get(this);
|
591
|
-
const target = priv.target.col;
|
592
|
-
const columnsLen = priv.columnsToMove.length;
|
593
|
-
priv.hoveredColumn = void 0;
|
594
|
-
priv.pressed = false;
|
595
|
-
priv.backlightWidth = 0;
|
596
|
-
removeClass(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI, CSS_AFTER_SELECTION]);
|
597
|
-
if (this.hot.selection.isSelectedByColumnHeader()) {
|
598
|
-
addClass(this.hot.rootElement, CSS_AFTER_SELECTION);
|
599
|
-
}
|
600
|
-
if (columnsLen < 1 || target === void 0) {
|
601
|
-
return;
|
602
|
-
}
|
603
|
-
const firstMovedVisualColumn = priv.columnsToMove[0];
|
604
|
-
const firstMovedPhysicalColumn = this.hot.toPhysicalColumn(firstMovedVisualColumn);
|
605
|
-
const movePerformed = this.dragColumns(priv.columnsToMove, target);
|
606
|
-
priv.columnsToMove.length = 0;
|
607
|
-
if (movePerformed === true) {
|
608
|
-
this.persistentStateSave();
|
609
|
-
this.hot.render();
|
610
|
-
this.hot.view.adjustElementsSize(true);
|
611
|
-
const selectionStart = this.hot.toVisualColumn(firstMovedPhysicalColumn);
|
612
|
-
const selectionEnd = selectionStart + columnsLen - 1;
|
613
|
-
this.hot.selectColumns(selectionStart, selectionEnd);
|
614
|
-
}
|
615
|
-
}
|
616
|
-
|
617
|
-
/**
|
618
|
-
* `afterScrollHorizontally` hook callback. Fired the table was scrolled horizontally.
|
619
|
-
*
|
620
|
-
* @private
|
621
|
-
*/
|
622
|
-
onAfterScrollVertically() {
|
623
|
-
const wtTable = this.hot.view._wt.wtTable;
|
624
|
-
const headerHeight = wtTable.getColumnHeaderHeight(0) + 1;
|
625
|
-
const scrollTop = wtTable.holder.scrollTop;
|
626
|
-
const posTop = headerHeight + scrollTop;
|
627
|
-
this.backlight.setPosition(posTop);
|
628
|
-
this.backlight.setSize(null, wtTable.hider.offsetHeight - posTop);
|
629
|
-
}
|
630
|
-
|
631
583
|
/**
|
632
584
|
* Builds the plugin's UI.
|
633
585
|
*
|
@@ -637,16 +589,6 @@ export class ManualColumnMove extends BasePlugin {
|
|
637
589
|
this.backlight.build();
|
638
590
|
this.guideline.build();
|
639
591
|
}
|
640
|
-
|
641
|
-
/**
|
642
|
-
* Callback for the `afterLoadData` hook.
|
643
|
-
*
|
644
|
-
* @private
|
645
|
-
*/
|
646
|
-
onAfterLoadData() {
|
647
|
-
this.moveBySettingsOrLoad();
|
648
|
-
}
|
649
|
-
|
650
592
|
/**
|
651
593
|
* Destroys the plugin instance.
|
652
594
|
*/
|
@@ -655,4 +597,117 @@ export class ManualColumnMove extends BasePlugin {
|
|
655
597
|
this.guideline.destroy();
|
656
598
|
super.destroy();
|
657
599
|
}
|
600
|
+
}
|
601
|
+
function _onBeforeOnCellMouseDown2(event, coords, TD, controller) {
|
602
|
+
const wtTable = this.hot.view._wt.wtTable;
|
603
|
+
const isHeaderSelection = this.hot.selection.isSelectedByColumnHeader();
|
604
|
+
const selection = this.hot.getSelectedRangeLast();
|
605
|
+
// This block action shouldn't be handled below.
|
606
|
+
const isSortingElement = hasClass(event.target, 'sortAction');
|
607
|
+
if (!selection || !isHeaderSelection || _classPrivateFieldGet(this, _pressed) || event.button !== 0 || isSortingElement) {
|
608
|
+
_classPrivateFieldSet(this, _pressed, false);
|
609
|
+
_classPrivateFieldGet(this, _columnsToMove).length = 0;
|
610
|
+
removeClass(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI]);
|
611
|
+
return;
|
612
|
+
}
|
613
|
+
const guidelineIsNotReady = this.guideline.isBuilt() && !this.guideline.isAppended();
|
614
|
+
const backlightIsNotReady = this.backlight.isBuilt() && !this.backlight.isAppended();
|
615
|
+
if (guidelineIsNotReady && backlightIsNotReady) {
|
616
|
+
this.guideline.appendTo(wtTable.hider);
|
617
|
+
this.backlight.appendTo(wtTable.hider);
|
618
|
+
}
|
619
|
+
const {
|
620
|
+
from,
|
621
|
+
to
|
622
|
+
} = selection;
|
623
|
+
const start = Math.min(from.col, to.col);
|
624
|
+
const end = Math.max(from.col, to.col);
|
625
|
+
if (coords.row < 0 && coords.col >= start && coords.col <= end) {
|
626
|
+
controller.column = true;
|
627
|
+
_classPrivateFieldSet(this, _pressed, true);
|
628
|
+
const eventOffsetX = TD.firstChild ? offsetRelativeTo(event, TD.firstChild).x : event.offsetX;
|
629
|
+
_classPrivateFieldGet(this, _target).eventPageX = event.pageX;
|
630
|
+
_classPrivateFieldSet(this, _hoveredColumn, coords.col);
|
631
|
+
_classPrivateFieldGet(this, _target).TD = TD;
|
632
|
+
_classPrivateFieldGet(this, _target).col = coords.col;
|
633
|
+
_classPrivateFieldSet(this, _columnsToMove, this.prepareColumnsToMoving(start, end));
|
634
|
+
_classPrivateFieldSet(this, _hasRowHeaders, !!this.hot.getSettings().rowHeaders);
|
635
|
+
_classPrivateFieldSet(this, _countCols, this.hot.countCols());
|
636
|
+
_classPrivateFieldSet(this, _fixedColumnsStart, this.hot.getSettings().fixedColumnsStart);
|
637
|
+
_classPrivateFieldSet(this, _rootElementOffset, offset(this.hot.rootElement).left);
|
638
|
+
const countColumnsFrom = _classPrivateFieldGet(this, _hasRowHeaders) ? -1 : 0;
|
639
|
+
const topPos = wtTable.holder.scrollTop + wtTable.getColumnHeaderHeight(0) + 1;
|
640
|
+
const fixedColumnsStart = coords.col < _classPrivateFieldGet(this, _fixedColumnsStart);
|
641
|
+
const horizontalScrollPosition = this.hot.view._wt.wtOverlays.inlineStartOverlay.getOverlayOffset();
|
642
|
+
const offsetX = Math.abs(eventOffsetX - (this.hot.isRtl() ? TD.offsetWidth : 0));
|
643
|
+
const inlineOffset = this.getColumnsWidth(start, coords.col - 1) + offsetX;
|
644
|
+
const inlinePos = this.getColumnsWidth(countColumnsFrom, start - 1) + (fixedColumnsStart ? horizontalScrollPosition : 0) + inlineOffset;
|
645
|
+
this.backlight.setPosition(topPos, inlinePos);
|
646
|
+
this.backlight.setSize(this.getColumnsWidth(start, end), wtTable.hider.offsetHeight - topPos);
|
647
|
+
this.backlight.setOffset(null, -inlineOffset);
|
648
|
+
addClass(this.hot.rootElement, CSS_ON_MOVING);
|
649
|
+
} else {
|
650
|
+
removeClass(this.hot.rootElement, CSS_AFTER_SELECTION);
|
651
|
+
_classPrivateFieldSet(this, _pressed, false);
|
652
|
+
_classPrivateFieldGet(this, _columnsToMove).length = 0;
|
653
|
+
}
|
654
|
+
}
|
655
|
+
function _onMouseMove2(event) {
|
656
|
+
if (!_classPrivateFieldGet(this, _pressed)) {
|
657
|
+
return;
|
658
|
+
}
|
659
|
+
_classPrivateFieldGet(this, _target).eventPageX = event.pageX;
|
660
|
+
this.refreshPositions();
|
661
|
+
}
|
662
|
+
function _onBeforeOnCellMouseOver2(event, coords, TD, controller) {
|
663
|
+
const selectedRange = this.hot.getSelectedRangeLast();
|
664
|
+
if (!selectedRange || !_classPrivateFieldGet(this, _pressed)) {
|
665
|
+
return;
|
666
|
+
}
|
667
|
+
if (_classPrivateFieldGet(this, _columnsToMove).indexOf(coords.col) > -1) {
|
668
|
+
removeClass(this.hot.rootElement, CSS_SHOW_UI);
|
669
|
+
} else {
|
670
|
+
addClass(this.hot.rootElement, CSS_SHOW_UI);
|
671
|
+
}
|
672
|
+
controller.row = true;
|
673
|
+
controller.column = true;
|
674
|
+
controller.cell = true;
|
675
|
+
_classPrivateFieldSet(this, _hoveredColumn, coords.col);
|
676
|
+
_classPrivateFieldGet(this, _target).TD = TD;
|
677
|
+
}
|
678
|
+
function _onMouseUp2() {
|
679
|
+
const target = _classPrivateFieldGet(this, _target).col;
|
680
|
+
const columnsLen = _classPrivateFieldGet(this, _columnsToMove).length;
|
681
|
+
_classPrivateFieldSet(this, _hoveredColumn, undefined);
|
682
|
+
_classPrivateFieldSet(this, _pressed, false);
|
683
|
+
removeClass(this.hot.rootElement, [CSS_ON_MOVING, CSS_SHOW_UI, CSS_AFTER_SELECTION]);
|
684
|
+
if (this.hot.selection.isSelectedByColumnHeader()) {
|
685
|
+
addClass(this.hot.rootElement, CSS_AFTER_SELECTION);
|
686
|
+
}
|
687
|
+
if (columnsLen < 1 || target === undefined) {
|
688
|
+
return;
|
689
|
+
}
|
690
|
+
const firstMovedVisualColumn = _classPrivateFieldGet(this, _columnsToMove)[0];
|
691
|
+
const firstMovedPhysicalColumn = this.hot.toPhysicalColumn(firstMovedVisualColumn);
|
692
|
+
const movePerformed = this.dragColumns(_classPrivateFieldGet(this, _columnsToMove), target);
|
693
|
+
_classPrivateFieldGet(this, _columnsToMove).length = 0;
|
694
|
+
if (movePerformed === true) {
|
695
|
+
this.persistentStateSave();
|
696
|
+
this.hot.render();
|
697
|
+
this.hot.view.adjustElementsSize(true);
|
698
|
+
const selectionStart = this.hot.toVisualColumn(firstMovedPhysicalColumn);
|
699
|
+
const selectionEnd = selectionStart + columnsLen - 1;
|
700
|
+
this.hot.selectColumns(selectionStart, selectionEnd);
|
701
|
+
}
|
702
|
+
}
|
703
|
+
function _onAfterScrollVertically2() {
|
704
|
+
const wtTable = this.hot.view._wt.wtTable;
|
705
|
+
const headerHeight = wtTable.getColumnHeaderHeight(0) + 1;
|
706
|
+
const scrollTop = wtTable.holder.scrollTop;
|
707
|
+
const posTop = headerHeight + scrollTop;
|
708
|
+
this.backlight.setPosition(posTop);
|
709
|
+
this.backlight.setSize(null, wtTable.hider.offsetHeight - posTop);
|
710
|
+
}
|
711
|
+
function _onAfterLoadData2() {
|
712
|
+
this.moveBySettingsOrLoad();
|
658
713
|
}
|