@mgdis/mg-components 6.17.0 → 6.18.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-DCZEYvlH.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_37.cjs.entry.js +411 -168
- package/dist/cjs/mg-alert.cjs.entry.js +1 -1
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
- package/dist/cjs/mg-input-combobox.cjs.entry.js +71 -55
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +33 -20
- package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-HYIzRsy7.js} +5 -0
- package/dist/cjs/mg-loader.cjs.entry.js +1 -1
- package/dist/cjs/mg-progress.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +178 -18
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +36 -16
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +78 -55
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +41 -22
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +32 -12
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +30 -12
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +31 -12
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +40 -20
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +31 -12
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +44 -25
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +31 -13
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +36 -11
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +5 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +13 -4
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +40 -9
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-alert.js +1 -1
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-fieldset.d.ts +11 -0
- package/dist/components/mg-fieldset.js +209 -0
- package/dist/components/mg-form.js +4 -3
- package/dist/components/mg-illustrated-message.js +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +1 -1
- package/dist/components/mg-input-checkbox.js +28 -15
- package/dist/components/mg-input-combobox.js +71 -55
- package/dist/components/mg-input-date.js +33 -21
- package/dist/components/mg-input-numeric.js +24 -11
- package/dist/components/mg-input-password.js +22 -11
- package/dist/components/mg-input-radio.js +23 -11
- package/dist/components/mg-input-rich-text-editor.js +32 -19
- package/dist/components/mg-input-select2.js +24 -12
- package/dist/components/mg-input-text2.js +36 -24
- package/dist/components/mg-input-textarea.js +23 -12
- package/dist/components/mg-input-toggle.js +35 -10
- package/dist/components/mg-input2.js +117 -18
- package/dist/components/mg-item-more2.js +5 -1
- package/dist/components/mg-loader2.js +1 -1
- package/dist/components/mg-message2.js +2 -2
- package/dist/components/mg-modal.js +2 -2
- package/dist/components/mg-panel.js +36 -7
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-popover2.js +1 -1
- package/dist/components/mg-progress.js +1 -1
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs2.js +1 -1
- package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
- package/dist/esm/index-T6kOJXP1.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_37.entry.js +412 -169
- package/dist/esm/mg-alert.entry.js +2 -2
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-fieldset.entry.js +139 -0
- package/dist/esm/mg-input-combobox.entry.js +72 -56
- package/dist/esm/mg-input-rich-text-editor.entry.js +34 -21
- package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-D9V2v4n2.js} +5 -1
- package/dist/esm/mg-loader.entry.js +2 -2
- package/dist/esm/mg-progress.entry.js +2 -2
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-2bab89c2.entry.js +1 -0
- package/dist/mg-components/{p-0e6b40d6.entry.js → p-5abc77cd.entry.js} +1 -1
- package/dist/mg-components/p-7d2e43b2.entry.js +1 -0
- package/dist/mg-components/{p-5dc3a1fb.entry.js → p-92e5e5a6.entry.js} +1 -1
- package/dist/mg-components/{p-c5da335e.entry.js → p-952288bd.entry.js} +1 -1
- package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
- package/dist/mg-components/p-D9V2v4n2.js +1 -0
- package/dist/mg-components/p-f2cddd52.entry.js +1 -0
- package/dist/mg-components/{p-397bf67b.entry.js → p-f6afaeb8.entry.js} +1 -1
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
- package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
- package/dist/types/components.d.ts +168 -18
- package/ide/intellij/web-types.json +272 -9
- package/ide/vscode/html-custom-data.json +243 -5
- package/package.json +15 -15
- package/dist/mg-components/p-8a69175b.entry.js +0 -1
- package/dist/mg-components/p-CNgv8hc5.js +0 -1
- package/dist/mg-components/p-d84d87ea.entry.js +0 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { P as Paginate, C as ClassList, f as formatID, e as Cursor, n as nextTick, h as Page, j as getObjectValueFromKey,
|
|
2
|
+
import { P as Paginate, C as ClassList, f as formatID, e as Cursor, t as toString, n as nextTick, h as Page, j as getObjectValueFromKey, d as allItemsAreString, i as isValidString, k as isObject } from './index2.js';
|
|
3
3
|
import { d as defineCustomElement$8, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index3.js';
|
|
5
5
|
import { K as Keys } from './events.utils.js';
|
|
@@ -70,6 +70,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
70
70
|
this.classFocus = 'mg-u-is-focused';
|
|
71
71
|
// hasDisplayedError (triggered by blur event)
|
|
72
72
|
this.hasDisplayedError = false;
|
|
73
|
+
this.customErrorMessage = { lock: false };
|
|
73
74
|
/**
|
|
74
75
|
* Input name
|
|
75
76
|
* If not set the value equals the identifier
|
|
@@ -204,7 +205,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
204
205
|
// override keys actions
|
|
205
206
|
switch (event.key) {
|
|
206
207
|
case Keys.TAB:
|
|
207
|
-
case Keys.ENTER:
|
|
208
|
+
case Keys.ENTER: {
|
|
208
209
|
guard = event.key === Keys.ENTER;
|
|
209
210
|
const option = (_a = this.option) !== null && _a !== void 0 ? _a : this.options.items.find(this.isCurrentOption);
|
|
210
211
|
// Sets the value to the content of the focused option in the listbox.
|
|
@@ -214,12 +215,13 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
214
215
|
// Closes the popover.
|
|
215
216
|
this.popoverDisplay = false;
|
|
216
217
|
break;
|
|
218
|
+
}
|
|
217
219
|
case Keys.DOWN:
|
|
218
220
|
case Keys.ARROWDOWN:
|
|
219
221
|
case Keys.UP:
|
|
220
|
-
case Keys.ARROWUP:
|
|
222
|
+
case Keys.ARROWUP: {
|
|
221
223
|
guard = true;
|
|
222
|
-
if (this.isLoading ||
|
|
224
|
+
if (this.isLoading || this.page.total === 0) {
|
|
223
225
|
this.popoverDisplay = true;
|
|
224
226
|
break;
|
|
225
227
|
}
|
|
@@ -250,12 +252,13 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
250
252
|
// open popover
|
|
251
253
|
this.popoverDisplay = true;
|
|
252
254
|
break;
|
|
255
|
+
}
|
|
253
256
|
case Keys.LEFT:
|
|
254
257
|
case Keys.ARROWLEFT:
|
|
255
258
|
case Keys.HOME:
|
|
256
259
|
case Keys.RIGHT:
|
|
257
260
|
case Keys.ARROWRIGHT:
|
|
258
|
-
case Keys.END:
|
|
261
|
+
case Keys.END: {
|
|
259
262
|
// skip process if visual focus is not in popover
|
|
260
263
|
if (!isItem(this.option))
|
|
261
264
|
break;
|
|
@@ -275,8 +278,9 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
275
278
|
this.input.setSelectionRange(index, index);
|
|
276
279
|
}
|
|
277
280
|
break;
|
|
281
|
+
}
|
|
278
282
|
case Keys.ESC:
|
|
279
|
-
case Keys.ESCAPE:
|
|
283
|
+
case Keys.ESCAPE: {
|
|
280
284
|
guard = true;
|
|
281
285
|
if (this.popoverDisplay) {
|
|
282
286
|
// If the popover is displayed, closes it.
|
|
@@ -290,10 +294,12 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
290
294
|
this.option = null;
|
|
291
295
|
}
|
|
292
296
|
break;
|
|
293
|
-
|
|
297
|
+
}
|
|
298
|
+
default: {
|
|
294
299
|
// Remove visual focus from popover options
|
|
295
300
|
this.option = null;
|
|
296
301
|
break;
|
|
302
|
+
}
|
|
297
303
|
}
|
|
298
304
|
if (guard) {
|
|
299
305
|
event.stopPropagation();
|
|
@@ -339,18 +345,20 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
339
345
|
};
|
|
340
346
|
/**
|
|
341
347
|
* Set input error message
|
|
342
|
-
* @param
|
|
348
|
+
* @param fromSetErrorContext - context come from `setError` method
|
|
343
349
|
*/
|
|
344
|
-
this.setErrorMessage = (
|
|
350
|
+
this.setErrorMessage = (fromSetErrorContext = false) => {
|
|
345
351
|
// Set error message
|
|
346
352
|
this.errorMessage = undefined;
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
this.
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
353
|
+
if (!this.valid) {
|
|
354
|
+
// Does have a new custom error message OR does have a custom error message locked
|
|
355
|
+
if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
|
|
356
|
+
this.errorMessage = this.customErrorMessage.message;
|
|
357
|
+
}
|
|
358
|
+
// required
|
|
359
|
+
else if (this.input.validity.valueMissing) {
|
|
360
|
+
this.errorMessage = this.messages.errors.required;
|
|
361
|
+
}
|
|
354
362
|
}
|
|
355
363
|
};
|
|
356
364
|
/**
|
|
@@ -364,15 +372,14 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
364
372
|
* @returns promisified action
|
|
365
373
|
*/
|
|
366
374
|
this.loadingWrapper = (action) => {
|
|
375
|
+
var _a;
|
|
367
376
|
let promise;
|
|
368
377
|
let index;
|
|
369
378
|
// cache initial loading action if not defined
|
|
370
|
-
|
|
371
|
-
this.loadingAction = action.name;
|
|
372
|
-
}
|
|
379
|
+
(_a = this.loadingAction) !== null && _a !== void 0 ? _a : (this.loadingAction = action.name);
|
|
373
380
|
// update index
|
|
374
381
|
if (Boolean(this.option) && this.loadingAction !== 'load-more') {
|
|
375
|
-
index = this.page.items.findIndex(option => option.value
|
|
382
|
+
index = this.page.items.findIndex(option => toString(option.value) === toString(this.option.value));
|
|
376
383
|
}
|
|
377
384
|
else if (this.loadingAction === 'load-more') {
|
|
378
385
|
index = this.page.items.length - this.page.baseIndex;
|
|
@@ -425,14 +432,14 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
425
432
|
*/
|
|
426
433
|
this.goToNextPage = () => {
|
|
427
434
|
this.showMore.emit();
|
|
428
|
-
if (
|
|
435
|
+
if (this.fetchurl !== undefined) {
|
|
429
436
|
return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {
|
|
430
|
-
if (
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
437
|
+
if (nextPage !== undefined) {
|
|
438
|
+
// merge items from current page and next page
|
|
439
|
+
const items = [...this.page.items, ...nextPage.items];
|
|
440
|
+
// create new options pagination withe merged items
|
|
441
|
+
this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });
|
|
442
|
+
}
|
|
436
443
|
});
|
|
437
444
|
}
|
|
438
445
|
else {
|
|
@@ -449,12 +456,12 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
449
456
|
* @returns promise
|
|
450
457
|
*/
|
|
451
458
|
this.updatePage = async () => {
|
|
452
|
-
if (
|
|
459
|
+
if (this.fetchurl !== undefined) {
|
|
453
460
|
return this.getOptions().then(page => {
|
|
454
|
-
if (
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
461
|
+
if (page !== undefined) {
|
|
462
|
+
// reset current options pagination from API response
|
|
463
|
+
this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });
|
|
464
|
+
}
|
|
458
465
|
});
|
|
459
466
|
}
|
|
460
467
|
else {
|
|
@@ -500,11 +507,11 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
500
507
|
this.valueChange.emit(newValue);
|
|
501
508
|
}
|
|
502
509
|
watchItems(newValue) {
|
|
503
|
-
if (
|
|
510
|
+
if (this.fetchurl !== undefined && newValue === undefined) {
|
|
504
511
|
// skip newValue check
|
|
505
512
|
return;
|
|
506
513
|
}
|
|
507
|
-
else if (
|
|
514
|
+
else if (this.fetchurl !== undefined && newValue !== undefined) {
|
|
508
515
|
throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${toString(newValue)}.`);
|
|
509
516
|
}
|
|
510
517
|
// Empty options
|
|
@@ -524,7 +531,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
524
531
|
}
|
|
525
532
|
}
|
|
526
533
|
watchIdentifier(newValue) {
|
|
527
|
-
if (
|
|
534
|
+
if (isValidString(newValue)) {
|
|
528
535
|
this.popoverId = `${newValue}-popover`;
|
|
529
536
|
this.element.dataset.mgPopoverGuard = this.popoverId;
|
|
530
537
|
}
|
|
@@ -564,7 +571,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
564
571
|
this.classCollection = new ClassList(this.classCollection.classes);
|
|
565
572
|
}
|
|
566
573
|
watchFetchUrl(newValue) {
|
|
567
|
-
if (
|
|
574
|
+
if (newValue !== undefined) {
|
|
568
575
|
this.loadingWrapper({ name: 'load-data' });
|
|
569
576
|
}
|
|
570
577
|
}
|
|
@@ -572,20 +579,17 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
572
579
|
if (this.fetchurl && newValue && !isObject(newValue)) {
|
|
573
580
|
throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${toString(newValue)}.`);
|
|
574
581
|
}
|
|
575
|
-
else {
|
|
576
|
-
new Request(this.fetchurl, newValue);
|
|
577
|
-
}
|
|
578
582
|
}
|
|
579
583
|
watchFetchMappings(newValue) {
|
|
580
|
-
if (
|
|
584
|
+
if (this.fetchurl !== undefined && !isObject(newValue)) {
|
|
581
585
|
throw new Error(`<mg-input-combobox> prop "fetchmappings" is required with "fetchurl" prop.`);
|
|
582
586
|
}
|
|
583
|
-
else if (
|
|
587
|
+
else if (newValue !== undefined && !isFetchmappings(newValue)) {
|
|
584
588
|
throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${toString(newValue)}.`);
|
|
585
589
|
}
|
|
586
590
|
}
|
|
587
591
|
watchOptions(newValue) {
|
|
588
|
-
this.page = newValue.getPage(0,
|
|
592
|
+
this.page = newValue.getPage(0, this.filter.length > 0 ? this.optionsFilter : undefined);
|
|
589
593
|
}
|
|
590
594
|
watchFilter(newValue) {
|
|
591
595
|
this.loadingWrapper({ name: 'load-data' });
|
|
@@ -642,17 +646,22 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
642
646
|
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
643
647
|
* @param valid - value indicating the validity
|
|
644
648
|
* @param errorMessage - the error message to display
|
|
649
|
+
* @param errorMessageLock - lock the error message and validity state
|
|
645
650
|
*/
|
|
646
|
-
async setError(valid, errorMessage) {
|
|
651
|
+
async setError(valid, errorMessage, errorMessageLock = false) {
|
|
647
652
|
if (typeof valid !== 'boolean') {
|
|
648
653
|
throw new Error('<mg-input-combobox> method "setError()" param "valid" must be a boolean.');
|
|
649
654
|
}
|
|
650
|
-
else if (!isValidString(errorMessage)) {
|
|
655
|
+
else if (errorMessage !== undefined && !isValidString(errorMessage)) {
|
|
651
656
|
throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');
|
|
652
657
|
}
|
|
653
658
|
else {
|
|
659
|
+
this.customErrorMessage = {
|
|
660
|
+
lock: valid ? false : errorMessageLock,
|
|
661
|
+
message: valid ? undefined : errorMessage,
|
|
662
|
+
};
|
|
654
663
|
this.setValidity(valid);
|
|
655
|
-
this.setErrorMessage(
|
|
664
|
+
this.setErrorMessage(true);
|
|
656
665
|
this.hasDisplayedError = this.invalid;
|
|
657
666
|
}
|
|
658
667
|
}
|
|
@@ -672,6 +681,8 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
672
681
|
// - Keep everything in sync both inside and outside the component
|
|
673
682
|
return new Promise(resolve => {
|
|
674
683
|
requestAnimationFrame(() => {
|
|
684
|
+
// unlock validity check by reseting customErrorMessage
|
|
685
|
+
this.customErrorMessage = { lock: false };
|
|
675
686
|
this.checkValidity();
|
|
676
687
|
this.errorMessage = undefined;
|
|
677
688
|
this.hasDisplayedError = false;
|
|
@@ -700,11 +711,13 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
700
711
|
* @param newValue - valid new value
|
|
701
712
|
*/
|
|
702
713
|
setValidity(newValue) {
|
|
703
|
-
const
|
|
704
|
-
this.
|
|
714
|
+
const oldValue = this.valid;
|
|
715
|
+
if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
|
|
716
|
+
this.valid = newValue;
|
|
717
|
+
}
|
|
705
718
|
this.invalid = !this.valid;
|
|
706
719
|
// We need to send valid event even if it is the same value
|
|
707
|
-
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !==
|
|
720
|
+
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
|
|
708
721
|
this.inputValid.emit(this.valid);
|
|
709
722
|
}
|
|
710
723
|
/*************
|
|
@@ -720,7 +733,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
720
733
|
// Validate
|
|
721
734
|
this.watchIdentifier(this.identifier);
|
|
722
735
|
this.watchItems(this.items);
|
|
723
|
-
if (
|
|
736
|
+
if (this.fetchurl !== undefined) {
|
|
724
737
|
this.watchFetchOptions(this.fetchoptions);
|
|
725
738
|
this.watchFetchMappings(this.fetchmappings);
|
|
726
739
|
this.loadingWrapper({ name: 'load-data' });
|
|
@@ -747,14 +760,17 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
747
760
|
const readonlyValue = this.getValueTitle();
|
|
748
761
|
const withResetButton = this.value && !this.disabled;
|
|
749
762
|
let popoverContent;
|
|
750
|
-
if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0)
|
|
763
|
+
if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0) {
|
|
751
764
|
popoverContent = 'list';
|
|
752
|
-
|
|
765
|
+
}
|
|
766
|
+
else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && this.filter.length > 0) {
|
|
753
767
|
popoverContent = 'notfound';
|
|
754
|
-
|
|
768
|
+
}
|
|
769
|
+
else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0) {
|
|
755
770
|
popoverContent = 'notavailable';
|
|
771
|
+
}
|
|
756
772
|
let activeDescendant;
|
|
757
|
-
if (
|
|
773
|
+
if (((_d = this.option) === null || _d === void 0 ? void 0 : _d.value) !== undefined) {
|
|
758
774
|
activeDescendant = this.option.value;
|
|
759
775
|
}
|
|
760
776
|
else if (typeof this.value === 'string') {
|
|
@@ -763,8 +779,8 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
763
779
|
else {
|
|
764
780
|
activeDescendant = (_e = this.value) === null || _e === void 0 ? void 0 : _e.value;
|
|
765
781
|
}
|
|
766
|
-
return (h("mg-input", { key: '
|
|
767
|
-
'--mg-c-input-list-width':
|
|
782
|
+
return (h("mg-input", { key: 'bebf380dbdea1a9f9e0257a9425dcb6cd94a7a52', label: this.label, identifier: this.identifier, class: this.classCollection.classes.join(' '), ariaDescribedbyIDs: popoverContent && popoverContent !== 'list' ? popoverContent : undefined, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("mg-popover", { identifier: this.popoverId, placement: "bottom-start", display: this.popoverDisplay, "arrow-hide": true, style: {
|
|
783
|
+
'--mg-c-input-list-width': ((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) > 0 ? `${this.input.offsetWidth}px` : undefined,
|
|
768
784
|
}, "data-fallback-placement": "bottom-end", "onDisplay-change": this.handlePopoverDisplay }, h("div", { class: "mg-c-input__input-group-container" }, h("mg-icon", { icon: "magnifying-glass" }), h("input", { type: "text", role: "combobox", class: "mg-c-input__box mg-c-input__box--width", value: this.filter, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, autocomplete: "off", "aria-autocomplete": "list", "aria-expanded": this.popoverDisplay.toString(), "aria-controls": listId, "aria-invalid": (this.invalid === true).toString(), "aria-activedescendant": formatID(activeDescendant), onInput: this.handleFilterInput, onBlur: this.handleFilterBlur, onFocus: this.handleFilterFocus, onKeyDown: this.handleFilterKeydown, ref: (el) => {
|
|
769
785
|
if (el !== null)
|
|
770
786
|
this.input = el;
|
|
@@ -22,6 +22,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
22
22
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
23
23
|
// hasDisplayedError (triggered by blur event)
|
|
24
24
|
this.hasDisplayedError = false;
|
|
25
|
+
this.customErrorMessage = { lock: false };
|
|
25
26
|
/**
|
|
26
27
|
* Input name
|
|
27
28
|
* If not set the value equals the identifier
|
|
@@ -134,39 +135,41 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
134
135
|
*/
|
|
135
136
|
this.getInputError = () => {
|
|
136
137
|
var _a;
|
|
138
|
+
let error;
|
|
137
139
|
// bad input or pattern
|
|
138
140
|
if (this.input.validity.badInput || (this.value && !this.isValidPattern(this.value))) {
|
|
139
|
-
|
|
141
|
+
error = 'badInput';
|
|
140
142
|
}
|
|
141
143
|
// required
|
|
142
|
-
if (this.input.validity.valueMissing) {
|
|
143
|
-
|
|
144
|
+
else if (this.input.validity.valueMissing) {
|
|
145
|
+
error = 'required';
|
|
144
146
|
}
|
|
145
147
|
// min & max
|
|
146
|
-
if ((this.input.validity.rangeUnderflow || this.input.validity.rangeOverflow) && ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.max !== DEFAULT_MAX_DATE) {
|
|
147
|
-
|
|
148
|
+
else if ((this.input.validity.rangeUnderflow || this.input.validity.rangeOverflow) && ((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.max !== DEFAULT_MAX_DATE) {
|
|
149
|
+
error = 'minMax';
|
|
148
150
|
}
|
|
149
151
|
// min
|
|
150
|
-
if (this.input.validity.rangeUnderflow) {
|
|
151
|
-
|
|
152
|
+
else if (this.input.validity.rangeUnderflow) {
|
|
153
|
+
error = 'min';
|
|
152
154
|
}
|
|
153
155
|
// max
|
|
154
|
-
if (this.input.validity.rangeOverflow) {
|
|
155
|
-
|
|
156
|
+
else if (this.input.validity.rangeOverflow) {
|
|
157
|
+
error = 'max';
|
|
156
158
|
}
|
|
157
|
-
return
|
|
159
|
+
return error;
|
|
158
160
|
};
|
|
159
161
|
/**
|
|
160
162
|
* Check input errors
|
|
161
|
-
* @param
|
|
163
|
+
* @param fromSetErrorContext - context come from `setError` method
|
|
162
164
|
*/
|
|
163
|
-
this.setErrorMessage = (
|
|
165
|
+
this.setErrorMessage = (fromSetErrorContext = false) => {
|
|
164
166
|
// Set error message
|
|
165
167
|
this.errorMessage = undefined;
|
|
166
168
|
if (!this.valid) {
|
|
167
169
|
const inputError = this.getInputError();
|
|
168
|
-
|
|
169
|
-
|
|
170
|
+
// Does have a new custom error message OR does have a custom error message locked
|
|
171
|
+
if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
|
|
172
|
+
this.errorMessage = this.customErrorMessage.message;
|
|
170
173
|
}
|
|
171
174
|
// required
|
|
172
175
|
else if (inputError === 'required') {
|
|
@@ -278,17 +281,22 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
278
281
|
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
279
282
|
* @param valid - value indicating the validity
|
|
280
283
|
* @param errorMessage - the error message to display
|
|
284
|
+
* @param errorMessageLock - lock the error message and validity state
|
|
281
285
|
*/
|
|
282
|
-
async setError(valid, errorMessage) {
|
|
286
|
+
async setError(valid, errorMessage, errorMessageLock = false) {
|
|
283
287
|
if (typeof valid !== 'boolean') {
|
|
284
288
|
throw new Error('<mg-input-date> method "setError()" param "valid" must be a boolean.');
|
|
285
289
|
}
|
|
286
|
-
else if (!isValidString(errorMessage)) {
|
|
290
|
+
else if (errorMessage !== undefined && !isValidString(errorMessage)) {
|
|
287
291
|
throw new Error('<mg-input-date> method "setError()" param "errorMessage" must be a string.');
|
|
288
292
|
}
|
|
289
293
|
else {
|
|
294
|
+
this.customErrorMessage = {
|
|
295
|
+
lock: valid ? false : errorMessageLock,
|
|
296
|
+
message: valid ? undefined : errorMessage,
|
|
297
|
+
};
|
|
290
298
|
this.setValidity(valid);
|
|
291
|
-
this.setErrorMessage(
|
|
299
|
+
this.setErrorMessage(true);
|
|
292
300
|
this.hasDisplayedError = this.invalid;
|
|
293
301
|
}
|
|
294
302
|
}
|
|
@@ -306,6 +314,8 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
306
314
|
// - Keep everything in sync both inside and outside the component
|
|
307
315
|
return new Promise(resolve => {
|
|
308
316
|
requestAnimationFrame(() => {
|
|
317
|
+
// unlock validity check by reseting customErrorMessage
|
|
318
|
+
this.customErrorMessage = { lock: false };
|
|
309
319
|
this.checkValidity();
|
|
310
320
|
this.errorMessage = undefined;
|
|
311
321
|
this.hasDisplayedError = false;
|
|
@@ -319,11 +329,13 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
319
329
|
* @param newValue - valid new value
|
|
320
330
|
*/
|
|
321
331
|
setValidity(newValue) {
|
|
322
|
-
const
|
|
323
|
-
this.
|
|
332
|
+
const oldValue = this.valid;
|
|
333
|
+
if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
|
|
334
|
+
this.valid = newValue;
|
|
335
|
+
}
|
|
324
336
|
this.invalid = !this.valid;
|
|
325
337
|
// We need to send valid event even if it is the same value
|
|
326
|
-
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !==
|
|
338
|
+
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
|
|
327
339
|
this.inputValid.emit(this.valid);
|
|
328
340
|
}
|
|
329
341
|
/*************
|
|
@@ -359,7 +371,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
359
371
|
* @returns HTML Element
|
|
360
372
|
*/
|
|
361
373
|
render() {
|
|
362
|
-
return (h("mg-input", { key: '
|
|
374
|
+
return (h("mg-input", { key: '1428f0f9f11d829ec8d3ed507c8690d63839ff17', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === null ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly ? (this.value && h("b", { class: "mg-c-input__readonly-value" }, localeDate(this.value, this.locale))) : (h("input", { type: "date", class: "mg-c-input__box", min: this.min, max: this.max, value: this.value, id: this.identifier, name: this.name, disabled: this.disabled, required: this.required, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, onKeyDown: this.handleKeyDown, ref: (el) => {
|
|
363
375
|
if (el !== null)
|
|
364
376
|
this.input = el;
|
|
365
377
|
} }))));
|
|
@@ -26,6 +26,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
26
26
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
27
27
|
// hasDisplayedError (triggered by blur event)
|
|
28
28
|
this.hasDisplayedError = false;
|
|
29
|
+
this.customErrorMessage = { lock: false };
|
|
29
30
|
/**
|
|
30
31
|
* Input name
|
|
31
32
|
* If not set the value equals the identifier
|
|
@@ -131,19 +132,22 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
131
132
|
this.formatErrorValue = (value) => localeNumber(value, this.locale, !Number.isInteger(value) && this.type === 'decimal' ? this.decimalLength : 0);
|
|
132
133
|
/**
|
|
133
134
|
* Set input error message
|
|
134
|
-
* @param
|
|
135
|
+
* @param fromSetErrorContext - context come from `setError` method
|
|
135
136
|
*/
|
|
136
|
-
this.setErrorMessage = (
|
|
137
|
+
this.setErrorMessage = (fromSetErrorContext = false) => {
|
|
137
138
|
// Set error message
|
|
138
139
|
this.errorMessage = undefined;
|
|
139
140
|
if (!this.valid) {
|
|
140
141
|
const inputError = this.getInputError();
|
|
141
|
-
|
|
142
|
-
|
|
142
|
+
// Does have a new custom error message OR does have a custom error message locked
|
|
143
|
+
if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
|
|
144
|
+
this.errorMessage = this.customErrorMessage.message;
|
|
143
145
|
}
|
|
146
|
+
// required
|
|
144
147
|
else if (inputError === 'required') {
|
|
145
148
|
this.errorMessage = this.messages.errors[inputError];
|
|
146
149
|
}
|
|
150
|
+
// min/max
|
|
147
151
|
else {
|
|
148
152
|
const formattedMin = this.formatErrorValue(this.min);
|
|
149
153
|
const formattedMax = this.formatErrorValue(this.max);
|
|
@@ -345,17 +349,22 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
345
349
|
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
346
350
|
* @param valid - value indicating the validity
|
|
347
351
|
* @param errorMessage - the error message to display
|
|
352
|
+
* @param errorMessageLock - lock the error message and validity state
|
|
348
353
|
*/
|
|
349
|
-
async setError(valid, errorMessage) {
|
|
354
|
+
async setError(valid, errorMessage, errorMessageLock = false) {
|
|
350
355
|
if (typeof valid !== 'boolean') {
|
|
351
356
|
throw new Error('<mg-input-numeric> method "setError()" param "valid" must be a boolean.');
|
|
352
357
|
}
|
|
353
|
-
else if (!isValidString(errorMessage)) {
|
|
358
|
+
else if (errorMessage !== undefined && !isValidString(errorMessage)) {
|
|
354
359
|
throw new Error('<mg-input-numeric> method "setError()" param "errorMessage" must be a string.');
|
|
355
360
|
}
|
|
356
361
|
else {
|
|
362
|
+
this.customErrorMessage = {
|
|
363
|
+
lock: valid ? false : errorMessageLock,
|
|
364
|
+
message: valid ? undefined : errorMessage,
|
|
365
|
+
};
|
|
357
366
|
this.setValidity(valid);
|
|
358
|
-
this.setErrorMessage(
|
|
367
|
+
this.setErrorMessage(true);
|
|
359
368
|
this.hasDisplayedError = this.invalid;
|
|
360
369
|
}
|
|
361
370
|
}
|
|
@@ -373,6 +382,8 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
373
382
|
// - Keep everything in sync both inside and outside the component
|
|
374
383
|
return new Promise(resolve => {
|
|
375
384
|
requestAnimationFrame(() => {
|
|
385
|
+
// unlock validity check by reseting customErrorMessage
|
|
386
|
+
this.customErrorMessage = { lock: false };
|
|
376
387
|
this.checkValidity();
|
|
377
388
|
this.errorMessage = undefined;
|
|
378
389
|
this.hasDisplayedError = false;
|
|
@@ -386,11 +397,13 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
386
397
|
* @param newValue - valid new value
|
|
387
398
|
*/
|
|
388
399
|
setValidity(newValue) {
|
|
389
|
-
const
|
|
390
|
-
this.
|
|
400
|
+
const oldValue = this.valid;
|
|
401
|
+
if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
|
|
402
|
+
this.valid = newValue;
|
|
403
|
+
}
|
|
391
404
|
this.invalid = !this.valid;
|
|
392
405
|
// We need to send valid event even if it is the same value
|
|
393
|
-
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !==
|
|
406
|
+
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
|
|
394
407
|
this.inputValid.emit(this.valid);
|
|
395
408
|
}
|
|
396
409
|
/**
|
|
@@ -462,7 +475,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
462
475
|
* @returns HTML Element
|
|
463
476
|
*/
|
|
464
477
|
render() {
|
|
465
|
-
return (h("mg-input", { key: '
|
|
478
|
+
return (h("mg-input", { key: 'c47f7c310587fc3bb4e7d5ffd07854a2297958df', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly
|
|
466
479
|
? this.readonlyValue && this.renderReadonly()
|
|
467
480
|
: [
|
|
468
481
|
h("input", { key: "input", type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, autocomplete: "off", "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
@@ -21,6 +21,7 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
|
|
|
21
21
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
22
22
|
// hasDisplayedError (triggered by blur event)
|
|
23
23
|
this.hasDisplayedError = false;
|
|
24
|
+
this.customErrorMessage = { lock: false };
|
|
24
25
|
/**
|
|
25
26
|
* Input name
|
|
26
27
|
* If not set the value equals the identifier
|
|
@@ -96,14 +97,15 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
|
|
|
96
97
|
};
|
|
97
98
|
/**
|
|
98
99
|
* Set input error message
|
|
99
|
-
* @param
|
|
100
|
+
* @param fromSetErrorContext - context come from `setError` method
|
|
100
101
|
*/
|
|
101
|
-
this.setErrorMessage = (
|
|
102
|
+
this.setErrorMessage = (fromSetErrorContext = false) => {
|
|
102
103
|
// Set error message
|
|
103
104
|
this.errorMessage = undefined;
|
|
104
105
|
if (!this.valid) {
|
|
105
|
-
|
|
106
|
-
|
|
106
|
+
// Does have a new custom error message OR does have a custom error message locked
|
|
107
|
+
if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
|
|
108
|
+
this.errorMessage = this.customErrorMessage.message;
|
|
107
109
|
}
|
|
108
110
|
// required
|
|
109
111
|
else if (this.input.validity.valueMissing) {
|
|
@@ -179,17 +181,22 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
|
|
|
179
181
|
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
180
182
|
* @param valid - value indicating the validity
|
|
181
183
|
* @param errorMessage - the error message to display
|
|
184
|
+
* @param errorMessageLock - lock the error message and validity state
|
|
182
185
|
*/
|
|
183
|
-
async setError(valid, errorMessage) {
|
|
186
|
+
async setError(valid, errorMessage, errorMessageLock = false) {
|
|
184
187
|
if (typeof valid !== 'boolean') {
|
|
185
188
|
throw new Error('<mg-input-password> method "setError()" param "valid" must be a boolean.');
|
|
186
189
|
}
|
|
187
|
-
else if (!isValidString(errorMessage)) {
|
|
190
|
+
else if (errorMessage !== undefined && !isValidString(errorMessage)) {
|
|
188
191
|
throw new Error('<mg-input-password> method "setError()" param "errorMessage" must be a string.');
|
|
189
192
|
}
|
|
190
193
|
else {
|
|
194
|
+
this.customErrorMessage = {
|
|
195
|
+
lock: valid ? false : errorMessageLock,
|
|
196
|
+
message: valid ? undefined : errorMessage,
|
|
197
|
+
};
|
|
191
198
|
this.setValidity(valid);
|
|
192
|
-
this.setErrorMessage(
|
|
199
|
+
this.setErrorMessage(true);
|
|
193
200
|
this.hasDisplayedError = this.invalid;
|
|
194
201
|
}
|
|
195
202
|
}
|
|
@@ -207,6 +214,8 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
|
|
|
207
214
|
// - Keep everything in sync both inside and outside the component
|
|
208
215
|
return new Promise(resolve => {
|
|
209
216
|
requestAnimationFrame(() => {
|
|
217
|
+
// unlock validity check by reseting customErrorMessage
|
|
218
|
+
this.customErrorMessage = { lock: false };
|
|
210
219
|
this.checkValidity();
|
|
211
220
|
this.errorMessage = undefined;
|
|
212
221
|
this.hasDisplayedError = false;
|
|
@@ -220,11 +229,13 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
|
|
|
220
229
|
* @param newValue - valid new value
|
|
221
230
|
*/
|
|
222
231
|
setValidity(newValue) {
|
|
223
|
-
const
|
|
224
|
-
this.
|
|
232
|
+
const oldValue = this.valid;
|
|
233
|
+
if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
|
|
234
|
+
this.valid = newValue;
|
|
235
|
+
}
|
|
225
236
|
this.invalid = !this.valid;
|
|
226
237
|
// We need to send valid event even if it is the same value
|
|
227
|
-
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !==
|
|
238
|
+
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
|
|
228
239
|
this.inputValid.emit(this.valid);
|
|
229
240
|
}
|
|
230
241
|
/*************
|
|
@@ -252,7 +263,7 @@ const MgInputPassword$1 = /*@__PURE__*/ proxyCustomElement(class MgInputPassword
|
|
|
252
263
|
* @returns HTML Element
|
|
253
264
|
*/
|
|
254
265
|
render() {
|
|
255
|
-
return (h("mg-input", { key: '
|
|
266
|
+
return (h("mg-input", { key: '845c075a44c50043776b7577642254d772629eef', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
256
267
|
if (el !== null)
|
|
257
268
|
this.input = el;
|
|
258
269
|
} }), h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
|