@mgdis/mg-components 6.16.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.
Files changed (160) hide show
  1. package/dist/cjs/{index-T3-qWqFE.js → index-DCZEYvlH.js} +51 -28
  2. package/dist/cjs/{index-YM1EJx9X.js → index-TUElr4Wv.js} +10 -10
  3. package/dist/cjs/loader.cjs.js +2 -2
  4. package/dist/cjs/mg-action-more_37.cjs.entry.js +443 -228
  5. package/dist/cjs/mg-alert.cjs.entry.js +3 -3
  6. package/dist/cjs/mg-components.cjs.js +3 -3
  7. package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
  8. package/dist/cjs/mg-input-combobox.cjs.entry.js +73 -57
  9. package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +36 -23
  10. package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-HYIzRsy7.js} +5 -0
  11. package/dist/cjs/mg-loader.cjs.entry.js +3 -3
  12. package/dist/cjs/mg-progress.cjs.entry.js +2 -2
  13. package/dist/collection/collection-manifest.json +2 -1
  14. package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +5 -5
  15. package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +7 -7
  16. package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -6
  17. package/dist/collection/components/atoms/mg-button/mg-button.js +13 -13
  18. package/dist/collection/components/atoms/mg-card/mg-card.js +2 -2
  19. package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
  20. package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -1
  21. package/dist/collection/components/atoms/mg-icon/mg-icon.js +32 -26
  22. package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
  23. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
  24. package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -6
  25. package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +4 -0
  26. package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +193 -33
  27. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +7 -9
  28. package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +65 -46
  29. package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +106 -86
  30. package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +67 -65
  31. package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +71 -66
  32. package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +56 -38
  33. package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +53 -35
  34. package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +66 -47
  35. package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +58 -40
  36. package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +77 -59
  37. package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +63 -45
  38. package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +54 -30
  39. package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +2 -4
  40. package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +9 -6
  41. package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +7 -7
  42. package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -5
  43. package/dist/collection/components/molecules/mg-alert/mg-alert.js +5 -5
  44. package/dist/collection/components/molecules/mg-details/mg-details.js +7 -7
  45. package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
  46. package/dist/collection/components/molecules/mg-form/mg-form.js +26 -17
  47. package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +3 -3
  48. package/dist/collection/components/molecules/mg-loader/mg-loader.js +4 -4
  49. package/dist/collection/components/molecules/mg-message/mg-message.js +4 -4
  50. package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -8
  51. package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +7 -8
  52. package/dist/collection/components/molecules/mg-panel/mg-panel.js +53 -22
  53. package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
  54. package/dist/collection/components/molecules/mg-popover/mg-popover.js +7 -7
  55. package/dist/collection/components/molecules/mg-progress/mg-progress.js +7 -7
  56. package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -2
  57. package/dist/collection/components/molecules/mg-table/mg-table.js +2 -3
  58. package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +7 -8
  59. package/dist/collection/locales/en/messages.json +5 -5
  60. package/dist/collection/locales/fr/messages.json +5 -5
  61. package/dist/components/index3.js +10 -10
  62. package/dist/components/mg-action-more.js +5 -3
  63. package/dist/components/mg-alert.js +5 -3
  64. package/dist/components/mg-badge2.js +4 -2
  65. package/dist/components/mg-button2.js +4 -2
  66. package/dist/components/mg-card2.js +4 -2
  67. package/dist/components/mg-character-left2.js +4 -2
  68. package/dist/components/mg-details.js +5 -3
  69. package/dist/components/mg-divider2.js +4 -2
  70. package/dist/components/mg-fieldset.d.ts +11 -0
  71. package/dist/components/mg-fieldset.js +209 -0
  72. package/dist/components/mg-form.js +8 -5
  73. package/dist/components/mg-icon2.js +29 -21
  74. package/dist/components/mg-illustrated-message.js +5 -3
  75. package/dist/components/mg-input-checkbox-paginated2.js +6 -6
  76. package/dist/components/mg-input-checkbox.js +32 -17
  77. package/dist/components/mg-input-combobox.js +75 -57
  78. package/dist/components/mg-input-date.js +39 -42
  79. package/dist/components/mg-input-numeric.js +30 -30
  80. package/dist/components/mg-input-password.js +26 -13
  81. package/dist/components/mg-input-radio.js +27 -13
  82. package/dist/components/mg-input-rich-text-editor.js +37 -22
  83. package/dist/components/mg-input-select2.js +28 -14
  84. package/dist/components/mg-input-text2.js +40 -26
  85. package/dist/components/mg-input-textarea.js +27 -14
  86. package/dist/components/mg-input-title2.js +4 -2
  87. package/dist/components/mg-input-toggle.js +39 -12
  88. package/dist/components/mg-input2.js +121 -20
  89. package/dist/components/mg-item-more2.js +13 -5
  90. package/dist/components/mg-loader2.js +5 -3
  91. package/dist/components/mg-menu-item2.js +4 -2
  92. package/dist/components/mg-message2.js +6 -4
  93. package/dist/components/mg-modal.js +6 -4
  94. package/dist/components/mg-pagination.js +4 -2
  95. package/dist/components/mg-panel.js +40 -9
  96. package/dist/components/mg-popover-content2.js +5 -3
  97. package/dist/components/mg-popover2.js +5 -3
  98. package/dist/components/mg-progress.js +5 -3
  99. package/dist/components/mg-skip-links.js +5 -3
  100. package/dist/components/mg-table.js +4 -2
  101. package/dist/components/mg-tabs2.js +5 -3
  102. package/dist/components/mg-tag.js +4 -2
  103. package/dist/components/mg-tooltip-content2.js +4 -2
  104. package/dist/components/mg-tooltip2.js +4 -2
  105. package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
  106. package/dist/esm/{index-Bab8_u8S.js → index-CNX6lq0x.js} +10 -10
  107. package/dist/esm/{index-JHj_9FSs.js → index-T6kOJXP1.js} +51 -28
  108. package/dist/esm/loader.js +3 -3
  109. package/dist/esm/mg-action-more_37.entry.js +444 -229
  110. package/dist/esm/mg-alert.entry.js +4 -4
  111. package/dist/esm/mg-components.js +4 -4
  112. package/dist/esm/mg-fieldset.entry.js +139 -0
  113. package/dist/esm/mg-input-combobox.entry.js +74 -58
  114. package/dist/esm/mg-input-rich-text-editor.entry.js +37 -24
  115. package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-D9V2v4n2.js} +5 -1
  116. package/dist/esm/mg-loader.entry.js +4 -4
  117. package/dist/esm/mg-progress.entry.js +3 -3
  118. package/dist/mg-components/locales/en/messages.json +5 -5
  119. package/dist/mg-components/locales/fr/messages.json +5 -5
  120. package/dist/mg-components/mg-components.esm.js +1 -1
  121. package/dist/mg-components/p-2bab89c2.entry.js +1 -0
  122. package/dist/mg-components/{p-658f828c.entry.js → p-5abc77cd.entry.js} +1 -1
  123. package/dist/mg-components/p-7d2e43b2.entry.js +1 -0
  124. package/dist/mg-components/{p-c85b5d10.entry.js → p-92e5e5a6.entry.js} +1 -1
  125. package/dist/mg-components/{p-42a90251.entry.js → p-952288bd.entry.js} +1 -1
  126. package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
  127. package/dist/mg-components/p-CNX6lq0x.js +1 -0
  128. package/dist/mg-components/p-D9V2v4n2.js +1 -0
  129. package/dist/mg-components/p-T6kOJXP1.js +2 -0
  130. package/dist/mg-components/p-f2cddd52.entry.js +1 -0
  131. package/dist/mg-components/{p-82455ac7.entry.js → p-f6afaeb8.entry.js} +1 -1
  132. package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +1 -1
  133. package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +0 -5
  134. package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +5 -0
  135. package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
  136. package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
  137. package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +4 -2
  138. package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
  139. package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
  140. package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
  141. package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
  142. package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -2
  143. package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
  144. package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -2
  145. package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -2
  146. package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
  147. package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
  148. package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
  149. package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
  150. package/dist/types/components.d.ts +168 -18
  151. package/dist/types/stencil-public-runtime.d.ts +39 -2
  152. package/dist/types/types/index.d.ts +1 -1
  153. package/ide/intellij/web-types.json +289 -181
  154. package/ide/vscode/html-custom-data.json +259 -18
  155. package/package.json +23 -23
  156. package/dist/mg-components/p-54156253.entry.js +0 -1
  157. package/dist/mg-components/p-Bab8_u8S.js +0 -1
  158. package/dist/mg-components/p-CNgv8hc5.js +0 -1
  159. package/dist/mg-components/p-JHj_9FSs.js +0 -2
  160. package/dist/mg-components/p-abbd151c.entry.js +0 -1
