handsontable 0.0.0-next-ff8465d-20231006 → 0.0.0-next-b0a4ea2-20231024
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/base.js +2 -2
- package/base.mjs +2 -2
- package/cellTypes/dateType/dateType.d.ts +3 -3
- package/cellTypes/dateType/dateType.js +2 -2
- package/cellTypes/dateType/dateType.mjs +2 -2
- package/cellTypes/handsontableType/handsontableType.d.ts +3 -3
- package/cellTypes/handsontableType/handsontableType.js +2 -2
- package/cellTypes/handsontableType/handsontableType.mjs +2 -2
- package/core.d.ts +1 -1
- package/core.js +10 -5
- package/core.mjs +10 -5
- package/dataMap/metaManager/metaSchema.js +1 -1
- package/dataMap/metaManager/metaSchema.mjs +1 -1
- package/dist/handsontable.css +13 -12
- package/dist/handsontable.full.css +13 -12
- package/dist/handsontable.full.js +2260 -1403
- package/dist/handsontable.full.min.css +5 -5
- package/dist/handsontable.full.min.js +10 -10
- package/dist/handsontable.js +2260 -1403
- package/dist/handsontable.min.css +5 -5
- package/dist/handsontable.min.js +24 -24
- package/dist/languages/all.js +6 -2
- package/dist/languages/all.min.js +1 -1
- package/dist/languages/en-US.js +3 -1
- package/dist/languages/en-US.min.js +1 -1
- package/dist/languages/pl-PL.js +3 -1
- package/dist/languages/pl-PL.min.js +1 -1
- package/editors/autocompleteEditor/autocompleteEditor.js +1 -1
- package/editors/autocompleteEditor/autocompleteEditor.mjs +1 -1
- package/editors/dateEditor/dateEditor.js +26 -7
- package/editors/dateEditor/dateEditor.mjs +27 -8
- package/editors/handsontableEditor/handsontableEditor.js +7 -0
- package/editors/handsontableEditor/handsontableEditor.mjs +8 -1
- package/helpers/a11y.js +3 -1
- package/helpers/a11y.mjs +2 -1
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/i18n/constants.js +7 -1
- package/i18n/constants.mjs +4 -1
- package/i18n/languages/en-US.js +3 -1
- package/i18n/languages/en-US.mjs +3 -1
- package/i18n/languages/pl-PL.js +3 -1
- package/i18n/languages/pl-PL.mjs +3 -1
- package/languages/all.js +6 -2
- package/languages/en-US.js +3 -1
- package/languages/en-US.mjs +3 -1
- package/languages/index.js +6 -2
- package/languages/pl-PL.js +3 -1
- package/languages/pl-PL.mjs +3 -1
- package/package.json +11 -1
- package/pluginHooks.js +1 -1
- package/pluginHooks.mjs +1 -1
- package/plugins/contextMenu/menu/defaultShortcutsList.js +88 -0
- package/plugins/contextMenu/menu/defaultShortcutsList.mjs +84 -0
- package/plugins/contextMenu/menu/menu.js +87 -151
- package/plugins/contextMenu/menu/menu.mjs +90 -154
- package/plugins/contextMenu/menu/menuItemRenderer.js +58 -0
- package/plugins/contextMenu/menu/menuItemRenderer.mjs +54 -0
- package/plugins/contextMenu/menu/navigator.js +19 -144
- package/plugins/contextMenu/menu/navigator.mjs +18 -143
- package/plugins/contextMenu/menu/shortcuts.js +114 -0
- package/plugins/contextMenu/menu/shortcuts.mjs +110 -0
- package/plugins/dropdownMenu/dropdownMenu.js +32 -4
- package/plugins/dropdownMenu/dropdownMenu.mjs +33 -5
- package/plugins/filters/component/_base.js +23 -8
- package/plugins/filters/component/_base.mjs +23 -8
- package/plugins/filters/component/actionBar.js +29 -27
- package/plugins/filters/component/actionBar.mjs +26 -23
- package/plugins/filters/component/condition.js +46 -59
- package/plugins/filters/component/condition.mjs +40 -52
- package/plugins/filters/component/operators.js +21 -22
- package/plugins/filters/component/operators.mjs +18 -18
- package/plugins/filters/component/value.js +35 -26
- package/plugins/filters/component/value.mjs +32 -22
- package/plugins/filters/filters.js +75 -48
- package/plugins/filters/filters.mjs +68 -41
- package/plugins/filters/menu/focusController.js +123 -0
- package/plugins/filters/menu/focusController.mjs +119 -0
- package/plugins/filters/menu/focusNavigator.js +30 -0
- package/plugins/filters/menu/focusNavigator.mjs +26 -0
- package/plugins/filters/ui/_base.js +35 -13
- package/plugins/filters/ui/_base.mjs +35 -13
- package/plugins/filters/ui/input.js +43 -32
- package/plugins/filters/ui/input.mjs +42 -30
- package/plugins/filters/ui/link.js +44 -12
- package/plugins/filters/ui/link.mjs +44 -11
- package/plugins/filters/ui/multipleSelect.js +234 -129
- package/plugins/filters/ui/multipleSelect.mjs +232 -127
- package/plugins/filters/ui/radioInput.js +42 -18
- package/plugins/filters/ui/radioInput.mjs +42 -17
- package/plugins/filters/ui/select.js +144 -75
- package/plugins/filters/ui/select.mjs +140 -70
- package/renderers/autocompleteRenderer/autocompleteRenderer.js +1 -1
- package/renderers/autocompleteRenderer/autocompleteRenderer.mjs +1 -1
- package/renderers/checkboxRenderer/checkboxRenderer.js +3 -3
- package/renderers/checkboxRenderer/checkboxRenderer.mjs +4 -4
- package/renderers/dateRenderer/dateRenderer.d.ts +5 -0
- package/renderers/dateRenderer/dateRenderer.js +29 -0
- package/renderers/dateRenderer/dateRenderer.mjs +24 -0
- package/renderers/dateRenderer/index.d.ts +1 -0
- package/renderers/dateRenderer/index.js +6 -0
- package/renderers/dateRenderer/index.mjs +1 -0
- package/renderers/handsontableRenderer/handsontableRenderer.d.ts +5 -0
- package/renderers/handsontableRenderer/handsontableRenderer.js +29 -0
- package/renderers/handsontableRenderer/handsontableRenderer.mjs +24 -0
- package/renderers/handsontableRenderer/index.d.ts +1 -0
- package/renderers/handsontableRenderer/index.js +6 -0
- package/renderers/handsontableRenderer/index.mjs +1 -0
- package/renderers/index.d.ts +6 -0
- package/renderers/selectRenderer/selectRenderer.js +2 -1
- package/renderers/selectRenderer/selectRenderer.mjs +2 -1
- package/selection/selection.js +2 -2
- package/selection/selection.mjs +2 -2
- package/shortcuts/context.js +3 -2
- package/shortcuts/context.mjs +3 -2
- package/utils/paginator.js +151 -0
- package/utils/paginator.mjs +147 -0
package/shortcuts/context.mjs
CHANGED
@@ -45,7 +45,7 @@ export const createContext = name => {
|
|
45
45
|
* @param {Function} options.callback The shortcut's action
|
46
46
|
* @param {object} options.group A group of shortcuts to which the shortcut belongs
|
47
47
|
* @param {object} [options.runOnlyIf] A condition on which the shortcut's action runs
|
48
|
-
* @param {object} [options.stopPropagation=
|
48
|
+
* @param {object} [options.stopPropagation=false] If set to `true`: stops the event's propagation
|
49
49
|
* @param {object} [options.captureCtrl=false] If set to `true`: captures the state of the Control/Meta modifier key
|
50
50
|
* @param {object} [options.preventDefault=true] If set to `true`: prevents the default behavior
|
51
51
|
* @param {object} [options.position='after'] The order in which the shortcut's action runs:
|
@@ -122,11 +122,12 @@ export const createContext = name => {
|
|
122
122
|
* @param {Function} [options.callback] A shortcut's action
|
123
123
|
* @param {object} [options.group] A group of shortcuts to which a shortcut belongs
|
124
124
|
* @param {object} [options.runOnlyIf] A condition on which a shortcut's action runs
|
125
|
-
* @param {object} [options.stopPropagation=
|
125
|
+
* @param {object} [options.stopPropagation=false] If set to `true`: stops the event's propagation
|
126
126
|
* @param {object} [options.preventDefault=true] If set to `true`: prevents the default behavior
|
127
127
|
* @param {object} [options.position='after'] The order in which a shortcut's action runs:
|
128
128
|
* `'before'` or `'after'` a `relativeToGroup` group of actions
|
129
129
|
* @param {object} [options.relativeToGroup] The name of a group of actions, used to determine an action's `position`
|
130
|
+
* @param {object} [options.forwardToContext] The context object where the event will be forwarded to.
|
130
131
|
*/
|
131
132
|
const addShortcuts = function (shortcuts) {
|
132
133
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
@@ -0,0 +1,151 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.createPaginator = createPaginator;
|
5
|
+
var _number = require("../helpers/number");
|
6
|
+
/**
|
7
|
+
* @typedef Paginator
|
8
|
+
* @property {function(number): void} setCurrentPage Sets the current index to the specific page.
|
9
|
+
* @property {function(): number} getCurrentPage Gets the current page.
|
10
|
+
* @property {function(): number} getSize Gets the total number of pages.
|
11
|
+
* @property {function(): void} toFirstItem Move the index to the first page.
|
12
|
+
* @property {function(): void} toLastItem Move the index to the last page.
|
13
|
+
* @property {function(): void} toNextItem Move the index to the next page.
|
14
|
+
* @property {function(): void} toPreviousItem Move the index to the previous page.
|
15
|
+
* @property {function(): void} clear Clear the internal state of the paginator.
|
16
|
+
*/
|
17
|
+
/**
|
18
|
+
* @param {object} options Paginator options.
|
19
|
+
* @param {number} [options.initialPage] Initial index from which paging starts. Also, after clearing the paginator
|
20
|
+
* the page is cleared to the initial page.
|
21
|
+
* @param {function(): number} [options.size] Sets the max size of the pages.
|
22
|
+
* @param {function(number): boolean | void} [options.onItemSelect] Fires the function on each page change.
|
23
|
+
* @param {function(): void} [options.onClear] Fires the function after clearing the state.
|
24
|
+
* @returns {Paginator}
|
25
|
+
*/
|
26
|
+
function createPaginator(_ref) {
|
27
|
+
let {
|
28
|
+
initialPage = -1,
|
29
|
+
size = () => 0,
|
30
|
+
onItemSelect = () => {},
|
31
|
+
onClear = () => {}
|
32
|
+
} = _ref;
|
33
|
+
const visitedPages = new Set();
|
34
|
+
let currentIndex = (0, _number.clamp)(initialPage, -1, getSize() - 1);
|
35
|
+
|
36
|
+
/**
|
37
|
+
* Updates the internal state of the paginator.
|
38
|
+
*
|
39
|
+
* @param {number} newIndex The page index to switch.
|
40
|
+
* @param {-1|1} direction The direction of traversing the pages in case when they are disabled.
|
41
|
+
* @returns {number} Returns the final index of the page.
|
42
|
+
*/
|
43
|
+
function _updateState(newIndex, direction) {
|
44
|
+
const lastIndex = getSize() - 1;
|
45
|
+
if (newIndex < 0) {
|
46
|
+
newIndex = lastIndex;
|
47
|
+
}
|
48
|
+
if (newIndex > lastIndex) {
|
49
|
+
newIndex = 0;
|
50
|
+
}
|
51
|
+
if (visitedPages.has(newIndex)) {
|
52
|
+
return -1;
|
53
|
+
}
|
54
|
+
visitedPages.add(newIndex);
|
55
|
+
const changeProceed = onItemSelect(newIndex, false);
|
56
|
+
if (changeProceed === false) {
|
57
|
+
newIndex = _updateState(direction === 1 ? ++newIndex : --newIndex,
|
58
|
+
// eslint-disable-line no-plusplus
|
59
|
+
direction);
|
60
|
+
}
|
61
|
+
return newIndex;
|
62
|
+
}
|
63
|
+
|
64
|
+
/**
|
65
|
+
* Sets the page index as current one.
|
66
|
+
*
|
67
|
+
* @param {number} index The index to set.
|
68
|
+
*/
|
69
|
+
function setCurrentPage(index) {
|
70
|
+
if (index > -1 && index < getSize() && onItemSelect(index, true) !== false) {
|
71
|
+
currentIndex = index;
|
72
|
+
}
|
73
|
+
}
|
74
|
+
|
75
|
+
/**
|
76
|
+
* Gets the current page.
|
77
|
+
*
|
78
|
+
* @returns {number}
|
79
|
+
*/
|
80
|
+
function getCurrentPage() {
|
81
|
+
return currentIndex;
|
82
|
+
}
|
83
|
+
|
84
|
+
/**
|
85
|
+
* Moves the index to the first page.
|
86
|
+
*/
|
87
|
+
function toFirstItem() {
|
88
|
+
if (getSize() > 0) {
|
89
|
+
visitedPages.clear();
|
90
|
+
currentIndex = _updateState(0, 1);
|
91
|
+
}
|
92
|
+
}
|
93
|
+
|
94
|
+
/**
|
95
|
+
* Moves the index to the last page.
|
96
|
+
*/
|
97
|
+
function toLastItem() {
|
98
|
+
if (getSize() > 0) {
|
99
|
+
visitedPages.clear();
|
100
|
+
currentIndex = _updateState(getSize() - 1, -1);
|
101
|
+
}
|
102
|
+
}
|
103
|
+
|
104
|
+
/**
|
105
|
+
* Moves the index to the next page.
|
106
|
+
*/
|
107
|
+
function toNextItem() {
|
108
|
+
if (getSize() > 0) {
|
109
|
+
visitedPages.clear();
|
110
|
+
currentIndex = _updateState(++currentIndex, 1); // eslint-disable-line no-plusplus
|
111
|
+
}
|
112
|
+
}
|
113
|
+
|
114
|
+
/**
|
115
|
+
* Moves the index to the previous page.
|
116
|
+
*/
|
117
|
+
function toPreviousItem() {
|
118
|
+
if (getSize() > 0) {
|
119
|
+
visitedPages.clear();
|
120
|
+
currentIndex = _updateState(--currentIndex, -1); // eslint-disable-line no-plusplus
|
121
|
+
}
|
122
|
+
}
|
123
|
+
|
124
|
+
/**
|
125
|
+
* Gets the total number of pages.
|
126
|
+
*
|
127
|
+
* @returns {number}
|
128
|
+
*/
|
129
|
+
function getSize() {
|
130
|
+
return Math.max(size(), 0);
|
131
|
+
}
|
132
|
+
|
133
|
+
/**
|
134
|
+
* Clears the internal state of the paginator.
|
135
|
+
*/
|
136
|
+
function clear() {
|
137
|
+
visitedPages.clear();
|
138
|
+
currentIndex = initialPage;
|
139
|
+
onClear();
|
140
|
+
}
|
141
|
+
return {
|
142
|
+
setCurrentPage,
|
143
|
+
getCurrentPage,
|
144
|
+
toFirstItem,
|
145
|
+
toLastItem,
|
146
|
+
toNextItem,
|
147
|
+
toPreviousItem,
|
148
|
+
getSize,
|
149
|
+
clear
|
150
|
+
};
|
151
|
+
}
|
@@ -0,0 +1,147 @@
|
|
1
|
+
import { clamp } from "../helpers/number.mjs";
|
2
|
+
/**
|
3
|
+
* @typedef Paginator
|
4
|
+
* @property {function(number): void} setCurrentPage Sets the current index to the specific page.
|
5
|
+
* @property {function(): number} getCurrentPage Gets the current page.
|
6
|
+
* @property {function(): number} getSize Gets the total number of pages.
|
7
|
+
* @property {function(): void} toFirstItem Move the index to the first page.
|
8
|
+
* @property {function(): void} toLastItem Move the index to the last page.
|
9
|
+
* @property {function(): void} toNextItem Move the index to the next page.
|
10
|
+
* @property {function(): void} toPreviousItem Move the index to the previous page.
|
11
|
+
* @property {function(): void} clear Clear the internal state of the paginator.
|
12
|
+
*/
|
13
|
+
/**
|
14
|
+
* @param {object} options Paginator options.
|
15
|
+
* @param {number} [options.initialPage] Initial index from which paging starts. Also, after clearing the paginator
|
16
|
+
* the page is cleared to the initial page.
|
17
|
+
* @param {function(): number} [options.size] Sets the max size of the pages.
|
18
|
+
* @param {function(number): boolean | void} [options.onItemSelect] Fires the function on each page change.
|
19
|
+
* @param {function(): void} [options.onClear] Fires the function after clearing the state.
|
20
|
+
* @returns {Paginator}
|
21
|
+
*/
|
22
|
+
export function createPaginator(_ref) {
|
23
|
+
let {
|
24
|
+
initialPage = -1,
|
25
|
+
size = () => 0,
|
26
|
+
onItemSelect = () => {},
|
27
|
+
onClear = () => {}
|
28
|
+
} = _ref;
|
29
|
+
const visitedPages = new Set();
|
30
|
+
let currentIndex = clamp(initialPage, -1, getSize() - 1);
|
31
|
+
|
32
|
+
/**
|
33
|
+
* Updates the internal state of the paginator.
|
34
|
+
*
|
35
|
+
* @param {number} newIndex The page index to switch.
|
36
|
+
* @param {-1|1} direction The direction of traversing the pages in case when they are disabled.
|
37
|
+
* @returns {number} Returns the final index of the page.
|
38
|
+
*/
|
39
|
+
function _updateState(newIndex, direction) {
|
40
|
+
const lastIndex = getSize() - 1;
|
41
|
+
if (newIndex < 0) {
|
42
|
+
newIndex = lastIndex;
|
43
|
+
}
|
44
|
+
if (newIndex > lastIndex) {
|
45
|
+
newIndex = 0;
|
46
|
+
}
|
47
|
+
if (visitedPages.has(newIndex)) {
|
48
|
+
return -1;
|
49
|
+
}
|
50
|
+
visitedPages.add(newIndex);
|
51
|
+
const changeProceed = onItemSelect(newIndex, false);
|
52
|
+
if (changeProceed === false) {
|
53
|
+
newIndex = _updateState(direction === 1 ? ++newIndex : --newIndex,
|
54
|
+
// eslint-disable-line no-plusplus
|
55
|
+
direction);
|
56
|
+
}
|
57
|
+
return newIndex;
|
58
|
+
}
|
59
|
+
|
60
|
+
/**
|
61
|
+
* Sets the page index as current one.
|
62
|
+
*
|
63
|
+
* @param {number} index The index to set.
|
64
|
+
*/
|
65
|
+
function setCurrentPage(index) {
|
66
|
+
if (index > -1 && index < getSize() && onItemSelect(index, true) !== false) {
|
67
|
+
currentIndex = index;
|
68
|
+
}
|
69
|
+
}
|
70
|
+
|
71
|
+
/**
|
72
|
+
* Gets the current page.
|
73
|
+
*
|
74
|
+
* @returns {number}
|
75
|
+
*/
|
76
|
+
function getCurrentPage() {
|
77
|
+
return currentIndex;
|
78
|
+
}
|
79
|
+
|
80
|
+
/**
|
81
|
+
* Moves the index to the first page.
|
82
|
+
*/
|
83
|
+
function toFirstItem() {
|
84
|
+
if (getSize() > 0) {
|
85
|
+
visitedPages.clear();
|
86
|
+
currentIndex = _updateState(0, 1);
|
87
|
+
}
|
88
|
+
}
|
89
|
+
|
90
|
+
/**
|
91
|
+
* Moves the index to the last page.
|
92
|
+
*/
|
93
|
+
function toLastItem() {
|
94
|
+
if (getSize() > 0) {
|
95
|
+
visitedPages.clear();
|
96
|
+
currentIndex = _updateState(getSize() - 1, -1);
|
97
|
+
}
|
98
|
+
}
|
99
|
+
|
100
|
+
/**
|
101
|
+
* Moves the index to the next page.
|
102
|
+
*/
|
103
|
+
function toNextItem() {
|
104
|
+
if (getSize() > 0) {
|
105
|
+
visitedPages.clear();
|
106
|
+
currentIndex = _updateState(++currentIndex, 1); // eslint-disable-line no-plusplus
|
107
|
+
}
|
108
|
+
}
|
109
|
+
|
110
|
+
/**
|
111
|
+
* Moves the index to the previous page.
|
112
|
+
*/
|
113
|
+
function toPreviousItem() {
|
114
|
+
if (getSize() > 0) {
|
115
|
+
visitedPages.clear();
|
116
|
+
currentIndex = _updateState(--currentIndex, -1); // eslint-disable-line no-plusplus
|
117
|
+
}
|
118
|
+
}
|
119
|
+
|
120
|
+
/**
|
121
|
+
* Gets the total number of pages.
|
122
|
+
*
|
123
|
+
* @returns {number}
|
124
|
+
*/
|
125
|
+
function getSize() {
|
126
|
+
return Math.max(size(), 0);
|
127
|
+
}
|
128
|
+
|
129
|
+
/**
|
130
|
+
* Clears the internal state of the paginator.
|
131
|
+
*/
|
132
|
+
function clear() {
|
133
|
+
visitedPages.clear();
|
134
|
+
currentIndex = initialPage;
|
135
|
+
onClear();
|
136
|
+
}
|
137
|
+
return {
|
138
|
+
setCurrentPage,
|
139
|
+
getCurrentPage,
|
140
|
+
toFirstItem,
|
141
|
+
toLastItem,
|
142
|
+
toNextItem,
|
143
|
+
toPreviousItem,
|
144
|
+
getSize,
|
145
|
+
clear
|
146
|
+
};
|
147
|
+
}
|