handsontable 0.0.0-next-48677e7-20230509 → 0.0.0-next-c73b24c-20230510
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/{selection/border/border.js → border.js} +12 -7
- package/3rdparty/walkontable/src/{selection/border/border.mjs → border.mjs} +12 -7
- package/3rdparty/walkontable/src/cell/coords.js +13 -40
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -40
- package/3rdparty/walkontable/src/cell/range.js +25 -29
- package/3rdparty/walkontable/src/cell/range.mjs +24 -28
- package/3rdparty/walkontable/src/core/_base.js +3 -9
- package/3rdparty/walkontable/src/core/_base.mjs +3 -9
- 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 +2 -3
- package/3rdparty/walkontable/src/core/core.mjs +2 -3
- package/3rdparty/walkontable/src/event.js +10 -12
- package/3rdparty/walkontable/src/event.mjs +10 -12
- package/3rdparty/walkontable/src/facade/core.js +2 -2
- package/3rdparty/walkontable/src/facade/core.mjs +2 -2
- package/3rdparty/walkontable/src/index.js +2 -10
- package/3rdparty/walkontable/src/index.mjs +2 -2
- package/3rdparty/walkontable/src/overlay/_base.js +7 -8
- package/3rdparty/walkontable/src/overlay/_base.mjs +7 -8
- package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/inlineStart.js +4 -2
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +4 -2
- package/3rdparty/walkontable/src/overlay/top.js +10 -9
- package/3rdparty/walkontable/src/overlay/top.mjs +10 -9
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.js +10 -12
- package/3rdparty/walkontable/src/overlay/topInlineStartCorner.mjs +10 -12
- package/3rdparty/walkontable/src/overlays.js +55 -64
- package/3rdparty/walkontable/src/overlays.mjs +55 -64
- package/3rdparty/walkontable/src/renderer/table.js +0 -2
- package/3rdparty/walkontable/src/renderer/table.mjs +0 -2
- package/3rdparty/walkontable/src/scroll.js +20 -23
- package/3rdparty/walkontable/src/scroll.mjs +20 -23
- package/3rdparty/walkontable/src/selection.js +354 -0
- package/3rdparty/walkontable/src/selection.mjs +348 -0
- package/3rdparty/walkontable/src/settings.js +13 -15
- package/3rdparty/walkontable/src/settings.mjs +13 -15
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +0 -9
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +0 -9
- package/3rdparty/walkontable/src/table.js +101 -33
- package/3rdparty/walkontable/src/table.mjs +102 -34
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core.d.ts +0 -4
- package/core.js +24 -52
- package/core.mjs +24 -52
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dataMap/metaManager/metaSchema.js +1 -8
- package/dataMap/metaManager/metaSchema.mjs +1 -8
- package/dist/handsontable.css +2 -7
- package/dist/handsontable.full.css +2 -7
- package/dist/handsontable.full.js +9101 -9413
- package/dist/handsontable.full.min.css +3 -3
- package/dist/handsontable.full.min.js +123 -115
- package/dist/handsontable.js +8761 -9074
- package/dist/handsontable.min.css +3 -3
- package/dist/handsontable.min.js +11 -3
- package/dist/languages/all.js +133 -0
- package/dist/languages/ar-AR.js +7 -0
- package/dist/languages/cs-CZ.js +7 -0
- package/dist/languages/de-CH.js +7 -0
- package/dist/languages/de-DE.js +7 -0
- package/dist/languages/en-US.js +7 -0
- package/dist/languages/es-MX.js +7 -0
- package/dist/languages/fr-FR.js +7 -0
- package/dist/languages/it-IT.js +7 -0
- package/dist/languages/ja-JP.js +7 -0
- package/dist/languages/ko-KR.js +7 -0
- package/dist/languages/lv-LV.js +7 -0
- package/dist/languages/nb-NO.js +7 -0
- package/dist/languages/nl-NL.js +7 -0
- package/dist/languages/pl-PL.js +7 -0
- package/dist/languages/pt-BR.js +7 -0
- package/dist/languages/ru-RU.js +7 -0
- package/dist/languages/sr-SP.js +7 -0
- package/dist/languages/zh-CN.js +7 -0
- package/dist/languages/zh-TW.js +7 -0
- package/editorManager.js +3 -7
- package/editorManager.mjs +3 -7
- package/editors/textEditor/textEditor.js +16 -3
- package/editors/textEditor/textEditor.mjs +17 -4
- package/helpers/dom/element.js +0 -11
- package/helpers/dom/element.mjs +0 -10
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/i18n/languages/ar-AR.js +7 -1
- package/i18n/languages/cs-CZ.js +7 -1
- package/i18n/languages/de-CH.js +7 -1
- package/i18n/languages/de-DE.js +7 -1
- package/i18n/languages/en-US.js +7 -1
- package/i18n/languages/es-MX.js +7 -1
- package/i18n/languages/fr-FR.js +7 -1
- package/i18n/languages/it-IT.js +7 -1
- package/i18n/languages/ja-JP.js +7 -1
- package/i18n/languages/ko-KR.js +7 -1
- package/i18n/languages/lv-LV.js +7 -1
- package/i18n/languages/nb-NO.js +7 -1
- package/i18n/languages/nl-NL.js +7 -1
- package/i18n/languages/pl-PL.js +7 -1
- package/i18n/languages/pt-BR.js +7 -1
- package/i18n/languages/ru-RU.js +7 -1
- package/i18n/languages/sr-SP.js +7 -1
- package/i18n/languages/zh-CN.js +7 -1
- package/i18n/languages/zh-TW.js +7 -1
- package/languages/all.js +133 -0
- package/languages/ar-AR.js +7 -0
- package/languages/cs-CZ.js +7 -0
- package/languages/de-CH.js +7 -0
- package/languages/de-DE.js +7 -0
- package/languages/en-US.js +7 -0
- package/languages/es-MX.js +7 -0
- package/languages/fr-FR.js +7 -0
- package/languages/index.js +133 -0
- package/languages/it-IT.js +7 -0
- package/languages/ja-JP.js +7 -0
- package/languages/ko-KR.js +7 -0
- package/languages/lv-LV.js +7 -0
- package/languages/nb-NO.js +7 -0
- package/languages/nl-NL.js +7 -0
- package/languages/pl-PL.js +7 -0
- package/languages/pt-BR.js +7 -0
- package/languages/ru-RU.js +7 -0
- package/languages/sr-SP.js +7 -0
- package/languages/zh-CN.js +7 -0
- package/languages/zh-TW.js +7 -0
- package/package.json +3 -2
- package/pluginHooks.js +17 -7
- package/pluginHooks.mjs +16 -4
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/copyPaste/copyPaste.js +93 -12
- package/plugins/copyPaste/copyPaste.mjs +93 -12
- package/plugins/copyPaste/copyableRanges.js +25 -31
- package/plugins/copyPaste/copyableRanges.mjs +18 -24
- package/plugins/copyPaste/focusableElement.js +219 -0
- package/plugins/copyPaste/focusableElement.mjs +213 -0
- package/plugins/customBorders/customBorders.js +2 -6
- package/plugins/customBorders/customBorders.mjs +3 -7
- package/plugins/filters/filters.js +5 -0
- package/plugins/filters/filters.mjs +5 -0
- package/plugins/formulas/formulas.js +190 -168
- package/plugins/formulas/formulas.mjs +190 -168
- package/plugins/formulas/indexSyncer/axisSyncer.js +379 -0
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +374 -0
- package/plugins/formulas/indexSyncer/index.js +225 -0
- package/plugins/formulas/indexSyncer/index.mjs +219 -0
- package/plugins/mergeCells/mergeCells.js +16 -0
- package/plugins/mergeCells/mergeCells.mjs +16 -0
- package/plugins/nestedHeaders/nestedHeaders.js +4 -3
- package/plugins/nestedHeaders/nestedHeaders.mjs +4 -3
- package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
- package/plugins/nestedHeaders/stateManager/index.js +3 -3
- package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
- package/plugins/nestedHeaders/utils/ghostTable.js +30 -35
- package/plugins/nestedHeaders/utils/ghostTable.mjs +30 -35
- package/plugins/registry.js +3 -1
- package/plugins/undoRedo/undoRedo.js +0 -1
- package/plugins/undoRedo/undoRedo.mjs +0 -1
- package/renderers/baseRenderer/baseRenderer.js +0 -3
- package/renderers/baseRenderer/baseRenderer.mjs +0 -3
- package/selection/highlight/constants.js +16 -0
- package/selection/highlight/constants.mjs +6 -0
- package/selection/highlight/highlight.js +133 -335
- package/selection/highlight/highlight.mjs +129 -325
- package/selection/highlight/types/activeHeader.js +9 -10
- package/selection/highlight/types/activeHeader.mjs +8 -10
- package/selection/highlight/types/area.js +27 -12
- package/selection/highlight/types/area.mjs +30 -16
- package/selection/highlight/types/{focus.js → cell.js} +8 -5
- package/selection/highlight/types/{focus.mjs → cell.mjs} +7 -5
- package/selection/highlight/types/customSelection.js +10 -7
- package/selection/highlight/types/customSelection.mjs +9 -7
- package/selection/highlight/types/fill.js +8 -5
- package/selection/highlight/types/fill.mjs +7 -5
- package/selection/highlight/types/header.js +20 -10
- package/selection/highlight/types/header.mjs +19 -10
- package/selection/highlight/types/{row.js → index.js} +31 -27
- package/selection/highlight/types/{row.mjs → index.mjs} +29 -24
- package/selection/highlight/visualSelection.js +21 -12
- package/selection/highlight/visualSelection.mjs +21 -12
- package/selection/index.js +7 -4
- package/selection/index.mjs +3 -2
- package/selection/selection.js +46 -88
- package/selection/selection.mjs +44 -82
- package/settings.d.ts +0 -1
- package/tableView.js +66 -94
- package/tableView.mjs +66 -94
- package/translations/changesObservable/observable.js +41 -46
- package/translations/changesObservable/observable.mjs +36 -41
- package/translations/changesObservable/observer.js +1 -1
- package/translations/indexMapper.js +21 -0
- package/translations/indexMapper.mjs +21 -0
- package/utils/dataStructures/tree.js +15 -18
- package/utils/dataStructures/tree.mjs +15 -18
- package/utils/parseTable.js +5 -1
- package/utils/parseTable.mjs +5 -1
- package/3rdparty/walkontable/src/selection/border/constants.js +0 -18
- package/3rdparty/walkontable/src/selection/border/constants.mjs +0 -13
- package/3rdparty/walkontable/src/selection/constants.js +0 -63
- package/3rdparty/walkontable/src/selection/constants.mjs +0 -51
- package/3rdparty/walkontable/src/selection/index.js +0 -30
- package/3rdparty/walkontable/src/selection/index.mjs +0 -5
- package/3rdparty/walkontable/src/selection/manager.js +0 -334
- package/3rdparty/walkontable/src/selection/manager.mjs +0 -328
- package/3rdparty/walkontable/src/selection/scanner.js +0 -363
- package/3rdparty/walkontable/src/selection/scanner.mjs +0 -359
- package/3rdparty/walkontable/src/selection/selection.js +0 -133
- package/3rdparty/walkontable/src/selection/selection.mjs +0 -127
- package/focusManager.d.ts +0 -12
- package/focusManager.js +0 -249
- package/focusManager.mjs +0 -245
- package/selection/highlight/types/areaLayered.js +0 -54
- package/selection/highlight/types/areaLayered.mjs +0 -49
- package/selection/highlight/types/column.js +0 -50
- package/selection/highlight/types/column.mjs +0 -45
@@ -0,0 +1,219 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
require("core-js/modules/es.symbol.iterator.js");
|
4
|
+
exports.__esModule = true;
|
5
|
+
exports.createElement = createElement;
|
6
|
+
exports.deactivateElement = deactivateElement;
|
7
|
+
exports.destroyElement = destroyElement;
|
8
|
+
require("core-js/modules/es.array.iterator.js");
|
9
|
+
require("core-js/modules/es.object.to-string.js");
|
10
|
+
require("core-js/modules/es.string.iterator.js");
|
11
|
+
require("core-js/modules/es.weak-set.js");
|
12
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
13
|
+
require("core-js/modules/es.symbol.to-primitive.js");
|
14
|
+
require("core-js/modules/es.date.to-primitive.js");
|
15
|
+
require("core-js/modules/es.symbol.js");
|
16
|
+
require("core-js/modules/es.symbol.description.js");
|
17
|
+
require("core-js/modules/es.number.constructor.js");
|
18
|
+
require("core-js/modules/es.weak-map.js");
|
19
|
+
var _eventManager = _interopRequireDefault(require("../../eventManager"));
|
20
|
+
var _localHooks = _interopRequireDefault(require("../../mixins/localHooks"));
|
21
|
+
var _object = require("../../helpers/object");
|
22
|
+
var _browser = require("../../helpers/browser");
|
23
|
+
var _element = require("../../helpers/dom/element");
|
24
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
25
|
+
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); }
|
26
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
27
|
+
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); } }
|
28
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
29
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
30
|
+
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); }
|
31
|
+
/**
|
32
|
+
* @private
|
33
|
+
* @class FocusableWrapper
|
34
|
+
*/
|
35
|
+
var FocusableWrapper = /*#__PURE__*/function () {
|
36
|
+
function FocusableWrapper(container) {
|
37
|
+
_classCallCheck(this, FocusableWrapper);
|
38
|
+
this.rootDocument = container.defaultView ? container : container.ownerDocument;
|
39
|
+
/**
|
40
|
+
* The main/operational focusable element.
|
41
|
+
*
|
42
|
+
* @type {HTMLElement}
|
43
|
+
*/
|
44
|
+
this.mainElement = null;
|
45
|
+
/**
|
46
|
+
* Instance of EventManager.
|
47
|
+
*
|
48
|
+
* @type {EventManager}
|
49
|
+
*/
|
50
|
+
this.eventManager = new _eventManager.default(this);
|
51
|
+
/**
|
52
|
+
* An object for tracking information about event listeners attached to the focusable element.
|
53
|
+
*
|
54
|
+
* @type {WeakSet}
|
55
|
+
*/
|
56
|
+
this.listenersCount = new WeakSet();
|
57
|
+
/**
|
58
|
+
* Parent for an focusable element.
|
59
|
+
*
|
60
|
+
* @type {HTMLElement}
|
61
|
+
*/
|
62
|
+
this.container = container;
|
63
|
+
}
|
64
|
+
|
65
|
+
/**
|
66
|
+
* Switch to the secondary focusable element. Used when no any main focusable element is provided.
|
67
|
+
*/
|
68
|
+
_createClass(FocusableWrapper, [{
|
69
|
+
key: "useSecondaryElement",
|
70
|
+
value: function useSecondaryElement() {
|
71
|
+
var el = createOrGetSecondaryElement(this.container);
|
72
|
+
if (!this.listenersCount.has(el)) {
|
73
|
+
this.listenersCount.add(el);
|
74
|
+
forwardEventsToLocalHooks(this.eventManager, el, this);
|
75
|
+
}
|
76
|
+
this.mainElement = el;
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Switch to the main focusable element.
|
81
|
+
*
|
82
|
+
* @param {HTMLElement} element The DOM element.
|
83
|
+
*/
|
84
|
+
}, {
|
85
|
+
key: "setFocusableElement",
|
86
|
+
value: function setFocusableElement(element) {
|
87
|
+
if (!this.listenersCount.has(element)) {
|
88
|
+
this.listenersCount.add(element);
|
89
|
+
forwardEventsToLocalHooks(this.eventManager, element, this);
|
90
|
+
}
|
91
|
+
this.mainElement = element;
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Get currently set focusable element.
|
96
|
+
*
|
97
|
+
* @returns {HTMLElement}
|
98
|
+
*/
|
99
|
+
}, {
|
100
|
+
key: "getFocusableElement",
|
101
|
+
value: function getFocusableElement() {
|
102
|
+
return this.mainElement;
|
103
|
+
}
|
104
|
+
|
105
|
+
/**
|
106
|
+
* Set focus to the focusable element.
|
107
|
+
*/
|
108
|
+
}, {
|
109
|
+
key: "focus",
|
110
|
+
value: function focus() {
|
111
|
+
// Add an empty space to texarea. It is necessary for safari to enable "copy" command from menu bar.
|
112
|
+
this.mainElement.value = ' ';
|
113
|
+
if (!(0, _browser.isMobileBrowser)()) {
|
114
|
+
(0, _element.selectElementIfAllowed)(this.mainElement);
|
115
|
+
}
|
116
|
+
}
|
117
|
+
}]);
|
118
|
+
return FocusableWrapper;
|
119
|
+
}();
|
120
|
+
(0, _object.mixin)(FocusableWrapper, _localHooks.default);
|
121
|
+
var refCounter = new WeakMap();
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Create and return the FocusableWrapper instance.
|
125
|
+
*
|
126
|
+
* @param {HTMLElement} container The container element, holder for focusable elements.
|
127
|
+
* @returns {FocusableWrapper}
|
128
|
+
*/
|
129
|
+
function createElement(container) {
|
130
|
+
var focusableWrapper = new FocusableWrapper(container);
|
131
|
+
var counter = refCounter.get(container);
|
132
|
+
counter = isNaN(counter) ? 0 : counter;
|
133
|
+
refCounter.set(container, counter + 1);
|
134
|
+
return focusableWrapper;
|
135
|
+
}
|
136
|
+
|
137
|
+
/**
|
138
|
+
* Deactivate the FocusableWrapper instance.
|
139
|
+
*
|
140
|
+
* @param {FocusableWrapper} wrapper The instance of the FocusableWrapper class.
|
141
|
+
*/
|
142
|
+
function deactivateElement(wrapper) {
|
143
|
+
wrapper.eventManager.clear();
|
144
|
+
}
|
145
|
+
var runLocalHooks = function runLocalHooks(eventName, subject) {
|
146
|
+
return function (event) {
|
147
|
+
return subject.runLocalHooks(eventName, event);
|
148
|
+
};
|
149
|
+
};
|
150
|
+
|
151
|
+
/**
|
152
|
+
* Register copy/cut/paste events and forward their actions to the subject local hooks system.
|
153
|
+
*
|
154
|
+
* @param {EventManager} eventManager The instance of the EventManager class.
|
155
|
+
* @param {HTMLElement} element The element on which the listeners are mounted.
|
156
|
+
* @param {FocusableWrapper} subject The subject object for local hooks.
|
157
|
+
*/
|
158
|
+
function forwardEventsToLocalHooks(eventManager, element, subject) {
|
159
|
+
eventManager.addEventListener(element, 'copy', runLocalHooks('copy', subject));
|
160
|
+
eventManager.addEventListener(element, 'cut', runLocalHooks('cut', subject));
|
161
|
+
eventManager.addEventListener(element, 'paste', runLocalHooks('paste', subject));
|
162
|
+
}
|
163
|
+
var secondaryElements = new WeakMap();
|
164
|
+
|
165
|
+
/**
|
166
|
+
* Create and attach newly created focusable element to the DOM.
|
167
|
+
*
|
168
|
+
* @param {HTMLElement} container The container element, holder for focusable elements.
|
169
|
+
* @returns {HTMLElement}
|
170
|
+
*/
|
171
|
+
function createOrGetSecondaryElement(container) {
|
172
|
+
var secondaryElement = secondaryElements.get(container);
|
173
|
+
if (secondaryElement) {
|
174
|
+
if (!secondaryElement.parentElement) {
|
175
|
+
container.appendChild(secondaryElement);
|
176
|
+
}
|
177
|
+
return secondaryElement;
|
178
|
+
}
|
179
|
+
var doc = container.defaultView ? container : container.ownerDocument;
|
180
|
+
var element = doc.createElement('textarea');
|
181
|
+
secondaryElements.set(container, element);
|
182
|
+
element.setAttribute('data-hot-input', ''); // Makes the element recognizable by Hot as its own component's element.
|
183
|
+
element.className = 'HandsontableCopyPaste';
|
184
|
+
element.tabIndex = -1;
|
185
|
+
element.autocomplete = 'off';
|
186
|
+
element.wrap = 'hard';
|
187
|
+
element.value = ' ';
|
188
|
+
container.appendChild(element);
|
189
|
+
return element;
|
190
|
+
}
|
191
|
+
|
192
|
+
/**
|
193
|
+
* Destroy the FocusableWrapper instance.
|
194
|
+
*
|
195
|
+
* @param {FocusableWrapper} wrapper The instance of the FocusableWrapper class.
|
196
|
+
*/
|
197
|
+
function destroyElement(wrapper) {
|
198
|
+
if (!(wrapper instanceof FocusableWrapper)) {
|
199
|
+
return;
|
200
|
+
}
|
201
|
+
var counter = refCounter.get(wrapper.container);
|
202
|
+
counter = isNaN(counter) ? 0 : counter;
|
203
|
+
if (counter > 0) {
|
204
|
+
counter -= 1;
|
205
|
+
}
|
206
|
+
deactivateElement(wrapper);
|
207
|
+
if (counter <= 0) {
|
208
|
+
counter = 0;
|
209
|
+
|
210
|
+
// Detach secondary element from the DOM.
|
211
|
+
var secondaryElement = secondaryElements.get(wrapper.container);
|
212
|
+
if (secondaryElement && secondaryElement.parentNode) {
|
213
|
+
secondaryElement.parentNode.removeChild(secondaryElement);
|
214
|
+
secondaryElements.delete(wrapper.container);
|
215
|
+
}
|
216
|
+
wrapper.mainElement = null;
|
217
|
+
}
|
218
|
+
refCounter.set(wrapper.container, counter);
|
219
|
+
}
|
@@ -0,0 +1,213 @@
|
|
1
|
+
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); }
|
2
|
+
import "core-js/modules/es.array.iterator.js";
|
3
|
+
import "core-js/modules/es.object.to-string.js";
|
4
|
+
import "core-js/modules/es.string.iterator.js";
|
5
|
+
import "core-js/modules/es.weak-set.js";
|
6
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
7
|
+
import "core-js/modules/es.weak-map.js";
|
8
|
+
import "core-js/modules/es.symbol.to-primitive.js";
|
9
|
+
import "core-js/modules/es.date.to-primitive.js";
|
10
|
+
import "core-js/modules/es.symbol.js";
|
11
|
+
import "core-js/modules/es.symbol.description.js";
|
12
|
+
import "core-js/modules/es.number.constructor.js";
|
13
|
+
import "core-js/modules/es.symbol.iterator.js";
|
14
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
15
|
+
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); } }
|
16
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
17
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
18
|
+
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); }
|
19
|
+
import EventManager from "../../eventManager.mjs";
|
20
|
+
import localHooks from "../../mixins/localHooks.mjs";
|
21
|
+
import { mixin } from "../../helpers/object.mjs";
|
22
|
+
import { isMobileBrowser } from "../../helpers/browser.mjs";
|
23
|
+
import { selectElementIfAllowed } from "../../helpers/dom/element.mjs";
|
24
|
+
/**
|
25
|
+
* @private
|
26
|
+
* @class FocusableWrapper
|
27
|
+
*/
|
28
|
+
var FocusableWrapper = /*#__PURE__*/function () {
|
29
|
+
function FocusableWrapper(container) {
|
30
|
+
_classCallCheck(this, FocusableWrapper);
|
31
|
+
this.rootDocument = container.defaultView ? container : container.ownerDocument;
|
32
|
+
/**
|
33
|
+
* The main/operational focusable element.
|
34
|
+
*
|
35
|
+
* @type {HTMLElement}
|
36
|
+
*/
|
37
|
+
this.mainElement = null;
|
38
|
+
/**
|
39
|
+
* Instance of EventManager.
|
40
|
+
*
|
41
|
+
* @type {EventManager}
|
42
|
+
*/
|
43
|
+
this.eventManager = new EventManager(this);
|
44
|
+
/**
|
45
|
+
* An object for tracking information about event listeners attached to the focusable element.
|
46
|
+
*
|
47
|
+
* @type {WeakSet}
|
48
|
+
*/
|
49
|
+
this.listenersCount = new WeakSet();
|
50
|
+
/**
|
51
|
+
* Parent for an focusable element.
|
52
|
+
*
|
53
|
+
* @type {HTMLElement}
|
54
|
+
*/
|
55
|
+
this.container = container;
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Switch to the secondary focusable element. Used when no any main focusable element is provided.
|
60
|
+
*/
|
61
|
+
_createClass(FocusableWrapper, [{
|
62
|
+
key: "useSecondaryElement",
|
63
|
+
value: function useSecondaryElement() {
|
64
|
+
var el = createOrGetSecondaryElement(this.container);
|
65
|
+
if (!this.listenersCount.has(el)) {
|
66
|
+
this.listenersCount.add(el);
|
67
|
+
forwardEventsToLocalHooks(this.eventManager, el, this);
|
68
|
+
}
|
69
|
+
this.mainElement = el;
|
70
|
+
}
|
71
|
+
|
72
|
+
/**
|
73
|
+
* Switch to the main focusable element.
|
74
|
+
*
|
75
|
+
* @param {HTMLElement} element The DOM element.
|
76
|
+
*/
|
77
|
+
}, {
|
78
|
+
key: "setFocusableElement",
|
79
|
+
value: function setFocusableElement(element) {
|
80
|
+
if (!this.listenersCount.has(element)) {
|
81
|
+
this.listenersCount.add(element);
|
82
|
+
forwardEventsToLocalHooks(this.eventManager, element, this);
|
83
|
+
}
|
84
|
+
this.mainElement = element;
|
85
|
+
}
|
86
|
+
|
87
|
+
/**
|
88
|
+
* Get currently set focusable element.
|
89
|
+
*
|
90
|
+
* @returns {HTMLElement}
|
91
|
+
*/
|
92
|
+
}, {
|
93
|
+
key: "getFocusableElement",
|
94
|
+
value: function getFocusableElement() {
|
95
|
+
return this.mainElement;
|
96
|
+
}
|
97
|
+
|
98
|
+
/**
|
99
|
+
* Set focus to the focusable element.
|
100
|
+
*/
|
101
|
+
}, {
|
102
|
+
key: "focus",
|
103
|
+
value: function focus() {
|
104
|
+
// Add an empty space to texarea. It is necessary for safari to enable "copy" command from menu bar.
|
105
|
+
this.mainElement.value = ' ';
|
106
|
+
if (!isMobileBrowser()) {
|
107
|
+
selectElementIfAllowed(this.mainElement);
|
108
|
+
}
|
109
|
+
}
|
110
|
+
}]);
|
111
|
+
return FocusableWrapper;
|
112
|
+
}();
|
113
|
+
mixin(FocusableWrapper, localHooks);
|
114
|
+
var refCounter = new WeakMap();
|
115
|
+
|
116
|
+
/**
|
117
|
+
* Create and return the FocusableWrapper instance.
|
118
|
+
*
|
119
|
+
* @param {HTMLElement} container The container element, holder for focusable elements.
|
120
|
+
* @returns {FocusableWrapper}
|
121
|
+
*/
|
122
|
+
function createElement(container) {
|
123
|
+
var focusableWrapper = new FocusableWrapper(container);
|
124
|
+
var counter = refCounter.get(container);
|
125
|
+
counter = isNaN(counter) ? 0 : counter;
|
126
|
+
refCounter.set(container, counter + 1);
|
127
|
+
return focusableWrapper;
|
128
|
+
}
|
129
|
+
|
130
|
+
/**
|
131
|
+
* Deactivate the FocusableWrapper instance.
|
132
|
+
*
|
133
|
+
* @param {FocusableWrapper} wrapper The instance of the FocusableWrapper class.
|
134
|
+
*/
|
135
|
+
function deactivateElement(wrapper) {
|
136
|
+
wrapper.eventManager.clear();
|
137
|
+
}
|
138
|
+
var runLocalHooks = function runLocalHooks(eventName, subject) {
|
139
|
+
return function (event) {
|
140
|
+
return subject.runLocalHooks(eventName, event);
|
141
|
+
};
|
142
|
+
};
|
143
|
+
|
144
|
+
/**
|
145
|
+
* Register copy/cut/paste events and forward their actions to the subject local hooks system.
|
146
|
+
*
|
147
|
+
* @param {EventManager} eventManager The instance of the EventManager class.
|
148
|
+
* @param {HTMLElement} element The element on which the listeners are mounted.
|
149
|
+
* @param {FocusableWrapper} subject The subject object for local hooks.
|
150
|
+
*/
|
151
|
+
function forwardEventsToLocalHooks(eventManager, element, subject) {
|
152
|
+
eventManager.addEventListener(element, 'copy', runLocalHooks('copy', subject));
|
153
|
+
eventManager.addEventListener(element, 'cut', runLocalHooks('cut', subject));
|
154
|
+
eventManager.addEventListener(element, 'paste', runLocalHooks('paste', subject));
|
155
|
+
}
|
156
|
+
var secondaryElements = new WeakMap();
|
157
|
+
|
158
|
+
/**
|
159
|
+
* Create and attach newly created focusable element to the DOM.
|
160
|
+
*
|
161
|
+
* @param {HTMLElement} container The container element, holder for focusable elements.
|
162
|
+
* @returns {HTMLElement}
|
163
|
+
*/
|
164
|
+
function createOrGetSecondaryElement(container) {
|
165
|
+
var secondaryElement = secondaryElements.get(container);
|
166
|
+
if (secondaryElement) {
|
167
|
+
if (!secondaryElement.parentElement) {
|
168
|
+
container.appendChild(secondaryElement);
|
169
|
+
}
|
170
|
+
return secondaryElement;
|
171
|
+
}
|
172
|
+
var doc = container.defaultView ? container : container.ownerDocument;
|
173
|
+
var element = doc.createElement('textarea');
|
174
|
+
secondaryElements.set(container, element);
|
175
|
+
element.setAttribute('data-hot-input', ''); // Makes the element recognizable by Hot as its own component's element.
|
176
|
+
element.className = 'HandsontableCopyPaste';
|
177
|
+
element.tabIndex = -1;
|
178
|
+
element.autocomplete = 'off';
|
179
|
+
element.wrap = 'hard';
|
180
|
+
element.value = ' ';
|
181
|
+
container.appendChild(element);
|
182
|
+
return element;
|
183
|
+
}
|
184
|
+
|
185
|
+
/**
|
186
|
+
* Destroy the FocusableWrapper instance.
|
187
|
+
*
|
188
|
+
* @param {FocusableWrapper} wrapper The instance of the FocusableWrapper class.
|
189
|
+
*/
|
190
|
+
function destroyElement(wrapper) {
|
191
|
+
if (!(wrapper instanceof FocusableWrapper)) {
|
192
|
+
return;
|
193
|
+
}
|
194
|
+
var counter = refCounter.get(wrapper.container);
|
195
|
+
counter = isNaN(counter) ? 0 : counter;
|
196
|
+
if (counter > 0) {
|
197
|
+
counter -= 1;
|
198
|
+
}
|
199
|
+
deactivateElement(wrapper);
|
200
|
+
if (counter <= 0) {
|
201
|
+
counter = 0;
|
202
|
+
|
203
|
+
// Detach secondary element from the DOM.
|
204
|
+
var secondaryElement = secondaryElements.get(wrapper.container);
|
205
|
+
if (secondaryElement && secondaryElement.parentNode) {
|
206
|
+
secondaryElement.parentNode.removeChild(secondaryElement);
|
207
|
+
secondaryElements.delete(wrapper.container);
|
208
|
+
}
|
209
|
+
wrapper.mainElement = null;
|
210
|
+
}
|
211
|
+
refCounter.set(wrapper.container, counter);
|
212
|
+
}
|
213
|
+
export { createElement, deactivateElement, destroyElement };
|
@@ -735,12 +735,10 @@ var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
|
|
735
735
|
}, {
|
736
736
|
key: "checkCustomSelectionsFromContextMenu",
|
737
737
|
value: function checkCustomSelectionsFromContextMenu(border, place, remove) {
|
738
|
-
var _this12 = this;
|
739
738
|
var check = false;
|
740
739
|
(0, _array.arrayEach)(this.hot.selection.highlight.customSelections, function (customSelection) {
|
741
740
|
if (border.id === customSelection.settings.id) {
|
742
|
-
|
743
|
-
(0, _array.arrayEach)(borders, function (borderObject) {
|
741
|
+
(0, _object.objectEach)(customSelection.instanceBorders, function (borderObject) {
|
744
742
|
borderObject.toggleHiddenClass(place, remove); // TODO this also bad?
|
745
743
|
});
|
746
744
|
|
@@ -765,7 +763,6 @@ var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
|
|
765
763
|
}, {
|
766
764
|
key: "checkCustomSelections",
|
767
765
|
value: function checkCustomSelections(border, cellRange, place) {
|
768
|
-
var _this13 = this;
|
769
766
|
var hideCount = this.countHide(border);
|
770
767
|
var check = false;
|
771
768
|
if (hideCount === 4) {
|
@@ -777,8 +774,7 @@ var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
|
|
777
774
|
customSelection.visualCellRange = cellRange;
|
778
775
|
customSelection.commit();
|
779
776
|
if (place) {
|
780
|
-
|
781
|
-
(0, _array.arrayEach)(borders, function (borderObject) {
|
777
|
+
(0, _object.objectEach)(customSelection.instanceBorders, function (borderObject) {
|
782
778
|
borderObject.changeBorderStyle(place, border);
|
783
779
|
});
|
784
780
|
}
|
@@ -45,7 +45,7 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
45
45
|
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
46
46
|
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); }
|
47
47
|
import { BasePlugin } from "../base/index.mjs";
|
48
|
-
import { hasOwnProperty, deepClone } from "../../helpers/object.mjs";
|
48
|
+
import { hasOwnProperty, objectEach, deepClone } from "../../helpers/object.mjs";
|
49
49
|
import { rangeEach } from "../../helpers/number.mjs";
|
50
50
|
import { arrayEach, arrayReduce, arrayMap } from "../../helpers/array.mjs";
|
51
51
|
import * as C from "../../i18n/constants.mjs";
|
@@ -726,12 +726,10 @@ export var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
|
|
726
726
|
}, {
|
727
727
|
key: "checkCustomSelectionsFromContextMenu",
|
728
728
|
value: function checkCustomSelectionsFromContextMenu(border, place, remove) {
|
729
|
-
var _this12 = this;
|
730
729
|
var check = false;
|
731
730
|
arrayEach(this.hot.selection.highlight.customSelections, function (customSelection) {
|
732
731
|
if (border.id === customSelection.settings.id) {
|
733
|
-
|
734
|
-
arrayEach(borders, function (borderObject) {
|
732
|
+
objectEach(customSelection.instanceBorders, function (borderObject) {
|
735
733
|
borderObject.toggleHiddenClass(place, remove); // TODO this also bad?
|
736
734
|
});
|
737
735
|
|
@@ -756,7 +754,6 @@ export var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
|
|
756
754
|
}, {
|
757
755
|
key: "checkCustomSelections",
|
758
756
|
value: function checkCustomSelections(border, cellRange, place) {
|
759
|
-
var _this13 = this;
|
760
757
|
var hideCount = this.countHide(border);
|
761
758
|
var check = false;
|
762
759
|
if (hideCount === 4) {
|
@@ -768,8 +765,7 @@ export var CustomBorders = /*#__PURE__*/function (_BasePlugin) {
|
|
768
765
|
customSelection.visualCellRange = cellRange;
|
769
766
|
customSelection.commit();
|
770
767
|
if (place) {
|
771
|
-
|
772
|
-
arrayEach(borders, function (borderObject) {
|
768
|
+
objectEach(customSelection.instanceBorders, function (borderObject) {
|
773
769
|
borderObject.changeBorderStyle(place, border);
|
774
770
|
});
|
775
771
|
}
|
@@ -329,6 +329,11 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
329
329
|
* * `between` - Between
|
330
330
|
* * `by_value` - By value
|
331
331
|
* * `contains` - Contains
|
332
|
+
* * `date_after` - After a date
|
333
|
+
* * `date_before` - Before a date
|
334
|
+
* * `date_today` - Today
|
335
|
+
* * `date_tomorrow` - Tomorrow
|
336
|
+
* * `date_yesterday` - Yesterday
|
332
337
|
* * `empty` - Empty
|
333
338
|
* * `ends_with` - Ends with
|
334
339
|
* * `eq` - Equal
|
@@ -319,6 +319,11 @@ export var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
319
319
|
* * `between` - Between
|
320
320
|
* * `by_value` - By value
|
321
321
|
* * `contains` - Contains
|
322
|
+
* * `date_after` - After a date
|
323
|
+
* * `date_before` - Before a date
|
324
|
+
* * `date_today` - Today
|
325
|
+
* * `date_tomorrow` - Tomorrow
|
326
|
+
* * `date_yesterday` - Yesterday
|
322
327
|
* * `empty` - Empty
|
323
328
|
* * `ends_with` - Ends with
|
324
329
|
* * `eq` - Equal
|