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/plugins/base/base.d.ts
CHANGED
@@ -19,7 +19,7 @@ export class BasePlugin {
|
|
19
19
|
enablePlugin(): void;
|
20
20
|
disablePlugin(): void;
|
21
21
|
updatePlugin(): void;
|
22
|
-
addHook<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]
|
22
|
+
addHook<K extends keyof Events>(key: K, callback: Events[K] | Array<Events[K]>, orderIndex?: number): void;
|
23
23
|
removeHooks(name: keyof Events): void;
|
24
24
|
clearHooks(): void;
|
25
25
|
callOnPluginsReady(callback: () => void): void;
|
package/plugins/base/base.js
CHANGED
@@ -178,11 +178,15 @@ class BasePlugin {
|
|
178
178
|
*
|
179
179
|
* @param {string} name The hook name.
|
180
180
|
* @param {Function} callback The listener function to add.
|
181
|
+
* @param {number} [orderIndex] Order index of the callback.
|
182
|
+
* If > 0, the callback will be added after the others, for example, with an index of 1, the callback will be added before the ones with an index of 2, 3, etc., but after the ones with an index of 0 and lower.
|
183
|
+
* If < 0, the callback will be added before the others, for example, with an index of -1, the callback will be added after the ones with an index of -2, -3, etc., but before the ones with an index of 0 and higher.
|
184
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
181
185
|
*/
|
182
|
-
addHook(name, callback) {
|
186
|
+
addHook(name, callback, orderIndex) {
|
183
187
|
_classPrivateFieldGet(_hooks, this)[name] = _classPrivateFieldGet(_hooks, this)[name] || [];
|
184
188
|
const hooks = _classPrivateFieldGet(_hooks, this)[name];
|
185
|
-
this.hot.addHook(name, callback);
|
189
|
+
this.hot.addHook(name, callback, orderIndex);
|
186
190
|
hooks.push(callback);
|
187
191
|
_classPrivateFieldGet(_hooks, this)[name] = hooks;
|
188
192
|
}
|
package/plugins/base/base.mjs
CHANGED
@@ -174,11 +174,15 @@ export class BasePlugin {
|
|
174
174
|
*
|
175
175
|
* @param {string} name The hook name.
|
176
176
|
* @param {Function} callback The listener function to add.
|
177
|
+
* @param {number} [orderIndex] Order index of the callback.
|
178
|
+
* If > 0, the callback will be added after the others, for example, with an index of 1, the callback will be added before the ones with an index of 2, 3, etc., but after the ones with an index of 0 and lower.
|
179
|
+
* If < 0, the callback will be added before the others, for example, with an index of -1, the callback will be added after the ones with an index of -2, -3, etc., but before the ones with an index of 0 and higher.
|
180
|
+
* If 0 or no order index is provided, the callback will be added between the "negative" and "positive" indexes.
|
177
181
|
*/
|
178
|
-
addHook(name, callback) {
|
182
|
+
addHook(name, callback, orderIndex) {
|
179
183
|
_classPrivateFieldGet(_hooks, this)[name] = _classPrivateFieldGet(_hooks, this)[name] || [];
|
180
184
|
const hooks = _classPrivateFieldGet(_hooks, this)[name];
|
181
|
-
this.hot.addHook(name, callback);
|
185
|
+
this.hot.addHook(name, callback, orderIndex);
|
182
186
|
hooks.push(callback);
|
183
187
|
_classPrivateFieldGet(_hooks, this)[name] = hooks;
|
184
188
|
}
|
@@ -496,7 +496,7 @@ class CollapsibleColumns extends _base.BasePlugin {
|
|
496
496
|
}
|
497
497
|
this.hot.runHooks(actionTranslator.afterHook, currentCollapsedColumns, destinationCollapsedColumns, isActionPossible, isActionPerformed);
|
498
498
|
this.hot.render();
|
499
|
-
this.hot.view.adjustElementsSize(
|
499
|
+
this.hot.view.adjustElementsSize();
|
500
500
|
}
|
501
501
|
|
502
502
|
/**
|
@@ -493,7 +493,7 @@ export class CollapsibleColumns extends BasePlugin {
|
|
493
493
|
}
|
494
494
|
this.hot.runHooks(actionTranslator.afterHook, currentCollapsedColumns, destinationCollapsedColumns, isActionPossible, isActionPerformed);
|
495
495
|
this.hot.render();
|
496
|
-
this.hot.view.adjustElementsSize(
|
496
|
+
this.hot.view.adjustElementsSize();
|
497
497
|
}
|
498
498
|
|
499
499
|
/**
|
@@ -2,10 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.compareFunctionFactory = compareFunctionFactory;
|
5
|
-
var
|
6
|
-
var _mixed = require("../../../helpers/mixed");
|
7
|
-
var _sortService = require("../sortService");
|
8
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
5
|
+
var _utils = require("../utils");
|
9
6
|
/**
|
10
7
|
* Date sorting compare function factory. Method get as parameters `sortOrder` and `columnMeta` and return compare function.
|
11
8
|
*
|
@@ -15,47 +12,6 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
|
15
12
|
* @returns {Function} The compare function.
|
16
13
|
*/
|
17
14
|
function compareFunctionFactory(sortOrder, columnMeta, columnPluginSettings) {
|
18
|
-
return
|
19
|
-
const {
|
20
|
-
sortEmptyCells
|
21
|
-
} = columnPluginSettings;
|
22
|
-
if (value === nextValue) {
|
23
|
-
return _sortService.DO_NOT_SWAP;
|
24
|
-
}
|
25
|
-
if ((0, _mixed.isEmpty)(value)) {
|
26
|
-
if ((0, _mixed.isEmpty)(nextValue)) {
|
27
|
-
return _sortService.DO_NOT_SWAP;
|
28
|
-
}
|
29
|
-
|
30
|
-
// Just fist value is empty and `sortEmptyCells` option was set
|
31
|
-
if (sortEmptyCells) {
|
32
|
-
return sortOrder === 'asc' ? _sortService.FIRST_BEFORE_SECOND : _sortService.FIRST_AFTER_SECOND;
|
33
|
-
}
|
34
|
-
return _sortService.FIRST_AFTER_SECOND;
|
35
|
-
}
|
36
|
-
if ((0, _mixed.isEmpty)(nextValue)) {
|
37
|
-
// Just second value is empty and `sortEmptyCells` option was set
|
38
|
-
if (sortEmptyCells) {
|
39
|
-
return sortOrder === 'asc' ? _sortService.FIRST_AFTER_SECOND : _sortService.FIRST_BEFORE_SECOND;
|
40
|
-
}
|
41
|
-
return _sortService.FIRST_BEFORE_SECOND;
|
42
|
-
}
|
43
|
-
const dateFormat = columnMeta.dateFormat;
|
44
|
-
const firstDate = (0, _moment.default)(value, dateFormat);
|
45
|
-
const nextDate = (0, _moment.default)(nextValue, dateFormat);
|
46
|
-
if (!firstDate.isValid()) {
|
47
|
-
return _sortService.FIRST_AFTER_SECOND;
|
48
|
-
}
|
49
|
-
if (!nextDate.isValid()) {
|
50
|
-
return _sortService.FIRST_BEFORE_SECOND;
|
51
|
-
}
|
52
|
-
if (nextDate.isAfter(firstDate)) {
|
53
|
-
return sortOrder === 'asc' ? _sortService.FIRST_BEFORE_SECOND : _sortService.FIRST_AFTER_SECOND;
|
54
|
-
}
|
55
|
-
if (nextDate.isBefore(firstDate)) {
|
56
|
-
return sortOrder === 'asc' ? _sortService.FIRST_AFTER_SECOND : _sortService.FIRST_BEFORE_SECOND;
|
57
|
-
}
|
58
|
-
return _sortService.DO_NOT_SWAP;
|
59
|
-
};
|
15
|
+
return (0, _utils.createDateTimeCompareFunction)(sortOrder, columnMeta.dateFormat, columnPluginSettings);
|
60
16
|
}
|
61
17
|
const COLUMN_DATA_TYPE = exports.COLUMN_DATA_TYPE = 'date';
|
@@ -1,6 +1,4 @@
|
|
1
|
-
import
|
2
|
-
import { isEmpty } from "../../../helpers/mixed.mjs";
|
3
|
-
import { DO_NOT_SWAP, FIRST_BEFORE_SECOND, FIRST_AFTER_SECOND } from "../sortService/index.mjs";
|
1
|
+
import { createDateTimeCompareFunction } from "../utils.mjs";
|
4
2
|
/**
|
5
3
|
* Date sorting compare function factory. Method get as parameters `sortOrder` and `columnMeta` and return compare function.
|
6
4
|
*
|
@@ -10,47 +8,6 @@ import { DO_NOT_SWAP, FIRST_BEFORE_SECOND, FIRST_AFTER_SECOND } from "../sortSer
|
|
10
8
|
* @returns {Function} The compare function.
|
11
9
|
*/
|
12
10
|
export function compareFunctionFactory(sortOrder, columnMeta, columnPluginSettings) {
|
13
|
-
return
|
14
|
-
const {
|
15
|
-
sortEmptyCells
|
16
|
-
} = columnPluginSettings;
|
17
|
-
if (value === nextValue) {
|
18
|
-
return DO_NOT_SWAP;
|
19
|
-
}
|
20
|
-
if (isEmpty(value)) {
|
21
|
-
if (isEmpty(nextValue)) {
|
22
|
-
return DO_NOT_SWAP;
|
23
|
-
}
|
24
|
-
|
25
|
-
// Just fist value is empty and `sortEmptyCells` option was set
|
26
|
-
if (sortEmptyCells) {
|
27
|
-
return sortOrder === 'asc' ? FIRST_BEFORE_SECOND : FIRST_AFTER_SECOND;
|
28
|
-
}
|
29
|
-
return FIRST_AFTER_SECOND;
|
30
|
-
}
|
31
|
-
if (isEmpty(nextValue)) {
|
32
|
-
// Just second value is empty and `sortEmptyCells` option was set
|
33
|
-
if (sortEmptyCells) {
|
34
|
-
return sortOrder === 'asc' ? FIRST_AFTER_SECOND : FIRST_BEFORE_SECOND;
|
35
|
-
}
|
36
|
-
return FIRST_BEFORE_SECOND;
|
37
|
-
}
|
38
|
-
const dateFormat = columnMeta.dateFormat;
|
39
|
-
const firstDate = moment(value, dateFormat);
|
40
|
-
const nextDate = moment(nextValue, dateFormat);
|
41
|
-
if (!firstDate.isValid()) {
|
42
|
-
return FIRST_AFTER_SECOND;
|
43
|
-
}
|
44
|
-
if (!nextDate.isValid()) {
|
45
|
-
return FIRST_BEFORE_SECOND;
|
46
|
-
}
|
47
|
-
if (nextDate.isAfter(firstDate)) {
|
48
|
-
return sortOrder === 'asc' ? FIRST_BEFORE_SECOND : FIRST_AFTER_SECOND;
|
49
|
-
}
|
50
|
-
if (nextDate.isBefore(firstDate)) {
|
51
|
-
return sortOrder === 'asc' ? FIRST_AFTER_SECOND : FIRST_BEFORE_SECOND;
|
52
|
-
}
|
53
|
-
return DO_NOT_SWAP;
|
54
|
-
};
|
11
|
+
return createDateTimeCompareFunction(sortOrder, columnMeta.dateFormat, columnPluginSettings);
|
55
12
|
}
|
56
13
|
export const COLUMN_DATA_TYPE = 'date';
|
@@ -0,0 +1,17 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.compareFunctionFactory = compareFunctionFactory;
|
5
|
+
var _utils = require("../utils");
|
6
|
+
/**
|
7
|
+
* Date sorting compare function factory. Method get as parameters `sortOrder` and `columnMeta` and return compare function.
|
8
|
+
*
|
9
|
+
* @param {string} sortOrder Sort order (`asc` for ascending, `desc` for descending).
|
10
|
+
* @param {object} columnMeta Column meta object.
|
11
|
+
* @param {object} columnPluginSettings Plugin settings for the column.
|
12
|
+
* @returns {Function} The compare function.
|
13
|
+
*/
|
14
|
+
function compareFunctionFactory(sortOrder, columnMeta, columnPluginSettings) {
|
15
|
+
return (0, _utils.createDateTimeCompareFunction)(sortOrder, columnMeta.timeFormat, columnPluginSettings);
|
16
|
+
}
|
17
|
+
const COLUMN_DATA_TYPE = exports.COLUMN_DATA_TYPE = 'time';
|
@@ -0,0 +1,13 @@
|
|
1
|
+
import { createDateTimeCompareFunction } from "../utils.mjs";
|
2
|
+
/**
|
3
|
+
* Date sorting compare function factory. Method get as parameters `sortOrder` and `columnMeta` and return compare function.
|
4
|
+
*
|
5
|
+
* @param {string} sortOrder Sort order (`asc` for ascending, `desc` for descending).
|
6
|
+
* @param {object} columnMeta Column meta object.
|
7
|
+
* @param {object} columnPluginSettings Plugin settings for the column.
|
8
|
+
* @returns {Function} The compare function.
|
9
|
+
*/
|
10
|
+
export function compareFunctionFactory(sortOrder, columnMeta, columnPluginSettings) {
|
11
|
+
return createDateTimeCompareFunction(sortOrder, columnMeta.timeFormat, columnPluginSettings);
|
12
|
+
}
|
13
|
+
export const COLUMN_DATA_TYPE = 'time';
|
@@ -6,6 +6,7 @@ var _default = require("../sortFunction/default");
|
|
6
6
|
var _numeric = require("../sortFunction/numeric");
|
7
7
|
var _checkbox = require("../sortFunction/checkbox");
|
8
8
|
var _date = require("../sortFunction/date");
|
9
|
+
var _time = require("../sortFunction/time");
|
9
10
|
var _staticRegister = _interopRequireDefault(require("../../../utils/staticRegister"));
|
10
11
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
12
|
const {
|
@@ -32,7 +33,8 @@ function getCompareFunctionFactory(type) {
|
|
32
33
|
}
|
33
34
|
return getGloballyCompareFunctionFactory(_default.COLUMN_DATA_TYPE);
|
34
35
|
}
|
35
|
-
registerCompareFunctionFactory(_numeric.COLUMN_DATA_TYPE, _numeric.compareFunctionFactory);
|
36
36
|
registerCompareFunctionFactory(_checkbox.COLUMN_DATA_TYPE, _checkbox.compareFunctionFactory);
|
37
37
|
registerCompareFunctionFactory(_date.COLUMN_DATA_TYPE, _date.compareFunctionFactory);
|
38
|
-
registerCompareFunctionFactory(_default.COLUMN_DATA_TYPE, _default.compareFunctionFactory);
|
38
|
+
registerCompareFunctionFactory(_default.COLUMN_DATA_TYPE, _default.compareFunctionFactory);
|
39
|
+
registerCompareFunctionFactory(_numeric.COLUMN_DATA_TYPE, _numeric.compareFunctionFactory);
|
40
|
+
registerCompareFunctionFactory(_time.COLUMN_DATA_TYPE, _time.compareFunctionFactory);
|
@@ -2,6 +2,7 @@ import { compareFunctionFactory as defaultSort, COLUMN_DATA_TYPE as DEFAULT_DATA
|
|
2
2
|
import { compareFunctionFactory as numericSort, COLUMN_DATA_TYPE as NUMERIC_DATA_TYPE } from "../sortFunction/numeric.mjs";
|
3
3
|
import { compareFunctionFactory as checkboxSort, COLUMN_DATA_TYPE as CHECKBOX_DATA_TYPE } from "../sortFunction/checkbox.mjs";
|
4
4
|
import { compareFunctionFactory as dateSort, COLUMN_DATA_TYPE as DATE_DATA_TYPE } from "../sortFunction/date.mjs";
|
5
|
+
import { compareFunctionFactory as timeSort, COLUMN_DATA_TYPE as TIME_DATA_TYPE } from "../sortFunction/time.mjs";
|
5
6
|
import staticRegister from "../../../utils/staticRegister.mjs";
|
6
7
|
const {
|
7
8
|
register: registerCompareFunctionFactory,
|
@@ -25,8 +26,9 @@ export function getCompareFunctionFactory(type) {
|
|
25
26
|
}
|
26
27
|
return getGloballyCompareFunctionFactory(DEFAULT_DATA_TYPE);
|
27
28
|
}
|
28
|
-
registerCompareFunctionFactory(NUMERIC_DATA_TYPE, numericSort);
|
29
29
|
registerCompareFunctionFactory(CHECKBOX_DATA_TYPE, checkboxSort);
|
30
30
|
registerCompareFunctionFactory(DATE_DATA_TYPE, dateSort);
|
31
31
|
registerCompareFunctionFactory(DEFAULT_DATA_TYPE, defaultSort);
|
32
|
+
registerCompareFunctionFactory(NUMERIC_DATA_TYPE, numericSort);
|
33
|
+
registerCompareFunctionFactory(TIME_DATA_TYPE, timeSort);
|
32
34
|
export { registerRootComparator, getRootComparator };
|
@@ -2,12 +2,24 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
exports.areValidSortStates = areValidSortStates;
|
5
|
+
exports.createDateTimeCompareFunction = createDateTimeCompareFunction;
|
5
6
|
exports.getHeaderSpanElement = getHeaderSpanElement;
|
6
7
|
exports.getNextSortOrder = getNextSortOrder;
|
7
8
|
exports.isFirstLevelColumnHeader = isFirstLevelColumnHeader;
|
8
9
|
exports.wasHeaderClickedProperly = wasHeaderClickedProperly;
|
10
|
+
require("core-js/modules/esnext.set.difference.v2.js");
|
11
|
+
require("core-js/modules/esnext.set.intersection.v2.js");
|
12
|
+
require("core-js/modules/esnext.set.is-disjoint-from.v2.js");
|
13
|
+
require("core-js/modules/esnext.set.is-subset-of.v2.js");
|
14
|
+
require("core-js/modules/esnext.set.is-superset-of.v2.js");
|
15
|
+
require("core-js/modules/esnext.set.symmetric-difference.v2.js");
|
16
|
+
require("core-js/modules/esnext.set.union.v2.js");
|
17
|
+
var _moment = _interopRequireDefault(require("moment"));
|
9
18
|
var _object = require("../../helpers/object");
|
10
19
|
var _event = require("../../helpers/dom/event");
|
20
|
+
var _mixed = require("../../helpers/mixed");
|
21
|
+
var _sortService = require("./sortService");
|
22
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
11
23
|
const ASC_SORT_STATE = exports.ASC_SORT_STATE = 'asc';
|
12
24
|
const DESC_SORT_STATE = exports.DESC_SORT_STATE = 'desc';
|
13
25
|
const HEADER_SPAN_CLASS = exports.HEADER_SPAN_CLASS = 'colHeader';
|
@@ -106,4 +118,56 @@ function isFirstLevelColumnHeader(column, TH) {
|
|
106
118
|
*/
|
107
119
|
function wasHeaderClickedProperly(row, column, clickEvent) {
|
108
120
|
return row === -1 && column >= 0 && (0, _event.isRightClick)(clickEvent) === false;
|
121
|
+
}
|
122
|
+
|
123
|
+
/**
|
124
|
+
* Creates date or time sorting compare function.
|
125
|
+
*
|
126
|
+
* @param {string} sortOrder Sort order (`asc` for ascending, `desc` for descending).
|
127
|
+
* @param {string} format Date or time format.
|
128
|
+
* @param {object} columnPluginSettings Plugin settings for the column.
|
129
|
+
* @returns {Function} The compare function.
|
130
|
+
*/
|
131
|
+
function createDateTimeCompareFunction(sortOrder, format, columnPluginSettings) {
|
132
|
+
return function (value, nextValue) {
|
133
|
+
const {
|
134
|
+
sortEmptyCells
|
135
|
+
} = columnPluginSettings;
|
136
|
+
if (value === nextValue) {
|
137
|
+
return _sortService.DO_NOT_SWAP;
|
138
|
+
}
|
139
|
+
if ((0, _mixed.isEmpty)(value)) {
|
140
|
+
if ((0, _mixed.isEmpty)(nextValue)) {
|
141
|
+
return _sortService.DO_NOT_SWAP;
|
142
|
+
}
|
143
|
+
|
144
|
+
// Just fist value is empty and `sortEmptyCells` option was set
|
145
|
+
if (sortEmptyCells) {
|
146
|
+
return sortOrder === 'asc' ? _sortService.FIRST_BEFORE_SECOND : _sortService.FIRST_AFTER_SECOND;
|
147
|
+
}
|
148
|
+
return _sortService.FIRST_AFTER_SECOND;
|
149
|
+
}
|
150
|
+
if ((0, _mixed.isEmpty)(nextValue)) {
|
151
|
+
// Just second value is empty and `sortEmptyCells` option was set
|
152
|
+
if (sortEmptyCells) {
|
153
|
+
return sortOrder === 'asc' ? _sortService.FIRST_AFTER_SECOND : _sortService.FIRST_BEFORE_SECOND;
|
154
|
+
}
|
155
|
+
return _sortService.FIRST_BEFORE_SECOND;
|
156
|
+
}
|
157
|
+
const firstDate = (0, _moment.default)(value, format);
|
158
|
+
const nextDate = (0, _moment.default)(nextValue, format);
|
159
|
+
if (!firstDate.isValid()) {
|
160
|
+
return _sortService.FIRST_AFTER_SECOND;
|
161
|
+
}
|
162
|
+
if (!nextDate.isValid()) {
|
163
|
+
return _sortService.FIRST_BEFORE_SECOND;
|
164
|
+
}
|
165
|
+
if (nextDate.isAfter(firstDate)) {
|
166
|
+
return sortOrder === 'asc' ? _sortService.FIRST_BEFORE_SECOND : _sortService.FIRST_AFTER_SECOND;
|
167
|
+
}
|
168
|
+
if (nextDate.isBefore(firstDate)) {
|
169
|
+
return sortOrder === 'asc' ? _sortService.FIRST_AFTER_SECOND : _sortService.FIRST_BEFORE_SECOND;
|
170
|
+
}
|
171
|
+
return _sortService.DO_NOT_SWAP;
|
172
|
+
};
|
109
173
|
}
|
@@ -1,5 +1,15 @@
|
|
1
|
+
import "core-js/modules/esnext.set.difference.v2.js";
|
2
|
+
import "core-js/modules/esnext.set.intersection.v2.js";
|
3
|
+
import "core-js/modules/esnext.set.is-disjoint-from.v2.js";
|
4
|
+
import "core-js/modules/esnext.set.is-subset-of.v2.js";
|
5
|
+
import "core-js/modules/esnext.set.is-superset-of.v2.js";
|
6
|
+
import "core-js/modules/esnext.set.symmetric-difference.v2.js";
|
7
|
+
import "core-js/modules/esnext.set.union.v2.js";
|
8
|
+
import moment from 'moment';
|
1
9
|
import { isObject } from "../../helpers/object.mjs";
|
2
10
|
import { isRightClick } from "../../helpers/dom/event.mjs";
|
11
|
+
import { isEmpty } from "../../helpers/mixed.mjs";
|
12
|
+
import { DO_NOT_SWAP, FIRST_BEFORE_SECOND, FIRST_AFTER_SECOND } from "./sortService/index.mjs";
|
3
13
|
export const ASC_SORT_STATE = 'asc';
|
4
14
|
export const DESC_SORT_STATE = 'desc';
|
5
15
|
export const HEADER_SPAN_CLASS = 'colHeader';
|
@@ -98,4 +108,56 @@ export function isFirstLevelColumnHeader(column, TH) {
|
|
98
108
|
*/
|
99
109
|
export function wasHeaderClickedProperly(row, column, clickEvent) {
|
100
110
|
return row === -1 && column >= 0 && isRightClick(clickEvent) === false;
|
111
|
+
}
|
112
|
+
|
113
|
+
/**
|
114
|
+
* Creates date or time sorting compare function.
|
115
|
+
*
|
116
|
+
* @param {string} sortOrder Sort order (`asc` for ascending, `desc` for descending).
|
117
|
+
* @param {string} format Date or time format.
|
118
|
+
* @param {object} columnPluginSettings Plugin settings for the column.
|
119
|
+
* @returns {Function} The compare function.
|
120
|
+
*/
|
121
|
+
export function createDateTimeCompareFunction(sortOrder, format, columnPluginSettings) {
|
122
|
+
return function (value, nextValue) {
|
123
|
+
const {
|
124
|
+
sortEmptyCells
|
125
|
+
} = columnPluginSettings;
|
126
|
+
if (value === nextValue) {
|
127
|
+
return DO_NOT_SWAP;
|
128
|
+
}
|
129
|
+
if (isEmpty(value)) {
|
130
|
+
if (isEmpty(nextValue)) {
|
131
|
+
return DO_NOT_SWAP;
|
132
|
+
}
|
133
|
+
|
134
|
+
// Just fist value is empty and `sortEmptyCells` option was set
|
135
|
+
if (sortEmptyCells) {
|
136
|
+
return sortOrder === 'asc' ? FIRST_BEFORE_SECOND : FIRST_AFTER_SECOND;
|
137
|
+
}
|
138
|
+
return FIRST_AFTER_SECOND;
|
139
|
+
}
|
140
|
+
if (isEmpty(nextValue)) {
|
141
|
+
// Just second value is empty and `sortEmptyCells` option was set
|
142
|
+
if (sortEmptyCells) {
|
143
|
+
return sortOrder === 'asc' ? FIRST_AFTER_SECOND : FIRST_BEFORE_SECOND;
|
144
|
+
}
|
145
|
+
return FIRST_BEFORE_SECOND;
|
146
|
+
}
|
147
|
+
const firstDate = moment(value, format);
|
148
|
+
const nextDate = moment(nextValue, format);
|
149
|
+
if (!firstDate.isValid()) {
|
150
|
+
return FIRST_AFTER_SECOND;
|
151
|
+
}
|
152
|
+
if (!nextDate.isValid()) {
|
153
|
+
return FIRST_BEFORE_SECOND;
|
154
|
+
}
|
155
|
+
if (nextDate.isAfter(firstDate)) {
|
156
|
+
return sortOrder === 'asc' ? FIRST_BEFORE_SECOND : FIRST_AFTER_SECOND;
|
157
|
+
}
|
158
|
+
if (nextDate.isBefore(firstDate)) {
|
159
|
+
return sortOrder === 'asc' ? FIRST_AFTER_SECOND : FIRST_BEFORE_SECOND;
|
160
|
+
}
|
161
|
+
return DO_NOT_SWAP;
|
162
|
+
};
|
101
163
|
}
|
@@ -159,37 +159,43 @@ class ColumnSummary extends _base.BasePlugin {
|
|
159
159
|
}
|
160
160
|
return _assertClassBrand(_ColumnSummary_brand, _this, _onAfterChange).call(_this, ...args);
|
161
161
|
});
|
162
|
+
this.addHook('afterUpdateSettings', function () {
|
163
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
164
|
+
args[_key3] = arguments[_key3];
|
165
|
+
}
|
166
|
+
return _assertClassBrand(_ColumnSummary_brand, _this, _onAfterUpdateSettings).call(_this, ...args);
|
167
|
+
});
|
162
168
|
this.addHook('beforeCreateRow', (index, amount, source) => this.endpoints.resetSetupBeforeStructureAlteration('insert_row', index, amount, null, source)); // eslint-disable-line max-len
|
163
169
|
this.addHook('beforeCreateCol', (index, amount, source) => this.endpoints.resetSetupBeforeStructureAlteration('insert_col', index, amount, null, source)); // eslint-disable-line max-len
|
164
170
|
this.addHook('beforeRemoveRow', function () {
|
165
|
-
for (var
|
166
|
-
args[
|
171
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
172
|
+
args[_key4] = arguments[_key4];
|
167
173
|
}
|
168
174
|
return _this.endpoints.resetSetupBeforeStructureAlteration('remove_row', ...args);
|
169
175
|
});
|
170
176
|
this.addHook('beforeRemoveCol', function () {
|
171
|
-
for (var
|
172
|
-
args[
|
177
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
178
|
+
args[_key5] = arguments[_key5];
|
173
179
|
}
|
174
180
|
return _this.endpoints.resetSetupBeforeStructureAlteration('remove_col', ...args);
|
175
181
|
});
|
176
182
|
this.addHook('afterCreateRow', (index, amount, source) => this.endpoints.resetSetupAfterStructureAlteration('insert_row', index, amount, null, source)); // eslint-disable-line max-len
|
177
183
|
this.addHook('afterCreateCol', (index, amount, source) => this.endpoints.resetSetupAfterStructureAlteration('insert_col', index, amount, null, source)); // eslint-disable-line max-len
|
178
184
|
this.addHook('afterRemoveRow', function () {
|
179
|
-
for (var
|
180
|
-
args[
|
185
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
186
|
+
args[_key6] = arguments[_key6];
|
181
187
|
}
|
182
188
|
return _this.endpoints.resetSetupAfterStructureAlteration('remove_row', ...args);
|
183
189
|
});
|
184
190
|
this.addHook('afterRemoveCol', function () {
|
185
|
-
for (var
|
186
|
-
args[
|
191
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
192
|
+
args[_key7] = arguments[_key7];
|
187
193
|
}
|
188
194
|
return _this.endpoints.resetSetupAfterStructureAlteration('remove_col', ...args);
|
189
195
|
});
|
190
196
|
this.addHook('afterRowMove', function () {
|
191
|
-
for (var
|
192
|
-
args[
|
197
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
198
|
+
args[_key8] = arguments[_key8];
|
193
199
|
}
|
194
200
|
return _assertClassBrand(_ColumnSummary_brand, _this, _onAfterRowMove).call(_this, ...args);
|
195
201
|
});
|
@@ -454,6 +460,17 @@ exports.ColumnSummary = ColumnSummary;
|
|
454
460
|
function _onAfterInit() {
|
455
461
|
this.endpoints.initEndpoints();
|
456
462
|
}
|
463
|
+
/**
|
464
|
+
* Called after the settings were updated. There is a need to refresh cell metas after the settings update with
|
465
|
+
* the `columns` property as the Core resets the cell metas to their initial state.
|
466
|
+
*
|
467
|
+
* @param {object} settings The settings object.
|
468
|
+
*/
|
469
|
+
function _onAfterUpdateSettings(settings) {
|
470
|
+
if (settings.columns !== undefined) {
|
471
|
+
this.endpoints.refreshCellMetas();
|
472
|
+
}
|
473
|
+
}
|
457
474
|
/**
|
458
475
|
* `afterChange` hook callback.
|
459
476
|
*
|
@@ -155,37 +155,43 @@ export class ColumnSummary extends BasePlugin {
|
|
155
155
|
}
|
156
156
|
return _assertClassBrand(_ColumnSummary_brand, _this, _onAfterChange).call(_this, ...args);
|
157
157
|
});
|
158
|
+
this.addHook('afterUpdateSettings', function () {
|
159
|
+
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
|
160
|
+
args[_key3] = arguments[_key3];
|
161
|
+
}
|
162
|
+
return _assertClassBrand(_ColumnSummary_brand, _this, _onAfterUpdateSettings).call(_this, ...args);
|
163
|
+
});
|
158
164
|
this.addHook('beforeCreateRow', (index, amount, source) => this.endpoints.resetSetupBeforeStructureAlteration('insert_row', index, amount, null, source)); // eslint-disable-line max-len
|
159
165
|
this.addHook('beforeCreateCol', (index, amount, source) => this.endpoints.resetSetupBeforeStructureAlteration('insert_col', index, amount, null, source)); // eslint-disable-line max-len
|
160
166
|
this.addHook('beforeRemoveRow', function () {
|
161
|
-
for (var
|
162
|
-
args[
|
167
|
+
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
|
168
|
+
args[_key4] = arguments[_key4];
|
163
169
|
}
|
164
170
|
return _this.endpoints.resetSetupBeforeStructureAlteration('remove_row', ...args);
|
165
171
|
});
|
166
172
|
this.addHook('beforeRemoveCol', function () {
|
167
|
-
for (var
|
168
|
-
args[
|
173
|
+
for (var _len5 = arguments.length, args = new Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
|
174
|
+
args[_key5] = arguments[_key5];
|
169
175
|
}
|
170
176
|
return _this.endpoints.resetSetupBeforeStructureAlteration('remove_col', ...args);
|
171
177
|
});
|
172
178
|
this.addHook('afterCreateRow', (index, amount, source) => this.endpoints.resetSetupAfterStructureAlteration('insert_row', index, amount, null, source)); // eslint-disable-line max-len
|
173
179
|
this.addHook('afterCreateCol', (index, amount, source) => this.endpoints.resetSetupAfterStructureAlteration('insert_col', index, amount, null, source)); // eslint-disable-line max-len
|
174
180
|
this.addHook('afterRemoveRow', function () {
|
175
|
-
for (var
|
176
|
-
args[
|
181
|
+
for (var _len6 = arguments.length, args = new Array(_len6), _key6 = 0; _key6 < _len6; _key6++) {
|
182
|
+
args[_key6] = arguments[_key6];
|
177
183
|
}
|
178
184
|
return _this.endpoints.resetSetupAfterStructureAlteration('remove_row', ...args);
|
179
185
|
});
|
180
186
|
this.addHook('afterRemoveCol', function () {
|
181
|
-
for (var
|
182
|
-
args[
|
187
|
+
for (var _len7 = arguments.length, args = new Array(_len7), _key7 = 0; _key7 < _len7; _key7++) {
|
188
|
+
args[_key7] = arguments[_key7];
|
183
189
|
}
|
184
190
|
return _this.endpoints.resetSetupAfterStructureAlteration('remove_col', ...args);
|
185
191
|
});
|
186
192
|
this.addHook('afterRowMove', function () {
|
187
|
-
for (var
|
188
|
-
args[
|
193
|
+
for (var _len8 = arguments.length, args = new Array(_len8), _key8 = 0; _key8 < _len8; _key8++) {
|
194
|
+
args[_key8] = arguments[_key8];
|
189
195
|
}
|
190
196
|
return _assertClassBrand(_ColumnSummary_brand, _this, _onAfterRowMove).call(_this, ...args);
|
191
197
|
});
|
@@ -449,6 +455,17 @@ export class ColumnSummary extends BasePlugin {
|
|
449
455
|
function _onAfterInit() {
|
450
456
|
this.endpoints.initEndpoints();
|
451
457
|
}
|
458
|
+
/**
|
459
|
+
* Called after the settings were updated. There is a need to refresh cell metas after the settings update with
|
460
|
+
* the `columns` property as the Core resets the cell metas to their initial state.
|
461
|
+
*
|
462
|
+
* @param {object} settings The settings object.
|
463
|
+
*/
|
464
|
+
function _onAfterUpdateSettings(settings) {
|
465
|
+
if (settings.columns !== undefined) {
|
466
|
+
this.endpoints.refreshCellMetas();
|
467
|
+
}
|
468
|
+
}
|
452
469
|
/**
|
453
470
|
* `afterChange` hook callback.
|
454
471
|
*
|
@@ -440,6 +440,21 @@ class Endpoints {
|
|
440
440
|
this.cellsToSetCache = [];
|
441
441
|
}
|
442
442
|
|
443
|
+
/**
|
444
|
+
* Refreshes the cell meta information for the all endpoints after the `updateSettings` method call which in some
|
445
|
+
* cases (call with `columns` option) can reset the cell metas to the initial state.
|
446
|
+
*/
|
447
|
+
refreshCellMetas() {
|
448
|
+
this.endpoints.forEach(endpoint => {
|
449
|
+
const destinationVisualRow = this.hot.toVisualRow(endpoint.destinationRow);
|
450
|
+
if (destinationVisualRow !== null) {
|
451
|
+
const cellMeta = this.hot.getCellMeta(destinationVisualRow, endpoint.destinationColumn);
|
452
|
+
cellMeta.readOnly = endpoint.readOnly;
|
453
|
+
cellMeta.className = 'columnSummaryResult';
|
454
|
+
}
|
455
|
+
});
|
456
|
+
}
|
457
|
+
|
443
458
|
/**
|
444
459
|
* Calculate and refresh a single endpoint.
|
445
460
|
*
|
@@ -437,6 +437,21 @@ class Endpoints {
|
|
437
437
|
this.cellsToSetCache = [];
|
438
438
|
}
|
439
439
|
|
440
|
+
/**
|
441
|
+
* Refreshes the cell meta information for the all endpoints after the `updateSettings` method call which in some
|
442
|
+
* cases (call with `columns` option) can reset the cell metas to the initial state.
|
443
|
+
*/
|
444
|
+
refreshCellMetas() {
|
445
|
+
this.endpoints.forEach(endpoint => {
|
446
|
+
const destinationVisualRow = this.hot.toVisualRow(endpoint.destinationRow);
|
447
|
+
if (destinationVisualRow !== null) {
|
448
|
+
const cellMeta = this.hot.getCellMeta(destinationVisualRow, endpoint.destinationColumn);
|
449
|
+
cellMeta.readOnly = endpoint.readOnly;
|
450
|
+
cellMeta.className = 'columnSummaryResult';
|
451
|
+
}
|
452
|
+
});
|
453
|
+
}
|
454
|
+
|
440
455
|
/**
|
441
456
|
* Calculate and refresh a single endpoint.
|
442
457
|
*
|
@@ -294,10 +294,7 @@ class Comments extends _base.BasePlugin {
|
|
294
294
|
this.hide();
|
295
295
|
manager.setActiveContextName('grid');
|
296
296
|
},
|
297
|
-
runOnlyIf: () =>
|
298
|
-
var _this$hot$getSelected2;
|
299
|
-
return ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight.isCell()) && _classPrivateFieldGet(_editor, this).isVisible();
|
300
|
-
},
|
297
|
+
runOnlyIf: () => _classPrivateFieldGet(_editor, this).isVisible() && _classPrivateFieldGet(_editor, this).isFocused(),
|
301
298
|
group: SHORTCUTS_GROUP
|
302
299
|
});
|
303
300
|
pluginContext.addShortcut({
|
@@ -306,10 +303,7 @@ class Comments extends _base.BasePlugin {
|
|
306
303
|
this.hide();
|
307
304
|
manager.setActiveContextName('grid');
|
308
305
|
},
|
309
|
-
runOnlyIf: () =>
|
310
|
-
var _this$hot$getSelected3;
|
311
|
-
return ((_this$hot$getSelected3 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected3 === void 0 ? void 0 : _this$hot$getSelected3.highlight.isCell()) && _classPrivateFieldGet(_editor, this).isVisible();
|
312
|
-
},
|
306
|
+
runOnlyIf: () => _classPrivateFieldGet(_editor, this).isVisible() && _classPrivateFieldGet(_editor, this).isFocused(),
|
313
307
|
group: SHORTCUTS_GROUP
|
314
308
|
});
|
315
309
|
}
|
@@ -290,10 +290,7 @@ export class Comments extends BasePlugin {
|
|
290
290
|
this.hide();
|
291
291
|
manager.setActiveContextName('grid');
|
292
292
|
},
|
293
|
-
runOnlyIf: () =>
|
294
|
-
var _this$hot$getSelected2;
|
295
|
-
return ((_this$hot$getSelected2 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected2 === void 0 ? void 0 : _this$hot$getSelected2.highlight.isCell()) && _classPrivateFieldGet(_editor, this).isVisible();
|
296
|
-
},
|
293
|
+
runOnlyIf: () => _classPrivateFieldGet(_editor, this).isVisible() && _classPrivateFieldGet(_editor, this).isFocused(),
|
297
294
|
group: SHORTCUTS_GROUP
|
298
295
|
});
|
299
296
|
pluginContext.addShortcut({
|
@@ -302,10 +299,7 @@ export class Comments extends BasePlugin {
|
|
302
299
|
this.hide();
|
303
300
|
manager.setActiveContextName('grid');
|
304
301
|
},
|
305
|
-
runOnlyIf: () =>
|
306
|
-
var _this$hot$getSelected3;
|
307
|
-
return ((_this$hot$getSelected3 = this.hot.getSelectedRangeLast()) === null || _this$hot$getSelected3 === void 0 ? void 0 : _this$hot$getSelected3.highlight.isCell()) && _classPrivateFieldGet(_editor, this).isVisible();
|
308
|
-
},
|
302
|
+
runOnlyIf: () => _classPrivateFieldGet(_editor, this).isVisible() && _classPrivateFieldGet(_editor, this).isFocused(),
|
309
303
|
group: SHORTCUTS_GROUP
|
310
304
|
});
|
311
305
|
}
|