slim-select 2.4.4 → 2.5.0
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/render.d.ts +1 -0
- package/dist/slimselect.cjs.js +45 -5
- package/dist/slimselect.es.js +45 -5
- package/dist/slimselect.global.js +45 -5
- package/dist/slimselect.js +45 -5
- package/dist/slimselect.min.js +1 -1
- package/dist/slimselect.umd.js +45 -5
- package/dist/slimselect.umd.min.js +1 -1
- package/dist/store.d.ts +1 -0
- package/package.json +15 -15
- package/src/slim-select/index.test.ts +99 -0
- package/src/slim-select/render.ts +45 -6
- package/src/slim-select/store.ts +4 -0
- package/src/vue/dist/slim-select/helpers.d.ts +5 -5
- package/src/vue/dist/slim-select/index.d.ts +46 -46
- package/src/vue/dist/slim-select/render.d.ts +120 -119
- package/src/vue/dist/slim-select/select.d.ts +28 -28
- package/src/vue/dist/slim-select/settings.d.ts +32 -32
- package/src/vue/dist/slim-select/store.d.ts +77 -76
- package/src/vue/dist/slimselectvue.es.js +1903 -1863
- package/src/vue/dist/slimselectvue.global.js +1903 -1863
- package/src/vue/dist/slimselectvue.ssr.js +1903 -1863
- package/src/vue/dist/vue/hello.d.ts +2 -2
- package/src/vue/dist/vue/slimselect.vue.d.ts +317 -314
- package/src/vue/package.json +2 -2
package/dist/render.d.ts
CHANGED
package/dist/slimselect.cjs.js
CHANGED
|
@@ -294,6 +294,9 @@ class Store {
|
|
|
294
294
|
});
|
|
295
295
|
return dataSearch;
|
|
296
296
|
}
|
|
297
|
+
getSelectType() {
|
|
298
|
+
return this.selectType;
|
|
299
|
+
}
|
|
297
300
|
}
|
|
298
301
|
|
|
299
302
|
class Render {
|
|
@@ -410,6 +413,7 @@ class Render {
|
|
|
410
413
|
this.content.main.setAttribute('role', 'listbox');
|
|
411
414
|
}
|
|
412
415
|
mainDiv() {
|
|
416
|
+
var _a;
|
|
413
417
|
const main = document.createElement('div');
|
|
414
418
|
main.dataset.id = this.settings.id;
|
|
415
419
|
main.id = this.settings.id;
|
|
@@ -448,9 +452,13 @@ class Render {
|
|
|
448
452
|
main.appendChild(values);
|
|
449
453
|
const deselect = document.createElement('div');
|
|
450
454
|
deselect.classList.add(this.classes.deselect);
|
|
451
|
-
|
|
455
|
+
const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions();
|
|
456
|
+
if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) {
|
|
452
457
|
deselect.classList.add(this.classes.hide);
|
|
453
458
|
}
|
|
459
|
+
else {
|
|
460
|
+
deselect.classList.remove(this.classes.hide);
|
|
461
|
+
}
|
|
454
462
|
deselect.onclick = (e) => {
|
|
455
463
|
e.stopPropagation();
|
|
456
464
|
if (this.settings.disabled) {
|
|
@@ -463,7 +471,13 @@ class Render {
|
|
|
463
471
|
shouldDelete = this.callbacks.beforeChange(after, before) === true;
|
|
464
472
|
}
|
|
465
473
|
if (shouldDelete) {
|
|
466
|
-
this.
|
|
474
|
+
if (this.settings.isMultiple) {
|
|
475
|
+
this.callbacks.setSelected([], false);
|
|
476
|
+
this.updateDeselectAll();
|
|
477
|
+
}
|
|
478
|
+
else {
|
|
479
|
+
this.callbacks.setSelected([''], false);
|
|
480
|
+
}
|
|
467
481
|
if (this.settings.closeOnSelect) {
|
|
468
482
|
this.callbacks.close();
|
|
469
483
|
}
|
|
@@ -542,7 +556,12 @@ class Render {
|
|
|
542
556
|
else {
|
|
543
557
|
const singleValue = document.createElement('div');
|
|
544
558
|
singleValue.classList.add(this.classes.single);
|
|
545
|
-
|
|
559
|
+
if (selectedSingle.html) {
|
|
560
|
+
singleValue.innerHTML = selectedSingle.html;
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
singleValue.innerText = selectedSingle.text;
|
|
564
|
+
}
|
|
546
565
|
this.main.values.innerHTML = singleValue.outerHTML;
|
|
547
566
|
}
|
|
548
567
|
if (!this.settings.allowDeselect || !selected.length) {
|
|
@@ -596,7 +615,9 @@ class Render {
|
|
|
596
615
|
for (const n of removeNodes) {
|
|
597
616
|
n.classList.add(this.classes.valueOut);
|
|
598
617
|
setTimeout(() => {
|
|
599
|
-
this.main.values.
|
|
618
|
+
if (this.main.values.hasChildNodes() && this.main.values.contains(n)) {
|
|
619
|
+
this.main.values.removeChild(n);
|
|
620
|
+
}
|
|
600
621
|
}, 100);
|
|
601
622
|
}
|
|
602
623
|
currentNodes = this.main.values.childNodes;
|
|
@@ -619,6 +640,7 @@ class Render {
|
|
|
619
640
|
}
|
|
620
641
|
}
|
|
621
642
|
}
|
|
643
|
+
this.updateDeselectAll();
|
|
622
644
|
}
|
|
623
645
|
multipleValue(option) {
|
|
624
646
|
const value = document.createElement('div');
|
|
@@ -626,7 +648,7 @@ class Render {
|
|
|
626
648
|
value.dataset.id = option.id;
|
|
627
649
|
const text = document.createElement('div');
|
|
628
650
|
text.classList.add(this.classes.valueText);
|
|
629
|
-
text.
|
|
651
|
+
text.innerText = option.text;
|
|
630
652
|
value.appendChild(text);
|
|
631
653
|
if (!option.mandatory) {
|
|
632
654
|
const deleteDiv = document.createElement('div');
|
|
@@ -667,6 +689,7 @@ class Render {
|
|
|
667
689
|
if (this.callbacks.afterChange) {
|
|
668
690
|
this.callbacks.afterChange(after);
|
|
669
691
|
}
|
|
692
|
+
this.updateDeselectAll();
|
|
670
693
|
}
|
|
671
694
|
};
|
|
672
695
|
const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
@@ -1208,6 +1231,23 @@ class Render {
|
|
|
1208
1231
|
}
|
|
1209
1232
|
return 'down';
|
|
1210
1233
|
}
|
|
1234
|
+
updateDeselectAll() {
|
|
1235
|
+
if (!this.store || !this.settings) {
|
|
1236
|
+
return;
|
|
1237
|
+
}
|
|
1238
|
+
const selected = this.store.getSelectedOptions();
|
|
1239
|
+
const hasSelectedItems = selected && selected.length > 0;
|
|
1240
|
+
const isMultiple = this.settings.isMultiple;
|
|
1241
|
+
const allowDeselect = this.settings.allowDeselect;
|
|
1242
|
+
const deselectButton = this.main.deselect.main;
|
|
1243
|
+
const hideClass = this.classes.hide;
|
|
1244
|
+
if (allowDeselect && !(isMultiple && !hasSelectedItems)) {
|
|
1245
|
+
deselectButton.classList.remove(hideClass);
|
|
1246
|
+
}
|
|
1247
|
+
else {
|
|
1248
|
+
deselectButton.classList.add(hideClass);
|
|
1249
|
+
}
|
|
1250
|
+
}
|
|
1211
1251
|
}
|
|
1212
1252
|
|
|
1213
1253
|
class Select {
|
package/dist/slimselect.es.js
CHANGED
|
@@ -292,6 +292,9 @@ class Store {
|
|
|
292
292
|
});
|
|
293
293
|
return dataSearch;
|
|
294
294
|
}
|
|
295
|
+
getSelectType() {
|
|
296
|
+
return this.selectType;
|
|
297
|
+
}
|
|
295
298
|
}
|
|
296
299
|
|
|
297
300
|
class Render {
|
|
@@ -408,6 +411,7 @@ class Render {
|
|
|
408
411
|
this.content.main.setAttribute('role', 'listbox');
|
|
409
412
|
}
|
|
410
413
|
mainDiv() {
|
|
414
|
+
var _a;
|
|
411
415
|
const main = document.createElement('div');
|
|
412
416
|
main.dataset.id = this.settings.id;
|
|
413
417
|
main.id = this.settings.id;
|
|
@@ -446,9 +450,13 @@ class Render {
|
|
|
446
450
|
main.appendChild(values);
|
|
447
451
|
const deselect = document.createElement('div');
|
|
448
452
|
deselect.classList.add(this.classes.deselect);
|
|
449
|
-
|
|
453
|
+
const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions();
|
|
454
|
+
if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) {
|
|
450
455
|
deselect.classList.add(this.classes.hide);
|
|
451
456
|
}
|
|
457
|
+
else {
|
|
458
|
+
deselect.classList.remove(this.classes.hide);
|
|
459
|
+
}
|
|
452
460
|
deselect.onclick = (e) => {
|
|
453
461
|
e.stopPropagation();
|
|
454
462
|
if (this.settings.disabled) {
|
|
@@ -461,7 +469,13 @@ class Render {
|
|
|
461
469
|
shouldDelete = this.callbacks.beforeChange(after, before) === true;
|
|
462
470
|
}
|
|
463
471
|
if (shouldDelete) {
|
|
464
|
-
this.
|
|
472
|
+
if (this.settings.isMultiple) {
|
|
473
|
+
this.callbacks.setSelected([], false);
|
|
474
|
+
this.updateDeselectAll();
|
|
475
|
+
}
|
|
476
|
+
else {
|
|
477
|
+
this.callbacks.setSelected([''], false);
|
|
478
|
+
}
|
|
465
479
|
if (this.settings.closeOnSelect) {
|
|
466
480
|
this.callbacks.close();
|
|
467
481
|
}
|
|
@@ -540,7 +554,12 @@ class Render {
|
|
|
540
554
|
else {
|
|
541
555
|
const singleValue = document.createElement('div');
|
|
542
556
|
singleValue.classList.add(this.classes.single);
|
|
543
|
-
|
|
557
|
+
if (selectedSingle.html) {
|
|
558
|
+
singleValue.innerHTML = selectedSingle.html;
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
singleValue.innerText = selectedSingle.text;
|
|
562
|
+
}
|
|
544
563
|
this.main.values.innerHTML = singleValue.outerHTML;
|
|
545
564
|
}
|
|
546
565
|
if (!this.settings.allowDeselect || !selected.length) {
|
|
@@ -594,7 +613,9 @@ class Render {
|
|
|
594
613
|
for (const n of removeNodes) {
|
|
595
614
|
n.classList.add(this.classes.valueOut);
|
|
596
615
|
setTimeout(() => {
|
|
597
|
-
this.main.values.
|
|
616
|
+
if (this.main.values.hasChildNodes() && this.main.values.contains(n)) {
|
|
617
|
+
this.main.values.removeChild(n);
|
|
618
|
+
}
|
|
598
619
|
}, 100);
|
|
599
620
|
}
|
|
600
621
|
currentNodes = this.main.values.childNodes;
|
|
@@ -617,6 +638,7 @@ class Render {
|
|
|
617
638
|
}
|
|
618
639
|
}
|
|
619
640
|
}
|
|
641
|
+
this.updateDeselectAll();
|
|
620
642
|
}
|
|
621
643
|
multipleValue(option) {
|
|
622
644
|
const value = document.createElement('div');
|
|
@@ -624,7 +646,7 @@ class Render {
|
|
|
624
646
|
value.dataset.id = option.id;
|
|
625
647
|
const text = document.createElement('div');
|
|
626
648
|
text.classList.add(this.classes.valueText);
|
|
627
|
-
text.
|
|
649
|
+
text.innerText = option.text;
|
|
628
650
|
value.appendChild(text);
|
|
629
651
|
if (!option.mandatory) {
|
|
630
652
|
const deleteDiv = document.createElement('div');
|
|
@@ -665,6 +687,7 @@ class Render {
|
|
|
665
687
|
if (this.callbacks.afterChange) {
|
|
666
688
|
this.callbacks.afterChange(after);
|
|
667
689
|
}
|
|
690
|
+
this.updateDeselectAll();
|
|
668
691
|
}
|
|
669
692
|
};
|
|
670
693
|
const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
@@ -1206,6 +1229,23 @@ class Render {
|
|
|
1206
1229
|
}
|
|
1207
1230
|
return 'down';
|
|
1208
1231
|
}
|
|
1232
|
+
updateDeselectAll() {
|
|
1233
|
+
if (!this.store || !this.settings) {
|
|
1234
|
+
return;
|
|
1235
|
+
}
|
|
1236
|
+
const selected = this.store.getSelectedOptions();
|
|
1237
|
+
const hasSelectedItems = selected && selected.length > 0;
|
|
1238
|
+
const isMultiple = this.settings.isMultiple;
|
|
1239
|
+
const allowDeselect = this.settings.allowDeselect;
|
|
1240
|
+
const deselectButton = this.main.deselect.main;
|
|
1241
|
+
const hideClass = this.classes.hide;
|
|
1242
|
+
if (allowDeselect && !(isMultiple && !hasSelectedItems)) {
|
|
1243
|
+
deselectButton.classList.remove(hideClass);
|
|
1244
|
+
}
|
|
1245
|
+
else {
|
|
1246
|
+
deselectButton.classList.add(hideClass);
|
|
1247
|
+
}
|
|
1248
|
+
}
|
|
1209
1249
|
}
|
|
1210
1250
|
|
|
1211
1251
|
class Select {
|
|
@@ -295,6 +295,9 @@ var SlimSelect = (function () {
|
|
|
295
295
|
});
|
|
296
296
|
return dataSearch;
|
|
297
297
|
}
|
|
298
|
+
getSelectType() {
|
|
299
|
+
return this.selectType;
|
|
300
|
+
}
|
|
298
301
|
}
|
|
299
302
|
|
|
300
303
|
class Render {
|
|
@@ -411,6 +414,7 @@ var SlimSelect = (function () {
|
|
|
411
414
|
this.content.main.setAttribute('role', 'listbox');
|
|
412
415
|
}
|
|
413
416
|
mainDiv() {
|
|
417
|
+
var _a;
|
|
414
418
|
const main = document.createElement('div');
|
|
415
419
|
main.dataset.id = this.settings.id;
|
|
416
420
|
main.id = this.settings.id;
|
|
@@ -449,9 +453,13 @@ var SlimSelect = (function () {
|
|
|
449
453
|
main.appendChild(values);
|
|
450
454
|
const deselect = document.createElement('div');
|
|
451
455
|
deselect.classList.add(this.classes.deselect);
|
|
452
|
-
|
|
456
|
+
const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions();
|
|
457
|
+
if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) {
|
|
453
458
|
deselect.classList.add(this.classes.hide);
|
|
454
459
|
}
|
|
460
|
+
else {
|
|
461
|
+
deselect.classList.remove(this.classes.hide);
|
|
462
|
+
}
|
|
455
463
|
deselect.onclick = (e) => {
|
|
456
464
|
e.stopPropagation();
|
|
457
465
|
if (this.settings.disabled) {
|
|
@@ -464,7 +472,13 @@ var SlimSelect = (function () {
|
|
|
464
472
|
shouldDelete = this.callbacks.beforeChange(after, before) === true;
|
|
465
473
|
}
|
|
466
474
|
if (shouldDelete) {
|
|
467
|
-
this.
|
|
475
|
+
if (this.settings.isMultiple) {
|
|
476
|
+
this.callbacks.setSelected([], false);
|
|
477
|
+
this.updateDeselectAll();
|
|
478
|
+
}
|
|
479
|
+
else {
|
|
480
|
+
this.callbacks.setSelected([''], false);
|
|
481
|
+
}
|
|
468
482
|
if (this.settings.closeOnSelect) {
|
|
469
483
|
this.callbacks.close();
|
|
470
484
|
}
|
|
@@ -543,7 +557,12 @@ var SlimSelect = (function () {
|
|
|
543
557
|
else {
|
|
544
558
|
const singleValue = document.createElement('div');
|
|
545
559
|
singleValue.classList.add(this.classes.single);
|
|
546
|
-
|
|
560
|
+
if (selectedSingle.html) {
|
|
561
|
+
singleValue.innerHTML = selectedSingle.html;
|
|
562
|
+
}
|
|
563
|
+
else {
|
|
564
|
+
singleValue.innerText = selectedSingle.text;
|
|
565
|
+
}
|
|
547
566
|
this.main.values.innerHTML = singleValue.outerHTML;
|
|
548
567
|
}
|
|
549
568
|
if (!this.settings.allowDeselect || !selected.length) {
|
|
@@ -597,7 +616,9 @@ var SlimSelect = (function () {
|
|
|
597
616
|
for (const n of removeNodes) {
|
|
598
617
|
n.classList.add(this.classes.valueOut);
|
|
599
618
|
setTimeout(() => {
|
|
600
|
-
this.main.values.
|
|
619
|
+
if (this.main.values.hasChildNodes() && this.main.values.contains(n)) {
|
|
620
|
+
this.main.values.removeChild(n);
|
|
621
|
+
}
|
|
601
622
|
}, 100);
|
|
602
623
|
}
|
|
603
624
|
currentNodes = this.main.values.childNodes;
|
|
@@ -620,6 +641,7 @@ var SlimSelect = (function () {
|
|
|
620
641
|
}
|
|
621
642
|
}
|
|
622
643
|
}
|
|
644
|
+
this.updateDeselectAll();
|
|
623
645
|
}
|
|
624
646
|
multipleValue(option) {
|
|
625
647
|
const value = document.createElement('div');
|
|
@@ -627,7 +649,7 @@ var SlimSelect = (function () {
|
|
|
627
649
|
value.dataset.id = option.id;
|
|
628
650
|
const text = document.createElement('div');
|
|
629
651
|
text.classList.add(this.classes.valueText);
|
|
630
|
-
text.
|
|
652
|
+
text.innerText = option.text;
|
|
631
653
|
value.appendChild(text);
|
|
632
654
|
if (!option.mandatory) {
|
|
633
655
|
const deleteDiv = document.createElement('div');
|
|
@@ -668,6 +690,7 @@ var SlimSelect = (function () {
|
|
|
668
690
|
if (this.callbacks.afterChange) {
|
|
669
691
|
this.callbacks.afterChange(after);
|
|
670
692
|
}
|
|
693
|
+
this.updateDeselectAll();
|
|
671
694
|
}
|
|
672
695
|
};
|
|
673
696
|
const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
@@ -1209,6 +1232,23 @@ var SlimSelect = (function () {
|
|
|
1209
1232
|
}
|
|
1210
1233
|
return 'down';
|
|
1211
1234
|
}
|
|
1235
|
+
updateDeselectAll() {
|
|
1236
|
+
if (!this.store || !this.settings) {
|
|
1237
|
+
return;
|
|
1238
|
+
}
|
|
1239
|
+
const selected = this.store.getSelectedOptions();
|
|
1240
|
+
const hasSelectedItems = selected && selected.length > 0;
|
|
1241
|
+
const isMultiple = this.settings.isMultiple;
|
|
1242
|
+
const allowDeselect = this.settings.allowDeselect;
|
|
1243
|
+
const deselectButton = this.main.deselect.main;
|
|
1244
|
+
const hideClass = this.classes.hide;
|
|
1245
|
+
if (allowDeselect && !(isMultiple && !hasSelectedItems)) {
|
|
1246
|
+
deselectButton.classList.remove(hideClass);
|
|
1247
|
+
}
|
|
1248
|
+
else {
|
|
1249
|
+
deselectButton.classList.add(hideClass);
|
|
1250
|
+
}
|
|
1251
|
+
}
|
|
1212
1252
|
}
|
|
1213
1253
|
|
|
1214
1254
|
class Select {
|
package/dist/slimselect.js
CHANGED
|
@@ -298,6 +298,9 @@
|
|
|
298
298
|
});
|
|
299
299
|
return dataSearch;
|
|
300
300
|
}
|
|
301
|
+
getSelectType() {
|
|
302
|
+
return this.selectType;
|
|
303
|
+
}
|
|
301
304
|
}
|
|
302
305
|
|
|
303
306
|
class Render {
|
|
@@ -414,6 +417,7 @@
|
|
|
414
417
|
this.content.main.setAttribute('role', 'listbox');
|
|
415
418
|
}
|
|
416
419
|
mainDiv() {
|
|
420
|
+
var _a;
|
|
417
421
|
const main = document.createElement('div');
|
|
418
422
|
main.dataset.id = this.settings.id;
|
|
419
423
|
main.id = this.settings.id;
|
|
@@ -452,9 +456,13 @@
|
|
|
452
456
|
main.appendChild(values);
|
|
453
457
|
const deselect = document.createElement('div');
|
|
454
458
|
deselect.classList.add(this.classes.deselect);
|
|
455
|
-
|
|
459
|
+
const selectedOptions = (_a = this.store) === null || _a === void 0 ? void 0 : _a.getSelectedOptions();
|
|
460
|
+
if (!this.settings.allowDeselect || (this.settings.isMultiple && selectedOptions && selectedOptions.length <= 0)) {
|
|
456
461
|
deselect.classList.add(this.classes.hide);
|
|
457
462
|
}
|
|
463
|
+
else {
|
|
464
|
+
deselect.classList.remove(this.classes.hide);
|
|
465
|
+
}
|
|
458
466
|
deselect.onclick = (e) => {
|
|
459
467
|
e.stopPropagation();
|
|
460
468
|
if (this.settings.disabled) {
|
|
@@ -467,7 +475,13 @@
|
|
|
467
475
|
shouldDelete = this.callbacks.beforeChange(after, before) === true;
|
|
468
476
|
}
|
|
469
477
|
if (shouldDelete) {
|
|
470
|
-
this.
|
|
478
|
+
if (this.settings.isMultiple) {
|
|
479
|
+
this.callbacks.setSelected([], false);
|
|
480
|
+
this.updateDeselectAll();
|
|
481
|
+
}
|
|
482
|
+
else {
|
|
483
|
+
this.callbacks.setSelected([''], false);
|
|
484
|
+
}
|
|
471
485
|
if (this.settings.closeOnSelect) {
|
|
472
486
|
this.callbacks.close();
|
|
473
487
|
}
|
|
@@ -546,7 +560,12 @@
|
|
|
546
560
|
else {
|
|
547
561
|
const singleValue = document.createElement('div');
|
|
548
562
|
singleValue.classList.add(this.classes.single);
|
|
549
|
-
|
|
563
|
+
if (selectedSingle.html) {
|
|
564
|
+
singleValue.innerHTML = selectedSingle.html;
|
|
565
|
+
}
|
|
566
|
+
else {
|
|
567
|
+
singleValue.innerText = selectedSingle.text;
|
|
568
|
+
}
|
|
550
569
|
this.main.values.innerHTML = singleValue.outerHTML;
|
|
551
570
|
}
|
|
552
571
|
if (!this.settings.allowDeselect || !selected.length) {
|
|
@@ -600,7 +619,9 @@
|
|
|
600
619
|
for (const n of removeNodes) {
|
|
601
620
|
n.classList.add(this.classes.valueOut);
|
|
602
621
|
setTimeout(() => {
|
|
603
|
-
this.main.values.
|
|
622
|
+
if (this.main.values.hasChildNodes() && this.main.values.contains(n)) {
|
|
623
|
+
this.main.values.removeChild(n);
|
|
624
|
+
}
|
|
604
625
|
}, 100);
|
|
605
626
|
}
|
|
606
627
|
currentNodes = this.main.values.childNodes;
|
|
@@ -623,6 +644,7 @@
|
|
|
623
644
|
}
|
|
624
645
|
}
|
|
625
646
|
}
|
|
647
|
+
this.updateDeselectAll();
|
|
626
648
|
}
|
|
627
649
|
multipleValue(option) {
|
|
628
650
|
const value = document.createElement('div');
|
|
@@ -630,7 +652,7 @@
|
|
|
630
652
|
value.dataset.id = option.id;
|
|
631
653
|
const text = document.createElement('div');
|
|
632
654
|
text.classList.add(this.classes.valueText);
|
|
633
|
-
text.
|
|
655
|
+
text.innerText = option.text;
|
|
634
656
|
value.appendChild(text);
|
|
635
657
|
if (!option.mandatory) {
|
|
636
658
|
const deleteDiv = document.createElement('div');
|
|
@@ -671,6 +693,7 @@
|
|
|
671
693
|
if (this.callbacks.afterChange) {
|
|
672
694
|
this.callbacks.afterChange(after);
|
|
673
695
|
}
|
|
696
|
+
this.updateDeselectAll();
|
|
674
697
|
}
|
|
675
698
|
};
|
|
676
699
|
const deleteSvg = document.createElementNS('http://www.w3.org/2000/svg', 'svg');
|
|
@@ -1212,6 +1235,23 @@
|
|
|
1212
1235
|
}
|
|
1213
1236
|
return 'down';
|
|
1214
1237
|
}
|
|
1238
|
+
updateDeselectAll() {
|
|
1239
|
+
if (!this.store || !this.settings) {
|
|
1240
|
+
return;
|
|
1241
|
+
}
|
|
1242
|
+
const selected = this.store.getSelectedOptions();
|
|
1243
|
+
const hasSelectedItems = selected && selected.length > 0;
|
|
1244
|
+
const isMultiple = this.settings.isMultiple;
|
|
1245
|
+
const allowDeselect = this.settings.allowDeselect;
|
|
1246
|
+
const deselectButton = this.main.deselect.main;
|
|
1247
|
+
const hideClass = this.classes.hide;
|
|
1248
|
+
if (allowDeselect && !(isMultiple && !hasSelectedItems)) {
|
|
1249
|
+
deselectButton.classList.remove(hideClass);
|
|
1250
|
+
}
|
|
1251
|
+
else {
|
|
1252
|
+
deselectButton.classList.add(hideClass);
|
|
1253
|
+
}
|
|
1254
|
+
}
|
|
1215
1255
|
}
|
|
1216
1256
|
|
|
1217
1257
|
class Select {
|