handsontable 0.0.0-next-8d0643b-20230809 → 0.0.0-next-be16baf-20230809
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/walkontable/src/cell/coords.d.ts +6 -1
- package/3rdparty/walkontable/src/cell/coords.js +50 -11
- package/3rdparty/walkontable/src/cell/coords.mjs +50 -11
- package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
- package/3rdparty/walkontable/src/cell/range.js +38 -7
- package/3rdparty/walkontable/src/cell/range.mjs +38 -7
- package/3rdparty/walkontable/src/core/_base.js +9 -3
- package/3rdparty/walkontable/src/core/_base.mjs +9 -3
- package/3rdparty/walkontable/src/core/clone.js +2 -2
- package/3rdparty/walkontable/src/core/clone.mjs +2 -2
- package/3rdparty/walkontable/src/core/core.js +3 -2
- package/3rdparty/walkontable/src/core/core.mjs +3 -2
- package/3rdparty/walkontable/src/event.js +7 -7
- package/3rdparty/walkontable/src/event.mjs +7 -7
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +10 -2
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +1 -1
- package/3rdparty/walkontable/src/overlay/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/inlineStart.js +2 -6
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -6
- package/3rdparty/walkontable/src/overlay/top.js +2 -6
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -6
- package/3rdparty/walkontable/src/{border.js → selection/border/border.js} +7 -12
- package/3rdparty/walkontable/src/{border.mjs → selection/border/border.mjs} +7 -12
- package/3rdparty/walkontable/src/selection/border/constants.js +16 -0
- package/3rdparty/walkontable/src/selection/border/constants.mjs +12 -0
- package/3rdparty/walkontable/src/selection/constants.js +62 -0
- package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
- package/3rdparty/walkontable/src/selection/index.js +26 -0
- package/3rdparty/walkontable/src/selection/index.mjs +5 -0
- package/3rdparty/walkontable/src/selection/manager.js +259 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +254 -0
- package/3rdparty/walkontable/src/selection/scanner.js +270 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +267 -0
- package/3rdparty/walkontable/src/selection/selection.js +101 -0
- package/3rdparty/walkontable/src/selection/selection.mjs +96 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +9 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +9 -0
- package/3rdparty/walkontable/src/table.js +6 -78
- package/3rdparty/walkontable/src/table.mjs +7 -79
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/common.d.ts +1 -1
- package/core/focusCatcher/focusDetector.js +58 -0
- package/core/focusCatcher/focusDetector.mjs +54 -0
- package/core/focusCatcher/index.js +142 -0
- package/core/focusCatcher/index.mjs +138 -0
- package/core/index.js +9 -0
- package/core/index.mjs +1 -0
- package/core.d.ts +6 -3
- package/core.js +176 -293
- package/core.mjs +176 -293
- package/dataMap/metaManager/metaSchema.js +41 -0
- package/dataMap/metaManager/metaSchema.mjs +41 -0
- package/dist/handsontable.css +24 -4
- package/dist/handsontable.full.css +24 -4
- package/dist/handsontable.full.js +8682 -5378
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +25 -25
- package/dist/handsontable.js +10989 -7685
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +19 -19
- package/editorManager.js +11 -75
- package/editorManager.mjs +11 -74
- package/editors/baseEditor/baseEditor.d.ts +0 -1
- package/editors/textEditor/textEditor.js +3 -11
- package/editors/textEditor/textEditor.mjs +4 -12
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/helpers/number.d.ts +1 -0
- package/helpers/number.js +18 -0
- package/helpers/number.mjs +17 -0
- package/package.json +1 -1
- package/pluginHooks.d.ts +7 -1
- package/pluginHooks.js +106 -1
- package/pluginHooks.mjs +106 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +58 -4
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +58 -4
- package/plugins/columnSorting/columnSorting.js +38 -0
- package/plugins/columnSorting/columnSorting.mjs +38 -2
- package/plugins/columnSorting/index.js +3 -1
- package/plugins/columnSorting/index.mjs +1 -1
- package/plugins/comments/commentEditor.js +1 -0
- package/plugins/comments/commentEditor.mjs +1 -0
- package/plugins/comments/comments.js +251 -189
- package/plugins/comments/comments.mjs +250 -190
- package/plugins/comments/contextMenuItem/addEditComment.js +41 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +49 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +43 -0
- package/plugins/comments/contextMenuItem/removeComment.js +38 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/contextMenu/contextMenu.js +72 -30
- package/plugins/contextMenu/contextMenu.mjs +73 -31
- package/plugins/contextMenu/predefinedItems/alignment.js +7 -0
- package/plugins/contextMenu/predefinedItems/alignment.mjs +7 -0
- package/plugins/contextMenu/predefinedItems/clearColumn.js +5 -3
- package/plugins/contextMenu/predefinedItems/clearColumn.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.js +5 -3
- package/plugins/contextMenu/predefinedItems/columnLeft.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/columnRight.js +5 -3
- package/plugins/contextMenu/predefinedItems/columnRight.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/readOnly.js +7 -0
- package/plugins/contextMenu/predefinedItems/readOnly.mjs +7 -0
- package/plugins/contextMenu/predefinedItems/removeColumn.js +7 -5
- package/plugins/contextMenu/predefinedItems/removeColumn.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/removeRow.js +7 -5
- package/plugins/contextMenu/predefinedItems/removeRow.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.js +5 -3
- package/plugins/contextMenu/predefinedItems/rowAbove.mjs +5 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.js +5 -3
- package/plugins/contextMenu/predefinedItems/rowBelow.mjs +5 -3
- package/plugins/contextMenu/utils.js +28 -16
- package/plugins/contextMenu/utils.mjs +27 -15
- package/plugins/copyPaste/contextMenuItem/copy.js +7 -0
- package/plugins/copyPaste/contextMenuItem/copy.mjs +7 -0
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyColumnHeadersOnly.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnGroupHeaders.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.js +9 -1
- package/plugins/copyPaste/contextMenuItem/copyWithColumnHeaders.mjs +9 -1
- package/plugins/copyPaste/contextMenuItem/cut.js +7 -0
- package/plugins/copyPaste/contextMenuItem/cut.mjs +7 -0
- package/plugins/copyPaste/copyPaste.js +14 -10
- package/plugins/copyPaste/copyPaste.mjs +14 -10
- package/plugins/customBorders/customBorders.js +23 -20
- package/plugins/customBorders/customBorders.mjs +24 -21
- package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
- package/plugins/dropdownMenu/dropdownMenu.js +89 -32
- package/plugins/dropdownMenu/dropdownMenu.mjs +89 -32
- package/plugins/filters/filters.js +31 -14
- package/plugins/filters/filters.mjs +30 -13
- package/plugins/mergeCells/mergeCells.js +5 -17
- package/plugins/mergeCells/mergeCells.mjs +5 -17
- package/plugins/multiColumnSorting/multiColumnSorting.js +37 -2
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +37 -2
- package/plugins/nestedHeaders/nestedHeaders.js +121 -8
- package/plugins/nestedHeaders/nestedHeaders.mjs +121 -8
- package/plugins/nestedHeaders/stateManager/index.js +37 -0
- package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
- package/plugins/nestedRows/nestedRows.js +41 -0
- package/plugins/nestedRows/nestedRows.mjs +41 -0
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +256 -71
- package/selection/highlight/highlight.mjs +250 -71
- package/selection/highlight/types/activeHeader.js +10 -8
- package/selection/highlight/types/activeHeader.mjs +10 -8
- package/selection/highlight/types/area.js +6 -18
- package/selection/highlight/types/area.mjs +6 -18
- package/selection/highlight/types/areaLayered.js +31 -0
- package/selection/highlight/types/areaLayered.mjs +26 -0
- package/selection/highlight/types/column.js +27 -0
- package/selection/highlight/types/column.mjs +22 -0
- package/selection/highlight/types/customSelection.js +7 -9
- package/selection/highlight/types/customSelection.mjs +7 -9
- package/selection/highlight/types/fill.js +5 -7
- package/selection/highlight/types/fill.mjs +5 -7
- package/selection/highlight/types/{cell.js → focus.js} +5 -7
- package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
- package/selection/highlight/types/header.js +9 -18
- package/selection/highlight/types/header.mjs +9 -18
- package/selection/highlight/types/row.js +27 -0
- package/selection/highlight/types/row.mjs +22 -0
- package/selection/highlight/visualSelection.js +31 -27
- package/selection/highlight/visualSelection.mjs +31 -27
- package/selection/index.js +4 -7
- package/selection/index.mjs +2 -3
- package/selection/mouseEventHandler.js +1 -1
- package/selection/mouseEventHandler.mjs +1 -1
- package/selection/range.js +8 -8
- package/selection/range.mjs +8 -8
- package/selection/selection.js +293 -154
- package/selection/selection.mjs +290 -153
- package/selection/transformation.js +232 -90
- package/selection/transformation.mjs +232 -90
- package/selection/utils.js +15 -21
- package/selection/utils.mjs +16 -21
- package/settings.d.ts +2 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +12 -0
- package/shortcutContexts/commands/editor/closeAndSave.mjs +8 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +12 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
- package/shortcutContexts/commands/editor/fastOpen.js +16 -0
- package/shortcutContexts/commands/editor/fastOpen.mjs +12 -0
- package/shortcutContexts/commands/editor/index.js +16 -0
- package/shortcutContexts/commands/editor/index.mjs +12 -0
- package/shortcutContexts/commands/editor/open.js +27 -0
- package/shortcutContexts/commands/editor/open.mjs +23 -0
- package/shortcutContexts/commands/emptySelectedCells.js +11 -0
- package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
- package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/index.js +26 -0
- package/shortcutContexts/commands/extendCellsSelection/index.mjs +22 -0
- package/shortcutContexts/commands/extendCellsSelection/left.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/left.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +29 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +25 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +11 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +17 -0
- package/shortcutContexts/commands/index.js +35 -0
- package/shortcutContexts/commands/index.mjs +31 -0
- package/shortcutContexts/commands/moveCellSelection/down.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +9 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +31 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +27 -0
- package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
- package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/left.js +10 -0
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/right.js +10 -0
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +18 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +14 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +14 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +10 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +19 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +15 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +21 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +19 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +15 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +9 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +31 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +27 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +29 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +25 -0
- package/shortcutContexts/commands/scrollToFocusedCell.js +36 -0
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +32 -0
- package/shortcutContexts/commands/selectAll.js +10 -0
- package/shortcutContexts/commands/selectAll.mjs +6 -0
- package/shortcutContexts/constants.js +13 -0
- package/shortcutContexts/constants.mjs +8 -0
- package/shortcutContexts/editor.js +25 -0
- package/shortcutContexts/editor.mjs +21 -0
- package/shortcutContexts/grid.js +163 -0
- package/shortcutContexts/grid.mjs +159 -0
- package/shortcutContexts/index.js +24 -0
- package/shortcutContexts/index.mjs +11 -0
- package/shortcuts/manager.js +2 -0
- package/shortcuts/manager.mjs +2 -0
- package/shortcuts/recorder.js +2 -2
- package/shortcuts/recorder.mjs +2 -2
- package/shortcuts/utils.js +19 -5
- package/shortcuts/utils.mjs +18 -4
- package/tableView.js +67 -13
- package/tableView.mjs +67 -13
- package/3rdparty/walkontable/src/selection.js +0 -295
- package/3rdparty/walkontable/src/selection.mjs +0 -290
- package/selection/highlight/constants.js +0 -15
- package/selection/highlight/constants.mjs +0 -6
- package/selection/highlight/types/index.js +0 -35
- package/selection/highlight/types/index.mjs +0 -31
@@ -5,6 +5,7 @@ require("core-js/modules/es.error.cause.js");
|
|
5
5
|
var _element = require("../../../../helpers/dom/element");
|
6
6
|
var _inlineStart = _interopRequireDefault(require("../table/inlineStart"));
|
7
7
|
var _base = require("./_base");
|
8
|
+
var _selection = require("../selection");
|
8
9
|
var _constants = require("./constants");
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
11
|
/**
|
@@ -172,15 +173,10 @@ class InlineStartOverlay extends _base.Overlay {
|
|
172
173
|
* Adjust overlay root childs size.
|
173
174
|
*/
|
174
175
|
adjustRootChildrenSize() {
|
175
|
-
var _selections$getCell$g;
|
176
176
|
const {
|
177
177
|
holder
|
178
178
|
} = this.clone.wtTable;
|
179
|
-
const
|
180
|
-
selections
|
181
|
-
} = this.wot;
|
182
|
-
const facade = this.facadeGetter();
|
183
|
-
const selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
|
179
|
+
const selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(_selection.CORNER_DEFAULT_STYLE.width, 10) / 2 : 0;
|
184
180
|
this.clone.wtTable.hider.style.height = this.hider.style.height;
|
185
181
|
holder.style.height = holder.parentNode.style.height;
|
186
182
|
// Add selection corner protruding part to the holder total width to make sure that
|
@@ -2,6 +2,7 @@ import "core-js/modules/es.error.cause.js";
|
|
2
2
|
import { addClass, getScrollbarWidth, getScrollLeft, getWindowScrollTop, hasClass, outerWidth, removeClass, setOverlayPosition, resetCssTransform } from "../../../../helpers/dom/element.mjs";
|
3
3
|
import InlineStartOverlayTable from "../table/inlineStart.mjs";
|
4
4
|
import { Overlay } from "./_base.mjs";
|
5
|
+
import { CORNER_DEFAULT_STYLE } from "../selection/index.mjs";
|
5
6
|
import { CLONE_INLINE_START } from "./constants.mjs";
|
6
7
|
/**
|
7
8
|
* @class InlineStartOverlay
|
@@ -168,15 +169,10 @@ export class InlineStartOverlay extends Overlay {
|
|
168
169
|
* Adjust overlay root childs size.
|
169
170
|
*/
|
170
171
|
adjustRootChildrenSize() {
|
171
|
-
var _selections$getCell$g;
|
172
172
|
const {
|
173
173
|
holder
|
174
174
|
} = this.clone.wtTable;
|
175
|
-
const
|
176
|
-
selections
|
177
|
-
} = this.wot;
|
178
|
-
const facade = this.facadeGetter();
|
179
|
-
const selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
|
175
|
+
const selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(CORNER_DEFAULT_STYLE.width, 10) / 2 : 0;
|
180
176
|
this.clone.wtTable.hider.style.height = this.hider.style.height;
|
181
177
|
holder.style.height = holder.parentNode.style.height;
|
182
178
|
// Add selection corner protruding part to the holder total width to make sure that
|
@@ -5,6 +5,7 @@ require("core-js/modules/es.error.cause.js");
|
|
5
5
|
var _element = require("../../../../helpers/dom/element");
|
6
6
|
var _top = _interopRequireDefault(require("./../table/top"));
|
7
7
|
var _base = require("./_base");
|
8
|
+
var _selection = require("../selection");
|
8
9
|
var _constants = require("./constants");
|
9
10
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
11
|
function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
@@ -199,15 +200,10 @@ class TopOverlay extends _base.Overlay {
|
|
199
200
|
* Adjust overlay root childs size.
|
200
201
|
*/
|
201
202
|
adjustRootChildrenSize() {
|
202
|
-
var _selections$getCell$g;
|
203
203
|
const {
|
204
204
|
holder
|
205
205
|
} = this.clone.wtTable;
|
206
|
-
const
|
207
|
-
selections
|
208
|
-
} = this.wot;
|
209
|
-
const facade = this.facadeGetter();
|
210
|
-
const selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
|
206
|
+
const selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(_selection.CORNER_DEFAULT_STYLE.height, 10) / 2 : 0;
|
211
207
|
this.clone.wtTable.hider.style.width = this.hider.style.width;
|
212
208
|
holder.style.width = holder.parentNode.style.width;
|
213
209
|
// Add selection corner protruding part to the holder total height to make sure that
|
@@ -5,6 +5,7 @@ function _toPrimitive(input, hint) { if (typeof input !== "object" || input ===
|
|
5
5
|
import { addClass, getScrollbarWidth, getScrollTop, getWindowScrollLeft, hasClass, outerHeight, removeClass, setOverlayPosition, resetCssTransform } from "../../../../helpers/dom/element.mjs";
|
6
6
|
import TopOverlayTable from "./../table/top.mjs";
|
7
7
|
import { Overlay } from "./_base.mjs";
|
8
|
+
import { CORNER_DEFAULT_STYLE } from "../selection/index.mjs";
|
8
9
|
import { CLONE_TOP } from "./constants.mjs";
|
9
10
|
/**
|
10
11
|
* @class TopOverlay
|
@@ -195,15 +196,10 @@ export class TopOverlay extends Overlay {
|
|
195
196
|
* Adjust overlay root childs size.
|
196
197
|
*/
|
197
198
|
adjustRootChildrenSize() {
|
198
|
-
var _selections$getCell$g;
|
199
199
|
const {
|
200
200
|
holder
|
201
201
|
} = this.clone.wtTable;
|
202
|
-
const
|
203
|
-
selections
|
204
|
-
} = this.wot;
|
205
|
-
const facade = this.facadeGetter();
|
206
|
-
const selectionCornerOffset = Math.abs((_selections$getCell$g = selections === null || selections === void 0 ? void 0 : selections.getCell().getBorder(facade).cornerCenterPointOffset) !== null && _selections$getCell$g !== void 0 ? _selections$getCell$g : 0);
|
202
|
+
const selectionCornerOffset = this.wot.selectionManager.getFocusSelection() ? parseInt(CORNER_DEFAULT_STYLE.height, 10) / 2 : 0;
|
207
203
|
this.clone.wtTable.hider.style.width = this.hider.style.width;
|
208
204
|
holder.style.width = holder.parentNode.style.width;
|
209
205
|
// Add selection corner protruding part to the holder total height to make sure that
|
@@ -1,10 +1,11 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
-
var _element = require("
|
5
|
-
var _event = require("
|
6
|
-
var _object = require("
|
7
|
-
var _browser = require("
|
4
|
+
var _element = require("../../../../../helpers/dom/element");
|
5
|
+
var _event = require("../../../../../helpers/dom/event");
|
6
|
+
var _object = require("../../../../../helpers/object");
|
7
|
+
var _browser = require("../../../../../helpers/browser");
|
8
|
+
var _constants = require("./constants");
|
8
9
|
/**
|
9
10
|
*
|
10
11
|
*/
|
@@ -34,13 +35,7 @@ class Border {
|
|
34
35
|
this.bottomStyle = null;
|
35
36
|
this.startStyle = null;
|
36
37
|
this.endStyle = null;
|
37
|
-
this.cornerDefaultStyle =
|
38
|
-
width: '6px',
|
39
|
-
height: '6px',
|
40
|
-
borderWidth: '1px',
|
41
|
-
borderStyle: 'solid',
|
42
|
-
borderColor: '#FFF'
|
43
|
-
};
|
38
|
+
this.cornerDefaultStyle = _constants.CORNER_DEFAULT_STYLE;
|
44
39
|
// Offset to moving the corner to be centered relative to the grid.
|
45
40
|
this.cornerCenterPointOffset = -(parseInt(this.cornerDefaultStyle.width, 10) / 2);
|
46
41
|
this.corner = null;
|
@@ -250,7 +245,7 @@ class Border {
|
|
250
245
|
* @returns {boolean}
|
251
246
|
*/
|
252
247
|
isPartRange(row, col) {
|
253
|
-
const areaSelection = this.wot.
|
248
|
+
const areaSelection = this.wot.selectionManager.getAreaSelection();
|
254
249
|
if (areaSelection.cellRange) {
|
255
250
|
if (row !== areaSelection.cellRange.to.row || col !== areaSelection.cellRange.to.col) {
|
256
251
|
return true;
|
@@ -1,7 +1,8 @@
|
|
1
|
-
import { addClass, hasClass, removeClass, getComputedStyle, getTrimmingContainer, innerWidth, innerHeight, offset, outerHeight, outerWidth } from "
|
2
|
-
import { stopImmediatePropagation } from "
|
3
|
-
import { objectEach } from "
|
4
|
-
import { isMobileBrowser } from "
|
1
|
+
import { addClass, hasClass, removeClass, getComputedStyle, getTrimmingContainer, innerWidth, innerHeight, offset, outerHeight, outerWidth } from "../../../../../helpers/dom/element.mjs";
|
2
|
+
import { stopImmediatePropagation } from "../../../../../helpers/dom/event.mjs";
|
3
|
+
import { objectEach } from "../../../../../helpers/object.mjs";
|
4
|
+
import { isMobileBrowser } from "../../../../../helpers/browser.mjs";
|
5
|
+
import { CORNER_DEFAULT_STYLE } from "./constants.mjs";
|
5
6
|
/**
|
6
7
|
*
|
7
8
|
*/
|
@@ -31,13 +32,7 @@ class Border {
|
|
31
32
|
this.bottomStyle = null;
|
32
33
|
this.startStyle = null;
|
33
34
|
this.endStyle = null;
|
34
|
-
this.cornerDefaultStyle =
|
35
|
-
width: '6px',
|
36
|
-
height: '6px',
|
37
|
-
borderWidth: '1px',
|
38
|
-
borderStyle: 'solid',
|
39
|
-
borderColor: '#FFF'
|
40
|
-
};
|
35
|
+
this.cornerDefaultStyle = CORNER_DEFAULT_STYLE;
|
41
36
|
// Offset to moving the corner to be centered relative to the grid.
|
42
37
|
this.cornerCenterPointOffset = -(parseInt(this.cornerDefaultStyle.width, 10) / 2);
|
43
38
|
this.corner = null;
|
@@ -247,7 +242,7 @@ class Border {
|
|
247
242
|
* @returns {boolean}
|
248
243
|
*/
|
249
244
|
isPartRange(row, col) {
|
250
|
-
const areaSelection = this.wot.
|
245
|
+
const areaSelection = this.wot.selectionManager.getAreaSelection();
|
251
246
|
if (areaSelection.cellRange) {
|
252
247
|
if (row !== areaSelection.cellRange.to.row || col !== areaSelection.cellRange.to.col) {
|
253
248
|
return true;
|
@@ -0,0 +1,16 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
/**
|
5
|
+
* Default border corner style.
|
6
|
+
*
|
7
|
+
* @type {object}
|
8
|
+
*/
|
9
|
+
const CORNER_DEFAULT_STYLE = Object.freeze({
|
10
|
+
width: '6px',
|
11
|
+
height: '6px',
|
12
|
+
borderWidth: '1px',
|
13
|
+
borderStyle: 'solid',
|
14
|
+
borderColor: '#FFF'
|
15
|
+
});
|
16
|
+
exports.CORNER_DEFAULT_STYLE = CORNER_DEFAULT_STYLE;
|
@@ -0,0 +1,62 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
/**
|
5
|
+
* Selection type that is visible only if the row or column header is clicked. If that happened
|
6
|
+
* all row or column header layers are highlighted.
|
7
|
+
*
|
8
|
+
* @type {string}
|
9
|
+
*/
|
10
|
+
const ACTIVE_HEADER_TYPE = 'active-header';
|
11
|
+
/**
|
12
|
+
* Selection type that is visible only if the a cell or cells are clicked. If that happened
|
13
|
+
* only the most closest to the cells row or column header is highlighted.
|
14
|
+
*
|
15
|
+
* @type {string}
|
16
|
+
*/
|
17
|
+
exports.ACTIVE_HEADER_TYPE = ACTIVE_HEADER_TYPE;
|
18
|
+
const HEADER_TYPE = 'header';
|
19
|
+
/**
|
20
|
+
* Selection type that is visible when a cell or cells are clicked. The selected cells are
|
21
|
+
* highlighted.
|
22
|
+
*
|
23
|
+
* @type {string}
|
24
|
+
*/
|
25
|
+
exports.HEADER_TYPE = HEADER_TYPE;
|
26
|
+
const AREA_TYPE = 'area';
|
27
|
+
/**
|
28
|
+
* Selection type defines a cell that follows the user (keyboard navigation).
|
29
|
+
*
|
30
|
+
* @type {string}
|
31
|
+
*/
|
32
|
+
exports.AREA_TYPE = AREA_TYPE;
|
33
|
+
const FOCUS_TYPE = 'focus';
|
34
|
+
/**
|
35
|
+
* Selection type defines borders for the autofill functionality.
|
36
|
+
*
|
37
|
+
* @type {string}
|
38
|
+
*/
|
39
|
+
exports.FOCUS_TYPE = FOCUS_TYPE;
|
40
|
+
const FILL_TYPE = 'fill';
|
41
|
+
/**
|
42
|
+
* Selection type defines highlights for the `currentRowClassName` option.
|
43
|
+
*
|
44
|
+
* @type {string}
|
45
|
+
*/
|
46
|
+
exports.FILL_TYPE = FILL_TYPE;
|
47
|
+
const ROW_TYPE = 'row';
|
48
|
+
/**
|
49
|
+
* Selection type defines highlights for the `currentColumnClassName` option.
|
50
|
+
*
|
51
|
+
* @type {string}
|
52
|
+
*/
|
53
|
+
exports.ROW_TYPE = ROW_TYPE;
|
54
|
+
const COLUMN_TYPE = 'column';
|
55
|
+
/**
|
56
|
+
* Selection type defines highlights managed by the CustomBorders plugin.
|
57
|
+
*
|
58
|
+
* @type {string}
|
59
|
+
*/
|
60
|
+
exports.COLUMN_TYPE = COLUMN_TYPE;
|
61
|
+
const CUSTOM_SELECTION_TYPE = 'custom-selection';
|
62
|
+
exports.CUSTOM_SELECTION_TYPE = CUSTOM_SELECTION_TYPE;
|
@@ -0,0 +1,51 @@
|
|
1
|
+
/**
|
2
|
+
* Selection type that is visible only if the row or column header is clicked. If that happened
|
3
|
+
* all row or column header layers are highlighted.
|
4
|
+
*
|
5
|
+
* @type {string}
|
6
|
+
*/
|
7
|
+
export const ACTIVE_HEADER_TYPE = 'active-header';
|
8
|
+
/**
|
9
|
+
* Selection type that is visible only if the a cell or cells are clicked. If that happened
|
10
|
+
* only the most closest to the cells row or column header is highlighted.
|
11
|
+
*
|
12
|
+
* @type {string}
|
13
|
+
*/
|
14
|
+
export const HEADER_TYPE = 'header';
|
15
|
+
/**
|
16
|
+
* Selection type that is visible when a cell or cells are clicked. The selected cells are
|
17
|
+
* highlighted.
|
18
|
+
*
|
19
|
+
* @type {string}
|
20
|
+
*/
|
21
|
+
export const AREA_TYPE = 'area';
|
22
|
+
/**
|
23
|
+
* Selection type defines a cell that follows the user (keyboard navigation).
|
24
|
+
*
|
25
|
+
* @type {string}
|
26
|
+
*/
|
27
|
+
export const FOCUS_TYPE = 'focus';
|
28
|
+
/**
|
29
|
+
* Selection type defines borders for the autofill functionality.
|
30
|
+
*
|
31
|
+
* @type {string}
|
32
|
+
*/
|
33
|
+
export const FILL_TYPE = 'fill';
|
34
|
+
/**
|
35
|
+
* Selection type defines highlights for the `currentRowClassName` option.
|
36
|
+
*
|
37
|
+
* @type {string}
|
38
|
+
*/
|
39
|
+
export const ROW_TYPE = 'row';
|
40
|
+
/**
|
41
|
+
* Selection type defines highlights for the `currentColumnClassName` option.
|
42
|
+
*
|
43
|
+
* @type {string}
|
44
|
+
*/
|
45
|
+
export const COLUMN_TYPE = 'column';
|
46
|
+
/**
|
47
|
+
* Selection type defines highlights managed by the CustomBorders plugin.
|
48
|
+
*
|
49
|
+
* @type {string}
|
50
|
+
*/
|
51
|
+
export const CUSTOM_SELECTION_TYPE = 'custom-selection';
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
var _exportNames = {
|
5
|
+
SelectionManager: true,
|
6
|
+
Selection: true
|
7
|
+
};
|
8
|
+
var _selection = _interopRequireDefault(require("./selection"));
|
9
|
+
exports.Selection = _selection.default;
|
10
|
+
var _constants = require("./constants");
|
11
|
+
Object.keys(_constants).forEach(function (key) {
|
12
|
+
if (key === "default" || key === "__esModule") return;
|
13
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
14
|
+
if (key in exports && exports[key] === _constants[key]) return;
|
15
|
+
exports[key] = _constants[key];
|
16
|
+
});
|
17
|
+
var _constants2 = require("./border/constants");
|
18
|
+
Object.keys(_constants2).forEach(function (key) {
|
19
|
+
if (key === "default" || key === "__esModule") return;
|
20
|
+
if (Object.prototype.hasOwnProperty.call(_exportNames, key)) return;
|
21
|
+
if (key in exports && exports[key] === _constants2[key]) return;
|
22
|
+
exports[key] = _constants2[key];
|
23
|
+
});
|
24
|
+
var _manager = require("./manager");
|
25
|
+
exports.SelectionManager = _manager.SelectionManager;
|
26
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -0,0 +1,259 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
require("core-js/modules/es.array.unscopables.flat.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
6
|
+
var _element = require("../../../../helpers/dom/element");
|
7
|
+
var _scanner2 = require("./scanner");
|
8
|
+
var _border = _interopRequireDefault(require("./border/border"));
|
9
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
10
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
11
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
12
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
13
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
14
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
15
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
16
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
17
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
18
|
+
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; } }
|
19
|
+
/**
|
20
|
+
* Module responsible for rendering selections (CSS classes) and borders based on the
|
21
|
+
* collection of the Selection instances provided throughout the `selections` Walkontable
|
22
|
+
* setting.
|
23
|
+
*
|
24
|
+
* @private
|
25
|
+
*/
|
26
|
+
var _activeOverlaysWot = /*#__PURE__*/new WeakMap();
|
27
|
+
var _selections = /*#__PURE__*/new WeakMap();
|
28
|
+
var _scanner = /*#__PURE__*/new WeakMap();
|
29
|
+
var _appliedClasses = /*#__PURE__*/new WeakMap();
|
30
|
+
var _destroyListeners = /*#__PURE__*/new WeakMap();
|
31
|
+
var _selectionBorders = /*#__PURE__*/new WeakMap();
|
32
|
+
var _resetCells = /*#__PURE__*/new WeakSet();
|
33
|
+
class SelectionManager {
|
34
|
+
constructor(selections) {
|
35
|
+
/**
|
36
|
+
* Resets the elements to their initial state (remove the CSS classes that are added in the
|
37
|
+
* previous render cycle).
|
38
|
+
*/
|
39
|
+
_classPrivateMethodInitSpec(this, _resetCells);
|
40
|
+
/**
|
41
|
+
* The overlay's Walkontable instance that are currently processed.
|
42
|
+
*
|
43
|
+
* @type {Walkontable}
|
44
|
+
*/
|
45
|
+
_classPrivateFieldInitSpec(this, _activeOverlaysWot, {
|
46
|
+
writable: true,
|
47
|
+
value: void 0
|
48
|
+
});
|
49
|
+
/**
|
50
|
+
* The Highlight instance that holds Selections instances within it.
|
51
|
+
*
|
52
|
+
* @type {Highlight|null}
|
53
|
+
*/
|
54
|
+
_classPrivateFieldInitSpec(this, _selections, {
|
55
|
+
writable: true,
|
56
|
+
value: void 0
|
57
|
+
});
|
58
|
+
/**
|
59
|
+
* The SelectionScanner allows to scan and collect the cell and header elements that matches
|
60
|
+
* to the coords defined in the selections.
|
61
|
+
*
|
62
|
+
* @type {SelectionScanner}
|
63
|
+
*/
|
64
|
+
_classPrivateFieldInitSpec(this, _scanner, {
|
65
|
+
writable: true,
|
66
|
+
value: new _scanner2.SelectionScanner()
|
67
|
+
});
|
68
|
+
/**
|
69
|
+
* The Map tracks applied CSS classes. It's used to reset the elements state to their initial state.
|
70
|
+
*
|
71
|
+
* @type {WeakMap}
|
72
|
+
*/
|
73
|
+
_classPrivateFieldInitSpec(this, _appliedClasses, {
|
74
|
+
writable: true,
|
75
|
+
value: new WeakMap()
|
76
|
+
});
|
77
|
+
/**
|
78
|
+
* The Map tracks applied "destroy" listeners for Selection instances.
|
79
|
+
*
|
80
|
+
* @type {WeakMap}
|
81
|
+
*/
|
82
|
+
_classPrivateFieldInitSpec(this, _destroyListeners, {
|
83
|
+
writable: true,
|
84
|
+
value: new WeakSet()
|
85
|
+
});
|
86
|
+
/**
|
87
|
+
* The Map holds references to Border classes for Selection instances which requires that when
|
88
|
+
* the "border" setting is defined.
|
89
|
+
*
|
90
|
+
* @type {Map}
|
91
|
+
*/
|
92
|
+
_classPrivateFieldInitSpec(this, _selectionBorders, {
|
93
|
+
writable: true,
|
94
|
+
value: new Map()
|
95
|
+
});
|
96
|
+
_classPrivateFieldSet(this, _selections, selections);
|
97
|
+
}
|
98
|
+
|
99
|
+
/**
|
100
|
+
* Sets the active Walkontable instance.
|
101
|
+
*
|
102
|
+
* @param {Walkontable} activeWot The overlays or master Walkontable instance.
|
103
|
+
* @returns {SelectionManager}
|
104
|
+
*/
|
105
|
+
setActiveOverlay(activeWot) {
|
106
|
+
_classPrivateFieldSet(this, _activeOverlaysWot, activeWot);
|
107
|
+
_classPrivateFieldGet(this, _scanner).setActiveOverlay(_classPrivateFieldGet(this, _activeOverlaysWot));
|
108
|
+
if (!_classPrivateFieldGet(this, _appliedClasses).has(_classPrivateFieldGet(this, _activeOverlaysWot))) {
|
109
|
+
_classPrivateFieldGet(this, _appliedClasses).set(_classPrivateFieldGet(this, _activeOverlaysWot), new Set());
|
110
|
+
}
|
111
|
+
return this;
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Gets the Selection instance of the "focus" type.
|
116
|
+
*
|
117
|
+
* @returns {Selection|null}
|
118
|
+
*/
|
119
|
+
getFocusSelection() {
|
120
|
+
return _classPrivateFieldGet(this, _selections) !== null ? _classPrivateFieldGet(this, _selections).getFocus() : null;
|
121
|
+
}
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Gets the Selection instance of the "area" type.
|
125
|
+
*
|
126
|
+
* @returns {Selection|null}
|
127
|
+
*/
|
128
|
+
getAreaSelection() {
|
129
|
+
return _classPrivateFieldGet(this, _selections) !== null ? _classPrivateFieldGet(this, _selections).createLayeredArea() : null;
|
130
|
+
}
|
131
|
+
|
132
|
+
/**
|
133
|
+
* Gets the Border instance associated with Selection instance.
|
134
|
+
*
|
135
|
+
* @param {Selection} selection The selection instance.
|
136
|
+
* @returns {Border|null} Returns the Border instance (new for each overlay Walkontable instance).
|
137
|
+
*/
|
138
|
+
getBorderInstance(selection) {
|
139
|
+
if (!selection.settings.border) {
|
140
|
+
return null;
|
141
|
+
}
|
142
|
+
if (_classPrivateFieldGet(this, _selectionBorders).has(selection)) {
|
143
|
+
const borders = _classPrivateFieldGet(this, _selectionBorders).get(selection);
|
144
|
+
if (borders.has(_classPrivateFieldGet(this, _activeOverlaysWot))) {
|
145
|
+
return borders.get(_classPrivateFieldGet(this, _activeOverlaysWot));
|
146
|
+
}
|
147
|
+
const border = new _border.default(_classPrivateFieldGet(this, _activeOverlaysWot), selection.settings);
|
148
|
+
borders.set(_classPrivateFieldGet(this, _activeOverlaysWot), border);
|
149
|
+
return border;
|
150
|
+
}
|
151
|
+
const border = new _border.default(_classPrivateFieldGet(this, _activeOverlaysWot), selection.settings);
|
152
|
+
_classPrivateFieldGet(this, _selectionBorders).set(selection, new Map([[_classPrivateFieldGet(this, _activeOverlaysWot), border]]));
|
153
|
+
return border;
|
154
|
+
}
|
155
|
+
|
156
|
+
/**
|
157
|
+
* Gets all Border instances associated with Selection instance for all overlays.
|
158
|
+
*
|
159
|
+
* @param {Selection} selection The selection instance.
|
160
|
+
* @returns {Border[]}
|
161
|
+
*/
|
162
|
+
getBorderInstances(selection) {
|
163
|
+
var _classPrivateFieldGet2, _classPrivateFieldGet3;
|
164
|
+
return Array.from((_classPrivateFieldGet2 = (_classPrivateFieldGet3 = _classPrivateFieldGet(this, _selectionBorders).get(selection)) === null || _classPrivateFieldGet3 === void 0 ? void 0 : _classPrivateFieldGet3.values()) !== null && _classPrivateFieldGet2 !== void 0 ? _classPrivateFieldGet2 : []);
|
165
|
+
}
|
166
|
+
|
167
|
+
/**
|
168
|
+
* Destroys the Border instance associated with Selection instance.
|
169
|
+
*
|
170
|
+
* @param {Selection} selection The selection instance.
|
171
|
+
*/
|
172
|
+
destroyBorders(selection) {
|
173
|
+
_classPrivateFieldGet(this, _selectionBorders).get(selection).forEach(border => border.destroy());
|
174
|
+
_classPrivateFieldGet(this, _selectionBorders).delete(selection);
|
175
|
+
}
|
176
|
+
|
177
|
+
/**
|
178
|
+
* Renders all the selections (add CSS classes to cells and draw borders).
|
179
|
+
*
|
180
|
+
* @param {boolean} fastDraw Indicates the render cycle type (fast/slow).
|
181
|
+
*/
|
182
|
+
render(fastDraw) {
|
183
|
+
if (_classPrivateFieldGet(this, _selections) === null) {
|
184
|
+
return;
|
185
|
+
}
|
186
|
+
if (fastDraw) {
|
187
|
+
// there was no rerender, so we need to remove classNames by ourselves
|
188
|
+
_classPrivateMethodGet(this, _resetCells, _resetCells2).call(this);
|
189
|
+
}
|
190
|
+
const selections = Array.from(_classPrivateFieldGet(this, _selections));
|
191
|
+
const classNamesMap = new Map();
|
192
|
+
for (let i = 0; i < selections.length; i++) {
|
193
|
+
const selection = selections[i];
|
194
|
+
const {
|
195
|
+
className,
|
196
|
+
createLayers,
|
197
|
+
selectionType
|
198
|
+
} = selection.settings;
|
199
|
+
if (!_classPrivateFieldGet(this, _destroyListeners).has(selection)) {
|
200
|
+
_classPrivateFieldGet(this, _destroyListeners).add(selection);
|
201
|
+
selection.addLocalHook('destroy', () => this.destroyBorders(selection));
|
202
|
+
}
|
203
|
+
const borderInstance = this.getBorderInstance(selection);
|
204
|
+
if (selection.isEmpty()) {
|
205
|
+
borderInstance === null || borderInstance === void 0 ? void 0 : borderInstance.disappear();
|
206
|
+
continue; // eslint-disable-line no-continue
|
207
|
+
}
|
208
|
+
|
209
|
+
if (className) {
|
210
|
+
const elements = _classPrivateFieldGet(this, _scanner).setActiveSelection(selection).scan();
|
211
|
+
elements.forEach(element => {
|
212
|
+
if (classNamesMap.has(element)) {
|
213
|
+
const classNamesLayers = classNamesMap.get(element);
|
214
|
+
if (classNamesLayers.has(className) && createLayers === true) {
|
215
|
+
classNamesLayers.set(className, classNamesLayers.get(className) + 1);
|
216
|
+
} else {
|
217
|
+
classNamesLayers.set(className, 1);
|
218
|
+
}
|
219
|
+
} else {
|
220
|
+
classNamesMap.set(element, new Map([[className, 1]]));
|
221
|
+
}
|
222
|
+
});
|
223
|
+
}
|
224
|
+
const corners = selection.getCorners();
|
225
|
+
_classPrivateFieldGet(this, _activeOverlaysWot).getSetting('onBeforeDrawBorders', corners, selectionType);
|
226
|
+
borderInstance === null || borderInstance === void 0 ? void 0 : borderInstance.appear(corners);
|
227
|
+
}
|
228
|
+
classNamesMap.forEach((classNamesLayers, element) => {
|
229
|
+
const classNames = Array.from(classNamesLayers).map(_ref => {
|
230
|
+
let [className, occurrenceCount] = _ref;
|
231
|
+
if (occurrenceCount === 1) {
|
232
|
+
return className;
|
233
|
+
}
|
234
|
+
return [className, ...Array.from({
|
235
|
+
length: occurrenceCount - 1
|
236
|
+
}, (_, i) => `${className}-${i + 1}`)];
|
237
|
+
}).flat();
|
238
|
+
classNames.forEach(className => _classPrivateFieldGet(this, _appliedClasses).get(_classPrivateFieldGet(this, _activeOverlaysWot)).add(className));
|
239
|
+
(0, _element.addClass)(element, classNames);
|
240
|
+
});
|
241
|
+
}
|
242
|
+
}
|
243
|
+
exports.SelectionManager = SelectionManager;
|
244
|
+
function _resetCells2() {
|
245
|
+
const appliedOverlaysClasses = _classPrivateFieldGet(this, _appliedClasses).get(_classPrivateFieldGet(this, _activeOverlaysWot));
|
246
|
+
const classesToRemove = _classPrivateFieldGet(this, _activeOverlaysWot).wtSettings.getSetting('onBeforeRemoveCellClassNames');
|
247
|
+
if (Array.isArray(classesToRemove)) {
|
248
|
+
for (let i = 0; i < classesToRemove.length; i++) {
|
249
|
+
appliedOverlaysClasses.add(classesToRemove[i]);
|
250
|
+
}
|
251
|
+
}
|
252
|
+
appliedOverlaysClasses.forEach(className => {
|
253
|
+
const nodes = _classPrivateFieldGet(this, _activeOverlaysWot).wtTable.TABLE.querySelectorAll(`.${className}`);
|
254
|
+
for (let i = 0, len = nodes.length; i < len; i++) {
|
255
|
+
(0, _element.removeClass)(nodes[i], className);
|
256
|
+
}
|
257
|
+
});
|
258
|
+
appliedOverlaysClasses.clear();
|
259
|
+
}
|