@aurodesignsystem-dev/auro-formkit 0.0.0-pr1516.0 → 0.0.0-pr1519.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/components/checkbox/demo/customize.min.js +18 -10
- package/components/checkbox/demo/getting-started.min.js +18 -10
- package/components/checkbox/demo/index.min.js +18 -10
- package/components/checkbox/dist/index.js +18 -10
- package/components/checkbox/dist/registered.js +18 -10
- package/components/combobox/README.md +1 -1
- package/components/combobox/demo/customize.md +2 -10
- package/components/combobox/demo/customize.min.js +454 -467
- package/components/combobox/demo/getting-started.min.js +454 -463
- package/components/combobox/demo/index.md +1 -1
- package/components/combobox/demo/index.min.js +454 -463
- package/components/combobox/demo/keyboard-behavior.md +2 -142
- package/components/combobox/demo/readme.md +1 -1
- package/components/combobox/demo/why-combobox.md +2 -2
- package/components/combobox/dist/auro-combobox.d.ts +30 -14
- package/components/combobox/dist/index.js +454 -463
- package/components/combobox/dist/registered.js +454 -463
- package/components/counter/demo/customize.min.js +32 -12
- package/components/counter/demo/index.min.js +32 -12
- package/components/counter/dist/index.js +32 -12
- package/components/counter/dist/registered.js +32 -12
- package/components/datepicker/demo/customize.min.js +183 -167
- package/components/datepicker/demo/index.min.js +183 -167
- package/components/datepicker/dist/index.js +183 -167
- package/components/datepicker/dist/registered.js +183 -167
- package/components/dropdown/demo/customize.min.js +14 -2
- package/components/dropdown/demo/getting-started.min.js +14 -2
- package/components/dropdown/demo/index.min.js +14 -2
- package/components/dropdown/dist/index.js +14 -2
- package/components/dropdown/dist/registered.js +14 -2
- package/components/form/demo/customize.min.js +851 -829
- package/components/form/demo/getting-started.min.js +851 -829
- package/components/form/demo/index.min.js +851 -829
- package/components/form/demo/registerDemoDeps.min.js +851 -829
- package/components/input/demo/api.md +58 -57
- package/components/input/demo/customize.min.js +114 -155
- package/components/input/demo/getting-started.min.js +114 -155
- package/components/input/demo/index.min.js +114 -155
- package/components/input/dist/base-input.d.ts +9 -51
- package/components/input/dist/index.js +114 -155
- package/components/input/dist/registered.js +114 -155
- package/components/input/dist/utilities.d.ts +9 -0
- package/components/radio/demo/customize.min.js +18 -10
- package/components/radio/demo/getting-started.min.js +18 -10
- package/components/radio/demo/index.min.js +18 -10
- package/components/radio/dist/index.js +18 -10
- package/components/radio/dist/registered.js +18 -10
- package/components/select/demo/customize.min.js +32 -12
- package/components/select/demo/getting-started.min.js +32 -12
- package/components/select/demo/index.min.js +32 -12
- package/components/select/dist/index.js +32 -12
- package/components/select/dist/registered.js +32 -12
- package/custom-elements.json +142 -278
- package/package.json +1 -1
|
@@ -4343,11 +4343,17 @@ class AuroFormValidation {
|
|
|
4343
4343
|
return;
|
|
4344
4344
|
}
|
|
4345
4345
|
|
|
4346
|
-
// Validate that the date passed was the correct format and is a valid date
|
|
4346
|
+
// Validate that the date passed was the correct format and is a valid date.
|
|
4347
|
+
// For partial date formats, valueObject is never populated; validate them directly.
|
|
4347
4348
|
if (elem.value && !elem.valueObject) {
|
|
4348
|
-
elem.
|
|
4349
|
-
|
|
4350
|
-
|
|
4349
|
+
const isPartialDateFormat = elem.util && !elem.util.isFullDateFormat(elem.type, elem.format);
|
|
4350
|
+
const isValidPartial = isPartialDateFormat && elem.util.isValidPartialDate(elem.value, elem.format);
|
|
4351
|
+
|
|
4352
|
+
if (!isValidPartial) {
|
|
4353
|
+
elem.validity = 'patternMismatch';
|
|
4354
|
+
elem.errorMessage = elem.setCustomValidityPatternMismatch || elem.setCustomValidity || 'Invalid Date Format Entered';
|
|
4355
|
+
return;
|
|
4356
|
+
}
|
|
4351
4357
|
}
|
|
4352
4358
|
|
|
4353
4359
|
// Perform the rest of the validation
|
|
@@ -4441,15 +4447,17 @@ class AuroFormValidation {
|
|
|
4441
4447
|
);
|
|
4442
4448
|
}
|
|
4443
4449
|
|
|
4444
|
-
|
|
4445
|
-
|
|
4446
|
-
|
|
4450
|
+
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
4451
|
+
|
|
4452
|
+
// If there is a second input in the elem and that value is undefined or an empty string set hasValue to false.
|
|
4453
|
+
// Skip for combobox: its second auro-input is the fullscreen-bib mirror of the same value, not an independent
|
|
4454
|
+
// field (datepicker is the intended consumer — start/end are independently required).
|
|
4455
|
+
if (this.auroInputElements?.length === 2 && !isCombobox) {
|
|
4456
|
+
if (!this.auroInputElements[1].value || this.auroInputElements[1].value.length === 0) {
|
|
4447
4457
|
hasValue = false;
|
|
4448
4458
|
}
|
|
4449
4459
|
}
|
|
4450
4460
|
|
|
4451
|
-
const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
|
|
4452
|
-
|
|
4453
4461
|
if (isCombobox) {
|
|
4454
4462
|
|
|
4455
4463
|
if (!elem.persistInput || elem.behavior === "filter") {
|
|
@@ -10349,6 +10357,42 @@ class AuroInputUtilities {
|
|
|
10349
10357
|
return type === 'date' && normalizedFormat.includes('yy') && normalizedFormat.includes('mm') && normalizedFormat.includes('dd');
|
|
10350
10358
|
}
|
|
10351
10359
|
|
|
10360
|
+
/**
|
|
10361
|
+
* Validates a value against a partial date format (one that lacks yy/mm/dd all three).
|
|
10362
|
+
* Single-component formats are checked as integer ranges; multi-component formats use
|
|
10363
|
+
* a date-fns parse + round-trip to confirm both validity and exact formatting.
|
|
10364
|
+
* @param {string} value - The user-facing display value.
|
|
10365
|
+
* @param {string} format - The partial date format string (e.g. "mm/yyyy", "yyyy", "dd").
|
|
10366
|
+
* @returns {boolean}
|
|
10367
|
+
*/
|
|
10368
|
+
isValidPartialDate(value, format$1) {
|
|
10369
|
+
if (!value || !format$1) {
|
|
10370
|
+
return false;
|
|
10371
|
+
}
|
|
10372
|
+
const normalizedFormat = format$1.toLowerCase();
|
|
10373
|
+
|
|
10374
|
+
if (normalizedFormat === 'dd') {
|
|
10375
|
+
const num = Number(value);
|
|
10376
|
+
return (/^\d{2}$/u).test(value) && num >= 1 && num <= 31;
|
|
10377
|
+
}
|
|
10378
|
+
if (normalizedFormat === 'yy') {
|
|
10379
|
+
const num = Number(value);
|
|
10380
|
+
return (/^\d{2}$/u).test(value) && num >= 0 && num <= 99;
|
|
10381
|
+
}
|
|
10382
|
+
if (normalizedFormat === 'yyyy') {
|
|
10383
|
+
const num = Number(value);
|
|
10384
|
+
return (/^\d{4}$/u).test(value) && num >= 1 && num <= 9999;
|
|
10385
|
+
}
|
|
10386
|
+
|
|
10387
|
+
const dateFnsMask = this.toDateFnsMask(normalizedFormat);
|
|
10388
|
+
// Use the 1st of the current month as the reference so that formats
|
|
10389
|
+
// omitting a day (e.g. MM/yyyy) never roll over on days 29–31.
|
|
10390
|
+
const referenceDate = new Date();
|
|
10391
|
+
referenceDate.setDate(1);
|
|
10392
|
+
const parsed = parse(value, dateFnsMask, referenceDate);
|
|
10393
|
+
return isValid(parsed) && format(parsed, dateFnsMask) === value;
|
|
10394
|
+
}
|
|
10395
|
+
|
|
10352
10396
|
/**
|
|
10353
10397
|
* Converts a display string to its model value.
|
|
10354
10398
|
* For full date formats, converts the display string to an ISO date string.
|
|
@@ -10396,6 +10440,7 @@ class AuroInputUtilities {
|
|
|
10396
10440
|
const maskOptions = this.getMaskOptions('date', normalizedFormat);
|
|
10397
10441
|
|
|
10398
10442
|
if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
|
|
10443
|
+
console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
|
|
10399
10444
|
return undefined;
|
|
10400
10445
|
}
|
|
10401
10446
|
|
|
@@ -10553,6 +10598,7 @@ class BaseInput extends AuroElement {
|
|
|
10553
10598
|
// so a parent (datepicker/combobox) calling `validate()` synchronously
|
|
10554
10599
|
// during its own update cycle sees a populated util instance.
|
|
10555
10600
|
this.activeLabel = false;
|
|
10601
|
+
|
|
10556
10602
|
/** @private */
|
|
10557
10603
|
this.allowedInputTypes = [
|
|
10558
10604
|
"text",
|
|
@@ -10563,6 +10609,7 @@ class BaseInput extends AuroElement {
|
|
|
10563
10609
|
"tel"
|
|
10564
10610
|
];
|
|
10565
10611
|
this.appearance = "default";
|
|
10612
|
+
|
|
10566
10613
|
/** @private */
|
|
10567
10614
|
this.dateFormatMap = {
|
|
10568
10615
|
'mm/dd/yyyy': 'dateMMDDYYYY',
|
|
@@ -10581,23 +10628,24 @@ class BaseInput extends AuroElement {
|
|
|
10581
10628
|
'mm/dd': 'dateMMDD'
|
|
10582
10629
|
};
|
|
10583
10630
|
this.disabled = false;
|
|
10631
|
+
|
|
10584
10632
|
/** @private */
|
|
10585
10633
|
this.domHandler = new DomHandler();
|
|
10586
10634
|
this.dvInputOnly = false;
|
|
10587
10635
|
this.hasValue = false;
|
|
10588
10636
|
this.hideLabelVisually = false;
|
|
10589
10637
|
this.icon = false;
|
|
10638
|
+
|
|
10590
10639
|
/** @private */
|
|
10591
10640
|
this.inputIconName = undefined;
|
|
10641
|
+
|
|
10592
10642
|
/** @private */
|
|
10593
10643
|
this.label = 'Input label is undefined';
|
|
10594
10644
|
this.layout = 'classic';
|
|
10595
10645
|
this.locale = 'en-US';
|
|
10596
10646
|
this.max = undefined;
|
|
10597
|
-
this._maxObject = undefined;
|
|
10598
10647
|
this.maxLength = undefined;
|
|
10599
10648
|
this.min = undefined;
|
|
10600
|
-
this._minObject = undefined;
|
|
10601
10649
|
this.minLength = undefined;
|
|
10602
10650
|
this.noValidate = false;
|
|
10603
10651
|
this.onDark = false;
|
|
@@ -10614,23 +10662,27 @@ class BaseInput extends AuroElement {
|
|
|
10614
10662
|
"email"
|
|
10615
10663
|
];
|
|
10616
10664
|
this.shape = 'classic';
|
|
10665
|
+
|
|
10617
10666
|
/** @private */
|
|
10618
10667
|
this.showPassword = false;
|
|
10619
10668
|
this.size = 'lg';
|
|
10620
10669
|
this.touched = false;
|
|
10670
|
+
|
|
10621
10671
|
/** @private */
|
|
10622
10672
|
this.uniqueId = new UniqueId().create();
|
|
10673
|
+
|
|
10623
10674
|
/** @private */
|
|
10624
10675
|
this.util = new AuroInputUtilities({
|
|
10625
10676
|
locale: this.locale,
|
|
10626
10677
|
format: this.format
|
|
10627
10678
|
});
|
|
10679
|
+
|
|
10628
10680
|
/** @private */
|
|
10629
10681
|
this.validation = new AuroFormValidation();
|
|
10682
|
+
|
|
10630
10683
|
/** @private */
|
|
10631
10684
|
this.validationCCLength = undefined;
|
|
10632
10685
|
this.value = undefined;
|
|
10633
|
-
this._valueObject = undefined;
|
|
10634
10686
|
}
|
|
10635
10687
|
|
|
10636
10688
|
// function to define props used within the scope of this component
|
|
@@ -10960,6 +11012,13 @@ class BaseInput extends AuroElement {
|
|
|
10960
11012
|
type: String
|
|
10961
11013
|
},
|
|
10962
11014
|
|
|
11015
|
+
/**
|
|
11016
|
+
* Custom help text message to display when validity = `patternMismatch`.
|
|
11017
|
+
*/
|
|
11018
|
+
setCustomValidityPatternMismatch: {
|
|
11019
|
+
type: String
|
|
11020
|
+
},
|
|
11021
|
+
|
|
10963
11022
|
/**
|
|
10964
11023
|
* Custom help text message to display when validity = `rangeOverflow`.
|
|
10965
11024
|
*/
|
|
@@ -11030,7 +11089,7 @@ class BaseInput extends AuroElement {
|
|
|
11030
11089
|
|
|
11031
11090
|
/**
|
|
11032
11091
|
* Populates the `type` attribute on the input.
|
|
11033
|
-
* @type {'text' | 'password' | 'email' | 'credit-card' | 'tel' | 'number'}
|
|
11092
|
+
* @type {'text' | 'password' | 'email' | 'credit-card' | 'tel' | 'number' | 'date'}
|
|
11034
11093
|
* @default 'text'
|
|
11035
11094
|
*/
|
|
11036
11095
|
type: {
|
|
@@ -11068,7 +11127,7 @@ class BaseInput extends AuroElement {
|
|
|
11068
11127
|
* @returns {Date|undefined}
|
|
11069
11128
|
*/
|
|
11070
11129
|
get valueObject() {
|
|
11071
|
-
return this.
|
|
11130
|
+
return this.value && dateFormatter.isValidDate(this.value) ? dateFormatter.stringToDateInstance(this.value) : undefined;
|
|
11072
11131
|
}
|
|
11073
11132
|
|
|
11074
11133
|
/**
|
|
@@ -11076,7 +11135,7 @@ class BaseInput extends AuroElement {
|
|
|
11076
11135
|
* @returns {Date|undefined}
|
|
11077
11136
|
*/
|
|
11078
11137
|
get minObject() {
|
|
11079
|
-
return this.
|
|
11138
|
+
return this.min && dateFormatter.isValidDate(this.min) ? dateFormatter.stringToDateInstance(this.min) : undefined;
|
|
11080
11139
|
}
|
|
11081
11140
|
|
|
11082
11141
|
/**
|
|
@@ -11084,50 +11143,7 @@ class BaseInput extends AuroElement {
|
|
|
11084
11143
|
* @returns {Date|undefined}
|
|
11085
11144
|
*/
|
|
11086
11145
|
get maxObject() {
|
|
11087
|
-
return this.
|
|
11088
|
-
}
|
|
11089
|
-
|
|
11090
|
-
/**
|
|
11091
|
-
* Parses a date string into a Date object when the corresponding `_*Object`
|
|
11092
|
-
* field hasn't been synced yet by `updated()`. Returns undefined when the
|
|
11093
|
-
* input type/format isn't a full date or the string is not a valid date.
|
|
11094
|
-
*
|
|
11095
|
-
* Why this exists: a parent (datepicker) can call `inputN.validate()` from
|
|
11096
|
-
* inside its own `updated()` before this input's `updated()` has run
|
|
11097
|
-
* `syncDateValues()` — so `_valueObject`/`_maxObject` are still `undefined`
|
|
11098
|
-
* and range checks would otherwise silently no-op (flipping the result to
|
|
11099
|
-
* `valid` or `patternMismatch`).
|
|
11100
|
-
* @private
|
|
11101
|
-
* @param {string|undefined} dateStr - ISO date string from `value`/`min`/`max`.
|
|
11102
|
-
* @returns {Date|undefined}
|
|
11103
|
-
*/
|
|
11104
|
-
_computeDateObjectFallback(dateStr) {
|
|
11105
|
-
if (!dateStr || !this.util || !this.util.isFullDateFormat(this.type, this.format)) {
|
|
11106
|
-
return undefined;
|
|
11107
|
-
}
|
|
11108
|
-
if (!dateFormatter.isValidDate(dateStr)) {
|
|
11109
|
-
return undefined;
|
|
11110
|
-
}
|
|
11111
|
-
return dateFormatter.stringToDateInstance(dateStr);
|
|
11112
|
-
}
|
|
11113
|
-
|
|
11114
|
-
/**
|
|
11115
|
-
* Internal setter for readonly date object properties.
|
|
11116
|
-
* @private
|
|
11117
|
-
* @param {'valueObject'|'minObject'|'maxObject'} propertyName - Public object property name.
|
|
11118
|
-
* @param {Date|undefined} propertyValue - Value to assign.
|
|
11119
|
-
* @returns {void}
|
|
11120
|
-
*/
|
|
11121
|
-
setDateObjectProperty(propertyName, propertyValue) {
|
|
11122
|
-
const internalPropertyName = `_${propertyName}`;
|
|
11123
|
-
const previousValue = this[internalPropertyName];
|
|
11124
|
-
|
|
11125
|
-
if (previousValue === propertyValue) {
|
|
11126
|
-
return;
|
|
11127
|
-
}
|
|
11128
|
-
|
|
11129
|
-
this[internalPropertyName] = propertyValue;
|
|
11130
|
-
this.requestUpdate(propertyName, previousValue);
|
|
11146
|
+
return this.max && dateFormatter.isValidDate(this.max) ? dateFormatter.stringToDateInstance(this.max) : undefined;
|
|
11131
11147
|
}
|
|
11132
11148
|
|
|
11133
11149
|
connectedCallback() {
|
|
@@ -11156,7 +11172,6 @@ class BaseInput extends AuroElement {
|
|
|
11156
11172
|
format: this.format
|
|
11157
11173
|
});
|
|
11158
11174
|
this.configureDataForType();
|
|
11159
|
-
this.syncDateValues();
|
|
11160
11175
|
}
|
|
11161
11176
|
|
|
11162
11177
|
disconnectedCallback() {
|
|
@@ -11195,7 +11210,6 @@ class BaseInput extends AuroElement {
|
|
|
11195
11210
|
this.setCustomHelpTextMessage();
|
|
11196
11211
|
this.configureAutoFormatting();
|
|
11197
11212
|
this.configureDataForType();
|
|
11198
|
-
this.syncDateValues();
|
|
11199
11213
|
}
|
|
11200
11214
|
|
|
11201
11215
|
/**
|
|
@@ -11339,8 +11353,6 @@ class BaseInput extends AuroElement {
|
|
|
11339
11353
|
this.configureDataForType();
|
|
11340
11354
|
}
|
|
11341
11355
|
|
|
11342
|
-
this.syncDateValues(changedProperties);
|
|
11343
|
-
|
|
11344
11356
|
if (changedProperties.has('value')) {
|
|
11345
11357
|
if (this.value && this.value.length > 0) {
|
|
11346
11358
|
this.hasValue = true;
|
|
@@ -11362,14 +11374,14 @@ class BaseInput extends AuroElement {
|
|
|
11362
11374
|
|
|
11363
11375
|
if (formattedValue !== this.inputElement.value) {
|
|
11364
11376
|
this.skipNextProgrammaticInputEvent = true;
|
|
11365
|
-
if (this.maskInstance && this.type
|
|
11377
|
+
if (this.maskInstance && this.type !== 'date') {
|
|
11366
11378
|
// Route through the mask so its _value and el.value stay in lock-step
|
|
11367
11379
|
// (set value calls updateControl which writes el.value = displayValue).
|
|
11368
11380
|
// Writing el.value directly leaves the mask thinking displayValue is
|
|
11369
|
-
// stale; _saveSelection on the next focus/click then warns.
|
|
11370
|
-
//
|
|
11371
|
-
//
|
|
11372
|
-
//
|
|
11381
|
+
// stale; _saveSelection on the next focus/click then warns. Date is
|
|
11382
|
+
// excluded because its formattedValue can be raw ISO when the calendar
|
|
11383
|
+
// is invalid, and re-masking through mm/dd/yyyy would truncate it and
|
|
11384
|
+
// flip validity from patternMismatch to tooShort.
|
|
11373
11385
|
this.maskInstance.value = formattedValue || '';
|
|
11374
11386
|
} else if (formattedValue) {
|
|
11375
11387
|
this.inputElement.value = formattedValue;
|
|
@@ -11411,120 +11423,65 @@ class BaseInput extends AuroElement {
|
|
|
11411
11423
|
}));
|
|
11412
11424
|
}
|
|
11413
11425
|
|
|
11414
|
-
|
|
11415
|
-
/**
|
|
11416
|
-
* Synchronizes the ISO string values and Date object representations for date-related properties.
|
|
11417
|
-
* This keeps the model and display values aligned when either side changes.
|
|
11418
|
-
*
|
|
11419
|
-
* When a full date format is in use, this method updates `value`, `min`, and `max` from their corresponding
|
|
11420
|
-
* Date objects or vice versa, based on which properties have changed. It only runs when the current configuration
|
|
11421
|
-
* represents a full year/month/day date format.
|
|
11422
|
-
*
|
|
11423
|
-
* @param {Map<string, unknown>|undefined} [changedProperties=undefined] - Optional map of changed properties used to limit which values are synchronized.
|
|
11424
|
-
* @returns {void}
|
|
11425
|
-
* @private
|
|
11426
|
-
*/
|
|
11427
|
-
syncDateValues(changedProperties = undefined) {
|
|
11428
|
-
if (!this.util.isFullDateFormat(this.type, this.format)) {
|
|
11429
|
-
return;
|
|
11430
|
-
}
|
|
11431
|
-
|
|
11432
|
-
this.syncSingleDateValue(changedProperties, 'valueObject', 'value');
|
|
11433
|
-
this.syncSingleDateValue(changedProperties, 'minObject', 'min');
|
|
11434
|
-
this.syncSingleDateValue(changedProperties, 'maxObject', 'max');
|
|
11435
|
-
}
|
|
11436
|
-
|
|
11437
|
-
/**
|
|
11438
|
-
* Synchronizes one date object/string property pair.
|
|
11439
|
-
* @private
|
|
11440
|
-
* @param {Map<string, unknown>|undefined} changedProperties - Map of changed properties from Lit.
|
|
11441
|
-
* @param {string} objectProperty - Date object property name.
|
|
11442
|
-
* @param {string} valueProperty - ISO string property name.
|
|
11443
|
-
* @returns {void}
|
|
11444
|
-
*/
|
|
11445
|
-
syncSingleDateValue(changedProperties, objectProperty, valueProperty) {
|
|
11446
|
-
const objectPropertyChanged = !changedProperties || changedProperties.has(objectProperty);
|
|
11447
|
-
|
|
11448
|
-
// objectProperty wins over valueProperty when both changed
|
|
11449
|
-
if (objectPropertyChanged && this[objectProperty]) {
|
|
11450
|
-
this[valueProperty] = dateFormatter.toISOFormatString(this[objectProperty]);
|
|
11451
|
-
return;
|
|
11452
|
-
}
|
|
11453
|
-
|
|
11454
|
-
const valuePropertyChanged = !changedProperties || changedProperties.has(valueProperty);
|
|
11455
|
-
if (!valuePropertyChanged) {
|
|
11456
|
-
return;
|
|
11457
|
-
}
|
|
11458
|
-
|
|
11459
|
-
// when value is newly set to the same ISO string that corresponds to the existing Date object, do not clear the Date object (avoid unnecessary updates)
|
|
11460
|
-
if (
|
|
11461
|
-
changedProperties &&
|
|
11462
|
-
valueProperty === 'value' &&
|
|
11463
|
-
changedProperties.get('value') === undefined &&
|
|
11464
|
-
this[objectProperty] instanceof Date &&
|
|
11465
|
-
this[valueProperty] === dateFormatter.toISOFormatString(this[objectProperty])
|
|
11466
|
-
) {
|
|
11467
|
-
return;
|
|
11468
|
-
}
|
|
11469
|
-
|
|
11470
|
-
if (dateFormatter.isValidDate(this[valueProperty])) {
|
|
11471
|
-
this.setDateObjectProperty(objectProperty, dateFormatter.stringToDateInstance(this[valueProperty]));
|
|
11472
|
-
} else {
|
|
11473
|
-
this.setDateObjectProperty(objectProperty, undefined);
|
|
11474
|
-
}
|
|
11475
|
-
}
|
|
11476
|
-
|
|
11477
11426
|
/**
|
|
11478
11427
|
* Sets up IMasks and logic based on auto-formatting requirements.
|
|
11479
11428
|
* @private
|
|
11480
11429
|
* @returns {void}
|
|
11481
11430
|
*/
|
|
11482
11431
|
configureAutoFormatting() {
|
|
11483
|
-
//
|
|
11484
|
-
//
|
|
11485
|
-
//
|
|
11486
|
-
//
|
|
11432
|
+
// _configuringMask gates two things: external re-entry into this method
|
|
11433
|
+
// while setup is mid-flight (from property changes that call back here),
|
|
11434
|
+
// and the accept/complete listeners below — both need to ignore the mask
|
|
11435
|
+
// events fired by our own value-restore step.
|
|
11487
11436
|
if (this._configuringMask) return;
|
|
11488
11437
|
this._configuringMask = true;
|
|
11489
11438
|
try {
|
|
11439
|
+
// Destroy any prior mask so IMask can attach fresh under the new format.
|
|
11440
|
+
// Null the reference too — if the new maskOptions.mask is falsy (e.g.
|
|
11441
|
+
// type switched from credit-card to text) the IMask() reassignment
|
|
11442
|
+
// below is skipped, and downstream writes at line ~823 would otherwise
|
|
11443
|
+
// route through the destroyed instance.
|
|
11490
11444
|
if (this.maskInstance) {
|
|
11491
11445
|
this.maskInstance.destroy();
|
|
11446
|
+
this.maskInstance = null;
|
|
11492
11447
|
}
|
|
11493
11448
|
|
|
11494
|
-
// Pass new format to util
|
|
11495
11449
|
this.util.updateFormat(this.format);
|
|
11496
11450
|
|
|
11497
11451
|
const maskOptions = this.util.getMaskOptions(this.type, this.format);
|
|
11498
11452
|
|
|
11499
11453
|
if (this.inputElement && maskOptions.mask) {
|
|
11500
|
-
|
|
11501
|
-
//
|
|
11502
|
-
//
|
|
11503
|
-
//
|
|
11504
|
-
// When the format changes (e.g. locale switch) and we have a valid ISO
|
|
11505
|
-
// model value, compute the display string for the NEW format instead of
|
|
11506
|
-
// re-using the old display string, which may be invalid in the new mask.
|
|
11454
|
+
// Capture the current display so it can be re-applied after IMask
|
|
11455
|
+
// attaches. The restore at the bottom goes through maskInstance.value
|
|
11456
|
+
// (not inputElement.value directly) so the mask's internal state and
|
|
11457
|
+
// the input's displayed text stay in lock-step.
|
|
11507
11458
|
let existingValue = this.inputElement.value;
|
|
11459
|
+
|
|
11460
|
+
// Format-change case (e.g. locale switch): existingValue is the OLD
|
|
11461
|
+
// mask's display string and may not parse under the new mask. When
|
|
11462
|
+
// we have a valid date model, rebuild the display from valueObject
|
|
11463
|
+
// (the canonical source) using the new mask's format function.
|
|
11508
11464
|
if (
|
|
11509
11465
|
this.util.isFullDateFormat(this.type, this.format) &&
|
|
11510
11466
|
this.value &&
|
|
11511
|
-
|
|
11512
|
-
this.valueObject instanceof Date &&
|
|
11513
|
-
!Number.isNaN(this.valueObject.getTime()) &&
|
|
11467
|
+
this.valueObject &&
|
|
11514
11468
|
typeof maskOptions.format === 'function'
|
|
11515
11469
|
) {
|
|
11516
11470
|
existingValue = maskOptions.format(this.valueObject);
|
|
11517
11471
|
}
|
|
11518
11472
|
|
|
11473
|
+
// Clear before IMask attaches so the constructor seeds an empty
|
|
11474
|
+
// internal value. Otherwise IMask reads the stale unmasked string
|
|
11475
|
+
// and emits a spurious 'accept' before the restore below runs.
|
|
11519
11476
|
this.skipNextProgrammaticInputEvent = true;
|
|
11520
11477
|
this.inputElement.value = '';
|
|
11521
11478
|
|
|
11522
11479
|
this.maskInstance = IMask(this.inputElement, maskOptions);
|
|
11523
11480
|
|
|
11481
|
+
// Mask fires 'accept' on every value change, including the restore
|
|
11482
|
+
// step below. Skip events fired during configureAutoFormatting so
|
|
11483
|
+
// we don't overwrite a value the parent just pushed.
|
|
11524
11484
|
this.maskInstance.on('accept', () => {
|
|
11525
|
-
// Suppress propagation during configureAutoFormatting's own value-restoration
|
|
11526
|
-
// (line below) — the mask emits 'accept' on every value-set, including ours,
|
|
11527
|
-
// and we don't want to overwrite a value the parent just pushed.
|
|
11528
11485
|
if (this._configuringMask) return;
|
|
11529
11486
|
this.value = this.util.toModelValue(this.maskInstance.value, this.format);
|
|
11530
11487
|
if (this.type === "date") {
|
|
@@ -11532,6 +11489,8 @@ class BaseInput extends AuroElement {
|
|
|
11532
11489
|
}
|
|
11533
11490
|
});
|
|
11534
11491
|
|
|
11492
|
+
// Mask fires 'complete' on the restore step below for any value that
|
|
11493
|
+
// happens to be a complete match. Same setup-suppression as 'accept'.
|
|
11535
11494
|
this.maskInstance.on('complete', () => {
|
|
11536
11495
|
if (this._configuringMask) return;
|
|
11537
11496
|
this.value = this.util.toModelValue(this.maskInstance.value, this.format);
|
|
@@ -11540,7 +11499,9 @@ class BaseInput extends AuroElement {
|
|
|
11540
11499
|
}
|
|
11541
11500
|
});
|
|
11542
11501
|
|
|
11543
|
-
//
|
|
11502
|
+
// Write existingValue through the mask (not the input directly) so
|
|
11503
|
+
// the mask reformats it under the new rules and keeps its internal
|
|
11504
|
+
// _value aligned with the input's displayed text.
|
|
11544
11505
|
if (existingValue) {
|
|
11545
11506
|
this.maskInstance.value = existingValue;
|
|
11546
11507
|
}
|
|
@@ -11634,9 +11595,9 @@ class BaseInput extends AuroElement {
|
|
|
11634
11595
|
// the gated types currently support it, since the list is a public
|
|
11635
11596
|
// property a consumer could mutate.
|
|
11636
11597
|
if (this.setSelectionInputTypes.includes(this.type)) {
|
|
11637
|
-
let selectionStart;
|
|
11598
|
+
let selectionStart = null;
|
|
11638
11599
|
try {
|
|
11639
|
-
selectionStart = this.inputElement
|
|
11600
|
+
({ selectionStart } = this.inputElement);
|
|
11640
11601
|
} catch (error) { // eslint-disable-line no-unused-vars
|
|
11641
11602
|
return;
|
|
11642
11603
|
}
|
|
@@ -11740,7 +11701,6 @@ class BaseInput extends AuroElement {
|
|
|
11740
11701
|
*/
|
|
11741
11702
|
reset() {
|
|
11742
11703
|
this.value = undefined;
|
|
11743
|
-
this.setDateObjectProperty('valueObject', undefined);
|
|
11744
11704
|
this.validation.reset(this);
|
|
11745
11705
|
}
|
|
11746
11706
|
|
|
@@ -11749,7 +11709,6 @@ class BaseInput extends AuroElement {
|
|
|
11749
11709
|
*/
|
|
11750
11710
|
clear() {
|
|
11751
11711
|
this.value = undefined;
|
|
11752
|
-
this.setDateObjectProperty('valueObject', undefined);
|
|
11753
11712
|
}
|
|
11754
11713
|
|
|
11755
11714
|
/**
|
|
@@ -12278,7 +12237,7 @@ class AuroHelpText extends i$3 {
|
|
|
12278
12237
|
}
|
|
12279
12238
|
}
|
|
12280
12239
|
|
|
12281
|
-
var formkitVersion = '
|
|
12240
|
+
var formkitVersion = '202607011722';
|
|
12282
12241
|
|
|
12283
12242
|
/**
|
|
12284
12243
|
* @license
|
|
@@ -291,6 +291,12 @@ export default class BaseInput extends AuroElement {
|
|
|
291
291
|
setCustomValidityForType: {
|
|
292
292
|
type: StringConstructor;
|
|
293
293
|
};
|
|
294
|
+
/**
|
|
295
|
+
* Custom help text message to display when validity = `patternMismatch`.
|
|
296
|
+
*/
|
|
297
|
+
setCustomValidityPatternMismatch: {
|
|
298
|
+
type: StringConstructor;
|
|
299
|
+
};
|
|
294
300
|
/**
|
|
295
301
|
* Custom help text message to display when validity = `rangeOverflow`.
|
|
296
302
|
*/
|
|
@@ -352,10 +358,10 @@ export default class BaseInput extends AuroElement {
|
|
|
352
358
|
};
|
|
353
359
|
/**
|
|
354
360
|
* Populates the `type` attribute on the input.
|
|
355
|
-
* @type {'text' | 'password' | 'email' | 'credit-card' | 'tel' | 'number'}
|
|
361
|
+
* @type {'text' | 'password' | 'email' | 'credit-card' | 'tel' | 'number' | 'date'}
|
|
356
362
|
* @default 'text'
|
|
357
363
|
*/
|
|
358
|
-
type: "text" | "password" | "email" | "credit-card" | "tel" | "number";
|
|
364
|
+
type: "text" | "password" | "email" | "credit-card" | "tel" | "number" | "date";
|
|
359
365
|
/**
|
|
360
366
|
* Sets validation mode to re-eval with each input.
|
|
361
367
|
*/
|
|
@@ -401,10 +407,8 @@ export default class BaseInput extends AuroElement {
|
|
|
401
407
|
private label;
|
|
402
408
|
locale: string;
|
|
403
409
|
max: any;
|
|
404
|
-
_maxObject: any;
|
|
405
410
|
maxLength: any;
|
|
406
411
|
min: any;
|
|
407
|
-
_minObject: any;
|
|
408
412
|
minLength: any;
|
|
409
413
|
noValidate: boolean;
|
|
410
414
|
onDark: boolean;
|
|
@@ -427,7 +431,6 @@ export default class BaseInput extends AuroElement {
|
|
|
427
431
|
/** @private */
|
|
428
432
|
private validationCCLength;
|
|
429
433
|
value: any;
|
|
430
|
-
_valueObject: any;
|
|
431
434
|
/**
|
|
432
435
|
* Read-only Date object representation of `value` for full date formats.
|
|
433
436
|
* @returns {Date|undefined}
|
|
@@ -443,29 +446,6 @@ export default class BaseInput extends AuroElement {
|
|
|
443
446
|
* @returns {Date|undefined}
|
|
444
447
|
*/
|
|
445
448
|
get maxObject(): Date | undefined;
|
|
446
|
-
/**
|
|
447
|
-
* Parses a date string into a Date object when the corresponding `_*Object`
|
|
448
|
-
* field hasn't been synced yet by `updated()`. Returns undefined when the
|
|
449
|
-
* input type/format isn't a full date or the string is not a valid date.
|
|
450
|
-
*
|
|
451
|
-
* Why this exists: a parent (datepicker) can call `inputN.validate()` from
|
|
452
|
-
* inside its own `updated()` before this input's `updated()` has run
|
|
453
|
-
* `syncDateValues()` — so `_valueObject`/`_maxObject` are still `undefined`
|
|
454
|
-
* and range checks would otherwise silently no-op (flipping the result to
|
|
455
|
-
* `valid` or `patternMismatch`).
|
|
456
|
-
* @private
|
|
457
|
-
* @param {string|undefined} dateStr - ISO date string from `value`/`min`/`max`.
|
|
458
|
-
* @returns {Date|undefined}
|
|
459
|
-
*/
|
|
460
|
-
private _computeDateObjectFallback;
|
|
461
|
-
/**
|
|
462
|
-
* Internal setter for readonly date object properties.
|
|
463
|
-
* @private
|
|
464
|
-
* @param {'valueObject'|'minObject'|'maxObject'} propertyName - Public object property name.
|
|
465
|
-
* @param {Date|undefined} propertyValue - Value to assign.
|
|
466
|
-
* @returns {void}
|
|
467
|
-
*/
|
|
468
|
-
private setDateObjectProperty;
|
|
469
449
|
firstUpdated(): void;
|
|
470
450
|
wrapperElement: Element | null | undefined;
|
|
471
451
|
inputElement: HTMLInputElement | null | undefined;
|
|
@@ -500,28 +480,6 @@ export default class BaseInput extends AuroElement {
|
|
|
500
480
|
* @returns {void} Notify validity state changed via event.
|
|
501
481
|
*/
|
|
502
482
|
private notifyValidityChange;
|
|
503
|
-
/**
|
|
504
|
-
* Synchronizes the ISO string values and Date object representations for date-related properties.
|
|
505
|
-
* This keeps the model and display values aligned when either side changes.
|
|
506
|
-
*
|
|
507
|
-
* When a full date format is in use, this method updates `value`, `min`, and `max` from their corresponding
|
|
508
|
-
* Date objects or vice versa, based on which properties have changed. It only runs when the current configuration
|
|
509
|
-
* represents a full year/month/day date format.
|
|
510
|
-
*
|
|
511
|
-
* @param {Map<string, unknown>|undefined} [changedProperties=undefined] - Optional map of changed properties used to limit which values are synchronized.
|
|
512
|
-
* @returns {void}
|
|
513
|
-
* @private
|
|
514
|
-
*/
|
|
515
|
-
private syncDateValues;
|
|
516
|
-
/**
|
|
517
|
-
* Synchronizes one date object/string property pair.
|
|
518
|
-
* @private
|
|
519
|
-
* @param {Map<string, unknown>|undefined} changedProperties - Map of changed properties from Lit.
|
|
520
|
-
* @param {string} objectProperty - Date object property name.
|
|
521
|
-
* @param {string} valueProperty - ISO string property name.
|
|
522
|
-
* @returns {void}
|
|
523
|
-
*/
|
|
524
|
-
private syncSingleDateValue;
|
|
525
483
|
/**
|
|
526
484
|
* Sets up IMasks and logic based on auto-formatting requirements.
|
|
527
485
|
* @private
|
|
@@ -529,7 +487,7 @@ export default class BaseInput extends AuroElement {
|
|
|
529
487
|
*/
|
|
530
488
|
private configureAutoFormatting;
|
|
531
489
|
_configuringMask: boolean | undefined;
|
|
532
|
-
maskInstance: import("imask").InputMask<any> | undefined;
|
|
490
|
+
maskInstance: import("imask").InputMask<any> | null | undefined;
|
|
533
491
|
/**
|
|
534
492
|
* Sends event notifying that the input has changed it's value.
|
|
535
493
|
* @private
|