@descope/web-components-ui 1.87.0 → 1.89.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 +190 -108
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/index.esm.js +190 -108
- package/dist/index.esm.js.map +1 -1
- package/dist/umd/8961.js.map +1 -1
- package/dist/umd/DescopeDev.js +1 -1
- package/dist/umd/DescopeDev.js.map +1 -1
- package/dist/umd/descope-collapsible-container.js +1 -1
- package/dist/umd/descope-collapsible-container.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/dist/umd/descope-icon.js +1 -1
- package/dist/umd/descope-icon.js.map +1 -1
- package/dist/umd/descope-image.js +1 -1
- package/dist/umd/descope-image.js.map +1 -1
- package/dist/umd/descope-third-party-app-logo-index-js.js +1 -1
- package/dist/umd/descope-third-party-app-logo-index-js.js.map +1 -1
- package/dist/umd/descope-timer-button.js +1 -1
- package/dist/umd/descope-timer-button.js.map +1 -1
- package/dist/umd/descope-timer.js +1 -1
- package/dist/umd/descope-timer.js.map +1 -1
- package/package.json +14 -14
- package/src/components/descope-date-field/DateCounterClass.js +42 -11
- package/src/components/descope-date-field/DateFieldClass.js +125 -89
- package/src/components/descope-date-field/consts.js +2 -1
- package/src/components/descope-date-field/helpers.js +2 -1
- package/src/theme/components/dateField.js +7 -0
package/dist/cjs/index.cjs.js
CHANGED
@@ -1765,8 +1765,9 @@ const inputEventsDispatchingMixin$1 = (superclass) =>
|
|
1765
1765
|
#blockNativeEvents() {
|
1766
1766
|
['blur', 'focus', 'focusin', 'focusout'].forEach((event) => {
|
1767
1767
|
this.addEventListener(event, (e) => {
|
1768
|
-
e.isTrusted && e.target === this
|
1769
|
-
|
1768
|
+
if (e.isTrusted && e.target === this) {
|
1769
|
+
e.stopImmediatePropagation();
|
1770
|
+
} });
|
1770
1771
|
});
|
1771
1772
|
}
|
1772
1773
|
|
@@ -14668,9 +14669,10 @@ const base64Prefix = 'data:image/svg+xml;base64,';
|
|
14668
14669
|
|
14669
14670
|
const isBase64Svg = (src) => src.startsWith(base64Prefix);
|
14670
14671
|
|
14671
|
-
const createImgEle = (src) => {
|
14672
|
+
const createImgEle = (src, altText) => {
|
14672
14673
|
const ele = document.createElement('img');
|
14673
14674
|
ele.setAttribute('src', src);
|
14675
|
+
ele.setAttribute('alt', altText);
|
14674
14676
|
return ele;
|
14675
14677
|
};
|
14676
14678
|
|
@@ -14687,7 +14689,7 @@ const createSvgEle = (text) => {
|
|
14687
14689
|
return ele;
|
14688
14690
|
};
|
14689
14691
|
|
14690
|
-
const createImage = async (src) => {
|
14692
|
+
const createImage = async (src, altText) => {
|
14691
14693
|
try {
|
14692
14694
|
let ele;
|
14693
14695
|
if (isBase64Svg(src)) {
|
@@ -14701,7 +14703,7 @@ const createImage = async (src) => {
|
|
14701
14703
|
ele = createSvgEle(text);
|
14702
14704
|
} else {
|
14703
14705
|
// handle binary
|
14704
|
-
ele = createImgEle(src);
|
14706
|
+
ele = createImgEle(src, altText);
|
14705
14707
|
}
|
14706
14708
|
|
14707
14709
|
ele.style.setProperty('max-width', '100%');
|
@@ -14776,6 +14778,10 @@ class RawImage extends createBaseClass$1({
|
|
14776
14778
|
}
|
14777
14779
|
}
|
14778
14780
|
|
14781
|
+
get altText() {
|
14782
|
+
return this.getAttribute('alt') || '';
|
14783
|
+
}
|
14784
|
+
|
14779
14785
|
get legacySrc() {
|
14780
14786
|
return this.getAttribute('src');
|
14781
14787
|
}
|
@@ -14806,7 +14812,7 @@ class RawImage extends createBaseClass$1({
|
|
14806
14812
|
renderImage() {
|
14807
14813
|
this.toggleVisibility(this.src);
|
14808
14814
|
|
14809
|
-
createImage(this.src).then((res) => {
|
14815
|
+
createImage(this.src, this.altText).then((res) => {
|
14810
14816
|
this.innerHTML = '';
|
14811
14817
|
if (res) {
|
14812
14818
|
this.updateFillColor(res);
|
@@ -15590,6 +15596,7 @@ const COUNTER_SUPPORTED_KEYS = [
|
|
15590
15596
|
'PageUp',
|
15591
15597
|
'PageDown',
|
15592
15598
|
'Meta',
|
15599
|
+
'Enter',
|
15593
15600
|
];
|
15594
15601
|
|
15595
15602
|
const months = [
|
@@ -15620,7 +15627,7 @@ const weekdays = [
|
|
15620
15627
|
const counterConfig = {
|
15621
15628
|
MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM', count: 5, shiftCount: 10 },
|
15622
15629
|
DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD', count: 5, shiftCount: 10 },
|
15623
|
-
YEAR: { id: 'year', min:
|
15630
|
+
YEAR: { id: 'year', min: 1900, max: 2099, placeholder: 'YYYY', count: 10, shiftCount: 100 },
|
15624
15631
|
};
|
15625
15632
|
|
15626
15633
|
const BUTTON_LABEL_DONE = 'Done';
|
@@ -15632,7 +15639,7 @@ const isValidTimestamp = (val) => !Number.isNaN(Number(val));
|
|
15632
15639
|
const isNumber = (val) => !Number.isNaN(Number(val));
|
15633
15640
|
|
15634
15641
|
const getTimestampParts = (timestamp) => {
|
15635
|
-
const date =
|
15642
|
+
const date = newDate(timestamp);
|
15636
15643
|
const year = date.getFullYear();
|
15637
15644
|
const month = date.getMonth() + 1;
|
15638
15645
|
const day = date.getDate();
|
@@ -15680,6 +15687,7 @@ const getKeyMap = (key, shiftKey, metaKey) => {
|
|
15680
15687
|
shiftArrowDown: shiftKey && key === 'ArrowDown',
|
15681
15688
|
shiftPageUp: shiftKey && key === 'PageUp',
|
15682
15689
|
shiftPageDown: shiftKey && key === 'PageDown',
|
15690
|
+
enter: key === 'Enter',
|
15683
15691
|
};
|
15684
15692
|
};
|
15685
15693
|
|
@@ -16664,12 +16672,23 @@ const formats = Object.fromEntries(SUPPORTED_FORMATS.map((f) => [f, createFormat
|
|
16664
16672
|
// For examele, we have a DayCounter, MonthCounter and YearCounter, which can each separately navigate
|
16665
16673
|
// between different ranges.
|
16666
16674
|
class DateCounter {
|
16667
|
-
|
16675
|
+
#data = Object.freeze([]);
|
16676
|
+
|
16677
|
+
constructor({ id, min, max, placeholder }, onChange) {
|
16668
16678
|
this.id = id;
|
16669
|
-
this.data = [];
|
16670
16679
|
this.min = min;
|
16671
16680
|
this.max = max;
|
16672
16681
|
this.placeholder = placeholder;
|
16682
|
+
this.onChange = onChange;
|
16683
|
+
}
|
16684
|
+
|
16685
|
+
get data() {
|
16686
|
+
return this.#data;
|
16687
|
+
}
|
16688
|
+
|
16689
|
+
set data(val) {
|
16690
|
+
this.#data = Object.freeze(val);
|
16691
|
+
this.onChange?.();
|
16673
16692
|
}
|
16674
16693
|
|
16675
16694
|
get #initialNumValue() {
|
@@ -16701,23 +16720,27 @@ class DateCounter {
|
|
16701
16720
|
}
|
16702
16721
|
|
16703
16722
|
add(num) {
|
16704
|
-
|
16723
|
+
// use local var to avoid triggering onChange
|
16724
|
+
let data = this.data;
|
16725
|
+
|
16726
|
+
data = [...data, num];
|
16705
16727
|
|
16706
16728
|
if (this.numberValue > this.max) {
|
16707
|
-
|
16708
|
-
|
16709
|
-
|
16710
|
-
this.data.shift();
|
16729
|
+
data = [num];
|
16730
|
+
} else if (this.length < data.length) {
|
16731
|
+
data = data.slice(1, data.length);
|
16711
16732
|
}
|
16712
16733
|
|
16734
|
+
this.data = data;
|
16735
|
+
|
16713
16736
|
return num;
|
16714
16737
|
}
|
16715
16738
|
|
16716
16739
|
del() {
|
16717
16740
|
if (!this.data.filter((d) => d !== '0').filter(Boolean).length) {
|
16718
|
-
this.data
|
16741
|
+
this.data = [];
|
16719
16742
|
} else {
|
16720
|
-
this.data.
|
16743
|
+
this.data = this.data.slice(0, this.data.length - 1);
|
16721
16744
|
}
|
16722
16745
|
}
|
16723
16746
|
|
@@ -16726,11 +16749,19 @@ class DateCounter {
|
|
16726
16749
|
}
|
16727
16750
|
|
16728
16751
|
inc(gap) {
|
16729
|
-
this.replaceValue(
|
16752
|
+
this.replaceValue(
|
16753
|
+
this.#initialNumValue < this.max
|
16754
|
+
? Math.max(this.#initialNumValue + (gap || 1), this.min)
|
16755
|
+
: this.min
|
16756
|
+
);
|
16730
16757
|
}
|
16731
16758
|
|
16732
16759
|
dec(gap) {
|
16733
|
-
this.replaceValue(
|
16760
|
+
this.replaceValue(
|
16761
|
+
this.#initialNumValue > this.min
|
16762
|
+
? Math.min(this.#initialNumValue - (gap || 1), this.max)
|
16763
|
+
: this.max
|
16764
|
+
);
|
16734
16765
|
}
|
16735
16766
|
|
16736
16767
|
isInRange(val) {
|
@@ -16742,6 +16773,14 @@ class DateCounter {
|
|
16742
16773
|
this.data = val.toString().padStart(this.length, 0).split('');
|
16743
16774
|
}
|
16744
16775
|
}
|
16776
|
+
|
16777
|
+
setMin(val) {
|
16778
|
+
this.min = Number(val);
|
16779
|
+
}
|
16780
|
+
|
16781
|
+
setMax(val) {
|
16782
|
+
this.max = Number(val);
|
16783
|
+
}
|
16745
16784
|
}
|
16746
16785
|
|
16747
16786
|
const componentName$j = getComponentName$1('date-field');
|
@@ -16762,10 +16801,40 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
16762
16801
|
|
16763
16802
|
selectedCounterIdx = 0;
|
16764
16803
|
|
16804
|
+
updateCountersDisplay() {
|
16805
|
+
this.inputElement.value = this.countersValue;
|
16806
|
+
}
|
16807
|
+
|
16808
|
+
updateValue() {
|
16809
|
+
if (this.isCountersOutOfRange) {
|
16810
|
+
this.updateTimestamp('');
|
16811
|
+
} else {
|
16812
|
+
const date = formats[this.format].getDate(this.inputElement.value);
|
16813
|
+
this.updateTimestamp(date.getTime());
|
16814
|
+
}
|
16815
|
+
}
|
16816
|
+
|
16817
|
+
onDateCounterChange = () => {
|
16818
|
+
this.updateCountersDisplay();
|
16819
|
+
this.updateValue();
|
16820
|
+
// update validity
|
16821
|
+
this.#dispatchInput();
|
16822
|
+
};
|
16823
|
+
|
16824
|
+
updateTimestamp(epochOrDate) {
|
16825
|
+
if (!epochOrDate) {
|
16826
|
+
this.timestamp = '';
|
16827
|
+
} else {
|
16828
|
+
this.timestamp = newDate(epochOrDate).getTime();
|
16829
|
+
}
|
16830
|
+
}
|
16831
|
+
|
16832
|
+
#yearDateCounter = new DateCounter(counterConfig.YEAR, this.onDateCounterChange.bind(this));
|
16833
|
+
|
16765
16834
|
dateCounters = [
|
16766
|
-
new DateCounter(counterConfig.MONTH),
|
16767
|
-
new DateCounter(counterConfig.DAY),
|
16768
|
-
|
16835
|
+
new DateCounter(counterConfig.MONTH, this.onDateCounterChange.bind(this)),
|
16836
|
+
new DateCounter(counterConfig.DAY, this.onDateCounterChange.bind(this)),
|
16837
|
+
this.#yearDateCounter,
|
16769
16838
|
];
|
16770
16839
|
|
16771
16840
|
static get observedAttributes() {
|
@@ -16817,11 +16886,10 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
16817
16886
|
|
16818
16887
|
this.inputElement = this.shadowRoot.querySelector('descope-text-field');
|
16819
16888
|
this.popoverToggleButton = this.inputElement.querySelector('.toggle-calendar');
|
16889
|
+
}
|
16820
16890
|
|
16821
|
-
|
16822
|
-
|
16823
|
-
this.inputElement.focus();
|
16824
|
-
};
|
16891
|
+
get validationTarget() {
|
16892
|
+
return this.inputElement;
|
16825
16893
|
}
|
16826
16894
|
|
16827
16895
|
get opened() {
|
@@ -16829,7 +16897,7 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
16829
16897
|
}
|
16830
16898
|
|
16831
16899
|
// returns the input's value as a timestamp
|
16832
|
-
get
|
16900
|
+
get displayValueEpoch() {
|
16833
16901
|
const date = formats[this.format].getDate(this.inputElement.value);
|
16834
16902
|
|
16835
16903
|
if (!isValidTimestamp(date?.getTime())) {
|
@@ -16881,37 +16949,32 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
16881
16949
|
}
|
16882
16950
|
|
16883
16951
|
set value(val) {
|
16884
|
-
if (
|
16885
|
-
|
16886
|
-
|
16887
|
-
const isValTimestamp = !Number.isNaN(numVal);
|
16888
|
-
|
16889
|
-
let date;
|
16890
|
-
let timestamp;
|
16891
|
-
|
16892
|
-
if (isValTimestamp) {
|
16893
|
-
date = newDate(numVal);
|
16894
|
-
timestamp = numVal;
|
16952
|
+
if (val) {
|
16953
|
+
this.updateTimestamp(val);
|
16954
|
+
this.updateDateCounters(newDate(val));
|
16895
16955
|
} else {
|
16896
|
-
|
16897
|
-
timestamp = date.getTime();
|
16956
|
+
this.updateTimestamp('');
|
16898
16957
|
}
|
16958
|
+
}
|
16899
16959
|
|
16900
|
-
|
16901
|
-
|
16902
|
-
|
16960
|
+
get isCountersEmpty() {
|
16961
|
+
return this.dateCounters.every((dc) => dc.isEmpty);
|
16962
|
+
}
|
16903
16963
|
|
16904
|
-
|
16964
|
+
get isCountersOutOfRange() {
|
16965
|
+
return this.dateCounters.some((dc) => !dc.isInRange(dc.numberValue));
|
16966
|
+
}
|
16905
16967
|
|
16906
|
-
|
16907
|
-
this.
|
16968
|
+
reportValidity() {
|
16969
|
+
this.inputElement.reportValidity();
|
16970
|
+
}
|
16908
16971
|
|
16909
|
-
|
16910
|
-
this.dispatchEvent(new Event('input'));
|
16972
|
+
#dispatchInput() {
|
16973
|
+
this.inputElement.baseElement.dispatchEvent(new Event('input', { bubbles: true }));
|
16911
16974
|
}
|
16912
16975
|
|
16913
16976
|
updateInputDisplay() {
|
16914
|
-
this.inputElement.value = formatTimestamp(newDate(this.
|
16977
|
+
this.inputElement.value = formatTimestamp(newDate(this.countersValue).getTime(), this.format);
|
16915
16978
|
}
|
16916
16979
|
|
16917
16980
|
init() {
|
@@ -16919,6 +16982,7 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
16919
16982
|
|
16920
16983
|
this.updateFormatPattern();
|
16921
16984
|
this.initPopover();
|
16985
|
+
this.onDateCounterChange();
|
16922
16986
|
this.initInputElement();
|
16923
16987
|
|
16924
16988
|
setTimeout(() => {
|
@@ -16927,15 +16991,16 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
16927
16991
|
}
|
16928
16992
|
|
16929
16993
|
initInputElement() {
|
16994
|
+
this.inputElement.getValidity = this.getValidity.bind(this);
|
16995
|
+
this.inputElement.baseElement.checkValidity = this.checkValidity.bind(this);
|
16996
|
+
|
16930
16997
|
this.popoverToggleButton.addEventListener('click', this.onPopoverToggle.bind(this));
|
16931
16998
|
|
16932
16999
|
this.inputElement.addEventListener('focus', this.onFocus.bind(this));
|
16933
17000
|
this.inputElement.addEventListener('blur', this.onBlur.bind(this));
|
16934
|
-
this.inputElement.addEventListener('input', this.onInput.bind(this));
|
16935
17001
|
this.inputElement.addEventListener('click', this.handleMouseCaretPositionChange.bind(this));
|
16936
|
-
this.inputElement.addEventListener('keydown', this.
|
16937
|
-
this.inputElement.addEventListener('keydown', this.
|
16938
|
-
this.inputElement.addEventListener('keydown', this.handleValueChange.bind(this));
|
17002
|
+
this.inputElement.addEventListener('keydown', this.handleNavKeys.bind(this));
|
17003
|
+
this.inputElement.addEventListener('keydown', this.handleDigitKeys.bind(this));
|
16939
17004
|
|
16940
17005
|
forwardAttrs$1(this, this.inputElement, {
|
16941
17006
|
includeAttrs: [
|
@@ -16949,8 +17014,14 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
16949
17014
|
'full-width',
|
16950
17015
|
'st-host-direction',
|
16951
17016
|
'pattern',
|
16952
|
-
'invalid',
|
16953
17017
|
'bordered',
|
17018
|
+
'data-errormessage-value-missing',
|
17019
|
+
'data-errormessage-pattern-mismatch',
|
17020
|
+
'data-errormessage-range-underflow',
|
17021
|
+
'data-errormessage-range-overflow',
|
17022
|
+
'st-error-message-icon',
|
17023
|
+
'st-error-message-icon-size',
|
17024
|
+
'st-error-message-icon-padding',
|
16954
17025
|
],
|
16955
17026
|
});
|
16956
17027
|
}
|
@@ -17078,7 +17149,7 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17078
17149
|
this.getCounterById('month').replaceValue(calendarDate.getMonth() + 1);
|
17079
17150
|
this.getCounterById('day').replaceValue(calendarDate.getDate());
|
17080
17151
|
|
17081
|
-
this
|
17152
|
+
this.#dispatchInput();
|
17082
17153
|
}
|
17083
17154
|
|
17084
17155
|
this.closePopover();
|
@@ -17089,10 +17160,10 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17089
17160
|
isValidTimestamp(newDate(this.inputElement.value || '').getTime()) &&
|
17090
17161
|
formats[this.format].validate(this.inputElement.value);
|
17091
17162
|
|
17092
|
-
if (this.
|
17163
|
+
if (this.displayValueEpoch || validInputVal) {
|
17093
17164
|
this.calendar.setAttribute(
|
17094
17165
|
'initial-value',
|
17095
|
-
formatTimestamp(this.
|
17166
|
+
formatTimestamp(this.displayValueEpoch || this.timestamp, NATIVE_FORMAT)
|
17096
17167
|
);
|
17097
17168
|
} else {
|
17098
17169
|
this.calendar.clearValue();
|
@@ -17115,13 +17186,6 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17115
17186
|
});
|
17116
17187
|
}
|
17117
17188
|
|
17118
|
-
onInput(e) {
|
17119
|
-
if (!e.target.value) {
|
17120
|
-
this.calendar?.clear();
|
17121
|
-
this.calendar?.renderCalendar();
|
17122
|
-
}
|
17123
|
-
}
|
17124
|
-
|
17125
17189
|
onFocus() {
|
17126
17190
|
if (this.isReadOnly) {
|
17127
17191
|
return;
|
@@ -17133,16 +17197,13 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17133
17197
|
}
|
17134
17198
|
}
|
17135
17199
|
|
17136
|
-
clearInputValue() {
|
17137
|
-
this.inputElement.value = '';
|
17138
|
-
this.resetDateCounters();
|
17139
|
-
}
|
17140
|
-
|
17141
17200
|
onBlur() {
|
17142
|
-
if (this.
|
17143
|
-
|
17144
|
-
}
|
17145
|
-
|
17201
|
+
if (this.opened) {
|
17202
|
+
return;
|
17203
|
+
}
|
17204
|
+
|
17205
|
+
if (this.inputElement.value === this.format) {
|
17206
|
+
this.inputElement.value = '';
|
17146
17207
|
}
|
17147
17208
|
}
|
17148
17209
|
|
@@ -17159,11 +17220,11 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17159
17220
|
this.setAttribute('pattern', formats[format].pattern);
|
17160
17221
|
}
|
17161
17222
|
|
17162
|
-
|
17223
|
+
handleDigitKeys(e) {
|
17163
17224
|
if (isNumber(e.key)) {
|
17164
17225
|
e.preventDefault();
|
17165
17226
|
|
17166
|
-
this.
|
17227
|
+
this.activeCounter.add(e.key);
|
17167
17228
|
|
17168
17229
|
if (this.activeCounter.isFull) {
|
17169
17230
|
this.selectNextCounter();
|
@@ -17183,11 +17244,6 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17183
17244
|
return [c1, c2, c3].indexOf(true);
|
17184
17245
|
}
|
17185
17246
|
|
17186
|
-
handleCountersValue(val) {
|
17187
|
-
this.activeCounter.add(val);
|
17188
|
-
this.inputElement.value = this.countersValue;
|
17189
|
-
}
|
17190
|
-
|
17191
17247
|
setSelectedCounterByCaretPosition(e) {
|
17192
17248
|
this.selectedCounterIdx = this.getCounterIdx(e.target.selectionStart);
|
17193
17249
|
}
|
@@ -17245,21 +17301,21 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17245
17301
|
});
|
17246
17302
|
}
|
17247
17303
|
|
17248
|
-
|
17304
|
+
handleNavKeys(e) {
|
17249
17305
|
if (this.isReadOnly) {
|
17250
17306
|
return;
|
17251
17307
|
}
|
17252
17308
|
|
17253
17309
|
const { key, shiftKey, metaKey } = e;
|
17254
17310
|
const keys = getKeyMap(key, shiftKey, metaKey);
|
17255
|
-
const allowedOperations = keys.refresh || keys.tab || keys.shiftTab;
|
17256
17311
|
|
17257
17312
|
if (this.opened) {
|
17258
17313
|
this.closePopover();
|
17259
17314
|
}
|
17260
17315
|
|
17316
|
+
e.preventDefault();
|
17317
|
+
|
17261
17318
|
if (isSupportedKey(key)) {
|
17262
|
-
e.preventDefault();
|
17263
17319
|
const counter = this.activeCounter;
|
17264
17320
|
|
17265
17321
|
if (!counter) return;
|
@@ -17276,12 +17332,10 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17276
17332
|
else if (keys.pageDown) counter.dec(count);
|
17277
17333
|
else if (keys.shiftPageUp) counter.inc(shiftCount);
|
17278
17334
|
else if (keys.shiftPageDown) counter.dec(shiftCount);
|
17279
|
-
|
17280
|
-
|
17335
|
+
else if (keys.arrowRight) this.selectNextCounter();
|
17336
|
+
else if (keys.arrowLeft) this.selectPrevCounter();
|
17281
17337
|
|
17282
17338
|
this.setInputSelectionRange();
|
17283
|
-
} else if (!allowedOperations) {
|
17284
|
-
e.preventDefault();
|
17285
17339
|
}
|
17286
17340
|
}
|
17287
17341
|
|
@@ -17296,25 +17350,6 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17296
17350
|
}
|
17297
17351
|
}
|
17298
17352
|
|
17299
|
-
handleKeydownCaretPositionChange(e) {
|
17300
|
-
if (this.opened) {
|
17301
|
-
return;
|
17302
|
-
}
|
17303
|
-
|
17304
|
-
const { key } = e;
|
17305
|
-
|
17306
|
-
if (isSupportedKey(key)) {
|
17307
|
-
e.preventDefault();
|
17308
|
-
|
17309
|
-
const keys = getKeyMap(key, false);
|
17310
|
-
|
17311
|
-
if (keys.arrowRight) this.selectNextCounter();
|
17312
|
-
else if (keys.arrowLeft) this.selectPrevCounter();
|
17313
|
-
|
17314
|
-
this.setInputSelectionRange();
|
17315
|
-
}
|
17316
|
-
}
|
17317
|
-
|
17318
17353
|
handleMouseCaretPositionChange(e) {
|
17319
17354
|
if (this.opened) {
|
17320
17355
|
return;
|
@@ -17334,10 +17369,22 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17334
17369
|
});
|
17335
17370
|
}
|
17336
17371
|
|
17372
|
+
setYearRange(val) {
|
17373
|
+
if (!val) return;
|
17374
|
+
const [min, max] = val.split?.('-');
|
17375
|
+
if (min && max) {
|
17376
|
+
this.#yearDateCounter.setMin(min);
|
17377
|
+
this.#yearDateCounter.setMax(max);
|
17378
|
+
}
|
17379
|
+
}
|
17380
|
+
|
17337
17381
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
17338
17382
|
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
17339
17383
|
|
17340
17384
|
if (oldValue !== newValue) {
|
17385
|
+
if (attrName === 'years-range') {
|
17386
|
+
this.setYearRange(newValue);
|
17387
|
+
}
|
17341
17388
|
if (dateFieldAttrs.includes(attrName)) {
|
17342
17389
|
if (newValue && attrName === 'format') {
|
17343
17390
|
this.onFormatUpdate(newValue);
|
@@ -17356,16 +17403,20 @@ class RawDateFieldClass extends BaseInputClass$1 {
|
|
17356
17403
|
}
|
17357
17404
|
|
17358
17405
|
getValidity() {
|
17359
|
-
if (this.isRequired &&
|
17406
|
+
if (this.isRequired && this.isCountersEmpty) {
|
17360
17407
|
return { valueMissing: true };
|
17361
17408
|
}
|
17362
17409
|
|
17410
|
+
if (this.isCountersOutOfRange) {
|
17411
|
+
return { patternMismatch: true };
|
17412
|
+
}
|
17413
|
+
|
17363
17414
|
return {};
|
17364
17415
|
}
|
17365
17416
|
}
|
17366
17417
|
|
17367
17418
|
const textVars = TextFieldClass.cssVarList;
|
17368
|
-
const { host: host$5, input, inputEleRTL, toggleButton, overlay, backdrop
|
17419
|
+
const { host: host$5, input, inputEleRTL, toggleButton, overlay, backdrop} = {
|
17369
17420
|
host: { selector: () => ':host' },
|
17370
17421
|
input: { selector: () => 'descope-text-field' },
|
17371
17422
|
inputEleRTL: { selector: () => ':host([st-host-direction="rtl"]) descope-text-field' },
|
@@ -17403,6 +17454,30 @@ const DateFieldClass = compose$1(
|
|
17403
17454
|
overlayOutlineStyle: {
|
17404
17455
|
property: () => DateFieldClass.cssVarList.overlayOutlineStyle,
|
17405
17456
|
},
|
17457
|
+
errorMessageIcon: {
|
17458
|
+
selector: TextFieldClass.componentName,
|
17459
|
+
property: TextFieldClass.cssVarList.errorMessageIcon,
|
17460
|
+
},
|
17461
|
+
errorMessageIconSize: {
|
17462
|
+
selector: TextFieldClass.componentName,
|
17463
|
+
property: TextFieldClass.cssVarList.errorMessageIconSize,
|
17464
|
+
},
|
17465
|
+
errorMessageIconPadding: {
|
17466
|
+
selector: TextFieldClass.componentName,
|
17467
|
+
property: TextFieldClass.cssVarList.errorMessageIconPadding,
|
17468
|
+
},
|
17469
|
+
errorMessageIconRepeat: {
|
17470
|
+
selector: TextFieldClass.componentName,
|
17471
|
+
property: TextFieldClass.cssVarList.errorMessageIconRepeat,
|
17472
|
+
},
|
17473
|
+
errorMessageIconPosition: {
|
17474
|
+
selector: TextFieldClass.componentName,
|
17475
|
+
property: TextFieldClass.cssVarList.errorMessageIconPosition,
|
17476
|
+
},
|
17477
|
+
errorMessageFontSize: {
|
17478
|
+
selector: TextFieldClass.componentName,
|
17479
|
+
property: TextFieldClass.cssVarList.errorMessageFontSize,
|
17480
|
+
},
|
17406
17481
|
},
|
17407
17482
|
}),
|
17408
17483
|
portalMixin({
|
@@ -17447,6 +17522,13 @@ const dateField = {
|
|
17447
17522
|
|
17448
17523
|
[vars$g.rtlInputDirection]: 'ltr',
|
17449
17524
|
[vars$g.rtlInputAlignment]: 'right',
|
17525
|
+
|
17526
|
+
[vars$g.errorMessageIcon]: refs$1.errorMessageIcon,
|
17527
|
+
[vars$g.errorMessageIconSize]: refs$1.errorMessageIconSize,
|
17528
|
+
[vars$g.errorMessageIconPadding]: refs$1.errorMessageIconPadding,
|
17529
|
+
[vars$g.errorMessageIconRepeat]: refs$1.errorMessageIconRepeat,
|
17530
|
+
[vars$g.errorMessageIconPosition]: refs$1.errorMessageIconPosition,
|
17531
|
+
[vars$g.errorMessageFontSize]: refs$1.errorMessageFontSize,
|
17450
17532
|
};
|
17451
17533
|
|
17452
17534
|
var dateField$1 = /*#__PURE__*/Object.freeze({
|