@descope/web-components-ui 1.0.240 → 1.0.241
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/index.cjs.js +44 -10
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +44 -10
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/1000.js +1 -1
- package/dist/umd/descope-multi-select-combo-box-index-js.js +1 -1
- package/package.json +1 -1
- package/src/components/descope-multi-select-combo-box/MultiSelectComboBoxClass.js +31 -4
- package/src/mixins/inputValidationMixin.js +13 -6
package/dist/index.esm.js
CHANGED
@@ -759,6 +759,14 @@ const inputValidationMixin = (superclass) =>
|
|
759
759
|
return `Maximum length is ${this.getAttribute('maxlength')}. `;
|
760
760
|
}
|
761
761
|
|
762
|
+
get defaultErrorMsgRangeUnderflow() {
|
763
|
+
return `At least ${this.minItemsSelection} items are required.`;
|
764
|
+
}
|
765
|
+
|
766
|
+
get defaultErrorMsgRangeOverflow() {
|
767
|
+
return `At most ${this.maxItemsSelection} items are allowed.`;
|
768
|
+
}
|
769
|
+
|
762
770
|
getErrorMessage(flags) {
|
763
771
|
const {
|
764
772
|
valueMissing,
|
@@ -777,12 +785,7 @@ const inputValidationMixin = (superclass) =>
|
|
777
785
|
return (
|
778
786
|
this.getAttribute(errorAttributes.valueMissing) || this.defaultErrorMsgValueMissing
|
779
787
|
);
|
780
|
-
case patternMismatch ||
|
781
|
-
typeMismatch ||
|
782
|
-
stepMismatch ||
|
783
|
-
rangeOverflow ||
|
784
|
-
rangeUnderflow ||
|
785
|
-
badInput:
|
788
|
+
case patternMismatch || typeMismatch || stepMismatch || badInput:
|
786
789
|
return (
|
787
790
|
this.getAttribute(errorAttributes.patternMismatch) ||
|
788
791
|
this.defaultErrorMsgPatternMismatch
|
@@ -791,6 +794,10 @@ const inputValidationMixin = (superclass) =>
|
|
791
794
|
return this.getAttribute(errorAttributes.tooShort) || this.defaultErrorMsgTooShort;
|
792
795
|
case tooLong:
|
793
796
|
return this.getAttribute(errorAttributes.tooLong) || this.defaultErrorMsgTooLong;
|
797
|
+
case rangeUnderflow:
|
798
|
+
return this.defaultErrorMsgRangeUnderflow;
|
799
|
+
case rangeOverflow:
|
800
|
+
return this.defaultErrorMsgRangeOverflow;
|
794
801
|
case customError:
|
795
802
|
return this.validationMessage;
|
796
803
|
default:
|
@@ -9091,6 +9098,14 @@ const MultiSelectComboBoxMixin = (superclass) =>
|
|
9091
9098
|
return this.getAttribute('allow-custom-value') === 'true';
|
9092
9099
|
}
|
9093
9100
|
|
9101
|
+
get minItemsSelection() {
|
9102
|
+
return parseInt(this.getAttribute('min-items-selection'), 10) || 0;
|
9103
|
+
}
|
9104
|
+
|
9105
|
+
get maxItemsSelection() {
|
9106
|
+
return parseInt(this.getAttribute('max-items-selection'), 10) || 0;
|
9107
|
+
}
|
9108
|
+
|
9094
9109
|
// eslint-disable-next-line class-methods-use-this
|
9095
9110
|
isValidDataType(data) {
|
9096
9111
|
const isValid = Array.isArray(data);
|
@@ -9235,18 +9250,37 @@ const MultiSelectComboBoxMixin = (superclass) =>
|
|
9235
9250
|
}
|
9236
9251
|
}
|
9237
9252
|
|
9238
|
-
|
9239
|
-
super.init?.();
|
9240
|
-
|
9253
|
+
setGetValidity() {
|
9241
9254
|
// eslint-disable-next-line func-names
|
9242
9255
|
this.getValidity = function () {
|
9243
|
-
if (
|
9256
|
+
if (this.isRequired && !this.value.length) {
|
9244
9257
|
return {
|
9245
9258
|
valueMissing: true,
|
9246
9259
|
};
|
9247
9260
|
}
|
9261
|
+
// If the field is not required, no minimum selection can be set
|
9262
|
+
if (
|
9263
|
+
this.isRequired &&
|
9264
|
+
this.minItemsSelection &&
|
9265
|
+
this.value.length < this.minItemsSelection
|
9266
|
+
) {
|
9267
|
+
return {
|
9268
|
+
rangeUnderflow: true,
|
9269
|
+
};
|
9270
|
+
}
|
9271
|
+
if (this.maxItemsSelection && this.value.length > this.maxItemsSelection) {
|
9272
|
+
return {
|
9273
|
+
rangeOverflow: true,
|
9274
|
+
};
|
9275
|
+
}
|
9248
9276
|
return {};
|
9249
9277
|
};
|
9278
|
+
}
|
9279
|
+
|
9280
|
+
init() {
|
9281
|
+
super.init?.();
|
9282
|
+
|
9283
|
+
this.setGetValidity();
|
9250
9284
|
|
9251
9285
|
this.setComboBoxDescriptor();
|
9252
9286
|
|