@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 CHANGED
@@ -1,5 +1,5 @@
1
1
  /*!
2
- * @danielgindi/selectbox 1.0.31
2
+ * @danielgindi/selectbox 1.0.32
3
3
  * git://github.com/danielgindi/selectbox.git
4
4
  */
5
5
  'use strict';
@@ -8104,7 +8104,9 @@ var inputBackbufferCssProps = [
8104
8104
  * @property {string} [multiItemLabelProp='short_label']
8105
8105
  * @property {number} [maxMultiItems] maximum number of multi items. The rest will get a single item to represent.
8106
8106
  * @property {function(count: number, items: DropList.ItemBase[]):string} [multiItemsRestLabelProvider] label for the item representing the rest of the items.
8107
- * @property {DropList.ItemBase[]|null} [items]
8107
+ * @property {DropList.ItemBase[]|null} [items] initial items
8108
+ * @property {*[]|null} [selectedValues] initial selected values
8109
+ * @property {*|*[]|null} [value] initial selected value
8108
8110
  * @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [renderSingleItem]
8109
8111
  * @property {function(item: DropList.ItemBase, itemEl: Element)} [unrenderSingleItem]
8110
8112
  * @property {function(item: DropList.ItemBase, itemEl: Element):(*|false)} [renderMultiItem]
@@ -8145,6 +8147,8 @@ var defaultOptions = {
8145
8147
  maxMultiItems: null,
8146
8148
  multiItemsRestLabelProvider: null,
8147
8149
  items: [],
8150
+ selectedValues: undefined,
8151
+ value: undefined,
8148
8152
  isLoadingMode: false };
8149
8153
 
8150
8154
 
@@ -8243,12 +8247,12 @@ var SelectBox = /*#__PURE__*/function () {
8243
8247
  renderNoResultsItem: o.renderNoResultsItem,
8244
8248
  unrenderNoResultsItem: o.unrenderNoResultsItem,
8245
8249
  filterFn: o.filterFn,
8246
- on: o.on,
8250
+ on: null,
8247
8251
  additionalClasses: o.additionalClasses,
8248
8252
 
8249
8253
  isLoadingMode: !!o.isLoadingMode,
8250
8254
 
8251
- items: o.items || [],
8255
+ items: [],
8252
8256
  filteredItems: null,
8253
8257
  itemsChanged: true,
8254
8258
 
@@ -8342,7 +8346,16 @@ var SelectBox = /*#__PURE__*/function () {
8342
8346
  p.sink.add(window, 'resize', function () {return _this._resizeInput();});
8343
8347
  p.sink.add(window, 'orientationchange', function () {return _this._resizeInput();});
8344
8348
 
8345
- this.setItems(p.items);
8349
+ this.setItems(o.items);
8350
+
8351
+ if (o.multi && Array.isArray(o.selectedValues)) {
8352
+ this.setSelectedValues(o.selectedValues);
8353
+ } else if (o.value != null) {
8354
+ this.setValue(o.value);
8355
+ }
8356
+
8357
+ // Start firing events
8358
+ p.on = o.on || null;
8346
8359
 
8347
8360
  this._scheduleSync();
8348
8361