@descope/web-components-ui 1.96.0 → 1.98.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 +26 -23
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +26 -23
- package/dist/index.esm.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 +1 -1
- package/src/components/descope-date-field/DateCounterClass.js +4 -1
- package/src/components/descope-date-field/DateFieldClass.js +16 -20
- package/src/components/descope-date-field/consts.js +7 -3
package/dist/index.esm.js
CHANGED
@@ -5339,9 +5339,13 @@ const weekdays = [
|
|
5339
5339
|
];
|
5340
5340
|
|
5341
5341
|
const counterConfig = {
|
5342
|
-
MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM'
|
5343
|
-
DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD'
|
5344
|
-
YEAR: { id: 'year', min:
|
5342
|
+
MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM' },
|
5343
|
+
DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD' },
|
5344
|
+
YEAR: { id: 'year', min: 0, max: 9999, placeholder: 'YYYY' },
|
5345
|
+
};
|
5346
|
+
|
5347
|
+
const valRange = {
|
5348
|
+
year: { min: 1900, max: 2099 },
|
5345
5349
|
};
|
5346
5350
|
|
5347
5351
|
const BUTTON_LABEL_DONE = 'Done';
|
@@ -6546,7 +6550,10 @@ class DateCounter {
|
|
6546
6550
|
|
6547
6551
|
data = [...data, num];
|
6548
6552
|
|
6549
|
-
|
6553
|
+
// we need to re-evaluate the number value
|
6554
|
+
const numVal = Number(data.join(''));
|
6555
|
+
|
6556
|
+
if (numVal > this.max) {
|
6550
6557
|
data = [num];
|
6551
6558
|
} else if (this.length < data.length) {
|
6552
6559
|
data = data.slice(1, data.length);
|
@@ -7035,10 +7042,11 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7035
7042
|
|
7036
7043
|
if (!this.inputElement.value) {
|
7037
7044
|
this.inputElement.value = this.format;
|
7038
|
-
// If no value, on focus select the first part of the format placeholder
|
7039
|
-
this.selectedCounterIdx = 0;
|
7040
|
-
this.setInputSelectionRange();
|
7041
7045
|
}
|
7046
|
+
|
7047
|
+
// On focus select the first part of the format placeholder
|
7048
|
+
this.selectedCounterIdx = 0;
|
7049
|
+
this.setInputSelectionRange();
|
7042
7050
|
}
|
7043
7051
|
|
7044
7052
|
onBlur() {
|
@@ -7204,16 +7212,6 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7204
7212
|
});
|
7205
7213
|
}
|
7206
7214
|
|
7207
|
-
setYearRange(val) {
|
7208
|
-
if (!val) return;
|
7209
|
-
const [min, max] = val.split?.('-');
|
7210
|
-
if (min && max) {
|
7211
|
-
const counter = this.getCounterById('year');
|
7212
|
-
counter.setMin(min);
|
7213
|
-
counter.setMax(max);
|
7214
|
-
}
|
7215
|
-
}
|
7216
|
-
|
7217
7215
|
togglePopoverAccess(visibility) {
|
7218
7216
|
if (visibility) {
|
7219
7217
|
this.popoverToggleButton.classList.remove('hidden');
|
@@ -7226,9 +7224,6 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7226
7224
|
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
7227
7225
|
|
7228
7226
|
if (oldValue !== newValue) {
|
7229
|
-
if (attrName === 'years-range') {
|
7230
|
-
this.setYearRange(newValue);
|
7231
|
-
}
|
7232
7227
|
if (attrName === 'disable-calendar') {
|
7233
7228
|
this.togglePopoverAccess(newValue !== 'true');
|
7234
7229
|
}
|
@@ -7254,9 +7249,17 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7254
7249
|
// To prevent this error from being submitted, we evaluate the
|
7255
7250
|
// date parts against their generated Date value.
|
7256
7251
|
isInvalidDate() {
|
7257
|
-
|
7258
|
-
|
7259
|
-
|
7252
|
+
const yearCounter = this.getCounterById('year');
|
7253
|
+
const isYearOutOfRange =
|
7254
|
+
yearCounter.numberValue > valRange['year'].max ||
|
7255
|
+
yearCounter.numberValue < valRange['year'].min;
|
7256
|
+
|
7257
|
+
const isDateDisplayMismatch = Object.entries(this.getDateVals()).some(([key, val]) => {
|
7258
|
+
const counter = this.getCounterById(key);
|
7259
|
+
return !val || counter.numberValue !== val;
|
7260
|
+
});
|
7261
|
+
|
7262
|
+
return isYearOutOfRange || isDateDisplayMismatch;
|
7260
7263
|
}
|
7261
7264
|
|
7262
7265
|
getValidity() {
|