@descope/web-components-ui 1.97.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 +88 -52
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +88 -52
- 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/dist/umd/descope-date-field-descope-calendar-index-js.js +1 -1
- package/dist/umd/descope-date-field-descope-calendar-index-js.js.map +1 -1
- package/dist/umd/descope-date-field-index-js.js +1 -1
- package/dist/umd/descope-date-field-index-js.js.map +1 -1
- package/package.json +14 -14
- package/src/components/descope-date-field/DateFieldClass.js +12 -17
- package/src/components/descope-date-field/consts.js +7 -3
- package/src/mixins/inputValidationMixin.js +19 -13
package/dist/cjs/index.cjs.js
CHANGED
@@ -1902,6 +1902,12 @@ const inputValidationMixin$1 = (superclass) =>
|
|
1902
1902
|
return `Please match the requested type.`;
|
1903
1903
|
}
|
1904
1904
|
|
1905
|
+
getCustomErrorMessage(attr, defaultMsg) {
|
1906
|
+
return this.hasAttribute(attr)
|
1907
|
+
? this.getAttribute(attr) || ' '
|
1908
|
+
: defaultMsg;
|
1909
|
+
}
|
1910
|
+
|
1905
1911
|
getErrorMessage(flags) {
|
1906
1912
|
const {
|
1907
1913
|
valueMissing,
|
@@ -1918,31 +1924,39 @@ const inputValidationMixin$1 = (superclass) =>
|
|
1918
1924
|
|
1919
1925
|
switch (true) {
|
1920
1926
|
case valueMissing:
|
1921
|
-
return (
|
1922
|
-
|
1927
|
+
return this.getCustomErrorMessage(
|
1928
|
+
errorAttributes$1.valueMissing,
|
1929
|
+
this.defaultErrorMsgValueMissing,
|
1923
1930
|
);
|
1924
1931
|
case patternMismatch || stepMismatch || badInput:
|
1925
|
-
return (
|
1926
|
-
|
1927
|
-
this.defaultErrorMsgPatternMismatch
|
1932
|
+
return this.getCustomErrorMessage(
|
1933
|
+
errorAttributes$1.patternMismatch,
|
1934
|
+
this.defaultErrorMsgPatternMismatch,
|
1928
1935
|
);
|
1929
1936
|
case typeMismatch:
|
1930
|
-
return (
|
1931
|
-
|
1932
|
-
this.
|
1933
|
-
this.defaultErrorMsgTypeMismatch
|
1937
|
+
return this.getCustomErrorMessage(
|
1938
|
+
errorAttributes$1.typeMismatch,
|
1939
|
+
this.defaultErrorMsgTypeMismatch,
|
1934
1940
|
);
|
1935
1941
|
case tooShort:
|
1936
|
-
return this.
|
1942
|
+
return this.getCustomErrorMessage(
|
1943
|
+
errorAttributes$1.tooShort,
|
1944
|
+
this.defaultErrorMsgTooShort,
|
1945
|
+
);
|
1937
1946
|
case tooLong:
|
1938
|
-
return this.
|
1947
|
+
return this.getCustomErrorMessage(
|
1948
|
+
errorAttributes$1.tooLong,
|
1949
|
+
this.defaultErrorMsgTooLong,
|
1950
|
+
);
|
1939
1951
|
case rangeUnderflow:
|
1940
|
-
return (
|
1941
|
-
|
1952
|
+
return this.getCustomErrorMessage(
|
1953
|
+
errorAttributes$1.rangeUnderflow,
|
1954
|
+
this.defaultErrorMsgRangeUnderflow,
|
1942
1955
|
);
|
1943
1956
|
case rangeOverflow:
|
1944
|
-
return (
|
1945
|
-
|
1957
|
+
return this.getCustomErrorMessage(
|
1958
|
+
errorAttributes$1.rangeOverflow,
|
1959
|
+
this.defaultErrorMsgRangeOverflow,
|
1946
1960
|
);
|
1947
1961
|
case customError:
|
1948
1962
|
return this.validationMessage;
|
@@ -1953,7 +1967,11 @@ const inputValidationMixin$1 = (superclass) =>
|
|
1953
1967
|
|
1954
1968
|
#setValidity() {
|
1955
1969
|
const validity = this.isReadOnly ? {} : this.getValidity();
|
1956
|
-
this.#internals.setValidity(
|
1970
|
+
this.#internals.setValidity(
|
1971
|
+
validity,
|
1972
|
+
this.getErrorMessage(validity),
|
1973
|
+
this.validationTarget,
|
1974
|
+
);
|
1957
1975
|
}
|
1958
1976
|
|
1959
1977
|
get validationMessage() {
|
@@ -1990,7 +2008,11 @@ const inputValidationMixin$1 = (superclass) =>
|
|
1990
2008
|
|
1991
2009
|
setCustomValidity(errorMessage) {
|
1992
2010
|
if (errorMessage) {
|
1993
|
-
this.#internals.setValidity(
|
2011
|
+
this.#internals.setValidity(
|
2012
|
+
{ customError: true },
|
2013
|
+
errorMessage,
|
2014
|
+
this.validationTarget,
|
2015
|
+
);
|
1994
2016
|
} else {
|
1995
2017
|
this.#internals.setValidity({});
|
1996
2018
|
this.#setValidity();
|
@@ -1998,15 +2020,24 @@ const inputValidationMixin$1 = (superclass) =>
|
|
1998
2020
|
}
|
1999
2021
|
|
2000
2022
|
get isRequired() {
|
2001
|
-
return
|
2023
|
+
return (
|
2024
|
+
this.hasAttribute('required') &&
|
2025
|
+
this.getAttribute('required') !== 'false'
|
2026
|
+
);
|
2002
2027
|
}
|
2003
2028
|
|
2004
2029
|
get isReadOnly() {
|
2005
|
-
return
|
2030
|
+
return (
|
2031
|
+
this.hasAttribute('readonly') &&
|
2032
|
+
this.getAttribute('readonly') !== 'false'
|
2033
|
+
);
|
2006
2034
|
}
|
2007
2035
|
|
2008
2036
|
get isDisabled() {
|
2009
|
-
return
|
2037
|
+
return (
|
2038
|
+
this.hasAttribute('disabled') &&
|
2039
|
+
this.getAttribute('disabled') !== 'false'
|
2040
|
+
);
|
2010
2041
|
}
|
2011
2042
|
|
2012
2043
|
get pattern() {
|
@@ -3493,6 +3524,10 @@ const inputValidationMixin = (superclass) =>
|
|
3493
3524
|
return `Please match the requested type.`;
|
3494
3525
|
}
|
3495
3526
|
|
3527
|
+
getCustomErrorMessage(attr, defaultMsg) {
|
3528
|
+
return this.hasAttribute(attr) ? this.getAttribute(attr) || ' ' : defaultMsg;
|
3529
|
+
}
|
3530
|
+
|
3496
3531
|
getErrorMessage(flags) {
|
3497
3532
|
const {
|
3498
3533
|
valueMissing,
|
@@ -3509,31 +3544,33 @@ const inputValidationMixin = (superclass) =>
|
|
3509
3544
|
|
3510
3545
|
switch (true) {
|
3511
3546
|
case valueMissing:
|
3512
|
-
return (
|
3513
|
-
|
3547
|
+
return this.getCustomErrorMessage(
|
3548
|
+
errorAttributes.valueMissing,
|
3549
|
+
this.defaultErrorMsgValueMissing
|
3514
3550
|
);
|
3515
3551
|
case patternMismatch || stepMismatch || badInput:
|
3516
|
-
return (
|
3517
|
-
|
3552
|
+
return this.getCustomErrorMessage(
|
3553
|
+
errorAttributes.patternMismatch,
|
3518
3554
|
this.defaultErrorMsgPatternMismatch
|
3519
3555
|
);
|
3520
3556
|
case typeMismatch:
|
3521
|
-
return (
|
3522
|
-
|
3523
|
-
this.getAttribute(errorAttributes.patternMismatch) ||
|
3557
|
+
return this.getCustomErrorMessage(
|
3558
|
+
errorAttributes.typeMismatch,
|
3524
3559
|
this.defaultErrorMsgTypeMismatch
|
3525
3560
|
);
|
3526
3561
|
case tooShort:
|
3527
|
-
return this.
|
3562
|
+
return this.getCustomErrorMessage(errorAttributes.tooShort, this.defaultErrorMsgTooShort);
|
3528
3563
|
case tooLong:
|
3529
|
-
return this.
|
3564
|
+
return this.getCustomErrorMessage(errorAttributes.tooLong, this.defaultErrorMsgTooLong);
|
3530
3565
|
case rangeUnderflow:
|
3531
|
-
return (
|
3532
|
-
|
3566
|
+
return this.getCustomErrorMessage(
|
3567
|
+
errorAttributes.rangeUnderflow,
|
3568
|
+
this.defaultErrorMsgRangeUnderflow
|
3533
3569
|
);
|
3534
3570
|
case rangeOverflow:
|
3535
|
-
return (
|
3536
|
-
|
3571
|
+
return this.getCustomErrorMessage(
|
3572
|
+
errorAttributes.rangeOverflow,
|
3573
|
+
this.defaultErrorMsgRangeOverflow
|
3537
3574
|
);
|
3538
3575
|
case customError:
|
3539
3576
|
return this.validationMessage;
|
@@ -15681,9 +15718,13 @@ const weekdays = [
|
|
15681
15718
|
];
|
15682
15719
|
|
15683
15720
|
const counterConfig = {
|
15684
|
-
MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM'
|
15685
|
-
DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD'
|
15686
|
-
YEAR: { id: 'year', min:
|
15721
|
+
MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM' },
|
15722
|
+
DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD' },
|
15723
|
+
YEAR: { id: 'year', min: 0, max: 9999, placeholder: 'YYYY' },
|
15724
|
+
};
|
15725
|
+
|
15726
|
+
const valRange = {
|
15727
|
+
year: { min: 1900, max: 2099 },
|
15687
15728
|
};
|
15688
15729
|
|
15689
15730
|
const BUTTON_LABEL_DONE = 'Done';
|
@@ -17357,16 +17398,6 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17357
17398
|
});
|
17358
17399
|
}
|
17359
17400
|
|
17360
|
-
setYearRange(val) {
|
17361
|
-
if (!val) return;
|
17362
|
-
const [min, max] = val.split?.('-');
|
17363
|
-
if (min && max) {
|
17364
|
-
const counter = this.getCounterById('year');
|
17365
|
-
counter.setMin(min);
|
17366
|
-
counter.setMax(max);
|
17367
|
-
}
|
17368
|
-
}
|
17369
|
-
|
17370
17401
|
togglePopoverAccess(visibility) {
|
17371
17402
|
if (visibility) {
|
17372
17403
|
this.popoverToggleButton.classList.remove('hidden');
|
@@ -17379,9 +17410,6 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17379
17410
|
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
17380
17411
|
|
17381
17412
|
if (oldValue !== newValue) {
|
17382
|
-
if (attrName === 'years-range') {
|
17383
|
-
this.setYearRange(newValue);
|
17384
|
-
}
|
17385
17413
|
if (attrName === 'disable-calendar') {
|
17386
17414
|
this.togglePopoverAccess(newValue !== 'true');
|
17387
17415
|
}
|
@@ -17407,9 +17435,17 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17407
17435
|
// To prevent this error from being submitted, we evaluate the
|
17408
17436
|
// date parts against their generated Date value.
|
17409
17437
|
isInvalidDate() {
|
17410
|
-
|
17411
|
-
|
17412
|
-
|
17438
|
+
const yearCounter = this.getCounterById('year');
|
17439
|
+
const isYearOutOfRange =
|
17440
|
+
yearCounter.numberValue > valRange['year'].max ||
|
17441
|
+
yearCounter.numberValue < valRange['year'].min;
|
17442
|
+
|
17443
|
+
const isDateDisplayMismatch = Object.entries(this.getDateVals()).some(([key, val]) => {
|
17444
|
+
const counter = this.getCounterById(key);
|
17445
|
+
return !val || counter.numberValue !== val;
|
17446
|
+
});
|
17447
|
+
|
17448
|
+
return isYearOutOfRange || isDateDisplayMismatch;
|
17413
17449
|
}
|
17414
17450
|
|
17415
17451
|
getValidity() {
|