@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/index.esm.js
CHANGED
@@ -3589,8 +3589,9 @@ const inputEventsDispatchingMixin = (superclass) =>
|
|
3589
3589
|
#blockNativeEvents() {
|
3590
3590
|
['blur', 'focus', 'focusin', 'focusout'].forEach((event) => {
|
3591
3591
|
this.addEventListener(event, (e) => {
|
3592
|
-
e.isTrusted && e.target === this
|
3593
|
-
|
3592
|
+
if (e.isTrusted && e.target === this) {
|
3593
|
+
e.stopImmediatePropagation();
|
3594
|
+
} });
|
3594
3595
|
});
|
3595
3596
|
}
|
3596
3597
|
|
@@ -5257,6 +5258,7 @@ const COUNTER_SUPPORTED_KEYS = [
|
|
5257
5258
|
'PageUp',
|
5258
5259
|
'PageDown',
|
5259
5260
|
'Meta',
|
5261
|
+
'Enter',
|
5260
5262
|
];
|
5261
5263
|
|
5262
5264
|
const months = [
|
@@ -5287,7 +5289,7 @@ const weekdays = [
|
|
5287
5289
|
const counterConfig = {
|
5288
5290
|
MONTH: { id: 'month', min: 1, max: 12, placeholder: 'MM', count: 5, shiftCount: 10 },
|
5289
5291
|
DAY: { id: 'day', min: 1, max: 31, placeholder: 'DD', count: 5, shiftCount: 10 },
|
5290
|
-
YEAR: { id: 'year', min:
|
5292
|
+
YEAR: { id: 'year', min: 1900, max: 2099, placeholder: 'YYYY', count: 10, shiftCount: 100 },
|
5291
5293
|
};
|
5292
5294
|
|
5293
5295
|
const BUTTON_LABEL_DONE = 'Done';
|
@@ -5299,7 +5301,7 @@ const isValidTimestamp = (val) => !Number.isNaN(Number(val));
|
|
5299
5301
|
const isNumber = (val) => !Number.isNaN(Number(val));
|
5300
5302
|
|
5301
5303
|
const getTimestampParts = (timestamp) => {
|
5302
|
-
const date =
|
5304
|
+
const date = newDate(timestamp);
|
5303
5305
|
const year = date.getFullYear();
|
5304
5306
|
const month = date.getMonth() + 1;
|
5305
5307
|
const day = date.getDate();
|
@@ -5347,6 +5349,7 @@ const getKeyMap = (key, shiftKey, metaKey) => {
|
|
5347
5349
|
shiftArrowDown: shiftKey && key === 'ArrowDown',
|
5348
5350
|
shiftPageUp: shiftKey && key === 'PageUp',
|
5349
5351
|
shiftPageDown: shiftKey && key === 'PageDown',
|
5352
|
+
enter: key === 'Enter',
|
5350
5353
|
};
|
5351
5354
|
};
|
5352
5355
|
|
@@ -6524,12 +6527,23 @@ const formats = Object.fromEntries(SUPPORTED_FORMATS.map((f) => [f, createFormat
|
|
6524
6527
|
// For examele, we have a DayCounter, MonthCounter and YearCounter, which can each separately navigate
|
6525
6528
|
// between different ranges.
|
6526
6529
|
class DateCounter {
|
6527
|
-
|
6530
|
+
#data = Object.freeze([]);
|
6531
|
+
|
6532
|
+
constructor({ id, min, max, placeholder }, onChange) {
|
6528
6533
|
this.id = id;
|
6529
|
-
this.data = [];
|
6530
6534
|
this.min = min;
|
6531
6535
|
this.max = max;
|
6532
6536
|
this.placeholder = placeholder;
|
6537
|
+
this.onChange = onChange;
|
6538
|
+
}
|
6539
|
+
|
6540
|
+
get data() {
|
6541
|
+
return this.#data;
|
6542
|
+
}
|
6543
|
+
|
6544
|
+
set data(val) {
|
6545
|
+
this.#data = Object.freeze(val);
|
6546
|
+
this.onChange?.();
|
6533
6547
|
}
|
6534
6548
|
|
6535
6549
|
get #initialNumValue() {
|
@@ -6561,23 +6575,27 @@ class DateCounter {
|
|
6561
6575
|
}
|
6562
6576
|
|
6563
6577
|
add(num) {
|
6564
|
-
|
6578
|
+
// use local var to avoid triggering onChange
|
6579
|
+
let data = this.data;
|
6580
|
+
|
6581
|
+
data = [...data, num];
|
6565
6582
|
|
6566
6583
|
if (this.numberValue > this.max) {
|
6567
|
-
|
6568
|
-
|
6569
|
-
|
6570
|
-
this.data.shift();
|
6584
|
+
data = [num];
|
6585
|
+
} else if (this.length < data.length) {
|
6586
|
+
data = data.slice(1, data.length);
|
6571
6587
|
}
|
6572
6588
|
|
6589
|
+
this.data = data;
|
6590
|
+
|
6573
6591
|
return num;
|
6574
6592
|
}
|
6575
6593
|
|
6576
6594
|
del() {
|
6577
6595
|
if (!this.data.filter((d) => d !== '0').filter(Boolean).length) {
|
6578
|
-
this.data
|
6596
|
+
this.data = [];
|
6579
6597
|
} else {
|
6580
|
-
this.data.
|
6598
|
+
this.data = this.data.slice(0, this.data.length - 1);
|
6581
6599
|
}
|
6582
6600
|
}
|
6583
6601
|
|
@@ -6586,11 +6604,19 @@ class DateCounter {
|
|
6586
6604
|
}
|
6587
6605
|
|
6588
6606
|
inc(gap) {
|
6589
|
-
this.replaceValue(
|
6607
|
+
this.replaceValue(
|
6608
|
+
this.#initialNumValue < this.max
|
6609
|
+
? Math.max(this.#initialNumValue + (gap || 1), this.min)
|
6610
|
+
: this.min
|
6611
|
+
);
|
6590
6612
|
}
|
6591
6613
|
|
6592
6614
|
dec(gap) {
|
6593
|
-
this.replaceValue(
|
6615
|
+
this.replaceValue(
|
6616
|
+
this.#initialNumValue > this.min
|
6617
|
+
? Math.min(this.#initialNumValue - (gap || 1), this.max)
|
6618
|
+
: this.max
|
6619
|
+
);
|
6594
6620
|
}
|
6595
6621
|
|
6596
6622
|
isInRange(val) {
|
@@ -6602,6 +6628,14 @@ class DateCounter {
|
|
6602
6628
|
this.data = val.toString().padStart(this.length, 0).split('');
|
6603
6629
|
}
|
6604
6630
|
}
|
6631
|
+
|
6632
|
+
setMin(val) {
|
6633
|
+
this.min = Number(val);
|
6634
|
+
}
|
6635
|
+
|
6636
|
+
setMax(val) {
|
6637
|
+
this.max = Number(val);
|
6638
|
+
}
|
6605
6639
|
}
|
6606
6640
|
|
6607
6641
|
const componentName$14 = getComponentName$1('date-field');
|
@@ -6622,10 +6656,40 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6622
6656
|
|
6623
6657
|
selectedCounterIdx = 0;
|
6624
6658
|
|
6659
|
+
updateCountersDisplay() {
|
6660
|
+
this.inputElement.value = this.countersValue;
|
6661
|
+
}
|
6662
|
+
|
6663
|
+
updateValue() {
|
6664
|
+
if (this.isCountersOutOfRange) {
|
6665
|
+
this.updateTimestamp('');
|
6666
|
+
} else {
|
6667
|
+
const date = formats[this.format].getDate(this.inputElement.value);
|
6668
|
+
this.updateTimestamp(date.getTime());
|
6669
|
+
}
|
6670
|
+
}
|
6671
|
+
|
6672
|
+
onDateCounterChange = () => {
|
6673
|
+
this.updateCountersDisplay();
|
6674
|
+
this.updateValue();
|
6675
|
+
// update validity
|
6676
|
+
this.#dispatchInput();
|
6677
|
+
};
|
6678
|
+
|
6679
|
+
updateTimestamp(epochOrDate) {
|
6680
|
+
if (!epochOrDate) {
|
6681
|
+
this.timestamp = '';
|
6682
|
+
} else {
|
6683
|
+
this.timestamp = newDate(epochOrDate).getTime();
|
6684
|
+
}
|
6685
|
+
}
|
6686
|
+
|
6687
|
+
#yearDateCounter = new DateCounter(counterConfig.YEAR, this.onDateCounterChange.bind(this));
|
6688
|
+
|
6625
6689
|
dateCounters = [
|
6626
|
-
new DateCounter(counterConfig.MONTH),
|
6627
|
-
new DateCounter(counterConfig.DAY),
|
6628
|
-
|
6690
|
+
new DateCounter(counterConfig.MONTH, this.onDateCounterChange.bind(this)),
|
6691
|
+
new DateCounter(counterConfig.DAY, this.onDateCounterChange.bind(this)),
|
6692
|
+
this.#yearDateCounter,
|
6629
6693
|
];
|
6630
6694
|
|
6631
6695
|
static get observedAttributes() {
|
@@ -6677,11 +6741,10 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6677
6741
|
|
6678
6742
|
this.inputElement = this.shadowRoot.querySelector('descope-text-field');
|
6679
6743
|
this.popoverToggleButton = this.inputElement.querySelector('.toggle-calendar');
|
6744
|
+
}
|
6680
6745
|
|
6681
|
-
|
6682
|
-
|
6683
|
-
this.inputElement.focus();
|
6684
|
-
};
|
6746
|
+
get validationTarget() {
|
6747
|
+
return this.inputElement;
|
6685
6748
|
}
|
6686
6749
|
|
6687
6750
|
get opened() {
|
@@ -6689,7 +6752,7 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6689
6752
|
}
|
6690
6753
|
|
6691
6754
|
// returns the input's value as a timestamp
|
6692
|
-
get
|
6755
|
+
get displayValueEpoch() {
|
6693
6756
|
const date = formats[this.format].getDate(this.inputElement.value);
|
6694
6757
|
|
6695
6758
|
if (!isValidTimestamp(date?.getTime())) {
|
@@ -6741,37 +6804,32 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6741
6804
|
}
|
6742
6805
|
|
6743
6806
|
set value(val) {
|
6744
|
-
if (
|
6745
|
-
|
6746
|
-
|
6747
|
-
const isValTimestamp = !Number.isNaN(numVal);
|
6748
|
-
|
6749
|
-
let date;
|
6750
|
-
let timestamp;
|
6751
|
-
|
6752
|
-
if (isValTimestamp) {
|
6753
|
-
date = newDate(numVal);
|
6754
|
-
timestamp = numVal;
|
6807
|
+
if (val) {
|
6808
|
+
this.updateTimestamp(val);
|
6809
|
+
this.updateDateCounters(newDate(val));
|
6755
6810
|
} else {
|
6756
|
-
|
6757
|
-
timestamp = date.getTime();
|
6811
|
+
this.updateTimestamp('');
|
6758
6812
|
}
|
6813
|
+
}
|
6759
6814
|
|
6760
|
-
|
6761
|
-
|
6762
|
-
|
6815
|
+
get isCountersEmpty() {
|
6816
|
+
return this.dateCounters.every((dc) => dc.isEmpty);
|
6817
|
+
}
|
6763
6818
|
|
6764
|
-
|
6819
|
+
get isCountersOutOfRange() {
|
6820
|
+
return this.dateCounters.some((dc) => !dc.isInRange(dc.numberValue));
|
6821
|
+
}
|
6765
6822
|
|
6766
|
-
|
6767
|
-
this.
|
6823
|
+
reportValidity() {
|
6824
|
+
this.inputElement.reportValidity();
|
6825
|
+
}
|
6768
6826
|
|
6769
|
-
|
6770
|
-
this.dispatchEvent(new Event('input'));
|
6827
|
+
#dispatchInput() {
|
6828
|
+
this.inputElement.baseElement.dispatchEvent(new Event('input', { bubbles: true }));
|
6771
6829
|
}
|
6772
6830
|
|
6773
6831
|
updateInputDisplay() {
|
6774
|
-
this.inputElement.value = formatTimestamp(newDate(this.
|
6832
|
+
this.inputElement.value = formatTimestamp(newDate(this.countersValue).getTime(), this.format);
|
6775
6833
|
}
|
6776
6834
|
|
6777
6835
|
init() {
|
@@ -6779,6 +6837,7 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6779
6837
|
|
6780
6838
|
this.updateFormatPattern();
|
6781
6839
|
this.initPopover();
|
6840
|
+
this.onDateCounterChange();
|
6782
6841
|
this.initInputElement();
|
6783
6842
|
|
6784
6843
|
setTimeout(() => {
|
@@ -6787,15 +6846,16 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6787
6846
|
}
|
6788
6847
|
|
6789
6848
|
initInputElement() {
|
6849
|
+
this.inputElement.getValidity = this.getValidity.bind(this);
|
6850
|
+
this.inputElement.baseElement.checkValidity = this.checkValidity.bind(this);
|
6851
|
+
|
6790
6852
|
this.popoverToggleButton.addEventListener('click', this.onPopoverToggle.bind(this));
|
6791
6853
|
|
6792
6854
|
this.inputElement.addEventListener('focus', this.onFocus.bind(this));
|
6793
6855
|
this.inputElement.addEventListener('blur', this.onBlur.bind(this));
|
6794
|
-
this.inputElement.addEventListener('input', this.onInput.bind(this));
|
6795
6856
|
this.inputElement.addEventListener('click', this.handleMouseCaretPositionChange.bind(this));
|
6796
|
-
this.inputElement.addEventListener('keydown', this.
|
6797
|
-
this.inputElement.addEventListener('keydown', this.
|
6798
|
-
this.inputElement.addEventListener('keydown', this.handleValueChange.bind(this));
|
6857
|
+
this.inputElement.addEventListener('keydown', this.handleNavKeys.bind(this));
|
6858
|
+
this.inputElement.addEventListener('keydown', this.handleDigitKeys.bind(this));
|
6799
6859
|
|
6800
6860
|
forwardAttrs$1(this, this.inputElement, {
|
6801
6861
|
includeAttrs: [
|
@@ -6809,8 +6869,14 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6809
6869
|
'full-width',
|
6810
6870
|
'st-host-direction',
|
6811
6871
|
'pattern',
|
6812
|
-
'invalid',
|
6813
6872
|
'bordered',
|
6873
|
+
'data-errormessage-value-missing',
|
6874
|
+
'data-errormessage-pattern-mismatch',
|
6875
|
+
'data-errormessage-range-underflow',
|
6876
|
+
'data-errormessage-range-overflow',
|
6877
|
+
'st-error-message-icon',
|
6878
|
+
'st-error-message-icon-size',
|
6879
|
+
'st-error-message-icon-padding',
|
6814
6880
|
],
|
6815
6881
|
});
|
6816
6882
|
}
|
@@ -6938,7 +7004,7 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6938
7004
|
this.getCounterById('month').replaceValue(calendarDate.getMonth() + 1);
|
6939
7005
|
this.getCounterById('day').replaceValue(calendarDate.getDate());
|
6940
7006
|
|
6941
|
-
this
|
7007
|
+
this.#dispatchInput();
|
6942
7008
|
}
|
6943
7009
|
|
6944
7010
|
this.closePopover();
|
@@ -6949,10 +7015,10 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6949
7015
|
isValidTimestamp(newDate(this.inputElement.value || '').getTime()) &&
|
6950
7016
|
formats[this.format].validate(this.inputElement.value);
|
6951
7017
|
|
6952
|
-
if (this.
|
7018
|
+
if (this.displayValueEpoch || validInputVal) {
|
6953
7019
|
this.calendar.setAttribute(
|
6954
7020
|
'initial-value',
|
6955
|
-
formatTimestamp(this.
|
7021
|
+
formatTimestamp(this.displayValueEpoch || this.timestamp, NATIVE_FORMAT)
|
6956
7022
|
);
|
6957
7023
|
} else {
|
6958
7024
|
this.calendar.clearValue();
|
@@ -6975,13 +7041,6 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6975
7041
|
});
|
6976
7042
|
}
|
6977
7043
|
|
6978
|
-
onInput(e) {
|
6979
|
-
if (!e.target.value) {
|
6980
|
-
this.calendar?.clear();
|
6981
|
-
this.calendar?.renderCalendar();
|
6982
|
-
}
|
6983
|
-
}
|
6984
|
-
|
6985
7044
|
onFocus() {
|
6986
7045
|
if (this.isReadOnly) {
|
6987
7046
|
return;
|
@@ -6993,16 +7052,13 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
6993
7052
|
}
|
6994
7053
|
}
|
6995
7054
|
|
6996
|
-
clearInputValue() {
|
6997
|
-
this.inputElement.value = '';
|
6998
|
-
this.resetDateCounters();
|
6999
|
-
}
|
7000
|
-
|
7001
7055
|
onBlur() {
|
7002
|
-
if (this.
|
7003
|
-
|
7004
|
-
}
|
7005
|
-
|
7056
|
+
if (this.opened) {
|
7057
|
+
return;
|
7058
|
+
}
|
7059
|
+
|
7060
|
+
if (this.inputElement.value === this.format) {
|
7061
|
+
this.inputElement.value = '';
|
7006
7062
|
}
|
7007
7063
|
}
|
7008
7064
|
|
@@ -7019,11 +7075,11 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7019
7075
|
this.setAttribute('pattern', formats[format].pattern);
|
7020
7076
|
}
|
7021
7077
|
|
7022
|
-
|
7078
|
+
handleDigitKeys(e) {
|
7023
7079
|
if (isNumber(e.key)) {
|
7024
7080
|
e.preventDefault();
|
7025
7081
|
|
7026
|
-
this.
|
7082
|
+
this.activeCounter.add(e.key);
|
7027
7083
|
|
7028
7084
|
if (this.activeCounter.isFull) {
|
7029
7085
|
this.selectNextCounter();
|
@@ -7043,11 +7099,6 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7043
7099
|
return [c1, c2, c3].indexOf(true);
|
7044
7100
|
}
|
7045
7101
|
|
7046
|
-
handleCountersValue(val) {
|
7047
|
-
this.activeCounter.add(val);
|
7048
|
-
this.inputElement.value = this.countersValue;
|
7049
|
-
}
|
7050
|
-
|
7051
7102
|
setSelectedCounterByCaretPosition(e) {
|
7052
7103
|
this.selectedCounterIdx = this.getCounterIdx(e.target.selectionStart);
|
7053
7104
|
}
|
@@ -7105,21 +7156,21 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7105
7156
|
});
|
7106
7157
|
}
|
7107
7158
|
|
7108
|
-
|
7159
|
+
handleNavKeys(e) {
|
7109
7160
|
if (this.isReadOnly) {
|
7110
7161
|
return;
|
7111
7162
|
}
|
7112
7163
|
|
7113
7164
|
const { key, shiftKey, metaKey } = e;
|
7114
7165
|
const keys = getKeyMap(key, shiftKey, metaKey);
|
7115
|
-
const allowedOperations = keys.refresh || keys.tab || keys.shiftTab;
|
7116
7166
|
|
7117
7167
|
if (this.opened) {
|
7118
7168
|
this.closePopover();
|
7119
7169
|
}
|
7120
7170
|
|
7171
|
+
e.preventDefault();
|
7172
|
+
|
7121
7173
|
if (isSupportedKey(key)) {
|
7122
|
-
e.preventDefault();
|
7123
7174
|
const counter = this.activeCounter;
|
7124
7175
|
|
7125
7176
|
if (!counter) return;
|
@@ -7136,12 +7187,10 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7136
7187
|
else if (keys.pageDown) counter.dec(count);
|
7137
7188
|
else if (keys.shiftPageUp) counter.inc(shiftCount);
|
7138
7189
|
else if (keys.shiftPageDown) counter.dec(shiftCount);
|
7139
|
-
|
7140
|
-
|
7190
|
+
else if (keys.arrowRight) this.selectNextCounter();
|
7191
|
+
else if (keys.arrowLeft) this.selectPrevCounter();
|
7141
7192
|
|
7142
7193
|
this.setInputSelectionRange();
|
7143
|
-
} else if (!allowedOperations) {
|
7144
|
-
e.preventDefault();
|
7145
7194
|
}
|
7146
7195
|
}
|
7147
7196
|
|
@@ -7156,25 +7205,6 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7156
7205
|
}
|
7157
7206
|
}
|
7158
7207
|
|
7159
|
-
handleKeydownCaretPositionChange(e) {
|
7160
|
-
if (this.opened) {
|
7161
|
-
return;
|
7162
|
-
}
|
7163
|
-
|
7164
|
-
const { key } = e;
|
7165
|
-
|
7166
|
-
if (isSupportedKey(key)) {
|
7167
|
-
e.preventDefault();
|
7168
|
-
|
7169
|
-
const keys = getKeyMap(key, false);
|
7170
|
-
|
7171
|
-
if (keys.arrowRight) this.selectNextCounter();
|
7172
|
-
else if (keys.arrowLeft) this.selectPrevCounter();
|
7173
|
-
|
7174
|
-
this.setInputSelectionRange();
|
7175
|
-
}
|
7176
|
-
}
|
7177
|
-
|
7178
7208
|
handleMouseCaretPositionChange(e) {
|
7179
7209
|
if (this.opened) {
|
7180
7210
|
return;
|
@@ -7194,10 +7224,22 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7194
7224
|
});
|
7195
7225
|
}
|
7196
7226
|
|
7227
|
+
setYearRange(val) {
|
7228
|
+
if (!val) return;
|
7229
|
+
const [min, max] = val.split?.('-');
|
7230
|
+
if (min && max) {
|
7231
|
+
this.#yearDateCounter.setMin(min);
|
7232
|
+
this.#yearDateCounter.setMax(max);
|
7233
|
+
}
|
7234
|
+
}
|
7235
|
+
|
7197
7236
|
attributeChangedCallback(attrName, oldValue, newValue) {
|
7198
7237
|
super.attributeChangedCallback?.(attrName, oldValue, newValue);
|
7199
7238
|
|
7200
7239
|
if (oldValue !== newValue) {
|
7240
|
+
if (attrName === 'years-range') {
|
7241
|
+
this.setYearRange(newValue);
|
7242
|
+
}
|
7201
7243
|
if (dateFieldAttrs.includes(attrName)) {
|
7202
7244
|
if (newValue && attrName === 'format') {
|
7203
7245
|
this.onFormatUpdate(newValue);
|
@@ -7216,16 +7258,20 @@ class RawDateFieldClass extends BaseInputClass$a {
|
|
7216
7258
|
}
|
7217
7259
|
|
7218
7260
|
getValidity() {
|
7219
|
-
if (this.isRequired &&
|
7261
|
+
if (this.isRequired && this.isCountersEmpty) {
|
7220
7262
|
return { valueMissing: true };
|
7221
7263
|
}
|
7222
7264
|
|
7265
|
+
if (this.isCountersOutOfRange) {
|
7266
|
+
return { patternMismatch: true };
|
7267
|
+
}
|
7268
|
+
|
7223
7269
|
return {};
|
7224
7270
|
}
|
7225
7271
|
}
|
7226
7272
|
|
7227
7273
|
const textVars$4 = TextFieldClass.cssVarList;
|
7228
|
-
const { host: host$n, input, inputEleRTL, toggleButton, overlay, backdrop
|
7274
|
+
const { host: host$n, input, inputEleRTL, toggleButton, overlay, backdrop} = {
|
7229
7275
|
host: { selector: () => ':host' },
|
7230
7276
|
input: { selector: () => 'descope-text-field' },
|
7231
7277
|
inputEleRTL: { selector: () => ':host([st-host-direction="rtl"]) descope-text-field' },
|
@@ -7263,6 +7309,30 @@ const DateFieldClass = compose$1(
|
|
7263
7309
|
overlayOutlineStyle: {
|
7264
7310
|
property: () => DateFieldClass.cssVarList.overlayOutlineStyle,
|
7265
7311
|
},
|
7312
|
+
errorMessageIcon: {
|
7313
|
+
selector: TextFieldClass.componentName,
|
7314
|
+
property: TextFieldClass.cssVarList.errorMessageIcon,
|
7315
|
+
},
|
7316
|
+
errorMessageIconSize: {
|
7317
|
+
selector: TextFieldClass.componentName,
|
7318
|
+
property: TextFieldClass.cssVarList.errorMessageIconSize,
|
7319
|
+
},
|
7320
|
+
errorMessageIconPadding: {
|
7321
|
+
selector: TextFieldClass.componentName,
|
7322
|
+
property: TextFieldClass.cssVarList.errorMessageIconPadding,
|
7323
|
+
},
|
7324
|
+
errorMessageIconRepeat: {
|
7325
|
+
selector: TextFieldClass.componentName,
|
7326
|
+
property: TextFieldClass.cssVarList.errorMessageIconRepeat,
|
7327
|
+
},
|
7328
|
+
errorMessageIconPosition: {
|
7329
|
+
selector: TextFieldClass.componentName,
|
7330
|
+
property: TextFieldClass.cssVarList.errorMessageIconPosition,
|
7331
|
+
},
|
7332
|
+
errorMessageFontSize: {
|
7333
|
+
selector: TextFieldClass.componentName,
|
7334
|
+
property: TextFieldClass.cssVarList.errorMessageFontSize,
|
7335
|
+
},
|
7266
7336
|
},
|
7267
7337
|
}),
|
7268
7338
|
portalMixin$1({
|
@@ -17443,9 +17513,10 @@ const base64Prefix = 'data:image/svg+xml;base64,';
|
|
17443
17513
|
|
17444
17514
|
const isBase64Svg = (src) => src.startsWith(base64Prefix);
|
17445
17515
|
|
17446
|
-
const createImgEle = (src) => {
|
17516
|
+
const createImgEle = (src, altText) => {
|
17447
17517
|
const ele = document.createElement('img');
|
17448
17518
|
ele.setAttribute('src', src);
|
17519
|
+
ele.setAttribute('alt', altText);
|
17449
17520
|
return ele;
|
17450
17521
|
};
|
17451
17522
|
|
@@ -17462,7 +17533,7 @@ const createSvgEle = (text) => {
|
|
17462
17533
|
return ele;
|
17463
17534
|
};
|
17464
17535
|
|
17465
|
-
const createImage = async (src) => {
|
17536
|
+
const createImage = async (src, altText) => {
|
17466
17537
|
try {
|
17467
17538
|
let ele;
|
17468
17539
|
if (isBase64Svg(src)) {
|
@@ -17476,7 +17547,7 @@ const createImage = async (src) => {
|
|
17476
17547
|
ele = createSvgEle(text);
|
17477
17548
|
} else {
|
17478
17549
|
// handle binary
|
17479
|
-
ele = createImgEle(src);
|
17550
|
+
ele = createImgEle(src, altText);
|
17480
17551
|
}
|
17481
17552
|
|
17482
17553
|
ele.style.setProperty('max-width', '100%');
|
@@ -17551,6 +17622,10 @@ class RawImage extends createBaseClass({
|
|
17551
17622
|
}
|
17552
17623
|
}
|
17553
17624
|
|
17625
|
+
get altText() {
|
17626
|
+
return this.getAttribute('alt') || '';
|
17627
|
+
}
|
17628
|
+
|
17554
17629
|
get legacySrc() {
|
17555
17630
|
return this.getAttribute('src');
|
17556
17631
|
}
|
@@ -17581,7 +17656,7 @@ class RawImage extends createBaseClass({
|
|
17581
17656
|
renderImage() {
|
17582
17657
|
this.toggleVisibility(this.src);
|
17583
17658
|
|
17584
|
-
createImage(this.src).then((res) => {
|
17659
|
+
createImage(this.src, this.altText).then((res) => {
|
17585
17660
|
this.innerHTML = '';
|
17586
17661
|
if (res) {
|
17587
17662
|
this.updateFillColor(res);
|
@@ -21561,6 +21636,13 @@ const dateField = {
|
|
21561
21636
|
|
21562
21637
|
[vars$g.rtlInputDirection]: 'ltr',
|
21563
21638
|
[vars$g.rtlInputAlignment]: 'right',
|
21639
|
+
|
21640
|
+
[vars$g.errorMessageIcon]: refs$1.errorMessageIcon,
|
21641
|
+
[vars$g.errorMessageIconSize]: refs$1.errorMessageIconSize,
|
21642
|
+
[vars$g.errorMessageIconPadding]: refs$1.errorMessageIconPadding,
|
21643
|
+
[vars$g.errorMessageIconRepeat]: refs$1.errorMessageIconRepeat,
|
21644
|
+
[vars$g.errorMessageIconPosition]: refs$1.errorMessageIconPosition,
|
21645
|
+
[vars$g.errorMessageFontSize]: refs$1.errorMessageFontSize,
|
21564
21646
|
};
|
21565
21647
|
|
21566
21648
|
var dateField$1 = /*#__PURE__*/Object.freeze({
|