@danielgindi/selectbox 2.0.9 → 2.0.11

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/vue/SelectBox.vue CHANGED
@@ -1,907 +1,907 @@
1
1
  <template>
2
- <span ref="el" />
2
+ <span ref="el" />
3
3
  </template>
4
4
 
5
5
  <script>
6
- import { version } from 'vue';
7
- import SelectBox from '../lib/SelectBox';
8
- import { createSlotBasedRenderFunc, createSlotBasedUnrenderFunc } from './utils/slots';
9
- import deepEqual from 'fast-deep-equal';
10
-
11
- const isVue3 = version > '3.';
12
-
13
- /**
14
- * Events:
15
- * 'clear:before': `{cancel: false}` - will clear the whole selection. return false to abort.
16
- * 'clear': clearead the whole selection.
17
- * 'open': `{ list: DropList `}: the drop list is opening
18
- * 'open:before': `{ list: DropList `}: the drop list will open
19
- * 'close': the drop list is closing
20
- * 'addsel:before': `{value, item, cancel: false}` - an item selection is about to be added (in multi mode). return false to abort.
21
- * 'removesel:before: `{value, item, cancel: false}` - an item selection is about to be removed (in multi mode). return false to abort.
22
- * 'select:before': `{value, item, cancel: false}` - an item is about to be selected (in single mode). return false to abort.
23
- * 'addsel': `{value, item}` - an item selection has been added (in multi mode)
24
- * 'removesel': `{value, item}` - an item selection has been removed (in multi mode)
25
- * 'select': `{value, item}` - an item has been selected (in single mode)
26
- * 'search': `string` - input box value has changed
27
- * 'search:focus': input box has gained focus
28
- * 'search:blur': input box has lost focus
29
- * 'input:resize': input box resized
30
- * 'input' (Vue v2): (on select, clear, addsel, removesel) - fired after any of the above events.
31
- * 'update:modelValue' (Vue v3): (on select, clear, addsel, removesel) - fired after any of the above events.
32
- * 'itemschanged': `{term, mutated, count}` = the current set of items has changed
33
- *
34
- * Slots:
35
- * list-item, single-item, multi-item, rest-multi-item, no-results-item
36
- */
37
-
38
- export default {
39
- inheritAttrs: false,
40
-
41
- props: {
42
- disabled: {
43
- type: Boolean,
44
- default: false,
45
- },
46
- clearable: {
47
- type: Boolean,
48
- default: true,
49
- },
50
- hasOpenIndicator: {
51
- type: Boolean,
52
- default: true,
53
- },
54
- placeholder: {
55
- type: String,
56
- default: '',
57
- },
58
- sortSelectedItems: {
59
- type: Boolean,
60
- default: true,
61
- },
62
- sortListItems: {
63
- type: Boolean,
64
- default: false,
65
- },
66
- sortListCheckedFirst: {
67
- type: Boolean,
68
- default: true,
69
- },
70
- stickyValues: {
71
- type: Array,
72
- required: false,
73
- },
74
- sortItemComparator: {
75
- type: Function,
76
- required: false,
77
- },
78
- splitListCheckedGroups: {
79
- type: Boolean,
80
- default: true,
81
- },
82
- showSelection: {
83
- type: Boolean,
84
- default: true,
85
- },
86
- showPlaceholderInTooltip: {
87
- type: Boolean,
88
- default: true,
89
- },
90
- multiPlaceholderFormatter: {
91
- type: Function,
92
- required: false,
93
- default: undefined,
94
- },
95
- blurOnSingleSelection: {
96
- type: [Boolean, String],
97
- default: 'touch',
98
- validator: value => {
99
- return [true, false, 'touch', null].includes(value);
100
- },
101
- },
102
- multi: {
103
- type: Boolean,
104
- default: false,
105
- },
106
- searchable: {
107
- type: Boolean,
108
- default: true,
109
- },
110
- noResultsText: {
111
- type: String,
112
- default: 'No matching results',
113
- },
114
- filterThrottleWindow: {
115
- type: Number,
116
- default: 300,
117
- },
118
- filterOnEmptyTerm: {
119
- type: Boolean,
120
- default: false,
121
- },
122
- filterFn: {
123
- type: Function,
124
- default: undefined,
125
- },
126
- // eslint-disable-next-line vue/require-prop-types
127
- filterDependencies: {
128
- default: undefined,
129
- },
130
- labelProp: {
131
- type: String,
132
- default: 'label',
133
- },
134
- valueProp: {
135
- type: String,
136
- default: 'value',
137
- },
138
- multiItemLabelProp: {
139
- type: String,
140
- default: 'short_label',
141
- },
142
- items: {
143
- type: Array,
144
- default: () => [],
145
- },
146
- [isVue3 ? 'modelValue' : 'value']: {
147
- type: [String, Number, Boolean, Object, Array, Symbol],
148
- default: undefined,
149
- },
150
- maxMultiItems: {
151
- type: Number,
152
- required: false,
153
- },
154
- multiItemsRestLabelProvider: {
155
- type: Function,
156
- required: false,
157
- },
158
- renderSingleItem: {
159
- type: Function,
160
- default: undefined,
161
- },
162
- unrenderSingleItem: {
163
- type: Function,
164
- default: undefined,
165
- },
166
- renderMultiItem: {
167
- type: Function,
168
- default: undefined,
169
- },
170
- unrenderMultiItem: {
171
- type: Function,
172
- default: undefined,
173
- },
174
- renderRestMultiItem: {
175
- type: Function,
176
- default: undefined,
177
- },
178
- unrenderRestMultiItem: {
179
- type: Function,
180
- default: undefined,
181
- },
182
- renderNoResultsItem: {
183
- type: Function,
184
- default: undefined,
185
- },
186
- unrenderNoResultsItem: {
187
- type: Function,
188
- default: undefined,
189
- },
190
- renderListItem: {
191
- type: Function,
192
- default: undefined,
193
- },
194
- unrenderListItem: {
195
- type: Function,
196
- default: undefined,
197
- },
198
- virtualMinItems: {
199
- type: Number,
200
- default: 10,
201
- },
202
- baseClass: {
203
- type: String,
204
- default: undefined,
205
- },
206
- droplistBaseClass: {
207
- type: String,
208
- default: undefined,
209
- },
210
- additionalClasses: {
211
- type: [Object, Array, String],
212
- default: undefined,
213
- },
214
- additionalDroplistClasses: {
215
- type: [Object, Array, String],
216
- default: undefined,
217
- },
218
- direction: {
219
- type: String,
220
- default: undefined,
221
- },
222
- fixedDroplistWidth: {
223
- type: Boolean,
224
- default: false,
225
- },
226
- acceptNullAsValue: {
227
- type: Boolean,
228
- default: false,
229
- },
230
- emitNullForEmptyValue: {
231
- type: Boolean,
232
- default: false,
233
- },
234
- isLoadingMode: {
235
- type: Boolean,
236
- default: false,
237
- },
238
- treatGroupSelectionAsItems: {
239
- type: Boolean,
240
- default: false,
241
- },
242
- autoCheckGroupChildren: {
243
- type: Boolean,
244
- default: true,
245
- },
246
- constrainListToWindow: {
247
- type: Boolean,
248
- default: true,
249
- },
250
- autoFlipListDirection: {
251
- type: Boolean,
252
- default: true,
6
+ import { version } from 'vue';
7
+ import SelectBox from '../lib/SelectBox';
8
+ import { createSlotBasedRenderFunc, createSlotBasedUnrenderFunc } from './utils/slots';
9
+ import deepEqual from 'fast-deep-equal';
10
+
11
+ const isVue3 = version > '3.';
12
+
13
+ /**
14
+ * Events:
15
+ * 'clear:before': `{cancel: false}` - will clear the whole selection. return false to abort.
16
+ * 'clear': clearead the whole selection.
17
+ * 'open': `{ list: DropList `}: the drop list is opening
18
+ * 'open:before': `{ list: DropList `}: the drop list will open
19
+ * 'close': the drop list is closing
20
+ * 'addsel:before': `{value, item, cancel: false}` - an item selection is about to be added (in multi mode). return false to abort.
21
+ * 'removesel:before: `{value, item, cancel: false}` - an item selection is about to be removed (in multi mode). return false to abort.
22
+ * 'select:before': `{value, item, cancel: false}` - an item is about to be selected (in single mode). return false to abort.
23
+ * 'addsel': `{value, item}` - an item selection has been added (in multi mode)
24
+ * 'removesel': `{value, item}` - an item selection has been removed (in multi mode)
25
+ * 'select': `{value, item}` - an item has been selected (in single mode)
26
+ * 'search': `string` - input box value has changed
27
+ * 'search:focus': input box has gained focus
28
+ * 'search:blur': input box has lost focus
29
+ * 'input:resize': input box resized
30
+ * 'input' (Vue v2): (on select, clear, addsel, removesel) - fired after any of the above events.
31
+ * 'update:modelValue' (Vue v3): (on select, clear, addsel, removesel) - fired after any of the above events.
32
+ * 'itemschanged': `{term, mutated, count}` = the current set of items has changed
33
+ *
34
+ * Slots:
35
+ * list-item, single-item, multi-item, rest-multi-item, no-results-item
36
+ */
37
+
38
+ export default {
39
+ inheritAttrs: false,
40
+
41
+ props: {
42
+ disabled: {
43
+ type: Boolean,
44
+ default: false,
45
+ },
46
+ clearable: {
47
+ type: Boolean,
48
+ default: true,
49
+ },
50
+ hasOpenIndicator: {
51
+ type: Boolean,
52
+ default: true,
53
+ },
54
+ placeholder: {
55
+ type: String,
56
+ default: '',
57
+ },
58
+ sortSelectedItems: {
59
+ type: Boolean,
60
+ default: true,
61
+ },
62
+ sortListItems: {
63
+ type: Boolean,
64
+ default: false,
65
+ },
66
+ sortListCheckedFirst: {
67
+ type: Boolean,
68
+ default: true,
69
+ },
70
+ stickyValues: {
71
+ type: Array,
72
+ required: false,
73
+ },
74
+ sortItemComparator: {
75
+ type: Function,
76
+ required: false,
77
+ },
78
+ splitListCheckedGroups: {
79
+ type: Boolean,
80
+ default: true,
81
+ },
82
+ showSelection: {
83
+ type: Boolean,
84
+ default: true,
85
+ },
86
+ showPlaceholderInTooltip: {
87
+ type: Boolean,
88
+ default: true,
89
+ },
90
+ multiPlaceholderFormatter: {
91
+ type: Function,
92
+ required: false,
93
+ default: undefined,
94
+ },
95
+ blurOnSingleSelection: {
96
+ type: [Boolean, String],
97
+ default: 'touch',
98
+ validator: value => {
99
+ return [true, false, 'touch', null].includes(value);
253
100
  },
254
101
  },
102
+ multi: {
103
+ type: Boolean,
104
+ default: false,
105
+ },
106
+ searchable: {
107
+ type: Boolean,
108
+ default: true,
109
+ },
110
+ noResultsText: {
111
+ type: String,
112
+ default: 'No matching results',
113
+ },
114
+ filterThrottleWindow: {
115
+ type: Number,
116
+ default: 300,
117
+ },
118
+ filterOnEmptyTerm: {
119
+ type: Boolean,
120
+ default: false,
121
+ },
122
+ filterFn: {
123
+ type: Function,
124
+ default: undefined,
125
+ },
126
+ // eslint-disable-next-line vue/require-prop-types
127
+ filterDependencies: {
128
+ default: undefined,
129
+ },
130
+ labelProp: {
131
+ type: String,
132
+ default: 'label',
133
+ },
134
+ valueProp: {
135
+ type: String,
136
+ default: 'value',
137
+ },
138
+ multiItemLabelProp: {
139
+ type: String,
140
+ default: 'short_label',
141
+ },
142
+ items: {
143
+ type: Array,
144
+ default: () => [],
145
+ },
146
+ [isVue3 ? 'modelValue' : 'value']: {
147
+ type: [String, Number, Boolean, Object, Array, Symbol],
148
+ default: undefined,
149
+ },
150
+ maxMultiItems: {
151
+ type: Number,
152
+ required: false,
153
+ },
154
+ multiItemsRestLabelProvider: {
155
+ type: Function,
156
+ required: false,
157
+ },
158
+ renderSingleItem: {
159
+ type: Function,
160
+ default: undefined,
161
+ },
162
+ unrenderSingleItem: {
163
+ type: Function,
164
+ default: undefined,
165
+ },
166
+ renderMultiItem: {
167
+ type: Function,
168
+ default: undefined,
169
+ },
170
+ unrenderMultiItem: {
171
+ type: Function,
172
+ default: undefined,
173
+ },
174
+ renderRestMultiItem: {
175
+ type: Function,
176
+ default: undefined,
177
+ },
178
+ unrenderRestMultiItem: {
179
+ type: Function,
180
+ default: undefined,
181
+ },
182
+ renderNoResultsItem: {
183
+ type: Function,
184
+ default: undefined,
185
+ },
186
+ unrenderNoResultsItem: {
187
+ type: Function,
188
+ default: undefined,
189
+ },
190
+ renderListItem: {
191
+ type: Function,
192
+ default: undefined,
193
+ },
194
+ unrenderListItem: {
195
+ type: Function,
196
+ default: undefined,
197
+ },
198
+ virtualMinItems: {
199
+ type: Number,
200
+ default: 10,
201
+ },
202
+ baseClass: {
203
+ type: String,
204
+ default: undefined,
205
+ },
206
+ droplistBaseClass: {
207
+ type: String,
208
+ default: undefined,
209
+ },
210
+ additionalClasses: {
211
+ type: [Object, Array, String],
212
+ default: undefined,
213
+ },
214
+ additionalDroplistClasses: {
215
+ type: [Object, Array, String],
216
+ default: undefined,
217
+ },
218
+ direction: {
219
+ type: String,
220
+ default: undefined,
221
+ },
222
+ fixedDroplistWidth: {
223
+ type: Boolean,
224
+ default: false,
225
+ },
226
+ acceptNullAsValue: {
227
+ type: Boolean,
228
+ default: false,
229
+ },
230
+ emitNullForEmptyValue: {
231
+ type: Boolean,
232
+ default: false,
233
+ },
234
+ isLoadingMode: {
235
+ type: Boolean,
236
+ default: false,
237
+ },
238
+ treatGroupSelectionAsItems: {
239
+ type: Boolean,
240
+ default: false,
241
+ },
242
+ autoCheckGroupChildren: {
243
+ type: Boolean,
244
+ default: true,
245
+ },
246
+ constrainListToWindow: {
247
+ type: Boolean,
248
+ default: true,
249
+ },
250
+ autoFlipListDirection: {
251
+ type: Boolean,
252
+ default: true,
253
+ },
254
+ },
255
+
256
+ emits: [
257
+ 'update:modelValue',
258
+ 'clear:before',
259
+ 'clear',
260
+ 'open',
261
+ 'close',
262
+ 'search:focus',
263
+ 'search:blur',
264
+ 'addsel:before',
265
+ 'addsel',
266
+ 'removesel:before',
267
+ 'removesel',
268
+ 'select:before',
269
+ 'select',
270
+ 'input:resize',
271
+ 'itemschanged',
272
+ 'search',
273
+ ],
274
+
275
+ data() {
276
+ return {
277
+ el: undefined,
278
+
279
+ nonReactive: Object.seal({
280
+ instance: undefined,
281
+ }),
282
+ };
283
+ },
255
284
 
256
- emits: [
257
- 'update:modelValue',
258
- 'clear:before',
259
- 'clear',
260
- 'open',
261
- 'close',
262
- 'search:focus',
263
- 'search:blur',
264
- 'addsel:before',
265
- 'addsel',
266
- 'removesel:before',
267
- 'removesel',
268
- 'select:before',
269
- 'select',
270
- 'input:resize',
271
- 'itemschanged',
272
- 'search',
273
- ],
274
-
275
- data() {
276
- return {
277
- el: undefined,
278
-
279
- nonReactive: Object.seal({
280
- instance: undefined,
281
- }),
282
- };
283
- },
284
-
285
- computed: {
286
- computedListOptions() {
287
- let opts = {};
288
-
289
- if (this.droplistBaseClass) {
290
- opts.baseClassName = this.droplistBaseClass;
291
- }
285
+ computed: {
286
+ computedListOptions() {
287
+ let opts = {};
292
288
 
293
- if (this.additionalDroplistClassesList) {
294
- opts.additionalClasses = this.additionalDroplistClassesList;
295
- }
289
+ if (this.droplistBaseClass) {
290
+ opts.baseClassName = this.droplistBaseClass;
291
+ }
296
292
 
297
- if (typeof this.autoCheckGroupChildren === 'boolean' && this.multi) {
298
- opts.autoCheckGroupChildren = this.autoCheckGroupChildren;
299
- }
293
+ if (this.additionalDroplistClassesList) {
294
+ opts.additionalClasses = this.additionalDroplistClassesList;
295
+ }
300
296
 
301
- if (typeof this.constrainListToWindow === 'boolean') {
302
- opts.constrainToWindow = this.constrainListToWindow;
303
- }
297
+ if (typeof this.autoCheckGroupChildren === 'boolean' && this.multi) {
298
+ opts.autoCheckGroupChildren = this.autoCheckGroupChildren;
299
+ }
304
300
 
305
- if (typeof this.autoFlipListDirection === 'boolean') {
306
- opts.autoFlipDirection = this.autoFlipListDirection;
307
- }
301
+ if (typeof this.constrainListToWindow === 'boolean') {
302
+ opts.constrainToWindow = this.constrainListToWindow;
303
+ }
308
304
 
309
- opts.virtualMinItems = this.virtualMinItems;
310
- opts.useExactTargetWidth = this.fixedDroplistWidth;
305
+ if (typeof this.autoFlipListDirection === 'boolean') {
306
+ opts.autoFlipDirection = this.autoFlipListDirection;
307
+ }
311
308
 
312
- opts.renderItem = this.renderListItem;
313
- if (!opts.renderItem) {
314
- opts.renderItem = createSlotBasedRenderFunc(this, 'list-item');
315
- }
309
+ opts.virtualMinItems = this.virtualMinItems;
310
+ opts.useExactTargetWidth = this.fixedDroplistWidth;
316
311
 
317
- opts.unrenderItem = this.unrenderListItem;
318
- if (!opts.unrenderItem) {
319
- let fn = createSlotBasedUnrenderFunc(this, 'list-item');
320
- if (fn) {
321
- opts.unrenderItem = (item, el) => fn(el);
322
- }
312
+ opts.renderItem = this.renderListItem;
313
+ if (!opts.renderItem) {
314
+ opts.renderItem = createSlotBasedRenderFunc(this, 'list-item');
315
+ }
316
+
317
+ opts.unrenderItem = this.unrenderListItem;
318
+ if (!opts.unrenderItem) {
319
+ let fn = createSlotBasedUnrenderFunc(this, 'list-item');
320
+ if (fn) {
321
+ opts.unrenderItem = (item, el) => fn(el);
323
322
  }
323
+ }
324
324
 
325
- return opts;
326
- },
325
+ return opts;
326
+ },
327
327
 
328
- computedRenderSingleItem() {
329
- let render = this.renderSingleItem;
328
+ computedRenderSingleItem() {
329
+ let render = this.renderSingleItem;
330
330
 
331
- if (!render) {
332
- render = createSlotBasedRenderFunc(this, 'single-item');
333
- }
331
+ if (!render) {
332
+ render = createSlotBasedRenderFunc(this, 'single-item');
333
+ }
334
334
 
335
- return render;
336
- },
335
+ return render;
336
+ },
337
337
 
338
- computedUnrenderSingleItem() {
339
- let unrender = this.unrenderSingleItem;
338
+ computedUnrenderSingleItem() {
339
+ let unrender = this.unrenderSingleItem;
340
340
 
341
- if (!unrender) {
342
- let fn = createSlotBasedUnrenderFunc(this, 'single-item');
343
- if (fn) {
344
- unrender = (item, el) => fn(el);
345
- }
341
+ if (!unrender) {
342
+ let fn = createSlotBasedUnrenderFunc(this, 'single-item');
343
+ if (fn) {
344
+ unrender = (item, el) => fn(el);
346
345
  }
346
+ }
347
347
 
348
- return unrender;
349
- },
348
+ return unrender;
349
+ },
350
350
 
351
- computedRenderMultiItem() {
352
- let render = this.renderMultiItem;
351
+ computedRenderMultiItem() {
352
+ let render = this.renderMultiItem;
353
353
 
354
- if (!render) {
355
- render = createSlotBasedRenderFunc(this, 'multi-item');
356
- }
354
+ if (!render) {
355
+ render = createSlotBasedRenderFunc(this, 'multi-item');
356
+ }
357
357
 
358
- return render;
359
- },
358
+ return render;
359
+ },
360
360
 
361
- computedUnrenderMultiItem() {
362
- let unrender = this.unrenderMultiItem;
361
+ computedUnrenderMultiItem() {
362
+ let unrender = this.unrenderMultiItem;
363
363
 
364
- if (!unrender) {
365
- let fn = createSlotBasedUnrenderFunc(this, 'multi-item');
366
- if (fn) {
367
- unrender = (item, el) => fn(el);
368
- }
364
+ if (!unrender) {
365
+ let fn = createSlotBasedUnrenderFunc(this, 'multi-item');
366
+ if (fn) {
367
+ unrender = (item, el) => fn(el);
369
368
  }
369
+ }
370
370
 
371
- return unrender;
372
- },
371
+ return unrender;
372
+ },
373
373
 
374
- computedRenderRestMultiItem() {
375
- let render = this.renderRestMultiItem;
374
+ computedRenderRestMultiItem() {
375
+ let render = this.renderRestMultiItem;
376
376
 
377
- if (!render) {
378
- render = createSlotBasedRenderFunc(this, 'rest-multi-item');
379
- }
377
+ if (!render) {
378
+ render = createSlotBasedRenderFunc(this, 'rest-multi-item');
379
+ }
380
380
 
381
- return render;
382
- },
381
+ return render;
382
+ },
383
383
 
384
- computedUnrenderRestMultiItem() {
385
- let unrender = this.unrenderRestMultiItem;
384
+ computedUnrenderRestMultiItem() {
385
+ let unrender = this.unrenderRestMultiItem;
386
386
 
387
- if (!unrender) {
388
- let fn = createSlotBasedUnrenderFunc(this, 'rest-multi-item');
389
- if (fn) {
390
- unrender = (item, el) => fn(el);
391
- }
387
+ if (!unrender) {
388
+ let fn = createSlotBasedUnrenderFunc(this, 'rest-multi-item');
389
+ if (fn) {
390
+ unrender = (item, el) => fn(el);
392
391
  }
392
+ }
393
393
 
394
- return unrender;
395
- },
394
+ return unrender;
395
+ },
396
396
 
397
- computedRenderNoResultsItem() {
398
- let render = this.renderNoResultsItem;
397
+ computedRenderNoResultsItem() {
398
+ let render = this.renderNoResultsItem;
399
399
 
400
- if (!render) {
401
- render = createSlotBasedRenderFunc(this, 'no-results-item');
402
- }
400
+ if (!render) {
401
+ render = createSlotBasedRenderFunc(this, 'no-results-item');
402
+ }
403
403
 
404
- return render;
405
- },
404
+ return render;
405
+ },
406
406
 
407
- computedUnrenderNoResultsItem() {
408
- let unrender = this.unrenderNoResultsItem;
407
+ computedUnrenderNoResultsItem() {
408
+ let unrender = this.unrenderNoResultsItem;
409
409
 
410
- if (!unrender) {
411
- let fn = createSlotBasedUnrenderFunc(this, 'no-results-item');
412
- if (fn) {
413
- unrender = (item, el) => fn(el);
414
- }
410
+ if (!unrender) {
411
+ let fn = createSlotBasedUnrenderFunc(this, 'no-results-item');
412
+ if (fn) {
413
+ unrender = (item, el) => fn(el);
415
414
  }
415
+ }
416
416
 
417
- return unrender;
418
- },
417
+ return unrender;
418
+ },
419
419
 
420
- additionalClassesList() {
421
- return this._concatClassesObject(this.additionalClasses);
422
- },
420
+ additionalClassesList() {
421
+ return this._concatClassesObject(this.additionalClasses);
422
+ },
423
423
 
424
- additionalDroplistClassesList() {
425
- return this._concatClassesObject(this.additionalDroplistClasses);
426
- },
424
+ additionalDroplistClassesList() {
425
+ return this._concatClassesObject(this.additionalDroplistClasses);
427
426
  },
427
+ },
428
428
 
429
- watch: {
430
- disabled(value) {
431
- if (this.nonReactive.instance)
432
- this.nonReactive.instance.disable(value);
433
- },
429
+ watch: {
430
+ disabled(value) {
431
+ if (this.nonReactive.instance)
432
+ this.nonReactive.instance.disable(value);
433
+ },
434
434
 
435
- clearable(value) {
436
- if (this.nonReactive.instance)
437
- this.nonReactive.instance.setClearable(value);
438
- },
435
+ clearable(value) {
436
+ if (this.nonReactive.instance)
437
+ this.nonReactive.instance.setClearable(value);
438
+ },
439
439
 
440
- direction(value) {
441
- if (this.nonReactive.instance)
442
- this.nonReactive.instance.setDirection(value);
443
- },
440
+ direction(value) {
441
+ if (this.nonReactive.instance)
442
+ this.nonReactive.instance.setDirection(value);
443
+ },
444
444
 
445
- hasOpenIndicator(value) {
446
- if (this.nonReactive.instance)
447
- this.nonReactive.instance.setHasOpenIndicator(value);
448
- },
445
+ hasOpenIndicator(value) {
446
+ if (this.nonReactive.instance)
447
+ this.nonReactive.instance.setHasOpenIndicator(value);
448
+ },
449
449
 
450
- placeholder(value) {
451
- if (this.nonReactive.instance)
452
- this.nonReactive.instance.setPlaceholder(value);
453
- },
450
+ placeholder(value) {
451
+ if (this.nonReactive.instance)
452
+ this.nonReactive.instance.setPlaceholder(value);
453
+ },
454
454
 
455
- sortSelectedItems(value) {
456
- if (this.nonReactive.instance)
457
- this.nonReactive.instance.setSortSelectedItems(value);
458
- },
455
+ sortSelectedItems(value) {
456
+ if (this.nonReactive.instance)
457
+ this.nonReactive.instance.setSortSelectedItems(value);
458
+ },
459
459
 
460
- sortListItems(value) {
461
- if (this.nonReactive.instance)
462
- this.nonReactive.instance.setSortListItems(value);
463
- },
460
+ sortListItems(value) {
461
+ if (this.nonReactive.instance)
462
+ this.nonReactive.instance.setSortListItems(value);
463
+ },
464
464
 
465
- sortListCheckedFirst(value) {
466
- if (this.nonReactive.instance)
467
- this.nonReactive.instance.setSortListCheckedFirst(value);
468
- },
465
+ sortListCheckedFirst(value) {
466
+ if (this.nonReactive.instance)
467
+ this.nonReactive.instance.setSortListCheckedFirst(value);
468
+ },
469
469
 
470
- stickyValues(value) {
471
- if (!this.nonReactive.instance) return;
470
+ stickyValues(value) {
471
+ if (!this.nonReactive.instance) return;
472
472
 
473
- // `stickyValues` tend to be a literal array,
474
- // and Vue will get a different reference for each update, triggering this watcher.
475
- // so use deepEqual here to avoid redoing the list items on each selection change.
476
- if (deepEqual(this.stickyValues, value)) return;
473
+ // `stickyValues` tend to be a literal array,
474
+ // and Vue will get a different reference for each update, triggering this watcher.
475
+ // so use deepEqual here to avoid redoing the list items on each selection change.
476
+ if (deepEqual(this.stickyValues, value)) return;
477
477
 
478
- this.nonReactive.instance.setStickyValues(value);
479
- },
478
+ this.nonReactive.instance.setStickyValues(value);
479
+ },
480
480
 
481
- sortItemComparator(value) {
482
- if (this.nonReactive.instance)
483
- this.nonReactive.instance.setSortItemComparator(value);
484
- },
481
+ sortItemComparator(value) {
482
+ if (this.nonReactive.instance)
483
+ this.nonReactive.instance.setSortItemComparator(value);
484
+ },
485
485
 
486
- splitListCheckedGroups(value) {
487
- if (this.nonReactive.instance)
488
- this.nonReactive.instance.setSplitListCheckedGroups(value);
489
- },
486
+ splitListCheckedGroups(value) {
487
+ if (this.nonReactive.instance)
488
+ this.nonReactive.instance.setSplitListCheckedGroups(value);
489
+ },
490
490
 
491
- showSelection(value) {
492
- if (this.nonReactive.instance)
493
- this.nonReactive.instance.setShowSelection(value);
494
- },
491
+ showSelection(value) {
492
+ if (this.nonReactive.instance)
493
+ this.nonReactive.instance.setShowSelection(value);
494
+ },
495
495
 
496
- showPlaceholderInTooltip(value) {
497
- if (this.nonReactive.instance)
498
- this.nonReactive.instance.setShowPlaceholderInTooltip(value);
499
- },
496
+ showPlaceholderInTooltip(value) {
497
+ if (this.nonReactive.instance)
498
+ this.nonReactive.instance.setShowPlaceholderInTooltip(value);
499
+ },
500
500
 
501
- multiPlaceholderFormatter(formatter) {
502
- if (this.nonReactive.instance)
503
- this.nonReactive.instance.setMultiPlaceholderFormatter(formatter);
504
- },
501
+ multiPlaceholderFormatter(formatter) {
502
+ if (this.nonReactive.instance)
503
+ this.nonReactive.instance.setMultiPlaceholderFormatter(formatter);
504
+ },
505
505
 
506
- showBlurOnSingleSelection(value) {
507
- if (this.nonReactive.instance)
508
- this.nonReactive.instance.setBlurOnSingleSelection(value);
509
- },
506
+ showBlurOnSingleSelection(value) {
507
+ if (this.nonReactive.instance)
508
+ this.nonReactive.instance.setBlurOnSingleSelection(value);
509
+ },
510
510
 
511
- multi(value) {
512
- if (this.nonReactive.instance)
513
- this.nonReactive.instance.setMulti(value);
514
- },
511
+ multi(value) {
512
+ if (this.nonReactive.instance)
513
+ this.nonReactive.instance.setMulti(value);
514
+ },
515
515
 
516
- searchable(value) {
517
- if (this.nonReactive.instance)
518
- this.nonReactive.instance.setSearchable(value);
519
- },
516
+ searchable(value) {
517
+ if (this.nonReactive.instance)
518
+ this.nonReactive.instance.setSearchable(value);
519
+ },
520
520
 
521
- noResultsText(value) {
522
- if (this.nonReactive.instance)
523
- this.nonReactive.instance.setNoResultsText(value);
524
- },
521
+ noResultsText(value) {
522
+ if (this.nonReactive.instance)
523
+ this.nonReactive.instance.setNoResultsText(value);
524
+ },
525
525
 
526
- filterThrottleWindow(value) {
527
- if (this.nonReactive.instance)
528
- this.nonReactive.instance.setFilterThrottleWindow(value || 0);
529
- },
526
+ filterThrottleWindow(value) {
527
+ if (this.nonReactive.instance)
528
+ this.nonReactive.instance.setFilterThrottleWindow(value || 0);
529
+ },
530
530
 
531
- filterOnEmptyTerm(value) {
532
- if (this.nonReactive.instance)
533
- this.nonReactive.instance.setFilterOnEmptyTerm(value || false);
534
- },
531
+ filterOnEmptyTerm(value) {
532
+ if (this.nonReactive.instance)
533
+ this.nonReactive.instance.setFilterOnEmptyTerm(value || false);
534
+ },
535
535
 
536
- filterFn() {
537
- if (this.nonReactive.instance)
538
- this.nonReactive.instance.setFilterFn(this.filterFn);
539
- },
536
+ filterFn() {
537
+ if (this.nonReactive.instance)
538
+ this.nonReactive.instance.setFilterFn(this.filterFn);
539
+ },
540
540
 
541
- labelProp(value) {
542
- if (this.nonReactive.instance)
543
- this.nonReactive.instance.setLabelProp(value);
544
- },
541
+ labelProp(value) {
542
+ if (this.nonReactive.instance)
543
+ this.nonReactive.instance.setLabelProp(value);
544
+ },
545
545
 
546
- valueProp(value) {
547
- if (this.nonReactive.instance)
548
- this.nonReactive.instance.setValueProp(value);
549
- },
546
+ valueProp(value) {
547
+ if (this.nonReactive.instance)
548
+ this.nonReactive.instance.setValueProp(value);
549
+ },
550
550
 
551
- multiItemLabelProp(value) {
552
- if (this.nonReactive.instance)
553
- this.nonReactive.instance.setMultiItemLabelProp(value);
554
- },
551
+ multiItemLabelProp(value) {
552
+ if (this.nonReactive.instance)
553
+ this.nonReactive.instance.setMultiItemLabelProp(value);
554
+ },
555
555
 
556
- maxMultiItems(value) {
557
- if (this.nonReactive.instance)
558
- this.nonReactive.instance.setMaxMultiItems(value);
559
- },
556
+ maxMultiItems(value) {
557
+ if (this.nonReactive.instance)
558
+ this.nonReactive.instance.setMaxMultiItems(value);
559
+ },
560
560
 
561
- multiItemsRestLabelProvider(value) {
562
- if (this.nonReactive.instance)
563
- this.nonReactive.instance.setMultiItemsRestLabelProvider(value);
564
- },
561
+ multiItemsRestLabelProvider(value) {
562
+ if (this.nonReactive.instance)
563
+ this.nonReactive.instance.setMultiItemsRestLabelProvider(value);
564
+ },
565
565
 
566
- items(value) {
567
- if (this.nonReactive.instance) {
568
- this.nonReactive.instance.setItems(value, false);
566
+ items(value) {
567
+ if (this.nonReactive.instance) {
568
+ this.nonReactive.instance.setItems(value, false);
569
569
 
570
- const modelValue = isVue3 ? this.modelValue : this.value;
571
- this.nonReactive.instance.setValue(modelValue === null && (!this.acceptNullAsValue || this.multi) ? undefined : modelValue);
572
- }
573
- },
570
+ const modelValue = isVue3 ? this.modelValue : this.value;
571
+ this.nonReactive.instance.setValue(modelValue === null && (!this.acceptNullAsValue || this.multi) ? undefined : modelValue);
572
+ }
573
+ },
574
574
 
575
- [isVue3 ? 'modelValue' : 'value'](value, old) {
576
- if (Array.isArray(value) && Array.isArray(old) &&
577
- value.length === old && value.every((v, i) => old[i] === v))
578
- return;
575
+ [isVue3 ? 'modelValue' : 'value'](value, old) {
576
+ if (Array.isArray(value) && Array.isArray(old) &&
577
+ value.length === old && value.every((v, i) => old[i] === v))
578
+ return;
579
579
 
580
- if (this.nonReactive.instance)
581
- this.nonReactive.instance.setValue(value === null && (!this.acceptNullAsValue || this.multi) ? undefined : value);
582
- },
580
+ if (this.nonReactive.instance)
581
+ this.nonReactive.instance.setValue(value === null && (!this.acceptNullAsValue || this.multi) ? undefined : value);
582
+ },
583
583
 
584
- renderSingleItem() {
585
- if (this.nonReactive.instance)
586
- this.nonReactive.instance.setRenderSingleItem(this.computedRenderSingleItem, this.computedUnrenderSingleItem);
587
- },
584
+ renderSingleItem() {
585
+ if (this.nonReactive.instance)
586
+ this.nonReactive.instance.setRenderSingleItem(this.computedRenderSingleItem, this.computedUnrenderSingleItem);
587
+ },
588
588
 
589
- unrenderSingleItem() {
590
- if (this.nonReactive.instance)
591
- this.nonReactive.instance.setRenderSingleItem(this.computedRenderSingleItem, this.computedUnrenderSingleItem);
592
- },
589
+ unrenderSingleItem() {
590
+ if (this.nonReactive.instance)
591
+ this.nonReactive.instance.setRenderSingleItem(this.computedRenderSingleItem, this.computedUnrenderSingleItem);
592
+ },
593
593
 
594
- renderMultiItem() {
595
- if (this.nonReactive.instance)
596
- this.nonReactive.instance.setRenderMultiItem(this.computedRenderMultiItem, this.computedUnrenderMultiItem);
597
- },
594
+ renderMultiItem() {
595
+ if (this.nonReactive.instance)
596
+ this.nonReactive.instance.setRenderMultiItem(this.computedRenderMultiItem, this.computedUnrenderMultiItem);
597
+ },
598
598
 
599
- unrenderMultiItem() {
600
- if (this.nonReactive.instance)
601
- this.nonReactive.instance.setRenderMultiItem(this.computedRenderMultiItem, this.computedUnrenderMultiItem);
602
- },
599
+ unrenderMultiItem() {
600
+ if (this.nonReactive.instance)
601
+ this.nonReactive.instance.setRenderMultiItem(this.computedRenderMultiItem, this.computedUnrenderMultiItem);
602
+ },
603
603
 
604
- renderRestMultiItem() {
605
- if (this.nonReactive.instance)
606
- this.nonReactive.instance.setRenderRestMultiItem(this.computedRenderRestMultiItem, this.computedUnrenderRestMultiItem);
607
- },
604
+ renderRestMultiItem() {
605
+ if (this.nonReactive.instance)
606
+ this.nonReactive.instance.setRenderRestMultiItem(this.computedRenderRestMultiItem, this.computedUnrenderRestMultiItem);
607
+ },
608
608
 
609
- unrenderRestMultiItem() {
610
- if (this.nonReactive.instance)
611
- this.nonReactive.instance.setRenderRestMultiItem(this.computedRenderRestMultiItem, this.computedUnrenderRestMultiItem);
612
- },
609
+ unrenderRestMultiItem() {
610
+ if (this.nonReactive.instance)
611
+ this.nonReactive.instance.setRenderRestMultiItem(this.computedRenderRestMultiItem, this.computedUnrenderRestMultiItem);
612
+ },
613
613
 
614
- renderNoResultsItem() {
615
- if (this.nonReactive.instance)
616
- this.nonReactive.instance.setRenderNoResultsItem(this.computedRenderNoResultsItem, this.computedUnrenderNoResultsItem);
617
- },
614
+ renderNoResultsItem() {
615
+ if (this.nonReactive.instance)
616
+ this.nonReactive.instance.setRenderNoResultsItem(this.computedRenderNoResultsItem, this.computedUnrenderNoResultsItem);
617
+ },
618
618
 
619
- unrenderNoResultsItem() {
620
- if (this.nonReactive.instance)
621
- this.nonReactive.instance.setRenderNoResultsItem(this.computedRenderNoResultsItem, this.computedUnrenderNoResultsItem);
622
- },
619
+ unrenderNoResultsItem() {
620
+ if (this.nonReactive.instance)
621
+ this.nonReactive.instance.setRenderNoResultsItem(this.computedRenderNoResultsItem, this.computedUnrenderNoResultsItem);
622
+ },
623
623
 
624
- renderListItem() {
625
- if (this.nonReactive.instance)
626
- this.nonReactive.instance.setListOptions(this.computedListOptions);
627
- },
624
+ renderListItem() {
625
+ if (this.nonReactive.instance)
626
+ this.nonReactive.instance.setListOptions(this.computedListOptions);
627
+ },
628
628
 
629
- unrenderListItem() {
629
+ unrenderListItem() {
630
+ if (this.nonReactive.instance)
631
+ this.nonReactive.instance.setListOptions(this.computedListOptions);
632
+ },
633
+
634
+ ...(isVue3 ? {} : {
635
+ $scopedSlots() { // Vue 2
630
636
  if (this.nonReactive.instance)
631
637
  this.nonReactive.instance.setListOptions(this.computedListOptions);
632
638
  },
639
+ }),
633
640
 
634
- ...(isVue3 ? {} : {
635
- $scopedSlots() { // Vue 2
636
- if (this.nonReactive.instance)
637
- this.nonReactive.instance.setListOptions(this.computedListOptions);
638
- },
639
- }),
641
+ $slots() {
642
+ if (this.nonReactive.instance)
643
+ this.nonReactive.instance.setListOptions(this.computedListOptions);
644
+ },
640
645
 
641
- $slots() {
642
- if (this.nonReactive.instance)
643
- this.nonReactive.instance.setListOptions(this.computedListOptions);
644
- },
646
+ additionalClasses() {
647
+ if (this.nonReactive.instance)
648
+ this.nonReactive.instance.setAdditionalClasses(this.additionalClassesList);
649
+ },
645
650
 
646
- additionalClasses() {
647
- if (this.nonReactive.instance)
648
- this.nonReactive.instance.setAdditionalClasses(this.additionalClassesList);
649
- },
651
+ isLoadingMode() {
652
+ if (this.nonReactive.instance)
653
+ this.nonReactive.instance.setIsLoadingMode(!!this.isLoadingMode);
654
+ },
650
655
 
651
- isLoadingMode() {
652
- if (this.nonReactive.instance)
653
- this.nonReactive.instance.setIsLoadingMode(!!this.isLoadingMode);
654
- },
656
+ treatGroupSelectionAsItems() {
657
+ if (this.nonReactive.instance)
658
+ this.nonReactive.instance.setTreatGroupSelectionAsItems(!!this.treatGroupSelectionAsItems);
659
+ },
655
660
 
656
- treatGroupSelectionAsItems() {
661
+ filterDependencies: {
662
+ deep: true,
663
+ handler() {
657
664
  if (this.nonReactive.instance)
658
- this.nonReactive.instance.setTreatGroupSelectionAsItems(!!this.treatGroupSelectionAsItems);
659
- },
660
-
661
- filterDependencies: {
662
- deep: true,
663
- handler() {
664
- if (this.nonReactive.instance)
665
- this.nonReactive.instance.invokeRefilter();
666
- },
665
+ this.nonReactive.instance.invokeRefilter();
667
666
  },
668
667
  },
668
+ },
669
669
 
670
- mounted() {
671
- this._createBox();
670
+ mounted() {
671
+ this._createBox();
672
672
 
673
- if (window.ResizeObserver === undefined) {
674
- this._isAttached = !!this.$refs.el && document.body.contains(this.$refs.el);
673
+ if (window.ResizeObserver === undefined) {
674
+ this._isAttached = !!this.$refs.el && document.body.contains(this.$refs.el);
675
675
 
676
- this.$nextTick(() => {
677
- if (this.nonReactive.instance && this._isAttached)
678
- this.nonReactive.instance.refreshSize();
679
- });
680
- }
681
- },
676
+ this.$nextTick(() => {
677
+ if (this.nonReactive.instance && this._isAttached)
678
+ this.nonReactive.instance.refreshSize();
679
+ });
680
+ }
681
+ },
682
682
 
683
- updated() {
684
- if (this.$refs.el && this.el !== this.$refs.el) {
685
- this._createBox();
683
+ updated() {
684
+ if (this.$refs.el && this.el !== this.$refs.el) {
685
+ this._createBox();
686
+ }
687
+
688
+ if (window.ResizeObserver === undefined) {
689
+ const wasAttached = this._isAttached;
690
+ this._isAttached = !!this.$refs.el && document.body.contains(this.$refs.el);
691
+ if (!wasAttached && this.nonReactive.instance && this._isAttached)
692
+ this.nonReactive.instance.refreshSize();
693
+ }
694
+ },
695
+
696
+ [isVue3 ? 'unmounted' : 'destroyed']() {
697
+ this._destroyBox();
698
+ },
699
+
700
+ methods: {
701
+ _handleBoxEvents(event, data) {
702
+ switch (event) {
703
+ case 'clear:before':
704
+ case 'clear':
705
+ case 'open':
706
+ case 'close':
707
+ case 'search:focus':
708
+ case 'search:blur':
709
+ case 'addsel:before':
710
+ case 'addsel':
711
+ case 'removesel:before':
712
+ case 'removesel':
713
+ case 'select:before':
714
+ case 'select':
715
+ case 'input:resize':
716
+ case 'itemschanged':
717
+ this.$emit(event, ...(data === undefined ? [] : [data]));
718
+ break;
719
+
720
+ case 'search':
721
+ this.$emit(event, data.value);
722
+ break;
686
723
  }
687
724
 
688
- if (window.ResizeObserver === undefined) {
689
- const wasAttached = this._isAttached;
690
- this._isAttached = !!this.$refs.el && document.body.contains(this.$refs.el);
691
- if (!wasAttached && this.nonReactive.instance && this._isAttached)
692
- this.nonReactive.instance.refreshSize();
725
+ if (event === 'select' ||
726
+ event === 'clear' ||
727
+ event === 'groupcheck' ||
728
+ (event === 'addsel' && !event.isCheckingGroup) ||
729
+ (event === 'removesel' && !event.isCheckingGroup)) {
730
+ let value = event === 'select' ? data.value : this.nonReactive.instance.getValue();
731
+ if (value === undefined && event !== 'select' && this.emitNullForEmptyValue)
732
+ value = null;
733
+ this.$emit(isVue3 ? 'update:modelValue' : 'input', value);
693
734
  }
694
735
  },
695
736
 
696
- [isVue3 ? 'unmounted' : 'destroyed']() {
737
+ _createBox() {
697
738
  this._destroyBox();
698
- },
699
-
700
- methods: {
701
- _handleBoxEvents(event, data) {
702
- switch (event) {
703
- case 'clear:before':
704
- case 'clear':
705
- case 'open':
706
- case 'close':
707
- case 'search:focus':
708
- case 'search:blur':
709
- case 'addsel:before':
710
- case 'addsel':
711
- case 'removesel:before':
712
- case 'removesel':
713
- case 'select:before':
714
- case 'select':
715
- case 'input:resize':
716
- case 'itemschanged':
717
- this.$emit(event, ...(data === undefined ? [] : [data]));
718
- break;
719
-
720
- case 'search':
721
- this.$emit(event, data.value);
722
- break;
723
- }
724
739
 
725
- if (event === 'select' ||
726
- event === 'clear' ||
727
- event === 'groupcheck' ||
728
- (event === 'addsel' && !event.isCheckingGroup) ||
729
- (event === 'removesel' && !event.isCheckingGroup)) {
730
- let value = event === 'select' ? data.value : this.nonReactive.instance.getValue();
731
- if (value === undefined && event !== 'select' && this.emitNullForEmptyValue)
732
- value = null;
733
- this.$emit(isVue3 ? 'update:modelValue' : 'input', value);
734
- }
735
- },
736
-
737
- _createBox() {
738
- this._destroyBox();
739
-
740
- this.el = this.$refs.el;
741
- if (!this.el)
742
- return;
743
-
744
- let box = new SelectBox({
745
- el: this.el,
746
- baseClass: this.baseClass,
747
- direction: this.direction,
748
- disabled: this.disabled,
749
- clearable: this.clearable,
750
- hasOpenIndicator: this.hasOpenIndicator,
751
- placeholder: this.placeholder,
752
- sortSelectedItems: this.sortSelectedItems,
753
- sortListItems: this.sortListItems,
754
- sortListCheckedFirst: this.sortListCheckedFirst,
755
- stickyValues: this.stickyValues,
756
- sortItemComparator: this.sortItemComparator,
757
- splitListCheckedGroups: this.splitListCheckedGroups,
758
- showSelection: this.showSelection,
759
- showPlaceholderInTooltip: this.showPlaceholderInTooltip,
760
- multiPlaceholderFormatter: this.multiPlaceholderFormatter,
761
- blurOnSingleSelection: this.blurOnSingleSelection,
762
- multi: this.multi,
763
- searchable: this.searchable,
764
- noResultsText: this.noResultsText,
765
- filterThrottleWindow: this.filterThrottleWindow,
766
- filterOnEmptyTerm: this.filterOnEmptyTerm,
767
- labelProp: this.labelProp,
768
- valueProp: this.valueProp,
769
- multiItemLabelProp: this.multiItemLabelProp,
770
- maxMultiItems: this.maxMultiItems,
771
- multiItemsRestLabelProvider: this.multiItemsRestLabelProvider,
772
- items: this.items,
773
- listOptions: this.computedListOptions,
774
- renderSingleItem: this.computedRenderSingleItem,
775
- unrenderSingleItem: this.computedUnrenderSingleItem,
776
- renderMultiItem: this.computedRenderMultiItem,
777
- unrenderMultiItem: this.computedUnrenderMultiItem,
778
- renderRestMultiItem: this.computedRenderRestMultiItem,
779
- unrenderRestMultiItem: this.computedUnrenderRestMultiItem,
780
- renderNoResultsItem: this.computedRenderNoResultsItem,
781
- unrenderNoResultsItem: this.computedUnrenderNoResultsItem,
782
- filterFn: this.filterFn,
783
- on: this._handleBoxEvents.bind(this),
784
- additionalClasses: this.additionalClassesList,
785
- isLoadingMode: this.isLoadingMode,
786
- treatGroupSelectionAsItems: this.treatGroupSelectionAsItems,
787
- });
788
-
789
- const modelValue = isVue3 ? this.modelValue : this.value;
790
- box.setValue(modelValue === null && (!this.acceptNullAsValue || this.multi) ? undefined : modelValue);
791
-
792
- this.nonReactive.instance = box;
793
- this.el = box.el;
794
- },
740
+ this.el = this.$refs.el;
741
+ if (!this.el)
742
+ return;
743
+
744
+ let box = new SelectBox({
745
+ el: this.el,
746
+ baseClass: this.baseClass,
747
+ direction: this.direction,
748
+ disabled: this.disabled,
749
+ clearable: this.clearable,
750
+ hasOpenIndicator: this.hasOpenIndicator,
751
+ placeholder: this.placeholder,
752
+ sortSelectedItems: this.sortSelectedItems,
753
+ sortListItems: this.sortListItems,
754
+ sortListCheckedFirst: this.sortListCheckedFirst,
755
+ stickyValues: this.stickyValues,
756
+ sortItemComparator: this.sortItemComparator,
757
+ splitListCheckedGroups: this.splitListCheckedGroups,
758
+ showSelection: this.showSelection,
759
+ showPlaceholderInTooltip: this.showPlaceholderInTooltip,
760
+ multiPlaceholderFormatter: this.multiPlaceholderFormatter,
761
+ blurOnSingleSelection: this.blurOnSingleSelection,
762
+ multi: this.multi,
763
+ searchable: this.searchable,
764
+ noResultsText: this.noResultsText,
765
+ filterThrottleWindow: this.filterThrottleWindow,
766
+ filterOnEmptyTerm: this.filterOnEmptyTerm,
767
+ labelProp: this.labelProp,
768
+ valueProp: this.valueProp,
769
+ multiItemLabelProp: this.multiItemLabelProp,
770
+ maxMultiItems: this.maxMultiItems,
771
+ multiItemsRestLabelProvider: this.multiItemsRestLabelProvider,
772
+ items: this.items,
773
+ listOptions: this.computedListOptions,
774
+ renderSingleItem: this.computedRenderSingleItem,
775
+ unrenderSingleItem: this.computedUnrenderSingleItem,
776
+ renderMultiItem: this.computedRenderMultiItem,
777
+ unrenderMultiItem: this.computedUnrenderMultiItem,
778
+ renderRestMultiItem: this.computedRenderRestMultiItem,
779
+ unrenderRestMultiItem: this.computedUnrenderRestMultiItem,
780
+ renderNoResultsItem: this.computedRenderNoResultsItem,
781
+ unrenderNoResultsItem: this.computedUnrenderNoResultsItem,
782
+ filterFn: this.filterFn,
783
+ on: this._handleBoxEvents.bind(this),
784
+ additionalClasses: this.additionalClassesList,
785
+ isLoadingMode: this.isLoadingMode,
786
+ treatGroupSelectionAsItems: this.treatGroupSelectionAsItems,
787
+ });
788
+
789
+ const modelValue = isVue3 ? this.modelValue : this.value;
790
+ box.setValue(modelValue === null && (!this.acceptNullAsValue || this.multi) ? undefined : modelValue);
791
+
792
+ this.nonReactive.instance = box;
793
+ this.el = box.el;
794
+ },
795
795
 
796
- _destroyBox() {
797
- if (this.nonReactive.instance) {
798
- this.nonReactive.instance.destroy();
799
- this.nonReactive.instance = undefined;
800
- }
796
+ _destroyBox() {
797
+ if (this.nonReactive.instance) {
798
+ this.nonReactive.instance.destroy();
799
+ this.nonReactive.instance = undefined;
800
+ }
801
801
 
802
- this.el = undefined;
803
- },
802
+ this.el = undefined;
803
+ },
804
804
 
805
- _concatClassesObject(classes) {
806
- if (Array.isArray(classes)) {
807
- return classes.join(' ');
808
- }
809
- else if (classes && typeof classes === 'object') {
810
- let arr = [];
811
- for (let [key, value] of Object.entries(classes)) {
812
- if (value)
813
- arr.push(key);
814
- }
815
- return arr.join(' ');
805
+ _concatClassesObject(classes) {
806
+ if (Array.isArray(classes)) {
807
+ return classes.join(' ');
808
+ }
809
+ else if (classes && typeof classes === 'object') {
810
+ let arr = [];
811
+ for (let [key, value] of Object.entries(classes)) {
812
+ if (value)
813
+ arr.push(key);
816
814
  }
815
+ return arr.join(' ');
816
+ }
817
817
 
818
- return classes || '';
819
- },
818
+ return classes || '';
819
+ },
820
820
 
821
- toggleLoading(on) {
822
- if (this.nonReactive.instance)
823
- this.nonReactive.instance.toggleLoading(on);
824
- },
821
+ toggleLoading(on) {
822
+ if (this.nonReactive.instance)
823
+ this.nonReactive.instance.toggleLoading(on);
824
+ },
825
825
 
826
- toggleList(open) {
827
- if (this.nonReactive.instance)
828
- this.nonReactive.instance.toggleList(open);
829
- },
826
+ toggleList(open) {
827
+ if (this.nonReactive.instance)
828
+ this.nonReactive.instance.toggleList(open);
829
+ },
830
830
 
831
- openList() {
832
- if (this.nonReactive.instance)
833
- this.nonReactive.instance.openList();
834
- },
831
+ openList() {
832
+ if (this.nonReactive.instance)
833
+ this.nonReactive.instance.openList();
834
+ },
835
835
 
836
- closeList() {
837
- if (this.nonReactive.instance)
838
- this.nonReactive.instance.closeList();
839
- },
836
+ closeList() {
837
+ if (this.nonReactive.instance)
838
+ this.nonReactive.instance.closeList();
839
+ },
840
840
 
841
- isListOpen() {
842
- if (this.nonReactive.instance)
843
- return this.nonReactive.instance.isListOpen();
844
- return false;
845
- },
841
+ isListOpen() {
842
+ if (this.nonReactive.instance)
843
+ return this.nonReactive.instance.isListOpen();
844
+ return false;
845
+ },
846
846
 
847
- updateItemByValue(value, newItem) {
848
- if (this.nonReactive.instance)
849
- return this.nonReactive.instance.updateItemByValue(value, newItem);
850
- },
847
+ updateItemByValue(value, newItem) {
848
+ if (this.nonReactive.instance)
849
+ return this.nonReactive.instance.updateItemByValue(value, newItem);
850
+ },
851
851
 
852
- getSelectedItems() {
853
- if (this.nonReactive.instance)
854
- return this.nonReactive.instance.getSelectedItems();
855
- return [];
856
- },
852
+ getSelectedItems() {
853
+ if (this.nonReactive.instance)
854
+ return this.nonReactive.instance.getSelectedItems();
855
+ return [];
856
+ },
857
857
 
858
- /**
859
- * @param {string} term
860
- * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
861
- */
862
- setSearchTerm(term, performSearch) {
863
- if (term != null && this.nonReactive.instance)
864
- this.nonReactive.instance.setSearchTerm(term, performSearch);
865
- },
858
+ /**
859
+ * @param {string} term
860
+ * @param {boolean} [performSearch=false] should actually perform the search, or just set the input's text?
861
+ */
862
+ setSearchTerm(term, performSearch) {
863
+ if (term != null && this.nonReactive.instance)
864
+ this.nonReactive.instance.setSearchTerm(term, performSearch);
865
+ },
866
866
 
867
- /**
868
- * @returns {string}
869
- */
870
- getSearchTerm() {
871
- if (this.nonReactive.instance)
872
- return this.nonReactive.instance.getSearchTerm();
873
- return '';
874
- },
867
+ /**
868
+ * @returns {string}
869
+ */
870
+ getSearchTerm() {
871
+ if (this.nonReactive.instance)
872
+ return this.nonReactive.instance.getSearchTerm();
873
+ return '';
874
+ },
875
875
 
876
- /**
877
- * @returns {number}
878
- */
879
- getFilteredItemCount() {
880
- if (this.nonReactive.instance)
881
- return this.nonReactive.instance.getFilteredItemCount();
882
- return 0;
883
- },
876
+ /**
877
+ * @returns {number}
878
+ */
879
+ getFilteredItemCount() {
880
+ if (this.nonReactive.instance)
881
+ return this.nonReactive.instance.getFilteredItemCount();
882
+ return 0;
883
+ },
884
884
 
885
- /**
886
- * @returns {boolean}
887
- */
888
- isFilterPending() {
889
- if (this.nonReactive.instance)
890
- return this.nonReactive.instance.isFilterPending();
891
- return false;
892
- },
885
+ /**
886
+ * @returns {boolean}
887
+ */
888
+ isFilterPending() {
889
+ if (this.nonReactive.instance)
890
+ return this.nonReactive.instance.isFilterPending();
891
+ return false;
892
+ },
893
893
 
894
- focus() {
895
- this.nonReactive.instance?.focusInput();
896
- },
894
+ focus() {
895
+ this.nonReactive.instance?.focusInput();
896
+ },
897
897
 
898
- blur() {
899
- this.nonReactive.instance?.blurInput();
900
- },
898
+ blur() {
899
+ this.nonReactive.instance?.blurInput();
900
+ },
901
901
 
902
- droplistElContains(other, considerSublists = true) {
903
- return this.nonReactive.instance?.droplistElContains(other, considerSublists);
904
- },
902
+ droplistElContains(other, considerSublists = true) {
903
+ return this.nonReactive.instance?.droplistElContains(other, considerSublists);
905
904
  },
906
- };
905
+ },
906
+ };
907
907
  </script>