@@ -48,6 +48,7 @@ export class MgInputCombobox {
48
48
  this.classFocus = 'mg-u-is-focused';
49
49
  // hasDisplayedError (triggered by blur event)
50
50
  this.hasDisplayedError = false;
51
+ this.customErrorMessage = { lock: false };
51
52
  /**
52
53
  * Input name
53
54
  * If not set the value equals the identifier
@@ -182,7 +183,7 @@ export class MgInputCombobox {
182
183
  // override keys actions
183
184
  switch (event.key) {
184
185
  case Keys.TAB:
185
- case Keys.ENTER:
186
+ case Keys.ENTER: {
186
187
  guard = event.key === Keys.ENTER;
187
188
  const option = (_a = this.option) !== null && _a !== void 0 ? _a : this.options.items.find(this.isCurrentOption);
188
189
  // Sets the value to the content of the focused option in the listbox.
@@ -192,12 +193,13 @@ export class MgInputCombobox {
192
193
  // Closes the popover.
193
194
  this.popoverDisplay = false;
194
195
  break;
196
+ }
195
197
  case Keys.DOWN:
196
198
  case Keys.ARROWDOWN:
197
199
  case Keys.UP:
198
- case Keys.ARROWUP:
200
+ case Keys.ARROWUP: {
199
201
  guard = true;
200
- if (this.isLoading || !(this.page.total > 0)) {
202
+ if (this.isLoading || this.page.total === 0) {
201
203
  this.popoverDisplay = true;
202
204
  break;
203
205
  }
@@ -228,12 +230,13 @@ export class MgInputCombobox {
228
230
  // open popover
229
231
  this.popoverDisplay = true;
230
232
  break;
233
+ }
231
234
  case Keys.LEFT:
232
235
  case Keys.ARROWLEFT:
233
236
  case Keys.HOME:
234
237
  case Keys.RIGHT:
235
238
  case Keys.ARROWRIGHT:
236
- case Keys.END:
239
+ case Keys.END: {
237
240
  // skip process if visual focus is not in popover
238
241
  if (!isItem(this.option))
239
242
  break;
@@ -253,8 +256,9 @@ export class MgInputCombobox {
253
256
  this.input.setSelectionRange(index, index);
254
257
  }
255
258
  break;
259
+ }
256
260
  case Keys.ESC:
257
- case Keys.ESCAPE:
261
+ case Keys.ESCAPE: {
258
262
  guard = true;
259
263
  if (this.popoverDisplay) {
260
264
  // If the popover is displayed, closes it.
@@ -268,10 +272,12 @@ export class MgInputCombobox {
268
272
  this.option = null;
269
273
  }
270
274
  break;
271
- default:
275
+ }
276
+ default: {
272
277
  // Remove visual focus from popover options
273
278
  this.option = null;
274
279
  break;
280
+ }
275
281
  }
276
282
  if (guard) {
277
283
  event.stopPropagation();
@@ -317,18 +323,20 @@ export class MgInputCombobox {
317
323
  };
318
324
  /**
319
325
  * Set input error message
320
- * @param errorMessage - errorMessage override
326
+ * @param fromSetErrorContext - context come from `setError` method
321
327
  */
322
- this.setErrorMessage = (errorMessage) => {
328
+ this.setErrorMessage = (fromSetErrorContext = false) => {
323
329
  // Set error message
324
330
  this.errorMessage = undefined;
325
- // Does have a custom error message
326
- if (!this.valid && errorMessage !== undefined) {
327
- this.errorMessage = errorMessage;
328
- }
329
- // required
330
- else if (!this.valid && this.input.validity.valueMissing) {
331
- this.errorMessage = this.messages.errors.required;
331
+ if (!this.valid) {
332
+ // Does have a new custom error message OR does have a custom error message locked
333
+ if (fromSetErrorContext || (this.customErrorMessage.lock && this.customErrorMessage.message !== undefined)) {
334
+ this.errorMessage = this.customErrorMessage.message;
335
+ }
336
+ // required
337
+ else if (this.input.validity.valueMissing) {
338
+ this.errorMessage = this.messages.errors.required;
339
+ }
332
340
  }
333
341
  };
334
342
  /**
@@ -342,15 +350,14 @@ export class MgInputCombobox {
342
350
  * @returns promisified action
343
351
  */
344
352
  this.loadingWrapper = (action) => {
353
+ var _a;
345
354
  let promise;
346
355
  let index;
347
356
  // cache initial loading action if not defined
348
- if (!Boolean(this.loadingAction)) {
349
- this.loadingAction = action.name;
350
- }
357
+ (_a = this.loadingAction) !== null && _a !== void 0 ? _a : (this.loadingAction = action.name);
351
358
  // update index
352
359
  if (Boolean(this.option) && this.loadingAction !== 'load-more') {
353
- index = this.page.items.findIndex(option => option.value.toString() === this.option.value.toString());
360
+ index = this.page.items.findIndex(option => toString(option.value) === toString(this.option.value));
354
361
  }
355
362
  else if (this.loadingAction === 'load-more') {
356
363
  index = this.page.items.length - this.page.baseIndex;
@@ -403,14 +410,14 @@ export class MgInputCombobox {
403
410
  */
404
411
  this.goToNextPage = () => {
405
412
  this.showMore.emit();
406
- if (Boolean(this.fetchurl)) {
413
+ if (this.fetchurl !== undefined) {
407
414
  return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {
408
- if (!Boolean(nextPage))
409
- return;
410
- // merge items from current page and next page
411
- const items = [...this.page.items, ...nextPage.items];
412
- // create new options pagination withe merged items
413
- this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });
415
+ if (nextPage !== undefined) {
416
+ // merge items from current page and next page
417
+ const items = [...this.page.items, ...nextPage.items];
418
+ // create new options pagination withe merged items
419
+ this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });
420
+ }
414
421
  });
415
422
  }
416
423
  else {
@@ -427,12 +434,12 @@ export class MgInputCombobox {
427
434
  * @returns promise
428
435
  */
429
436
  this.updatePage = async () => {
430
- if (Boolean(this.fetchurl)) {
437
+ if (this.fetchurl !== undefined) {
431
438
  return this.getOptions().then(page => {
432
- if (!Boolean(page))
433
- return;
434
- // reset current options pagination from API response
435
- this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });
439
+ if (page !== undefined) {
440
+ // reset current options pagination from API response
441
+ this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });
442
+ }
436
443
  });
437
444
  }
438
445
  else {
@@ -478,11 +485,11 @@ export class MgInputCombobox {
478
485
  this.valueChange.emit(newValue);
479
486
  }
480
487
  watchItems(newValue) {
481
- if (Boolean(this.fetchurl) && !Boolean(newValue)) {
488
+ if (this.fetchurl !== undefined && newValue === undefined) {
482
489
  // skip newValue check
483
490
  return;
484
491
  }
485
- else if (Boolean(this.fetchurl) && Boolean(newValue)) {
492
+ else if (this.fetchurl !== undefined && newValue !== undefined) {
486
493
  throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${toString(newValue)}.`);
487
494
  }
488
495
  // Empty options
@@ -502,7 +509,7 @@ export class MgInputCombobox {
502
509
  }
503
510
  }
504
511
  watchIdentifier(newValue) {
505
- if (Boolean(newValue)) {
512
+ if (isValidString(newValue)) {
506
513
  this.popoverId = `${newValue}-popover`;
507
514
  this.element.dataset.mgPopoverGuard = this.popoverId;
508
515
  }
@@ -542,7 +549,7 @@ export class MgInputCombobox {
542
549
  this.classCollection = new ClassList(this.classCollection.classes);
543
550
  }
544
551
  watchFetchUrl(newValue) {
545
- if (Boolean(newValue)) {
552
+ if (newValue !== undefined) {
546
553
  this.loadingWrapper({ name: 'load-data' });
547
554
  }
548
555
  }
@@ -550,20 +557,17 @@ export class MgInputCombobox {
550
557
  if (this.fetchurl && newValue && !isObject(newValue)) {
551
558
  throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${toString(newValue)}.`);
552
559
  }
553
- else {
554
- new Request(this.fetchurl, newValue);
555
- }
556
560
  }
557
561
  watchFetchMappings(newValue) {
558
- if (Boolean(this.fetchurl) && !Boolean(newValue)) {
562
+ if (this.fetchurl !== undefined && !isObject(newValue)) {
559
563
  throw new Error(`<mg-input-combobox> prop "fetchmappings" is required with "fetchurl" prop.`);
560
564
  }
561
- else if (Boolean(newValue) && !isFetchmappings(newValue)) {
565
+ else if (newValue !== undefined && !isFetchmappings(newValue)) {
562
566
  throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${toString(newValue)}.`);
563
567
  }
564
568
  }
565
569
  watchOptions(newValue) {
566
- this.page = newValue.getPage(0, Boolean(this.filter) ? this.optionsFilter : undefined);
570
+ this.page = newValue.getPage(0, this.filter.length > 0 ? this.optionsFilter : undefined);
567
571
  }
568
572
  watchFilter(newValue) {
569
573
  this.loadingWrapper({ name: 'load-data' });
@@ -620,17 +624,22 @@ export class MgInputCombobox {
620
624
  * When used to set validity to `false`, you should use this method again to reset the validity to `true`.
621
625
  * @param valid - value indicating the validity
622
626
  * @param errorMessage - the error message to display
627
+ * @param errorMessageLock - lock the error message and validity state
623
628
  */
624
- async setError(valid, errorMessage) {
629
+ async setError(valid, errorMessage, errorMessageLock = false) {
625
630
  if (typeof valid !== 'boolean') {
626
631
  throw new Error('<mg-input-combobox> method "setError()" param "valid" must be a boolean.');
627
632
  }
628
- else if (!isValidString(errorMessage)) {
633
+ else if (errorMessage !== undefined && !isValidString(errorMessage)) {
629
634
  throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');
630
635
  }
631
636
  else {
637
+ this.customErrorMessage = {
638
+ lock: valid ? false : errorMessageLock,
639
+ message: valid ? undefined : errorMessage,
640
+ };
632
641
  this.setValidity(valid);
633
- this.setErrorMessage(valid ? undefined : errorMessage);
642
+ this.setErrorMessage(true);
634
643
  this.hasDisplayedError = this.invalid;
635
644
  }
636
645
  }
@@ -650,6 +659,8 @@ export class MgInputCombobox {
650
659
  // - Keep everything in sync both inside and outside the component
651
660
  return new Promise(resolve => {
652
661
  requestAnimationFrame(() => {
662
+ // unlock validity check by reseting customErrorMessage
663
+ this.customErrorMessage = { lock: false };
653
664
  this.checkValidity();
654
665
  this.errorMessage = undefined;
655
666
  this.hasDisplayedError = false;
@@ -678,11 +689,13 @@ export class MgInputCombobox {
678
689
  * @param newValue - valid new value
679
690
  */
680
691
  setValidity(newValue) {
681
- const oldValidValue = this.valid;
682
- this.valid = newValue;
692
+ const oldValue = this.valid;
693
+ if (!this.customErrorMessage.lock || (this.customErrorMessage.message !== undefined && !newValue)) {
694
+ this.valid = newValue;
695
+ }
683
696
  this.invalid = !this.valid;
684
697
  // We need to send valid event even if it is the same value
685
- if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
698
+ if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValue))
686
699
  this.inputValid.emit(this.valid);
687
700
  }
688
701
  /*************
@@ -698,7 +711,7 @@ export class MgInputCombobox {
698
711
  // Validate
699
712
  this.watchIdentifier(this.identifier);
700
713
  this.watchItems(this.items);
701
- if (Boolean(this.fetchurl)) {
714
+ if (this.fetchurl !== undefined) {
702
715
  this.watchFetchOptions(this.fetchoptions);
703
716
  this.watchFetchMappings(this.fetchmappings);
704
717
  this.loadingWrapper({ name: 'load-data' });
@@ -725,14 +738,17 @@ export class MgInputCombobox {
725
738
  const readonlyValue = this.getValueTitle();
726
739
  const withResetButton = this.value && !this.disabled;
727
740
  let popoverContent;
728
- if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0)
741
+ if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0) {
729
742
  popoverContent = 'list';
730
- else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && Boolean(this.filter))
743
+ }
744
+ else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && this.filter.length > 0) {
731
745
  popoverContent = 'notfound';
732
- else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0)
746
+ }
747
+ else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0) {
733
748
  popoverContent = 'notavailable';
749
+ }
734
750
  let activeDescendant;
735
- if (Boolean((_d = this.option) === null || _d === void 0 ? void 0 : _d.value)) {
751
+ if (((_d = this.option) === null || _d === void 0 ? void 0 : _d.value) !== undefined) {
736
752
  activeDescendant = this.option.value;
737
753
  }
738
754
  else if (typeof this.value === 'string') {
@@ -741,8 +757,8 @@ export class MgInputCombobox {
741
757
  else {
742
758
  activeDescendant = (_e = this.value) === null || _e === void 0 ? void 0 : _e.value;
743
759
  }
744
- return (h("mg-input", { key: '79e5263cd3b1c0fa0b3f386a547f2bdd48a33b28', 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: {
745
- '--mg-c-input-list-width': Boolean((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) ? `${this.input.offsetWidth}px` : undefined,
760
+ 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: {
761
+ '--mg-c-input-list-width': ((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) > 0 ? `${this.input.offsetWidth}px` : undefined,
746
762
  }, "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) => {
747
763
  if (el !== null)
748
764
  this.input = el;
@@ -781,7 +797,6 @@ export class MgInputCombobox {
781
797
  return {
782
798
  "value": {
783
799
  "type": "string",
784
- "attribute": "value",
785
800
  "mutable": true,
786
801
  "complexType": {
787
802
  "original": "string | Option",
@@ -802,11 +817,11 @@ export class MgInputCombobox {
802
817
  },
803
818
  "getter": false,
804
819
  "setter": false,
805
- "reflect": true
820
+ "reflect": true,
821
+ "attribute": "value"
806
822
  },
807
823
  "items": {
808
824
  "type": "unknown",
809
- "attribute": "items",
810
825
  "mutable": false,
811
826
  "complexType": {
812
827
  "original": "(string | Option)[]",
@@ -830,7 +845,6 @@ export class MgInputCombobox {
830
845
  },
831
846
  "itemsLabel": {
832
847
  "type": "string",
833
- "attribute": "items-label",
834
848
  "mutable": false,
835
849
  "complexType": {
836
850
  "original": "string",
@@ -848,11 +862,11 @@ export class MgInputCombobox {
848
862
  },
849
863
  "getter": false,
850
864
  "setter": false,
851
- "reflect": false
865
+ "reflect": false,
866
+ "attribute": "items-label"
852
867
  },
853
868
  "identifier": {
854
869
  "type": "string",
855
- "attribute": "identifier",
856
870
  "mutable": false,
857
871
  "complexType": {
858
872
  "original": "string",
@@ -867,11 +881,11 @@ export class MgInputCombobox {
867
881
  },
868
882
  "getter": false,
869
883
  "setter": false,
870
- "reflect": false
884
+ "reflect": false,
885
+ "attribute": "identifier"
871
886
  },
872
887
  "name": {
873
888
  "type": "string",
874
- "attribute": "name",
875
889
  "mutable": false,
876
890
  "complexType": {
877
891
  "original": "string",
@@ -887,11 +901,11 @@ export class MgInputCombobox {
887
901
  "getter": false,
888
902
  "setter": false,
889
903
  "reflect": false,
904
+ "attribute": "name",
890
905
  "defaultValue": "this.identifier"
891
906
  },
892
907
  "label": {
893
908
  "type": "string",
894
- "attribute": "label",
895
909
  "mutable": false,
896
910
  "complexType": {
897
911
  "original": "string",
@@ -906,11 +920,11 @@ export class MgInputCombobox {
906
920
  },
907
921
  "getter": false,
908
922
  "setter": false,
909
- "reflect": false
923
+ "reflect": false,
924
+ "attribute": "label"
910
925
  },
911
926
  "labelOnTop": {
912
927
  "type": "boolean",
913
- "attribute": "label-on-top",
914
928
  "mutable": false,
915
929
  "complexType": {
916
930
  "original": "boolean",
@@ -926,11 +940,11 @@ export class MgInputCombobox {
926
940
  "getter": false,
927
941
  "setter": false,
928
942
  "reflect": false,
943
+ "attribute": "label-on-top",
929
944
  "defaultValue": "false"
930
945
  },
931
946
  "labelHide": {
932
947
  "type": "boolean",
933
- "attribute": "label-hide",
934
948
  "mutable": false,
935
949
  "complexType": {
936
950
  "original": "boolean",
@@ -946,11 +960,11 @@ export class MgInputCombobox {
946
960
  "getter": false,
947
961
  "setter": false,
948
962
  "reflect": false,
963
+ "attribute": "label-hide",
949
964
  "defaultValue": "false"
950
965
  },
951
966
  "placeholder": {
952
967
  "type": "string",
953
- "attribute": "placeholder",
954
968
  "mutable": false,
955
969
  "complexType": {
956
970
  "original": "string",
@@ -965,11 +979,11 @@ export class MgInputCombobox {
965
979
  },
966
980
  "getter": false,
967
981
  "setter": false,
968
- "reflect": false
982
+ "reflect": false,
983
+ "attribute": "placeholder"
969
984
  },
970
985
  "required": {
971
986
  "type": "boolean",
972
- "attribute": "required",
973
987
  "mutable": false,
974
988
  "complexType": {
975
989
  "original": "boolean",
@@ -985,11 +999,11 @@ export class MgInputCombobox {
985
999
  "getter": false,
986
1000
  "setter": false,
987
1001
  "reflect": false,
1002
+ "attribute": "required",
988
1003
  "defaultValue": "false"
989
1004
  },
990
1005
  "readonly": {
991
1006
  "type": "boolean",
992
- "attribute": "readonly",
993
1007
  "mutable": false,
994
1008
  "complexType": {
995
1009
  "original": "boolean",
@@ -1005,11 +1019,11 @@ export class MgInputCombobox {
1005
1019
  "getter": false,
1006
1020
  "setter": false,
1007
1021
  "reflect": false,
1022
+ "attribute": "readonly",
1008
1023
  "defaultValue": "false"
1009
1024
  },
1010
1025
  "disabled": {
1011
1026
  "type": "boolean",
1012
- "attribute": "disabled",
1013
1027
  "mutable": false,
1014
1028
  "complexType": {
1015
1029
  "original": "boolean",
@@ -1025,11 +1039,11 @@ export class MgInputCombobox {
1025
1039
  "getter": false,
1026
1040
  "setter": false,
1027
1041
  "reflect": false,
1042
+ "attribute": "disabled",
1028
1043
  "defaultValue": "false"
1029
1044
  },
1030
1045
  "mgWidth": {
1031
1046
  "type": "any",
1032
- "attribute": "mg-width",
1033
1047
  "mutable": false,
1034
1048
  "complexType": {
1035
1049
  "original": "Width",
@@ -1051,11 +1065,11 @@ export class MgInputCombobox {
1051
1065
  "getter": false,
1052
1066
  "setter": false,
1053
1067
  "reflect": false,
1068
+ "attribute": "mg-width",
1054
1069
  "defaultValue": "'full'"
1055
1070
  },
1056
1071
  "tooltip": {
1057
1072
  "type": "string",
1058
- "attribute": "tooltip",
1059
1073
  "mutable": false,
1060
1074
  "complexType": {
1061
1075
  "original": "string",
@@ -1070,11 +1084,11 @@ export class MgInputCombobox {
1070
1084
  },
1071
1085
  "getter": false,
1072
1086
  "setter": false,
1073
- "reflect": false
1087
+ "reflect": false,
1088
+ "attribute": "tooltip"
1074
1089
  },
1075
1090
  "tooltipPosition": {
1076
1091
  "type": "string",
1077
- "attribute": "tooltip-position",
1078
1092
  "mutable": false,
1079
1093
  "complexType": {
1080
1094
  "original": "TooltipPosition",
@@ -1096,11 +1110,11 @@ export class MgInputCombobox {
1096
1110
  "getter": false,
1097
1111
  "setter": false,
1098
1112
  "reflect": false,
1113
+ "attribute": "tooltip-position",
1099
1114
  "defaultValue": "'input'"
1100
1115
  },
1101
1116
  "helpText": {
1102
1117
  "type": "string",
1103
- "attribute": "help-text",
1104
1118
  "mutable": false,
1105
1119
  "complexType": {
1106
1120
  "original": "string",
@@ -1115,11 +1129,11 @@ export class MgInputCombobox {
1115
1129
  },
1116
1130
  "getter": false,
1117
1131
  "setter": false,
1118
- "reflect": false
1132
+ "reflect": false,
1133
+ "attribute": "help-text"
1119
1134
  },
1120
1135
  "fetchurl": {
1121
1136
  "type": "string",
1122
- "attribute": "fetchurl",
1123
1137
  "mutable": false,
1124
1138
  "complexType": {
1125
1139
  "original": "string | URL",
@@ -1142,11 +1156,11 @@ export class MgInputCombobox {
1142
1156
  },
1143
1157
  "getter": false,
1144
1158
  "setter": false,
1145
- "reflect": false
1159
+ "reflect": false,
1160
+ "attribute": "fetchurl"
1146
1161
  },
1147
1162
  "fetchoptions": {
1148
1163
  "type": "unknown",
1149
- "attribute": "fetchoptions",
1150
1164
  "mutable": false,
1151
1165
  "complexType": {
1152
1166
  "original": "RequestInit",
@@ -1175,7 +1189,6 @@ export class MgInputCombobox {
1175
1189
  },
1176
1190
  "fetchmappings": {
1177
1191
  "type": "unknown",
1178
- "attribute": "fetchmappings",
1179
1192
  "mutable": false,
1180
1193
  "complexType": {
1181
1194
  "original": "{ request: RequestMappingType; response: ResponseMappingType }",
@@ -1207,7 +1220,6 @@ export class MgInputCombobox {
1207
1220
  },
1208
1221
  "valid": {
1209
1222
  "type": "boolean",
1210
- "attribute": "valid",
1211
1223
  "mutable": true,
1212
1224
  "complexType": {
1213
1225
  "original": "boolean",
@@ -1222,11 +1234,11 @@ export class MgInputCombobox {
1222
1234
  },
1223
1235
  "getter": false,
1224
1236
  "setter": false,
1225
- "reflect": false
1237
+ "reflect": false,
1238
+ "attribute": "valid"
1226
1239
  },
1227
1240
  "invalid": {
1228
1241
  "type": "boolean",
1229
- "attribute": "invalid",
1230
1242
  "mutable": true,
1231
1243
  "complexType": {
1232
1244
  "original": "boolean",
@@ -1241,7 +1253,8 @@ export class MgInputCombobox {
1241
1253
  },
1242
1254
  "getter": false,
1243
1255
  "setter": false,
1244
- "reflect": false
1256
+ "reflect": false,
1257
+ "attribute": "invalid"
1245
1258
  }
1246
1259
  };
1247
1260
  }
@@ -1387,7 +1400,7 @@ export class MgInputCombobox {
1387
1400
  },
1388
1401
  "setError": {
1389
1402
  "complexType": {
1390
- "signature": "(valid: MgInputCombobox[\"valid\"], errorMessage: string) => Promise<void>",
1403
+ "signature": "(valid: MgInputCombobox[\"valid\"], errorMessage?: string, errorMessageLock?: boolean) => Promise<void>",
1391
1404
  "parameters": [{
1392
1405
  "name": "valid",
1393
1406
  "type": "boolean",
@@ -1396,6 +1409,10 @@ export class MgInputCombobox {
1396
1409
  "name": "errorMessage",
1397
1410
  "type": "string",
1398
1411
  "docs": "- the error message to display"
1412
+ }, {
1413
+ "name": "errorMessageLock",
1414
+ "type": "boolean",
1415
+ "docs": "- lock the error message and validity state"
1399
1416
  }],
1400
1417
  "references": {
1401
1418
  "Promise": {
@@ -1417,6 +1434,9 @@ export class MgInputCombobox {
1417
1434
  }, {
1418
1435
  "name": "param",
1419
1436
  "text": "errorMessage - the error message to display"
1437
+ }, {
1438
+ "name": "param",
1439
+ "text": "errorMessageLock - lock the error message and validity state"
1420
1440
  }]
1421
1441
  }
1422
1442
  },