handsontable 0.0.0-next-03bda88-20230622 → 0.0.0-next-c3d199b-20230626
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 +61 -12
- package/3rdparty/walkontable/src/cell/coords.mjs +61 -12
- package/3rdparty/walkontable/src/cell/range.d.ts +9 -2
- package/3rdparty/walkontable/src/cell/range.js +44 -7
- package/3rdparty/walkontable/src/cell/range.mjs +44 -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 -4
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +2 -4
- package/3rdparty/walkontable/src/overlay/top.js +2 -4
- package/3rdparty/walkontable/src/overlay/top.mjs +2 -4
- 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 +18 -0
- package/3rdparty/walkontable/src/selection/border/constants.mjs +13 -0
- package/3rdparty/walkontable/src/selection/constants.js +63 -0
- package/3rdparty/walkontable/src/selection/constants.mjs +51 -0
- package/3rdparty/walkontable/src/selection/index.js +30 -0
- package/3rdparty/walkontable/src/selection/index.mjs +5 -0
- package/3rdparty/walkontable/src/selection/manager.js +329 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +323 -0
- package/3rdparty/walkontable/src/selection/scanner.js +364 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +360 -0
- package/3rdparty/walkontable/src/selection/selection.js +133 -0
- package/3rdparty/walkontable/src/selection/selection.mjs +127 -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 +7 -79
- package/3rdparty/walkontable/src/table.mjs +8 -80
- package/CHANGELOG.md +0 -31
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +5 -3
- package/core.js +127 -309
- package/core.mjs +127 -309
- package/dataMap/metaManager/metaSchema.js +19 -0
- package/dataMap/metaManager/metaSchema.mjs +19 -0
- package/dist/handsontable.css +8 -3
- package/dist/handsontable.full.css +8 -3
- package/dist/handsontable.full.js +15283 -12109
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +115 -115
- package/dist/handsontable.js +23364 -20190
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +21 -94
- package/editorManager.mjs +26 -98
- package/editors/textEditor/textEditor.js +3 -11
- package/editors/textEditor/textEditor.mjs +4 -12
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- 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 +5 -1
- package/pluginHooks.js +89 -1
- package/pluginHooks.mjs +89 -1
- package/plugins/collapsibleColumns/collapsibleColumns.js +81 -24
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +81 -24
- package/plugins/columnSorting/columnSorting.js +50 -8
- package/plugins/columnSorting/columnSorting.mjs +49 -9
- package/plugins/columnSorting/index.js +4 -2
- 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 +263 -224
- package/plugins/comments/comments.mjs +271 -234
- package/plugins/comments/contextMenuItem/addEditComment.js +51 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +63 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +55 -0
- package/plugins/comments/contextMenuItem/removeComment.js +48 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/contextMenu/contextMenu.js +80 -29
- package/plugins/contextMenu/contextMenu.mjs +81 -30
- 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 +25 -16
- package/plugins/contextMenu/utils.mjs +24 -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 +6 -2
- package/plugins/copyPaste/copyPaste.mjs +6 -2
- package/plugins/customBorders/customBorders.js +25 -53
- package/plugins/customBorders/customBorders.mjs +26 -54
- package/plugins/dropdownMenu/dropdownMenu.d.ts +1 -1
- package/plugins/dropdownMenu/dropdownMenu.js +94 -30
- package/plugins/dropdownMenu/dropdownMenu.mjs +94 -30
- package/plugins/mergeCells/mergeCells.js +5 -18
- package/plugins/mergeCells/mergeCells.mjs +5 -18
- package/plugins/multiColumnSorting/multiColumnSorting.js +42 -3
- package/plugins/multiColumnSorting/multiColumnSorting.mjs +42 -3
- package/plugins/nestedHeaders/nestedHeaders.js +132 -10
- package/plugins/nestedHeaders/nestedHeaders.mjs +132 -10
- package/plugins/nestedHeaders/stateManager/index.js +37 -0
- package/plugins/nestedHeaders/stateManager/index.mjs +37 -0
- package/plugins/nestedRows/nestedRows.js +52 -7
- package/plugins/nestedRows/nestedRows.mjs +52 -7
- package/renderers/checkboxRenderer/checkboxRenderer.js +2 -2
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +1 -1
- package/selection/highlight/highlight.js +312 -89
- package/selection/highlight/highlight.mjs +302 -85
- package/selection/highlight/types/activeHeader.js +10 -9
- package/selection/highlight/types/activeHeader.mjs +10 -8
- package/selection/highlight/types/area.js +12 -27
- package/selection/highlight/types/area.mjs +16 -30
- package/selection/highlight/types/areaLayered.js +54 -0
- package/selection/highlight/types/areaLayered.mjs +49 -0
- package/selection/highlight/types/column.js +50 -0
- package/selection/highlight/types/column.mjs +45 -0
- package/selection/highlight/types/customSelection.js +7 -10
- package/selection/highlight/types/customSelection.mjs +7 -9
- package/selection/highlight/types/fill.js +5 -8
- package/selection/highlight/types/fill.mjs +5 -7
- package/selection/highlight/types/{cell.js → focus.js} +5 -8
- package/selection/highlight/types/{cell.mjs → focus.mjs} +5 -7
- package/selection/highlight/types/header.js +10 -20
- package/selection/highlight/types/header.mjs +10 -19
- package/selection/highlight/types/{index.js → row.js} +27 -31
- package/selection/highlight/types/{index.mjs → row.mjs} +24 -29
- 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 +315 -181
- package/selection/selection.mjs +310 -180
- package/selection/transformation.js +233 -96
- package/selection/transformation.mjs +230 -93
- package/selection/utils.js +12 -36
- package/selection/utils.mjs +13 -36
- package/settings.d.ts +1 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +15 -0
- package/shortcutContexts/commands/editor/closeAndSave.mjs +10 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.js +13 -0
- package/shortcutContexts/commands/editor/closeWithoutSaving.mjs +8 -0
- package/shortcutContexts/commands/editor/fastOpen.js +16 -0
- package/shortcutContexts/commands/editor/fastOpen.mjs +11 -0
- package/shortcutContexts/commands/editor/index.js +16 -0
- package/shortcutContexts/commands/editor/index.mjs +12 -0
- package/shortcutContexts/commands/editor/open.js +29 -0
- package/shortcutContexts/commands/editor/open.mjs +24 -0
- package/shortcutContexts/commands/emptySelectedCells.js +12 -0
- package/shortcutContexts/commands/emptySelectedCells.mjs +7 -0
- package/shortcutContexts/commands/extendCellsSelection/down.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/down.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/downByViewportHeight.mjs +16 -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 +10 -0
- package/shortcutContexts/commands/extendCellsSelection/right.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/right.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toColumns.mjs +14 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.js +22 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostBottom.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.js +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineEnd.mjs +12 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.js +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostInlineStart.mjs +12 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.js +40 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostLeft.mjs +35 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.js +40 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostRight.mjs +35 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.js +22 -0
- package/shortcutContexts/commands/extendCellsSelection/toMostTop.mjs +17 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.js +19 -0
- package/shortcutContexts/commands/extendCellsSelection/toRows.mjs +14 -0
- package/shortcutContexts/commands/extendCellsSelection/up.js +15 -0
- package/shortcutContexts/commands/extendCellsSelection/up.mjs +10 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.js +21 -0
- package/shortcutContexts/commands/extendCellsSelection/upByViewportHeight.mjs +16 -0
- package/shortcutContexts/commands/index.js +52 -0
- package/shortcutContexts/commands/index.mjs +48 -0
- package/shortcutContexts/commands/moveCellSelection/down.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/down.mjs +7 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.js +29 -0
- package/shortcutContexts/commands/moveCellSelection/downByViewportHeight.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/index.js +28 -0
- package/shortcutContexts/commands/moveCellSelection/index.mjs +24 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/inlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/inlineStart.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/left.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/left.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/right.js +11 -0
- package/shortcutContexts/commands/moveCellSelection/right.mjs +6 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottom.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.js +17 -0
- package/shortcutContexts/commands/moveCellSelection/toMostBottomInlineEnd.mjs +12 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.js +13 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineEnd.mjs +8 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostInlineStart.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.js +36 -0
- package/shortcutContexts/commands/moveCellSelection/toMostLeft.mjs +31 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.js +36 -0
- package/shortcutContexts/commands/moveCellSelection/toMostRight.mjs +31 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.js +16 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTop.mjs +11 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.js +18 -0
- package/shortcutContexts/commands/moveCellSelection/toMostTopInlineStart.mjs +13 -0
- package/shortcutContexts/commands/moveCellSelection/up.js +12 -0
- package/shortcutContexts/commands/moveCellSelection/up.mjs +7 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.js +29 -0
- package/shortcutContexts/commands/moveCellSelection/upByViewportHeight.mjs +24 -0
- package/shortcutContexts/commands/populateSelectedCellsData.js +35 -0
- package/shortcutContexts/commands/populateSelectedCellsData.mjs +30 -0
- package/shortcutContexts/commands/selectAll.js +11 -0
- package/shortcutContexts/commands/selectAll.mjs +6 -0
- package/shortcutContexts/constants.js +19 -0
- package/shortcutContexts/constants.mjs +12 -0
- package/shortcutContexts/editor.js +29 -0
- package/shortcutContexts/editor.mjs +25 -0
- package/shortcutContexts/grid.js +247 -0
- package/shortcutContexts/grid.mjs +243 -0
- package/shortcutContexts/index.js +29 -0
- package/shortcutContexts/index.mjs +15 -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 +21 -5
- package/shortcuts/utils.mjs +20 -4
- package/tableView.js +63 -11
- package/tableView.mjs +63 -11
- package/3rdparty/walkontable/src/selection.js +0 -355
- package/3rdparty/walkontable/src/selection.mjs +0 -349
- package/selection/highlight/constants.js +0 -16
- package/selection/highlight/constants.mjs +0 -6
@@ -1,41 +1,40 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
|
-
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
-
require("core-js/modules/es.object.set-prototype-of.js");
|
5
|
-
require("core-js/modules/es.object.get-prototype-of.js");
|
6
|
-
require("core-js/modules/es.reflect.construct.js");
|
7
|
-
require("core-js/modules/es.reflect.get.js");
|
8
|
-
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
9
3
|
require("core-js/modules/es.symbol.to-primitive.js");
|
10
4
|
require("core-js/modules/es.date.to-primitive.js");
|
11
5
|
require("core-js/modules/es.symbol.js");
|
12
6
|
require("core-js/modules/es.symbol.description.js");
|
13
7
|
require("core-js/modules/es.number.constructor.js");
|
8
|
+
require("core-js/modules/es.object.set-prototype-of.js");
|
9
|
+
require("core-js/modules/es.object.get-prototype-of.js");
|
10
|
+
require("core-js/modules/es.reflect.construct.js");
|
11
|
+
require("core-js/modules/es.reflect.get.js");
|
12
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
14
13
|
require("core-js/modules/es.symbol.iterator.js");
|
14
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
15
15
|
exports.__esModule = true;
|
16
|
-
exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.Comments = void 0;
|
16
|
+
exports.PLUGIN_PRIORITY = exports.PLUGIN_KEY = exports.META_STYLE = exports.META_READONLY = exports.META_COMMENT_VALUE = exports.META_COMMENT = exports.Comments = void 0;
|
17
|
+
require("core-js/modules/es.array.concat.js");
|
17
18
|
require("core-js/modules/es.array.iterator.js");
|
18
19
|
require("core-js/modules/es.object.to-string.js");
|
19
20
|
require("core-js/modules/es.string.iterator.js");
|
20
21
|
require("core-js/modules/es.weak-map.js");
|
21
22
|
require("core-js/modules/web.dom-collections.iterator.js");
|
22
23
|
var _element = require("../../helpers/dom/element");
|
24
|
+
var _event = require("../../helpers/dom/event");
|
23
25
|
var _object = require("../../helpers/object");
|
24
26
|
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
25
27
|
var _base = require("../base");
|
26
28
|
var _commentEditor = _interopRequireDefault(require("./commentEditor"));
|
27
|
-
var
|
28
|
-
var
|
29
|
-
var
|
30
|
-
|
31
|
-
|
29
|
+
var _displaySwitch2 = _interopRequireDefault(require("./displaySwitch"));
|
30
|
+
var _predefinedItems = require("../contextMenu/predefinedItems");
|
31
|
+
var _addEditComment = _interopRequireDefault(require("./contextMenuItem/addEditComment"));
|
32
|
+
var _removeComment = _interopRequireDefault(require("./contextMenuItem/removeComment"));
|
33
|
+
var _readOnlyComment = _interopRequireDefault(require("./contextMenuItem/readOnlyComment"));
|
32
34
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
33
|
-
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; }
|
34
35
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
35
36
|
function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor); } }
|
36
37
|
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
37
|
-
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
38
|
-
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); }
|
39
38
|
function _get() { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get.bind(); } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(arguments.length < 3 ? target : receiver); } return desc.value; }; } return _get.apply(this, arguments); }
|
40
39
|
function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }
|
41
40
|
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); Object.defineProperty(subClass, "prototype", { writable: false }); if (superClass) _setPrototypeOf(subClass, superClass); }
|
@@ -45,15 +44,30 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
45
44
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
46
45
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
47
46
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
47
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
48
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
49
|
+
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; }
|
50
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
51
|
+
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); }
|
52
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
53
|
+
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; } }
|
54
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
55
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
56
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
48
57
|
var PLUGIN_KEY = 'comments';
|
49
58
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
50
59
|
var PLUGIN_PRIORITY = 60;
|
51
60
|
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
52
|
-
var privatePool = new WeakMap();
|
53
61
|
var META_COMMENT = 'comment';
|
62
|
+
exports.META_COMMENT = META_COMMENT;
|
54
63
|
var META_COMMENT_VALUE = 'value';
|
64
|
+
exports.META_COMMENT_VALUE = META_COMMENT_VALUE;
|
55
65
|
var META_STYLE = 'style';
|
66
|
+
exports.META_STYLE = META_STYLE;
|
56
67
|
var META_READONLY = 'readOnly';
|
68
|
+
exports.META_READONLY = META_READONLY;
|
69
|
+
var SHORTCUTS_GROUP = PLUGIN_KEY;
|
70
|
+
var SHORTCUTS_CONTEXT_NAME = "plugin:".concat(PLUGIN_KEY);
|
57
71
|
|
58
72
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
59
73
|
/**
|
@@ -145,63 +159,107 @@ var META_READONLY = 'readOnly';
|
|
145
159
|
* ```
|
146
160
|
* :::
|
147
161
|
*/
|
162
|
+
var _editor = /*#__PURE__*/new WeakMap();
|
163
|
+
var _displaySwitch = /*#__PURE__*/new WeakMap();
|
164
|
+
var _preventEditorAutoSwitch = /*#__PURE__*/new WeakMap();
|
165
|
+
var _tempEditorDimensions = /*#__PURE__*/new WeakMap();
|
166
|
+
var _cellBelowCursor = /*#__PURE__*/new WeakMap();
|
167
|
+
var _commentValueBeforeSave = /*#__PURE__*/new WeakMap();
|
148
168
|
var Comments = /*#__PURE__*/function (_BasePlugin) {
|
149
169
|
_inherits(Comments, _BasePlugin);
|
150
170
|
var _super = _createSuper(Comments);
|
151
|
-
function Comments(
|
171
|
+
function Comments() {
|
152
172
|
var _this;
|
153
173
|
_classCallCheck(this, Comments);
|
154
|
-
|
174
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
175
|
+
args[_key] = arguments[_key];
|
176
|
+
}
|
177
|
+
_this = _super.call.apply(_super, [this].concat(args));
|
178
|
+
/**
|
179
|
+
* Current cell range, an object with `from` property, with `row` and `col` properties (e.q. `{from: {row: 1, col: 6}}`).
|
180
|
+
*
|
181
|
+
* @type {object}
|
182
|
+
*/
|
183
|
+
_defineProperty(_assertThisInitialized(_this), "range", {});
|
184
|
+
/**
|
185
|
+
* Instance of {@link EventManager}.
|
186
|
+
*
|
187
|
+
* @protected
|
188
|
+
* @type {EventManager}
|
189
|
+
*/
|
190
|
+
_defineProperty(_assertThisInitialized(_this), "eventManager", null);
|
155
191
|
/**
|
156
192
|
* Instance of {@link CommentEditor}.
|
157
193
|
*
|
158
194
|
* @private
|
159
195
|
* @type {CommentEditor}
|
160
196
|
*/
|
161
|
-
_this
|
197
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _editor, {
|
198
|
+
writable: true,
|
199
|
+
value: null
|
200
|
+
});
|
162
201
|
/**
|
163
202
|
* Instance of {@link DisplaySwitch}.
|
164
203
|
*
|
165
204
|
* @private
|
166
205
|
* @type {DisplaySwitch}
|
167
206
|
*/
|
168
|
-
_this
|
207
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _displaySwitch, {
|
208
|
+
writable: true,
|
209
|
+
value: null
|
210
|
+
});
|
169
211
|
/**
|
170
|
-
*
|
212
|
+
* Prevents showing/hiding editor that reacts on the logic triggered by the "mouseover" events.
|
171
213
|
*
|
172
214
|
* @private
|
173
|
-
* @type {
|
215
|
+
* @type {boolean}
|
174
216
|
*/
|
175
|
-
_this
|
217
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _preventEditorAutoSwitch, {
|
218
|
+
writable: true,
|
219
|
+
value: false
|
220
|
+
});
|
176
221
|
/**
|
177
|
-
*
|
222
|
+
* The property for holding editor dimensions for further processing.
|
178
223
|
*
|
224
|
+
* @private
|
179
225
|
* @type {object}
|
180
226
|
*/
|
181
|
-
_this
|
227
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _tempEditorDimensions, {
|
228
|
+
writable: true,
|
229
|
+
value: {}
|
230
|
+
});
|
182
231
|
/**
|
183
|
-
*
|
232
|
+
* The flag that allows processing mousedown event correctly when comments editor is triggered.
|
184
233
|
*
|
185
234
|
* @private
|
186
235
|
* @type {boolean}
|
187
236
|
*/
|
188
|
-
_this
|
189
|
-
|
190
|
-
|
191
|
-
|
237
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _cellBelowCursor, {
|
238
|
+
writable: true,
|
239
|
+
value: null
|
240
|
+
});
|
241
|
+
/**
|
242
|
+
* Holds the comment value before it's actually saved to the cell meta.
|
243
|
+
*
|
244
|
+
* @private
|
245
|
+
* @type {string}
|
246
|
+
*/
|
247
|
+
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _commentValueBeforeSave, {
|
248
|
+
writable: true,
|
249
|
+
value: ''
|
192
250
|
});
|
193
251
|
return _this;
|
194
252
|
}
|
195
|
-
|
196
|
-
/**
|
197
|
-
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
198
|
-
* hook and if it returns `true` then the {@link Comments#enablePlugin} method is called.
|
199
|
-
*
|
200
|
-
* @returns {boolean}
|
201
|
-
*/
|
202
253
|
_createClass(Comments, [{
|
203
254
|
key: "isEnabled",
|
204
|
-
value:
|
255
|
+
value:
|
256
|
+
/**
|
257
|
+
* Checks if the plugin is enabled in the handsontable settings. This method is executed in {@link Hooks#beforeInit}
|
258
|
+
* hook and if it returns `true` then the {@link Comments#enablePlugin} method is called.
|
259
|
+
*
|
260
|
+
* @returns {boolean}
|
261
|
+
*/
|
262
|
+
function isEnabled() {
|
205
263
|
return !!this.hot.getSettings()[PLUGIN_KEY];
|
206
264
|
}
|
207
265
|
|
@@ -215,14 +273,14 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
215
273
|
if (this.enabled) {
|
216
274
|
return;
|
217
275
|
}
|
218
|
-
if (!this
|
219
|
-
this
|
276
|
+
if (!_classPrivateFieldGet(this, _editor)) {
|
277
|
+
_classPrivateFieldSet(this, _editor, new _commentEditor.default(this.hot.rootDocument, this.hot.isRtl()));
|
220
278
|
}
|
221
279
|
if (!this.eventManager) {
|
222
280
|
this.eventManager = new _eventManager.default(this);
|
223
281
|
}
|
224
|
-
if (!this
|
225
|
-
this
|
282
|
+
if (!_classPrivateFieldGet(this, _displaySwitch)) {
|
283
|
+
_classPrivateFieldSet(this, _displaySwitch, new _displaySwitch2.default(this.getDisplayDelaySetting()));
|
226
284
|
}
|
227
285
|
this.addHook('afterContextMenuDefaultOptions', function (options) {
|
228
286
|
return _this2.addToContextMenu(options);
|
@@ -239,12 +297,16 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
239
297
|
this.addHook('afterBeginEditing', function () {
|
240
298
|
return _this2.hide();
|
241
299
|
});
|
242
|
-
this.
|
300
|
+
this.addHook('afterDocumentKeyDown', function (event) {
|
301
|
+
return _this2.onAfterDocumentKeyDown(event);
|
302
|
+
});
|
303
|
+
_classPrivateFieldGet(this, _displaySwitch).addLocalHook('hide', function () {
|
243
304
|
return _this2.hide();
|
244
305
|
});
|
245
|
-
this.
|
306
|
+
_classPrivateFieldGet(this, _displaySwitch).addLocalHook('show', function (row, col) {
|
246
307
|
return _this2.showAtCell(row, col);
|
247
308
|
});
|
309
|
+
this.registerShortcuts();
|
248
310
|
this.registerListeners();
|
249
311
|
_get(_getPrototypeOf(Comments.prototype), "enablePlugin", this).call(this);
|
250
312
|
}
|
@@ -258,10 +320,8 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
258
320
|
}, {
|
259
321
|
key: "updatePlugin",
|
260
322
|
value: function updatePlugin() {
|
261
|
-
this.
|
262
|
-
this.enablePlugin();
|
323
|
+
_classPrivateFieldGet(this, _displaySwitch).updateDelay(this.getDisplayDelaySetting());
|
263
324
|
_get(_getPrototypeOf(Comments.prototype), "updatePlugin", this).call(this);
|
264
|
-
this.displaySwitch.updateDelay(this.getDisplayDelaySetting());
|
265
325
|
}
|
266
326
|
|
267
327
|
/**
|
@@ -270,9 +330,76 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
270
330
|
}, {
|
271
331
|
key: "disablePlugin",
|
272
332
|
value: function disablePlugin() {
|
333
|
+
this.unregisterShortcuts();
|
273
334
|
_get(_getPrototypeOf(Comments.prototype), "disablePlugin", this).call(this);
|
274
335
|
}
|
275
336
|
|
337
|
+
/**
|
338
|
+
* Register shortcuts responsible for toggling context menu.
|
339
|
+
*
|
340
|
+
* @private
|
341
|
+
*/
|
342
|
+
}, {
|
343
|
+
key: "registerShortcuts",
|
344
|
+
value: function registerShortcuts() {
|
345
|
+
var _this3 = this;
|
346
|
+
var manager = this.hot.getShortcutManager();
|
347
|
+
var gridContext = manager.getContext('grid');
|
348
|
+
var pluginContext = manager.addContext(SHORTCUTS_CONTEXT_NAME);
|
349
|
+
gridContext.addShortcut({
|
350
|
+
keys: [['Control', 'Alt', 'M']],
|
351
|
+
callback: function callback() {
|
352
|
+
var range = _this3.hot.getSelectedRangeLast();
|
353
|
+
_this3.setRange(range);
|
354
|
+
_this3.show();
|
355
|
+
_this3.focusEditor();
|
356
|
+
manager.setActiveContextName(SHORTCUTS_CONTEXT_NAME);
|
357
|
+
},
|
358
|
+
stopPropagation: true,
|
359
|
+
runOnlyIf: function runOnlyIf() {
|
360
|
+
var _this3$hot$getSelecte;
|
361
|
+
return ((_this3$hot$getSelecte = _this3.hot.getSelectedRangeLast()) === null || _this3$hot$getSelecte === void 0 ? void 0 : _this3$hot$getSelecte.highlight.isCell()) && !_classPrivateFieldGet(_this3, _editor).isVisible();
|
362
|
+
},
|
363
|
+
group: SHORTCUTS_GROUP
|
364
|
+
});
|
365
|
+
pluginContext.addShortcut({
|
366
|
+
keys: [['Escape']],
|
367
|
+
callback: function callback() {
|
368
|
+
_classPrivateFieldGet(_this3, _editor).setValue(_classPrivateFieldGet(_this3, _commentValueBeforeSave));
|
369
|
+
_this3.hide();
|
370
|
+
manager.setActiveContextName('grid');
|
371
|
+
},
|
372
|
+
runOnlyIf: function runOnlyIf() {
|
373
|
+
var _this3$hot$getSelecte2;
|
374
|
+
return ((_this3$hot$getSelecte2 = _this3.hot.getSelectedRangeLast()) === null || _this3$hot$getSelecte2 === void 0 ? void 0 : _this3$hot$getSelecte2.highlight.isCell()) && _classPrivateFieldGet(_this3, _editor).isVisible();
|
375
|
+
},
|
376
|
+
group: SHORTCUTS_GROUP
|
377
|
+
});
|
378
|
+
pluginContext.addShortcut({
|
379
|
+
keys: [['Control/Meta', 'Enter']],
|
380
|
+
callback: function callback() {
|
381
|
+
_this3.hide();
|
382
|
+
manager.setActiveContextName('grid');
|
383
|
+
},
|
384
|
+
runOnlyIf: function runOnlyIf() {
|
385
|
+
var _this3$hot$getSelecte3;
|
386
|
+
return ((_this3$hot$getSelecte3 = _this3.hot.getSelectedRangeLast()) === null || _this3$hot$getSelecte3 === void 0 ? void 0 : _this3$hot$getSelecte3.highlight.isCell()) && _classPrivateFieldGet(_this3, _editor).isVisible();
|
387
|
+
},
|
388
|
+
group: SHORTCUTS_GROUP
|
389
|
+
});
|
390
|
+
}
|
391
|
+
|
392
|
+
/**
|
393
|
+
* Unregister shortcuts responsible for toggling context menu.
|
394
|
+
*
|
395
|
+
* @private
|
396
|
+
*/
|
397
|
+
}, {
|
398
|
+
key: "unregisterShortcuts",
|
399
|
+
value: function unregisterShortcuts() {
|
400
|
+
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
401
|
+
}
|
402
|
+
|
276
403
|
/**
|
277
404
|
* Registers all necessary DOM listeners.
|
278
405
|
*
|
@@ -281,25 +408,29 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
281
408
|
}, {
|
282
409
|
key: "registerListeners",
|
283
410
|
value: function registerListeners() {
|
284
|
-
var
|
411
|
+
var _this4 = this;
|
285
412
|
var rootDocument = this.hot.rootDocument;
|
413
|
+
var editorElement = this.getEditorInputElement();
|
286
414
|
this.eventManager.addEventListener(rootDocument, 'mouseover', function (event) {
|
287
|
-
return
|
415
|
+
return _this4.onMouseOver(event);
|
288
416
|
});
|
289
417
|
this.eventManager.addEventListener(rootDocument, 'mousedown', function (event) {
|
290
|
-
return
|
418
|
+
return _this4.onMouseDown(event);
|
291
419
|
});
|
292
420
|
this.eventManager.addEventListener(rootDocument, 'mouseup', function () {
|
293
|
-
return
|
421
|
+
return _this4.onMouseUp();
|
422
|
+
});
|
423
|
+
this.eventManager.addEventListener(editorElement, 'focus', function () {
|
424
|
+
return _this4.onEditorFocus();
|
294
425
|
});
|
295
|
-
this.eventManager.addEventListener(
|
296
|
-
return
|
426
|
+
this.eventManager.addEventListener(editorElement, 'blur', function () {
|
427
|
+
return _this4.onEditorBlur();
|
297
428
|
});
|
298
|
-
this.eventManager.addEventListener(
|
299
|
-
return
|
429
|
+
this.eventManager.addEventListener(editorElement, 'mousedown', function (event) {
|
430
|
+
return _this4.onEditorMouseDown(event);
|
300
431
|
});
|
301
|
-
this.eventManager.addEventListener(
|
302
|
-
return
|
432
|
+
this.eventManager.addEventListener(editorElement, 'mouseup', function (event) {
|
433
|
+
return _this4.onEditorMouseUp(event);
|
303
434
|
});
|
304
435
|
}
|
305
436
|
|
@@ -347,7 +478,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
347
478
|
}, {
|
348
479
|
key: "targetIsCommentTextArea",
|
349
480
|
value: function targetIsCommentTextArea(event) {
|
350
|
-
return this.
|
481
|
+
return this.getEditorInputElement() === event.target;
|
351
482
|
}
|
352
483
|
|
353
484
|
/**
|
@@ -361,7 +492,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
361
492
|
if (!this.range.from) {
|
362
493
|
throw new Error('Before using this method, first set cell range (hot.getPlugin("comment").setRange())');
|
363
494
|
}
|
364
|
-
var editorValue = this.
|
495
|
+
var editorValue = _classPrivateFieldGet(this, _editor).getValue();
|
365
496
|
var comment = '';
|
366
497
|
if (value !== null && value !== void 0) {
|
367
498
|
comment = value;
|
@@ -470,8 +601,9 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
470
601
|
return false;
|
471
602
|
}
|
472
603
|
var meta = this.hot.getCellMeta(this.range.from.row, this.range.from.col);
|
473
|
-
this.
|
474
|
-
this.
|
604
|
+
_classPrivateFieldGet(this, _displaySwitch).cancelHiding();
|
605
|
+
_classPrivateFieldGet(this, _editor).setValue(meta[META_COMMENT] ? meta[META_COMMENT][META_COMMENT_VALUE] : null || '');
|
606
|
+
_classPrivateFieldGet(this, _editor).show();
|
475
607
|
this.refreshEditor(true);
|
476
608
|
return true;
|
477
609
|
}
|
@@ -498,7 +630,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
498
630
|
}, {
|
499
631
|
key: "hide",
|
500
632
|
value: function hide() {
|
501
|
-
this.
|
633
|
+
_classPrivateFieldGet(this, _editor).hide();
|
502
634
|
}
|
503
635
|
|
504
636
|
/**
|
@@ -511,7 +643,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
511
643
|
value: function refreshEditor() {
|
512
644
|
var _renderableRow, _renderableColumn;
|
513
645
|
var force = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;
|
514
|
-
if (!force && (!this.range.from || !this.
|
646
|
+
if (!force && (!this.range.from || !_classPrivateFieldGet(this, _editor).isVisible())) {
|
515
647
|
return;
|
516
648
|
}
|
517
649
|
var _this$hot = this.hot,
|
@@ -527,7 +659,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
527
659
|
|
528
660
|
// Reset the editor position to (0, 0) so the opening direction calculation wouldn't be influenced by its
|
529
661
|
// previous position
|
530
|
-
this.
|
662
|
+
_classPrivateFieldGet(this, _editor).setPosition(0, 0);
|
531
663
|
if (renderableRow === null) {
|
532
664
|
renderableRow = rowIndexMapper.getRenderableFromVisualIndex(rowIndexMapper.getNearestNotHiddenIndex(visualRow, -1));
|
533
665
|
}
|
@@ -550,9 +682,9 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
550
682
|
}, true);
|
551
683
|
var commentStyle = this.getCommentMeta(visualRow, visualColumn, META_STYLE);
|
552
684
|
if (commentStyle) {
|
553
|
-
this.
|
685
|
+
_classPrivateFieldGet(this, _editor).setSize(commentStyle.width, commentStyle.height);
|
554
686
|
} else {
|
555
|
-
this.
|
687
|
+
_classPrivateFieldGet(this, _editor).resetSize();
|
556
688
|
}
|
557
689
|
var lastColWidth = isBeforeRenderedColumns ? 0 : wtTable.getStretchedColumnWidth(renderableColumn);
|
558
690
|
var lastRowHeight = targetingPreviousRow && !isBeforeRenderedRows ? (0, _element.outerHeight)(TD) : 0;
|
@@ -561,9 +693,9 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
561
693
|
top = _TD$getBoundingClient.top,
|
562
694
|
cellWidth = _TD$getBoundingClient.width,
|
563
695
|
cellHeight = _TD$getBoundingClient.height;
|
564
|
-
var
|
565
|
-
editorWidth =
|
566
|
-
editorHeight =
|
696
|
+
var _classPrivateFieldGet2 = _classPrivateFieldGet(this, _editor).getSize(),
|
697
|
+
editorWidth = _classPrivateFieldGet2.width,
|
698
|
+
editorHeight = _classPrivateFieldGet2.height;
|
567
699
|
var _this$hot$rootWindow = this.hot.rootWindow,
|
568
700
|
innerWidth = _this$hot$rootWindow.innerWidth,
|
569
701
|
innerHeight = _this$hot$rootWindow.innerHeight;
|
@@ -583,30 +715,17 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
583
715
|
if (top + editorHeight > innerHeight) {
|
584
716
|
y -= editorHeight - cellHeight + 1;
|
585
717
|
}
|
586
|
-
this.
|
587
|
-
this.
|
718
|
+
_classPrivateFieldGet(this, _editor).setPosition(x, y);
|
719
|
+
_classPrivateFieldGet(this, _editor).setReadOnlyState(this.getCommentMeta(visualRow, visualColumn, META_READONLY));
|
588
720
|
}
|
589
721
|
|
590
722
|
/**
|
591
|
-
*
|
592
|
-
*
|
593
|
-
* @private
|
594
|
-
* @returns {boolean}
|
723
|
+
* Focuses the comments editor element.
|
595
724
|
*/
|
596
725
|
}, {
|
597
|
-
key: "
|
598
|
-
value: function
|
599
|
-
|
600
|
-
if (!selected) {
|
601
|
-
return false;
|
602
|
-
}
|
603
|
-
var hasComment = false;
|
604
|
-
var cell = selected.getTopStartCorner(); // IN EXCEL THERE IS COMMENT ONLY FOR TOP LEFT CELL IN SELECTION
|
605
|
-
|
606
|
-
if (this.getCommentMeta(cell.row, cell.col, META_COMMENT_VALUE)) {
|
607
|
-
hasComment = true;
|
608
|
-
}
|
609
|
-
return hasComment;
|
726
|
+
key: "focusEditor",
|
727
|
+
value: function focusEditor() {
|
728
|
+
_classPrivateFieldGet(this, _editor).focus();
|
610
729
|
}
|
611
730
|
|
612
731
|
/**
|
@@ -660,7 +779,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
660
779
|
if (!this.hot.view || !this.hot.view._wt) {
|
661
780
|
return;
|
662
781
|
}
|
663
|
-
if (!this
|
782
|
+
if (!_classPrivateFieldGet(this, _preventEditorAutoSwitch) && !this.targetIsCommentTextArea(event)) {
|
664
783
|
var eventCell = (0, _element.closest)(event.target, 'TD', 'TBODY');
|
665
784
|
var coordinates = null;
|
666
785
|
if (eventCell) {
|
@@ -681,17 +800,16 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
681
800
|
}, {
|
682
801
|
key: "onMouseOver",
|
683
802
|
value: function onMouseOver(event) {
|
684
|
-
var priv = privatePool.get(this);
|
685
803
|
var rootDocument = this.hot.rootDocument;
|
686
|
-
if (this
|
804
|
+
if (_classPrivateFieldGet(this, _preventEditorAutoSwitch) || _classPrivateFieldGet(this, _editor).isFocused() || (0, _element.hasClass)(event.target, 'wtBorder') || _classPrivateFieldGet(this, _cellBelowCursor) === event.target || !_classPrivateFieldGet(this, _editor)) {
|
687
805
|
return;
|
688
806
|
}
|
689
|
-
|
807
|
+
_classPrivateFieldSet(this, _cellBelowCursor, rootDocument.elementFromPoint(event.clientX, event.clientY));
|
690
808
|
if (this.targetIsCellWithComment(event)) {
|
691
809
|
var range = this.hot._createCellRange(this.hot.getCoords(event.target));
|
692
|
-
this.
|
810
|
+
_classPrivateFieldGet(this, _displaySwitch).show(range);
|
693
811
|
} else if ((0, _element.isChildOf)(event.target, rootDocument) && !this.targetIsCommentTextArea(event)) {
|
694
|
-
this.
|
812
|
+
_classPrivateFieldGet(this, _displaySwitch).hide();
|
695
813
|
}
|
696
814
|
}
|
697
815
|
|
@@ -703,7 +821,7 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
703
821
|
}, {
|
704
822
|
key: "onMouseUp",
|
705
823
|
value: function onMouseUp() {
|
706
|
-
this
|
824
|
+
_classPrivateFieldSet(this, _preventEditorAutoSwitch, false);
|
707
825
|
}
|
708
826
|
|
709
827
|
/**
|
@@ -722,16 +840,33 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
722
840
|
}
|
723
841
|
|
724
842
|
/**
|
725
|
-
*
|
843
|
+
* Hook observer the "blur" event from the comments editor element. The hook clears the
|
844
|
+
* editor content and gives back the keyboard shortcuts control by switching to the "grid" context.
|
726
845
|
*
|
727
846
|
* @private
|
728
847
|
*/
|
729
848
|
}, {
|
730
849
|
key: "onEditorBlur",
|
731
850
|
value: function onEditorBlur() {
|
851
|
+
_classPrivateFieldSet(this, _commentValueBeforeSave, '');
|
852
|
+
this.hot.getShortcutManager().setActiveContextName('grid');
|
732
853
|
this.setComment();
|
733
854
|
}
|
734
855
|
|
856
|
+
/**
|
857
|
+
* Hook observer the "focus" event from the comments editor element. The hook takes the control of
|
858
|
+
* the keyboard shortcuts by switching the context to plugins one.
|
859
|
+
*
|
860
|
+
* @private
|
861
|
+
*/
|
862
|
+
}, {
|
863
|
+
key: "onEditorFocus",
|
864
|
+
value: function onEditorFocus() {
|
865
|
+
_classPrivateFieldSet(this, _commentValueBeforeSave, this.getComment());
|
866
|
+
this.hot.listen();
|
867
|
+
this.hot.getShortcutManager().setActiveContextName(SHORTCUTS_CONTEXT_NAME);
|
868
|
+
}
|
869
|
+
|
735
870
|
/**
|
736
871
|
* `mousedown` hook. Along with `onEditorMouseUp` used to simulate the textarea resizing event.
|
737
872
|
*
|
@@ -741,11 +876,10 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
741
876
|
}, {
|
742
877
|
key: "onEditorMouseDown",
|
743
878
|
value: function onEditorMouseDown(event) {
|
744
|
-
|
745
|
-
priv.tempEditorDimensions = {
|
879
|
+
_classPrivateFieldSet(this, _tempEditorDimensions, {
|
746
880
|
width: (0, _element.outerWidth)(event.target),
|
747
881
|
height: (0, _element.outerHeight)(event.target)
|
748
|
-
};
|
882
|
+
});
|
749
883
|
}
|
750
884
|
|
751
885
|
/**
|
@@ -757,10 +891,9 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
757
891
|
}, {
|
758
892
|
key: "onEditorMouseUp",
|
759
893
|
value: function onEditorMouseUp(event) {
|
760
|
-
var priv = privatePool.get(this);
|
761
894
|
var currentWidth = (0, _element.outerWidth)(event.target);
|
762
895
|
var currentHeight = (0, _element.outerHeight)(event.target);
|
763
|
-
if (currentWidth !==
|
896
|
+
if (currentWidth !== _classPrivateFieldGet(this, _tempEditorDimensions).width + 1 || currentHeight !== _classPrivateFieldGet(this, _tempEditorDimensions).height + 2) {
|
764
897
|
this.updateCommentMeta(this.range.from.row, this.range.from.col, _defineProperty({}, META_STYLE, {
|
765
898
|
width: currentWidth,
|
766
899
|
height: currentHeight
|
@@ -769,137 +902,31 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
769
902
|
}
|
770
903
|
|
771
904
|
/**
|
772
|
-
*
|
773
|
-
*
|
774
|
-
* @private
|
775
|
-
*/
|
776
|
-
}, {
|
777
|
-
key: "onContextMenuAddComment",
|
778
|
-
value: function onContextMenuAddComment() {
|
779
|
-
var coords = this.hot.getSelectedRangeLast();
|
780
|
-
this.preventEditorAutoSwitch = true;
|
781
|
-
this.displaySwitch.cancelHiding();
|
782
|
-
this.setRange({
|
783
|
-
from: coords.highlight
|
784
|
-
});
|
785
|
-
this.show();
|
786
|
-
this.hot.deselectCell();
|
787
|
-
this.editor.focus();
|
788
|
-
}
|
789
|
-
|
790
|
-
/**
|
791
|
-
* Context Menu's "remove comment" callback.
|
905
|
+
* Observes the pressed keys and if there is already opened the comment editor prevents open
|
906
|
+
* the table editor into the fast edit mode.
|
792
907
|
*
|
793
|
-
* @
|
794
|
-
*/
|
795
|
-
}, {
|
796
|
-
key: "onContextMenuRemoveComment",
|
797
|
-
value: function onContextMenuRemoveComment() {
|
798
|
-
var _this4 = this;
|
799
|
-
var coords = this.hot.getSelectedRangeLast();
|
800
|
-
this.preventEditorAutoSwitch = true;
|
801
|
-
coords.forAll(function (row, column) {
|
802
|
-
if (row >= 0 && column >= 0) {
|
803
|
-
_this4.removeCommentAtCell(row, column, false);
|
804
|
-
}
|
805
|
-
});
|
806
|
-
this.hot.render();
|
807
|
-
}
|
808
|
-
|
809
|
-
/**
|
810
|
-
* Context Menu's "make comment read-only" callback.
|
811
|
-
*
|
812
|
-
* @private
|
908
|
+
* @param {Event} event The keydown event.
|
813
909
|
*/
|
814
910
|
}, {
|
815
|
-
key: "
|
816
|
-
value: function
|
817
|
-
|
818
|
-
|
819
|
-
|
820
|
-
coords.forAll(function (row, column) {
|
821
|
-
if (row >= 0 && column >= 0) {
|
822
|
-
var currentState = !!_this5.getCommentMeta(row, column, META_READONLY);
|
823
|
-
_this5.updateCommentMeta(row, column, _defineProperty({}, META_READONLY, !currentState));
|
824
|
-
}
|
825
|
-
});
|
911
|
+
key: "onAfterDocumentKeyDown",
|
912
|
+
value: function onAfterDocumentKeyDown(event) {
|
913
|
+
if (_classPrivateFieldGet(this, _editor).isVisible()) {
|
914
|
+
(0, _event.stopImmediatePropagation)(event);
|
915
|
+
}
|
826
916
|
}
|
827
917
|
|
828
918
|
/**
|
829
919
|
* Add Comments plugin options to the Context Menu.
|
830
920
|
*
|
831
921
|
* @private
|
832
|
-
* @param {object}
|
922
|
+
* @param {object} options The menu options.
|
833
923
|
*/
|
834
924
|
}, {
|
835
925
|
key: "addToContextMenu",
|
836
|
-
value: function addToContextMenu(
|
837
|
-
|
838
|
-
|
839
|
-
|
840
|
-
};
|
841
|
-
defaultOptions.items.push({
|
842
|
-
name: '---------'
|
843
|
-
}, {
|
844
|
-
key: 'commentsAddEdit',
|
845
|
-
name: function name() {
|
846
|
-
if (_this6.checkSelectionCommentsConsistency()) {
|
847
|
-
return _this6.hot.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_EDIT_COMMENT);
|
848
|
-
}
|
849
|
-
return _this6.hot.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ADD_COMMENT);
|
850
|
-
},
|
851
|
-
callback: function callback() {
|
852
|
-
return _this6.onContextMenuAddComment();
|
853
|
-
},
|
854
|
-
disabled: function disabled() {
|
855
|
-
if (!isThereAnyCellRendered()) {
|
856
|
-
return true;
|
857
|
-
}
|
858
|
-
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
|
859
|
-
}
|
860
|
-
}, {
|
861
|
-
key: 'commentsRemove',
|
862
|
-
name: function name() {
|
863
|
-
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_REMOVE_COMMENT);
|
864
|
-
},
|
865
|
-
callback: function callback() {
|
866
|
-
return _this6.onContextMenuRemoveComment();
|
867
|
-
},
|
868
|
-
disabled: function disabled() {
|
869
|
-
if (!isThereAnyCellRendered()) {
|
870
|
-
return true;
|
871
|
-
}
|
872
|
-
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner());
|
873
|
-
}
|
874
|
-
}, {
|
875
|
-
key: 'commentsReadOnly',
|
876
|
-
name: function name() {
|
877
|
-
var _this7 = this;
|
878
|
-
var label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT);
|
879
|
-
var hasProperty = (0, _utils.checkSelectionConsistency)(this.getSelectedRangeLast(), function (row, col) {
|
880
|
-
var readOnlyProperty = _this7.getCellMeta(row, col)[META_COMMENT];
|
881
|
-
if (readOnlyProperty) {
|
882
|
-
readOnlyProperty = readOnlyProperty[META_READONLY];
|
883
|
-
}
|
884
|
-
if (readOnlyProperty) {
|
885
|
-
return true;
|
886
|
-
}
|
887
|
-
});
|
888
|
-
if (hasProperty) {
|
889
|
-
label = (0, _utils.markLabelAsSelected)(label);
|
890
|
-
}
|
891
|
-
return label;
|
892
|
-
},
|
893
|
-
callback: function callback() {
|
894
|
-
return _this6.onContextMenuMakeReadOnly();
|
895
|
-
},
|
896
|
-
disabled: function disabled() {
|
897
|
-
if (!isThereAnyCellRendered()) {
|
898
|
-
return true;
|
899
|
-
}
|
900
|
-
return !(_this6.hot.getSelectedLast() && !_this6.hot.selection.isSelectedByCorner()) || !_this6.checkSelectionCommentsConsistency();
|
901
|
-
}
|
902
|
-
});
|
926
|
+
value: function addToContextMenu(options) {
|
927
|
+
options.items.push({
|
928
|
+
name: _predefinedItems.SEPARATOR
|
929
|
+
}, (0, _addEditComment.default)(this), (0, _removeComment.default)(this), (0, _readOnlyComment.default)(this));
|
903
930
|
}
|
904
931
|
|
905
932
|
/**
|
@@ -917,17 +944,29 @@ var Comments = /*#__PURE__*/function (_BasePlugin) {
|
|
917
944
|
}
|
918
945
|
}
|
919
946
|
|
947
|
+
/**
|
948
|
+
* Gets the editors input element.
|
949
|
+
*
|
950
|
+
* @private
|
951
|
+
* @returns {HTMLTextAreaElement}
|
952
|
+
*/
|
953
|
+
}, {
|
954
|
+
key: "getEditorInputElement",
|
955
|
+
value: function getEditorInputElement() {
|
956
|
+
return _classPrivateFieldGet(this, _editor).getInputElement();
|
957
|
+
}
|
958
|
+
|
920
959
|
/**
|
921
960
|
* Destroys the plugin instance.
|
922
961
|
*/
|
923
962
|
}, {
|
924
963
|
key: "destroy",
|
925
964
|
value: function destroy() {
|
926
|
-
if (this
|
927
|
-
this.
|
965
|
+
if (_classPrivateFieldGet(this, _editor)) {
|
966
|
+
_classPrivateFieldGet(this, _editor).destroy();
|
928
967
|
}
|
929
|
-
if (this
|
930
|
-
this.
|
968
|
+
if (_classPrivateFieldGet(this, _displaySwitch)) {
|
969
|
+
_classPrivateFieldGet(this, _displaySwitch).destroy();
|
931
970
|
}
|
932
971
|
_get(_getPrototypeOf(Comments.prototype), "destroy", this).call(this);
|
933
972
|
}
|