@aurodesignsystem-dev/auro-formkit 0.0.0-pr1505.0 → 0.0.0-pr1506.1
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 +1 -1
- package/components/checkbox/demo/getting-started.min.js +1 -1
- package/components/checkbox/demo/index.min.js +1 -1
- package/components/checkbox/dist/index.js +1 -1
- package/components/checkbox/dist/registered.js +1 -1
- package/components/combobox/demo/customize.min.js +138 -266
- package/components/combobox/demo/getting-started.min.js +138 -266
- package/components/combobox/demo/index.min.js +138 -266
- package/components/combobox/dist/auro-combobox.d.ts +9 -0
- package/components/combobox/dist/index.js +138 -266
- package/components/combobox/dist/registered.js +138 -266
- package/components/counter/demo/customize.min.js +2 -2
- package/components/counter/demo/index.min.js +2 -2
- package/components/counter/dist/index.js +2 -2
- package/components/counter/dist/registered.js +2 -2
- package/components/datepicker/demo/api.md +0 -2
- package/components/datepicker/demo/customize.md +33 -195
- package/components/datepicker/demo/customize.min.js +41 -164
- package/components/datepicker/demo/index.min.js +40 -156
- package/components/datepicker/dist/index.js +40 -156
- package/components/datepicker/dist/registered.js +40 -156
- package/components/datepicker/dist/src/auro-datepicker.d.ts +0 -2
- package/components/dropdown/demo/customize.min.js +1 -1
- package/components/dropdown/demo/getting-started.min.js +1 -1
- package/components/dropdown/demo/index.min.js +1 -1
- package/components/dropdown/dist/index.js +1 -1
- package/components/dropdown/dist/registered.js +1 -1
- package/components/form/demo/customize.min.js +351 -599
- package/components/form/demo/getting-started.min.js +351 -599
- package/components/form/demo/index.min.js +351 -599
- package/components/form/demo/registerDemoDeps.min.js +351 -599
- package/components/input/demo/customize.md +55 -56
- package/components/input/demo/customize.min.js +36 -147
- package/components/input/demo/getting-started.min.js +36 -147
- package/components/input/demo/index.md +2 -2
- package/components/input/demo/index.min.js +36 -147
- package/components/input/dist/base-input.d.ts +0 -48
- package/components/input/dist/index.js +36 -147
- package/components/input/dist/registered.js +36 -147
- package/components/radio/demo/customize.min.js +1 -1
- package/components/radio/demo/getting-started.min.js +1 -1
- package/components/radio/demo/index.min.js +1 -1
- package/components/radio/dist/index.js +1 -1
- package/components/radio/dist/registered.js +1 -1
- package/components/select/demo/api.md +1 -0
- package/components/select/demo/customize.md +71 -0
- package/components/select/demo/customize.min.js +133 -26
- package/components/select/demo/getting-started.min.js +133 -26
- package/components/select/demo/index.min.js +133 -26
- package/components/select/demo/keyboard-behavior.md +18 -0
- package/components/select/dist/auro-select.d.ts +38 -2
- package/components/select/dist/index.js +133 -26
- package/components/select/dist/registered.js +133 -26
- package/components/select/dist/selectUtils.d.ts +12 -0
- package/custom-elements.json +114 -274
- package/package.json +1 -1
|
@@ -232,19 +232,21 @@
|
|
|
232
232
|
<auro-header level="3" id="localization">Localization</auro-header>
|
|
233
233
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../docs/partials/customize/localization.md) -->
|
|
234
234
|
<!-- The below content is automatically added from ./../docs/partials/customize/localization.md -->
|
|
235
|
-
<p>The component supports complete localization, including visible strings, screen reader announcements
|
|
236
|
-
<auro-header level="4" id="localizationVisibleStrings">Visible
|
|
235
|
+
<p>The component supports complete localization, including visible strings, screen reader announcements and locale based date formatting.</p>
|
|
236
|
+
<auro-header level="4" id="localizationVisibleStrings">Visible strings</auro-header>
|
|
237
237
|
<p>The visible strings rendered in the input are not derived from <code>locale</code> — they are projected through named slots so each language can supply its own translation. Pass a <code><span></code> with the matching <code>slot</code> attribute for every string you need to localize.</p>
|
|
238
238
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/localization-visible-strings.html) -->
|
|
239
|
-
<!-- The below content is automatically added from ./../apiExamples/localization-visible-strings.html -->
|
|
240
|
-
|
|
241
|
-
<
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
239
|
+
<!-- The below content is automatically added from ./../apiExamples/localization-visible-strings.html -->
|
|
240
|
+
<auro-input locale="ja-JP">
|
|
241
|
+
<span slot="label">出発日</span>
|
|
242
|
+
<span slot="helpText">日付を選択してください</span>
|
|
243
|
+
<span slot="optionalLabel">(任意)</span>
|
|
244
|
+
<span slot="ariaLabel.clear">入力をクリア</span>
|
|
245
|
+
<span slot="ariaLabel.password.show">パスワードを表示</span>
|
|
246
|
+
<span slot="ariaLabel.password.hide">パスワードを非表示</span>
|
|
247
|
+
</auro-input>
|
|
246
248
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
247
|
-
<auro-header level="4" id="localizationA11yStrings">Screen
|
|
249
|
+
<auro-header level="4" id="localizationA11yStrings">Screen reader strings</auro-header>
|
|
248
250
|
<p>Assistive-technology announcements that are not visible in the UI are also exposed as named slots so they can be translated independently. These strings are not derived from <code>locale</code>; supply translated values for every language you support.</p>
|
|
249
251
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/localization-screenreader-strings.html) -->
|
|
250
252
|
<!-- The below content is automatically added from ./../apiExamples/localization-screenreader-strings.html -->
|
|
@@ -259,7 +261,7 @@
|
|
|
259
261
|
</auro-input></code></pre>
|
|
260
262
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
261
263
|
<p class="note"><strong>Note:</strong> Custom validation messages set via <code>setCustomValidity*</code> attributes are also not localized — supply translated strings yourself when using those properties.</p>
|
|
262
|
-
<auro-header level="4" id="localizationDateFormatting">Date
|
|
264
|
+
<auro-header level="4" id="localizationDateFormatting">Date formatting</auro-header>
|
|
263
265
|
<p>When <code>type="date"</code> is set, the <code>locale</code> attribute drives the date format used by the input mask. Setting <code>locale</code> automatically selects the regional format (for example <code>en-US</code> → <code>mm/dd/yyyy</code>, <code>de-DE</code> → <code>dd.mm.yyyy</code>, <code>ja-JP</code> → <code>yyyy/mm/dd</code>), derived from the browser's <auro-hyperlink href="https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl" target="_blank">Intl</auro-hyperlink> API, so <code>format</code> does not need to be set manually.</p>
|
|
264
266
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/localization-locale.html) -->
|
|
265
267
|
<!-- The below content is automatically added from ./../apiExamples/localization-locale.html -->
|
|
@@ -296,43 +298,41 @@
|
|
|
296
298
|
<span slot="optionalLabel">(freiwillig)</span>
|
|
297
299
|
</auro-input></code></pre>
|
|
298
300
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
299
|
-
<p>The following live example shows several locale configurations in action:</p>
|
|
300
301
|
<div class="exampleWrapper">
|
|
301
302
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/locale.html) -->
|
|
302
303
|
<!-- The below content is automatically added from ./../apiExamples/locale.html -->
|
|
303
|
-
<
|
|
304
|
+
<div data-locale="de-DE">
|
|
305
|
+
<auro-header level="4">en-GB Example</auro-header>
|
|
304
306
|
<auro-input type="date" locale="en-GB">
|
|
305
307
|
<span slot="ariaLabel.clear">Clear All</span>
|
|
306
308
|
<span slot="label">en-GB Date</span>
|
|
307
309
|
<span slot="helpText">Help Text</span>
|
|
308
310
|
</auro-input>
|
|
309
|
-
<
|
|
311
|
+
<auro-header level="4">en-US Example</auro-header>
|
|
310
312
|
<auro-input type="date" locale="en-US">
|
|
311
313
|
<span slot="ariaLabel.clear">Clear All</span>
|
|
312
314
|
<span slot="label">en-US Date</span>
|
|
313
315
|
<span slot="helpText">Help Text</span>
|
|
314
316
|
</auro-input>
|
|
315
|
-
<
|
|
317
|
+
<auro-header level="4">zh-CN Example</auro-header>
|
|
316
318
|
<auro-input type="date" locale="zh-CN">
|
|
317
319
|
<span slot="ariaLabel.clear">全部清除</span>
|
|
318
320
|
<span slot="label">中文日期</span>
|
|
319
321
|
<span slot="helpText">帮助文本</span>
|
|
320
322
|
<span slot="optionalLabel">(可选)</span>
|
|
321
323
|
</auro-input>
|
|
322
|
-
<
|
|
323
|
-
<auro-input type="date" locale="en-US" format="yyyy.mm.dd">
|
|
324
|
-
<span slot="ariaLabel.clear">Clear All</span>
|
|
325
|
-
<span slot="label">en-US with yyyy.mm.dd format</span>
|
|
326
|
-
<span slot="helpText">Help Text</span>
|
|
327
|
-
</auro-input>
|
|
328
|
-
<p class="body-sm"><strong>Inherited de-DE (via <code>data-locale</code>)</strong></p>
|
|
329
|
-
<div data-locale="de-DE">
|
|
324
|
+
<auro-header level="4">Inherited de-DE date-locale Example</auro-header>
|
|
330
325
|
<auro-input type="date">
|
|
331
326
|
<span slot="ariaLabel.clear">Alles löschen</span>
|
|
332
|
-
<span slot="label">
|
|
327
|
+
<span slot="label">Nächstes `data-locale`-Attributformat (`de-DE` in diesem Fall)</span>
|
|
333
328
|
<span slot="helpText">Hilfetext</span>
|
|
334
329
|
<span slot="optionalLabel">(freiwillig)</span>
|
|
335
|
-
</auro-input>
|
|
330
|
+
</auro-input>
|
|
331
|
+
<auro-header level="4">en-US with `yyyy.mm.dd` format Example</auro-header>
|
|
332
|
+
<auro-input type="date" locale="en-US" format="yyyy.mm.dd">
|
|
333
|
+
<span slot="ariaLabel.clear">Clear All</span>
|
|
334
|
+
<span slot="label">en-US with yyyy.mm.dd format</span>
|
|
335
|
+
<span slot="helpText">Help Text</span>
|
|
336
336
|
</div>
|
|
337
337
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
338
338
|
</div>
|
|
@@ -340,43 +340,42 @@
|
|
|
340
340
|
<span slot="trigger">See code</span>
|
|
341
341
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/locale.html) -->
|
|
342
342
|
<!-- The below code snippet is automatically added from ./../apiExamples/locale.html -->
|
|
343
|
-
<pre class="language-html"><code class="language-html"><
|
|
344
|
-
<auro-
|
|
345
|
-
<
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
</
|
|
349
|
-
|
|
350
|
-
<p class="body-sm"><strong>en-US</strong></p>
|
|
351
|
-
<auro-input type="date" locale="en-US">
|
|
352
|
-
<span slot="ariaLabel.clear">Clear All</span>
|
|
353
|
-
<span slot="label">en-US Date</span>
|
|
354
|
-
<span slot="helpText">Help Text</span>
|
|
355
|
-
</auro-input>
|
|
343
|
+
<pre class="language-html"><code class="language-html"><div data-locale="de-DE">
|
|
344
|
+
<auro-header level="4">en-GB Example</auro-header>
|
|
345
|
+
<auro-input type="date" locale="en-GB">
|
|
346
|
+
<span slot="ariaLabel.clear">Clear All</span>
|
|
347
|
+
<span slot="label">en-GB Date</span>
|
|
348
|
+
<span slot="helpText">Help Text</span>
|
|
349
|
+
</auro-input>
|
|
356
350
|
|
|
357
|
-
<
|
|
358
|
-
<auro-input type="date" locale="
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
<
|
|
363
|
-
</auro-input>
|
|
351
|
+
<auro-header level="4">en-US Example</auro-header>
|
|
352
|
+
<auro-input type="date" locale="en-US">
|
|
353
|
+
<span slot="ariaLabel.clear">Clear All</span>
|
|
354
|
+
<span slot="label">en-US Date</span>
|
|
355
|
+
<span slot="helpText">Help Text</span>
|
|
356
|
+
</auro-input>
|
|
364
357
|
|
|
365
|
-
<
|
|
366
|
-
<auro-input type="date" locale="
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
</
|
|
358
|
+
<auro-header level="4">zh-CN Example</auro-header>
|
|
359
|
+
<auro-input type="date" locale="zh-CN">
|
|
360
|
+
<span slot="ariaLabel.clear">全部清除</span>
|
|
361
|
+
<span slot="label">中文日期</span>
|
|
362
|
+
<span slot="helpText">帮助文本</span>
|
|
363
|
+
<span slot="optionalLabel">(可选)</span>
|
|
364
|
+
</auro-input>
|
|
371
365
|
|
|
372
|
-
<
|
|
373
|
-
<div data-locale="de-DE">
|
|
366
|
+
<auro-header level="4">Inherited de-DE date-locale Example</auro-header>
|
|
374
367
|
<auro-input type="date">
|
|
375
368
|
<span slot="ariaLabel.clear">Alles löschen</span>
|
|
376
|
-
<span slot="label">
|
|
369
|
+
<span slot="label">Nächstes `data-locale`-Attributformat (`de-DE` in diesem Fall)</span>
|
|
377
370
|
<span slot="helpText">Hilfetext</span>
|
|
378
371
|
<span slot="optionalLabel">(freiwillig)</span>
|
|
379
372
|
</auro-input>
|
|
373
|
+
|
|
374
|
+
<auro-header level="4">en-US with `yyyy.mm.dd` format Example</auro-header>
|
|
375
|
+
<auro-input type="date" locale="en-US" format="yyyy.mm.dd">
|
|
376
|
+
<span slot="ariaLabel.clear">Clear All</span>
|
|
377
|
+
<span slot="label">en-US with yyyy.mm.dd format</span>
|
|
378
|
+
<span slot="helpText">Help Text</span>
|
|
380
379
|
</div></code></pre>
|
|
381
380
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
382
381
|
</auro-accordion>
|
|
@@ -1198,7 +1197,7 @@
|
|
|
1198
1197
|
<div class="exampleWrapper">
|
|
1199
1198
|
<!-- AURO-GENERATED-CONTENT:START (FILE:src=../apiExamples/month-day-year.html) -->
|
|
1200
1199
|
<!-- The below content is automatically added from ../apiExamples/month-day-year.html -->
|
|
1201
|
-
<auro-input type="date"
|
|
1200
|
+
<auro-input type="date">
|
|
1202
1201
|
<span slot="label">Arrival date</span>
|
|
1203
1202
|
<span slot="helpText">Help Text</span>
|
|
1204
1203
|
</auro-input>
|
|
@@ -1208,7 +1207,7 @@
|
|
|
1208
1207
|
<span slot="trigger">See code</span>
|
|
1209
1208
|
<!-- AURO-GENERATED-CONTENT:START (CODE:src=../apiExamples/month-day-year.html) -->
|
|
1210
1209
|
<!-- The below code snippet is automatically added from ../apiExamples/month-day-year.html -->
|
|
1211
|
-
<pre class="language-html"><code class="language-html"><auro-input type="date"
|
|
1210
|
+
<pre class="language-html"><code class="language-html"><auro-input type="date">
|
|
1212
1211
|
<span slot="label">Arrival date</span>
|
|
1213
1212
|
<span slot="helpText">Help Text</span>
|
|
1214
1213
|
</auro-input></code></pre>
|
|
@@ -10389,6 +10389,7 @@ class AuroInputUtilities {
|
|
|
10389
10389
|
const maskOptions = this.getMaskOptions('date', normalizedFormat);
|
|
10390
10390
|
|
|
10391
10391
|
if (!(valueObject instanceof Date) || Number.isNaN(valueObject.getTime()) || !maskOptions || typeof maskOptions.format !== 'function') {
|
|
10392
|
+
console.debug('Invalid date object or mask options for formatting', { valueObject, maskOptions }); // eslint-disable-line no-console
|
|
10392
10393
|
return undefined;
|
|
10393
10394
|
}
|
|
10394
10395
|
|
|
@@ -10540,10 +10541,8 @@ class BaseInput extends AuroElement {
|
|
|
10540
10541
|
this.layout = 'classic';
|
|
10541
10542
|
this.locale = 'en-US';
|
|
10542
10543
|
this.max = undefined;
|
|
10543
|
-
this._maxObject = undefined;
|
|
10544
10544
|
this.maxLength = undefined;
|
|
10545
10545
|
this.min = undefined;
|
|
10546
|
-
this._minObject = undefined;
|
|
10547
10546
|
this.minLength = undefined;
|
|
10548
10547
|
this.required = false;
|
|
10549
10548
|
this.onDark = false;
|
|
@@ -10551,7 +10550,6 @@ class BaseInput extends AuroElement {
|
|
|
10551
10550
|
this.size = 'lg';
|
|
10552
10551
|
this.shape = 'classic';
|
|
10553
10552
|
this.value = undefined;
|
|
10554
|
-
this._valueObject = undefined;
|
|
10555
10553
|
|
|
10556
10554
|
this._initializePrivateDefaults();
|
|
10557
10555
|
}
|
|
@@ -11091,7 +11089,7 @@ class BaseInput extends AuroElement {
|
|
|
11091
11089
|
* @returns {Date|undefined}
|
|
11092
11090
|
*/
|
|
11093
11091
|
get valueObject() {
|
|
11094
|
-
return this.
|
|
11092
|
+
return this.value && dateFormatter.isValidDate(this.value) ? dateFormatter.stringToDateInstance(this.value) : undefined;
|
|
11095
11093
|
}
|
|
11096
11094
|
|
|
11097
11095
|
/**
|
|
@@ -11099,7 +11097,7 @@ class BaseInput extends AuroElement {
|
|
|
11099
11097
|
* @returns {Date|undefined}
|
|
11100
11098
|
*/
|
|
11101
11099
|
get minObject() {
|
|
11102
|
-
return this.
|
|
11100
|
+
return this.min && dateFormatter.isValidDate(this.min) ? dateFormatter.stringToDateInstance(this.min) : undefined;
|
|
11103
11101
|
}
|
|
11104
11102
|
|
|
11105
11103
|
/**
|
|
@@ -11107,50 +11105,7 @@ class BaseInput extends AuroElement {
|
|
|
11107
11105
|
* @returns {Date|undefined}
|
|
11108
11106
|
*/
|
|
11109
11107
|
get maxObject() {
|
|
11110
|
-
return this.
|
|
11111
|
-
}
|
|
11112
|
-
|
|
11113
|
-
/**
|
|
11114
|
-
* Parses a date string into a Date object when the corresponding `_*Object`
|
|
11115
|
-
* field hasn't been synced yet by `updated()`. Returns undefined when the
|
|
11116
|
-
* input type/format isn't a full date or the string is not a valid date.
|
|
11117
|
-
*
|
|
11118
|
-
* Why this exists: a parent (datepicker) can call `inputN.validate()` from
|
|
11119
|
-
* inside its own `updated()` before this input's `updated()` has run
|
|
11120
|
-
* `syncDateValues()` — so `_valueObject`/`_maxObject` are still `undefined`
|
|
11121
|
-
* and range checks would otherwise silently no-op (flipping the result to
|
|
11122
|
-
* `valid` or `patternMismatch`).
|
|
11123
|
-
* @private
|
|
11124
|
-
* @param {string|undefined} dateStr - ISO date string from `value`/`min`/`max`.
|
|
11125
|
-
* @returns {Date|undefined}
|
|
11126
|
-
*/
|
|
11127
|
-
_computeDateObjectFallback(dateStr) {
|
|
11128
|
-
if (!dateStr || !this.util || !this.util.isFullDateFormat(this.type, this.format)) {
|
|
11129
|
-
return undefined;
|
|
11130
|
-
}
|
|
11131
|
-
if (!dateFormatter.isValidDate(dateStr)) {
|
|
11132
|
-
return undefined;
|
|
11133
|
-
}
|
|
11134
|
-
return dateFormatter.stringToDateInstance(dateStr);
|
|
11135
|
-
}
|
|
11136
|
-
|
|
11137
|
-
/**
|
|
11138
|
-
* Internal setter for readonly date object properties.
|
|
11139
|
-
* @private
|
|
11140
|
-
* @param {'valueObject'|'minObject'|'maxObject'} propertyName - Public object property name.
|
|
11141
|
-
* @param {Date|undefined} propertyValue - Value to assign.
|
|
11142
|
-
* @returns {void}
|
|
11143
|
-
*/
|
|
11144
|
-
setDateObjectProperty(propertyName, propertyValue) {
|
|
11145
|
-
const internalPropertyName = `_${propertyName}`;
|
|
11146
|
-
const previousValue = this[internalPropertyName];
|
|
11147
|
-
|
|
11148
|
-
if (previousValue === propertyValue) {
|
|
11149
|
-
return;
|
|
11150
|
-
}
|
|
11151
|
-
|
|
11152
|
-
this[internalPropertyName] = propertyValue;
|
|
11153
|
-
this.requestUpdate(propertyName, previousValue);
|
|
11108
|
+
return this.max && dateFormatter.isValidDate(this.max) ? dateFormatter.stringToDateInstance(this.max) : undefined;
|
|
11154
11109
|
}
|
|
11155
11110
|
|
|
11156
11111
|
connectedCallback() {
|
|
@@ -11179,7 +11134,6 @@ class BaseInput extends AuroElement {
|
|
|
11179
11134
|
format: this.format
|
|
11180
11135
|
});
|
|
11181
11136
|
this.configureDataForType();
|
|
11182
|
-
this.syncDateValues();
|
|
11183
11137
|
}
|
|
11184
11138
|
|
|
11185
11139
|
disconnectedCallback() {
|
|
@@ -11199,10 +11153,6 @@ class BaseInput extends AuroElement {
|
|
|
11199
11153
|
this.wrapperElement.addEventListener('click', this.handleClick);
|
|
11200
11154
|
}
|
|
11201
11155
|
|
|
11202
|
-
// add attribute for query selectors when auro-input is registered under a custom name
|
|
11203
|
-
if (this.tagName.toLowerCase() !== 'auro-input' && !this.hasAttribute('auro-input')) {
|
|
11204
|
-
this.setAttribute('auro-input', '');
|
|
11205
|
-
}
|
|
11206
11156
|
this.inputId = this.id ? `${this.id}-input` : window.crypto.randomUUID();
|
|
11207
11157
|
|
|
11208
11158
|
// use validity message override if declared when initializing the component
|
|
@@ -11213,7 +11163,6 @@ class BaseInput extends AuroElement {
|
|
|
11213
11163
|
this.setCustomHelpTextMessage();
|
|
11214
11164
|
this.configureAutoFormatting();
|
|
11215
11165
|
this.configureDataForType();
|
|
11216
|
-
this.syncDateValues();
|
|
11217
11166
|
}
|
|
11218
11167
|
|
|
11219
11168
|
/**
|
|
@@ -11350,8 +11299,6 @@ class BaseInput extends AuroElement {
|
|
|
11350
11299
|
this.configureDataForType();
|
|
11351
11300
|
}
|
|
11352
11301
|
|
|
11353
|
-
this.syncDateValues(changedProperties);
|
|
11354
|
-
|
|
11355
11302
|
if (changedProperties.has('value')) {
|
|
11356
11303
|
if (this.value && this.value.length > 0) {
|
|
11357
11304
|
this.hasValue = true;
|
|
@@ -11373,14 +11320,14 @@ class BaseInput extends AuroElement {
|
|
|
11373
11320
|
|
|
11374
11321
|
if (formattedValue !== this.inputElement.value) {
|
|
11375
11322
|
this.skipNextProgrammaticInputEvent = true;
|
|
11376
|
-
if (this.maskInstance && this.type
|
|
11323
|
+
if (this.maskInstance && this.type !== 'date') {
|
|
11377
11324
|
// Route through the mask so its _value and el.value stay in lock-step
|
|
11378
11325
|
// (set value calls updateControl which writes el.value = displayValue).
|
|
11379
11326
|
// Writing el.value directly leaves the mask thinking displayValue is
|
|
11380
|
-
// stale; _saveSelection on the next focus/click then warns.
|
|
11381
|
-
//
|
|
11382
|
-
//
|
|
11383
|
-
//
|
|
11327
|
+
// stale; _saveSelection on the next focus/click then warns. Date is
|
|
11328
|
+
// excluded because its formattedValue can be raw ISO when the calendar
|
|
11329
|
+
// is invalid, and re-masking through mm/dd/yyyy would truncate it and
|
|
11330
|
+
// flip validity from patternMismatch to tooShort.
|
|
11384
11331
|
this.maskInstance.value = formattedValue || '';
|
|
11385
11332
|
} else if (formattedValue) {
|
|
11386
11333
|
this.inputElement.value = formattedValue;
|
|
@@ -11422,120 +11369,60 @@ class BaseInput extends AuroElement {
|
|
|
11422
11369
|
}));
|
|
11423
11370
|
}
|
|
11424
11371
|
|
|
11425
|
-
|
|
11426
|
-
/**
|
|
11427
|
-
* Synchronizes the ISO string values and Date object representations for date-related properties.
|
|
11428
|
-
* This keeps the model and display values aligned when either side changes.
|
|
11429
|
-
*
|
|
11430
|
-
* When a full date format is in use, this method updates `value`, `min`, and `max` from their corresponding
|
|
11431
|
-
* Date objects or vice versa, based on which properties have changed. It only runs when the current configuration
|
|
11432
|
-
* represents a full year/month/day date format.
|
|
11433
|
-
*
|
|
11434
|
-
* @param {Map<string, unknown>|undefined} [changedProperties=undefined] - Optional map of changed properties used to limit which values are synchronized.
|
|
11435
|
-
* @returns {void}
|
|
11436
|
-
* @private
|
|
11437
|
-
*/
|
|
11438
|
-
syncDateValues(changedProperties = undefined) {
|
|
11439
|
-
if (!this.util.isFullDateFormat(this.type, this.format)) {
|
|
11440
|
-
return;
|
|
11441
|
-
}
|
|
11442
|
-
|
|
11443
|
-
this.syncSingleDateValue(changedProperties, 'valueObject', 'value');
|
|
11444
|
-
this.syncSingleDateValue(changedProperties, 'minObject', 'min');
|
|
11445
|
-
this.syncSingleDateValue(changedProperties, 'maxObject', 'max');
|
|
11446
|
-
}
|
|
11447
|
-
|
|
11448
|
-
/**
|
|
11449
|
-
* Synchronizes one date object/string property pair.
|
|
11450
|
-
* @private
|
|
11451
|
-
* @param {Map<string, unknown>|undefined} changedProperties - Map of changed properties from Lit.
|
|
11452
|
-
* @param {string} objectProperty - Date object property name.
|
|
11453
|
-
* @param {string} valueProperty - ISO string property name.
|
|
11454
|
-
* @returns {void}
|
|
11455
|
-
*/
|
|
11456
|
-
syncSingleDateValue(changedProperties, objectProperty, valueProperty) {
|
|
11457
|
-
const objectPropertyChanged = !changedProperties || changedProperties.has(objectProperty);
|
|
11458
|
-
|
|
11459
|
-
// objectProperty wins over valueProperty when both changed
|
|
11460
|
-
if (objectPropertyChanged && this[objectProperty]) {
|
|
11461
|
-
this[valueProperty] = dateFormatter.toISOFormatString(this[objectProperty]);
|
|
11462
|
-
return;
|
|
11463
|
-
}
|
|
11464
|
-
|
|
11465
|
-
const valuePropertyChanged = !changedProperties || changedProperties.has(valueProperty);
|
|
11466
|
-
if (!valuePropertyChanged) {
|
|
11467
|
-
return;
|
|
11468
|
-
}
|
|
11469
|
-
|
|
11470
|
-
// 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)
|
|
11471
|
-
if (
|
|
11472
|
-
changedProperties &&
|
|
11473
|
-
valueProperty === 'value' &&
|
|
11474
|
-
changedProperties.get('value') === undefined &&
|
|
11475
|
-
this[objectProperty] instanceof Date &&
|
|
11476
|
-
this[valueProperty] === dateFormatter.toISOFormatString(this[objectProperty])
|
|
11477
|
-
) {
|
|
11478
|
-
return;
|
|
11479
|
-
}
|
|
11480
|
-
|
|
11481
|
-
if (dateFormatter.isValidDate(this[valueProperty])) {
|
|
11482
|
-
this.setDateObjectProperty(objectProperty, dateFormatter.stringToDateInstance(this[valueProperty]));
|
|
11483
|
-
} else {
|
|
11484
|
-
this.setDateObjectProperty(objectProperty, undefined);
|
|
11485
|
-
}
|
|
11486
|
-
}
|
|
11487
|
-
|
|
11488
11372
|
/**
|
|
11489
11373
|
* Sets up IMasks and logic based on auto-formatting requirements.
|
|
11490
11374
|
* @private
|
|
11491
11375
|
* @returns {void}
|
|
11492
11376
|
*/
|
|
11493
11377
|
configureAutoFormatting() {
|
|
11494
|
-
//
|
|
11495
|
-
//
|
|
11496
|
-
//
|
|
11497
|
-
//
|
|
11378
|
+
// _configuringMask gates two things: external re-entry into this method
|
|
11379
|
+
// while setup is mid-flight (from property changes that call back here),
|
|
11380
|
+
// and the accept/complete listeners below — both need to ignore the mask
|
|
11381
|
+
// events fired by our own value-restore step.
|
|
11498
11382
|
if (this._configuringMask) return;
|
|
11499
11383
|
this._configuringMask = true;
|
|
11500
11384
|
try {
|
|
11385
|
+
// Destroy any prior mask so IMask can attach fresh under the new format.
|
|
11501
11386
|
if (this.maskInstance) {
|
|
11502
11387
|
this.maskInstance.destroy();
|
|
11503
11388
|
}
|
|
11504
11389
|
|
|
11505
|
-
// Pass new format to util
|
|
11506
11390
|
this.util.updateFormat(this.format);
|
|
11507
11391
|
|
|
11508
11392
|
const maskOptions = this.util.getMaskOptions(this.type, this.format);
|
|
11509
11393
|
|
|
11510
11394
|
if (this.inputElement && maskOptions.mask) {
|
|
11511
|
-
|
|
11512
|
-
//
|
|
11513
|
-
//
|
|
11514
|
-
//
|
|
11515
|
-
// When the format changes (e.g. locale switch) and we have a valid ISO
|
|
11516
|
-
// model value, compute the display string for the NEW format instead of
|
|
11517
|
-
// re-using the old display string, which may be invalid in the new mask.
|
|
11395
|
+
// Capture the current display so it can be re-applied after IMask
|
|
11396
|
+
// attaches. The restore at the bottom goes through maskInstance.value
|
|
11397
|
+
// (not inputElement.value directly) so the mask's internal state and
|
|
11398
|
+
// the input's displayed text stay in lock-step.
|
|
11518
11399
|
let existingValue = this.inputElement.value;
|
|
11400
|
+
|
|
11401
|
+
// Format-change case (e.g. locale switch): existingValue is the OLD
|
|
11402
|
+
// mask's display string and may not parse under the new mask. When
|
|
11403
|
+
// we have a valid date model, rebuild the display from valueObject
|
|
11404
|
+
// (the canonical source) using the new mask's format function.
|
|
11519
11405
|
if (
|
|
11520
11406
|
this.util.isFullDateFormat(this.type, this.format) &&
|
|
11521
11407
|
this.value &&
|
|
11522
|
-
|
|
11523
|
-
this.valueObject instanceof Date &&
|
|
11524
|
-
!Number.isNaN(this.valueObject.getTime()) &&
|
|
11408
|
+
this.valueObject &&
|
|
11525
11409
|
typeof maskOptions.format === 'function'
|
|
11526
11410
|
) {
|
|
11527
11411
|
existingValue = maskOptions.format(this.valueObject);
|
|
11528
11412
|
}
|
|
11529
11413
|
|
|
11414
|
+
// Clear before IMask attaches so the constructor seeds an empty
|
|
11415
|
+
// internal value. Otherwise IMask reads the stale unmasked string
|
|
11416
|
+
// and emits a spurious 'accept' before the restore below runs.
|
|
11530
11417
|
this.skipNextProgrammaticInputEvent = true;
|
|
11531
11418
|
this.inputElement.value = '';
|
|
11532
11419
|
|
|
11533
11420
|
this.maskInstance = IMask(this.inputElement, maskOptions);
|
|
11534
11421
|
|
|
11422
|
+
// Mask fires 'accept' on every value change, including the restore
|
|
11423
|
+
// step below. Skip events fired during configureAutoFormatting so
|
|
11424
|
+
// we don't overwrite a value the parent just pushed.
|
|
11535
11425
|
this.maskInstance.on('accept', () => {
|
|
11536
|
-
// Suppress propagation during configureAutoFormatting's own value-restoration
|
|
11537
|
-
// (line below) — the mask emits 'accept' on every value-set, including ours,
|
|
11538
|
-
// and we don't want to overwrite a value the parent just pushed.
|
|
11539
11426
|
if (this._configuringMask) return;
|
|
11540
11427
|
this.value = this.util.toModelValue(this.maskInstance.value, this.format);
|
|
11541
11428
|
if (this.type === "date") {
|
|
@@ -11543,6 +11430,8 @@ class BaseInput extends AuroElement {
|
|
|
11543
11430
|
}
|
|
11544
11431
|
});
|
|
11545
11432
|
|
|
11433
|
+
// Mask fires 'complete' on the restore step below for any value that
|
|
11434
|
+
// happens to be a complete match. Same setup-suppression as 'accept'.
|
|
11546
11435
|
this.maskInstance.on('complete', () => {
|
|
11547
11436
|
if (this._configuringMask) return;
|
|
11548
11437
|
this.value = this.util.toModelValue(this.maskInstance.value, this.format);
|
|
@@ -11551,7 +11440,9 @@ class BaseInput extends AuroElement {
|
|
|
11551
11440
|
}
|
|
11552
11441
|
});
|
|
11553
11442
|
|
|
11554
|
-
//
|
|
11443
|
+
// Write existingValue through the mask (not the input directly) so
|
|
11444
|
+
// the mask reformats it under the new rules and keeps its internal
|
|
11445
|
+
// _value aligned with the input's displayed text.
|
|
11555
11446
|
if (existingValue) {
|
|
11556
11447
|
this.maskInstance.value = existingValue;
|
|
11557
11448
|
}
|
|
@@ -11719,7 +11610,6 @@ class BaseInput extends AuroElement {
|
|
|
11719
11610
|
*/
|
|
11720
11611
|
reset() {
|
|
11721
11612
|
this.value = undefined;
|
|
11722
|
-
this.setDateObjectProperty('valueObject', undefined);
|
|
11723
11613
|
this.validation.reset(this);
|
|
11724
11614
|
}
|
|
11725
11615
|
|
|
@@ -11728,7 +11618,6 @@ class BaseInput extends AuroElement {
|
|
|
11728
11618
|
*/
|
|
11729
11619
|
clear() {
|
|
11730
11620
|
this.value = undefined;
|
|
11731
|
-
this.setDateObjectProperty('valueObject', undefined);
|
|
11732
11621
|
}
|
|
11733
11622
|
|
|
11734
11623
|
/**
|
|
@@ -12257,7 +12146,7 @@ class AuroHelpText extends i$3 {
|
|
|
12257
12146
|
}
|
|
12258
12147
|
}
|
|
12259
12148
|
|
|
12260
|
-
var formkitVersion = '
|
|
12149
|
+
var formkitVersion = '202606192004';
|
|
12261
12150
|
|
|
12262
12151
|
/**
|
|
12263
12152
|
* @license
|