sas-ui 0.8.210 → 0.8.211
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/cjs/sas-alert_26.cjs.entry.js +27 -7
- package/dist/collection/components/sas-multiselect/sas-multiselect.css +7 -1
- package/dist/collection/components/sas-multiselect/sas-multiselect.js +31 -12
- package/dist/custom-elements/index.js +27 -7
- package/dist/esm/sas-alert_26.entry.js +27 -7
- package/dist/sas-ui/{p-b37c8f0e.entry.js → p-e24a4086.entry.js} +1 -1
- package/dist/sas-ui/sas-ui.esm.js +1 -1
- package/dist/types/components/sas-multiselect/sas-multiselect.d.ts +2 -1
- package/package.json +1 -1
|
@@ -4293,7 +4293,7 @@ let SasListItem = class {
|
|
|
4293
4293
|
};
|
|
4294
4294
|
SasListItem.style = sasListItemCss;
|
|
4295
4295
|
|
|
4296
|
-
const sasMultiselectCss = ":host{display:block;--checkbox-padding:8px}:host sas-form-input-template{--input-height:var(--multiselect-height, 40px)}:host .input-container{position:absolute;top:50%;transform:translateY(-50%);left:10px;right:30px;white-space:nowrap;display:flex;align-items:center;height:100%}:host .input-container:focus{outline:none}:host sas-chip{margin-right:10px;--chip-padding:2px 10px;box-sizing:border-box}:host #text-chip{color:var(--primary)}:host .clear-button-container{display:flex;justify-content:flex-end}:host .clear-button{color:var(--primary);border:none;background-color:transparent;cursor:pointer;text-decoration:underline}:host .filter{border:none;
|
|
4296
|
+
const sasMultiselectCss = ":host{display:block;--checkbox-padding:8px}:host sas-form-input-template{--input-height:var(--multiselect-height, 40px)}:host .input-container{position:absolute;top:50%;transform:translateY(-50%);left:10px;right:30px;white-space:nowrap;display:flex;align-items:center;height:100%}:host .input-container:focus{outline:none}:host sas-chip{margin-right:10px;--chip-padding:2px 10px;box-sizing:border-box}:host #text-chip{color:var(--primary)}:host .clear-button-container{display:flex;justify-content:flex-end;text-wrap:nowrap;padding:10px}:host .clear-button{color:var(--primary);border:none;background-color:transparent;cursor:pointer;text-decoration:underline}:host .filter{border:none;box-sizing:border-box;color:var(--s-500);font-size:14px;width:100%;padding:10px}:host .filter:focus{outline:none;background-color:white}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;margin-left:auto;box-shadow:none}:host sas-checkbox-group{max-height:200px;overflow-y:auto;position:relative}:host sas-checkbox{box-sizing:border-box;width:100%;outline:none}:host #no-match-tip:not(.hide){display:grid;grid-template-columns:max-content auto;grid-gap:10px;padding:10px 15px}:host .no-match-add-new-option-button{margin:0;color:#0D76B4;font-family:roboto;font-weight:500;cursor:pointer;margin-right:auto}:host .hide{display:none}:host .inline{display:flex;border-bottom:1px solid var(--s-300);flex-direction:row-reverse}";
|
|
4297
4297
|
|
|
4298
4298
|
let SasMultiselect = class {
|
|
4299
4299
|
constructor(hostRef) {
|
|
@@ -4940,14 +4940,34 @@ let SasMultiselect = class {
|
|
|
4940
4940
|
this.filterText = "";
|
|
4941
4941
|
this.filter();
|
|
4942
4942
|
}
|
|
4943
|
+
getSelectedDisabledOptionValues() {
|
|
4944
|
+
const disabledOptions = this.options.filter(option => {
|
|
4945
|
+
return option.disabled === true;
|
|
4946
|
+
});
|
|
4947
|
+
const disabledSubOptions = this.options
|
|
4948
|
+
.filter(option => { var _a; return ((_a = option.sub) === null || _a === void 0 ? void 0 : _a.length) > 0; })
|
|
4949
|
+
.map(option => option.sub)
|
|
4950
|
+
.reduce((acc, curVal) => acc.concat(curVal), [])
|
|
4951
|
+
.filter(subOption => subOption.disabled === true);
|
|
4952
|
+
const selectedOptions = this.values;
|
|
4953
|
+
const selectedDisabledOptionValues = selectedOptions.filter(selectedOption => {
|
|
4954
|
+
return disabledOptions.some(disabledOption => disabledOption.value === selectedOption)
|
|
4955
|
+
|| disabledSubOptions.some(disabledSubOption => disabledSubOption.value === selectedOption);
|
|
4956
|
+
});
|
|
4957
|
+
return selectedDisabledOptionValues;
|
|
4958
|
+
}
|
|
4943
4959
|
clearSelection() {
|
|
4944
|
-
|
|
4960
|
+
// When selection is cleared by user, don't clear any disabled options
|
|
4961
|
+
this.values = this.getSelectedDisabledOptionValues();
|
|
4945
4962
|
this.update();
|
|
4946
4963
|
}
|
|
4947
4964
|
getClearText() {
|
|
4948
4965
|
const inputFilter = this.el.shadowRoot.querySelector('#inputFilter');
|
|
4949
4966
|
if (inputFilter === null) {
|
|
4950
|
-
if (this.chipArray.length === 0) {
|
|
4967
|
+
if (this.chipArray.length === 0 && !this.search) {
|
|
4968
|
+
this.buttonFilterText = 'Clear Selection';
|
|
4969
|
+
}
|
|
4970
|
+
else if (this.chipArray.length === 0) {
|
|
4951
4971
|
this.buttonFilterText = 'Clear';
|
|
4952
4972
|
}
|
|
4953
4973
|
else {
|
|
@@ -4970,11 +4990,11 @@ let SasMultiselect = class {
|
|
|
4970
4990
|
render() {
|
|
4971
4991
|
return (index.h(index.Host, { tabindex: "0" }, index.h("sas-form-input-template", { label: this.label, outside: this.outside, placeholder: this.placeholder, "icon-right": "far fa-chevron-down", required: this.required, readonly: true, value: this.value, disabled: this.disabled, "data-message": this.message, position: this.position, minimumPixelsAboveComponentRequired: 250 }, this.type === 'chip'
|
|
4972
4992
|
? index.h("div", { class: "input-container", tabindex: -1, slot: "input" }, this.getChipElement(), index.h("sas-chip", { class: this.getChipClass(this.chipArray.length > this.maxChip), id: "text-chip", text: `+${this.chipArray.length - this.maxChip}`, uppercase: false, bold: false, onMouseDown: this.chipMouseDownEvent }))
|
|
4973
|
-
: null, this.clear
|
|
4974
|
-
? index.h("div", {
|
|
4993
|
+
: null, index.h("div", { class: this.clear || this.search ? 'inline' : null, slot: 'container' }, this.clear
|
|
4994
|
+
? index.h("div", { class: "clear-button-container" }, index.h("button", { class: "clear-button", onClick: this.clearAll }, this.getClearText()))
|
|
4975
4995
|
: null, this.search
|
|
4976
|
-
? index.h("input", { id: "inputFilter",
|
|
4977
|
-
: null, this.formatOptions.length > 0
|
|
4996
|
+
? index.h("input", { id: "inputFilter", class: "filter", placeholder: "filter", onInput: this.inputEvent })
|
|
4997
|
+
: null), this.formatOptions.length > 0
|
|
4978
4998
|
? index.h("sas-checkbox-group", { slot: "container", max: this.max, options: this.formatOptions, values: this.values, selectAll: this.selectAll, selectAllText: this.selectAllText })
|
|
4979
4999
|
: index.h("slot", { slot: "container" }), index.h("div", { slot: "container", class: "hide", id: "no-match-tip" }, this.getNoMatchTipTextContent(), this.noMatchAction === 'show_no_match_add_new_option'
|
|
4980
5000
|
? index.h("p", { onClick: this.addNewOptionClickEvent, class: "no-match-add-new-option-button" }, "Add")
|
|
@@ -33,6 +33,8 @@
|
|
|
33
33
|
:host .clear-button-container {
|
|
34
34
|
display: flex;
|
|
35
35
|
justify-content: flex-end;
|
|
36
|
+
text-wrap: nowrap;
|
|
37
|
+
padding: 10px;
|
|
36
38
|
}
|
|
37
39
|
:host .clear-button {
|
|
38
40
|
color: var(--primary);
|
|
@@ -43,7 +45,6 @@
|
|
|
43
45
|
}
|
|
44
46
|
:host .filter {
|
|
45
47
|
border: none;
|
|
46
|
-
border-bottom: 1px solid var(--s-300);
|
|
47
48
|
box-sizing: border-box;
|
|
48
49
|
color: var(--s-500);
|
|
49
50
|
font-size: 14px;
|
|
@@ -100,4 +101,9 @@
|
|
|
100
101
|
}
|
|
101
102
|
:host .hide {
|
|
102
103
|
display: none;
|
|
104
|
+
}
|
|
105
|
+
:host .inline {
|
|
106
|
+
display: flex;
|
|
107
|
+
border-bottom: 1px solid var(--s-300);
|
|
108
|
+
flex-direction: row-reverse;
|
|
103
109
|
}
|
|
@@ -1,6 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
// eslint-disable-next-line no-unused-vars
|
|
3
|
-
Component, Host, Prop, h, Element, Listen, Watch, Event, State, Method, } from '@stencil/core';
|
|
1
|
+
import { Component, Element, Event, Host, Listen, Method, Prop, State, Watch, h, } from '@stencil/core';
|
|
4
2
|
import { HTMLDecodeString } from '../../global/global';
|
|
5
3
|
export class SasMultiselect {
|
|
6
4
|
constructor() {
|
|
@@ -643,14 +641,34 @@ export class SasMultiselect {
|
|
|
643
641
|
this.filterText = "";
|
|
644
642
|
this.filter();
|
|
645
643
|
}
|
|
644
|
+
getSelectedDisabledOptionValues() {
|
|
645
|
+
const disabledOptions = this.options.filter(option => {
|
|
646
|
+
return option.disabled === true;
|
|
647
|
+
});
|
|
648
|
+
const disabledSubOptions = this.options
|
|
649
|
+
.filter(option => { var _a; return ((_a = option.sub) === null || _a === void 0 ? void 0 : _a.length) > 0; })
|
|
650
|
+
.map(option => option.sub)
|
|
651
|
+
.reduce((acc, curVal) => acc.concat(curVal), [])
|
|
652
|
+
.filter(subOption => subOption.disabled === true);
|
|
653
|
+
const selectedOptions = this.values;
|
|
654
|
+
const selectedDisabledOptionValues = selectedOptions.filter(selectedOption => {
|
|
655
|
+
return disabledOptions.some(disabledOption => disabledOption.value === selectedOption)
|
|
656
|
+
|| disabledSubOptions.some(disabledSubOption => disabledSubOption.value === selectedOption);
|
|
657
|
+
});
|
|
658
|
+
return selectedDisabledOptionValues;
|
|
659
|
+
}
|
|
646
660
|
clearSelection() {
|
|
647
|
-
|
|
661
|
+
// When selection is cleared by user, don't clear any disabled options
|
|
662
|
+
this.values = this.getSelectedDisabledOptionValues();
|
|
648
663
|
this.update();
|
|
649
664
|
}
|
|
650
665
|
getClearText() {
|
|
651
666
|
const inputFilter = this.el.shadowRoot.querySelector('#inputFilter');
|
|
652
667
|
if (inputFilter === null) {
|
|
653
|
-
if (this.chipArray.length === 0) {
|
|
668
|
+
if (this.chipArray.length === 0 && !this.search) {
|
|
669
|
+
this.buttonFilterText = 'Clear Selection';
|
|
670
|
+
}
|
|
671
|
+
else if (this.chipArray.length === 0) {
|
|
654
672
|
this.buttonFilterText = 'Clear';
|
|
655
673
|
}
|
|
656
674
|
else {
|
|
@@ -678,13 +696,14 @@ export class SasMultiselect {
|
|
|
678
696
|
this.getChipElement(),
|
|
679
697
|
h("sas-chip", { class: this.getChipClass(this.chipArray.length > this.maxChip), id: "text-chip", text: `+${this.chipArray.length - this.maxChip}`, uppercase: false, bold: false, onMouseDown: this.chipMouseDownEvent }))
|
|
680
698
|
: null,
|
|
681
|
-
this.clear
|
|
682
|
-
|
|
683
|
-
h("
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
699
|
+
h("div", { class: this.clear || this.search ? 'inline' : null, slot: 'container' },
|
|
700
|
+
this.clear
|
|
701
|
+
? h("div", { class: "clear-button-container" },
|
|
702
|
+
h("button", { class: "clear-button", onClick: this.clearAll }, this.getClearText()))
|
|
703
|
+
: null,
|
|
704
|
+
this.search
|
|
705
|
+
? h("input", { id: "inputFilter", class: "filter", placeholder: "filter", onInput: this.inputEvent })
|
|
706
|
+
: null),
|
|
688
707
|
this.formatOptions.length > 0
|
|
689
708
|
? h("sas-checkbox-group", { slot: "container", max: this.max, options: this.formatOptions, values: this.values, selectAll: this.selectAll, selectAllText: this.selectAllText })
|
|
690
709
|
: h("slot", { slot: "container" }),
|
|
@@ -11250,7 +11250,7 @@ let SasMenuBar$1 = class extends H {
|
|
|
11250
11250
|
static get style() { return sasMenuBarCss; }
|
|
11251
11251
|
};
|
|
11252
11252
|
|
|
11253
|
-
const sasMultiselectCss = ":host{display:block;--checkbox-padding:8px}:host sas-form-input-template{--input-height:var(--multiselect-height, 40px)}:host .input-container{position:absolute;top:50%;transform:translateY(-50%);left:10px;right:30px;white-space:nowrap;display:flex;align-items:center;height:100%}:host .input-container:focus{outline:none}:host sas-chip{margin-right:10px;--chip-padding:2px 10px;box-sizing:border-box}:host #text-chip{color:var(--primary)}:host .clear-button-container{display:flex;justify-content:flex-end}:host .clear-button{color:var(--primary);border:none;background-color:transparent;cursor:pointer;text-decoration:underline}:host .filter{border:none;
|
|
11253
|
+
const sasMultiselectCss = ":host{display:block;--checkbox-padding:8px}:host sas-form-input-template{--input-height:var(--multiselect-height, 40px)}:host .input-container{position:absolute;top:50%;transform:translateY(-50%);left:10px;right:30px;white-space:nowrap;display:flex;align-items:center;height:100%}:host .input-container:focus{outline:none}:host sas-chip{margin-right:10px;--chip-padding:2px 10px;box-sizing:border-box}:host #text-chip{color:var(--primary)}:host .clear-button-container{display:flex;justify-content:flex-end;text-wrap:nowrap;padding:10px}:host .clear-button{color:var(--primary);border:none;background-color:transparent;cursor:pointer;text-decoration:underline}:host .filter{border:none;box-sizing:border-box;color:var(--s-500);font-size:14px;width:100%;padding:10px}:host .filter:focus{outline:none;background-color:white}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;margin-left:auto;box-shadow:none}:host sas-checkbox-group{max-height:200px;overflow-y:auto;position:relative}:host sas-checkbox{box-sizing:border-box;width:100%;outline:none}:host #no-match-tip:not(.hide){display:grid;grid-template-columns:max-content auto;grid-gap:10px;padding:10px 15px}:host .no-match-add-new-option-button{margin:0;color:#0D76B4;font-family:roboto;font-weight:500;cursor:pointer;margin-right:auto}:host .hide{display:none}:host .inline{display:flex;border-bottom:1px solid var(--s-300);flex-direction:row-reverse}";
|
|
11254
11254
|
|
|
11255
11255
|
let SasMultiselect$1 = class extends H {
|
|
11256
11256
|
constructor() {
|
|
@@ -11899,14 +11899,34 @@ let SasMultiselect$1 = class extends H {
|
|
|
11899
11899
|
this.filterText = "";
|
|
11900
11900
|
this.filter();
|
|
11901
11901
|
}
|
|
11902
|
+
getSelectedDisabledOptionValues() {
|
|
11903
|
+
const disabledOptions = this.options.filter(option => {
|
|
11904
|
+
return option.disabled === true;
|
|
11905
|
+
});
|
|
11906
|
+
const disabledSubOptions = this.options
|
|
11907
|
+
.filter(option => { var _a; return ((_a = option.sub) === null || _a === void 0 ? void 0 : _a.length) > 0; })
|
|
11908
|
+
.map(option => option.sub)
|
|
11909
|
+
.reduce((acc, curVal) => acc.concat(curVal), [])
|
|
11910
|
+
.filter(subOption => subOption.disabled === true);
|
|
11911
|
+
const selectedOptions = this.values;
|
|
11912
|
+
const selectedDisabledOptionValues = selectedOptions.filter(selectedOption => {
|
|
11913
|
+
return disabledOptions.some(disabledOption => disabledOption.value === selectedOption)
|
|
11914
|
+
|| disabledSubOptions.some(disabledSubOption => disabledSubOption.value === selectedOption);
|
|
11915
|
+
});
|
|
11916
|
+
return selectedDisabledOptionValues;
|
|
11917
|
+
}
|
|
11902
11918
|
clearSelection() {
|
|
11903
|
-
|
|
11919
|
+
// When selection is cleared by user, don't clear any disabled options
|
|
11920
|
+
this.values = this.getSelectedDisabledOptionValues();
|
|
11904
11921
|
this.update();
|
|
11905
11922
|
}
|
|
11906
11923
|
getClearText() {
|
|
11907
11924
|
const inputFilter = this.el.shadowRoot.querySelector('#inputFilter');
|
|
11908
11925
|
if (inputFilter === null) {
|
|
11909
|
-
if (this.chipArray.length === 0) {
|
|
11926
|
+
if (this.chipArray.length === 0 && !this.search) {
|
|
11927
|
+
this.buttonFilterText = 'Clear Selection';
|
|
11928
|
+
}
|
|
11929
|
+
else if (this.chipArray.length === 0) {
|
|
11910
11930
|
this.buttonFilterText = 'Clear';
|
|
11911
11931
|
}
|
|
11912
11932
|
else {
|
|
@@ -11929,11 +11949,11 @@ let SasMultiselect$1 = class extends H {
|
|
|
11929
11949
|
render() {
|
|
11930
11950
|
return (h(Host, { tabindex: "0" }, h("sas-form-input-template", { label: this.label, outside: this.outside, placeholder: this.placeholder, "icon-right": "far fa-chevron-down", required: this.required, readonly: true, value: this.value, disabled: this.disabled, "data-message": this.message, position: this.position, minimumPixelsAboveComponentRequired: 250 }, this.type === 'chip'
|
|
11931
11951
|
? h("div", { class: "input-container", tabindex: -1, slot: "input" }, this.getChipElement(), h("sas-chip", { class: this.getChipClass(this.chipArray.length > this.maxChip), id: "text-chip", text: `+${this.chipArray.length - this.maxChip}`, uppercase: false, bold: false, onMouseDown: this.chipMouseDownEvent }))
|
|
11932
|
-
: null, this.clear
|
|
11933
|
-
? h("div", {
|
|
11952
|
+
: null, h("div", { class: this.clear || this.search ? 'inline' : null, slot: 'container' }, this.clear
|
|
11953
|
+
? h("div", { class: "clear-button-container" }, h("button", { class: "clear-button", onClick: this.clearAll }, this.getClearText()))
|
|
11934
11954
|
: null, this.search
|
|
11935
|
-
? h("input", { id: "inputFilter",
|
|
11936
|
-
: null, this.formatOptions.length > 0
|
|
11955
|
+
? h("input", { id: "inputFilter", class: "filter", placeholder: "filter", onInput: this.inputEvent })
|
|
11956
|
+
: null), this.formatOptions.length > 0
|
|
11937
11957
|
? h("sas-checkbox-group", { slot: "container", max: this.max, options: this.formatOptions, values: this.values, selectAll: this.selectAll, selectAllText: this.selectAllText })
|
|
11938
11958
|
: h("slot", { slot: "container" }), h("div", { slot: "container", class: "hide", id: "no-match-tip" }, this.getNoMatchTipTextContent(), this.noMatchAction === 'show_no_match_add_new_option'
|
|
11939
11959
|
? h("p", { onClick: this.addNewOptionClickEvent, class: "no-match-add-new-option-button" }, "Add")
|
|
@@ -4289,7 +4289,7 @@ let SasListItem = class {
|
|
|
4289
4289
|
};
|
|
4290
4290
|
SasListItem.style = sasListItemCss;
|
|
4291
4291
|
|
|
4292
|
-
const sasMultiselectCss = ":host{display:block;--checkbox-padding:8px}:host sas-form-input-template{--input-height:var(--multiselect-height, 40px)}:host .input-container{position:absolute;top:50%;transform:translateY(-50%);left:10px;right:30px;white-space:nowrap;display:flex;align-items:center;height:100%}:host .input-container:focus{outline:none}:host sas-chip{margin-right:10px;--chip-padding:2px 10px;box-sizing:border-box}:host #text-chip{color:var(--primary)}:host .clear-button-container{display:flex;justify-content:flex-end}:host .clear-button{color:var(--primary);border:none;background-color:transparent;cursor:pointer;text-decoration:underline}:host .filter{border:none;
|
|
4292
|
+
const sasMultiselectCss = ":host{display:block;--checkbox-padding:8px}:host sas-form-input-template{--input-height:var(--multiselect-height, 40px)}:host .input-container{position:absolute;top:50%;transform:translateY(-50%);left:10px;right:30px;white-space:nowrap;display:flex;align-items:center;height:100%}:host .input-container:focus{outline:none}:host sas-chip{margin-right:10px;--chip-padding:2px 10px;box-sizing:border-box}:host #text-chip{color:var(--primary)}:host .clear-button-container{display:flex;justify-content:flex-end;text-wrap:nowrap;padding:10px}:host .clear-button{color:var(--primary);border:none;background-color:transparent;cursor:pointer;text-decoration:underline}:host .filter{border:none;box-sizing:border-box;color:var(--s-500);font-size:14px;width:100%;padding:10px}:host .filter:focus{outline:none;background-color:white}:host ::-webkit-input-placeholder{color:var(--s-400)}:host :-ms-input-placeholder{color:var(--s-400)}:host ::placeholder{color:var(--s-400)}:host .clear-icon{--icon-color:white;--icon-background-color:var(--s-300);--icon-background-width:14px;--icon-background-height:14px;--icon-size:9px;margin-left:auto;box-shadow:none}:host sas-checkbox-group{max-height:200px;overflow-y:auto;position:relative}:host sas-checkbox{box-sizing:border-box;width:100%;outline:none}:host #no-match-tip:not(.hide){display:grid;grid-template-columns:max-content auto;grid-gap:10px;padding:10px 15px}:host .no-match-add-new-option-button{margin:0;color:#0D76B4;font-family:roboto;font-weight:500;cursor:pointer;margin-right:auto}:host .hide{display:none}:host .inline{display:flex;border-bottom:1px solid var(--s-300);flex-direction:row-reverse}";
|
|
4293
4293
|
|
|
4294
4294
|
let SasMultiselect = class {
|
|
4295
4295
|
constructor(hostRef) {
|
|
@@ -4936,14 +4936,34 @@ let SasMultiselect = class {
|
|
|
4936
4936
|
this.filterText = "";
|
|
4937
4937
|
this.filter();
|
|
4938
4938
|
}
|
|
4939
|
+
getSelectedDisabledOptionValues() {
|
|
4940
|
+
const disabledOptions = this.options.filter(option => {
|
|
4941
|
+
return option.disabled === true;
|
|
4942
|
+
});
|
|
4943
|
+
const disabledSubOptions = this.options
|
|
4944
|
+
.filter(option => { var _a; return ((_a = option.sub) === null || _a === void 0 ? void 0 : _a.length) > 0; })
|
|
4945
|
+
.map(option => option.sub)
|
|
4946
|
+
.reduce((acc, curVal) => acc.concat(curVal), [])
|
|
4947
|
+
.filter(subOption => subOption.disabled === true);
|
|
4948
|
+
const selectedOptions = this.values;
|
|
4949
|
+
const selectedDisabledOptionValues = selectedOptions.filter(selectedOption => {
|
|
4950
|
+
return disabledOptions.some(disabledOption => disabledOption.value === selectedOption)
|
|
4951
|
+
|| disabledSubOptions.some(disabledSubOption => disabledSubOption.value === selectedOption);
|
|
4952
|
+
});
|
|
4953
|
+
return selectedDisabledOptionValues;
|
|
4954
|
+
}
|
|
4939
4955
|
clearSelection() {
|
|
4940
|
-
|
|
4956
|
+
// When selection is cleared by user, don't clear any disabled options
|
|
4957
|
+
this.values = this.getSelectedDisabledOptionValues();
|
|
4941
4958
|
this.update();
|
|
4942
4959
|
}
|
|
4943
4960
|
getClearText() {
|
|
4944
4961
|
const inputFilter = this.el.shadowRoot.querySelector('#inputFilter');
|
|
4945
4962
|
if (inputFilter === null) {
|
|
4946
|
-
if (this.chipArray.length === 0) {
|
|
4963
|
+
if (this.chipArray.length === 0 && !this.search) {
|
|
4964
|
+
this.buttonFilterText = 'Clear Selection';
|
|
4965
|
+
}
|
|
4966
|
+
else if (this.chipArray.length === 0) {
|
|
4947
4967
|
this.buttonFilterText = 'Clear';
|
|
4948
4968
|
}
|
|
4949
4969
|
else {
|
|
@@ -4966,11 +4986,11 @@ let SasMultiselect = class {
|
|
|
4966
4986
|
render() {
|
|
4967
4987
|
return (h(Host, { tabindex: "0" }, h("sas-form-input-template", { label: this.label, outside: this.outside, placeholder: this.placeholder, "icon-right": "far fa-chevron-down", required: this.required, readonly: true, value: this.value, disabled: this.disabled, "data-message": this.message, position: this.position, minimumPixelsAboveComponentRequired: 250 }, this.type === 'chip'
|
|
4968
4988
|
? h("div", { class: "input-container", tabindex: -1, slot: "input" }, this.getChipElement(), h("sas-chip", { class: this.getChipClass(this.chipArray.length > this.maxChip), id: "text-chip", text: `+${this.chipArray.length - this.maxChip}`, uppercase: false, bold: false, onMouseDown: this.chipMouseDownEvent }))
|
|
4969
|
-
: null, this.clear
|
|
4970
|
-
? h("div", {
|
|
4989
|
+
: null, h("div", { class: this.clear || this.search ? 'inline' : null, slot: 'container' }, this.clear
|
|
4990
|
+
? h("div", { class: "clear-button-container" }, h("button", { class: "clear-button", onClick: this.clearAll }, this.getClearText()))
|
|
4971
4991
|
: null, this.search
|
|
4972
|
-
? h("input", { id: "inputFilter",
|
|
4973
|
-
: null, this.formatOptions.length > 0
|
|
4992
|
+
? h("input", { id: "inputFilter", class: "filter", placeholder: "filter", onInput: this.inputEvent })
|
|
4993
|
+
: null), this.formatOptions.length > 0
|
|
4974
4994
|
? h("sas-checkbox-group", { slot: "container", max: this.max, options: this.formatOptions, values: this.values, selectAll: this.selectAll, selectAllText: this.selectAllText })
|
|
4975
4995
|
: h("slot", { slot: "container" }), h("div", { slot: "container", class: "hide", id: "no-match-tip" }, this.getNoMatchTipTextContent(), this.noMatchAction === 'show_no_match_add_new_option'
|
|
4976
4996
|
? h("p", { onClick: this.addNewOptionClickEvent, class: "no-match-add-new-option-button" }, "Add")
|