@descope/web-components-ui 1.98.0 → 1.99.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/cjs/index.cjs.js +70 -33
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +70 -33
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/8961.js +1 -1
- package/dist/umd/8961.js.map +1 -1
- package/dist/umd/9365.js +1 -1
- package/dist/umd/9365.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/package.json +14 -14
- package/src/mixins/inputValidationMixin.js +19 -13
package/dist/index.esm.js
CHANGED
@@ -1453,6 +1453,10 @@ const inputValidationMixin$1 = (superclass) =>
|
|
1453
1453
|
return `Please match the requested type.`;
|
1454
1454
|
}
|
1455
1455
|
|
1456
|
+
getCustomErrorMessage(attr, defaultMsg) {
|
1457
|
+
return this.hasAttribute(attr) ? this.getAttribute(attr) || ' ' : defaultMsg;
|
1458
|
+
}
|
1459
|
+
|
1456
1460
|
getErrorMessage(flags) {
|
1457
1461
|
const {
|
1458
1462
|
valueMissing,
|
@@ -1469,31 +1473,33 @@ const inputValidationMixin$1 = (superclass) =>
|
|
1469
1473
|
|
1470
1474
|
switch (true) {
|
1471
1475
|
case valueMissing:
|
1472
|
-
return (
|
1473
|
-
|
1476
|
+
return this.getCustomErrorMessage(
|
1477
|
+
errorAttributes$1.valueMissing,
|
1478
|
+
this.defaultErrorMsgValueMissing
|
1474
1479
|
);
|
1475
1480
|
case patternMismatch || stepMismatch || badInput:
|
1476
|
-
return (
|
1477
|
-
|
1481
|
+
return this.getCustomErrorMessage(
|
1482
|
+
errorAttributes$1.patternMismatch,
|
1478
1483
|
this.defaultErrorMsgPatternMismatch
|
1479
1484
|
);
|
1480
1485
|
case typeMismatch:
|
1481
|
-
return (
|
1482
|
-
|
1483
|
-
this.getAttribute(errorAttributes$1.patternMismatch) ||
|
1486
|
+
return this.getCustomErrorMessage(
|
1487
|
+
errorAttributes$1.typeMismatch,
|
1484
1488
|
this.defaultErrorMsgTypeMismatch
|
1485
1489
|
);
|
1486
1490
|
case tooShort:
|
1487
|
-
return this.
|
1491
|
+
return this.getCustomErrorMessage(errorAttributes$1.tooShort, this.defaultErrorMsgTooShort);
|
1488
1492
|
case tooLong:
|
1489
|
-
return this.
|
1493
|
+
return this.getCustomErrorMessage(errorAttributes$1.tooLong, this.defaultErrorMsgTooLong);
|
1490
1494
|
case rangeUnderflow:
|
1491
|
-
return (
|
1492
|
-
|
1495
|
+
return this.getCustomErrorMessage(
|
1496
|
+
errorAttributes$1.rangeUnderflow,
|
1497
|
+
this.defaultErrorMsgRangeUnderflow
|
1493
1498
|
);
|
1494
1499
|
case rangeOverflow:
|
1495
|
-
return (
|
1496
|
-
|
1500
|
+
return this.getCustomErrorMessage(
|
1501
|
+
errorAttributes$1.rangeOverflow,
|
1502
|
+
this.defaultErrorMsgRangeOverflow
|
1497
1503
|
);
|
1498
1504
|
case customError:
|
1499
1505
|
return this.validationMessage;
|
@@ -3726,6 +3732,12 @@ const inputValidationMixin = (superclass) =>
|
|
3726
3732
|
return `Please match the requested type.`;
|
3727
3733
|
}
|
3728
3734
|
|
3735
|
+
getCustomErrorMessage(attr, defaultMsg) {
|
3736
|
+
return this.hasAttribute(attr)
|
3737
|
+
? this.getAttribute(attr) || ' '
|
3738
|
+
: defaultMsg;
|
3739
|
+
}
|
3740
|
+
|
3729
3741
|
getErrorMessage(flags) {
|
3730
3742
|
const {
|
3731
3743
|
valueMissing,
|
@@ -3742,31 +3754,39 @@ const inputValidationMixin = (superclass) =>
|
|
3742
3754
|
|
3743
3755
|
switch (true) {
|
3744
3756
|
case valueMissing:
|
3745
|
-
return (
|
3746
|
-
|
3757
|
+
return this.getCustomErrorMessage(
|
3758
|
+
errorAttributes.valueMissing,
|
3759
|
+
this.defaultErrorMsgValueMissing,
|
3747
3760
|
);
|
3748
3761
|
case patternMismatch || stepMismatch || badInput:
|
3749
|
-
return (
|
3750
|
-
|
3751
|
-
this.defaultErrorMsgPatternMismatch
|
3762
|
+
return this.getCustomErrorMessage(
|
3763
|
+
errorAttributes.patternMismatch,
|
3764
|
+
this.defaultErrorMsgPatternMismatch,
|
3752
3765
|
);
|
3753
3766
|
case typeMismatch:
|
3754
|
-
return (
|
3755
|
-
|
3756
|
-
this.
|
3757
|
-
this.defaultErrorMsgTypeMismatch
|
3767
|
+
return this.getCustomErrorMessage(
|
3768
|
+
errorAttributes.typeMismatch,
|
3769
|
+
this.defaultErrorMsgTypeMismatch,
|
3758
3770
|
);
|
3759
3771
|
case tooShort:
|
3760
|
-
return this.
|
3772
|
+
return this.getCustomErrorMessage(
|
3773
|
+
errorAttributes.tooShort,
|
3774
|
+
this.defaultErrorMsgTooShort,
|
3775
|
+
);
|
3761
3776
|
case tooLong:
|
3762
|
-
return this.
|
3777
|
+
return this.getCustomErrorMessage(
|
3778
|
+
errorAttributes.tooLong,
|
3779
|
+
this.defaultErrorMsgTooLong,
|
3780
|
+
);
|
3763
3781
|
case rangeUnderflow:
|
3764
|
-
return (
|
3765
|
-
|
3782
|
+
return this.getCustomErrorMessage(
|
3783
|
+
errorAttributes.rangeUnderflow,
|
3784
|
+
this.defaultErrorMsgRangeUnderflow,
|
3766
3785
|
);
|
3767
3786
|
case rangeOverflow:
|
3768
|
-
return (
|
3769
|
-
|
3787
|
+
return this.getCustomErrorMessage(
|
3788
|
+
errorAttributes.rangeOverflow,
|
3789
|
+
this.defaultErrorMsgRangeOverflow,
|
3770
3790
|
);
|
3771
3791
|
case customError:
|
3772
3792
|
return this.validationMessage;
|
@@ -3777,7 +3797,11 @@ const inputValidationMixin = (superclass) =>
|
|
3777
3797
|
|
3778
3798
|
#setValidity() {
|
3779
3799
|
const validity = this.isReadOnly ? {} : this.getValidity();
|
3780
|
-
this.#internals.setValidity(
|
3800
|
+
this.#internals.setValidity(
|
3801
|
+
validity,
|
3802
|
+
this.getErrorMessage(validity),
|
3803
|
+
this.validationTarget,
|
3804
|
+
);
|
3781
3805
|
}
|
3782
3806
|
|
3783
3807
|
get validationMessage() {
|
@@ -3814,7 +3838,11 @@ const inputValidationMixin = (superclass) =>
|
|
3814
3838
|
|
3815
3839
|
setCustomValidity(errorMessage) {
|
3816
3840
|
if (errorMessage) {
|
3817
|
-
this.#internals.setValidity(
|
3841
|
+
this.#internals.setValidity(
|
3842
|
+
{ customError: true },
|
3843
|
+
errorMessage,
|
3844
|
+
this.validationTarget,
|
3845
|
+
);
|
3818
3846
|
} else {
|
3819
3847
|
this.#internals.setValidity({});
|
3820
3848
|
this.#setValidity();
|
@@ -3822,15 +3850,24 @@ const inputValidationMixin = (superclass) =>
|
|
3822
3850
|
}
|
3823
3851
|
|
3824
3852
|
get isRequired() {
|
3825
|
-
return
|
3853
|
+
return (
|
3854
|
+
this.hasAttribute('required') &&
|
3855
|
+
this.getAttribute('required') !== 'false'
|
3856
|
+
);
|
3826
3857
|
}
|
3827
3858
|
|
3828
3859
|
get isReadOnly() {
|
3829
|
-
return
|
3860
|
+
return (
|
3861
|
+
this.hasAttribute('readonly') &&
|
3862
|
+
this.getAttribute('readonly') !== 'false'
|
3863
|
+
);
|
3830
3864
|
}
|
3831
3865
|
|
3832
3866
|
get isDisabled() {
|
3833
|
-
return
|
3867
|
+
return (
|
3868
|
+
this.hasAttribute('disabled') &&
|
3869
|
+
this.getAttribute('disabled') !== 'false'
|
3870
|
+
);
|
3834
3871
|
}
|
3835
3872
|
|
3836
3873
|
get pattern() {
|