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
@@ -1,45 +1,121 @@
|
|
1
|
+
import "core-js/modules/es.error.cause.js";
|
2
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
3
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
4
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
5
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
6
|
+
function _classApplyDescriptorSet(receiver, descriptor, value) { if (descriptor.set) { descriptor.set.call(receiver, value); } else { if (!descriptor.writable) { throw new TypeError("attempted to set read only private field"); } descriptor.value = value; } }
|
7
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
8
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
9
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
10
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
1
11
|
import { Menu } from "../../../plugins/contextMenu/menu/index.mjs";
|
2
12
|
import { clone, extend } from "../../../helpers/object.mjs";
|
3
13
|
import { arrayEach } from "../../../helpers/array.mjs";
|
4
14
|
import * as C from "../../../i18n/constants.mjs";
|
5
15
|
import { SEPARATOR } from "../../../plugins/contextMenu/predefinedItems/index.mjs";
|
6
|
-
import BaseUI from "./_base.mjs";
|
7
|
-
const privatePool = new WeakMap();
|
8
|
-
|
16
|
+
import { BaseUI } from "./_base.mjs";
|
9
17
|
/**
|
10
18
|
* @private
|
11
19
|
* @class SelectUI
|
12
20
|
*/
|
13
|
-
|
21
|
+
var _menu = /*#__PURE__*/new WeakMap();
|
22
|
+
var _items = /*#__PURE__*/new WeakMap();
|
23
|
+
var _caption = /*#__PURE__*/new WeakMap();
|
24
|
+
var _captionElement = /*#__PURE__*/new WeakMap();
|
25
|
+
var _dropdown = /*#__PURE__*/new WeakMap();
|
26
|
+
var _onMenuSelect = /*#__PURE__*/new WeakSet();
|
27
|
+
var _onMenuClosed = /*#__PURE__*/new WeakSet();
|
28
|
+
var _onClick = /*#__PURE__*/new WeakSet();
|
29
|
+
export class SelectUI extends BaseUI {
|
14
30
|
static get DEFAULTS() {
|
15
31
|
return clone({
|
16
32
|
className: 'htUISelect',
|
17
|
-
wrapIt: false
|
33
|
+
wrapIt: false,
|
34
|
+
tabIndex: -1
|
18
35
|
});
|
19
36
|
}
|
37
|
+
|
38
|
+
/**
|
39
|
+
* Instance of {@link Menu}.
|
40
|
+
*
|
41
|
+
* @type {Menu}
|
42
|
+
*/
|
43
|
+
|
20
44
|
constructor(hotInstance, options) {
|
21
45
|
super(hotInstance, extend(SelectUI.DEFAULTS, options));
|
22
|
-
privatePool.set(this, {});
|
23
46
|
/**
|
24
|
-
*
|
47
|
+
* On element click listener.
|
25
48
|
*
|
26
|
-
* @
|
49
|
+
* @private
|
27
50
|
*/
|
28
|
-
this
|
51
|
+
_classPrivateMethodInitSpec(this, _onClick);
|
52
|
+
/**
|
53
|
+
* On menu closed listener.
|
54
|
+
*/
|
55
|
+
_classPrivateMethodInitSpec(this, _onMenuClosed);
|
56
|
+
/**
|
57
|
+
* On menu selected listener.
|
58
|
+
*
|
59
|
+
* @param {object} command Selected item.
|
60
|
+
*/
|
61
|
+
_classPrivateMethodInitSpec(this, _onMenuSelect);
|
62
|
+
_classPrivateFieldInitSpec(this, _menu, {
|
63
|
+
writable: true,
|
64
|
+
value: null
|
65
|
+
});
|
29
66
|
/**
|
30
67
|
* List of available select options.
|
31
68
|
*
|
32
69
|
* @type {Array}
|
33
70
|
*/
|
34
|
-
this
|
71
|
+
_classPrivateFieldInitSpec(this, _items, {
|
72
|
+
writable: true,
|
73
|
+
value: []
|
74
|
+
});
|
75
|
+
/**
|
76
|
+
* The reference to the BaseUI instance of the caption.
|
77
|
+
*
|
78
|
+
* @type {BaseUI}
|
79
|
+
*/
|
80
|
+
_classPrivateFieldInitSpec(this, _caption, {
|
81
|
+
writable: true,
|
82
|
+
value: void 0
|
83
|
+
});
|
84
|
+
/**
|
85
|
+
* The reference to the table caption element.
|
86
|
+
*
|
87
|
+
* @type {HTMLTableCaptionElement}
|
88
|
+
*/
|
89
|
+
_classPrivateFieldInitSpec(this, _captionElement, {
|
90
|
+
writable: true,
|
91
|
+
value: void 0
|
92
|
+
});
|
93
|
+
/**
|
94
|
+
* The reference to the BaseUI instance of the dropdown.
|
95
|
+
*
|
96
|
+
* @type {BaseUI}
|
97
|
+
*/
|
98
|
+
_classPrivateFieldInitSpec(this, _dropdown, {
|
99
|
+
writable: true,
|
100
|
+
value: void 0
|
101
|
+
});
|
35
102
|
this.registerHooks();
|
36
103
|
}
|
37
104
|
|
105
|
+
/**
|
106
|
+
* Gets the instance of the Menu.
|
107
|
+
*
|
108
|
+
* @returns {Menu}
|
109
|
+
*/
|
110
|
+
getMenu() {
|
111
|
+
return _classPrivateFieldGet(this, _menu);
|
112
|
+
}
|
113
|
+
|
38
114
|
/**
|
39
115
|
* Register all necessary hooks.
|
40
116
|
*/
|
41
117
|
registerHooks() {
|
42
|
-
this.addLocalHook('click', () => this.
|
118
|
+
this.addLocalHook('click', () => _classPrivateMethodGet(this, _onClick, _onClick2).call(this));
|
43
119
|
}
|
44
120
|
|
45
121
|
/**
|
@@ -48,9 +124,9 @@ class SelectUI extends BaseUI {
|
|
48
124
|
* @param {Array} items Array of objects with required keys `key` and `name`.
|
49
125
|
*/
|
50
126
|
setItems(items) {
|
51
|
-
this
|
52
|
-
if (this
|
53
|
-
this.
|
127
|
+
_classPrivateFieldSet(this, _items, this.translateNames(items));
|
128
|
+
if (_classPrivateFieldGet(this, _menu)) {
|
129
|
+
_classPrivateFieldGet(this, _menu).setMenuItems(_classPrivateFieldGet(this, _items));
|
54
130
|
}
|
55
131
|
}
|
56
132
|
|
@@ -72,26 +148,25 @@ class SelectUI extends BaseUI {
|
|
72
148
|
*/
|
73
149
|
build() {
|
74
150
|
super.build();
|
75
|
-
this
|
151
|
+
_classPrivateFieldSet(this, _menu, new Menu(this.hot, {
|
76
152
|
className: 'htSelectUI htFiltersConditionsMenu',
|
77
153
|
keepInViewport: false,
|
78
154
|
standalone: true,
|
79
155
|
container: this.options.menuContainer
|
80
|
-
});
|
81
|
-
this.
|
156
|
+
}));
|
157
|
+
_classPrivateFieldGet(this, _menu).setMenuItems(_classPrivateFieldGet(this, _items));
|
82
158
|
const caption = new BaseUI(this.hot, {
|
83
159
|
className: 'htUISelectCaption'
|
84
160
|
});
|
85
161
|
const dropdown = new BaseUI(this.hot, {
|
86
162
|
className: 'htUISelectDropdown'
|
87
163
|
});
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
priv.dropdown = dropdown;
|
164
|
+
_classPrivateFieldSet(this, _caption, caption);
|
165
|
+
_classPrivateFieldSet(this, _captionElement, caption.element);
|
166
|
+
_classPrivateFieldSet(this, _dropdown, dropdown);
|
92
167
|
arrayEach([caption, dropdown], element => this._element.appendChild(element.element));
|
93
|
-
this.
|
94
|
-
this.
|
168
|
+
_classPrivateFieldGet(this, _menu).addLocalHook('select', command => _classPrivateMethodGet(this, _onMenuSelect, _onMenuSelect2).call(this, command));
|
169
|
+
_classPrivateFieldGet(this, _menu).addLocalHook('afterClose', () => _classPrivateMethodGet(this, _onMenuClosed, _onMenuClosed2).call(this));
|
95
170
|
this.update();
|
96
171
|
}
|
97
172
|
|
@@ -106,9 +181,9 @@ class SelectUI extends BaseUI {
|
|
106
181
|
if (this.options.value) {
|
107
182
|
conditionName = this.options.value.name;
|
108
183
|
} else {
|
109
|
-
conditionName = this.
|
184
|
+
conditionName = _classPrivateFieldGet(this, _menu).hot.getTranslatedPhrase(C.FILTERS_CONDITIONS_NONE);
|
110
185
|
}
|
111
|
-
|
186
|
+
_classPrivateFieldGet(this, _captionElement).textContent = conditionName;
|
112
187
|
super.update();
|
113
188
|
}
|
114
189
|
|
@@ -117,14 +192,25 @@ class SelectUI extends BaseUI {
|
|
117
192
|
*/
|
118
193
|
openOptions() {
|
119
194
|
const rect = this.element.getBoundingClientRect();
|
120
|
-
if (this
|
121
|
-
this.
|
122
|
-
this.
|
195
|
+
if (_classPrivateFieldGet(this, _menu)) {
|
196
|
+
_classPrivateFieldGet(this, _menu).open();
|
197
|
+
_classPrivateFieldGet(this, _menu).setPosition({
|
123
198
|
left: this.hot.isLtr() ? rect.left - 5 : rect.left - 31,
|
124
199
|
top: rect.top - 1,
|
125
200
|
width: rect.width,
|
126
201
|
height: rect.height
|
127
202
|
});
|
203
|
+
_classPrivateFieldGet(this, _menu).getNavigator().toFirstItem();
|
204
|
+
_classPrivateFieldGet(this, _menu).getKeyboardShortcutsCtrl().addCustomShortcuts([{
|
205
|
+
keys: [['Tab'], ['Shift', 'Tab']],
|
206
|
+
callback: event => {
|
207
|
+
this.closeOptions();
|
208
|
+
this.runLocalHooks('tabKeydown', event);
|
209
|
+
}
|
210
|
+
}, {
|
211
|
+
keys: [['Control/Meta', 'A']],
|
212
|
+
callback: () => false
|
213
|
+
}]);
|
128
214
|
}
|
129
215
|
}
|
130
216
|
|
@@ -132,62 +218,46 @@ class SelectUI extends BaseUI {
|
|
132
218
|
* Close select dropdown menu.
|
133
219
|
*/
|
134
220
|
closeOptions() {
|
135
|
-
if (this
|
136
|
-
this.
|
221
|
+
if (_classPrivateFieldGet(this, _menu)) {
|
222
|
+
_classPrivateFieldGet(this, _menu).close();
|
137
223
|
}
|
138
224
|
}
|
139
225
|
|
140
226
|
/**
|
141
|
-
*
|
142
|
-
*
|
143
|
-
* @private
|
144
|
-
* @param {object} command Selected item.
|
227
|
+
* Focus element.
|
145
228
|
*/
|
146
|
-
|
147
|
-
if (
|
148
|
-
this.
|
149
|
-
this.update();
|
150
|
-
this.runLocalHooks('select', this.options.value);
|
229
|
+
focus() {
|
230
|
+
if (this.isBuilt()) {
|
231
|
+
this.element.focus();
|
151
232
|
}
|
152
233
|
}
|
153
|
-
|
154
|
-
/**
|
155
|
-
* On menu closed listener.
|
156
|
-
*
|
157
|
-
* @private
|
158
|
-
*/
|
159
|
-
onMenuClosed() {
|
160
|
-
this.runLocalHooks('afterClose');
|
161
|
-
}
|
162
|
-
|
163
|
-
/**
|
164
|
-
* On element click listener.
|
165
|
-
*
|
166
|
-
* @private
|
167
|
-
*/
|
168
|
-
onClick() {
|
169
|
-
this.openOptions();
|
170
|
-
}
|
171
|
-
|
172
234
|
/**
|
173
235
|
* Destroy instance.
|
174
236
|
*/
|
175
237
|
destroy() {
|
176
|
-
if (this
|
177
|
-
this.
|
178
|
-
this
|
238
|
+
if (_classPrivateFieldGet(this, _menu)) {
|
239
|
+
_classPrivateFieldGet(this, _menu).destroy();
|
240
|
+
_classPrivateFieldSet(this, _menu, null);
|
179
241
|
}
|
180
|
-
|
181
|
-
|
182
|
-
dropdown
|
183
|
-
} = privatePool.get(this);
|
184
|
-
if (caption) {
|
185
|
-
caption.destroy();
|
242
|
+
if (_classPrivateFieldGet(this, _caption)) {
|
243
|
+
_classPrivateFieldGet(this, _caption).destroy();
|
186
244
|
}
|
187
|
-
if (
|
188
|
-
|
245
|
+
if (_classPrivateFieldGet(this, _dropdown)) {
|
246
|
+
_classPrivateFieldGet(this, _dropdown).destroy();
|
189
247
|
}
|
190
248
|
super.destroy();
|
191
249
|
}
|
192
250
|
}
|
193
|
-
|
251
|
+
function _onMenuSelect2(command) {
|
252
|
+
if (command.name !== SEPARATOR) {
|
253
|
+
this.options.value = command;
|
254
|
+
this.update();
|
255
|
+
this.runLocalHooks('select', this.options.value);
|
256
|
+
}
|
257
|
+
}
|
258
|
+
function _onMenuClosed2() {
|
259
|
+
this.runLocalHooks('afterClose');
|
260
|
+
}
|
261
|
+
function _onClick2() {
|
262
|
+
this.openOptions();
|
263
|
+
}
|
@@ -46,7 +46,7 @@ function autocompleteRenderer(instance, TD, row, col, prop, value, cellPropertie
|
|
46
46
|
TD.insertBefore(ARROW, TD.firstChild);
|
47
47
|
(0, _element.addClass)(TD, 'htAutocomplete');
|
48
48
|
if (isAriaEnabled) {
|
49
|
-
TD.setAttribute(...(0, _a11y.A11Y_HASPOPUP)());
|
49
|
+
TD.setAttribute(...(0, _a11y.A11Y_HASPOPUP)('listbox'));
|
50
50
|
}
|
51
51
|
if (!instance.acArrowListener) {
|
52
52
|
const eventManager = new _eventManager.default(instance);
|
@@ -40,7 +40,7 @@ export function autocompleteRenderer(instance, TD, row, col, prop, value, cellPr
|
|
40
40
|
TD.insertBefore(ARROW, TD.firstChild);
|
41
41
|
addClass(TD, 'htAutocomplete');
|
42
42
|
if (isAriaEnabled) {
|
43
|
-
TD.setAttribute(...A11Y_HASPOPUP());
|
43
|
+
TD.setAttribute(...A11Y_HASPOPUP('listbox'));
|
44
44
|
}
|
45
45
|
if (!instance.acArrowListener) {
|
46
46
|
const eventManager = new EventManager(instance);
|
@@ -10,6 +10,7 @@ var _mixed = require("../../helpers/mixed");
|
|
10
10
|
var _shortcutContexts = require("../../shortcutContexts");
|
11
11
|
var _pluginHooks = _interopRequireDefault(require("../../pluginHooks"));
|
12
12
|
var _a11y = require("../../helpers/a11y");
|
13
|
+
var _constants = require("../../i18n/constants");
|
13
14
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
14
15
|
const isListeningKeyDownEvent = new WeakMap();
|
15
16
|
const isCheckboxListenerAdded = new WeakMap();
|
@@ -88,10 +89,9 @@ function checkboxRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
|
88
89
|
(0, _element.addClass)(input, BAD_VALUE_CLASS);
|
89
90
|
badValue = true;
|
90
91
|
}
|
91
|
-
|
92
|
-
input.setAttribute(ATTR_COLUMN, col);
|
92
|
+
(0, _element.setAttribute)(input, [[ATTR_ROW, row], [ATTR_COLUMN, col]]);
|
93
93
|
if (ariaEnabled) {
|
94
|
-
(0, _element.setAttribute)(
|
94
|
+
(0, _element.setAttribute)(input, [(0, _a11y.A11Y_LABEL)(input.checked ? instance.getTranslatedPhrase(_constants.CHECKBOX_CHECKED) : instance.getTranslatedPhrase(_constants.CHECKBOX_UNCHECKED)), (0, _a11y.A11Y_CHECKED)(input.checked), (0, _a11y.A11Y_CHECKBOX)()]);
|
95
95
|
}
|
96
96
|
if (!badValue && labelOptions) {
|
97
97
|
let labelText = '';
|
@@ -5,7 +5,8 @@ import { empty, addClass, setAttribute } from "../../helpers/dom/element.mjs";
|
|
5
5
|
import { isEmpty, stringify } from "../../helpers/mixed.mjs";
|
6
6
|
import { EDITOR_EDIT_GROUP as SHORTCUTS_GROUP_EDITOR } from "../../shortcutContexts/index.mjs";
|
7
7
|
import Hooks from "../../pluginHooks.mjs";
|
8
|
-
import { A11Y_CHECKED } from "../../helpers/a11y.mjs";
|
8
|
+
import { A11Y_CHECKBOX, A11Y_CHECKED, A11Y_LABEL } from "../../helpers/a11y.mjs";
|
9
|
+
import { CHECKBOX_CHECKED, CHECKBOX_UNCHECKED } from "../../i18n/constants.mjs";
|
9
10
|
const isListeningKeyDownEvent = new WeakMap();
|
10
11
|
const isCheckboxListenerAdded = new WeakMap();
|
11
12
|
const BAD_VALUE_CLASS = 'htBadValue';
|
@@ -82,10 +83,9 @@ export function checkboxRenderer(instance, TD, row, col, prop, value, cellProper
|
|
82
83
|
addClass(input, BAD_VALUE_CLASS);
|
83
84
|
badValue = true;
|
84
85
|
}
|
85
|
-
|
86
|
-
input.setAttribute(ATTR_COLUMN, col);
|
86
|
+
setAttribute(input, [[ATTR_ROW, row], [ATTR_COLUMN, col]]);
|
87
87
|
if (ariaEnabled) {
|
88
|
-
setAttribute(
|
88
|
+
setAttribute(input, [A11Y_LABEL(input.checked ? instance.getTranslatedPhrase(CHECKBOX_CHECKED) : instance.getTranslatedPhrase(CHECKBOX_UNCHECKED)), A11Y_CHECKED(input.checked), A11Y_CHECKBOX()]);
|
89
89
|
}
|
90
90
|
if (!badValue && labelOptions) {
|
91
91
|
let labelText = '';
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import Core from '../../core';
|
2
|
+
import { CellProperties } from '../../settings';
|
3
|
+
|
4
|
+
export const RENDERER_TYPE: 'date';
|
5
|
+
export function dateRenderer(instance: Core, TD: HTMLTableCellElement, row: number, col: number, prop: string | number, value: any, cellProperties: CellProperties): void;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.dateRenderer = dateRenderer;
|
5
|
+
var _autocompleteRenderer = require("../autocompleteRenderer");
|
6
|
+
var _a11y = require("../../helpers/a11y");
|
7
|
+
var _element = require("../../helpers/dom/element");
|
8
|
+
const RENDERER_TYPE = 'date';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Handsontable renderer.
|
12
|
+
*
|
13
|
+
* @private
|
14
|
+
* @param {Core} instance The Handsontable instance.
|
15
|
+
* @param {HTMLTableCellElement} TD The rendered cell element.
|
16
|
+
* @param {number} row The visual row index.
|
17
|
+
* @param {number} col The visual column index.
|
18
|
+
* @param {number|string} prop The column property (passed when datasource is an array of objects).
|
19
|
+
* @param {*} value The rendered value.
|
20
|
+
* @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
|
21
|
+
*/
|
22
|
+
exports.RENDERER_TYPE = RENDERER_TYPE;
|
23
|
+
function dateRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
24
|
+
_autocompleteRenderer.autocompleteRenderer.apply(this, [instance, TD, row, col, prop, value, cellProperties]);
|
25
|
+
if (instance.getSettings().ariaTags) {
|
26
|
+
(0, _element.setAttribute)(TD, [(0, _a11y.A11Y_HASPOPUP)('dialog'), (0, _a11y.A11Y_EXPANDED)('false')]);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
dateRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { autocompleteRenderer } from "../autocompleteRenderer/index.mjs";
|
2
|
+
import { A11Y_EXPANDED, A11Y_HASPOPUP } from "../../helpers/a11y.mjs";
|
3
|
+
import { setAttribute } from "../../helpers/dom/element.mjs";
|
4
|
+
export const RENDERER_TYPE = 'date';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Handsontable renderer.
|
8
|
+
*
|
9
|
+
* @private
|
10
|
+
* @param {Core} instance The Handsontable instance.
|
11
|
+
* @param {HTMLTableCellElement} TD The rendered cell element.
|
12
|
+
* @param {number} row The visual row index.
|
13
|
+
* @param {number} col The visual column index.
|
14
|
+
* @param {number|string} prop The column property (passed when datasource is an array of objects).
|
15
|
+
* @param {*} value The rendered value.
|
16
|
+
* @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
|
17
|
+
*/
|
18
|
+
export function dateRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
19
|
+
autocompleteRenderer.apply(this, [instance, TD, row, col, prop, value, cellProperties]);
|
20
|
+
if (instance.getSettings().ariaTags) {
|
21
|
+
setAttribute(TD, [A11Y_HASPOPUP('dialog'), A11Y_EXPANDED('false')]);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
dateRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { RENDERER_TYPE, dateRenderer } from './dateRenderer';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { RENDERER_TYPE, dateRenderer } from "./dateRenderer.mjs";
|
@@ -0,0 +1,5 @@
|
|
1
|
+
import Core from '../../core';
|
2
|
+
import { CellProperties } from '../../settings';
|
3
|
+
|
4
|
+
export const RENDERER_TYPE: 'handsontable';
|
5
|
+
export function handsontableRenderer(instance: Core, TD: HTMLTableCellElement, row: number, col: number, prop: string | number, value: any, cellProperties: CellProperties): void;
|
@@ -0,0 +1,29 @@
|
|
1
|
+
"use strict";
|
2
|
+
|
3
|
+
exports.__esModule = true;
|
4
|
+
exports.handsontableRenderer = handsontableRenderer;
|
5
|
+
var _autocompleteRenderer = require("../autocompleteRenderer");
|
6
|
+
var _a11y = require("../../helpers/a11y");
|
7
|
+
var _element = require("../../helpers/dom/element");
|
8
|
+
const RENDERER_TYPE = 'handsontable';
|
9
|
+
|
10
|
+
/**
|
11
|
+
* Handsontable renderer.
|
12
|
+
*
|
13
|
+
* @private
|
14
|
+
* @param {Core} instance The Handsontable instance.
|
15
|
+
* @param {HTMLTableCellElement} TD The rendered cell element.
|
16
|
+
* @param {number} row The visual row index.
|
17
|
+
* @param {number} col The visual column index.
|
18
|
+
* @param {number|string} prop The column property (passed when datasource is an array of objects).
|
19
|
+
* @param {*} value The rendered value.
|
20
|
+
* @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
|
21
|
+
*/
|
22
|
+
exports.RENDERER_TYPE = RENDERER_TYPE;
|
23
|
+
function handsontableRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
24
|
+
_autocompleteRenderer.autocompleteRenderer.apply(this, [instance, TD, row, col, prop, value, cellProperties]);
|
25
|
+
if (instance.getSettings().ariaTags) {
|
26
|
+
(0, _element.setAttribute)(TD, [(0, _a11y.A11Y_HASPOPUP)('true'), (0, _a11y.A11Y_EXPANDED)('false')]);
|
27
|
+
}
|
28
|
+
}
|
29
|
+
handsontableRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
@@ -0,0 +1,24 @@
|
|
1
|
+
import { autocompleteRenderer } from "../autocompleteRenderer/index.mjs";
|
2
|
+
import { A11Y_EXPANDED, A11Y_HASPOPUP } from "../../helpers/a11y.mjs";
|
3
|
+
import { setAttribute } from "../../helpers/dom/element.mjs";
|
4
|
+
export const RENDERER_TYPE = 'handsontable';
|
5
|
+
|
6
|
+
/**
|
7
|
+
* Handsontable renderer.
|
8
|
+
*
|
9
|
+
* @private
|
10
|
+
* @param {Core} instance The Handsontable instance.
|
11
|
+
* @param {HTMLTableCellElement} TD The rendered cell element.
|
12
|
+
* @param {number} row The visual row index.
|
13
|
+
* @param {number} col The visual column index.
|
14
|
+
* @param {number|string} prop The column property (passed when datasource is an array of objects).
|
15
|
+
* @param {*} value The rendered value.
|
16
|
+
* @param {object} cellProperties The cell meta object ({@see Core#getCellMeta}).
|
17
|
+
*/
|
18
|
+
export function handsontableRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
19
|
+
autocompleteRenderer.apply(this, [instance, TD, row, col, prop, value, cellProperties]);
|
20
|
+
if (instance.getSettings().ariaTags) {
|
21
|
+
setAttribute(TD, [A11Y_HASPOPUP('true'), A11Y_EXPANDED('false')]);
|
22
|
+
}
|
23
|
+
}
|
24
|
+
handsontableRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
@@ -0,0 +1 @@
|
|
1
|
+
export { RENDERER_TYPE, handsontableRenderer } from './handsontableRenderer';
|
@@ -0,0 +1 @@
|
|
1
|
+
export { RENDERER_TYPE, handsontableRenderer } from "./handsontableRenderer.mjs";
|
package/renderers/index.d.ts
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
import { autocompleteRenderer, RENDERER_TYPE as AUTOCOMPLETE_RENDERER } from './autocompleteRenderer';
|
2
2
|
import { baseRenderer, RENDERER_TYPE as BASE_RENDERER } from './baseRenderer';
|
3
|
+
import { dateRenderer, RENDERER_TYPE as DATE_RENDERER } from './dateRenderer';
|
3
4
|
import { checkboxRenderer, RENDERER_TYPE as CHECKBOX_RENDERER } from './checkboxRenderer';
|
5
|
+
import { handsontableRenderer, RENDERER_TYPE as HANDSONTABLE_RENDERER } from "./handsontableRenderer";
|
4
6
|
import { htmlRenderer, RENDERER_TYPE as HTML_RENDERER } from './htmlRenderer';
|
5
7
|
import { numericRenderer, RENDERER_TYPE as NUMERIC_RENDERER } from './numericRenderer';
|
6
8
|
import { passwordRenderer, RENDERER_TYPE as PASSWORD_RENDERER } from './passwordRenderer';
|
@@ -14,6 +16,8 @@ export interface Renderers {
|
|
14
16
|
autocomplete: typeof autocompleteRenderer;
|
15
17
|
base: typeof baseRenderer;
|
16
18
|
checkbox: typeof checkboxRenderer;
|
19
|
+
date: typeof dateRenderer;
|
20
|
+
handsontable: typeof handsontableRenderer;
|
17
21
|
html: typeof htmlRenderer;
|
18
22
|
numeric: typeof numericRenderer;
|
19
23
|
password: typeof passwordRenderer;
|
@@ -31,6 +35,8 @@ export {
|
|
31
35
|
autocompleteRenderer, AUTOCOMPLETE_RENDERER,
|
32
36
|
baseRenderer, BASE_RENDERER,
|
33
37
|
checkboxRenderer, CHECKBOX_RENDERER,
|
38
|
+
dateRenderer, DATE_RENDERER,
|
39
|
+
handsontableRenderer, HANDSONTABLE_RENDERER,
|
34
40
|
htmlRenderer, HTML_RENDERER,
|
35
41
|
numericRenderer, NUMERIC_RENDERER,
|
36
42
|
passwordRenderer, PASSWORD_RENDERER,
|
@@ -4,6 +4,7 @@ exports.__esModule = true;
|
|
4
4
|
exports.selectRenderer = selectRenderer;
|
5
5
|
var _textRenderer = require("../textRenderer");
|
6
6
|
var _a11y = require("../../helpers/a11y");
|
7
|
+
var _element = require("../../helpers/dom/element");
|
7
8
|
const RENDERER_TYPE = 'select';
|
8
9
|
|
9
10
|
/**
|
@@ -20,7 +21,7 @@ exports.RENDERER_TYPE = RENDERER_TYPE;
|
|
20
21
|
function selectRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
21
22
|
_textRenderer.textRenderer.apply(this, [instance, TD, row, col, prop, value, cellProperties]);
|
22
23
|
if (instance.getSettings().ariaTags) {
|
23
|
-
|
24
|
+
(0, _element.setAttribute)(TD, ...(0, _a11y.A11Y_HASPOPUP)('listbox'));
|
24
25
|
}
|
25
26
|
}
|
26
27
|
selectRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
@@ -1,5 +1,6 @@
|
|
1
1
|
import { textRenderer } from "../textRenderer/index.mjs";
|
2
2
|
import { A11Y_HASPOPUP } from "../../helpers/a11y.mjs";
|
3
|
+
import { setAttribute } from "../../helpers/dom/element.mjs";
|
3
4
|
export const RENDERER_TYPE = 'select';
|
4
5
|
|
5
6
|
/**
|
@@ -15,7 +16,7 @@ export const RENDERER_TYPE = 'select';
|
|
15
16
|
export function selectRenderer(instance, TD, row, col, prop, value, cellProperties) {
|
16
17
|
textRenderer.apply(this, [instance, TD, row, col, prop, value, cellProperties]);
|
17
18
|
if (instance.getSettings().ariaTags) {
|
18
|
-
|
19
|
+
setAttribute(TD, ...A11Y_HASPOPUP('listbox'));
|
19
20
|
}
|
20
21
|
}
|
21
22
|
selectRenderer.RENDERER_TYPE = RENDERER_TYPE;
|
package/selection/selection.js
CHANGED
@@ -610,8 +610,8 @@ class Selection {
|
|
610
610
|
const nrOfColumns = this.tableProps.countCols();
|
611
611
|
const countRowHeaders = this.tableProps.countRowHeaders();
|
612
612
|
const countColHeaders = this.tableProps.countColHeaders();
|
613
|
-
const rowFrom =
|
614
|
-
const columnFrom =
|
613
|
+
const rowFrom = includeColumnHeaders ? -countColHeaders : 0;
|
614
|
+
const columnFrom = includeRowHeaders ? -countRowHeaders : 0;
|
615
615
|
|
616
616
|
// We can't select cells when there is no data.
|
617
617
|
if (rowFrom === 0 && columnFrom === 0 && (nrOfRows === 0 || nrOfColumns === 0)) {
|
package/selection/selection.mjs
CHANGED
@@ -604,8 +604,8 @@ class Selection {
|
|
604
604
|
const nrOfColumns = this.tableProps.countCols();
|
605
605
|
const countRowHeaders = this.tableProps.countRowHeaders();
|
606
606
|
const countColHeaders = this.tableProps.countColHeaders();
|
607
|
-
const rowFrom =
|
608
|
-
const columnFrom =
|
607
|
+
const rowFrom = includeColumnHeaders ? -countColHeaders : 0;
|
608
|
+
const columnFrom = includeRowHeaders ? -countRowHeaders : 0;
|
609
609
|
|
610
610
|
// We can't select cells when there is no data.
|
611
611
|
if (rowFrom === 0 && columnFrom === 0 && (nrOfRows === 0 || nrOfColumns === 0)) {
|
package/shortcuts/context.js
CHANGED
@@ -49,7 +49,7 @@ const createContext = name => {
|
|
49
49
|
* @param {Function} options.callback The shortcut's action
|
50
50
|
* @param {object} options.group A group of shortcuts to which the shortcut belongs
|
51
51
|
* @param {object} [options.runOnlyIf] A condition on which the shortcut's action runs
|
52
|
-
* @param {object} [options.stopPropagation=
|
52
|
+
* @param {object} [options.stopPropagation=false] If set to `true`: stops the event's propagation
|
53
53
|
* @param {object} [options.captureCtrl=false] If set to `true`: captures the state of the Control/Meta modifier key
|
54
54
|
* @param {object} [options.preventDefault=true] If set to `true`: prevents the default behavior
|
55
55
|
* @param {object} [options.position='after'] The order in which the shortcut's action runs:
|
@@ -126,11 +126,12 @@ const createContext = name => {
|
|
126
126
|
* @param {Function} [options.callback] A shortcut's action
|
127
127
|
* @param {object} [options.group] A group of shortcuts to which a shortcut belongs
|
128
128
|
* @param {object} [options.runOnlyIf] A condition on which a shortcut's action runs
|
129
|
-
* @param {object} [options.stopPropagation=
|
129
|
+
* @param {object} [options.stopPropagation=false] If set to `true`: stops the event's propagation
|
130
130
|
* @param {object} [options.preventDefault=true] If set to `true`: prevents the default behavior
|
131
131
|
* @param {object} [options.position='after'] The order in which a shortcut's action runs:
|
132
132
|
* `'before'` or `'after'` a `relativeToGroup` group of actions
|
133
133
|
* @param {object} [options.relativeToGroup] The name of a group of actions, used to determine an action's `position`
|
134
|
+
* @param {object} [options.forwardToContext] The context object where the event will be forwarded to.
|
134
135
|
*/
|
135
136
|
const addShortcuts = function (shortcuts) {
|
136
137
|
let options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|