@danielgindi/selectbox 1.0.31 → 1.0.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/lib.cjs.js +18 -5
- package/dist/lib.cjs.js.map +1 -1
- package/dist/lib.cjs.min.js +2 -2
- package/dist/lib.cjs.min.js.map +1 -1
- package/dist/lib.es6.js +18 -5
- package/dist/lib.es6.js.map +1 -1
- package/dist/lib.es6.min.js +2 -2
- package/dist/lib.es6.min.js.map +1 -1
- package/dist/lib.umd.js +18 -5
- package/dist/lib.umd.js.map +1 -1
- package/dist/lib.umd.min.js +2 -2
- package/dist/lib.umd.min.js.map +1 -1
- package/lib/SelectBox.js +17 -4
- package/package.json +1 -1
package/lib/SelectBox.js
CHANGED
|
@@ -100,7 +100,9 @@ const inputBackbufferCssProps = [
|
|
|
100
100
|
* @property {string} [multiItemLabelProp='short_label']
|
|
101
101
|
* @property {number} [maxMultiItems] maximum number of multi items. The rest will get a single item to represent.
|
|
102
102
|
* @property {function(count: number, items: DropList.ItemBase[]):string} [multiItemsRestLabelProvider] label for the item representing the rest of the items.
|
|
103
|
-
* @property {DropList.ItemBase[]|null} [items]
|
|
103
|
+
* @property {DropList.ItemBase[]|null} [items] initial items
|
|
104
|
+
* @property {*[]|null} [selectedValues] initial selected values
|
|
105
|
+
* @property {*|*[]|null} [value] initial selected value
|
|
104
106
|
* @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [renderSingleItem]
|
|
105
107
|
* @property {function(item: DropList.ItemBase, itemEl: Element)} [unrenderSingleItem]
|
|
106
108
|
* @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [renderMultiItem]
|
|
@@ -141,6 +143,8 @@ const defaultOptions = {
|
|
|
141
143
|
maxMultiItems: null,
|
|
142
144
|
multiItemsRestLabelProvider: null,
|
|
143
145
|
items: [],
|
|
146
|
+
selectedValues: undefined,
|
|
147
|
+
value: undefined,
|
|
144
148
|
isLoadingMode: false,
|
|
145
149
|
};
|
|
146
150
|
|
|
@@ -239,12 +243,12 @@ class SelectBox {
|
|
|
239
243
|
renderNoResultsItem: o.renderNoResultsItem,
|
|
240
244
|
unrenderNoResultsItem: o.unrenderNoResultsItem,
|
|
241
245
|
filterFn: o.filterFn,
|
|
242
|
-
on:
|
|
246
|
+
on: null,
|
|
243
247
|
additionalClasses: o.additionalClasses,
|
|
244
248
|
|
|
245
249
|
isLoadingMode: !!o.isLoadingMode,
|
|
246
250
|
|
|
247
|
-
items:
|
|
251
|
+
items: [],
|
|
248
252
|
filteredItems: null,
|
|
249
253
|
itemsChanged: true,
|
|
250
254
|
|
|
@@ -338,7 +342,16 @@ class SelectBox {
|
|
|
338
342
|
p.sink.add(window, 'resize', () => this._resizeInput());
|
|
339
343
|
p.sink.add(window, 'orientationchange', () => this._resizeInput());
|
|
340
344
|
|
|
341
|
-
this.setItems(
|
|
345
|
+
this.setItems(o.items);
|
|
346
|
+
|
|
347
|
+
if (o.multi && Array.isArray(o.selectedValues)) {
|
|
348
|
+
this.setSelectedValues(o.selectedValues);
|
|
349
|
+
} else if (o.value != null) {
|
|
350
|
+
this.setValue(o.value);
|
|
351
|
+
}
|
|
352
|
+
|
|
353
|
+
// Start firing events
|
|
354
|
+
p.on = o.on || null;
|
|
342
355
|
|
|
343
356
|
this._scheduleSync();
|
|
344
357
|
|
package/package.json
CHANGED