handsontable 12.3.3 → 12.4.0-next-ddbea0c-20230512
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/3rdparty/walkontable/src/cell/coords.js +13 -16
- package/3rdparty/walkontable/src/cell/coords.mjs +13 -16
- 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 +16 -20
- package/3rdparty/walkontable/src/core/_base.mjs +16 -20
- package/3rdparty/walkontable/src/event.js +4 -0
- package/3rdparty/walkontable/src/event.mjs +4 -0
- package/3rdparty/walkontable/src/overlay/_base.js +6 -7
- package/3rdparty/walkontable/src/overlay/_base.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.js +6 -7
- package/3rdparty/walkontable/src/overlay/bottom.mjs +6 -7
- package/3rdparty/walkontable/src/overlay/top.js +6 -7
- package/3rdparty/walkontable/src/overlay/top.mjs +6 -7
- 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/scroll.js +20 -23
- package/3rdparty/walkontable/src/scroll.mjs +20 -23
- package/3rdparty/walkontable/src/settings.js +13 -15
- package/3rdparty/walkontable/src/settings.mjs +13 -15
- package/3rdparty/walkontable/src/table.js +22 -26
- package/3rdparty/walkontable/src/table.mjs +22 -26
- package/CHANGELOG.md +14 -0
- package/base.js +2 -4
- package/base.mjs +2 -2
- package/core.js +23 -6
- package/core.mjs +23 -6
- package/dataMap/dataSource.js +5 -5
- package/dataMap/dataSource.mjs +5 -5
- package/dataMap/metaManager/metaSchema.js +9 -7
- package/dataMap/metaManager/metaSchema.mjs +9 -7
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +7364 -5992
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +256 -234
- package/dist/handsontable.js +4326 -3275
- package/dist/handsontable.min.css +2 -2
- 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/editors/autocompleteEditor/autocompleteEditor.js +8 -9
- package/editors/autocompleteEditor/autocompleteEditor.mjs +8 -9
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- 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 +16 -6
- package/pluginHooks.mjs +15 -3
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/base/base.js +9 -10
- package/plugins/base/base.mjs +9 -10
- package/plugins/collapsibleColumns/collapsibleColumns.js +24 -7
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +24 -7
- package/plugins/copyPaste/copyPaste.js +92 -16
- package/plugins/copyPaste/copyPaste.mjs +92 -16
- package/plugins/copyPaste/copyableRanges.js +39 -39
- package/plugins/copyPaste/copyableRanges.mjs +32 -32
- package/plugins/customBorders/customBorders.d.ts +2 -0
- package/plugins/customBorders/customBorders.js +6 -7
- package/plugins/customBorders/customBorders.mjs +6 -7
- package/plugins/filters/filters.js +5 -0
- package/plugins/filters/filters.mjs +5 -0
- package/plugins/formulas/engine/register.js +9 -0
- package/plugins/formulas/engine/register.mjs +13 -4
- package/plugins/formulas/engine/settings.js +18 -3
- package/plugins/formulas/engine/settings.mjs +16 -3
- package/plugins/formulas/formulas.js +308 -162
- package/plugins/formulas/formulas.mjs +308 -163
- 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/formulas/utils.js +81 -0
- package/plugins/formulas/utils.mjs +74 -0
- package/plugins/hiddenColumns/hiddenColumns.js +12 -7
- package/plugins/hiddenColumns/hiddenColumns.mjs +12 -7
- package/plugins/hiddenRows/hiddenRows.js +12 -7
- package/plugins/hiddenRows/hiddenRows.mjs +12 -7
- package/plugins/manualRowMove/manualRowMove.js +26 -11
- package/plugins/manualRowMove/manualRowMove.mjs +27 -12
- package/plugins/nestedHeaders/nestedHeaders.js +26 -7
- package/plugins/nestedHeaders/nestedHeaders.mjs +26 -7
- package/plugins/nestedHeaders/stateManager/headersTree.js +23 -26
- package/plugins/nestedHeaders/stateManager/headersTree.mjs +20 -23
- package/plugins/nestedHeaders/stateManager/index.js +21 -3
- package/plugins/nestedHeaders/stateManager/index.mjs +18 -0
- package/plugins/nestedHeaders/stateManager/matrixGenerator.js +1 -0
- package/plugins/nestedHeaders/stateManager/settingsNormalizer.js +1 -1
- package/plugins/nestedHeaders/stateManager/sourceSettings.js +19 -0
- package/plugins/nestedHeaders/stateManager/sourceSettings.mjs +19 -0
- 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/selection/highlight/visualSelection.js +5 -6
- package/selection/highlight/visualSelection.mjs +5 -6
- package/tableView.js +62 -72
- package/tableView.mjs +62 -72
- package/translations/changesObservable/observable.js +41 -46
- package/translations/changesObservable/observable.mjs +36 -41
- package/translations/changesObservable/observer.js +8 -1
- package/translations/changesObservable/observer.mjs +7 -0
- package/translations/indexMapper.js +21 -0
- package/translations/indexMapper.mjs +21 -0
- package/translations/maps/linkedPhysicalIndexToValueMap.js +6 -0
- package/translations/maps/linkedPhysicalIndexToValueMap.mjs +6 -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
@@ -0,0 +1,219 @@
|
|
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-map.js";
|
6
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
7
|
+
import "core-js/modules/es.symbol.to-primitive.js";
|
8
|
+
import "core-js/modules/es.date.to-primitive.js";
|
9
|
+
import "core-js/modules/es.symbol.js";
|
10
|
+
import "core-js/modules/es.symbol.description.js";
|
11
|
+
import "core-js/modules/es.number.constructor.js";
|
12
|
+
import "core-js/modules/es.symbol.iterator.js";
|
13
|
+
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
14
|
+
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); } }
|
15
|
+
function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); Object.defineProperty(Constructor, "prototype", { writable: false }); return Constructor; }
|
16
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
17
|
+
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); }
|
18
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
19
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
20
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
21
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
22
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
23
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
24
|
+
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; } }
|
25
|
+
import AxisSyncer from "./axisSyncer.mjs";
|
26
|
+
/**
|
27
|
+
* @private
|
28
|
+
* @class IndexSyncer
|
29
|
+
* @description
|
30
|
+
*
|
31
|
+
* Indexes synchronizer responsible for providing logic for syncing actions done on indexes for HOT to actions performed
|
32
|
+
* on HF's.
|
33
|
+
*
|
34
|
+
*/
|
35
|
+
var _rowIndexSyncer = /*#__PURE__*/new WeakMap();
|
36
|
+
var _columnIndexSyncer = /*#__PURE__*/new WeakMap();
|
37
|
+
var _postponeAction = /*#__PURE__*/new WeakMap();
|
38
|
+
var _isPerformingUndo = /*#__PURE__*/new WeakMap();
|
39
|
+
var _isPerformingRedo = /*#__PURE__*/new WeakMap();
|
40
|
+
var _engine = /*#__PURE__*/new WeakMap();
|
41
|
+
var _sheetId = /*#__PURE__*/new WeakMap();
|
42
|
+
var IndexSyncer = /*#__PURE__*/function () {
|
43
|
+
function IndexSyncer(rowIndexMapper, columnIndexMapper, postponeAction) {
|
44
|
+
_classCallCheck(this, IndexSyncer);
|
45
|
+
/**
|
46
|
+
* Indexes synchronizer for the axis of the rows.
|
47
|
+
*
|
48
|
+
* @private
|
49
|
+
* @type {AxisSyncer}
|
50
|
+
*/
|
51
|
+
_classPrivateFieldInitSpec(this, _rowIndexSyncer, {
|
52
|
+
writable: true,
|
53
|
+
value: void 0
|
54
|
+
});
|
55
|
+
/**
|
56
|
+
* Indexes synchronizer for the axis of the columns.
|
57
|
+
*
|
58
|
+
* @private
|
59
|
+
* @type {AxisSyncer}
|
60
|
+
*/
|
61
|
+
_classPrivateFieldInitSpec(this, _columnIndexSyncer, {
|
62
|
+
writable: true,
|
63
|
+
value: void 0
|
64
|
+
});
|
65
|
+
/**
|
66
|
+
* Method which will postpone execution of some action (needed when synchronization endpoint isn't setup yet).
|
67
|
+
*
|
68
|
+
* @private
|
69
|
+
* @type {Function}
|
70
|
+
*/
|
71
|
+
_classPrivateFieldInitSpec(this, _postponeAction, {
|
72
|
+
writable: true,
|
73
|
+
value: void 0
|
74
|
+
});
|
75
|
+
/**
|
76
|
+
* Flag informing whether undo is already performed (we don't perform synchronization in such case).
|
77
|
+
*
|
78
|
+
* @private
|
79
|
+
* @type {boolean}
|
80
|
+
*/
|
81
|
+
_classPrivateFieldInitSpec(this, _isPerformingUndo, {
|
82
|
+
writable: true,
|
83
|
+
value: false
|
84
|
+
});
|
85
|
+
/**
|
86
|
+
* Flag informing whether redo is already performed (we don't perform synchronization in such case).
|
87
|
+
*
|
88
|
+
* @private
|
89
|
+
* @type {boolean}
|
90
|
+
*/
|
91
|
+
_classPrivateFieldInitSpec(this, _isPerformingRedo, {
|
92
|
+
writable: true,
|
93
|
+
value: false
|
94
|
+
});
|
95
|
+
/**
|
96
|
+
* The HF's engine instance which will be synced.
|
97
|
+
*
|
98
|
+
* @private
|
99
|
+
* @type {HyperFormula|null}
|
100
|
+
*/
|
101
|
+
_classPrivateFieldInitSpec(this, _engine, {
|
102
|
+
writable: true,
|
103
|
+
value: null
|
104
|
+
});
|
105
|
+
/**
|
106
|
+
* HyperFormula's sheet name.
|
107
|
+
*
|
108
|
+
* @private
|
109
|
+
* @type {string|null}
|
110
|
+
*/
|
111
|
+
_classPrivateFieldInitSpec(this, _sheetId, {
|
112
|
+
writable: true,
|
113
|
+
value: null
|
114
|
+
});
|
115
|
+
_classPrivateFieldSet(this, _rowIndexSyncer, new AxisSyncer('row', rowIndexMapper, this));
|
116
|
+
_classPrivateFieldSet(this, _columnIndexSyncer, new AxisSyncer('column', columnIndexMapper, this));
|
117
|
+
_classPrivateFieldSet(this, _postponeAction, postponeAction);
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Gets index synchronizer for a particular axis.
|
122
|
+
*
|
123
|
+
* @param {'row'|'column'} indexType Type of indexes.
|
124
|
+
* @returns {AxisSyncer}
|
125
|
+
*/
|
126
|
+
_createClass(IndexSyncer, [{
|
127
|
+
key: "getForAxis",
|
128
|
+
value: function getForAxis(indexType) {
|
129
|
+
if (indexType === 'row') {
|
130
|
+
return _classPrivateFieldGet(this, _rowIndexSyncer);
|
131
|
+
}
|
132
|
+
return _classPrivateFieldGet(this, _columnIndexSyncer);
|
133
|
+
}
|
134
|
+
|
135
|
+
/**
|
136
|
+
* Sets flag informing whether an undo action is already performed (we don't execute synchronization in such case).
|
137
|
+
*
|
138
|
+
* @param {boolean} flagValue Boolean value for the flag.
|
139
|
+
*/
|
140
|
+
}, {
|
141
|
+
key: "setPerformUndo",
|
142
|
+
value: function setPerformUndo(flagValue) {
|
143
|
+
_classPrivateFieldSet(this, _isPerformingUndo, flagValue);
|
144
|
+
}
|
145
|
+
|
146
|
+
/**
|
147
|
+
* Sets flag informing whether a redo action is already performed (we don't execute synchronization in such case).
|
148
|
+
*
|
149
|
+
* @param {boolean} flagValue Boolean value for the flag.
|
150
|
+
*/
|
151
|
+
}, {
|
152
|
+
key: "setPerformRedo",
|
153
|
+
value: function setPerformRedo(flagValue) {
|
154
|
+
_classPrivateFieldSet(this, _isPerformingRedo, flagValue);
|
155
|
+
}
|
156
|
+
|
157
|
+
/**
|
158
|
+
* Gets information whether redo or undo action is already performed (we don't execute synchronization in such case).
|
159
|
+
*
|
160
|
+
* @private
|
161
|
+
* @returns {boolean}
|
162
|
+
*/
|
163
|
+
}, {
|
164
|
+
key: "isPerformingUndoRedo",
|
165
|
+
value: function isPerformingUndoRedo() {
|
166
|
+
return _classPrivateFieldGet(this, _isPerformingUndo) || _classPrivateFieldGet(this, _isPerformingRedo);
|
167
|
+
}
|
168
|
+
|
169
|
+
/**
|
170
|
+
* Gets HyperFormula's sheet id.
|
171
|
+
*
|
172
|
+
* @returns {string|null}
|
173
|
+
*/
|
174
|
+
}, {
|
175
|
+
key: "getSheetId",
|
176
|
+
value: function getSheetId() {
|
177
|
+
return _classPrivateFieldGet(this, _sheetId);
|
178
|
+
}
|
179
|
+
|
180
|
+
/**
|
181
|
+
* Gets engine instance that will be used for handled instance of Handsontable.
|
182
|
+
*
|
183
|
+
* @type {HyperFormula|null}
|
184
|
+
*/
|
185
|
+
}, {
|
186
|
+
key: "getEngine",
|
187
|
+
value: function getEngine() {
|
188
|
+
return _classPrivateFieldGet(this, _engine);
|
189
|
+
}
|
190
|
+
|
191
|
+
/**
|
192
|
+
* Gets method which will postpone execution of some action (needed when synchronization endpoint isn't setup yet).
|
193
|
+
*
|
194
|
+
* @returns {Function}
|
195
|
+
*/
|
196
|
+
}, {
|
197
|
+
key: "getPostponeAction",
|
198
|
+
value: function getPostponeAction() {
|
199
|
+
return _classPrivateFieldGet(this, _postponeAction);
|
200
|
+
}
|
201
|
+
|
202
|
+
/**
|
203
|
+
* Setups a synchronization endpoint.
|
204
|
+
*
|
205
|
+
* @param {HyperFormula|null} engine The HF's engine instance which will be synced.
|
206
|
+
* @param {string|null} sheetId HyperFormula's sheet name.
|
207
|
+
*/
|
208
|
+
}, {
|
209
|
+
key: "setupSyncEndpoint",
|
210
|
+
value: function setupSyncEndpoint(engine, sheetId) {
|
211
|
+
_classPrivateFieldSet(this, _engine, engine);
|
212
|
+
_classPrivateFieldSet(this, _sheetId, sheetId);
|
213
|
+
_classPrivateFieldGet(this, _rowIndexSyncer).init();
|
214
|
+
_classPrivateFieldGet(this, _columnIndexSyncer).init();
|
215
|
+
}
|
216
|
+
}]);
|
217
|
+
return IndexSyncer;
|
218
|
+
}();
|
219
|
+
export default IndexSyncer;
|
@@ -1,8 +1,19 @@
|
|
1
1
|
"use strict";
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
|
+
exports.getDateFromExcelDate = getDateFromExcelDate;
|
5
|
+
exports.getDateInHfFormat = getDateInHfFormat;
|
6
|
+
exports.getDateInHotFormat = getDateInHotFormat;
|
7
|
+
exports.isDate = isDate;
|
8
|
+
exports.isDateValid = isDateValid;
|
4
9
|
exports.isEscapedFormulaExpression = isEscapedFormulaExpression;
|
10
|
+
exports.isFormula = isFormula;
|
5
11
|
exports.unescapeFormulaExpression = unescapeFormulaExpression;
|
12
|
+
require("core-js/modules/es.string.starts-with.js");
|
13
|
+
var _moment = _interopRequireDefault(require("moment"));
|
14
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
15
|
+
var DEFAULT_DATE_FORMAT_HYPERFORMULA = 'DD/MM/YYYY';
|
16
|
+
|
6
17
|
/**
|
7
18
|
* Checks if provided formula expression is escaped.
|
8
19
|
*
|
@@ -21,4 +32,74 @@ function isEscapedFormulaExpression(expression) {
|
|
21
32
|
*/
|
22
33
|
function unescapeFormulaExpression(expression) {
|
23
34
|
return isEscapedFormulaExpression(expression) ? expression.substr(1) : expression;
|
35
|
+
}
|
36
|
+
|
37
|
+
/**
|
38
|
+
* Checks whether string looks like formula or not. Corresponds to {@link https://hyperformula.handsontable.com/api/globals.html#isformula|HyperFormula's implementation}.
|
39
|
+
*
|
40
|
+
* @param {string} value Checked value.
|
41
|
+
* @returns {boolean}
|
42
|
+
*/
|
43
|
+
function isFormula(value) {
|
44
|
+
return typeof value === 'string' && value.startsWith('=');
|
45
|
+
}
|
46
|
+
|
47
|
+
/**
|
48
|
+
* Checks if provided value is a date according to cell meta.
|
49
|
+
*
|
50
|
+
* @param {*} value Checked value.
|
51
|
+
* @param {string} cellType Type of a cell.
|
52
|
+
* @returns {boolean}
|
53
|
+
*/
|
54
|
+
function isDate(value, cellType) {
|
55
|
+
return typeof value === 'string' && cellType === 'date';
|
56
|
+
}
|
57
|
+
|
58
|
+
/**
|
59
|
+
* Checks if provided date is a valid date according to cell date format.
|
60
|
+
*
|
61
|
+
* @param {*} date Checked date.
|
62
|
+
* @param {object} dateFormat Handled format for a date.
|
63
|
+
* @returns {boolean}
|
64
|
+
*/
|
65
|
+
function isDateValid(date, dateFormat) {
|
66
|
+
return (0, _moment.default)(date, dateFormat, true).isValid();
|
67
|
+
}
|
68
|
+
|
69
|
+
/**
|
70
|
+
* Returns date formatted in HF's default format.
|
71
|
+
*
|
72
|
+
* @param {string} date Date formatted according to Handsontable cell date format.
|
73
|
+
* @param {string} dateFormat The format used for the date passed.
|
74
|
+
* @returns {string}
|
75
|
+
*/
|
76
|
+
function getDateInHfFormat(date, dateFormat) {
|
77
|
+
return (0, _moment.default)(date, dateFormat, true).format(DEFAULT_DATE_FORMAT_HYPERFORMULA);
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Returns date formatted in HF's default format.
|
82
|
+
*
|
83
|
+
* @param {string} date Date formatted according to Handsontable cell date format.
|
84
|
+
* @param {string} dateFormat The format used for the date passed.
|
85
|
+
* @returns {string}
|
86
|
+
*/
|
87
|
+
function getDateInHotFormat(date, dateFormat) {
|
88
|
+
return (0, _moment.default)(date, DEFAULT_DATE_FORMAT_HYPERFORMULA, true).format(dateFormat);
|
89
|
+
}
|
90
|
+
|
91
|
+
/**
|
92
|
+
* Converts Excel-like dates into strings and formats them based on the handled date format.
|
93
|
+
*
|
94
|
+
* @param {number} numericDate An integer representing numbers of days from January 1, 1900.
|
95
|
+
* @param {string} dateFormat The format used for parsing an output.
|
96
|
+
* @returns {string}
|
97
|
+
*/
|
98
|
+
function getDateFromExcelDate(numericDate, dateFormat) {
|
99
|
+
// To replicate the behavior from the HyperFormula. UTC starts from 31/12/1899, while HF from 30/12/1899.
|
100
|
+
var dateOffset = -1;
|
101
|
+
|
102
|
+
// Based on solution from: https://stackoverflow.com/a/67130235.
|
103
|
+
var dateForFormatting = new Date(Date.UTC(0, 0, numericDate + dateOffset));
|
104
|
+
return (0, _moment.default)(dateForFormatting).format(dateFormat);
|
24
105
|
}
|
@@ -1,3 +1,7 @@
|
|
1
|
+
import "core-js/modules/es.string.starts-with.js";
|
2
|
+
import moment from 'moment';
|
3
|
+
var DEFAULT_DATE_FORMAT_HYPERFORMULA = 'DD/MM/YYYY';
|
4
|
+
|
1
5
|
/**
|
2
6
|
* Checks if provided formula expression is escaped.
|
3
7
|
*
|
@@ -16,4 +20,74 @@ export function isEscapedFormulaExpression(expression) {
|
|
16
20
|
*/
|
17
21
|
export function unescapeFormulaExpression(expression) {
|
18
22
|
return isEscapedFormulaExpression(expression) ? expression.substr(1) : expression;
|
23
|
+
}
|
24
|
+
|
25
|
+
/**
|
26
|
+
* Checks whether string looks like formula or not. Corresponds to {@link https://hyperformula.handsontable.com/api/globals.html#isformula|HyperFormula's implementation}.
|
27
|
+
*
|
28
|
+
* @param {string} value Checked value.
|
29
|
+
* @returns {boolean}
|
30
|
+
*/
|
31
|
+
export function isFormula(value) {
|
32
|
+
return typeof value === 'string' && value.startsWith('=');
|
33
|
+
}
|
34
|
+
|
35
|
+
/**
|
36
|
+
* Checks if provided value is a date according to cell meta.
|
37
|
+
*
|
38
|
+
* @param {*} value Checked value.
|
39
|
+
* @param {string} cellType Type of a cell.
|
40
|
+
* @returns {boolean}
|
41
|
+
*/
|
42
|
+
export function isDate(value, cellType) {
|
43
|
+
return typeof value === 'string' && cellType === 'date';
|
44
|
+
}
|
45
|
+
|
46
|
+
/**
|
47
|
+
* Checks if provided date is a valid date according to cell date format.
|
48
|
+
*
|
49
|
+
* @param {*} date Checked date.
|
50
|
+
* @param {object} dateFormat Handled format for a date.
|
51
|
+
* @returns {boolean}
|
52
|
+
*/
|
53
|
+
export function isDateValid(date, dateFormat) {
|
54
|
+
return moment(date, dateFormat, true).isValid();
|
55
|
+
}
|
56
|
+
|
57
|
+
/**
|
58
|
+
* Returns date formatted in HF's default format.
|
59
|
+
*
|
60
|
+
* @param {string} date Date formatted according to Handsontable cell date format.
|
61
|
+
* @param {string} dateFormat The format used for the date passed.
|
62
|
+
* @returns {string}
|
63
|
+
*/
|
64
|
+
export function getDateInHfFormat(date, dateFormat) {
|
65
|
+
return moment(date, dateFormat, true).format(DEFAULT_DATE_FORMAT_HYPERFORMULA);
|
66
|
+
}
|
67
|
+
|
68
|
+
/**
|
69
|
+
* Returns date formatted in HF's default format.
|
70
|
+
*
|
71
|
+
* @param {string} date Date formatted according to Handsontable cell date format.
|
72
|
+
* @param {string} dateFormat The format used for the date passed.
|
73
|
+
* @returns {string}
|
74
|
+
*/
|
75
|
+
export function getDateInHotFormat(date, dateFormat) {
|
76
|
+
return moment(date, DEFAULT_DATE_FORMAT_HYPERFORMULA, true).format(dateFormat);
|
77
|
+
}
|
78
|
+
|
79
|
+
/**
|
80
|
+
* Converts Excel-like dates into strings and formats them based on the handled date format.
|
81
|
+
*
|
82
|
+
* @param {number} numericDate An integer representing numbers of days from January 1, 1900.
|
83
|
+
* @param {string} dateFormat The format used for parsing an output.
|
84
|
+
* @returns {string}
|
85
|
+
*/
|
86
|
+
export function getDateFromExcelDate(numericDate, dateFormat) {
|
87
|
+
// To replicate the behavior from the HyperFormula. UTC starts from 31/12/1899, while HF from 30/12/1899.
|
88
|
+
var dateOffset = -1;
|
89
|
+
|
90
|
+
// Based on solution from: https://stackoverflow.com/a/67130235.
|
91
|
+
var dateForFormatting = new Date(Date.UTC(0, 0, numericDate + dateOffset));
|
92
|
+
return moment(dateForFormatting).format(dateFormat);
|
19
93
|
}
|
@@ -188,10 +188,22 @@ var HiddenColumns = /*#__PURE__*/function (_BasePlugin) {
|
|
188
188
|
args[_key] = arguments[_key];
|
189
189
|
}
|
190
190
|
_this = _super.call.apply(_super, [this].concat(args));
|
191
|
+
/**
|
192
|
+
* Cached plugin settings.
|
193
|
+
*
|
194
|
+
* @private
|
195
|
+
* @type {object}
|
196
|
+
*/
|
191
197
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _settings, {
|
192
198
|
writable: true,
|
193
199
|
value: {}
|
194
200
|
});
|
201
|
+
/**
|
202
|
+
* Map of hidden columns by the plugin.
|
203
|
+
*
|
204
|
+
* @private
|
205
|
+
* @type {null|HidingMap}
|
206
|
+
*/
|
195
207
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _hiddenColumnsMap, {
|
196
208
|
writable: true,
|
197
209
|
value: null
|
@@ -611,13 +623,6 @@ var HiddenColumns = /*#__PURE__*/function (_BasePlugin) {
|
|
611
623
|
get: function get() {
|
612
624
|
return PLUGIN_PRIORITY;
|
613
625
|
}
|
614
|
-
|
615
|
-
/**
|
616
|
-
* Cached plugin settings.
|
617
|
-
*
|
618
|
-
* @private
|
619
|
-
* @type {object}
|
620
|
-
*/
|
621
626
|
}]);
|
622
627
|
return HiddenColumns;
|
623
628
|
}(_base.BasePlugin);
|
@@ -181,10 +181,22 @@ export var HiddenColumns = /*#__PURE__*/function (_BasePlugin) {
|
|
181
181
|
args[_key] = arguments[_key];
|
182
182
|
}
|
183
183
|
_this = _super.call.apply(_super, [this].concat(args));
|
184
|
+
/**
|
185
|
+
* Cached plugin settings.
|
186
|
+
*
|
187
|
+
* @private
|
188
|
+
* @type {object}
|
189
|
+
*/
|
184
190
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _settings, {
|
185
191
|
writable: true,
|
186
192
|
value: {}
|
187
193
|
});
|
194
|
+
/**
|
195
|
+
* Map of hidden columns by the plugin.
|
196
|
+
*
|
197
|
+
* @private
|
198
|
+
* @type {null|HidingMap}
|
199
|
+
*/
|
188
200
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _hiddenColumnsMap, {
|
189
201
|
writable: true,
|
190
202
|
value: null
|
@@ -604,13 +616,6 @@ export var HiddenColumns = /*#__PURE__*/function (_BasePlugin) {
|
|
604
616
|
get: function get() {
|
605
617
|
return PLUGIN_PRIORITY;
|
606
618
|
}
|
607
|
-
|
608
|
-
/**
|
609
|
-
* Cached plugin settings.
|
610
|
-
*
|
611
|
-
* @private
|
612
|
-
* @type {object}
|
613
|
-
*/
|
614
619
|
}]);
|
615
620
|
return HiddenColumns;
|
616
621
|
}(BasePlugin);
|
@@ -188,10 +188,22 @@ var HiddenRows = /*#__PURE__*/function (_BasePlugin) {
|
|
188
188
|
args[_key] = arguments[_key];
|
189
189
|
}
|
190
190
|
_this = _super.call.apply(_super, [this].concat(args));
|
191
|
+
/**
|
192
|
+
* Cached settings from Handsontable settings.
|
193
|
+
*
|
194
|
+
* @private
|
195
|
+
* @type {object}
|
196
|
+
*/
|
191
197
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _settings, {
|
192
198
|
writable: true,
|
193
199
|
value: {}
|
194
200
|
});
|
201
|
+
/**
|
202
|
+
* Map of hidden rows by the plugin.
|
203
|
+
*
|
204
|
+
* @private
|
205
|
+
* @type {HidingMap|null}
|
206
|
+
*/
|
195
207
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _hiddenRowsMap, {
|
196
208
|
writable: true,
|
197
209
|
value: null
|
@@ -603,13 +615,6 @@ var HiddenRows = /*#__PURE__*/function (_BasePlugin) {
|
|
603
615
|
get: function get() {
|
604
616
|
return PLUGIN_PRIORITY;
|
605
617
|
}
|
606
|
-
|
607
|
-
/**
|
608
|
-
* Cached settings from Handsontable settings.
|
609
|
-
*
|
610
|
-
* @private
|
611
|
-
* @type {object}
|
612
|
-
*/
|
613
618
|
}]);
|
614
619
|
return HiddenRows;
|
615
620
|
}(_base.BasePlugin);
|
@@ -181,10 +181,22 @@ export var HiddenRows = /*#__PURE__*/function (_BasePlugin) {
|
|
181
181
|
args[_key] = arguments[_key];
|
182
182
|
}
|
183
183
|
_this = _super.call.apply(_super, [this].concat(args));
|
184
|
+
/**
|
185
|
+
* Cached settings from Handsontable settings.
|
186
|
+
*
|
187
|
+
* @private
|
188
|
+
* @type {object}
|
189
|
+
*/
|
184
190
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _settings, {
|
185
191
|
writable: true,
|
186
192
|
value: {}
|
187
193
|
});
|
194
|
+
/**
|
195
|
+
* Map of hidden rows by the plugin.
|
196
|
+
*
|
197
|
+
* @private
|
198
|
+
* @type {HidingMap|null}
|
199
|
+
*/
|
188
200
|
_classPrivateFieldInitSpec(_assertThisInitialized(_this), _hiddenRowsMap, {
|
189
201
|
writable: true,
|
190
202
|
value: null
|
@@ -596,13 +608,6 @@ export var HiddenRows = /*#__PURE__*/function (_BasePlugin) {
|
|
596
608
|
get: function get() {
|
597
609
|
return PLUGIN_PRIORITY;
|
598
610
|
}
|
599
|
-
|
600
|
-
/**
|
601
|
-
* Cached settings from Handsontable settings.
|
602
|
-
*
|
603
|
-
* @private
|
604
|
-
* @type {object}
|
605
|
-
*/
|
606
611
|
}]);
|
607
612
|
return HiddenRows;
|
608
613
|
}(BasePlugin);
|
@@ -484,38 +484,53 @@ var ManualRowMove = /*#__PURE__*/function (_BasePlugin) {
|
|
484
484
|
}
|
485
485
|
var wtTable = this.hot.view._wt.wtTable;
|
486
486
|
var TD = priv.target.TD;
|
487
|
-
var
|
488
|
-
var
|
489
|
-
var
|
487
|
+
var rootElement = this.hot.rootElement;
|
488
|
+
var rootElementOffset = (0, _element.offset)(rootElement);
|
489
|
+
var trimmingContainer = (0, _element.getTrimmingContainer)(rootElement);
|
490
|
+
var tableScroll = wtTable.holder.scrollTop;
|
491
|
+
var trimmingContainerScroll;
|
492
|
+
|
493
|
+
// Trimming container is the `window` element.
|
494
|
+
if (this.hot.rootWindow === trimmingContainer) {
|
495
|
+
trimmingContainerScroll = trimmingContainer.scrollY;
|
496
|
+
} else {
|
497
|
+
trimmingContainerScroll = trimmingContainer.scrollTop;
|
498
|
+
}
|
499
|
+
var pixelsAbove = rootElementOffset.top - trimmingContainerScroll;
|
500
|
+
var pixelsRelToTableStart = priv.target.eventPageY - pixelsAbove + tableScroll;
|
490
501
|
var hiderHeight = wtTable.hider.offsetHeight;
|
491
502
|
var tbodyOffsetTop = wtTable.TBODY.offsetTop;
|
492
503
|
var backlightElemMarginTop = this.backlight.getOffset().top;
|
493
504
|
var backlightElemHeight = this.backlight.getSize().height;
|
505
|
+
var tdMiddle = TD.offsetHeight / 2;
|
506
|
+
var tdHeight = TD.offsetHeight;
|
507
|
+
var tdStartPixel = this.hot.view.THEAD.offsetHeight + this.getRowsHeight(0, coords.row - 1);
|
508
|
+
var isBelowTable = pixelsRelToTableStart >= tdStartPixel + tdMiddle;
|
494
509
|
if (this.isFixedRowTop(coords.row)) {
|
495
|
-
|
510
|
+
tdStartPixel += wtTable.holder.scrollTop;
|
496
511
|
}
|
497
512
|
if (coords.row < 0) {
|
498
513
|
// if hover on colHeader
|
499
514
|
priv.target.row = firstVisible > 0 ? firstVisible - 1 : firstVisible;
|
500
|
-
} else if (
|
515
|
+
} else if (isBelowTable) {
|
501
516
|
// if hover on lower part of TD
|
502
517
|
priv.target.row = coords.row + 1;
|
503
518
|
// unfortunately first row is bigger than rest
|
504
|
-
|
519
|
+
tdStartPixel += coords.row === 0 ? tdHeight - 1 : tdHeight;
|
505
520
|
} else {
|
506
521
|
// elsewhere on table
|
507
522
|
priv.target.row = coords.row;
|
508
523
|
}
|
509
|
-
var backlightTop =
|
510
|
-
var guidelineTop =
|
511
|
-
if (
|
524
|
+
var backlightTop = pixelsRelToTableStart;
|
525
|
+
var guidelineTop = tdStartPixel;
|
526
|
+
if (pixelsRelToTableStart + backlightElemHeight + backlightElemMarginTop >= hiderHeight) {
|
512
527
|
// prevent display backlight below table
|
513
528
|
backlightTop = hiderHeight - backlightElemHeight - backlightElemMarginTop;
|
514
|
-
} else if (
|
529
|
+
} else if (pixelsRelToTableStart + backlightElemMarginTop < tbodyOffsetTop) {
|
515
530
|
// prevent display above below table
|
516
531
|
backlightTop = tbodyOffsetTop + Math.abs(backlightElemMarginTop);
|
517
532
|
}
|
518
|
-
if (
|
533
|
+
if (tdStartPixel >= hiderHeight - 1) {
|
519
534
|
// prevent display guideline below table
|
520
535
|
guidelineTop = hiderHeight - 1;
|
521
536
|
}
|
@@ -34,7 +34,7 @@ import "core-js/modules/es.symbol.iterator.js";
|
|
34
34
|
import { BasePlugin } from "../base/index.mjs";
|
35
35
|
import Hooks from "../../pluginHooks.mjs";
|
36
36
|
import { arrayReduce } from "../../helpers/array.mjs";
|
37
|
-
import { addClass, removeClass, offset } from "../../helpers/dom/element.mjs";
|
37
|
+
import { addClass, removeClass, offset, getTrimmingContainer } from "../../helpers/dom/element.mjs";
|
38
38
|
import { rangeEach } from "../../helpers/number.mjs";
|
39
39
|
import EventManager from "../../eventManager.mjs";
|
40
40
|
import BacklightUI from "./ui/backlight.mjs";
|
@@ -477,38 +477,53 @@ export var ManualRowMove = /*#__PURE__*/function (_BasePlugin) {
|
|
477
477
|
}
|
478
478
|
var wtTable = this.hot.view._wt.wtTable;
|
479
479
|
var TD = priv.target.TD;
|
480
|
-
var
|
481
|
-
var
|
482
|
-
var
|
480
|
+
var rootElement = this.hot.rootElement;
|
481
|
+
var rootElementOffset = offset(rootElement);
|
482
|
+
var trimmingContainer = getTrimmingContainer(rootElement);
|
483
|
+
var tableScroll = wtTable.holder.scrollTop;
|
484
|
+
var trimmingContainerScroll;
|
485
|
+
|
486
|
+
// Trimming container is the `window` element.
|
487
|
+
if (this.hot.rootWindow === trimmingContainer) {
|
488
|
+
trimmingContainerScroll = trimmingContainer.scrollY;
|
489
|
+
} else {
|
490
|
+
trimmingContainerScroll = trimmingContainer.scrollTop;
|
491
|
+
}
|
492
|
+
var pixelsAbove = rootElementOffset.top - trimmingContainerScroll;
|
493
|
+
var pixelsRelToTableStart = priv.target.eventPageY - pixelsAbove + tableScroll;
|
483
494
|
var hiderHeight = wtTable.hider.offsetHeight;
|
484
495
|
var tbodyOffsetTop = wtTable.TBODY.offsetTop;
|
485
496
|
var backlightElemMarginTop = this.backlight.getOffset().top;
|
486
497
|
var backlightElemHeight = this.backlight.getSize().height;
|
498
|
+
var tdMiddle = TD.offsetHeight / 2;
|
499
|
+
var tdHeight = TD.offsetHeight;
|
500
|
+
var tdStartPixel = this.hot.view.THEAD.offsetHeight + this.getRowsHeight(0, coords.row - 1);
|
501
|
+
var isBelowTable = pixelsRelToTableStart >= tdStartPixel + tdMiddle;
|
487
502
|
if (this.isFixedRowTop(coords.row)) {
|
488
|
-
|
503
|
+
tdStartPixel += wtTable.holder.scrollTop;
|
489
504
|
}
|
490
505
|
if (coords.row < 0) {
|
491
506
|
// if hover on colHeader
|
492
507
|
priv.target.row = firstVisible > 0 ? firstVisible - 1 : firstVisible;
|
493
|
-
} else if (
|
508
|
+
} else if (isBelowTable) {
|
494
509
|
// if hover on lower part of TD
|
495
510
|
priv.target.row = coords.row + 1;
|
496
511
|
// unfortunately first row is bigger than rest
|
497
|
-
|
512
|
+
tdStartPixel += coords.row === 0 ? tdHeight - 1 : tdHeight;
|
498
513
|
} else {
|
499
514
|
// elsewhere on table
|
500
515
|
priv.target.row = coords.row;
|
501
516
|
}
|
502
|
-
var backlightTop =
|
503
|
-
var guidelineTop =
|
504
|
-
if (
|
517
|
+
var backlightTop = pixelsRelToTableStart;
|
518
|
+
var guidelineTop = tdStartPixel;
|
519
|
+
if (pixelsRelToTableStart + backlightElemHeight + backlightElemMarginTop >= hiderHeight) {
|
505
520
|
// prevent display backlight below table
|
506
521
|
backlightTop = hiderHeight - backlightElemHeight - backlightElemMarginTop;
|
507
|
-
} else if (
|
522
|
+
} else if (pixelsRelToTableStart + backlightElemMarginTop < tbodyOffsetTop) {
|
508
523
|
// prevent display above below table
|
509
524
|
backlightTop = tbodyOffsetTop + Math.abs(backlightElemMarginTop);
|
510
525
|
}
|
511
|
-
if (
|
526
|
+
if (tdStartPixel >= hiderHeight - 1) {
|
512
527
|
// prevent display guideline below table
|
513
528
|
guidelineTop = hiderHeight - 1;
|
514
529
|
}
|