handsontable 14.3.0 → 14.4.0-next-0a79a1f-20240521
Sign up to get free protection for your applications and to get access to all the features.
- package/3rdparty/walkontable/src/calculator/viewportRows.js +3 -3
- package/3rdparty/walkontable/src/calculator/viewportRows.mjs +3 -3
- package/3rdparty/walkontable/src/core/_base.js +1 -1
- package/3rdparty/walkontable/src/core/_base.mjs +1 -1
- package/3rdparty/walkontable/src/overlay/_base.js +24 -20
- package/3rdparty/walkontable/src/overlay/_base.mjs +24 -20
- package/3rdparty/walkontable/src/overlay/bottom.js +3 -6
- package/3rdparty/walkontable/src/overlay/bottom.mjs +3 -6
- package/3rdparty/walkontable/src/overlay/inlineStart.js +22 -19
- package/3rdparty/walkontable/src/overlay/inlineStart.mjs +22 -19
- package/3rdparty/walkontable/src/overlay/top.js +13 -12
- package/3rdparty/walkontable/src/overlay/top.mjs +13 -12
- package/3rdparty/walkontable/src/overlays.js +46 -24
- package/3rdparty/walkontable/src/overlays.mjs +46 -24
- package/3rdparty/walkontable/src/selection/manager.js +7 -0
- package/3rdparty/walkontable/src/selection/manager.mjs +7 -0
- package/3rdparty/walkontable/src/selection/scanner.js +7 -0
- package/3rdparty/walkontable/src/selection/scanner.mjs +7 -0
- package/3rdparty/walkontable/src/table.js +10 -11
- package/3rdparty/walkontable/src/table.mjs +10 -11
- package/3rdparty/walkontable/src/utils/columnStretching.js +4 -0
- package/3rdparty/walkontable/src/utils/columnStretching.mjs +4 -0
- package/3rdparty/walkontable/src/viewport.js +18 -10
- package/3rdparty/walkontable/src/viewport.mjs +18 -10
- package/CHANGELOG.md +37 -0
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +2 -2
- package/core.js +93 -162
- package/core.mjs +93 -162
- package/dataMap/dataMap.js +10 -4
- package/dataMap/dataMap.mjs +10 -4
- package/dataMap/dataSource.js +16 -3
- package/dataMap/dataSource.mjs +16 -3
- package/dataMap/metaManager/lazyFactoryMap.js +7 -0
- package/dataMap/metaManager/lazyFactoryMap.mjs +7 -0
- package/dataMap/metaManager/metaSchema.js +38 -0
- package/dataMap/metaManager/metaSchema.mjs +38 -0
- package/dataMap/metaManager/mods/dynamicCellMeta.js +7 -0
- package/dataMap/metaManager/mods/dynamicCellMeta.mjs +7 -0
- package/dataMap/metaManager/mods/extendMetaProperties.js +44 -31
- package/dataMap/metaManager/mods/extendMetaProperties.mjs +44 -31
- package/dataMap/metaManager/utils.js +7 -0
- package/dataMap/metaManager/utils.mjs +7 -0
- package/dist/handsontable.css +4 -5
- package/dist/handsontable.full.css +4 -5
- package/dist/handsontable.full.js +5878 -4657
- package/dist/handsontable.full.min.css +4 -4
- package/dist/handsontable.full.min.js +59 -59
- package/dist/handsontable.js +5383 -4277
- package/dist/handsontable.min.css +4 -4
- package/dist/handsontable.min.js +20 -20
- package/editorManager.js +0 -67
- package/editorManager.mjs +0 -67
- package/editors/autocompleteEditor/autocompleteEditor.js +6 -4
- package/editors/autocompleteEditor/autocompleteEditor.mjs +6 -4
- package/editors/baseEditor/baseEditor.js +1 -36
- package/editors/baseEditor/baseEditor.mjs +2 -37
- package/editors/dateEditor/dateEditor.js +4 -1
- package/editors/dateEditor/dateEditor.mjs +4 -1
- package/editors/dropdownEditor/dropdownEditor.js +8 -5
- package/editors/dropdownEditor/dropdownEditor.mjs +8 -5
- package/editors/handsontableEditor/handsontableEditor.js +2 -2
- package/editors/handsontableEditor/handsontableEditor.mjs +2 -2
- package/editors/selectEditor/selectEditor.js +1 -9
- package/editors/selectEditor/selectEditor.mjs +1 -9
- package/editors/textEditor/textEditor.js +2 -11
- package/editors/textEditor/textEditor.mjs +2 -11
- package/focusManager.js +3 -5
- package/focusManager.mjs +3 -5
- package/helpers/array.js +7 -0
- package/helpers/array.mjs +7 -0
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/helpers/number.js +12 -2
- package/helpers/number.mjs +12 -2
- package/package.json +3 -3
- package/pluginHooks.d.ts +1 -1
- package/pluginHooks.js +79 -2
- package/pluginHooks.mjs +79 -2
- package/plugins/autoColumnSize/autoColumnSize.js +7 -0
- package/plugins/autoColumnSize/autoColumnSize.mjs +7 -0
- package/plugins/autoRowSize/autoRowSize.js +2 -2
- package/plugins/autoRowSize/autoRowSize.mjs +2 -2
- package/plugins/autofill/autofill.js +1 -1
- package/plugins/autofill/autofill.mjs +1 -1
- package/plugins/base/base.d.ts +1 -1
- package/plugins/base/base.js +6 -2
- package/plugins/base/base.mjs +6 -2
- package/plugins/collapsibleColumns/collapsibleColumns.js +1 -1
- package/plugins/collapsibleColumns/collapsibleColumns.mjs +1 -1
- package/plugins/columnSorting/sortFunction/date.js +2 -46
- package/plugins/columnSorting/sortFunction/date.mjs +2 -45
- package/plugins/columnSorting/sortFunction/time.js +17 -0
- package/plugins/columnSorting/sortFunction/time.mjs +13 -0
- package/plugins/columnSorting/sortService/registry.js +4 -2
- package/plugins/columnSorting/sortService/registry.mjs +3 -1
- package/plugins/columnSorting/utils.js +64 -0
- package/plugins/columnSorting/utils.mjs +62 -0
- package/plugins/columnSummary/columnSummary.js +27 -10
- package/plugins/columnSummary/columnSummary.mjs +27 -10
- package/plugins/columnSummary/endpoints.js +15 -0
- package/plugins/columnSummary/endpoints.mjs +15 -0
- package/plugins/comments/comments.js +2 -8
- package/plugins/comments/comments.mjs +2 -8
- package/plugins/comments/contextMenuItem/addEditComment.js +0 -1
- package/plugins/comments/contextMenuItem/addEditComment.mjs +0 -1
- package/plugins/contextMenu/contextMenu.d.ts +1 -1
- package/plugins/copyPaste/copyPaste.js +9 -2
- package/plugins/copyPaste/copyPaste.mjs +9 -2
- package/plugins/copyPaste/pasteEvent.js +1 -0
- package/plugins/copyPaste/pasteEvent.mjs +1 -0
- package/plugins/filters/filters.js +1 -1
- package/plugins/filters/filters.mjs +1 -1
- package/plugins/filters/ui/multipleSelect.js +22 -14
- package/plugins/filters/ui/multipleSelect.mjs +22 -14
- package/plugins/filters/utils.js +7 -0
- package/plugins/filters/utils.mjs +7 -0
- package/plugins/formulas/formulas.d.ts +10 -0
- package/plugins/formulas/formulas.js +11 -2
- package/plugins/formulas/formulas.mjs +11 -2
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.js +1 -1
- package/plugins/hiddenColumns/contextMenuItem/hideColumn.mjs +1 -1
- package/plugins/hiddenColumns/contextMenuItem/showColumn.js +1 -1
- package/plugins/hiddenColumns/contextMenuItem/showColumn.mjs +1 -1
- package/plugins/hiddenColumns/hiddenColumns.js +8 -1
- package/plugins/hiddenColumns/hiddenColumns.mjs +8 -1
- package/plugins/hiddenRows/contextMenuItem/hideRow.js +1 -1
- package/plugins/hiddenRows/contextMenuItem/hideRow.mjs +1 -1
- package/plugins/hiddenRows/contextMenuItem/showRow.js +1 -1
- package/plugins/hiddenRows/contextMenuItem/showRow.mjs +1 -1
- package/plugins/hiddenRows/hiddenRows.js +7 -0
- package/plugins/hiddenRows/hiddenRows.mjs +7 -0
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/freezeColumn.mjs +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.js +1 -1
- package/plugins/manualColumnFreeze/contextMenuItem/unfreezeColumn.mjs +1 -1
- package/plugins/manualColumnMove/manualColumnMove.js +1 -1
- package/plugins/manualColumnMove/manualColumnMove.mjs +1 -1
- package/plugins/manualColumnResize/manualColumnResize.js +3 -3
- package/plugins/manualColumnResize/manualColumnResize.mjs +3 -3
- package/plugins/manualRowMove/manualRowMove.js +1 -1
- package/plugins/manualRowMove/manualRowMove.mjs +1 -1
- package/plugins/manualRowResize/manualRowResize.d.ts +1 -0
- package/plugins/manualRowResize/manualRowResize.js +11 -2
- package/plugins/manualRowResize/manualRowResize.mjs +11 -2
- package/plugins/mergeCells/cellsCollection.js +7 -0
- package/plugins/mergeCells/cellsCollection.mjs +7 -0
- package/plugins/mergeCells/mergeCells.js +7 -0
- package/plugins/mergeCells/mergeCells.mjs +7 -0
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.js +7 -0
- package/plugins/nestedHeaders/stateManager/nodeModifiers/collapse.mjs +7 -0
- package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.js +7 -0
- package/plugins/nestedHeaders/stateManager/nodeModifiers/expand.mjs +7 -0
- package/plugins/nestedRows/nestedRows.js +7 -0
- package/plugins/nestedRows/nestedRows.mjs +7 -0
- package/plugins/trimRows/trimRows.js +7 -0
- package/plugins/trimRows/trimRows.mjs +7 -0
- package/selection/selection.js +163 -4
- package/selection/selection.mjs +163 -4
- package/selection/utils.js +7 -0
- package/selection/utils.mjs +7 -0
- package/settings.d.ts +1 -0
- package/shortcutContexts/commands/editor/closeAndSave.js +2 -3
- package/shortcutContexts/commands/editor/closeAndSave.mjs +2 -3
- package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.js +27 -0
- package/shortcutContexts/commands/editor/closeAndSaveByArrowKeys.mjs +24 -0
- package/shortcutContexts/commands/editor/closeAndSaveByEnter.js +11 -0
- package/shortcutContexts/commands/editor/closeAndSaveByEnter.mjs +8 -0
- package/shortcutContexts/commands/editor/index.js +3 -1
- package/shortcutContexts/commands/editor/index.mjs +3 -1
- package/shortcutContexts/editor.js +9 -1
- package/shortcutContexts/editor.mjs +9 -1
- package/shortcutContexts/index.js +1 -1
- package/shortcutContexts/index.mjs +1 -1
- package/shortcuts/keyObserver.js +7 -0
- package/shortcuts/keyObserver.mjs +7 -0
- package/shortcuts/utils.js +7 -0
- package/shortcuts/utils.mjs +7 -0
- package/tableView.js +1 -4
- package/tableView.mjs +1 -4
- package/translations/changesObservable/observable.js +7 -0
- package/translations/changesObservable/observable.mjs +7 -0
- package/translations/indexMapper.js +7 -0
- package/translations/indexMapper.mjs +8 -1
- package/utils/dataStructures/uniqueSet.js +7 -0
- package/utils/dataStructures/uniqueSet.mjs +7 -0
- package/utils/ghostTable.js +0 -4
- package/utils/ghostTable.mjs +0 -4
- package/utils/paginator.js +7 -0
- package/utils/paginator.mjs +7 -0
- package/validators/dateValidator/dateValidator.js +1 -3
- package/validators/dateValidator/dateValidator.mjs +1 -3
- package/validators/timeValidator/timeValidator.js +1 -3
- package/validators/timeValidator/timeValidator.mjs +1 -3
package/editorManager.js
CHANGED
@@ -6,7 +6,6 @@ var _unicode = require("./helpers/unicode");
|
|
6
6
|
var _event = require("./helpers/dom/event");
|
7
7
|
var _registry = require("./editors/registry");
|
8
8
|
var _eventManager = _interopRequireDefault(require("./eventManager"));
|
9
|
-
var _mixed = require("./helpers/mixed");
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
10
|
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
12
11
|
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
@@ -14,7 +13,6 @@ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key i
|
|
14
13
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
15
14
|
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); }
|
16
15
|
function _assertClassBrand(e, t, n) { if ("function" == typeof e ? e === t : e.has(t)) return arguments.length < 3 ? t : n; throw new TypeError("Private element is not present on this object"); }
|
17
|
-
const SHORTCUTS_GROUP_NAVIGATION = exports.SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
18
16
|
var _EditorManager_brand = /*#__PURE__*/new WeakSet();
|
19
17
|
class EditorManager {
|
20
18
|
/**
|
@@ -64,13 +62,6 @@ class EditorManager {
|
|
64
62
|
* @type {boolean}
|
65
63
|
*/
|
66
64
|
_defineProperty(this, "destroyed", false);
|
67
|
-
/**
|
68
|
-
* Determines if EditorManager is locked.
|
69
|
-
*
|
70
|
-
* @private
|
71
|
-
* @type {boolean}
|
72
|
-
*/
|
73
|
-
_defineProperty(this, "lock", false);
|
74
65
|
/**
|
75
66
|
* A reference to an instance of the activeEditor.
|
76
67
|
*
|
@@ -99,34 +90,6 @@ class EditorManager {
|
|
99
90
|
this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _assertClassBrand(_EditorManager_brand, this, _onCellDblClick).call(this, event, coords, elem));
|
100
91
|
}
|
101
92
|
|
102
|
-
/**
|
103
|
-
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
104
|
-
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
105
|
-
*/
|
106
|
-
lockEditor() {
|
107
|
-
this.lock = true;
|
108
|
-
}
|
109
|
-
|
110
|
-
/**
|
111
|
-
* Unlock the editor from being prepared and closed. This method restores the original behavior of
|
112
|
-
* the editors where for every new selection its instances are closed.
|
113
|
-
*/
|
114
|
-
unlockEditor() {
|
115
|
-
this.lock = false;
|
116
|
-
}
|
117
|
-
|
118
|
-
/**
|
119
|
-
* Destroy current editor, if exists.
|
120
|
-
*
|
121
|
-
* @param {boolean} revertOriginal If `false` and the cell using allowInvalid option,
|
122
|
-
* then an editor won't be closed until validation is passed.
|
123
|
-
*/
|
124
|
-
destroyEditor(revertOriginal) {
|
125
|
-
if (!this.lock) {
|
126
|
-
this.closeEditor(revertOriginal);
|
127
|
-
}
|
128
|
-
}
|
129
|
-
|
130
93
|
/**
|
131
94
|
* Get active editor.
|
132
95
|
*
|
@@ -141,9 +104,6 @@ class EditorManager {
|
|
141
104
|
*/
|
142
105
|
prepareEditor() {
|
143
106
|
var _this$hot$getSelected;
|
144
|
-
if (this.lock) {
|
145
|
-
return;
|
146
|
-
}
|
147
107
|
if (this.activeEditor && this.activeEditor.isWaiting()) {
|
148
108
|
this.closeEditor(false, false, dataSaved => {
|
149
109
|
if (dataSaved) {
|
@@ -350,33 +310,6 @@ function _onAfterDocumentKeyDown(event) {
|
|
350
310
|
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
351
311
|
if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
|
352
312
|
if (!(0, _unicode.isFunctionKey)(keyCode) && !(0, _unicode.isCtrlMetaKey)(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
|
353
|
-
const shortcutManager = this.hot.getShortcutManager();
|
354
|
-
const editorContext = shortcutManager.getContext('editor');
|
355
|
-
const runOnlySelectedConfig = {
|
356
|
-
runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
|
357
|
-
group: SHORTCUTS_GROUP_NAVIGATION
|
358
|
-
};
|
359
|
-
editorContext.addShortcuts([{
|
360
|
-
keys: [['ArrowUp']],
|
361
|
-
callback: () => {
|
362
|
-
this.hot.selection.transformStart(-1, 0);
|
363
|
-
}
|
364
|
-
}, {
|
365
|
-
keys: [['ArrowDown']],
|
366
|
-
callback: () => {
|
367
|
-
this.hot.selection.transformStart(1, 0);
|
368
|
-
}
|
369
|
-
}, {
|
370
|
-
keys: [['ArrowLeft']],
|
371
|
-
callback: () => {
|
372
|
-
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
373
|
-
}
|
374
|
-
}, {
|
375
|
-
keys: [['ArrowRight']],
|
376
|
-
callback: () => {
|
377
|
-
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
378
|
-
}
|
379
|
-
}], runOnlySelectedConfig);
|
380
313
|
this.openEditor('', event);
|
381
314
|
}
|
382
315
|
}
|
package/editorManager.mjs
CHANGED
@@ -9,8 +9,6 @@ import { isFunctionKey, isCtrlMetaKey } from "./helpers/unicode.mjs";
|
|
9
9
|
import { isImmediatePropagationStopped } from "./helpers/dom/event.mjs";
|
10
10
|
import { getEditorInstance } from "./editors/registry.mjs";
|
11
11
|
import EventManager from "./eventManager.mjs";
|
12
|
-
import { isDefined } from "./helpers/mixed.mjs";
|
13
|
-
export const SHORTCUTS_GROUP_NAVIGATION = 'editorManager.navigation';
|
14
12
|
var _EditorManager_brand = /*#__PURE__*/new WeakSet();
|
15
13
|
class EditorManager {
|
16
14
|
/**
|
@@ -60,13 +58,6 @@ class EditorManager {
|
|
60
58
|
* @type {boolean}
|
61
59
|
*/
|
62
60
|
_defineProperty(this, "destroyed", false);
|
63
|
-
/**
|
64
|
-
* Determines if EditorManager is locked.
|
65
|
-
*
|
66
|
-
* @private
|
67
|
-
* @type {boolean}
|
68
|
-
*/
|
69
|
-
_defineProperty(this, "lock", false);
|
70
61
|
/**
|
71
62
|
* A reference to an instance of the activeEditor.
|
72
63
|
*
|
@@ -95,34 +86,6 @@ class EditorManager {
|
|
95
86
|
this.hot.view._wt.update('onCellDblClick', (event, coords, elem) => _assertClassBrand(_EditorManager_brand, this, _onCellDblClick).call(this, event, coords, elem));
|
96
87
|
}
|
97
88
|
|
98
|
-
/**
|
99
|
-
* Lock the editor from being prepared and closed. Locking the editor prevents its closing and
|
100
|
-
* reinitialized after selecting the new cell. This feature is necessary for a mobile editor.
|
101
|
-
*/
|
102
|
-
lockEditor() {
|
103
|
-
this.lock = true;
|
104
|
-
}
|
105
|
-
|
106
|
-
/**
|
107
|
-
* Unlock the editor from being prepared and closed. This method restores the original behavior of
|
108
|
-
* the editors where for every new selection its instances are closed.
|
109
|
-
*/
|
110
|
-
unlockEditor() {
|
111
|
-
this.lock = false;
|
112
|
-
}
|
113
|
-
|
114
|
-
/**
|
115
|
-
* Destroy current editor, if exists.
|
116
|
-
*
|
117
|
-
* @param {boolean} revertOriginal If `false` and the cell using allowInvalid option,
|
118
|
-
* then an editor won't be closed until validation is passed.
|
119
|
-
*/
|
120
|
-
destroyEditor(revertOriginal) {
|
121
|
-
if (!this.lock) {
|
122
|
-
this.closeEditor(revertOriginal);
|
123
|
-
}
|
124
|
-
}
|
125
|
-
|
126
89
|
/**
|
127
90
|
* Get active editor.
|
128
91
|
*
|
@@ -137,9 +100,6 @@ class EditorManager {
|
|
137
100
|
*/
|
138
101
|
prepareEditor() {
|
139
102
|
var _this$hot$getSelected;
|
140
|
-
if (this.lock) {
|
141
|
-
return;
|
142
|
-
}
|
143
103
|
if (this.activeEditor && this.activeEditor.isWaiting()) {
|
144
104
|
this.closeEditor(false, false, dataSaved => {
|
145
105
|
if (dataSaved) {
|
@@ -346,33 +306,6 @@ function _onAfterDocumentKeyDown(event) {
|
|
346
306
|
const isCtrlPressed = (event.ctrlKey || event.metaKey) && !event.altKey;
|
347
307
|
if (!this.activeEditor || this.activeEditor && !this.activeEditor.isWaiting()) {
|
348
308
|
if (!isFunctionKey(keyCode) && !isCtrlMetaKey(keyCode) && !isCtrlPressed && !this.isEditorOpened()) {
|
349
|
-
const shortcutManager = this.hot.getShortcutManager();
|
350
|
-
const editorContext = shortcutManager.getContext('editor');
|
351
|
-
const runOnlySelectedConfig = {
|
352
|
-
runOnlyIf: () => isDefined(this.hot.getSelected()),
|
353
|
-
group: SHORTCUTS_GROUP_NAVIGATION
|
354
|
-
};
|
355
|
-
editorContext.addShortcuts([{
|
356
|
-
keys: [['ArrowUp']],
|
357
|
-
callback: () => {
|
358
|
-
this.hot.selection.transformStart(-1, 0);
|
359
|
-
}
|
360
|
-
}, {
|
361
|
-
keys: [['ArrowDown']],
|
362
|
-
callback: () => {
|
363
|
-
this.hot.selection.transformStart(1, 0);
|
364
|
-
}
|
365
|
-
}, {
|
366
|
-
keys: [['ArrowLeft']],
|
367
|
-
callback: () => {
|
368
|
-
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
369
|
-
}
|
370
|
-
}, {
|
371
|
-
keys: [['ArrowRight']],
|
372
|
-
callback: () => {
|
373
|
-
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
374
|
-
}
|
375
|
-
}], runOnlySelectedConfig);
|
376
309
|
this.openEditor('', event);
|
377
310
|
}
|
378
311
|
}
|
@@ -318,12 +318,14 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
318
318
|
choices = sorted;
|
319
319
|
}
|
320
320
|
this.strippedChoices = choices;
|
321
|
-
this.htEditor.loadData((0, _array.pivot)([choices]));
|
322
321
|
if (choices.length === 0) {
|
323
322
|
this.htEditor.rootElement.style.display = 'none';
|
324
323
|
} else {
|
325
324
|
this.htEditor.rootElement.style.display = '';
|
326
|
-
|
325
|
+
}
|
326
|
+
this.htEditor.loadData((0, _array.pivot)([choices]));
|
327
|
+
if (choices.length > 0) {
|
328
|
+
this.updateDropdownDimensions();
|
327
329
|
this.flipDropdownIfNeeded();
|
328
330
|
if (this.cellProperties.strict === true) {
|
329
331
|
this.highlightBestMatchingChoice(highlightIndex);
|
@@ -384,7 +386,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
384
386
|
} while (tempHeight < spaceAvailable);
|
385
387
|
height = tempHeight - lastRowHeight;
|
386
388
|
if (this.htEditor.flipped) {
|
387
|
-
this.htEditor.rootElement.style.top = `${parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height}px`;
|
389
|
+
this.htEditor.rootElement.style.top = `${parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height}px`;
|
388
390
|
}
|
389
391
|
this.setDropdownHeight(tempHeight - lastRowHeight);
|
390
392
|
}
|
@@ -420,7 +422,7 @@ class AutocompleteEditor extends _handsontableEditor.HandsontableEditor {
|
|
420
422
|
*
|
421
423
|
* @private
|
422
424
|
*/
|
423
|
-
|
425
|
+
updateDropdownDimensions() {
|
424
426
|
const currentDropdownWidth = this.htEditor.getColWidth(0) + (0, _element.getScrollbarWidth)(this.hot.rootDocument) + 2;
|
425
427
|
const trimDropdown = this.cellProperties.trimDropdown;
|
426
428
|
this.htEditor.updateSettings({
|
@@ -315,12 +315,14 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
315
315
|
choices = sorted;
|
316
316
|
}
|
317
317
|
this.strippedChoices = choices;
|
318
|
-
this.htEditor.loadData(pivot([choices]));
|
319
318
|
if (choices.length === 0) {
|
320
319
|
this.htEditor.rootElement.style.display = 'none';
|
321
320
|
} else {
|
322
321
|
this.htEditor.rootElement.style.display = '';
|
323
|
-
|
322
|
+
}
|
323
|
+
this.htEditor.loadData(pivot([choices]));
|
324
|
+
if (choices.length > 0) {
|
325
|
+
this.updateDropdownDimensions();
|
324
326
|
this.flipDropdownIfNeeded();
|
325
327
|
if (this.cellProperties.strict === true) {
|
326
328
|
this.highlightBestMatchingChoice(highlightIndex);
|
@@ -381,7 +383,7 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
381
383
|
} while (tempHeight < spaceAvailable);
|
382
384
|
height = tempHeight - lastRowHeight;
|
383
385
|
if (this.htEditor.flipped) {
|
384
|
-
this.htEditor.rootElement.style.top = `${parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height}px`;
|
386
|
+
this.htEditor.rootElement.style.top = `${parseInt(this.htEditor.rootElement.style.top, 10) + dropdownHeight - height}px`;
|
385
387
|
}
|
386
388
|
this.setDropdownHeight(tempHeight - lastRowHeight);
|
387
389
|
}
|
@@ -417,7 +419,7 @@ export class AutocompleteEditor extends HandsontableEditor {
|
|
417
419
|
*
|
418
420
|
* @private
|
419
421
|
*/
|
420
|
-
|
422
|
+
updateDropdownDimensions() {
|
421
423
|
const currentDropdownWidth = this.htEditor.getColWidth(0) + getScrollbarWidth(this.hot.rootDocument) + 2;
|
422
424
|
const trimDropdown = this.cellProperties.trimDropdown;
|
423
425
|
this.htEditor.updateSettings({
|
@@ -4,7 +4,6 @@ exports.__esModule = true;
|
|
4
4
|
require("core-js/modules/es.error.cause.js");
|
5
5
|
var _mixed = require("../../helpers/mixed");
|
6
6
|
var _object = require("../../helpers/object");
|
7
|
-
var _editorManager = require("../../editorManager");
|
8
7
|
var _hooksRefRegisterer = _interopRequireDefault(require("../../mixins/hooksRefRegisterer"));
|
9
8
|
var _element = require("../../helpers/dom/element");
|
10
9
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -20,7 +19,6 @@ const EDITOR_STATE = exports.EDITOR_STATE = Object.freeze({
|
|
20
19
|
// waiting for async validation
|
21
20
|
FINISHED: 'STATE_FINISHED'
|
22
21
|
});
|
23
|
-
const SHORTCUTS_GROUP_EDITOR = exports.SHORTCUTS_GROUP_EDITOR = 'baseEditor';
|
24
22
|
|
25
23
|
/**
|
26
24
|
* @class BaseEditor
|
@@ -172,7 +170,7 @@ class BaseEditor {
|
|
172
170
|
this.prop = prop;
|
173
171
|
this.originalValue = value;
|
174
172
|
this.cellProperties = cellProperties;
|
175
|
-
this.state = EDITOR_STATE.VIRGIN;
|
173
|
+
this.state = this.isOpened() ? this.state : EDITOR_STATE.VIRGIN;
|
176
174
|
}
|
177
175
|
|
178
176
|
/**
|
@@ -210,35 +208,6 @@ class BaseEditor {
|
|
210
208
|
if (Array.isArray(modifiedCellCoords)) {
|
211
209
|
[visualRowFrom, visualColumnFrom] = modifiedCellCoords;
|
212
210
|
}
|
213
|
-
const shortcutManager = this.hot.getShortcutManager();
|
214
|
-
const editorContext = shortcutManager.getContext('editor');
|
215
|
-
const contextConfig = {
|
216
|
-
runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
|
217
|
-
group: SHORTCUTS_GROUP_EDITOR
|
218
|
-
};
|
219
|
-
if (this.isInFullEditMode()) {
|
220
|
-
editorContext.addShortcuts([{
|
221
|
-
keys: [['ArrowUp']],
|
222
|
-
callback: () => {
|
223
|
-
this.hot.selection.transformStart(-1, 0);
|
224
|
-
}
|
225
|
-
}, {
|
226
|
-
keys: [['ArrowDown']],
|
227
|
-
callback: () => {
|
228
|
-
this.hot.selection.transformStart(1, 0);
|
229
|
-
}
|
230
|
-
}, {
|
231
|
-
keys: [['ArrowLeft']],
|
232
|
-
callback: () => {
|
233
|
-
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
234
|
-
}
|
235
|
-
}, {
|
236
|
-
keys: [['ArrowRight']],
|
237
|
-
callback: () => {
|
238
|
-
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
239
|
-
}
|
240
|
-
}], contextConfig);
|
241
|
-
}
|
242
211
|
|
243
212
|
// Saving values using the modified coordinates.
|
244
213
|
this.hot.populateFromArray(visualRowFrom, visualColumnFrom, value, visualRowTo, visualColumnTo, 'edit');
|
@@ -299,10 +268,6 @@ class BaseEditor {
|
|
299
268
|
if (this.isWaiting()) {
|
300
269
|
return;
|
301
270
|
}
|
302
|
-
const shortcutManager = this.hot.getShortcutManager();
|
303
|
-
const editorContext = shortcutManager.getContext('editor');
|
304
|
-
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_EDITOR);
|
305
|
-
editorContext.removeShortcutsByGroup(_editorManager.SHORTCUTS_GROUP_NAVIGATION);
|
306
271
|
if (this.state === EDITOR_STATE.VIRGIN) {
|
307
272
|
this.hot._registerTimeout(() => {
|
308
273
|
this._fireCallbacks(true);
|
@@ -2,9 +2,8 @@ import "core-js/modules/es.error.cause.js";
|
|
2
2
|
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; }
|
3
3
|
function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : i + ""; }
|
4
4
|
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); }
|
5
|
-
import {
|
5
|
+
import { stringify } from "../../helpers/mixed.mjs";
|
6
6
|
import { mixin } from "../../helpers/object.mjs";
|
7
|
-
import { SHORTCUTS_GROUP_NAVIGATION } from "../../editorManager.mjs";
|
8
7
|
import hooksRefRegisterer from "../../mixins/hooksRefRegisterer.mjs";
|
9
8
|
import { getScrollbarWidth, offset, hasVerticalScrollbar, hasHorizontalScrollbar, outerWidth, outerHeight, getComputedStyle } from "../../helpers/dom/element.mjs";
|
10
9
|
export const EDITOR_TYPE = 'base';
|
@@ -16,7 +15,6 @@ export const EDITOR_STATE = Object.freeze({
|
|
16
15
|
// waiting for async validation
|
17
16
|
FINISHED: 'STATE_FINISHED'
|
18
17
|
});
|
19
|
-
export const SHORTCUTS_GROUP_EDITOR = 'baseEditor';
|
20
18
|
|
21
19
|
/**
|
22
20
|
* @class BaseEditor
|
@@ -168,7 +166,7 @@ export class BaseEditor {
|
|
168
166
|
this.prop = prop;
|
169
167
|
this.originalValue = value;
|
170
168
|
this.cellProperties = cellProperties;
|
171
|
-
this.state = EDITOR_STATE.VIRGIN;
|
169
|
+
this.state = this.isOpened() ? this.state : EDITOR_STATE.VIRGIN;
|
172
170
|
}
|
173
171
|
|
174
172
|
/**
|
@@ -206,35 +204,6 @@ export class BaseEditor {
|
|
206
204
|
if (Array.isArray(modifiedCellCoords)) {
|
207
205
|
[visualRowFrom, visualColumnFrom] = modifiedCellCoords;
|
208
206
|
}
|
209
|
-
const shortcutManager = this.hot.getShortcutManager();
|
210
|
-
const editorContext = shortcutManager.getContext('editor');
|
211
|
-
const contextConfig = {
|
212
|
-
runOnlyIf: () => isDefined(this.hot.getSelected()),
|
213
|
-
group: SHORTCUTS_GROUP_EDITOR
|
214
|
-
};
|
215
|
-
if (this.isInFullEditMode()) {
|
216
|
-
editorContext.addShortcuts([{
|
217
|
-
keys: [['ArrowUp']],
|
218
|
-
callback: () => {
|
219
|
-
this.hot.selection.transformStart(-1, 0);
|
220
|
-
}
|
221
|
-
}, {
|
222
|
-
keys: [['ArrowDown']],
|
223
|
-
callback: () => {
|
224
|
-
this.hot.selection.transformStart(1, 0);
|
225
|
-
}
|
226
|
-
}, {
|
227
|
-
keys: [['ArrowLeft']],
|
228
|
-
callback: () => {
|
229
|
-
this.hot.selection.transformStart(0, -1 * this.hot.getDirectionFactor());
|
230
|
-
}
|
231
|
-
}, {
|
232
|
-
keys: [['ArrowRight']],
|
233
|
-
callback: () => {
|
234
|
-
this.hot.selection.transformStart(0, this.hot.getDirectionFactor());
|
235
|
-
}
|
236
|
-
}], contextConfig);
|
237
|
-
}
|
238
207
|
|
239
208
|
// Saving values using the modified coordinates.
|
240
209
|
this.hot.populateFromArray(visualRowFrom, visualColumnFrom, value, visualRowTo, visualColumnTo, 'edit');
|
@@ -295,10 +264,6 @@ export class BaseEditor {
|
|
295
264
|
if (this.isWaiting()) {
|
296
265
|
return;
|
297
266
|
}
|
298
|
-
const shortcutManager = this.hot.getShortcutManager();
|
299
|
-
const editorContext = shortcutManager.getContext('editor');
|
300
|
-
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_EDITOR);
|
301
|
-
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP_NAVIGATION);
|
302
267
|
if (this.state === EDITOR_STATE.VIRGIN) {
|
303
268
|
this.hot._registerTimeout(() => {
|
304
269
|
this._fireCallbacks(true);
|
@@ -155,7 +155,10 @@ class DateEditor extends _textEditor.TextEditor {
|
|
155
155
|
this.$datePicker.destroy();
|
156
156
|
}
|
157
157
|
this.hot._registerTimeout(() => {
|
158
|
-
this.hot.
|
158
|
+
const editorManager = this.hot._getEditorManager();
|
159
|
+
editorManager.closeEditor();
|
160
|
+
this.hot.view.render();
|
161
|
+
editorManager.prepareEditor();
|
159
162
|
});
|
160
163
|
const shortcutManager = this.hot.getShortcutManager();
|
161
164
|
const editorContext = shortcutManager.getContext('editor');
|
@@ -151,7 +151,10 @@ export class DateEditor extends TextEditor {
|
|
151
151
|
this.$datePicker.destroy();
|
152
152
|
}
|
153
153
|
this.hot._registerTimeout(() => {
|
154
|
-
this.hot.
|
154
|
+
const editorManager = this.hot._getEditorManager();
|
155
|
+
editorManager.closeEditor();
|
156
|
+
this.hot.view.render();
|
157
|
+
editorManager.prepareEditor();
|
155
158
|
});
|
156
159
|
const shortcutManager = this.hot.getShortcutManager();
|
157
160
|
const editorContext = shortcutManager.getContext('editor');
|
@@ -31,11 +31,14 @@ class DropdownEditor extends _autocompleteEditor.AutocompleteEditor {
|
|
31
31
|
}
|
32
32
|
exports.DropdownEditor = DropdownEditor;
|
33
33
|
_pluginHooks.default.getSingleton().add('beforeValidate', function (value, row, col) {
|
34
|
-
const
|
35
|
-
if (
|
36
|
-
|
37
|
-
|
38
|
-
cellMeta.strict
|
34
|
+
const visualColumnIndex = this.propToCol(col);
|
35
|
+
if (Number.isInteger(visualColumnIndex)) {
|
36
|
+
const cellMeta = this.getCellMeta(row, visualColumnIndex);
|
37
|
+
if (cellMeta.editor === DropdownEditor) {
|
38
|
+
if (cellMeta.strict === undefined) {
|
39
|
+
cellMeta.filter = false;
|
40
|
+
cellMeta.strict = true;
|
41
|
+
}
|
39
42
|
}
|
40
43
|
}
|
41
44
|
});
|
@@ -26,11 +26,14 @@ export class DropdownEditor extends AutocompleteEditor {
|
|
26
26
|
}
|
27
27
|
}
|
28
28
|
Hooks.getSingleton().add('beforeValidate', function (value, row, col) {
|
29
|
-
const
|
30
|
-
if (
|
31
|
-
|
32
|
-
|
33
|
-
cellMeta.strict
|
29
|
+
const visualColumnIndex = this.propToCol(col);
|
30
|
+
if (Number.isInteger(visualColumnIndex)) {
|
31
|
+
const cellMeta = this.getCellMeta(row, visualColumnIndex);
|
32
|
+
if (cellMeta.editor === DropdownEditor) {
|
33
|
+
if (cellMeta.strict === undefined) {
|
34
|
+
cellMeta.filter = false;
|
35
|
+
cellMeta.strict = true;
|
36
|
+
}
|
34
37
|
}
|
35
38
|
}
|
36
39
|
});
|
@@ -5,7 +5,7 @@ var _textEditor = require("../textEditor");
|
|
5
5
|
var _element = require("../../helpers/dom/element");
|
6
6
|
var _event = require("../../helpers/dom/event");
|
7
7
|
var _object = require("../../helpers/object");
|
8
|
-
var
|
8
|
+
var _shortcutContexts = require("../../shortcutContexts");
|
9
9
|
const SHORTCUTS_GROUP = 'handsontableEditor';
|
10
10
|
const EDITOR_TYPE = exports.EDITOR_TYPE = 'handsontable';
|
11
11
|
|
@@ -171,7 +171,7 @@ class HandsontableEditor extends _textEditor.TextEditor {
|
|
171
171
|
super.registerShortcuts();
|
172
172
|
const contextConfig = {
|
173
173
|
group: SHORTCUTS_GROUP,
|
174
|
-
relativeToGroup:
|
174
|
+
relativeToGroup: _shortcutContexts.EDITOR_EDIT_GROUP,
|
175
175
|
position: 'before'
|
176
176
|
};
|
177
177
|
const action = (rowToSelect, event) => {
|
@@ -2,7 +2,7 @@ import { TextEditor } from "../textEditor/index.mjs";
|
|
2
2
|
import { setCaretPosition } from "../../helpers/dom/element.mjs";
|
3
3
|
import { stopImmediatePropagation } from "../../helpers/dom/event.mjs";
|
4
4
|
import { extend } from "../../helpers/object.mjs";
|
5
|
-
import {
|
5
|
+
import { EDITOR_EDIT_GROUP } from "../../shortcutContexts/index.mjs";
|
6
6
|
const SHORTCUTS_GROUP = 'handsontableEditor';
|
7
7
|
export const EDITOR_TYPE = 'handsontable';
|
8
8
|
|
@@ -168,7 +168,7 @@ export class HandsontableEditor extends TextEditor {
|
|
168
168
|
super.registerShortcuts();
|
169
169
|
const contextConfig = {
|
170
170
|
group: SHORTCUTS_GROUP,
|
171
|
-
relativeToGroup:
|
171
|
+
relativeToGroup: EDITOR_EDIT_GROUP,
|
172
172
|
position: 'before'
|
173
173
|
};
|
174
174
|
const action = (rowToSelect, event) => {
|
@@ -189,18 +189,10 @@ class SelectEditor extends _baseEditor.BaseEditor {
|
|
189
189
|
registerShortcuts() {
|
190
190
|
const shortcutManager = this.hot.getShortcutManager();
|
191
191
|
const editorContext = shortcutManager.getContext('editor');
|
192
|
-
const gridContext = shortcutManager.getContext('grid');
|
193
192
|
const contextConfig = {
|
194
193
|
group: SHORTCUTS_GROUP
|
195
194
|
};
|
196
|
-
|
197
|
-
// The `TAB`-related shortcuts should work both in full and fast edit modes.
|
198
|
-
editorContext.addShortcuts([{
|
199
|
-
keys: [['Tab'], ['Shift', 'Tab']],
|
200
|
-
forwardToContext: gridContext,
|
201
|
-
callback: () => {}
|
202
|
-
}], contextConfig);
|
203
|
-
if (this.isInFullEditMode() === true) {
|
195
|
+
if (this.isInFullEditMode()) {
|
204
196
|
// The arrow-related shortcuts should work only in full edit mode.
|
205
197
|
editorContext.addShortcuts([{
|
206
198
|
keys: [['ArrowUp']],
|
@@ -186,18 +186,10 @@ export class SelectEditor extends BaseEditor {
|
|
186
186
|
registerShortcuts() {
|
187
187
|
const shortcutManager = this.hot.getShortcutManager();
|
188
188
|
const editorContext = shortcutManager.getContext('editor');
|
189
|
-
const gridContext = shortcutManager.getContext('grid');
|
190
189
|
const contextConfig = {
|
191
190
|
group: SHORTCUTS_GROUP
|
192
191
|
};
|
193
|
-
|
194
|
-
// The `TAB`-related shortcuts should work both in full and fast edit modes.
|
195
|
-
editorContext.addShortcuts([{
|
196
|
-
keys: [['Tab'], ['Shift', 'Tab']],
|
197
|
-
forwardToContext: gridContext,
|
198
|
-
callback: () => {}
|
199
|
-
}], contextConfig);
|
200
|
-
if (this.isInFullEditMode() === true) {
|
192
|
+
if (this.isInFullEditMode()) {
|
201
193
|
// The arrow-related shortcuts should work only in full edit mode.
|
202
194
|
editorContext.addShortcuts([{
|
203
195
|
keys: [['ArrowUp']],
|
@@ -9,8 +9,6 @@ var _element = require("../../helpers/dom/element");
|
|
9
9
|
var _number = require("../../helpers/number");
|
10
10
|
var _autoResize = require("../../utils/autoResize");
|
11
11
|
var _mixed = require("../../helpers/mixed");
|
12
|
-
var _editorManager = require("../../editorManager");
|
13
|
-
var _baseEditor2 = require("../baseEditor/baseEditor");
|
14
12
|
var _caretPositioner = require("./caretPositioner");
|
15
13
|
var _a11y = require("../../helpers/a11y");
|
16
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
@@ -150,12 +148,12 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
150
148
|
const {
|
151
149
|
allowInvalid
|
152
150
|
} = cellProperties;
|
153
|
-
if (allowInvalid) {
|
151
|
+
if (allowInvalid && !this.isOpened()) {
|
154
152
|
// Remove an empty space from textarea (added by copyPaste plugin to make copy/paste
|
155
153
|
// functionality work with IME)
|
156
154
|
this.TEXTAREA.value = '';
|
157
155
|
}
|
158
|
-
if (previousState !== _baseEditor.EDITOR_STATE.FINISHED) {
|
156
|
+
if (previousState !== _baseEditor.EDITOR_STATE.FINISHED && !this.isOpened()) {
|
159
157
|
this.hideEditableElement();
|
160
158
|
}
|
161
159
|
}
|
@@ -381,7 +379,6 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
381
379
|
registerShortcuts() {
|
382
380
|
const shortcutManager = this.hot.getShortcutManager();
|
383
381
|
const editorContext = shortcutManager.getContext('editor');
|
384
|
-
const gridContext = shortcutManager.getContext('grid');
|
385
382
|
const contextConfig = {
|
386
383
|
runOnlyIf: () => (0, _mixed.isDefined)(this.hot.getSelected()),
|
387
384
|
group: SHORTCUTS_GROUP
|
@@ -390,10 +387,6 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
390
387
|
this.hot.rootDocument.execCommand('insertText', false, '\n');
|
391
388
|
};
|
392
389
|
editorContext.addShortcuts([{
|
393
|
-
keys: [['Tab'], ['Shift', 'Tab'], ['PageUp'], ['PageDown']],
|
394
|
-
forwardToContext: gridContext,
|
395
|
-
callback: () => {}
|
396
|
-
}, {
|
397
390
|
keys: [['Control', 'Enter']],
|
398
391
|
callback: () => {
|
399
392
|
insertNewLine();
|
@@ -439,9 +432,7 @@ class TextEditor extends _baseEditor.BaseEditor {
|
|
439
432
|
unregisterShortcuts() {
|
440
433
|
const shortcutManager = this.hot.getShortcutManager();
|
441
434
|
const editorContext = shortcutManager.getContext('editor');
|
442
|
-
editorContext.removeShortcutsByGroup(_editorManager.SHORTCUTS_GROUP_NAVIGATION);
|
443
435
|
editorContext.removeShortcutsByGroup(SHORTCUTS_GROUP);
|
444
|
-
editorContext.removeShortcutsByGroup(_baseEditor2.SHORTCUTS_GROUP_EDITOR);
|
445
436
|
}
|
446
437
|
}
|
447
438
|
exports.TextEditor = TextEditor;
|