@mgdis/mg-components 6.15.0 → 6.17.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/events.utils-D5SAtkpQ.js +25 -0
- package/dist/cjs/{index-BGxkpQwi.js → index-DCZEYvlH.js} +48 -29
- package/dist/cjs/{index-iUZvsp-F.js → index-TUElr4Wv.js} +18 -30
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +100 -365
- package/dist/cjs/mg-alert.cjs.entry.js +2 -2
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-input-combobox.cjs.entry.js +78 -140
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +4 -4
- package/dist/cjs/{mg-input.conf-CwjEAih3.js → mg-input.conf-WTsvDfpC.js} +0 -7
- package/dist/cjs/mg-loader.cjs.entry.js +2 -2
- package/dist/cjs/mg-progress.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +5 -5
- package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +7 -7
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +6 -6
- package/dist/collection/components/atoms/mg-button/mg-button.js +13 -13
- package/dist/collection/components/atoms/mg-card/mg-card.js +2 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +32 -26
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +3 -3
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +2 -2
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -6
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +0 -6
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +37 -108
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +6 -8
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +42 -99
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +82 -167
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +27 -44
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +40 -55
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +26 -26
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +32 -86
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +26 -27
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +33 -82
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +33 -34
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +32 -32
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +27 -161
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +2 -4
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +4 -5
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +7 -7
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -4
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +4 -4
- package/dist/collection/components/molecules/mg-details/mg-details.js +6 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js +13 -13
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +2 -2
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +3 -3
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +6 -6
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +7 -8
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +13 -13
- 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 +6 -6
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +6 -6
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +0 -1
- package/dist/collection/components/molecules/mg-table/mg-table.js +2 -3
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +6 -7
- package/dist/collection/locales/en/messages.json +8 -13
- package/dist/collection/locales/fr/messages.json +8 -13
- package/dist/components/index2.js +1 -1
- package/dist/components/index3.js +18 -30
- package/dist/components/mg-action-more.js +4 -2
- package/dist/components/mg-alert.js +4 -2
- package/dist/components/mg-badge2.js +4 -2
- package/dist/components/mg-button2.js +4 -2
- package/dist/components/mg-card2.js +4 -2
- package/dist/components/mg-character-left2.js +4 -2
- package/dist/components/mg-details.js +99 -1
- package/dist/components/mg-divider2.js +4 -2
- package/dist/components/mg-form.js +4 -2
- package/dist/components/mg-icon2.js +29 -21
- package/dist/components/mg-illustrated-message.js +4 -2
- package/dist/components/mg-input-checkbox-paginated2.js +6 -7
- package/dist/components/mg-input-checkbox.js +23 -65
- package/dist/components/mg-input-combobox.js +64 -132
- package/dist/components/mg-input-date.js +8 -29
- package/dist/components/mg-input-numeric.js +8 -27
- package/dist/components/mg-input-password.js +6 -10
- package/dist/components/mg-input-radio.js +16 -55
- package/dist/components/mg-input-rich-text-editor.js +6 -10
- package/dist/components/mg-input-select2.js +12 -46
- package/dist/components/mg-input-text2.js +6 -10
- package/dist/components/mg-input-textarea.js +6 -10
- package/dist/components/mg-input-title2.js +4 -2
- package/dist/components/mg-input-toggle.js +15 -98
- package/dist/components/mg-input2.js +26 -101
- package/dist/components/mg-item-more2.js +8 -4
- package/dist/components/mg-loader2.js +4 -2
- package/dist/components/mg-menu-item2.js +4 -2
- package/dist/components/mg-message2.js +4 -2
- package/dist/components/mg-modal.js +4 -2
- package/dist/components/mg-pagination.js +6 -10
- package/dist/components/mg-panel.js +11 -15
- package/dist/components/mg-popover-content2.js +4 -2
- package/dist/components/mg-popover2.js +4 -2
- package/dist/components/mg-progress.js +4 -2
- package/dist/components/mg-skip-links.js +4 -2
- package/dist/components/mg-table.js +4 -2
- package/dist/components/mg-tabs2.js +4 -2
- package/dist/components/mg-tag.js +4 -2
- package/dist/components/mg-tooltip-content2.js +4 -2
- package/dist/components/mg-tooltip2.js +4 -2
- package/dist/esm/events.utils-yMGqY8YG.js +23 -0
- package/dist/esm/{index-CKB-AnCZ.js → index-CNX6lq0x.js} +18 -30
- package/dist/esm/{index-DhAOnZJn.js → index-T6kOJXP1.js} +48 -29
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +96 -361
- package/dist/esm/mg-alert.entry.js +2 -2
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-input-combobox.entry.js +59 -121
- package/dist/esm/mg-input-rich-text-editor.entry.js +4 -4
- package/dist/esm/{mg-input.conf-BAUTlb6r.js → mg-input.conf-CNgv8hc5.js} +1 -7
- package/dist/esm/mg-loader.entry.js +2 -2
- package/dist/esm/mg-progress.entry.js +1 -1
- package/dist/mg-components/locales/en/messages.json +8 -13
- package/dist/mg-components/locales/fr/messages.json +8 -13
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-47e19783.entry.js → p-0e6b40d6.entry.js} +1 -1
- package/dist/mg-components/{p-67af6274.entry.js → p-397bf67b.entry.js} +1 -1
- package/dist/mg-components/{p-a0fa44cf.entry.js → p-5dc3a1fb.entry.js} +1 -1
- package/dist/mg-components/p-8a69175b.entry.js +1 -0
- package/dist/mg-components/p-CNX6lq0x.js +1 -0
- package/dist/mg-components/p-CNgv8hc5.js +1 -0
- package/dist/mg-components/p-T6kOJXP1.js +2 -0
- package/dist/mg-components/{p-420daa1e.entry.js → p-c5da335e.entry.js} +1 -1
- package/dist/mg-components/p-d84d87ea.entry.js +1 -0
- package/dist/mg-components/p-yMGqY8YG.js +1 -0
- package/dist/types/components/atoms/mg-icon/mg-icon.conf.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +0 -5
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +0 -13
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +4 -15
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +3 -21
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +2 -16
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -40
- package/dist/types/components.d.ts +7 -63
- package/dist/types/stencil-public-runtime.d.ts +39 -2
- package/dist/types/types/index.d.ts +1 -1
- package/ide/intellij/web-types.json +23 -304
- package/ide/vscode/html-custom-data.json +18 -113
- package/package.json +22 -22
- package/dist/cjs/mg-input.utils-D-ASK4ua.js +0 -49
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.utils.js +0 -21
- package/dist/components/mg-details2.js +0 -99
- package/dist/components/mg-input.utils.js +0 -24
- package/dist/esm/mg-input.utils-BYI03zSi.js +0 -46
- package/dist/mg-components/p-31856cff.entry.js +0 -1
- package/dist/mg-components/p-698dfc6c.entry.js +0 -1
- package/dist/mg-components/p-BAUTlb6r.js +0 -1
- package/dist/mg-components/p-CKB-AnCZ.js +0 -1
- package/dist/mg-components/p-DhAOnZJn.js +0 -2
- package/dist/mg-components/p-PuX-pdL4.js +0 -1
- package/dist/types/components/molecules/inputs/mg-input/mg-input.utils.d.ts +0 -8
|
@@ -1,12 +1,10 @@
|
|
|
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,
|
|
3
|
-
import { d as defineCustomElement$8,
|
|
2
|
+
import { P as Paginate, C as ClassList, f as formatID, e as Cursor, n as nextTick, h as Page, j as getObjectValueFromKey, t as toString, d as allItemsAreString, k as isObject, i as isValidString } from './index2.js';
|
|
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';
|
|
6
|
-
import { d as
|
|
7
|
-
import { d as defineCustomElement$
|
|
8
|
-
import { d as defineCustomElement$b } from './mg-card2.js';
|
|
9
|
-
import { d as defineCustomElement$a } from './mg-details2.js';
|
|
6
|
+
import { d as defineCustomElement$b } from './mg-button2.js';
|
|
7
|
+
import { d as defineCustomElement$a } from './mg-card2.js';
|
|
10
8
|
import { d as defineCustomElement$9 } from './mg-icon2.js';
|
|
11
9
|
import { d as defineCustomElement$7 } from './mg-input-title2.js';
|
|
12
10
|
import { d as defineCustomElement$6 } from './mg-loader2.js';
|
|
@@ -15,7 +13,7 @@ import { d as defineCustomElement$4 } from './mg-popover-content2.js';
|
|
|
15
13
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
16
14
|
import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
|
|
17
15
|
|
|
18
|
-
const mgInputComboboxCss = ".mg-c-
|
|
16
|
+
const mgInputComboboxCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;color:var(--mg-b-color-neutral-90);text-align:center}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input.mg-c-input--combobox mg-popover{--mg-c-card-overflow:hidden;--mg-c-popover-padding-vertical:0;--mg-c-popover-padding-horizontal:0}.mg-c-input.mg-c-input--combobox .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--combobox .mg-c-input__box{cursor:pointer}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-container{display:flex;min-width:var(--mg-c-input-list-width);max-height:calc(50*var(--mg-b-size-8) - var(--mg-b-size-32));flex-direction:column;gap:var(--mg-b-size-4);overflow-y:scroll}.mg-c-input.mg-c-input--combobox .mg-c-input__load-more{padding:0 var(--mg-b-size-8) var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list{padding:0;margin:0;cursor:pointer;list-style:none}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item{display:flex;padding:var(--mg-b-size-8)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item:hover,.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--focus-visible{background-color:var(--mg-b-color-neutral-20)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected{font-weight:700}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected mg-icon{margin-left:auto}.mg-c-input.mg-c-input--combobox.mg-c-input--width-2 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-24) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-4 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-48) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-16 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + calc(23 * var(--mg-b-size-8)) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full mg-popover{--mg-c-popover-max-width:var(--mg-c-input-list-width, var(--mg-c-popover-max-width))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__input-group-container{display:flex;width:100%}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__box{flex:1}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box-append{position:absolute;top:0;right:0}";
|
|
19
17
|
|
|
20
18
|
/**
|
|
21
19
|
* Check if object is an item
|
|
@@ -54,9 +52,11 @@ const isFetchmappings = (value) => {
|
|
|
54
52
|
}
|
|
55
53
|
};
|
|
56
54
|
const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox extends HTMLElement {
|
|
57
|
-
constructor() {
|
|
55
|
+
constructor(registerHost) {
|
|
58
56
|
super();
|
|
59
|
-
|
|
57
|
+
if (registerHost !== false) {
|
|
58
|
+
this.__registerHost();
|
|
59
|
+
}
|
|
60
60
|
this.__attachShadow();
|
|
61
61
|
this.valueChange = createEvent(this, "value-change", 7);
|
|
62
62
|
this.filterChange = createEvent(this, "filter-change", 7);
|
|
@@ -148,12 +148,10 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
148
148
|
*/
|
|
149
149
|
this.handleFilterInput = () => {
|
|
150
150
|
this.checkValidity();
|
|
151
|
-
if (this.hasDisplayedError)
|
|
151
|
+
if (this.hasDisplayedError)
|
|
152
152
|
this.setErrorMessage();
|
|
153
|
-
|
|
154
|
-
if (!this.popoverDisplay) {
|
|
153
|
+
if (!this.popoverDisplay)
|
|
155
154
|
this.popoverDisplay = true;
|
|
156
|
-
}
|
|
157
155
|
// update filter with debounce to prevent filter update overload
|
|
158
156
|
if (!this.debounce) {
|
|
159
157
|
this.debounce = true;
|
|
@@ -199,6 +197,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
199
197
|
* @param event - keyboard event
|
|
200
198
|
*/
|
|
201
199
|
this.handleFilterKeydown = (event) => {
|
|
200
|
+
var _a;
|
|
202
201
|
if (this.disabled || event.ctrlKey || event.shiftKey)
|
|
203
202
|
return;
|
|
204
203
|
let guard = false;
|
|
@@ -207,10 +206,11 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
207
206
|
case Keys.TAB:
|
|
208
207
|
case Keys.ENTER:
|
|
209
208
|
guard = event.key === Keys.ENTER;
|
|
210
|
-
const option = this.option
|
|
209
|
+
const option = (_a = this.option) !== null && _a !== void 0 ? _a : this.options.items.find(this.isCurrentOption);
|
|
211
210
|
// Sets the value to the content of the focused option in the listbox.
|
|
212
|
-
if (this.popoverDisplay)
|
|
211
|
+
if (this.popoverDisplay) {
|
|
213
212
|
this.setValue(option);
|
|
213
|
+
}
|
|
214
214
|
// Closes the popover.
|
|
215
215
|
this.popoverDisplay = false;
|
|
216
216
|
break;
|
|
@@ -331,46 +331,27 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
331
331
|
else
|
|
332
332
|
return '';
|
|
333
333
|
};
|
|
334
|
-
/**
|
|
335
|
-
* Test if component has no value error message displayed
|
|
336
|
-
* @returns truthy if compent display no value error message
|
|
337
|
-
*/
|
|
338
|
-
this.hasNoValueError = () => this.customError === CustomError.NoValue;
|
|
339
334
|
/**
|
|
340
335
|
* Check if input is valid
|
|
341
336
|
*/
|
|
342
337
|
this.checkValidity = () => {
|
|
343
|
-
|
|
344
|
-
this.setValidity(this.readonly || this.disabled);
|
|
338
|
+
this.setValidity(this.readonly || this.disabled || this.input.checkValidity());
|
|
345
339
|
};
|
|
346
340
|
/**
|
|
347
341
|
* Set input error message
|
|
342
|
+
* @param errorMessage - errorMessage override
|
|
348
343
|
*/
|
|
349
|
-
this.setErrorMessage = () => {
|
|
344
|
+
this.setErrorMessage = (errorMessage) => {
|
|
350
345
|
// Set error message
|
|
351
346
|
this.errorMessage = undefined;
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
this.errorMessage = this.messages.errors.noValue;
|
|
360
|
-
}
|
|
361
|
-
// required
|
|
362
|
-
else if (this.input.validity.valueMissing) {
|
|
363
|
-
this.errorMessage = this.messages.errors.required;
|
|
364
|
-
}
|
|
347
|
+
// Does have a custom error message
|
|
348
|
+
if (!this.valid && errorMessage !== undefined) {
|
|
349
|
+
this.errorMessage = errorMessage;
|
|
350
|
+
}
|
|
351
|
+
// required
|
|
352
|
+
else if (!this.valid && this.input.validity.valueMissing) {
|
|
353
|
+
this.errorMessage = this.messages.errors.required;
|
|
365
354
|
}
|
|
366
|
-
};
|
|
367
|
-
/**
|
|
368
|
-
* Reset error message
|
|
369
|
-
*/
|
|
370
|
-
this.resetErrorMessage = () => {
|
|
371
|
-
this.checkValidity();
|
|
372
|
-
this.errorMessage = undefined;
|
|
373
|
-
this.hasDisplayedError = false;
|
|
374
355
|
};
|
|
375
356
|
/**
|
|
376
357
|
* Get filtered options from `filter` input value
|
|
@@ -444,14 +425,14 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
444
425
|
*/
|
|
445
426
|
this.goToNextPage = () => {
|
|
446
427
|
this.showMore.emit();
|
|
447
|
-
if (this.fetchurl
|
|
428
|
+
if (Boolean(this.fetchurl)) {
|
|
448
429
|
return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {
|
|
449
|
-
if (
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
}
|
|
430
|
+
if (!Boolean(nextPage))
|
|
431
|
+
return;
|
|
432
|
+
// merge items from current page and next page
|
|
433
|
+
const items = [...this.page.items, ...nextPage.items];
|
|
434
|
+
// create new options pagination withe merged items
|
|
435
|
+
this.options = new Paginate(items, { total: nextPage.total, next: nextPage.next, top: items.length });
|
|
455
436
|
});
|
|
456
437
|
}
|
|
457
438
|
else {
|
|
@@ -468,20 +449,12 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
468
449
|
* @returns promise
|
|
469
450
|
*/
|
|
470
451
|
this.updatePage = async () => {
|
|
471
|
-
if (this.fetchurl
|
|
452
|
+
if (Boolean(this.fetchurl)) {
|
|
472
453
|
return this.getOptions().then(page => {
|
|
473
|
-
if (
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
if (this.filter.length === 0 && page.total === 0) {
|
|
478
|
-
this.displayError();
|
|
479
|
-
}
|
|
480
|
-
// force to reset error when noValueError is displaied
|
|
481
|
-
else if (this.invalid && this.hasNoValueError()) {
|
|
482
|
-
this.resetErrorMessage();
|
|
483
|
-
}
|
|
484
|
-
}
|
|
454
|
+
if (!Boolean(page))
|
|
455
|
+
return;
|
|
456
|
+
// reset current options pagination from API response
|
|
457
|
+
this.options = new Paginate(page.items, { total: page.total, next: page.next, top: page.top });
|
|
485
458
|
});
|
|
486
459
|
}
|
|
487
460
|
else {
|
|
@@ -500,16 +473,14 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
500
473
|
const response = await fetch(updateUrl, this.fetchoptions);
|
|
501
474
|
if (!response.ok) {
|
|
502
475
|
this.fetchError.emit(new Error(`${response.status} - ${response.statusText}`));
|
|
503
|
-
this.displayError();
|
|
504
476
|
return;
|
|
505
477
|
}
|
|
506
478
|
const json = await response.json();
|
|
507
|
-
const
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
value: getObjectValueFromKey(item, this.fetchmappings.response.itemValue, item),
|
|
479
|
+
const items = getObjectValueFromKey(json, this.fetchmappings.response.items).map((item) => ({
|
|
480
|
+
title: getObjectValueFromKey(item, this.fetchmappings.response.itemTitle),
|
|
481
|
+
value: this.fetchmappings.response.itemValue !== undefined ? getObjectValueFromKey(item, this.fetchmappings.response.itemValue) : item,
|
|
511
482
|
}));
|
|
512
|
-
const total = Number(getObjectValueFromKey(json, this.fetchmappings.response.total,
|
|
483
|
+
const total = Number(getObjectValueFromKey(json, this.fetchmappings.response.total, 0));
|
|
513
484
|
let next = getObjectValueFromKey(json, this.fetchmappings.response.next);
|
|
514
485
|
if (URL.canParse(updateUrl) && Boolean(next) && !URL.canParse(next)) {
|
|
515
486
|
const previousUrl = new URL(updateUrl);
|
|
@@ -521,7 +492,6 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
521
492
|
}
|
|
522
493
|
catch (error) {
|
|
523
494
|
this.fetchError.emit(error);
|
|
524
|
-
this.displayError();
|
|
525
495
|
}
|
|
526
496
|
};
|
|
527
497
|
}
|
|
@@ -530,35 +500,24 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
530
500
|
this.valueChange.emit(newValue);
|
|
531
501
|
}
|
|
532
502
|
watchItems(newValue) {
|
|
533
|
-
|
|
534
|
-
if (![undefined, null].includes(this.fetchurl) && [undefined, null].includes(newValue)) {
|
|
503
|
+
if (Boolean(this.fetchurl) && !Boolean(newValue)) {
|
|
535
504
|
// skip newValue check
|
|
536
505
|
return;
|
|
537
506
|
}
|
|
538
|
-
|
|
539
|
-
else if (![undefined, null].includes(this.fetchurl) && Array.isArray(newValue)) {
|
|
507
|
+
else if (Boolean(this.fetchurl) && Boolean(newValue)) {
|
|
540
508
|
throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${toString(newValue)}.`);
|
|
541
509
|
}
|
|
542
|
-
// Empty
|
|
543
|
-
else if (
|
|
510
|
+
// Empty options
|
|
511
|
+
else if (Array.isArray(newValue) && newValue.length === 0) {
|
|
544
512
|
this.options = new Paginate([]);
|
|
545
|
-
this.displayError();
|
|
546
513
|
}
|
|
547
514
|
// String array
|
|
548
515
|
else if (allItemsAreString(newValue)) {
|
|
549
516
|
this.options = new Paginate(newValue.map(item => ({ title: item, value: item })), { total: newValue.length });
|
|
550
|
-
// force to reset error when noValueError is displayed
|
|
551
|
-
if (this.invalid && this.hasNoValueError()) {
|
|
552
|
-
this.resetErrorMessage();
|
|
553
|
-
}
|
|
554
517
|
}
|
|
555
518
|
// Object array
|
|
556
519
|
else if (isItems(newValue)) {
|
|
557
520
|
this.options = new Paginate(newValue, { total: newValue.length });
|
|
558
|
-
// force to reset error when noValueError is displayed
|
|
559
|
-
if (this.invalid && this.hasNoValueError()) {
|
|
560
|
-
this.resetErrorMessage();
|
|
561
|
-
}
|
|
562
521
|
}
|
|
563
522
|
else {
|
|
564
523
|
throw new Error(`<mg-input-combobox> prop "items" values must be the same type, string or Option. Passed value: ${toString(newValue)}.`);
|
|
@@ -626,7 +585,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
626
585
|
}
|
|
627
586
|
}
|
|
628
587
|
watchOptions(newValue) {
|
|
629
|
-
this.page = newValue.getPage(0, this.filter
|
|
588
|
+
this.page = newValue.getPage(0, Boolean(this.filter) ? this.optionsFilter : undefined);
|
|
630
589
|
}
|
|
631
590
|
watchFilter(newValue) {
|
|
632
591
|
this.loadingWrapper({ name: 'load-data' });
|
|
@@ -692,8 +651,8 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
692
651
|
throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');
|
|
693
652
|
}
|
|
694
653
|
else {
|
|
695
|
-
this.setValidity(valid
|
|
696
|
-
this.setErrorMessage();
|
|
654
|
+
this.setValidity(valid);
|
|
655
|
+
this.setErrorMessage(valid ? undefined : errorMessage);
|
|
697
656
|
this.hasDisplayedError = this.invalid;
|
|
698
657
|
}
|
|
699
658
|
}
|
|
@@ -713,7 +672,9 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
713
672
|
// - Keep everything in sync both inside and outside the component
|
|
714
673
|
return new Promise(resolve => {
|
|
715
674
|
requestAnimationFrame(() => {
|
|
716
|
-
this.
|
|
675
|
+
this.checkValidity();
|
|
676
|
+
this.errorMessage = undefined;
|
|
677
|
+
this.hasDisplayedError = false;
|
|
717
678
|
resolve();
|
|
718
679
|
});
|
|
719
680
|
});
|
|
@@ -736,34 +697,15 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
736
697
|
}
|
|
737
698
|
/**
|
|
738
699
|
* Method to set validity values
|
|
739
|
-
* @param
|
|
740
|
-
* @param customErrorMessage - custom error message
|
|
700
|
+
* @param newValue - valid new value
|
|
741
701
|
*/
|
|
742
|
-
setValidity(
|
|
743
|
-
var _a;
|
|
702
|
+
setValidity(newValue) {
|
|
744
703
|
const oldValidValue = this.valid;
|
|
745
|
-
|
|
746
|
-
// Set custom validity
|
|
747
|
-
if (!valid && this.input !== undefined) {
|
|
748
|
-
// custom errror, start by reset it
|
|
749
|
-
this.customError = undefined;
|
|
750
|
-
if (isValidString(customErrorMessage)) {
|
|
751
|
-
this.customError = customErrorMessage;
|
|
752
|
-
}
|
|
753
|
-
// no value
|
|
754
|
-
else if ((this.fetchurl === undefined ? ((_a = this.items) !== null && _a !== void 0 ? _a : []).length : this.page.total) === 0) {
|
|
755
|
-
this.customError = CustomError.NoValue;
|
|
756
|
-
}
|
|
757
|
-
// get new input validity from validity state
|
|
758
|
-
valid = this.input.checkValidity() && this.customError === undefined;
|
|
759
|
-
}
|
|
760
|
-
// set valid/invalid props
|
|
761
|
-
this.valid = valid;
|
|
704
|
+
this.valid = newValue;
|
|
762
705
|
this.invalid = !this.valid;
|
|
763
706
|
// We need to send valid event even if it is the same value
|
|
764
|
-
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
|
|
707
|
+
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
|
|
765
708
|
this.inputValid.emit(this.valid);
|
|
766
|
-
}
|
|
767
709
|
}
|
|
768
710
|
/*************
|
|
769
711
|
* Lifecycle *
|
|
@@ -804,19 +746,15 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
804
746
|
const listId = `${this.identifier}-list`;
|
|
805
747
|
const readonlyValue = this.getValueTitle();
|
|
806
748
|
const withResetButton = this.value && !this.disabled;
|
|
807
|
-
const disabled = this.disabled || this.hasNoValueError();
|
|
808
749
|
let popoverContent;
|
|
809
|
-
if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0)
|
|
750
|
+
if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0)
|
|
810
751
|
popoverContent = 'list';
|
|
811
|
-
|
|
812
|
-
else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && this.filter.length > 0) {
|
|
752
|
+
else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && Boolean(this.filter))
|
|
813
753
|
popoverContent = 'notfound';
|
|
814
|
-
|
|
815
|
-
else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0) {
|
|
754
|
+
else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0)
|
|
816
755
|
popoverContent = 'notavailable';
|
|
817
|
-
}
|
|
818
756
|
let activeDescendant;
|
|
819
|
-
if (
|
|
757
|
+
if (Boolean((_d = this.option) === null || _d === void 0 ? void 0 : _d.value)) {
|
|
820
758
|
activeDescendant = this.option.value;
|
|
821
759
|
}
|
|
822
760
|
else if (typeof this.value === 'string') {
|
|
@@ -825,12 +763,12 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
825
763
|
else {
|
|
826
764
|
activeDescendant = (_e = this.value) === null || _e === void 0 ? void 0 : _e.value;
|
|
827
765
|
}
|
|
828
|
-
return (h("mg-input", { key: '
|
|
766
|
+
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: {
|
|
829
767
|
'--mg-c-input-list-width': Boolean((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) ? `${this.input.offsetWidth}px` : undefined,
|
|
830
|
-
}, "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: 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) => {
|
|
768
|
+
}, "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) => {
|
|
831
769
|
if (el !== null)
|
|
832
770
|
this.input = el;
|
|
833
|
-
} }), withResetButton ? (h("mg-button", { class: "mg-c-input__box-append mg-c-input__reset", variant: "flat", "is-icon": true, label: this.messages.general.reset, "aria-controls": this.identifier, tabindex: "-1", onClick: this.handleResetButton
|
|
771
|
+
} }), withResetButton ? (h("mg-button", { class: "mg-c-input__box-append mg-c-input__reset", variant: "flat", "is-icon": true, label: this.messages.general.reset, "aria-controls": this.identifier, tabindex: "-1", onClick: this.handleResetButton }, h("mg-icon", { icon: "cross" }))) : (h("mg-button", { class: "mg-c-input__box-append", variant: "flat", "is-icon": true, label: this.itemsLabel, tabindex: "-1", disabled: this.disabled }, h("mg-icon", { icon: `chevron-${this.popoverDisplay ? 'up' : 'down'}` })))), h("div", { slot: "content", class: "mg-c-input__popover-container" }, popoverContent === 'list' && [
|
|
834
772
|
// eslint-disable-next-line jsx-a11y/role-supports-aria-props
|
|
835
773
|
h("ul", { key: "list", class: "mg-c-input__input-list", role: "listbox", id: listId, "aria-label": this.itemsLabel, "aria-setsize": this.page.total }, this.page.items.map(option => {
|
|
836
774
|
var _a;
|
|
@@ -886,7 +824,6 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
886
824
|
"fetchurl": [1],
|
|
887
825
|
"fetchoptions": [16],
|
|
888
826
|
"fetchmappings": [16],
|
|
889
|
-
"noValueErrorDetail": [1, "no-value-error-detail"],
|
|
890
827
|
"valid": [1028],
|
|
891
828
|
"invalid": [1028],
|
|
892
829
|
"isLoading": [32],
|
|
@@ -919,7 +856,7 @@ function defineCustomElement$1() {
|
|
|
919
856
|
if (typeof customElements === "undefined") {
|
|
920
857
|
return;
|
|
921
858
|
}
|
|
922
|
-
const components = ["mg-input-combobox", "mg-button", "mg-card", "mg-
|
|
859
|
+
const components = ["mg-input-combobox", "mg-button", "mg-card", "mg-icon", "mg-input", "mg-input-title", "mg-loader", "mg-popover", "mg-popover-content", "mg-tooltip", "mg-tooltip-content"];
|
|
923
860
|
components.forEach(tagName => { switch (tagName) {
|
|
924
861
|
case "mg-input-combobox":
|
|
925
862
|
if (!customElements.get(tagName)) {
|
|
@@ -927,16 +864,11 @@ function defineCustomElement$1() {
|
|
|
927
864
|
}
|
|
928
865
|
break;
|
|
929
866
|
case "mg-button":
|
|
930
|
-
if (!customElements.get(tagName)) {
|
|
931
|
-
defineCustomElement$c();
|
|
932
|
-
}
|
|
933
|
-
break;
|
|
934
|
-
case "mg-card":
|
|
935
867
|
if (!customElements.get(tagName)) {
|
|
936
868
|
defineCustomElement$b();
|
|
937
869
|
}
|
|
938
870
|
break;
|
|
939
|
-
case "mg-
|
|
871
|
+
case "mg-card":
|
|
940
872
|
if (!customElements.get(tagName)) {
|
|
941
873
|
defineCustomElement$a();
|
|
942
874
|
}
|
|
@@ -2,7 +2,6 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, i as isValidString, o as dateRegExp, p as dateToString, t as toString } from './index2.js';
|
|
3
3
|
import { l as localeDate, a as localeDatePattern, i as initLocales } from './index3.js';
|
|
4
4
|
import { d as defineCustomElement$5, c as classReadonly, a as classDisabled } from './mg-input2.js';
|
|
5
|
-
import { d as defineCustomElement$7 } from './mg-details2.js';
|
|
6
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
7
6
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
8
7
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
@@ -13,9 +12,11 @@ const DEFAULT_MAX_DATE = '9999-12-31';
|
|
|
13
12
|
const mgInputDateCss = ".mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}";
|
|
14
13
|
|
|
15
14
|
const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends HTMLElement {
|
|
16
|
-
constructor() {
|
|
15
|
+
constructor(registerHost) {
|
|
17
16
|
super();
|
|
18
|
-
|
|
17
|
+
if (registerHost !== false) {
|
|
18
|
+
this.__registerHost();
|
|
19
|
+
}
|
|
19
20
|
this.__attachShadow();
|
|
20
21
|
this.valueChange = createEvent(this, "value-change", 7);
|
|
21
22
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
@@ -71,7 +72,6 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
71
72
|
* @returns formated pattern help text. Ex: Format attendu : jj/mm/aaaa (ex : 20/12/2020)
|
|
72
73
|
*/
|
|
73
74
|
this.formatHelpText = (helpText) => {
|
|
74
|
-
var _a, _b;
|
|
75
75
|
// If the component is in readonly mode, return directly because the message will not be rendered
|
|
76
76
|
if (this.readonly) {
|
|
77
77
|
return undefined;
|
|
@@ -84,23 +84,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
84
84
|
text = text.replace(defaultHelpTextVariable, this.formatHelpText(this.messages.input.date.helpText.expectedFormat));
|
|
85
85
|
}
|
|
86
86
|
// Replace pattern and date variables
|
|
87
|
-
|
|
88
|
-
// Add additional message for min/max if necessary
|
|
89
|
-
let rangeMessage;
|
|
90
|
-
if (((_a = this.min) === null || _a === void 0 ? void 0 : _a.length) > 0 && this.max !== DEFAULT_MAX_DATE) {
|
|
91
|
-
rangeMessage = this.messages.input.date.helpText.minMax.replace('{min}', localeDate(this.min, this.systemLocale)).replace('{max}', localeDate(this.max, this.systemLocale));
|
|
92
|
-
}
|
|
93
|
-
else if (((_b = this.min) === null || _b === void 0 ? void 0 : _b.length) > 0) {
|
|
94
|
-
rangeMessage = this.messages.input.date.helpText.min.replace('{min}', localeDate(this.min, this.systemLocale));
|
|
95
|
-
}
|
|
96
|
-
else if (this.max !== DEFAULT_MAX_DATE) {
|
|
97
|
-
rangeMessage = this.messages.input.date.helpText.max.replace('{max}', localeDate(this.max, this.systemLocale));
|
|
98
|
-
}
|
|
99
|
-
// Combine custom helpText with range message if both exist
|
|
100
|
-
if (text !== undefined && rangeMessage !== undefined) {
|
|
101
|
-
return `${text}<br>${rangeMessage}`;
|
|
102
|
-
}
|
|
103
|
-
return text;
|
|
87
|
+
return text.replace('{pattern}', this.renderPattern()).replace('{date}', localeDate(dateToString(new Date('2025-12-24')), this.systemLocale));
|
|
104
88
|
};
|
|
105
89
|
/**
|
|
106
90
|
* Handle input event
|
|
@@ -190,7 +174,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
190
174
|
}
|
|
191
175
|
// min, max & minMax
|
|
192
176
|
else if (['min', 'max', 'minMax'].includes(inputError)) {
|
|
193
|
-
this.errorMessage = this.messages.input.date.
|
|
177
|
+
this.errorMessage = this.messages.input.date.error[inputError]
|
|
194
178
|
.replace('{min}', localeDate(this.min, this.systemLocale))
|
|
195
179
|
.replace('{max}', localeDate(this.max, this.systemLocale));
|
|
196
180
|
}
|
|
@@ -375,7 +359,7 @@ const MgInputDate$1 = /*@__PURE__*/ proxyCustomElement(class MgInputDate extends
|
|
|
375
359
|
* @returns HTML Element
|
|
376
360
|
*/
|
|
377
361
|
render() {
|
|
378
|
-
return (h("mg-input", { key: '
|
|
362
|
+
return (h("mg-input", { key: '31c223be6c69af4ffa89f74102c41a27040ad031', 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) => {
|
|
379
363
|
if (el !== null)
|
|
380
364
|
this.input = el;
|
|
381
365
|
} }))));
|
|
@@ -425,18 +409,13 @@ function defineCustomElement$1() {
|
|
|
425
409
|
if (typeof customElements === "undefined") {
|
|
426
410
|
return;
|
|
427
411
|
}
|
|
428
|
-
const components = ["mg-input-date", "mg-
|
|
412
|
+
const components = ["mg-input-date", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
429
413
|
components.forEach(tagName => { switch (tagName) {
|
|
430
414
|
case "mg-input-date":
|
|
431
415
|
if (!customElements.get(tagName)) {
|
|
432
416
|
customElements.define(tagName, MgInputDate$1);
|
|
433
417
|
}
|
|
434
418
|
break;
|
|
435
|
-
case "mg-details":
|
|
436
|
-
if (!customElements.get(tagName)) {
|
|
437
|
-
defineCustomElement$7();
|
|
438
|
-
}
|
|
439
|
-
break;
|
|
440
419
|
case "mg-icon":
|
|
441
420
|
if (!customElements.get(tagName)) {
|
|
442
421
|
defineCustomElement$6();
|
|
@@ -2,7 +2,6 @@ import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/i
|
|
|
2
2
|
import { C as ClassList, i as isValidString, t as toString } from './index2.js';
|
|
3
3
|
import { b as localeNumber, c as localeUnit, d as localePercent, e as localeCurrency, i as initLocales } from './index3.js';
|
|
4
4
|
import { d as defineCustomElement$5, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
|
|
5
|
-
import { d as defineCustomElement$7 } from './mg-details2.js';
|
|
6
5
|
import { d as defineCustomElement$6 } from './mg-icon2.js';
|
|
7
6
|
import { d as defineCustomElement$4 } from './mg-input-title2.js';
|
|
8
7
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
@@ -17,9 +16,11 @@ const formats = ['none', 'number', 'currency', 'percent', 'unit'];
|
|
|
17
16
|
const mgInputNumericCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);overflow-wrap:anywhere}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}a{color:inherit;text-decoration:underline}a:hover,a:focus,a:active{text-decoration:none}.mg-c-input .mg-c-input__box{width:auto;text-align:var(--mg-c-input-text-align, right)}";
|
|
18
17
|
|
|
19
18
|
const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric extends HTMLElement {
|
|
20
|
-
constructor() {
|
|
19
|
+
constructor(registerHost) {
|
|
21
20
|
super();
|
|
22
|
-
|
|
21
|
+
if (registerHost !== false) {
|
|
22
|
+
this.__registerHost();
|
|
23
|
+
}
|
|
23
24
|
this.__attachShadow();
|
|
24
25
|
this.valueChange = createEvent(this, "value-change", 7);
|
|
25
26
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
@@ -146,7 +147,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
146
147
|
else {
|
|
147
148
|
const formattedMin = this.formatErrorValue(this.min);
|
|
148
149
|
const formattedMax = this.formatErrorValue(this.max);
|
|
149
|
-
this.errorMessage = this.messages.input.numeric.
|
|
150
|
+
this.errorMessage = this.messages.input.numeric.error[inputError].replace('{min}', formattedMin).replace('{max}', formattedMax);
|
|
150
151
|
}
|
|
151
152
|
}
|
|
152
153
|
};
|
|
@@ -225,23 +226,8 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
225
226
|
if (this.min === undefined && this.max === undefined && text === undefined) {
|
|
226
227
|
return undefined;
|
|
227
228
|
}
|
|
228
|
-
// Generate range message based on available constraints
|
|
229
|
-
let rangeMessage;
|
|
230
|
-
if (this.min !== undefined && this.max !== undefined) {
|
|
231
|
-
rangeMessage = this.messages.input.numeric.helpText.minMax.replace('{min}', this.formatErrorValue(this.min)).replace('{max}', this.formatErrorValue(this.max));
|
|
232
|
-
}
|
|
233
|
-
else if (this.min !== undefined) {
|
|
234
|
-
rangeMessage = this.messages.input.numeric.helpText.min.replace('{min}', this.formatErrorValue(this.min));
|
|
235
|
-
}
|
|
236
|
-
else if (this.max !== undefined) {
|
|
237
|
-
rangeMessage = this.messages.input.numeric.helpText.max.replace('{max}', this.formatErrorValue(this.max));
|
|
238
|
-
}
|
|
239
|
-
// Combine custom helpText with range message if both exist
|
|
240
|
-
if (text !== undefined && rangeMessage !== undefined) {
|
|
241
|
-
return `${text}<br>${rangeMessage}`;
|
|
242
|
-
}
|
|
243
229
|
// Return either custom helpText or range message
|
|
244
|
-
return text
|
|
230
|
+
return text;
|
|
245
231
|
};
|
|
246
232
|
/**
|
|
247
233
|
* Renders the readonly content of the input component.
|
|
@@ -476,7 +462,7 @@ const MgInputNumeric$1 = /*@__PURE__*/ proxyCustomElement(class MgInputNumeric e
|
|
|
476
462
|
* @returns HTML Element
|
|
477
463
|
*/
|
|
478
464
|
render() {
|
|
479
|
-
return (h("mg-input", { key: '
|
|
465
|
+
return (h("mg-input", { key: '43e41f72e4cc4cf15a565167cee9e65035935e1f', 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
|
|
480
466
|
? this.readonlyValue && this.renderReadonly()
|
|
481
467
|
: [
|
|
482
468
|
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) => {
|
|
@@ -551,18 +537,13 @@ function defineCustomElement$1() {
|
|
|
551
537
|
if (typeof customElements === "undefined") {
|
|
552
538
|
return;
|
|
553
539
|
}
|
|
554
|
-
const components = ["mg-input-numeric", "mg-
|
|
540
|
+
const components = ["mg-input-numeric", "mg-icon", "mg-input", "mg-input-title", "mg-tooltip", "mg-tooltip-content"];
|
|
555
541
|
components.forEach(tagName => { switch (tagName) {
|
|
556
542
|
case "mg-input-numeric":
|
|
557
543
|
if (!customElements.get(tagName)) {
|
|
558
544
|
customElements.define(tagName, MgInputNumeric$1);
|
|
559
545
|
}
|
|
560
546
|
break;
|
|
561
|
-
case "mg-details":
|
|
562
|
-
if (!customElements.get(tagName)) {
|
|
563
|
-
defineCustomElement$7();
|
|
564
|
-
}
|
|
565
|
-
break;
|
|
566
547
|
case "mg-icon":
|
|
567
548
|
if (!customElements.get(tagName)) {
|
|
568
549
|
defineCustomElement$6();
|