handsontable 14.1.0 → 14.2.0-next-7ae341f-20240229
Sign up to get free protection for your applications and to get access to all the features.
- package/3rdparty/walkontable/src/core/_base.js +12 -0
- package/3rdparty/walkontable/src/core/_base.mjs +12 -0
- package/3rdparty/walkontable/src/scroll.js +131 -98
- package/3rdparty/walkontable/src/scroll.mjs +133 -100
- package/3rdparty/walkontable/src/selection/border/border.js +3 -3
- package/3rdparty/walkontable/src/selection/border/border.mjs +3 -3
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.js +26 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedColumns.mjs +26 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.js +26 -0
- package/3rdparty/walkontable/src/table/mixin/calculatedRows.mjs +26 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.js +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyColumnsStart.mjs +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.js +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsBottom.mjs +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.js +20 -0
- package/3rdparty/walkontable/src/table/mixin/stickyRowsTop.mjs +20 -0
- package/3rdparty/walkontable/src/table.js +2 -0
- package/3rdparty/walkontable/src/table.mjs +2 -0
- package/3rdparty/walkontable/src/viewport.js +9 -0
- package/3rdparty/walkontable/src/viewport.mjs +10 -1
- package/CHANGELOG.md +36 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core/index.js +6 -0
- package/core/index.mjs +2 -1
- package/core/viewportScroll/index.js +65 -0
- package/core/viewportScroll/index.mjs +61 -0
- package/core/viewportScroll/scrollStrategies/columnHeaderScroll.js +20 -0
- package/core/viewportScroll/scrollStrategies/columnHeaderScroll.mjs +16 -0
- package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.js +14 -0
- package/core/viewportScroll/scrollStrategies/cornerHeaderScroll.mjs +10 -0
- package/core/viewportScroll/scrollStrategies/multipleScroll.js +15 -0
- package/core/viewportScroll/scrollStrategies/multipleScroll.mjs +11 -0
- package/core/viewportScroll/scrollStrategies/noncontiguousScroll.js +15 -0
- package/core/viewportScroll/scrollStrategies/noncontiguousScroll.mjs +11 -0
- package/core/viewportScroll/scrollStrategies/rowHeaderScroll.js +20 -0
- package/core/viewportScroll/scrollStrategies/rowHeaderScroll.mjs +16 -0
- package/core/viewportScroll/scrollStrategies/singleScroll.js +46 -0
- package/core/viewportScroll/scrollStrategies/singleScroll.mjs +42 -0
- package/core.d.ts +1 -1
- package/core.js +11 -52
- package/core.mjs +12 -53
- package/dataMap/metaManager/index.js +1 -1
- package/dataMap/metaManager/index.mjs +1 -1
- package/dataMap/metaManager/metaLayers/cellMeta.js +6 -1
- package/dataMap/metaManager/metaLayers/cellMeta.mjs +6 -1
- package/dataMap/metaManager/metaSchema.js +36 -12
- package/dataMap/metaManager/metaSchema.mjs +36 -12
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +2996 -1928
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +42 -42
- package/dist/handsontable.js +2998 -1930
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +25 -25
- package/dist/languages/all.js +130 -25
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/hr-HR.js +167 -0
- package/dist/languages/hr-HR.min.js +1 -0
- package/editorManager.js +15 -4
- package/editorManager.mjs +15 -4
- package/editors/autocompleteEditor/autocompleteEditor.js +2 -2
- package/editors/autocompleteEditor/autocompleteEditor.mjs +2 -2
- package/editors/baseEditor/baseEditor.js +1 -1
- package/editors/baseEditor/baseEditor.mjs +1 -1
- package/editors/checkboxEditor/checkboxEditor.js +5 -4
- package/editors/checkboxEditor/checkboxEditor.mjs +5 -4
- package/editors/dateEditor/dateEditor.js +1 -1
- package/editors/dateEditor/dateEditor.mjs +1 -1
- package/editors/dropdownEditor/dropdownEditor.js +1 -1
- package/editors/dropdownEditor/dropdownEditor.mjs +1 -1
- package/editors/handsontableEditor/handsontableEditor.js +1 -1
- package/editors/handsontableEditor/handsontableEditor.mjs +1 -1
- package/editors/selectEditor/selectEditor.js +1 -1
- package/editors/selectEditor/selectEditor.mjs +1 -1
- package/editors/textEditor/textEditor.js +1 -2
- package/editors/textEditor/textEditor.mjs +1 -2
- package/editors/timeEditor/timeEditor.js +1 -1
- package/editors/timeEditor/timeEditor.mjs +1 -1
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/moves.js +86 -0
- package/helpers/moves.mjs +82 -0
- package/i18n/languages/hr-HR.js +96 -0
- package/i18n/languages/hr-HR.mjs +90 -0
- package/i18n/languages/index.js +2 -0
- package/i18n/languages/index.mjs +2 -1
- package/languages/all.js +130 -25
- package/languages/hr-HR.js +167 -0
- package/languages/hr-HR.mjs +92 -0
- package/languages/index.js +130 -25
- package/languages/index.mjs +2 -1
- package/package.json +11 -1
- package/pluginHooks.d.ts +4 -2
- package/pluginHooks.js +33 -3
- package/pluginHooks.mjs +33 -3
- package/plugins/autoColumnSize/autoColumnSize.js +6 -1
- package/plugins/autoColumnSize/autoColumnSize.mjs +6 -1
- package/plugins/autoRowSize/autoRowSize.js +5 -0
- package/plugins/autoRowSize/autoRowSize.mjs +5 -0
- package/plugins/autofill/autofill.js +3 -2
- package/plugins/autofill/autofill.mjs +3 -2
- package/plugins/dropdownMenu/dropdownMenu.js +58 -4
- package/plugins/dropdownMenu/dropdownMenu.mjs +58 -4
- package/plugins/filters/component/value.js +51 -5
- package/plugins/filters/component/value.mjs +51 -5
- package/plugins/filters/utils.js +1 -1
- package/plugins/filters/utils.mjs +1 -1
- package/plugins/formulas/formulas.js +10 -1
- package/plugins/formulas/formulas.mjs +10 -1
- package/plugins/formulas/indexSyncer/axisSyncer.js +3 -75
- package/plugins/formulas/indexSyncer/axisSyncer.mjs +3 -75
- package/plugins/manualColumnResize/manualColumnResize.js +3 -0
- package/plugins/manualColumnResize/manualColumnResize.mjs +3 -0
- package/plugins/mergeCells/cellsCollection.js +1 -1
- package/plugins/mergeCells/cellsCollection.mjs +1 -1
- package/plugins/mergeCells/mergeCells.js +30 -0
- package/plugins/mergeCells/mergeCells.mjs +30 -0
- package/plugins/undoRedo/undoRedo.js +61 -14
- package/plugins/undoRedo/undoRedo.mjs +61 -14
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +1 -1
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -1
- package/renderers/baseRenderer/baseRenderer.js +1 -1
- package/renderers/baseRenderer/baseRenderer.mjs +1 -1
- package/renderers/checkboxRenderer/checkboxRenderer.js +36 -8
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +36 -8
- package/renderers/dateRenderer/dateRenderer.js +1 -1
- package/renderers/dateRenderer/dateRenderer.mjs +1 -1
- package/renderers/dropdownRenderer/dropdownRenderer.js +1 -1
- package/renderers/dropdownRenderer/dropdownRenderer.mjs +1 -1
- package/renderers/handsontableRenderer/handsontableRenderer.js +1 -1
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +1 -1
- package/renderers/htmlRenderer/htmlRenderer.js +1 -1
- package/renderers/htmlRenderer/htmlRenderer.mjs +1 -1
- package/renderers/numericRenderer/index.js +2 -1
- package/renderers/numericRenderer/index.mjs +1 -1
- package/renderers/numericRenderer/numericRenderer.js +28 -13
- package/renderers/numericRenderer/numericRenderer.mjs +27 -13
- package/renderers/passwordRenderer/passwordRenderer.js +1 -1
- package/renderers/passwordRenderer/passwordRenderer.mjs +1 -1
- package/renderers/selectRenderer/selectRenderer.js +1 -1
- package/renderers/selectRenderer/selectRenderer.mjs +1 -1
- package/renderers/textRenderer/textRenderer.js +1 -1
- package/renderers/textRenderer/textRenderer.mjs +1 -1
- package/renderers/timeRenderer/timeRenderer.js +1 -1
- package/renderers/timeRenderer/timeRenderer.mjs +1 -1
- package/selection/mouseEventHandler.js +4 -0
- package/selection/mouseEventHandler.mjs +4 -0
- package/selection/selection.js +64 -5
- package/selection/selection.mjs +64 -5
- package/shortcuts/recorder.js +27 -8
- package/shortcuts/recorder.mjs +27 -8
- package/tableView.js +86 -5
- package/tableView.mjs +87 -6
- package/utils/autoResize.js +0 -1
- package/utils/autoResize.mjs +0 -1
- package/utils/ghostTable.js +6 -6
- package/utils/ghostTable.mjs +6 -6
- package/utils/parseTable.js +9 -1
- package/utils/parseTable.mjs +9 -1
@@ -15,10 +15,16 @@ var _predefinedItems = require("../contextMenu/predefinedItems");
|
|
15
15
|
var _a11y = require("../../helpers/a11y");
|
16
16
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
17
17
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
18
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
18
19
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
19
20
|
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; }
|
20
21
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
21
22
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
23
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
24
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
25
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
26
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
27
|
+
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; } }
|
22
28
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
23
29
|
_pluginHooks.default.getSingleton().register('afterDropdownMenuDefaultOptions');
|
24
30
|
_pluginHooks.default.getSingleton().register('beforeDropdownMenuShow');
|
@@ -80,6 +86,7 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
80
86
|
* ```
|
81
87
|
* :::
|
82
88
|
*/
|
89
|
+
var _isButtonClicked = /*#__PURE__*/new WeakMap();
|
83
90
|
var _addCustomShortcuts = /*#__PURE__*/new WeakSet();
|
84
91
|
var _onTableClick = /*#__PURE__*/new WeakSet();
|
85
92
|
var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
|
@@ -87,6 +94,8 @@ var _onMenuBeforeOpen = /*#__PURE__*/new WeakSet();
|
|
87
94
|
var _onMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
88
95
|
var _onSubMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
89
96
|
var _onMenuAfterClose = /*#__PURE__*/new WeakSet();
|
97
|
+
var _onBeforeViewportScrollHorizontally = /*#__PURE__*/new WeakSet();
|
98
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
90
99
|
class DropdownMenu extends _base.BasePlugin {
|
91
100
|
static get PLUGIN_KEY() {
|
92
101
|
return PLUGIN_KEY;
|
@@ -118,6 +127,21 @@ class DropdownMenu extends _base.BasePlugin {
|
|
118
127
|
super(hotInstance);
|
119
128
|
|
120
129
|
// One listener for enable/disable functionality
|
130
|
+
/**
|
131
|
+
* Hook sets the internal flag to `true` when the button is clicked.
|
132
|
+
*
|
133
|
+
* @param {MouseEvent} event The mouse event object.
|
134
|
+
*/
|
135
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
136
|
+
/**
|
137
|
+
* Hook allows blocking horizontal scroll when the menu is opened by clicking on
|
138
|
+
* the column header button. This prevents from scrolling the viewport (jump effect) when
|
139
|
+
* the button is clicked.
|
140
|
+
*
|
141
|
+
* @param {number} visualColumn Visual column index.
|
142
|
+
* @returns {number | null}
|
143
|
+
*/
|
144
|
+
_classPrivateMethodInitSpec(this, _onBeforeViewportScrollHorizontally);
|
121
145
|
/**
|
122
146
|
* On menu after close listener.
|
123
147
|
*
|
@@ -182,6 +206,15 @@ class DropdownMenu extends _base.BasePlugin {
|
|
182
206
|
* @type {Menu}
|
183
207
|
*/
|
184
208
|
_defineProperty(this, "menu", null);
|
209
|
+
/**
|
210
|
+
* Flag which determines if the button that opens the menu was clicked.
|
211
|
+
*
|
212
|
+
* @type {boolean}
|
213
|
+
*/
|
214
|
+
_classPrivateFieldInitSpec(this, _isButtonClicked, {
|
215
|
+
writable: true,
|
216
|
+
value: false
|
217
|
+
});
|
185
218
|
this.hot.addHook('afterGetColHeader', (col, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, col, TH));
|
186
219
|
}
|
187
220
|
|
@@ -207,6 +240,18 @@ class DropdownMenu extends _base.BasePlugin {
|
|
207
240
|
return;
|
208
241
|
}
|
209
242
|
this.itemsFactory = new _itemsFactory.ItemsFactory(this.hot, DropdownMenu.DEFAULT_ITEMS);
|
243
|
+
this.addHook('beforeOnCellMouseDown', function () {
|
244
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
245
|
+
args[_key] = arguments[_key];
|
246
|
+
}
|
247
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
248
|
+
});
|
249
|
+
this.addHook('beforeViewportScrollHorizontally', function () {
|
250
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
251
|
+
args[_key2] = arguments[_key2];
|
252
|
+
}
|
253
|
+
return _classPrivateMethodGet(_this, _onBeforeViewportScrollHorizontally, _onBeforeViewportScrollHorizontally2).call(_this, ...args);
|
254
|
+
});
|
210
255
|
const settings = this.hot.getSettings()[PLUGIN_KEY];
|
211
256
|
const predefinedItems = {
|
212
257
|
items: this.itemsFactory.getItems(settings)
|
@@ -236,8 +281,8 @@ class DropdownMenu extends _base.BasePlugin {
|
|
236
281
|
this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance => _classPrivateMethodGet(this, _onSubMenuAfterOpen, _onSubMenuAfterOpen2).call(this, subMenuInstance));
|
237
282
|
this.menu.addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuAfterClose, _onMenuAfterClose2).call(this));
|
238
283
|
this.menu.addLocalHook('executeCommand', function () {
|
239
|
-
for (var
|
240
|
-
params[
|
284
|
+
for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
285
|
+
params[_key3] = arguments[_key3];
|
241
286
|
}
|
242
287
|
return _this.executeCommand.call(_this, ...params);
|
243
288
|
});
|
@@ -410,8 +455,8 @@ class DropdownMenu extends _base.BasePlugin {
|
|
410
455
|
* @param {*} params Additional parameters passed to the command executor.
|
411
456
|
*/
|
412
457
|
executeCommand(commandName) {
|
413
|
-
for (var
|
414
|
-
params[
|
458
|
+
for (var _len4 = arguments.length, params = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
459
|
+
params[_key4 - 1] = arguments[_key4];
|
415
460
|
}
|
416
461
|
this.commandExecutor.execute(commandName, ...params);
|
417
462
|
}
|
@@ -455,6 +500,7 @@ function _onTableClick2(event) {
|
|
455
500
|
if ((0, _element.hasClass)(event.target, BUTTON_CLASS_NAME)) {
|
456
501
|
const offset = (0, _utils.getDocumentOffsetByElement)(this.menu.container, this.hot.rootDocument);
|
457
502
|
const rect = event.target.getBoundingClientRect();
|
503
|
+
_classPrivateFieldSet(this, _isButtonClicked, false);
|
458
504
|
this.open({
|
459
505
|
left: rect.left + offset.left,
|
460
506
|
top: rect.top + event.target.offsetHeight + 3 + offset.top
|
@@ -516,6 +562,14 @@ function _onMenuAfterClose2() {
|
|
516
562
|
this.hot.listen();
|
517
563
|
this.hot.runHooks('afterDropdownMenuHide', this);
|
518
564
|
}
|
565
|
+
function _onBeforeViewportScrollHorizontally2(visualColumn) {
|
566
|
+
return _classPrivateFieldGet(this, _isButtonClicked) ? null : visualColumn;
|
567
|
+
}
|
568
|
+
function _onBeforeOnCellMouseDown2(event) {
|
569
|
+
if ((0, _element.hasClass)(event.target, BUTTON_CLASS_NAME)) {
|
570
|
+
_classPrivateFieldSet(this, _isButtonClicked, true);
|
571
|
+
}
|
572
|
+
}
|
519
573
|
DropdownMenu.SEPARATOR = {
|
520
574
|
name: _predefinedItems.SEPARATOR
|
521
575
|
};
|
@@ -1,9 +1,15 @@
|
|
1
1
|
import "core-js/modules/es.error.cause.js";
|
2
2
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
3
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
3
4
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
4
5
|
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; }
|
5
6
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
|
6
7
|
function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
|
8
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
9
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
10
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
11
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
12
|
+
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; } }
|
7
13
|
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
8
14
|
import { BasePlugin } from "../base/index.mjs";
|
9
15
|
import { arrayEach } from "../../helpers/array.mjs";
|
@@ -76,6 +82,7 @@ const SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
76
82
|
* ```
|
77
83
|
* :::
|
78
84
|
*/
|
85
|
+
var _isButtonClicked = /*#__PURE__*/new WeakMap();
|
79
86
|
var _addCustomShortcuts = /*#__PURE__*/new WeakSet();
|
80
87
|
var _onTableClick = /*#__PURE__*/new WeakSet();
|
81
88
|
var _onAfterGetColHeader = /*#__PURE__*/new WeakSet();
|
@@ -83,6 +90,8 @@ var _onMenuBeforeOpen = /*#__PURE__*/new WeakSet();
|
|
83
90
|
var _onMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
84
91
|
var _onSubMenuAfterOpen = /*#__PURE__*/new WeakSet();
|
85
92
|
var _onMenuAfterClose = /*#__PURE__*/new WeakSet();
|
93
|
+
var _onBeforeViewportScrollHorizontally = /*#__PURE__*/new WeakSet();
|
94
|
+
var _onBeforeOnCellMouseDown = /*#__PURE__*/new WeakSet();
|
86
95
|
export class DropdownMenu extends BasePlugin {
|
87
96
|
static get PLUGIN_KEY() {
|
88
97
|
return PLUGIN_KEY;
|
@@ -114,6 +123,21 @@ export class DropdownMenu extends BasePlugin {
|
|
114
123
|
super(hotInstance);
|
115
124
|
|
116
125
|
// One listener for enable/disable functionality
|
126
|
+
/**
|
127
|
+
* Hook sets the internal flag to `true` when the button is clicked.
|
128
|
+
*
|
129
|
+
* @param {MouseEvent} event The mouse event object.
|
130
|
+
*/
|
131
|
+
_classPrivateMethodInitSpec(this, _onBeforeOnCellMouseDown);
|
132
|
+
/**
|
133
|
+
* Hook allows blocking horizontal scroll when the menu is opened by clicking on
|
134
|
+
* the column header button. This prevents from scrolling the viewport (jump effect) when
|
135
|
+
* the button is clicked.
|
136
|
+
*
|
137
|
+
* @param {number} visualColumn Visual column index.
|
138
|
+
* @returns {number | null}
|
139
|
+
*/
|
140
|
+
_classPrivateMethodInitSpec(this, _onBeforeViewportScrollHorizontally);
|
117
141
|
/**
|
118
142
|
* On menu after close listener.
|
119
143
|
*
|
@@ -178,6 +202,15 @@ export class DropdownMenu extends BasePlugin {
|
|
178
202
|
* @type {Menu}
|
179
203
|
*/
|
180
204
|
_defineProperty(this, "menu", null);
|
205
|
+
/**
|
206
|
+
* Flag which determines if the button that opens the menu was clicked.
|
207
|
+
*
|
208
|
+
* @type {boolean}
|
209
|
+
*/
|
210
|
+
_classPrivateFieldInitSpec(this, _isButtonClicked, {
|
211
|
+
writable: true,
|
212
|
+
value: false
|
213
|
+
});
|
181
214
|
this.hot.addHook('afterGetColHeader', (col, TH) => _classPrivateMethodGet(this, _onAfterGetColHeader, _onAfterGetColHeader2).call(this, col, TH));
|
182
215
|
}
|
183
216
|
|
@@ -203,6 +236,18 @@ export class DropdownMenu extends BasePlugin {
|
|
203
236
|
return;
|
204
237
|
}
|
205
238
|
this.itemsFactory = new ItemsFactory(this.hot, DropdownMenu.DEFAULT_ITEMS);
|
239
|
+
this.addHook('beforeOnCellMouseDown', function () {
|
240
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
241
|
+
args[_key] = arguments[_key];
|
242
|
+
}
|
243
|
+
return _classPrivateMethodGet(_this, _onBeforeOnCellMouseDown, _onBeforeOnCellMouseDown2).call(_this, ...args);
|
244
|
+
});
|
245
|
+
this.addHook('beforeViewportScrollHorizontally', function () {
|
246
|
+
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
|
247
|
+
args[_key2] = arguments[_key2];
|
248
|
+
}
|
249
|
+
return _classPrivateMethodGet(_this, _onBeforeViewportScrollHorizontally, _onBeforeViewportScrollHorizontally2).call(_this, ...args);
|
250
|
+
});
|
206
251
|
const settings = this.hot.getSettings()[PLUGIN_KEY];
|
207
252
|
const predefinedItems = {
|
208
253
|
items: this.itemsFactory.getItems(settings)
|
@@ -232,8 +277,8 @@ export class DropdownMenu extends BasePlugin {
|
|
232
277
|
this.menu.addLocalHook('afterSubmenuOpen', subMenuInstance => _classPrivateMethodGet(this, _onSubMenuAfterOpen, _onSubMenuAfterOpen2).call(this, subMenuInstance));
|
233
278
|
this.menu.addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuAfterClose, _onMenuAfterClose2).call(this));
|
234
279
|
this.menu.addLocalHook('executeCommand', function () {
|
235
|
-
for (var
|
236
|
-
params[
|
280
|
+
for (var _len3 = arguments.length, params = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
281
|
+
params[_key3] = arguments[_key3];
|
237
282
|
}
|
238
283
|
return _this.executeCommand.call(_this, ...params);
|
239
284
|
});
|
@@ -406,8 +451,8 @@ export class DropdownMenu extends BasePlugin {
|
|
406
451
|
* @param {*} params Additional parameters passed to the command executor.
|
407
452
|
*/
|
408
453
|
executeCommand(commandName) {
|
409
|
-
for (var
|
410
|
-
params[
|
454
|
+
for (var _len4 = arguments.length, params = new Array(_len4 > 1 ? _len4 - 1 : 0), _key4 = 1; _key4 < _len4; _key4++) {
|
455
|
+
params[_key4 - 1] = arguments[_key4];
|
411
456
|
}
|
412
457
|
this.commandExecutor.execute(commandName, ...params);
|
413
458
|
}
|
@@ -450,6 +495,7 @@ function _onTableClick2(event) {
|
|
450
495
|
if (hasClass(event.target, BUTTON_CLASS_NAME)) {
|
451
496
|
const offset = getDocumentOffsetByElement(this.menu.container, this.hot.rootDocument);
|
452
497
|
const rect = event.target.getBoundingClientRect();
|
498
|
+
_classPrivateFieldSet(this, _isButtonClicked, false);
|
453
499
|
this.open({
|
454
500
|
left: rect.left + offset.left,
|
455
501
|
top: rect.top + event.target.offsetHeight + 3 + offset.top
|
@@ -511,6 +557,14 @@ function _onMenuAfterClose2() {
|
|
511
557
|
this.hot.listen();
|
512
558
|
this.hot.runHooks('afterDropdownMenuHide', this);
|
513
559
|
}
|
560
|
+
function _onBeforeViewportScrollHorizontally2(visualColumn) {
|
561
|
+
return _classPrivateFieldGet(this, _isButtonClicked) ? null : visualColumn;
|
562
|
+
}
|
563
|
+
function _onBeforeOnCellMouseDown2(event) {
|
564
|
+
if (hasClass(event.target, BUTTON_CLASS_NAME)) {
|
565
|
+
_classPrivateFieldSet(this, _isButtonClicked, true);
|
566
|
+
}
|
567
|
+
}
|
514
568
|
DropdownMenu.SEPARATOR = {
|
515
569
|
name: SEPARATOR
|
516
570
|
};
|
@@ -13,6 +13,7 @@ var _base = require("./_base");
|
|
13
13
|
var _multipleSelect = require("../ui/multipleSelect");
|
14
14
|
var _constants2 = require("../constants");
|
15
15
|
var _conditionRegisterer = require("../conditionRegisterer");
|
16
|
+
var _numericRenderer = require("../../../renderers/numericRenderer");
|
16
17
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
17
18
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
18
19
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
@@ -26,12 +27,29 @@ function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(
|
|
26
27
|
* @class ValueComponent
|
27
28
|
*/
|
28
29
|
var _onInputKeyDown = /*#__PURE__*/new WeakSet();
|
30
|
+
var _triggerModifyMultipleSelectionValueHook = /*#__PURE__*/new WeakSet();
|
31
|
+
var _onModifyDisplayedValue = /*#__PURE__*/new WeakSet();
|
29
32
|
class ValueComponent extends _base.BaseComponent {
|
30
33
|
constructor(hotInstance, options) {
|
31
34
|
super(hotInstance, {
|
32
35
|
id: options.id,
|
33
36
|
stateless: false
|
34
37
|
});
|
38
|
+
/**
|
39
|
+
* Modify the value displayed in the multiple select list.
|
40
|
+
*
|
41
|
+
* @param {*} value Cell value.
|
42
|
+
* @param {object} meta The cell meta object.
|
43
|
+
* @returns {*} Returns the modified value.
|
44
|
+
*/
|
45
|
+
_classPrivateMethodInitSpec(this, _onModifyDisplayedValue);
|
46
|
+
/**
|
47
|
+
* Trigger the `modifyFiltersMultiSelectValue` hook.
|
48
|
+
*
|
49
|
+
* @param {object} item Item from the multiple select list.
|
50
|
+
* @param {Map} metaMap Map of row meta objects.
|
51
|
+
*/
|
52
|
+
_classPrivateMethodInitSpec(this, _triggerModifyMultipleSelectionValueHook);
|
35
53
|
/**
|
36
54
|
* Key down listener.
|
37
55
|
*
|
@@ -56,6 +74,7 @@ class ValueComponent extends _base.BaseComponent {
|
|
56
74
|
*/
|
57
75
|
registerHooks() {
|
58
76
|
this.getMultipleSelectElement().addLocalHook('keydown', event => _classPrivateMethodGet(this, _onInputKeyDown, _onInputKeyDown2).call(this, event)).addLocalHook('listTabKeydown', event => this.runLocalHooks('listTabKeydown', event));
|
77
|
+
this.hot.addHook('modifyFiltersMultiSelectValue', (value, meta) => _classPrivateMethodGet(this, _onModifyDisplayedValue, _onModifyDisplayedValue2).call(this, value, meta));
|
59
78
|
}
|
60
79
|
|
61
80
|
/**
|
@@ -113,15 +132,19 @@ class ValueComponent extends _base.BaseComponent {
|
|
113
132
|
const state = {};
|
114
133
|
const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
|
115
134
|
if (firstByValueCondition) {
|
116
|
-
const
|
135
|
+
const filteredRows = filteredRowsFactory(physicalColumn, conditionsStack);
|
136
|
+
const rowValues = (0, _array.arrayMap)(filteredRows, row => row.value);
|
137
|
+
const rowMetaMap = new Map(filteredRows.map(row => [row.value, this.hot.getCellMeta(row.meta.visualRow, row.meta.visualCol)]));
|
138
|
+
const unifiedRowValues = (0, _utils.unifyColumnValues)(rowValues);
|
117
139
|
if (conditionArgsChange) {
|
118
140
|
firstByValueCondition.args[0] = conditionArgsChange;
|
119
141
|
}
|
120
142
|
const selectedValues = [];
|
121
|
-
const itemsSnapshot = (0, _utils.intersectValues)(
|
143
|
+
const itemsSnapshot = (0, _utils.intersectValues)(unifiedRowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {
|
122
144
|
if (item.checked) {
|
123
145
|
selectedValues.push(item.value);
|
124
146
|
}
|
147
|
+
_classPrivateMethodGet(this, _triggerModifyMultipleSelectionValueHook, _triggerModifyMultipleSelectionValueHook2).call(this, item, rowMetaMap);
|
125
148
|
});
|
126
149
|
const column = stateInfo.editedConditionStack.column;
|
127
150
|
state.locale = this.hot.getCellMeta(0, column).locale;
|
@@ -182,8 +205,13 @@ class ValueComponent extends _base.BaseComponent {
|
|
182
205
|
*/
|
183
206
|
reset() {
|
184
207
|
const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
|
185
|
-
const
|
186
|
-
const
|
208
|
+
const rowEntries = this._getColumnVisibleValues();
|
209
|
+
const rowValues = rowEntries.map(entry => entry.value);
|
210
|
+
const rowMetaMap = new Map(rowEntries.map(row => [row.value, row.meta]));
|
211
|
+
const values = (0, _utils.unifyColumnValues)(rowValues);
|
212
|
+
const items = (0, _utils.intersectValues)(values, values, defaultBlankCellValue, item => {
|
213
|
+
_classPrivateMethodGet(this, _triggerModifyMultipleSelectionValueHook, _triggerModifyMultipleSelectionValueHook2).call(this, item, rowMetaMap);
|
214
|
+
});
|
187
215
|
this.getMultipleSelectElement().setItems(items);
|
188
216
|
super.reset();
|
189
217
|
this.getMultipleSelectElement().setValue(values);
|
@@ -203,7 +231,12 @@ class ValueComponent extends _base.BaseComponent {
|
|
203
231
|
if (selectedColumn === null) {
|
204
232
|
return [];
|
205
233
|
}
|
206
|
-
return (0, _array.arrayMap)(this.hot.getDataAtCol(selectedColumn.visualIndex), v =>
|
234
|
+
return (0, _array.arrayMap)(this.hot.getDataAtCol(selectedColumn.visualIndex), (v, rowIndex) => {
|
235
|
+
return {
|
236
|
+
value: (0, _utils.toEmptyString)(v),
|
237
|
+
meta: this.hot.getCellMeta(rowIndex, selectedColumn.visualIndex)
|
238
|
+
};
|
239
|
+
});
|
207
240
|
}
|
208
241
|
}
|
209
242
|
exports.ValueComponent = ValueComponent;
|
@@ -212,4 +245,17 @@ function _onInputKeyDown2(event) {
|
|
212
245
|
this.runLocalHooks('cancel');
|
213
246
|
(0, _event.stopImmediatePropagation)(event);
|
214
247
|
}
|
248
|
+
}
|
249
|
+
function _triggerModifyMultipleSelectionValueHook2(item, metaMap) {
|
250
|
+
if (this.hot.hasHook('modifyFiltersMultiSelectValue')) {
|
251
|
+
item.visualValue = this.hot.runHooks('modifyFiltersMultiSelectValue', item.visualValue, metaMap.get(item.value));
|
252
|
+
}
|
253
|
+
}
|
254
|
+
function _onModifyDisplayedValue2(value, meta) {
|
255
|
+
switch (meta.type) {
|
256
|
+
case 'numeric':
|
257
|
+
return (0, _numericRenderer.getRenderedValue)(value, meta);
|
258
|
+
default:
|
259
|
+
return value;
|
260
|
+
}
|
215
261
|
}
|
@@ -16,17 +16,35 @@ import { BaseComponent } from "./_base.mjs";
|
|
16
16
|
import { MultipleSelectUI } from "../ui/multipleSelect.mjs";
|
17
17
|
import { CONDITION_BY_VALUE, CONDITION_NONE } from "../constants.mjs";
|
18
18
|
import { getConditionDescriptor } from "../conditionRegisterer.mjs";
|
19
|
+
import { getRenderedValue as getRenderedNumericValue } from "../../../renderers/numericRenderer/index.mjs";
|
19
20
|
/**
|
20
21
|
* @private
|
21
22
|
* @class ValueComponent
|
22
23
|
*/
|
23
24
|
var _onInputKeyDown = /*#__PURE__*/new WeakSet();
|
25
|
+
var _triggerModifyMultipleSelectionValueHook = /*#__PURE__*/new WeakSet();
|
26
|
+
var _onModifyDisplayedValue = /*#__PURE__*/new WeakSet();
|
24
27
|
export class ValueComponent extends BaseComponent {
|
25
28
|
constructor(hotInstance, options) {
|
26
29
|
super(hotInstance, {
|
27
30
|
id: options.id,
|
28
31
|
stateless: false
|
29
32
|
});
|
33
|
+
/**
|
34
|
+
* Modify the value displayed in the multiple select list.
|
35
|
+
*
|
36
|
+
* @param {*} value Cell value.
|
37
|
+
* @param {object} meta The cell meta object.
|
38
|
+
* @returns {*} Returns the modified value.
|
39
|
+
*/
|
40
|
+
_classPrivateMethodInitSpec(this, _onModifyDisplayedValue);
|
41
|
+
/**
|
42
|
+
* Trigger the `modifyFiltersMultiSelectValue` hook.
|
43
|
+
*
|
44
|
+
* @param {object} item Item from the multiple select list.
|
45
|
+
* @param {Map} metaMap Map of row meta objects.
|
46
|
+
*/
|
47
|
+
_classPrivateMethodInitSpec(this, _triggerModifyMultipleSelectionValueHook);
|
30
48
|
/**
|
31
49
|
* Key down listener.
|
32
50
|
*
|
@@ -51,6 +69,7 @@ export class ValueComponent extends BaseComponent {
|
|
51
69
|
*/
|
52
70
|
registerHooks() {
|
53
71
|
this.getMultipleSelectElement().addLocalHook('keydown', event => _classPrivateMethodGet(this, _onInputKeyDown, _onInputKeyDown2).call(this, event)).addLocalHook('listTabKeydown', event => this.runLocalHooks('listTabKeydown', event));
|
72
|
+
this.hot.addHook('modifyFiltersMultiSelectValue', (value, meta) => _classPrivateMethodGet(this, _onModifyDisplayedValue, _onModifyDisplayedValue2).call(this, value, meta));
|
54
73
|
}
|
55
74
|
|
56
75
|
/**
|
@@ -108,15 +127,19 @@ export class ValueComponent extends BaseComponent {
|
|
108
127
|
const state = {};
|
109
128
|
const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
|
110
129
|
if (firstByValueCondition) {
|
111
|
-
const
|
130
|
+
const filteredRows = filteredRowsFactory(physicalColumn, conditionsStack);
|
131
|
+
const rowValues = arrayMap(filteredRows, row => row.value);
|
132
|
+
const rowMetaMap = new Map(filteredRows.map(row => [row.value, this.hot.getCellMeta(row.meta.visualRow, row.meta.visualCol)]));
|
133
|
+
const unifiedRowValues = unifyColumnValues(rowValues);
|
112
134
|
if (conditionArgsChange) {
|
113
135
|
firstByValueCondition.args[0] = conditionArgsChange;
|
114
136
|
}
|
115
137
|
const selectedValues = [];
|
116
|
-
const itemsSnapshot = intersectValues(
|
138
|
+
const itemsSnapshot = intersectValues(unifiedRowValues, firstByValueCondition.args[0], defaultBlankCellValue, item => {
|
117
139
|
if (item.checked) {
|
118
140
|
selectedValues.push(item.value);
|
119
141
|
}
|
142
|
+
_classPrivateMethodGet(this, _triggerModifyMultipleSelectionValueHook, _triggerModifyMultipleSelectionValueHook2).call(this, item, rowMetaMap);
|
120
143
|
});
|
121
144
|
const column = stateInfo.editedConditionStack.column;
|
122
145
|
state.locale = this.hot.getCellMeta(0, column).locale;
|
@@ -177,8 +200,13 @@ export class ValueComponent extends BaseComponent {
|
|
177
200
|
*/
|
178
201
|
reset() {
|
179
202
|
const defaultBlankCellValue = this.hot.getTranslatedPhrase(C.FILTERS_VALUES_BLANK_CELLS);
|
180
|
-
const
|
181
|
-
const
|
203
|
+
const rowEntries = this._getColumnVisibleValues();
|
204
|
+
const rowValues = rowEntries.map(entry => entry.value);
|
205
|
+
const rowMetaMap = new Map(rowEntries.map(row => [row.value, row.meta]));
|
206
|
+
const values = unifyColumnValues(rowValues);
|
207
|
+
const items = intersectValues(values, values, defaultBlankCellValue, item => {
|
208
|
+
_classPrivateMethodGet(this, _triggerModifyMultipleSelectionValueHook, _triggerModifyMultipleSelectionValueHook2).call(this, item, rowMetaMap);
|
209
|
+
});
|
182
210
|
this.getMultipleSelectElement().setItems(items);
|
183
211
|
super.reset();
|
184
212
|
this.getMultipleSelectElement().setValue(values);
|
@@ -198,7 +226,12 @@ export class ValueComponent extends BaseComponent {
|
|
198
226
|
if (selectedColumn === null) {
|
199
227
|
return [];
|
200
228
|
}
|
201
|
-
return arrayMap(this.hot.getDataAtCol(selectedColumn.visualIndex), v =>
|
229
|
+
return arrayMap(this.hot.getDataAtCol(selectedColumn.visualIndex), (v, rowIndex) => {
|
230
|
+
return {
|
231
|
+
value: toEmptyString(v),
|
232
|
+
meta: this.hot.getCellMeta(rowIndex, selectedColumn.visualIndex)
|
233
|
+
};
|
234
|
+
});
|
202
235
|
}
|
203
236
|
}
|
204
237
|
function _onInputKeyDown2(event) {
|
@@ -206,4 +239,17 @@ function _onInputKeyDown2(event) {
|
|
206
239
|
this.runLocalHooks('cancel');
|
207
240
|
stopImmediatePropagation(event);
|
208
241
|
}
|
242
|
+
}
|
243
|
+
function _triggerModifyMultipleSelectionValueHook2(item, metaMap) {
|
244
|
+
if (this.hot.hasHook('modifyFiltersMultiSelectValue')) {
|
245
|
+
item.visualValue = this.hot.runHooks('modifyFiltersMultiSelectValue', item.visualValue, metaMap.get(item.value));
|
246
|
+
}
|
247
|
+
}
|
248
|
+
function _onModifyDisplayedValue2(value, meta) {
|
249
|
+
switch (meta.type) {
|
250
|
+
case 'numeric':
|
251
|
+
return getRenderedNumericValue(value, meta);
|
252
|
+
default:
|
253
|
+
return value;
|
254
|
+
}
|
209
255
|
}
|
package/plugins/filters/utils.js
CHANGED
@@ -77,7 +77,7 @@ function toEmptyString(value) {
|
|
77
77
|
}
|
78
78
|
|
79
79
|
/**
|
80
|
-
* Unify column values (
|
80
|
+
* Unify column values (remove duplicated values and sort them).
|
81
81
|
*
|
82
82
|
* @param {Array} values An array of values.
|
83
83
|
* @returns {Array}
|
@@ -68,7 +68,7 @@ export function toEmptyString(value) {
|
|
68
68
|
}
|
69
69
|
|
70
70
|
/**
|
71
|
-
* Unify column values (
|
71
|
+
* Unify column values (remove duplicated values and sort them).
|
72
72
|
*
|
73
73
|
* @param {Array} values An array of values.
|
74
74
|
* @returns {Array}
|
@@ -1069,7 +1069,15 @@ function _onModifyData2(physicalRow, visualColumn, valueHolder, ioMode) {
|
|
1069
1069
|
sheet: this.sheetId
|
1070
1070
|
};
|
1071
1071
|
let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
1072
|
-
|
1072
|
+
|
1073
|
+
// TODO: Workaround. We use HOT's `getCellsMeta` method instead of HOT's `getCellMeta` method. Getting cell meta
|
1074
|
+
// using the second method lead to execution of the `cells` method. Using the `getDataAtCell` (which may be useful)
|
1075
|
+
// in a callback to the `cells` method leads to triggering the `modifyData` hook. Thus, the `onModifyData` callback
|
1076
|
+
// is executed once again and it cause creation of an infinite loop.
|
1077
|
+
let cellMeta = this.hot.getCellsMeta().find(singleCellMeta => singleCellMeta.visualRow === visualRow && singleCellMeta.visualCol === visualColumn);
|
1078
|
+
if (cellMeta === undefined) {
|
1079
|
+
cellMeta = {};
|
1080
|
+
}
|
1073
1081
|
if (cellMeta.type === 'date' && (0, _number.isNumeric)(cellValue)) {
|
1074
1082
|
cellValue = (0, _utils.getDateFromExcelDate)(cellValue, cellMeta.dateFormat);
|
1075
1083
|
}
|
@@ -1282,6 +1290,7 @@ function _onEngineSheetAdded2(addedSheetDisplayName) {
|
|
1282
1290
|
this.hot.runHooks('afterSheetAdded', addedSheetDisplayName);
|
1283
1291
|
}
|
1284
1292
|
function _onEngineSheetRenamed2(oldDisplayName, newDisplayName) {
|
1293
|
+
this.sheetName = newDisplayName;
|
1285
1294
|
this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);
|
1286
1295
|
}
|
1287
1296
|
function _onEngineSheetRemoved2(removedSheetDisplayName, changes) {
|
@@ -1064,7 +1064,15 @@ function _onModifyData2(physicalRow, visualColumn, valueHolder, ioMode) {
|
|
1064
1064
|
sheet: this.sheetId
|
1065
1065
|
};
|
1066
1066
|
let cellValue = this.engine.getCellValue(address); // Date as an integer (Excel like date).
|
1067
|
-
|
1067
|
+
|
1068
|
+
// TODO: Workaround. We use HOT's `getCellsMeta` method instead of HOT's `getCellMeta` method. Getting cell meta
|
1069
|
+
// using the second method lead to execution of the `cells` method. Using the `getDataAtCell` (which may be useful)
|
1070
|
+
// in a callback to the `cells` method leads to triggering the `modifyData` hook. Thus, the `onModifyData` callback
|
1071
|
+
// is executed once again and it cause creation of an infinite loop.
|
1072
|
+
let cellMeta = this.hot.getCellsMeta().find(singleCellMeta => singleCellMeta.visualRow === visualRow && singleCellMeta.visualCol === visualColumn);
|
1073
|
+
if (cellMeta === undefined) {
|
1074
|
+
cellMeta = {};
|
1075
|
+
}
|
1068
1076
|
if (cellMeta.type === 'date' && isNumeric(cellValue)) {
|
1069
1077
|
cellValue = getDateFromExcelDate(cellValue, cellMeta.dateFormat);
|
1070
1078
|
}
|
@@ -1277,6 +1285,7 @@ function _onEngineSheetAdded2(addedSheetDisplayName) {
|
|
1277
1285
|
this.hot.runHooks('afterSheetAdded', addedSheetDisplayName);
|
1278
1286
|
}
|
1279
1287
|
function _onEngineSheetRenamed2(oldDisplayName, newDisplayName) {
|
1288
|
+
this.sheetName = newDisplayName;
|
1280
1289
|
this.hot.runHooks('afterSheetRenamed', oldDisplayName, newDisplayName);
|
1281
1290
|
}
|
1282
1291
|
function _onEngineSheetRemoved2(removedSheetDisplayName, changes) {
|