handsontable 0.0.0-next-9379dd1-20231020 → 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/dist/handsontable.css +13 -12
- package/dist/handsontable.full.css +13 -12
- package/dist/handsontable.full.js +1864 -1143
- package/dist/handsontable.full.min.css +5 -5
- package/dist/handsontable.full.min.js +70 -70
- package/dist/handsontable.js +1864 -1143
- package/dist/handsontable.min.css +5 -5
- package/dist/handsontable.min.js +24 -24
- package/helpers/mixed.js +1 -1
- package/helpers/mixed.mjs +1 -1
- package/package.json +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/shortcuts/context.js +3 -2
- package/shortcuts/context.mjs +3 -2
- package/utils/paginator.js +151 -0
- package/utils/paginator.mjs +147 -0
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
exports.__esModule = true;
|
4
4
|
require("core-js/modules/es.array.push.js");
|
5
|
+
require("core-js/modules/es.error.cause.js");
|
5
6
|
var _element = require("../../../helpers/dom/element");
|
6
7
|
var _object = require("../../../helpers/object");
|
7
8
|
var _array = require("../../../helpers/array");
|
@@ -10,80 +11,158 @@ var _function = require("../../../helpers/function");
|
|
10
11
|
var _data = require("../../../helpers/data");
|
11
12
|
var C = _interopRequireWildcard(require("../../../i18n/constants"));
|
12
13
|
var _event = require("../../../helpers/dom/event");
|
13
|
-
var _base =
|
14
|
-
var _input =
|
15
|
-
var _link =
|
14
|
+
var _base = require("./_base");
|
15
|
+
var _input = require("./input");
|
16
|
+
var _link = require("./link");
|
16
17
|
var _utils = require("../utils");
|
17
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
18
18
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
19
19
|
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; }
|
20
|
-
|
20
|
+
function _classPrivateMethodInitSpec(obj, privateSet) { _checkPrivateRedeclaration(obj, privateSet); privateSet.add(obj); }
|
21
|
+
function _classPrivateFieldInitSpec(obj, privateMap, value) { _checkPrivateRedeclaration(obj, privateMap); privateMap.set(obj, value); }
|
22
|
+
function _checkPrivateRedeclaration(obj, privateCollection) { if (privateCollection.has(obj)) { throw new TypeError("Cannot initialize the same private elements twice on an object"); } }
|
23
|
+
function _classPrivateMethodGet(receiver, privateSet, fn) { if (!privateSet.has(receiver)) { throw new TypeError("attempted to get private field on non-instance"); } return fn; }
|
24
|
+
function _classPrivateFieldGet(receiver, privateMap) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "get"); return _classApplyDescriptorGet(receiver, descriptor); }
|
25
|
+
function _classApplyDescriptorGet(receiver, descriptor) { if (descriptor.get) { return descriptor.get.call(receiver); } return descriptor.value; }
|
26
|
+
function _classPrivateFieldSet(receiver, privateMap, value) { var descriptor = _classExtractFieldDescriptor(receiver, privateMap, "set"); _classApplyDescriptorSet(receiver, descriptor, value); return value; }
|
27
|
+
function _classExtractFieldDescriptor(receiver, privateMap, action) { if (!privateMap.has(receiver)) { throw new TypeError("attempted to " + action + " private field on non-instance"); } return privateMap.get(receiver); }
|
28
|
+
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; } }
|
21
29
|
const SHORTCUTS_GROUP = 'multipleSelect.itemBox';
|
22
30
|
|
23
31
|
/**
|
24
32
|
* @private
|
25
33
|
* @class MultipleSelectUI
|
26
34
|
*/
|
27
|
-
|
35
|
+
var _items = /*#__PURE__*/new WeakMap();
|
36
|
+
var _itemsBox = /*#__PURE__*/new WeakMap();
|
37
|
+
var _locale = /*#__PURE__*/new WeakMap();
|
38
|
+
var _searchInput = /*#__PURE__*/new WeakMap();
|
39
|
+
var _selectAllUI = /*#__PURE__*/new WeakMap();
|
40
|
+
var _clearAllUI = /*#__PURE__*/new WeakMap();
|
41
|
+
var _onInput = /*#__PURE__*/new WeakSet();
|
42
|
+
var _onInputKeyDown = /*#__PURE__*/new WeakSet();
|
43
|
+
var _onSelectAllClick = /*#__PURE__*/new WeakSet();
|
44
|
+
var _onClearAllClick = /*#__PURE__*/new WeakSet();
|
45
|
+
class MultipleSelectUI extends _base.BaseUI {
|
28
46
|
static get DEFAULTS() {
|
29
47
|
return (0, _object.clone)({
|
30
48
|
className: 'htUIMultipleSelect',
|
31
49
|
value: []
|
32
50
|
});
|
33
51
|
}
|
52
|
+
|
53
|
+
/**
|
54
|
+
* List of available select options.
|
55
|
+
*
|
56
|
+
* @type {Array}
|
57
|
+
*/
|
58
|
+
|
34
59
|
constructor(hotInstance, options) {
|
35
60
|
super(hotInstance, (0, _object.extend)(MultipleSelectUI.DEFAULTS, options));
|
36
|
-
privatePool.set(this, {});
|
37
61
|
/**
|
38
|
-
*
|
62
|
+
* On click listener for "Clear" link.
|
39
63
|
*
|
40
|
-
* @
|
64
|
+
* @param {DOMEvent} event The mouse event object.
|
41
65
|
*/
|
42
|
-
|
43
|
-
|
44
|
-
|
66
|
+
_classPrivateMethodInitSpec(this, _onClearAllClick);
|
67
|
+
/**
|
68
|
+
* On click listener for "Select all" link.
|
69
|
+
*
|
70
|
+
* @param {DOMEvent} event The mouse event object.
|
71
|
+
*/
|
72
|
+
_classPrivateMethodInitSpec(this, _onSelectAllClick);
|
73
|
+
/**
|
74
|
+
* 'keydown' event listener for input element.
|
75
|
+
*
|
76
|
+
* @param {Event} event DOM event.
|
77
|
+
*/
|
78
|
+
_classPrivateMethodInitSpec(this, _onInputKeyDown);
|
79
|
+
/**
|
80
|
+
* 'input' event listener for input element.
|
81
|
+
*
|
82
|
+
* @param {Event} event DOM event.
|
83
|
+
*/
|
84
|
+
_classPrivateMethodInitSpec(this, _onInput);
|
85
|
+
_classPrivateFieldInitSpec(this, _items, {
|
86
|
+
writable: true,
|
87
|
+
value: []
|
45
88
|
});
|
46
89
|
/**
|
47
|
-
*
|
90
|
+
* Handsontable instance used as items list element.
|
48
91
|
*
|
49
|
-
* @type {
|
92
|
+
* @type {Handsontable}
|
50
93
|
*/
|
51
|
-
|
52
|
-
|
53
|
-
|
94
|
+
_classPrivateFieldInitSpec(this, _itemsBox, {
|
95
|
+
writable: true,
|
96
|
+
value: void 0
|
54
97
|
});
|
55
98
|
/**
|
56
|
-
*
|
99
|
+
* A locale for the component used to compare filtered values.
|
57
100
|
*
|
58
|
-
* @type {
|
101
|
+
* @type {string}
|
59
102
|
*/
|
60
|
-
|
61
|
-
|
62
|
-
|
103
|
+
_classPrivateFieldInitSpec(this, _locale, {
|
104
|
+
writable: true,
|
105
|
+
value: void 0
|
63
106
|
});
|
64
107
|
/**
|
65
|
-
*
|
108
|
+
* Input element.
|
66
109
|
*
|
67
|
-
* @type {
|
110
|
+
* @type {InputUI}
|
68
111
|
*/
|
69
|
-
this
|
112
|
+
_classPrivateFieldInitSpec(this, _searchInput, {
|
113
|
+
writable: true,
|
114
|
+
value: void 0
|
115
|
+
});
|
70
116
|
/**
|
71
|
-
*
|
117
|
+
* "Select all" UI element.
|
72
118
|
*
|
73
|
-
* @type {
|
119
|
+
* @type {LinkUI}
|
120
|
+
*/
|
121
|
+
_classPrivateFieldInitSpec(this, _selectAllUI, {
|
122
|
+
writable: true,
|
123
|
+
value: void 0
|
124
|
+
});
|
125
|
+
/**
|
126
|
+
* "Clear" UI element.
|
127
|
+
*
|
128
|
+
* @type {LinkUI}
|
74
129
|
*/
|
75
|
-
this
|
130
|
+
_classPrivateFieldInitSpec(this, _clearAllUI, {
|
131
|
+
writable: true,
|
132
|
+
value: void 0
|
133
|
+
});
|
134
|
+
_classPrivateFieldSet(this, _searchInput, new _input.InputUI(this.hot, {
|
135
|
+
placeholder: C.FILTERS_BUTTONS_PLACEHOLDER_SEARCH,
|
136
|
+
className: 'htUIMultipleSelectSearch'
|
137
|
+
}));
|
138
|
+
_classPrivateFieldSet(this, _selectAllUI, new _link.LinkUI(this.hot, {
|
139
|
+
textContent: C.FILTERS_BUTTONS_SELECT_ALL,
|
140
|
+
className: 'htUISelectAll'
|
141
|
+
}));
|
142
|
+
_classPrivateFieldSet(this, _clearAllUI, new _link.LinkUI(this.hot, {
|
143
|
+
textContent: C.FILTERS_BUTTONS_CLEAR,
|
144
|
+
className: 'htUIClearAll'
|
145
|
+
}));
|
76
146
|
this.registerHooks();
|
77
147
|
}
|
78
148
|
|
149
|
+
/**
|
150
|
+
* Gets the instance of the internal Handsontable that acts here as a listbox component.
|
151
|
+
*
|
152
|
+
* @returns {Handsontable}
|
153
|
+
*/
|
154
|
+
getItemsBox() {
|
155
|
+
return _classPrivateFieldGet(this, _itemsBox);
|
156
|
+
}
|
157
|
+
|
79
158
|
/**
|
80
159
|
* Register all necessary hooks.
|
81
160
|
*/
|
82
161
|
registerHooks() {
|
83
|
-
this.
|
84
|
-
this.
|
85
|
-
this.
|
86
|
-
this.
|
162
|
+
_classPrivateFieldGet(this, _searchInput).addLocalHook('keydown', event => _classPrivateMethodGet(this, _onInputKeyDown, _onInputKeyDown2).call(this, event));
|
163
|
+
_classPrivateFieldGet(this, _searchInput).addLocalHook('input', event => _classPrivateMethodGet(this, _onInput, _onInput2).call(this, event));
|
164
|
+
_classPrivateFieldGet(this, _selectAllUI).addLocalHook('click', event => _classPrivateMethodGet(this, _onSelectAllClick, _onSelectAllClick2).call(this, event));
|
165
|
+
_classPrivateFieldGet(this, _clearAllUI).addLocalHook('click', event => _classPrivateMethodGet(this, _onClearAllClick, _onClearAllClick2).call(this, event));
|
87
166
|
}
|
88
167
|
|
89
168
|
/**
|
@@ -92,9 +171,9 @@ class MultipleSelectUI extends _base.default {
|
|
92
171
|
* @param {Array} items Array of objects with `checked` and `label` property.
|
93
172
|
*/
|
94
173
|
setItems(items) {
|
95
|
-
this
|
96
|
-
if (this
|
97
|
-
this.
|
174
|
+
_classPrivateFieldSet(this, _items, items);
|
175
|
+
if (_classPrivateFieldGet(this, _itemsBox)) {
|
176
|
+
_classPrivateFieldGet(this, _itemsBox).loadData(_classPrivateFieldGet(this, _items));
|
98
177
|
}
|
99
178
|
}
|
100
179
|
|
@@ -104,7 +183,7 @@ class MultipleSelectUI extends _base.default {
|
|
104
183
|
* @param {string} locale Locale used for filter actions performed on data, ie. `en-US`.
|
105
184
|
*/
|
106
185
|
setLocale(locale) {
|
107
|
-
this
|
186
|
+
_classPrivateFieldSet(this, _locale, locale);
|
108
187
|
}
|
109
188
|
|
110
189
|
/**
|
@@ -113,7 +192,7 @@ class MultipleSelectUI extends _base.default {
|
|
113
192
|
* @returns {string}
|
114
193
|
*/
|
115
194
|
getLocale() {
|
116
|
-
return this
|
195
|
+
return _classPrivateFieldGet(this, _locale);
|
117
196
|
}
|
118
197
|
|
119
198
|
/**
|
@@ -122,7 +201,7 @@ class MultipleSelectUI extends _base.default {
|
|
122
201
|
* @returns {Array}
|
123
202
|
*/
|
124
203
|
getItems() {
|
125
|
-
return [...this
|
204
|
+
return [..._classPrivateFieldGet(this, _items)];
|
126
205
|
}
|
127
206
|
|
128
207
|
/**
|
@@ -131,7 +210,34 @@ class MultipleSelectUI extends _base.default {
|
|
131
210
|
* @returns {Array} Array of selected values.
|
132
211
|
*/
|
133
212
|
getValue() {
|
134
|
-
return itemsToValue(this
|
213
|
+
return itemsToValue(_classPrivateFieldGet(this, _items));
|
214
|
+
}
|
215
|
+
|
216
|
+
/**
|
217
|
+
* Gets the instance of the search input element.
|
218
|
+
*
|
219
|
+
* @returns {InputUI}
|
220
|
+
*/
|
221
|
+
getSearchInputElement() {
|
222
|
+
return _classPrivateFieldGet(this, _searchInput);
|
223
|
+
}
|
224
|
+
|
225
|
+
/**
|
226
|
+
* Gets the instance of the "select all" link element.
|
227
|
+
*
|
228
|
+
* @returns {LinkUI}
|
229
|
+
*/
|
230
|
+
getSelectAllElement() {
|
231
|
+
return _classPrivateFieldGet(this, _selectAllUI);
|
232
|
+
}
|
233
|
+
|
234
|
+
/**
|
235
|
+
* Gets the instance of the "clear" link element.
|
236
|
+
*
|
237
|
+
* @returns {LinkUI}
|
238
|
+
*/
|
239
|
+
getClearAllElement() {
|
240
|
+
return _classPrivateFieldGet(this, _clearAllUI);
|
135
241
|
}
|
136
242
|
|
137
243
|
/**
|
@@ -140,7 +246,7 @@ class MultipleSelectUI extends _base.default {
|
|
140
246
|
* @returns {boolean}
|
141
247
|
*/
|
142
248
|
isSelectedAllValues() {
|
143
|
-
return this.
|
249
|
+
return _classPrivateFieldGet(this, _items).length === this.getValue().length;
|
144
250
|
}
|
145
251
|
|
146
252
|
/**
|
@@ -152,24 +258,24 @@ class MultipleSelectUI extends _base.default {
|
|
152
258
|
rootDocument
|
153
259
|
} = this.hot;
|
154
260
|
const itemsBoxWrapper = rootDocument.createElement('div');
|
155
|
-
const selectionControl = new _base.
|
261
|
+
const selectionControl = new _base.BaseUI(this.hot, {
|
156
262
|
className: 'htUISelectionControls',
|
157
|
-
children: [this
|
263
|
+
children: [_classPrivateFieldGet(this, _selectAllUI), _classPrivateFieldGet(this, _clearAllUI)]
|
158
264
|
});
|
159
|
-
this._element.appendChild(this.
|
265
|
+
this._element.appendChild(_classPrivateFieldGet(this, _searchInput).element);
|
160
266
|
this._element.appendChild(selectionControl.element);
|
161
267
|
this._element.appendChild(itemsBoxWrapper);
|
162
268
|
const hotInitializer = wrapper => {
|
163
269
|
if (!this._element) {
|
164
270
|
return;
|
165
271
|
}
|
166
|
-
if (this
|
167
|
-
this.
|
272
|
+
if (_classPrivateFieldGet(this, _itemsBox)) {
|
273
|
+
_classPrivateFieldGet(this, _itemsBox).destroy();
|
168
274
|
}
|
169
275
|
(0, _element.addClass)(wrapper, 'htUIMultipleSelectHot');
|
170
276
|
// Constructs and initializes a new Handsontable instance
|
171
|
-
this
|
172
|
-
data: this
|
277
|
+
_classPrivateFieldSet(this, _itemsBox, new this.hot.constructor(wrapper, {
|
278
|
+
data: _classPrivateFieldGet(this, _items),
|
173
279
|
columns: [{
|
174
280
|
data: 'checked',
|
175
281
|
type: 'checkbox',
|
@@ -181,11 +287,17 @@ class MultipleSelectUI extends _base.default {
|
|
181
287
|
beforeRenderer: (TD, row, col, prop, value, cellProperties) => {
|
182
288
|
TD.title = cellProperties.instance.getDataAtRowProp(row, cellProperties.label.property);
|
183
289
|
},
|
290
|
+
afterListen: () => {
|
291
|
+
this.runLocalHooks('focus', this);
|
292
|
+
},
|
293
|
+
beforeOnCellMouseUp: () => {
|
294
|
+
_classPrivateFieldGet(this, _itemsBox).listen();
|
295
|
+
},
|
184
296
|
maxCols: 1,
|
185
297
|
autoWrapCol: true,
|
186
298
|
height: 110,
|
187
299
|
// Workaround for #151.
|
188
|
-
colWidths: () => this.
|
300
|
+
colWidths: () => _classPrivateFieldGet(this, _itemsBox).container.scrollWidth - (0, _element.getScrollbarWidth)(rootDocument),
|
189
301
|
copyPaste: false,
|
190
302
|
disableVisualSelection: 'area',
|
191
303
|
fillHandle: false,
|
@@ -195,30 +307,49 @@ class MultipleSelectUI extends _base.default {
|
|
195
307
|
col: 0
|
196
308
|
},
|
197
309
|
layoutDirection: this.hot.isRtl() ? 'rtl' : 'ltr'
|
198
|
-
});
|
199
|
-
this.
|
200
|
-
const shortcutManager = this.
|
310
|
+
}));
|
311
|
+
_classPrivateFieldGet(this, _itemsBox).init();
|
312
|
+
const shortcutManager = _classPrivateFieldGet(this, _itemsBox).getShortcutManager();
|
201
313
|
const gridContext = shortcutManager.getContext('grid');
|
314
|
+
gridContext.removeShortcutsByKeys(['Tab']);
|
315
|
+
gridContext.removeShortcutsByKeys(['Shift', 'Tab']);
|
202
316
|
gridContext.addShortcut({
|
203
|
-
// TODO: Is this shortcut really needed? We have one test for that case, but focus is performed programmatically.
|
204
317
|
keys: [['Escape']],
|
205
318
|
callback: event => {
|
206
319
|
this.runLocalHooks('keydown', event, this);
|
207
320
|
},
|
208
321
|
group: SHORTCUTS_GROUP
|
209
322
|
});
|
323
|
+
gridContext.addShortcut({
|
324
|
+
keys: [['Tab'], ['Shift', 'Tab']],
|
325
|
+
callback: event => {
|
326
|
+
_classPrivateFieldGet(this, _itemsBox).deselectCell();
|
327
|
+
this.runLocalHooks('keydown', event, this);
|
328
|
+
this.runLocalHooks('listTabKeydown', event, this);
|
329
|
+
},
|
330
|
+
group: SHORTCUTS_GROUP
|
331
|
+
});
|
210
332
|
};
|
211
333
|
hotInitializer(itemsBoxWrapper);
|
212
|
-
|
334
|
+
this.hot._registerTimeout(() => hotInitializer(itemsBoxWrapper), 100);
|
335
|
+
}
|
336
|
+
|
337
|
+
/**
|
338
|
+
* Focus element.
|
339
|
+
*/
|
340
|
+
focus() {
|
341
|
+
if (this.isBuilt()) {
|
342
|
+
_classPrivateFieldGet(this, _itemsBox).listen();
|
343
|
+
}
|
213
344
|
}
|
214
345
|
|
215
346
|
/**
|
216
347
|
* Reset DOM structure.
|
217
348
|
*/
|
218
349
|
reset() {
|
219
|
-
this.
|
220
|
-
this.
|
221
|
-
this.
|
350
|
+
_classPrivateFieldGet(this, _searchInput).reset();
|
351
|
+
_classPrivateFieldGet(this, _selectAllUI).reset();
|
352
|
+
_classPrivateFieldGet(this, _clearAllUI).reset();
|
222
353
|
}
|
223
354
|
|
224
355
|
/**
|
@@ -228,7 +359,7 @@ class MultipleSelectUI extends _base.default {
|
|
228
359
|
if (!this.isBuilt()) {
|
229
360
|
return;
|
230
361
|
}
|
231
|
-
this.
|
362
|
+
_classPrivateFieldGet(this, _itemsBox).loadData(valueToItems(_classPrivateFieldGet(this, _items), this.options.value));
|
232
363
|
super.update();
|
233
364
|
}
|
234
365
|
|
@@ -236,85 +367,59 @@ class MultipleSelectUI extends _base.default {
|
|
236
367
|
* Destroy instance.
|
237
368
|
*/
|
238
369
|
destroy() {
|
239
|
-
if (this
|
240
|
-
this.
|
370
|
+
if (_classPrivateFieldGet(this, _itemsBox)) {
|
371
|
+
_classPrivateFieldGet(this, _itemsBox).destroy();
|
241
372
|
}
|
242
|
-
this.
|
243
|
-
this.
|
244
|
-
this.
|
245
|
-
this
|
246
|
-
this
|
247
|
-
this
|
248
|
-
this
|
249
|
-
this
|
373
|
+
_classPrivateFieldGet(this, _searchInput).destroy();
|
374
|
+
_classPrivateFieldGet(this, _clearAllUI).destroy();
|
375
|
+
_classPrivateFieldGet(this, _selectAllUI).destroy();
|
376
|
+
_classPrivateFieldSet(this, _searchInput, null);
|
377
|
+
_classPrivateFieldSet(this, _clearAllUI, null);
|
378
|
+
_classPrivateFieldSet(this, _selectAllUI, null);
|
379
|
+
_classPrivateFieldSet(this, _itemsBox, null);
|
380
|
+
_classPrivateFieldSet(this, _items, null);
|
250
381
|
super.destroy();
|
251
382
|
}
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
261
|
-
let filteredItems;
|
262
|
-
if (value === '') {
|
263
|
-
filteredItems = [...this.items];
|
264
|
-
} else {
|
265
|
-
filteredItems = (0, _array.arrayFilter)(this.items, item => `${item.value}`.toLocaleLowerCase(this.getLocale()).indexOf(value) >= 0);
|
266
|
-
}
|
267
|
-
this.itemsBox.loadData(filteredItems);
|
268
|
-
}
|
269
|
-
|
270
|
-
/**
|
271
|
-
* 'keydown' event listener for input element.
|
272
|
-
*
|
273
|
-
* @private
|
274
|
-
* @param {Event} event DOM event.
|
275
|
-
*/
|
276
|
-
onInputKeyDown(event) {
|
277
|
-
this.runLocalHooks('keydown', event, this);
|
278
|
-
const isKeyCode = (0, _function.partial)(_unicode.isKey, event.keyCode);
|
279
|
-
if (isKeyCode('ARROW_DOWN|TAB') && !this.itemsBox.isListening()) {
|
280
|
-
(0, _event.stopImmediatePropagation)(event);
|
281
|
-
this.itemsBox.listen();
|
282
|
-
this.itemsBox.selectCell(0, 0);
|
283
|
-
}
|
284
|
-
}
|
285
|
-
|
286
|
-
/**
|
287
|
-
* On click listener for "Select all" link.
|
288
|
-
*
|
289
|
-
* @private
|
290
|
-
* @param {DOMEvent} event The mouse event object.
|
291
|
-
*/
|
292
|
-
onSelectAllClick(event) {
|
293
|
-
const changes = [];
|
294
|
-
event.preventDefault();
|
295
|
-
(0, _array.arrayEach)(this.itemsBox.getSourceData(), (row, rowIndex) => {
|
296
|
-
row.checked = true;
|
297
|
-
changes.push((0, _data.dataRowToChangesArray)(row, rowIndex)[0]);
|
298
|
-
});
|
299
|
-
this.itemsBox.setSourceDataAtCell(changes);
|
383
|
+
}
|
384
|
+
exports.MultipleSelectUI = MultipleSelectUI;
|
385
|
+
function _onInput2(event) {
|
386
|
+
const value = event.target.value.toLocaleLowerCase(this.getLocale());
|
387
|
+
let filteredItems;
|
388
|
+
if (value === '') {
|
389
|
+
filteredItems = [..._classPrivateFieldGet(this, _items)];
|
390
|
+
} else {
|
391
|
+
filteredItems = (0, _array.arrayFilter)(_classPrivateFieldGet(this, _items), item => `${item.value}`.toLocaleLowerCase(this.getLocale()).indexOf(value) >= 0);
|
300
392
|
}
|
301
|
-
|
302
|
-
|
303
|
-
|
304
|
-
|
305
|
-
|
306
|
-
|
307
|
-
*/
|
308
|
-
onClearAllClick(event) {
|
309
|
-
const changes = [];
|
393
|
+
_classPrivateFieldGet(this, _itemsBox).loadData(filteredItems);
|
394
|
+
}
|
395
|
+
function _onInputKeyDown2(event) {
|
396
|
+
this.runLocalHooks('keydown', event, this);
|
397
|
+
const isKeyCode = (0, _function.partial)(_unicode.isKey, event.keyCode);
|
398
|
+
if (isKeyCode('ARROW_DOWN')) {
|
310
399
|
event.preventDefault();
|
311
|
-
(0,
|
312
|
-
|
313
|
-
|
314
|
-
});
|
315
|
-
this.itemsBox.setSourceDataAtCell(changes);
|
400
|
+
(0, _event.stopImmediatePropagation)(event);
|
401
|
+
_classPrivateFieldGet(this, _itemsBox).listen();
|
402
|
+
_classPrivateFieldGet(this, _itemsBox).selectCell(0, 0);
|
316
403
|
}
|
317
404
|
}
|
405
|
+
function _onSelectAllClick2(event) {
|
406
|
+
const changes = [];
|
407
|
+
event.preventDefault();
|
408
|
+
(0, _array.arrayEach)(_classPrivateFieldGet(this, _itemsBox).getSourceData(), (row, rowIndex) => {
|
409
|
+
row.checked = true;
|
410
|
+
changes.push((0, _data.dataRowToChangesArray)(row, rowIndex)[0]);
|
411
|
+
});
|
412
|
+
_classPrivateFieldGet(this, _itemsBox).setSourceDataAtCell(changes);
|
413
|
+
}
|
414
|
+
function _onClearAllClick2(event) {
|
415
|
+
const changes = [];
|
416
|
+
event.preventDefault();
|
417
|
+
(0, _array.arrayEach)(_classPrivateFieldGet(this, _itemsBox).getSourceData(), (row, rowIndex) => {
|
418
|
+
row.checked = false;
|
419
|
+
changes.push((0, _data.dataRowToChangesArray)(row, rowIndex)[0]);
|
420
|
+
});
|
421
|
+
_classPrivateFieldGet(this, _itemsBox).setSourceDataAtCell(changes);
|
422
|
+
}
|
318
423
|
var _default = MultipleSelectUI;
|
319
424
|
/**
|
320
425
|
* Pick up object items based on selected values.
|