handsontable 0.0.0-next-74a68c1-20230627 → 0.0.0-next-208afb8-20230627
Sign up to get free protection for your applications and to get access to all the features.
Potentially problematic release.
This version of handsontable might be problematic. Click here for more details.
- package/CHANGELOG.md +0 -31
- package/base.js +2 -2
- package/base.mjs +2 -2
- package/core.d.ts +1 -0
- package/core.js +31 -2
- package/core.mjs +31 -2
- package/dataMap/metaManager/metaSchema.js +1 -1
- package/dataMap/metaManager/metaSchema.mjs +1 -1
- package/dist/handsontable.css +2 -2
- package/dist/handsontable.full.css +2 -2
- package/dist/handsontable.full.js +3553 -3366
- package/dist/handsontable.full.min.css +2 -2
- package/dist/handsontable.full.min.js +53 -53
- package/dist/handsontable.js +7968 -7781
- package/dist/handsontable.min.css +2 -2
- package/dist/handsontable.min.js +4 -4
- package/editorManager.js +4 -10
- package/editorManager.mjs +4 -10
- package/helpers/mixed.js +2 -2
- package/helpers/mixed.mjs +2 -2
- package/package.json +1 -1
- package/pluginHooks.d.ts +1 -0
- package/pluginHooks.js +11 -4
- package/pluginHooks.mjs +11 -4
- package/plugins/comments/commentEditor.js +1 -0
- package/plugins/comments/commentEditor.mjs +1 -0
- package/plugins/comments/comments.js +289 -231
- package/plugins/comments/comments.mjs +297 -241
- package/plugins/comments/contextMenuItem/addEditComment.js +51 -0
- package/plugins/comments/contextMenuItem/addEditComment.mjs +35 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.js +63 -0
- package/plugins/comments/contextMenuItem/readOnlyComment.mjs +55 -0
- package/plugins/comments/contextMenuItem/removeComment.js +48 -0
- package/plugins/comments/contextMenuItem/removeComment.mjs +32 -0
- package/plugins/contextMenu/contextMenu.js +1 -0
- package/plugins/contextMenu/contextMenu.mjs +1 -0
- package/plugins/copyPaste/copyPaste.js +1 -1
- package/plugins/copyPaste/copyPaste.mjs +1 -1
- package/plugins/filters/filters.js +42 -62
- package/plugins/filters/filters.mjs +41 -61
- package/shortcutContexts/commands/index.js +1 -2
- package/shortcutContexts/commands/index.mjs +1 -2
- package/shortcutContexts/grid.js +0 -5
- package/shortcutContexts/grid.mjs +0 -5
- package/tableView.js +9 -4
- package/tableView.mjs +9 -4
- package/translations/indexMapper.d.ts +2 -0
- package/shortcutContexts/commands/scrollToFocusedCell.js +0 -38
- package/shortcutContexts/commands/scrollToFocusedCell.mjs +0 -33
@@ -0,0 +1,51 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
require("core-js/modules/es.array.iterator.js");
|
5
|
+
require("core-js/modules/es.object.to-string.js");
|
6
|
+
require("core-js/modules/es.string.iterator.js");
|
7
|
+
require("core-js/modules/es.weak-map.js");
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
9
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
10
|
+
require("core-js/modules/es.symbol.js");
|
11
|
+
require("core-js/modules/es.symbol.description.js");
|
12
|
+
require("core-js/modules/es.symbol.iterator.js");
|
13
|
+
exports.__esModule = true;
|
14
|
+
exports.default = addEditCommentItem;
|
15
|
+
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
18
|
+
/**
|
19
|
+
* @param {Comments} plugin The Comments plugin instance.
|
20
|
+
* @returns {object}
|
21
|
+
*/
|
22
|
+
function addEditCommentItem(plugin) {
|
23
|
+
return {
|
24
|
+
key: 'commentsAddEdit',
|
25
|
+
name: function name() {
|
26
|
+
var _this$getSelectedRang;
|
27
|
+
var highlight = (_this$getSelectedRang = this.getSelectedRangeLast()) === null || _this$getSelectedRang === void 0 ? void 0 : _this$getSelectedRang.highlight;
|
28
|
+
if (highlight && highlight.isCell() && plugin.getCommentAtCell(highlight.row, highlight.col)) {
|
29
|
+
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_EDIT_COMMENT);
|
30
|
+
}
|
31
|
+
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ADD_COMMENT);
|
32
|
+
},
|
33
|
+
callback: function callback() {
|
34
|
+
var range = this.getSelectedRangeLast();
|
35
|
+
this.deselectCell();
|
36
|
+
plugin.setRange(range);
|
37
|
+
plugin.show();
|
38
|
+
plugin.focusEditor();
|
39
|
+
},
|
40
|
+
disabled: function disabled() {
|
41
|
+
var range = this.getSelectedRangeLast();
|
42
|
+
if (!range) {
|
43
|
+
return true;
|
44
|
+
}
|
45
|
+
if (range.highlight.isHeader()) {
|
46
|
+
return true;
|
47
|
+
}
|
48
|
+
return this.countRenderedRows() === 0 || this.countRenderedCols() === 0;
|
49
|
+
}
|
50
|
+
};
|
51
|
+
}
|
@@ -0,0 +1,35 @@
|
|
1
|
+
import * as C from "../../../i18n/constants.mjs";
|
2
|
+
/**
|
3
|
+
* @param {Comments} plugin The Comments plugin instance.
|
4
|
+
* @returns {object}
|
5
|
+
*/
|
6
|
+
export default function addEditCommentItem(plugin) {
|
7
|
+
return {
|
8
|
+
key: 'commentsAddEdit',
|
9
|
+
name: function name() {
|
10
|
+
var _this$getSelectedRang;
|
11
|
+
var highlight = (_this$getSelectedRang = this.getSelectedRangeLast()) === null || _this$getSelectedRang === void 0 ? void 0 : _this$getSelectedRang.highlight;
|
12
|
+
if (highlight && highlight.isCell() && plugin.getCommentAtCell(highlight.row, highlight.col)) {
|
13
|
+
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_EDIT_COMMENT);
|
14
|
+
}
|
15
|
+
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_ADD_COMMENT);
|
16
|
+
},
|
17
|
+
callback: function callback() {
|
18
|
+
var range = this.getSelectedRangeLast();
|
19
|
+
this.deselectCell();
|
20
|
+
plugin.setRange(range);
|
21
|
+
plugin.show();
|
22
|
+
plugin.focusEditor();
|
23
|
+
},
|
24
|
+
disabled: function disabled() {
|
25
|
+
var range = this.getSelectedRangeLast();
|
26
|
+
if (!range) {
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
if (range.highlight.isHeader()) {
|
30
|
+
return true;
|
31
|
+
}
|
32
|
+
return this.countRenderedRows() === 0 || this.countRenderedCols() === 0;
|
33
|
+
}
|
34
|
+
};
|
35
|
+
}
|
@@ -0,0 +1,63 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
require("core-js/modules/es.symbol.iterator.js");
|
4
|
+
require("core-js/modules/es.array.iterator.js");
|
5
|
+
require("core-js/modules/es.string.iterator.js");
|
6
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
7
|
+
require("core-js/modules/es.weak-map.js");
|
8
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
9
|
+
exports.__esModule = true;
|
10
|
+
exports.default = readOnlyCommentItem;
|
11
|
+
require("core-js/modules/es.symbol.to-primitive.js");
|
12
|
+
require("core-js/modules/es.date.to-primitive.js");
|
13
|
+
require("core-js/modules/es.symbol.js");
|
14
|
+
require("core-js/modules/es.symbol.description.js");
|
15
|
+
require("core-js/modules/es.object.to-string.js");
|
16
|
+
require("core-js/modules/es.number.constructor.js");
|
17
|
+
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
18
|
+
var _utils = require("../../contextMenu/utils");
|
19
|
+
var _comments = require("../comments");
|
20
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
21
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
22
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
23
|
+
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; }
|
24
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
25
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
26
|
+
/**
|
27
|
+
* @param {Comments} plugin The Comments plugin instance.
|
28
|
+
* @returns {object}
|
29
|
+
*/
|
30
|
+
function readOnlyCommentItem(plugin) {
|
31
|
+
return {
|
32
|
+
key: 'commentsReadOnly',
|
33
|
+
name: function name() {
|
34
|
+
var label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT);
|
35
|
+
var areReadOnly = (0, _utils.checkSelectionConsistency)(this.getSelectedRange(), function (row, col) {
|
36
|
+
return plugin.getCommentMeta(row, col, _comments.META_READONLY);
|
37
|
+
});
|
38
|
+
return areReadOnly ? (0, _utils.markLabelAsSelected)(label) : label;
|
39
|
+
},
|
40
|
+
callback: function callback() {
|
41
|
+
var range = this.getSelectedRangeLast();
|
42
|
+
range.forAll(function (row, column) {
|
43
|
+
if (row >= 0 && column >= 0) {
|
44
|
+
var currentState = !!plugin.getCommentMeta(row, column, _comments.META_READONLY);
|
45
|
+
plugin.updateCommentMeta(row, column, _defineProperty({}, _comments.META_READONLY, !currentState));
|
46
|
+
}
|
47
|
+
});
|
48
|
+
},
|
49
|
+
disabled: function disabled() {
|
50
|
+
var range = this.getSelectedRangeLast();
|
51
|
+
if (!range) {
|
52
|
+
return true;
|
53
|
+
}
|
54
|
+
if (range.highlight.isHeader()) {
|
55
|
+
return true;
|
56
|
+
}
|
57
|
+
if (!plugin.getCommentAtCell(range.highlight.row, range.highlight.col)) {
|
58
|
+
return true;
|
59
|
+
}
|
60
|
+
return this.countRenderedRows() === 0 || this.countRenderedCols() === 0;
|
61
|
+
}
|
62
|
+
};
|
63
|
+
}
|
@@ -0,0 +1,55 @@
|
|
1
|
+
import "core-js/modules/es.symbol.to-primitive.js";
|
2
|
+
import "core-js/modules/es.date.to-primitive.js";
|
3
|
+
import "core-js/modules/es.symbol.js";
|
4
|
+
import "core-js/modules/es.symbol.description.js";
|
5
|
+
import "core-js/modules/es.object.to-string.js";
|
6
|
+
import "core-js/modules/es.number.constructor.js";
|
7
|
+
import "core-js/modules/es.symbol.iterator.js";
|
8
|
+
import "core-js/modules/es.array.iterator.js";
|
9
|
+
import "core-js/modules/es.string.iterator.js";
|
10
|
+
import "core-js/modules/web.dom-collections.iterator.js";
|
11
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
12
|
+
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; }
|
13
|
+
function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return _typeof(key) === "symbol" ? key : String(key); }
|
14
|
+
function _toPrimitive(input, hint) { if (_typeof(input) !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (_typeof(res) !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
|
15
|
+
import * as C from "../../../i18n/constants.mjs";
|
16
|
+
import { checkSelectionConsistency, markLabelAsSelected } from "../../contextMenu/utils.mjs";
|
17
|
+
import { META_READONLY } from "../comments.mjs";
|
18
|
+
/**
|
19
|
+
* @param {Comments} plugin The Comments plugin instance.
|
20
|
+
* @returns {object}
|
21
|
+
*/
|
22
|
+
export default function readOnlyCommentItem(plugin) {
|
23
|
+
return {
|
24
|
+
key: 'commentsReadOnly',
|
25
|
+
name: function name() {
|
26
|
+
var label = this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_READ_ONLY_COMMENT);
|
27
|
+
var areReadOnly = checkSelectionConsistency(this.getSelectedRange(), function (row, col) {
|
28
|
+
return plugin.getCommentMeta(row, col, META_READONLY);
|
29
|
+
});
|
30
|
+
return areReadOnly ? markLabelAsSelected(label) : label;
|
31
|
+
},
|
32
|
+
callback: function callback() {
|
33
|
+
var range = this.getSelectedRangeLast();
|
34
|
+
range.forAll(function (row, column) {
|
35
|
+
if (row >= 0 && column >= 0) {
|
36
|
+
var currentState = !!plugin.getCommentMeta(row, column, META_READONLY);
|
37
|
+
plugin.updateCommentMeta(row, column, _defineProperty({}, META_READONLY, !currentState));
|
38
|
+
}
|
39
|
+
});
|
40
|
+
},
|
41
|
+
disabled: function disabled() {
|
42
|
+
var range = this.getSelectedRangeLast();
|
43
|
+
if (!range) {
|
44
|
+
return true;
|
45
|
+
}
|
46
|
+
if (range.highlight.isHeader()) {
|
47
|
+
return true;
|
48
|
+
}
|
49
|
+
if (!plugin.getCommentAtCell(range.highlight.row, range.highlight.col)) {
|
50
|
+
return true;
|
51
|
+
}
|
52
|
+
return this.countRenderedRows() === 0 || this.countRenderedCols() === 0;
|
53
|
+
}
|
54
|
+
};
|
55
|
+
}
|
@@ -0,0 +1,48 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
|
4
|
+
require("core-js/modules/es.array.iterator.js");
|
5
|
+
require("core-js/modules/es.object.to-string.js");
|
6
|
+
require("core-js/modules/es.string.iterator.js");
|
7
|
+
require("core-js/modules/es.weak-map.js");
|
8
|
+
require("core-js/modules/web.dom-collections.iterator.js");
|
9
|
+
require("core-js/modules/es.object.get-own-property-descriptor.js");
|
10
|
+
require("core-js/modules/es.symbol.js");
|
11
|
+
require("core-js/modules/es.symbol.description.js");
|
12
|
+
require("core-js/modules/es.symbol.iterator.js");
|
13
|
+
exports.__esModule = true;
|
14
|
+
exports.default = removeCommentItem;
|
15
|
+
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
16
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
17
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
18
|
+
/**
|
19
|
+
* @param {Comments} plugin The Comments plugin instance.
|
20
|
+
* @returns {object}
|
21
|
+
*/
|
22
|
+
function removeCommentItem(plugin) {
|
23
|
+
return {
|
24
|
+
key: 'commentsRemove',
|
25
|
+
name: function name() {
|
26
|
+
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_REMOVE_COMMENT);
|
27
|
+
},
|
28
|
+
callback: function callback() {
|
29
|
+
var range = this.getSelectedRangeLast();
|
30
|
+
range.forAll(function (row, column) {
|
31
|
+
if (row >= 0 && column >= 0) {
|
32
|
+
plugin.removeCommentAtCell(row, column, false);
|
33
|
+
}
|
34
|
+
});
|
35
|
+
this.render();
|
36
|
+
},
|
37
|
+
disabled: function disabled() {
|
38
|
+
var range = this.getSelectedRangeLast();
|
39
|
+
if (!range) {
|
40
|
+
return true;
|
41
|
+
}
|
42
|
+
if (range.highlight.isHeader()) {
|
43
|
+
return true;
|
44
|
+
}
|
45
|
+
return this.countRenderedRows() === 0 || this.countRenderedCols() === 0;
|
46
|
+
}
|
47
|
+
};
|
48
|
+
}
|
@@ -0,0 +1,32 @@
|
|
1
|
+
import * as C from "../../../i18n/constants.mjs";
|
2
|
+
/**
|
3
|
+
* @param {Comments} plugin The Comments plugin instance.
|
4
|
+
* @returns {object}
|
5
|
+
*/
|
6
|
+
export default function removeCommentItem(plugin) {
|
7
|
+
return {
|
8
|
+
key: 'commentsRemove',
|
9
|
+
name: function name() {
|
10
|
+
return this.getTranslatedPhrase(C.CONTEXTMENU_ITEMS_REMOVE_COMMENT);
|
11
|
+
},
|
12
|
+
callback: function callback() {
|
13
|
+
var range = this.getSelectedRangeLast();
|
14
|
+
range.forAll(function (row, column) {
|
15
|
+
if (row >= 0 && column >= 0) {
|
16
|
+
plugin.removeCommentAtCell(row, column, false);
|
17
|
+
}
|
18
|
+
});
|
19
|
+
this.render();
|
20
|
+
},
|
21
|
+
disabled: function disabled() {
|
22
|
+
var range = this.getSelectedRangeLast();
|
23
|
+
if (!range) {
|
24
|
+
return true;
|
25
|
+
}
|
26
|
+
if (range.highlight.isHeader()) {
|
27
|
+
return true;
|
28
|
+
}
|
29
|
+
return this.countRenderedRows() === 0 || this.countRenderedCols() === 0;
|
30
|
+
}
|
31
|
+
};
|
32
|
+
}
|
@@ -218,6 +218,7 @@ var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
218
218
|
callback: function callback() {
|
219
219
|
var _this3$hot$getSelecte = _this3.hot.getSelectedRangeLast(),
|
220
220
|
highlight = _this3$hot$getSelecte.highlight;
|
221
|
+
_this3.hot.scrollToFocusedCell();
|
221
222
|
var rect = _this3.hot.getCell(highlight.row, highlight.col, true).getBoundingClientRect();
|
222
223
|
var offset = (0, _utils.getDocumentOffsetByElement)(_this3.menu.container, _this3.hot.rootDocument);
|
223
224
|
_this3.open({
|
@@ -211,6 +211,7 @@ export var ContextMenu = /*#__PURE__*/function (_BasePlugin) {
|
|
211
211
|
callback: function callback() {
|
212
212
|
var _this3$hot$getSelecte = _this3.hot.getSelectedRangeLast(),
|
213
213
|
highlight = _this3$hot$getSelecte.highlight;
|
214
|
+
_this3.hot.scrollToFocusedCell();
|
214
215
|
var rect = _this3.hot.getCell(highlight.row, highlight.col, true).getBoundingClientRect();
|
215
216
|
var offset = getDocumentOffsetByElement(_this3.menu.container, _this3.hot.rootDocument);
|
216
217
|
_this3.open({
|
@@ -735,7 +735,7 @@ var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
735
735
|
}, {
|
736
736
|
key: "onPaste",
|
737
737
|
value: function onPaste(event) {
|
738
|
-
if (!this.hot.isListening() || this.isEditorOpened()) {
|
738
|
+
if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
|
739
739
|
return;
|
740
740
|
}
|
741
741
|
if (event && event.preventDefault) {
|
@@ -728,7 +728,7 @@ export var CopyPaste = /*#__PURE__*/function (_BasePlugin) {
|
|
728
728
|
}, {
|
729
729
|
key: "onPaste",
|
730
730
|
value: function onPaste(event) {
|
731
|
-
if (!this.hot.isListening() || this.isEditorOpened()) {
|
731
|
+
if (!this.hot.isListening() || this.isEditorOpened() || !this.hot.getSelected()) {
|
732
732
|
return;
|
733
733
|
}
|
734
734
|
if (event && event.preventDefault) {
|
@@ -76,8 +76,6 @@ function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.g
|
|
76
76
|
var PLUGIN_KEY = 'filters';
|
77
77
|
exports.PLUGIN_KEY = PLUGIN_KEY;
|
78
78
|
var PLUGIN_PRIORITY = 250;
|
79
|
-
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
80
|
-
var SHORTCUTS_GROUP = PLUGIN_KEY;
|
81
79
|
|
82
80
|
/**
|
83
81
|
* @plugin Filters
|
@@ -114,6 +112,7 @@ var SHORTCUTS_GROUP = PLUGIN_KEY;
|
|
114
112
|
* ```
|
115
113
|
* :::
|
116
114
|
*/
|
115
|
+
exports.PLUGIN_PRIORITY = PLUGIN_PRIORITY;
|
117
116
|
var Filters = /*#__PURE__*/function (_BasePlugin) {
|
118
117
|
_inherits(Filters, _BasePlugin);
|
119
118
|
var _super = _createSuper(Filters);
|
@@ -293,7 +292,6 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
293
292
|
this.dropdownMenuPlugin.disablePlugin();
|
294
293
|
this.dropdownMenuPlugin.enablePlugin();
|
295
294
|
}
|
296
|
-
this.registerShortcuts();
|
297
295
|
_get(_getPrototypeOf(Filters.prototype), "enablePlugin", this).call(this);
|
298
296
|
}
|
299
297
|
|
@@ -317,41 +315,9 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
317
315
|
this.conditionCollection = null;
|
318
316
|
this.hot.rowIndexMapper.unregisterMap(this.pluginName);
|
319
317
|
}
|
320
|
-
this.unregisterShortcuts();
|
321
318
|
_get(_getPrototypeOf(Filters.prototype), "disablePlugin", this).call(this);
|
322
319
|
}
|
323
320
|
|
324
|
-
/**
|
325
|
-
* Register shortcuts responsible for clearing the filters.
|
326
|
-
*
|
327
|
-
* @private
|
328
|
-
*/
|
329
|
-
}, {
|
330
|
-
key: "registerShortcuts",
|
331
|
-
value: function registerShortcuts() {
|
332
|
-
var _this4 = this;
|
333
|
-
this.hot.getShortcutManager().getContext('grid').addShortcut({
|
334
|
-
keys: [['Alt', 'A']],
|
335
|
-
stopPropagation: true,
|
336
|
-
callback: function callback() {
|
337
|
-
_this4.clearConditions();
|
338
|
-
_this4.filter();
|
339
|
-
},
|
340
|
-
group: SHORTCUTS_GROUP
|
341
|
-
});
|
342
|
-
}
|
343
|
-
|
344
|
-
/**
|
345
|
-
* Unregister shortcuts responsible for clearing the filters.
|
346
|
-
*
|
347
|
-
* @private
|
348
|
-
*/
|
349
|
-
}, {
|
350
|
-
key: "unregisterShortcuts",
|
351
|
-
value: function unregisterShortcuts() {
|
352
|
-
this.hot.getShortcutManager().getContext('grid').removeShortcutsByGroup(SHORTCUTS_GROUP);
|
353
|
-
}
|
354
|
-
|
355
321
|
/* eslint-disable jsdoc/require-description-complete-sentence */
|
356
322
|
/**
|
357
323
|
* @memberof Filters#
|
@@ -518,7 +484,7 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
518
484
|
}, {
|
519
485
|
key: "filter",
|
520
486
|
value: function filter() {
|
521
|
-
var
|
487
|
+
var _this4 = this;
|
522
488
|
var dataFilter = this._createDataFilter();
|
523
489
|
var needToFilter = !this.conditionCollection.isEmpty();
|
524
490
|
var visibleVisualRows = [];
|
@@ -528,18 +494,18 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
528
494
|
if (needToFilter) {
|
529
495
|
var trimmedRows = [];
|
530
496
|
this.hot.batchExecution(function () {
|
531
|
-
|
497
|
+
_this4.filtersRowsMap.clear();
|
532
498
|
visibleVisualRows = (0, _array.arrayMap)(dataFilter.filter(), function (rowData) {
|
533
499
|
return rowData.meta.visualRow;
|
534
500
|
});
|
535
501
|
var visibleVisualRowsAssertion = (0, _utils.createArrayAssertion)(visibleVisualRows);
|
536
|
-
(0, _number.rangeEach)(
|
502
|
+
(0, _number.rangeEach)(_this4.hot.countSourceRows() - 1, function (row) {
|
537
503
|
if (!visibleVisualRowsAssertion(row)) {
|
538
504
|
trimmedRows.push(row);
|
539
505
|
}
|
540
506
|
});
|
541
507
|
(0, _array.arrayEach)(trimmedRows, function (physicalRow) {
|
542
|
-
|
508
|
+
_this4.filtersRowsMap.setValueAtIndex(physicalRow, true);
|
543
509
|
});
|
544
510
|
}, true);
|
545
511
|
if (!visibleVisualRows.length) {
|
@@ -552,6 +518,7 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
552
518
|
this.hot.runHooks('afterFilter', conditions);
|
553
519
|
this.hot.view.adjustElementsSize(true);
|
554
520
|
this.hot.render();
|
521
|
+
this.clearColumnSelection();
|
555
522
|
}
|
556
523
|
|
557
524
|
/**
|
@@ -575,6 +542,20 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
575
542
|
};
|
576
543
|
}
|
577
544
|
|
545
|
+
/**
|
546
|
+
* Clears column selection.
|
547
|
+
*
|
548
|
+
* @private
|
549
|
+
*/
|
550
|
+
}, {
|
551
|
+
key: "clearColumnSelection",
|
552
|
+
value: function clearColumnSelection() {
|
553
|
+
var selectedColumn = this.getSelectedColumn();
|
554
|
+
if (selectedColumn !== null) {
|
555
|
+
this.hot.selectCell(0, selectedColumn.visualIndex);
|
556
|
+
}
|
557
|
+
}
|
558
|
+
|
578
559
|
/**
|
579
560
|
* Returns handsontable source data with cell meta based on current selection.
|
580
561
|
*
|
@@ -584,21 +565,21 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
584
565
|
}, {
|
585
566
|
key: "getDataMapAtColumn",
|
586
567
|
value: function getDataMapAtColumn(column) {
|
587
|
-
var
|
568
|
+
var _this5 = this;
|
588
569
|
var visualColumn = this.hot.toVisualColumn(column);
|
589
570
|
var data = [];
|
590
571
|
(0, _array.arrayEach)(this.hot.getSourceDataAtCol(visualColumn), function (value, rowIndex) {
|
591
|
-
var
|
592
|
-
var
|
593
|
-
row =
|
594
|
-
col =
|
595
|
-
visualCol =
|
596
|
-
visualRow =
|
597
|
-
type =
|
598
|
-
instance =
|
599
|
-
dateFormat =
|
600
|
-
locale =
|
601
|
-
var dataValue = (
|
572
|
+
var _this5$hot$getDataAtC;
|
573
|
+
var _this5$hot$getCellMet = _this5.hot.getCellMeta(rowIndex, visualColumn),
|
574
|
+
row = _this5$hot$getCellMet.row,
|
575
|
+
col = _this5$hot$getCellMet.col,
|
576
|
+
visualCol = _this5$hot$getCellMet.visualCol,
|
577
|
+
visualRow = _this5$hot$getCellMet.visualRow,
|
578
|
+
type = _this5$hot$getCellMet.type,
|
579
|
+
instance = _this5$hot$getCellMet.instance,
|
580
|
+
dateFormat = _this5$hot$getCellMet.dateFormat,
|
581
|
+
locale = _this5$hot$getCellMet.locale;
|
582
|
+
var dataValue = (_this5$hot$getDataAtC = _this5.hot.getDataAtCell(_this5.hot.toVisualRow(rowIndex), visualColumn)) !== null && _this5$hot$getDataAtC !== void 0 ? _this5$hot$getDataAtC : value;
|
602
583
|
data.push({
|
603
584
|
meta: {
|
604
585
|
row: row,
|
@@ -625,14 +606,14 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
625
606
|
}, {
|
626
607
|
key: "onAfterChange",
|
627
608
|
value: function onAfterChange(changes) {
|
628
|
-
var
|
609
|
+
var _this6 = this;
|
629
610
|
if (changes) {
|
630
611
|
(0, _array.arrayEach)(changes, function (change) {
|
631
612
|
var _change = _slicedToArray(change, 2),
|
632
613
|
prop = _change[1];
|
633
|
-
var columnIndex =
|
634
|
-
if (
|
635
|
-
|
614
|
+
var columnIndex = _this6.hot.propToCol(prop);
|
615
|
+
if (_this6.conditionCollection.hasConditions(columnIndex)) {
|
616
|
+
_this6.updateValueComponentCondition(columnIndex);
|
636
617
|
}
|
637
618
|
});
|
638
619
|
}
|
@@ -703,10 +684,10 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
703
684
|
}, {
|
704
685
|
key: "onBeforeDropdownMenuSetItems",
|
705
686
|
value: function onBeforeDropdownMenuSetItems() {
|
706
|
-
var
|
687
|
+
var _this7 = this;
|
707
688
|
if (this.dropdownMenuPlugin) {
|
708
689
|
this.dropdownMenuPlugin.menu.addLocalHook('afterOpen', function () {
|
709
|
-
|
690
|
+
_this7.dropdownMenuPlugin.menu.hotMenu.updateSettings({
|
710
691
|
hiddenRows: true
|
711
692
|
});
|
712
693
|
});
|
@@ -797,7 +778,6 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
797
778
|
});
|
798
779
|
this.filtersRowsMap.clear();
|
799
780
|
this.filter();
|
800
|
-
this.hot.selectCell(0, selectedColumn.visualIndex);
|
801
781
|
}
|
802
782
|
(_this$dropdownMenuPlu3 = this.dropdownMenuPlugin) === null || _this$dropdownMenuPlu3 === void 0 ? void 0 : _this$dropdownMenuPlu3.close();
|
803
783
|
}
|
@@ -890,10 +870,10 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
890
870
|
}, {
|
891
871
|
key: "_createDataFilter",
|
892
872
|
value: function _createDataFilter() {
|
893
|
-
var
|
873
|
+
var _this8 = this;
|
894
874
|
var conditionCollection = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.conditionCollection;
|
895
875
|
return new _dataFilter.default(conditionCollection, function (physicalColumn) {
|
896
|
-
return
|
876
|
+
return _this8.getDataMapAtColumn(physicalColumn);
|
897
877
|
});
|
898
878
|
}
|
899
879
|
|
@@ -1025,12 +1005,12 @@ var Filters = /*#__PURE__*/function (_BasePlugin) {
|
|
1025
1005
|
}, {
|
1026
1006
|
key: "destroy",
|
1027
1007
|
value: function destroy() {
|
1028
|
-
var
|
1008
|
+
var _this9 = this;
|
1029
1009
|
if (this.enabled) {
|
1030
1010
|
this.components.forEach(function (component, key) {
|
1031
1011
|
if (component !== null) {
|
1032
1012
|
component.destroy();
|
1033
|
-
|
1013
|
+
_this9.components.set(key, null);
|
1034
1014
|
}
|
1035
1015
|
});
|
1036
1016
|
this.conditionCollection.destroy();
|