@mgdis/mg-components 6.14.0 → 6.15.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/{index-DzBkSgSK.js → index-BGxkpQwi.js} +7 -1
- package/dist/cjs/{index-DUJwxnoi.js → index-CpENFzEo.js} +2 -2
- package/dist/cjs/{index-CwjAofQ1.js → index-iUZvsp-F.js} +55 -31
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +431 -208
- package/dist/cjs/mg-alert.cjs.entry.js +4 -4
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-input-combobox.cjs.entry.js +145 -81
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +1248 -16004
- package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-CwjEAih3.js} +7 -0
- package/dist/cjs/mg-input.utils-D-ASK4ua.js +49 -0
- package/dist/cjs/mg-loader.cjs.entry.js +4 -4
- package/dist/cjs/mg-progress.cjs.entry.js +3 -3
- package/dist/collection/assets/icons/index.js +1 -1
- package/dist/collection/collection-manifest.json +2 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +6 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +93 -22
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.utils.js +21 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +2 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +49 -106
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +123 -48
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +140 -56
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +6 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +63 -10
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +54 -6
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +2 -2
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +142 -9
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +2 -2
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-table/mg-table.js +2 -2
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/locales/en/messages.json +23 -14
- package/dist/collection/locales/fr/messages.json +24 -15
- package/dist/components/index2.js +3 -3
- package/dist/components/index3.js +55 -31
- package/dist/components/mg-action-more.js +2 -2
- package/dist/components/mg-alert.js +2 -2
- package/dist/components/mg-badge2.js +1 -1
- package/dist/components/mg-button2.js +1 -1
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-character-left2.js +1 -1
- package/dist/components/mg-details.js +1 -97
- package/dist/components/mg-details2.js +99 -0
- package/dist/components/mg-divider2.js +1 -1
- package/dist/components/mg-form.js +2 -2
- package/dist/components/mg-icon2.js +1 -1
- package/dist/components/mg-illustrated-message.js +2 -2
- package/dist/components/mg-input-checkbox-paginated2.js +43 -124
- package/dist/components/mg-input-checkbox.js +136 -62
- package/dist/components/mg-input-combobox.js +135 -63
- package/dist/components/mg-input-date.js +9 -3
- package/dist/components/mg-input-numeric.js +14 -3
- package/dist/components/mg-input-password.js +10 -4
- package/dist/components/mg-input-radio.js +54 -13
- package/dist/components/mg-input-rich-text-editor.js +1266 -16016
- package/dist/components/mg-input-select2.js +45 -9
- package/dist/components/mg-input-text2.js +10 -4
- package/dist/components/mg-input-textarea.js +10 -4
- package/dist/components/mg-input-title2.js +1 -1
- package/dist/components/mg-input-toggle.js +97 -12
- package/dist/components/mg-input.utils.js +24 -0
- package/dist/components/mg-input2.js +100 -23
- package/dist/components/mg-item-more2.js +2 -2
- package/dist/components/mg-loader2.js +2 -2
- package/dist/components/mg-menu-item2.js +1 -1
- package/dist/components/mg-message2.js +3 -3
- package/dist/components/mg-modal.js +3 -3
- package/dist/components/mg-pagination.js +233 -1
- package/dist/components/mg-panel.js +14 -8
- package/dist/components/mg-popover-content2.js +2 -2
- package/dist/components/mg-popover2.js +2 -2
- package/dist/components/mg-progress.js +2 -2
- package/dist/components/mg-skip-links.js +2 -2
- package/dist/components/mg-table.js +3 -3
- package/dist/components/mg-tabs.js +1 -311
- package/dist/components/mg-tabs2.js +313 -0
- package/dist/components/mg-tag.js +1 -1
- package/dist/components/mg-tooltip-content2.js +1 -1
- package/dist/components/mg-tooltip2.js +2 -2
- package/dist/esm/{index-Bv7NHR-W.js → index-CKB-AnCZ.js} +55 -31
- package/dist/esm/{index-Degtjvph.js → index-DhAOnZJn.js} +7 -1
- package/dist/esm/{index-Dr7GYvIz.js → index-WtiuOkLj.js} +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +426 -203
- package/dist/esm/mg-alert.entry.js +4 -4
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-input-combobox.entry.js +125 -61
- package/dist/esm/mg-input-rich-text-editor.entry.js +1249 -16005
- package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-BAUTlb6r.js} +7 -1
- package/dist/esm/mg-input.utils-BYI03zSi.js +46 -0
- package/dist/esm/mg-loader.entry.js +4 -4
- package/dist/esm/mg-progress.entry.js +3 -3
- package/dist/mg-components/locales/en/messages.json +23 -14
- package/dist/mg-components/locales/fr/messages.json +24 -15
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-31856cff.entry.js +1 -0
- package/dist/mg-components/{p-056ba467.entry.js → p-420daa1e.entry.js} +1 -1
- package/dist/mg-components/{p-d13a6fdc.entry.js → p-47e19783.entry.js} +1 -1
- package/dist/mg-components/p-67af6274.entry.js +1 -0
- package/dist/mg-components/p-698dfc6c.entry.js +1 -0
- package/dist/mg-components/p-BAUTlb6r.js +1 -0
- package/dist/mg-components/p-CKB-AnCZ.js +1 -0
- package/dist/mg-components/p-DhAOnZJn.js +2 -0
- package/dist/mg-components/p-PuX-pdL4.js +1 -0
- package/dist/mg-components/p-WtiuOkLj.js +1 -0
- package/dist/mg-components/p-a0fa44cf.entry.js +1 -0
- package/dist/types/assets/icons/index.d.ts +6 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +13 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +15 -4
- package/dist/types/components/molecules/inputs/mg-input/mg-input.utils.d.ts +8 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +17 -40
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +1 -2
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +36 -9
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +17 -3
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +18 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +18 -0
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +40 -4
- package/dist/types/components.d.ts +69 -40
- package/ide/intellij/web-types.json +148 -22
- package/ide/vscode/html-custom-data.json +143 -9
- package/package.json +15 -15
- package/dist/cjs/events.utils-D5SAtkpQ.js +0 -25
- package/dist/components/mg-pagination2.js +0 -229
- package/dist/esm/events.utils-yMGqY8YG.js +0 -23
- package/dist/mg-components/p-625c463c.entry.js +0 -1
- package/dist/mg-components/p-Bv7NHR-W.js +0 -1
- package/dist/mg-components/p-CNgv8hc5.js +0 -1
- package/dist/mg-components/p-Degtjvph.js +0 -2
- package/dist/mg-components/p-Dr7GYvIz.js +0 -1
- package/dist/mg-components/p-c522f3c1.entry.js +0 -1
- package/dist/mg-components/p-cac23bd7.entry.js +0 -1
- package/dist/mg-components/p-e75f5383.entry.js +0 -10
- package/dist/mg-components/p-yMGqY8YG.js +0 -1
|
@@ -1,22 +1,36 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import { C as ClassList,
|
|
3
|
-
import { d as defineCustomElement$
|
|
4
|
-
import { d as defineCustomElement$
|
|
2
|
+
import { C as ClassList, m as cleanString, i as isValidString, t as toString } from './index2.js';
|
|
3
|
+
import { d as defineCustomElement$9, a as MgInputCheckboxList } from './mg-input-checkbox-paginated2.js';
|
|
4
|
+
import { d as defineCustomElement$a, b as classFieldset, e as classVerticalList, c as classReadonly, a as classDisabled } from './mg-input2.js';
|
|
5
5
|
import { i as initLocales } from './index3.js';
|
|
6
|
+
import { d as defineErrorMessage } from './mg-input.utils.js';
|
|
7
|
+
import { d as defineCustomElement$4, S as Status } from './mg-tabs2.js';
|
|
8
|
+
import { d as defineCustomElement$g } from './mg-badge2.js';
|
|
6
9
|
import { d as defineCustomElement$f } from './mg-button2.js';
|
|
7
10
|
import { d as defineCustomElement$e } from './mg-card2.js';
|
|
8
11
|
import { d as defineCustomElement$d } from './mg-character-left2.js';
|
|
9
|
-
import { d as defineCustomElement$c } from './mg-
|
|
10
|
-
import { d as defineCustomElement$
|
|
12
|
+
import { d as defineCustomElement$c } from './mg-details2.js';
|
|
13
|
+
import { d as defineCustomElement$b } from './mg-icon2.js';
|
|
11
14
|
import { d as defineCustomElement$8 } from './mg-input-text2.js';
|
|
12
15
|
import { d as defineCustomElement$7 } from './mg-input-title2.js';
|
|
13
|
-
import { d as defineCustomElement$6 } from './mg-
|
|
14
|
-
import { d as defineCustomElement$5 } from './mg-
|
|
15
|
-
import { d as defineCustomElement$4 } from './mg-popover-content2.js';
|
|
16
|
+
import { d as defineCustomElement$6 } from './mg-popover2.js';
|
|
17
|
+
import { d as defineCustomElement$5 } from './mg-popover-content2.js';
|
|
16
18
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
17
19
|
import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
|
|
18
20
|
|
|
19
|
-
|
|
21
|
+
/**
|
|
22
|
+
* List of all availables checkbox type
|
|
23
|
+
*/
|
|
24
|
+
const checkboxTypes = ['checkbox', 'multi'];
|
|
25
|
+
/**
|
|
26
|
+
* mg-input-checkbox-paginated section kind value
|
|
27
|
+
*/
|
|
28
|
+
const SectionKind = {
|
|
29
|
+
SELECTED: 'selected',
|
|
30
|
+
NOT_SELECTED: 'not-selected',
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
const mgInputCheckboxCss = ".mg-c-input__error-details{margin:0}.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.mg-c-input--fieldset{padding:0;border:0;margin-right:0;margin-left:0}.mg-c-input.mg-c-input--fieldset input[type=radio],.mg-c-input.mg-c-input--fieldset input[type=checkbox]{width:var(--mg-c-input-check-size);height:var(--mg-c-input-check-size);flex-shrink:0;margin:calc((var(--mg-b-font-size)*var(--mg-b-line-height) - var(--mg-c-input-check-size))/2) var(--mg-b-size-8) 0 0}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group{display:flex;align-items:start}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group-container{display:flex;flex-wrap:wrap;padding:0;margin:0;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);gap:var(--mg-b-size-12) var(--mg-b-size-24);list-style:none}.mg-c-input.mg-c-input--fieldset .mg-c-input__input-group.mg-c-input__input-group--disabled label{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--fieldset.mg-c-input--vertical-list .mg-c-input__input-group-container,.mg-c-input.mg-c-input--fieldset.mg-c-input--checkbox-multi .mg-c-input__input-group-container{flex-direction:column}.mg-c-input.mg-c-input--fieldset.mg-c-input--label-on-top .mg-c-input__input-group-container{margin-top:var(--mg-b-size-8)}.mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;color:var(--mg-b-color-neutral-90);text-align:center}.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--checkbox-multi .mg-c-input__input-group-container{padding:var(--mg-b-size-4) var(--mg-b-size-8);margin:0}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container{display:flex;width:unset;flex:unset;flex-wrap:wrap;column-gap:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-container-list{display:flex;flex-flow:row wrap;padding:0;margin:0;gap:var(--mg-b-size-4);list-style:none}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tab{display:block;min-height:calc(var(--mg-b-size-4)*55)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs{min-height:0;flex-shrink:1}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs-action{padding-top:var(--mg-b-size-16);padding-bottom:var(--mg-b-size-12)}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__tabs-content{height:calc(24*var(--mg-b-size-8) - 2*var(--mg-b-size-8));overflow-y:auto}.mg-c-input.mg-c-input--checkbox-multi .mg-c-input__input-value{display:inline-flex;min-width:var(--mg-b-size-min-height);min-height:var(--mg-b-size-min-height);box-sizing:border-box;align-items:center;justify-content:center;padding:calc((var(--mg-b-size-min-height) - 2*var(--mg-b-size-border) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-12);border-radius:var(--mg-b-size-4);background-color:var(--mg-b-color-neutral-20);font-size:var(--mg-b-font-size)}.mg-c-input.mg-c-input--checkbox-multi b{margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--disabled .mg-c-input__input-container b{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--with-values .mg-c-input__input-container{gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content{display:flex;width:calc(var(--mg-b-size-floating-element-max-width) - var(--mg-b-size-16));flex-direction:column;gap:var(--mg-b-size-4)}.mg-c-input.mg-c-input--checkbox-multi.mg-c-input--search-mode .mg-c-input__content .mg-c-input__tabs-content{min-height:calc(var(--mg-b-size-4)*55)}.mg-c-input.mg-c-input--checkbox-multi:not(.mg-c-input--label-on-top) mg-tooltip:not(.mg-c-input__section-header-tootlip){margin-left:var(--mg-b-size-8)}.mg-c-input.mg-c-input--checkbox-multi mg-popover{--mg-c-card-spacing:var(--mg-b-size-8)}.mg-c-input.mg-c-input--readonly ul{display:flex;min-height:var(--mg-b-font-size);flex-flow:column wrap;padding:0;margin:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) 0 0;list-style:none;row-gap:var(--mg-b-size-8)}";
|
|
20
34
|
|
|
21
35
|
/**
|
|
22
36
|
* type CheckboxItem validation function
|
|
@@ -45,6 +59,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
45
59
|
this.searchStart = 10;
|
|
46
60
|
// popover variables
|
|
47
61
|
this.hasOpenedPopover = false;
|
|
62
|
+
this.checkboxesId = 'checkboxes-list';
|
|
48
63
|
/**
|
|
49
64
|
* Define input name
|
|
50
65
|
* If not set the value equals the identifier
|
|
@@ -103,6 +118,10 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
103
118
|
* Select values button text local key
|
|
104
119
|
*/
|
|
105
120
|
this.selectValuesButtonKey = 'editButton';
|
|
121
|
+
/**
|
|
122
|
+
* Define <mg-tabs> active-tab
|
|
123
|
+
*/
|
|
124
|
+
this.activeTab = 1;
|
|
106
125
|
/**
|
|
107
126
|
* Handle input event
|
|
108
127
|
* @param event - input event
|
|
@@ -151,6 +170,14 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
151
170
|
this.searchValue = event.detail;
|
|
152
171
|
event.stopPropagation();
|
|
153
172
|
};
|
|
173
|
+
/**
|
|
174
|
+
* Handle <mg-tabs> tab-change event
|
|
175
|
+
* @param event - tab change event
|
|
176
|
+
*/
|
|
177
|
+
this.handleActiveTabChange = (event) => {
|
|
178
|
+
this.activeTab = event.detail;
|
|
179
|
+
this.resetTabsLimit();
|
|
180
|
+
};
|
|
154
181
|
/**
|
|
155
182
|
* popover display-change handler
|
|
156
183
|
* @param event - mg-popover display-change custom event
|
|
@@ -164,26 +191,11 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
164
191
|
if (!event.detail) {
|
|
165
192
|
// reset search value
|
|
166
193
|
this.searchValue = '';
|
|
167
|
-
|
|
168
|
-
Array.from(this.element.shadowRoot.querySelectorAll('mg-input-checkbox-paginated')).forEach(element => {
|
|
169
|
-
element.currentPage = 1;
|
|
170
|
-
});
|
|
194
|
+
this.resetTabsLimit();
|
|
171
195
|
this.checkValidity();
|
|
172
196
|
}
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
* Handle select all button
|
|
176
|
-
* @param event - mass action event trigger a global select/unselect on values
|
|
177
|
-
*/
|
|
178
|
-
this.handleMassAction = (event) => {
|
|
179
|
-
const displayItems = this.getDisplayItems();
|
|
180
|
-
// update only displayed items
|
|
181
|
-
displayItems.forEach(item => {
|
|
182
|
-
if (item.disabled !== true) {
|
|
183
|
-
item.value = event.detail !== SectionKind.SELECTED;
|
|
184
|
-
}
|
|
185
|
-
});
|
|
186
|
-
this.updateValues();
|
|
197
|
+
// init active tab to selected if some values are checked
|
|
198
|
+
this.activeTab = this.checkboxItems.some(items => items.value) ? 2 : 1;
|
|
187
199
|
};
|
|
188
200
|
/**
|
|
189
201
|
* Update values
|
|
@@ -217,8 +229,18 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
217
229
|
* Check if input is valid
|
|
218
230
|
*/
|
|
219
231
|
this.checkValidity = () => {
|
|
220
|
-
this.setValidity(this.readonly || this.disabled || (!this.hasInvalidInput() && this.validateRequired()));
|
|
232
|
+
this.setValidity(this.readonly || this.disabled || (this.hasInputValue() && !this.hasInvalidInput() && this.validateRequired()));
|
|
221
233
|
};
|
|
234
|
+
/**
|
|
235
|
+
* Test if component has items
|
|
236
|
+
* @returns truthy if component has items
|
|
237
|
+
*/
|
|
238
|
+
this.hasInputValue = () => { var _a; return ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) > 0; };
|
|
239
|
+
/**
|
|
240
|
+
* Test if component has no value error message displayed
|
|
241
|
+
* @returns truthy if compent display no value error message
|
|
242
|
+
*/
|
|
243
|
+
this.hasNoValueErrorMessageDisplay = () => this.errorMessage === this.messages.errors.noValue;
|
|
222
244
|
/**
|
|
223
245
|
* Set button text locale key
|
|
224
246
|
*/
|
|
@@ -260,12 +282,25 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
260
282
|
// Set error message
|
|
261
283
|
this.errorMessage = undefined;
|
|
262
284
|
if (displayError && !this.valid) {
|
|
263
|
-
if (errorMessage !== undefined)
|
|
285
|
+
if (errorMessage !== undefined) {
|
|
264
286
|
this.errorMessage = errorMessage;
|
|
265
|
-
|
|
287
|
+
}
|
|
288
|
+
else if (!this.hasInputValue()) {
|
|
289
|
+
this.errorMessage = this.messages.errors.noValue;
|
|
290
|
+
}
|
|
291
|
+
else if (!this.validateRequired()) {
|
|
266
292
|
this.errorMessage = this.messages.errors.required;
|
|
293
|
+
}
|
|
267
294
|
}
|
|
268
295
|
};
|
|
296
|
+
/**
|
|
297
|
+
* Reset error message
|
|
298
|
+
*/
|
|
299
|
+
this.resetErrorMessage = () => {
|
|
300
|
+
this.checkValidity();
|
|
301
|
+
this.errorMessage = undefined;
|
|
302
|
+
this.hasDisplayedError = false;
|
|
303
|
+
};
|
|
269
304
|
/**
|
|
270
305
|
* Method to get mg-popover identifier
|
|
271
306
|
* @returns MgPopover identifier
|
|
@@ -281,23 +316,45 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
281
316
|
* @returns selected checkboxItems
|
|
282
317
|
*/
|
|
283
318
|
this.getSelectedItems = () => this.checkboxItems.filter(({ value }) => value);
|
|
319
|
+
/**
|
|
320
|
+
* Reset <mg-input-checkbox-paginated> limit state
|
|
321
|
+
*/
|
|
322
|
+
this.resetTabsLimit = () => {
|
|
323
|
+
Array.from(this.element.shadowRoot.querySelectorAll('mg-input-checkbox-paginated')).forEach(component => {
|
|
324
|
+
component.resetLimit();
|
|
325
|
+
});
|
|
326
|
+
};
|
|
284
327
|
/**
|
|
285
328
|
* Renders the readonly value of the input.
|
|
286
329
|
* @returns The rendered readonly value.
|
|
287
330
|
*/
|
|
288
331
|
this.renderReadonly = (readonlyValue) => {
|
|
289
|
-
|
|
332
|
+
if (Array.isArray(readonlyValue)) {
|
|
333
|
+
if (this.inputVerticalList) {
|
|
334
|
+
return (h("ul", { class: "mg-c-input__readonly-value" }, readonlyValue.map(value => (h("li", { key: value }, h("b", null, value))))));
|
|
335
|
+
}
|
|
336
|
+
else {
|
|
337
|
+
return h("b", { class: "mg-c-input__readonly-value" }, readonlyValue.join(', '));
|
|
338
|
+
}
|
|
339
|
+
}
|
|
290
340
|
};
|
|
291
341
|
/**
|
|
292
342
|
* Renders the MgInputCheckboxList component.
|
|
293
343
|
* @returns The rendered MgInputCheckboxList component.
|
|
294
344
|
*/
|
|
295
|
-
this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems,
|
|
345
|
+
this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems, id: this.checkboxesId, disabled: this.disabled, name: this.name, invalid: this.invalid }));
|
|
296
346
|
}
|
|
297
347
|
validateValue(newValue) {
|
|
298
|
-
if (
|
|
348
|
+
if ([null, undefined].includes(newValue) || newValue.length === 0) {
|
|
349
|
+
this.displayError();
|
|
350
|
+
}
|
|
351
|
+
else if (newValue.length > 0 && isCheckboxItems(newValue)) {
|
|
299
352
|
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this) })));
|
|
300
353
|
this.valueChange.emit(newValue);
|
|
354
|
+
// force to reset error when noValueError is displaied
|
|
355
|
+
if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
|
|
356
|
+
this.resetErrorMessage();
|
|
357
|
+
}
|
|
301
358
|
}
|
|
302
359
|
else {
|
|
303
360
|
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${toString(newValue)}.`);
|
|
@@ -441,9 +498,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
441
498
|
// - Keep everything in sync both inside and outside the component
|
|
442
499
|
return new Promise(resolve => {
|
|
443
500
|
requestAnimationFrame(() => {
|
|
444
|
-
this.
|
|
445
|
-
this.errorMessage = undefined;
|
|
446
|
-
this.hasDisplayedError = false;
|
|
501
|
+
this.resetErrorMessage();
|
|
447
502
|
resolve();
|
|
448
503
|
});
|
|
449
504
|
});
|
|
@@ -516,23 +571,30 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
516
571
|
* @param checkboxes - checkboxes to render
|
|
517
572
|
* @returns render sections of checkboxes
|
|
518
573
|
*/
|
|
519
|
-
|
|
574
|
+
renderCheckboxTabs(checkboxes, checkboxPaginatedProps) {
|
|
575
|
+
const handleMassAction = (kind) => () => {
|
|
576
|
+
const displayItems = this.getDisplayItems();
|
|
577
|
+
// update only displayed items
|
|
578
|
+
displayItems.forEach(item => {
|
|
579
|
+
if (!item.disabled) {
|
|
580
|
+
item.value = kind !== SectionKind.SELECTED;
|
|
581
|
+
}
|
|
582
|
+
});
|
|
583
|
+
this.updateValues();
|
|
584
|
+
};
|
|
520
585
|
const [checkedValues, notCheckedValues] = checkboxes.reduce((acc, curr) => {
|
|
521
586
|
acc[curr.value ? 0 : 1].push(curr);
|
|
522
587
|
return acc;
|
|
523
588
|
}, [[], []]);
|
|
524
|
-
const baseSection = {
|
|
525
|
-
readonly: this.readonly,
|
|
526
|
-
disabled: this.disabled,
|
|
527
|
-
identifier: this.identifier,
|
|
528
|
-
};
|
|
529
589
|
const sections = [
|
|
530
|
-
Object.assign(Object.assign({},
|
|
531
|
-
Object.assign(Object.assign({},
|
|
590
|
+
Object.assign(Object.assign({}, checkboxPaginatedProps), { checkboxes: notCheckedValues, messages: Object.assign(Object.assign({}, this.messages.input.checkbox.sections.notSelected), { showMore: this.messages.input.showMore }), handleMassAction: handleMassAction(SectionKind.NOT_SELECTED) }),
|
|
591
|
+
Object.assign(Object.assign({}, checkboxPaginatedProps), { checkboxes: checkedValues, messages: Object.assign(Object.assign({}, this.messages.input.checkbox.sections.selected), { showMore: this.messages.input.showMore }), handleMassAction: handleMassAction(SectionKind.SELECTED) }),
|
|
532
592
|
];
|
|
533
|
-
return sections
|
|
534
|
-
|
|
535
|
-
|
|
593
|
+
return (h("mg-tabs", { identifier: `${this.identifier}-tabs`, class: "mg-c-input__tabs", label: this.messages.input.checkbox.sections.label, items: sections.map((section, key) => ({
|
|
594
|
+
label: section.messages.title,
|
|
595
|
+
badge: { value: section.checkboxes.length, label: this.messages.input.checkbox.sections.badge.label, role: 'information' },
|
|
596
|
+
status: key + 1 === this.activeTab ? Status.ACTIVE : Status.VISIBLE,
|
|
597
|
+
})), activeTab: this.activeTab, "onActive-tab-change": this.handleActiveTabChange }, sections.map((section, key) => (h("mg-input-checkbox-paginated", Object.assign({ class: "mg-c-input__tab", slot: `tab_content-${key + 1}` }, section, { key: section.messages.title }), section.checkboxes.length > 0 && section.checkboxes.some(checkbox => checkbox.disabled !== true) && (h("mg-tooltip", { slot: "header-action", class: "mg-c-input__tabs-action", message: section.messages.tooltip }, h("mg-button", { variant: "link", onClick: section.handleMassAction }, section.messages.action))))))));
|
|
536
598
|
}
|
|
537
599
|
/**
|
|
538
600
|
* render checkbox multi element
|
|
@@ -541,22 +603,27 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
541
603
|
renderCheckboxMulti() {
|
|
542
604
|
const selectedValuesNb = this.getSelectedItems().length;
|
|
543
605
|
const checkboxes = this.getDisplayItems();
|
|
606
|
+
const checkboxPaginatedProps = {
|
|
607
|
+
readonly: this.readonly,
|
|
608
|
+
disabled: this.disabled,
|
|
609
|
+
identifier: this.identifier,
|
|
610
|
+
};
|
|
544
611
|
return (h("div", { class: "mg-c-input__input-container" }, h("mg-popover", { arrowHide: true, identifier: this.getMgPopoverIdentifier(), display: this.hasOpenedPopover, "onDisplay-change": this.handleMgPopoverDisplayChange, ref: (el) => {
|
|
545
612
|
if (el !== null)
|
|
546
613
|
this.mgPopover = el;
|
|
547
614
|
} }, h("mg-button", { variant: "secondary", "aria-describedby": `${this.identifier}-title` }, h("mg-icon", { icon: "list" }), this.getSelectValuesButtonMessage()), h("div", { slot: "content", class: "mg-c-input__content" }, this.displaySearchInput ? ([
|
|
548
|
-
h("mg-input-text", { key: "input-search", identifier: `${this.identifier}-input-search`, icon: "magnifying-glass", type: "search", placeholder: this.messages.input.checkbox.label, label: this.messages.input.checkbox.label, mgWidth: "full", value: this.searchValue, labelHide: true, characterLeftHide: true, name: "q", "onValue-change": this.handleSearchChange
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
]) : (h(MgInputCheckboxList, { checkboxes: checkboxes, displaySearchInput: this.displaySearchInput, messages: this.messages.input.checkbox, id: "checkboxes-list", disabled: this.disabled, name: this.name, invalid: this.invalid })), this.displaySearchInput && checkboxes.length === 0 && h("p", { class: "mg-c-input__input-no-result" }, this.messages.input.checkbox.noResult))), this.displaySelectedValues ? (selectedValuesNb > 0 && (h("ul", { role: "list", class: "mg-c-input__input-container-list" }, this.getSelectedItems().map(({ title }) => (h("li", { class: "mg-c-input__input-value", key: title }, title)))))) : (h("b", null, this.messages.input.checkbox[selectedValuesNb > 1 ? 'selectedValues' : 'selectedValue'].replace('{nb}', selectedValuesNb)))));
|
|
615
|
+
h("mg-input-text", { key: "input-search", identifier: `${this.identifier}-input-search`, icon: "magnifying-glass", type: "search", placeholder: this.messages.input.checkbox.sections.search.label, label: this.messages.input.checkbox.sections.search.label, mgWidth: "full", value: this.searchValue, labelHide: true, characterLeftHide: true, name: "q", "onValue-change": this.handleSearchChange }),
|
|
616
|
+
this.searchValue.length > 0 ? (h("mg-input-checkbox-paginated", Object.assign({ class: "mg-c-input__tab" }, checkboxPaginatedProps, { messages: Object.assign(Object.assign({}, this.messages.input.checkbox.sections.search), { showMore: this.messages.input.showMore }), checkboxes: checkboxes, key: "search" }))) : (this.renderCheckboxTabs(checkboxes, checkboxPaginatedProps)),
|
|
617
|
+
]) : (h(MgInputCheckboxList, { checkboxes: checkboxes, id: this.checkboxesId, disabled: this.disabled, name: this.name, invalid: this.invalid })))), this.displaySelectedValues ? (selectedValuesNb > 0 && (h("ul", { role: "list", class: "mg-c-input__input-container-list" }, this.getSelectedItems().map(({ title }) => (h("li", { class: "mg-c-input__input-value", key: title }, title)))))) : (h("b", null, this.messages.input.checkbox[selectedValuesNb > 1 ? 'selectedValues' : 'selectedValue'].replace('{nb}', selectedValuesNb)))));
|
|
552
618
|
}
|
|
553
619
|
/**
|
|
554
620
|
* Render
|
|
555
621
|
* @returns HTML Element
|
|
556
622
|
*/
|
|
557
623
|
render() {
|
|
624
|
+
var _a;
|
|
558
625
|
let inputContent;
|
|
559
|
-
const readonlyValue = this.value.filter(({ value }) => value).map(({ title }) => title);
|
|
626
|
+
const readonlyValue = ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(({ value }) => value).map(({ title }) => title);
|
|
560
627
|
if (this.readonly) {
|
|
561
628
|
inputContent = this.renderReadonly(readonlyValue);
|
|
562
629
|
}
|
|
@@ -566,7 +633,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
566
633
|
else {
|
|
567
634
|
inputContent = this.renderCheckboxMulti();
|
|
568
635
|
}
|
|
569
|
-
return (h("mg-input", { key: '
|
|
636
|
+
return (h("mg-input", { key: '6b1a72d80387da057c0d20367e141c90ff921889', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? defineErrorMessage(this.errorMessage, this.noValueErrorDetail) : undefined }, inputContent));
|
|
570
637
|
}
|
|
571
638
|
get element() { return this; }
|
|
572
639
|
static get watchers() { return {
|
|
@@ -582,7 +649,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
582
649
|
"searchValue": ["validateSearchValue"]
|
|
583
650
|
}; }
|
|
584
651
|
static get style() { return mgInputCheckboxCss; }
|
|
585
|
-
}, [
|
|
652
|
+
}, [257, "mg-input-checkbox", {
|
|
586
653
|
"value": [1040],
|
|
587
654
|
"type": [1025],
|
|
588
655
|
"identifier": [1],
|
|
@@ -603,6 +670,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
603
670
|
"editButtonMessage": [1, "edit-button-message"],
|
|
604
671
|
"showButtonMessage": [1, "show-button-message"],
|
|
605
672
|
"selectButtonMessage": [1, "select-button-message"],
|
|
673
|
+
"noValueErrorDetail": [1, "no-value-error-detail"],
|
|
606
674
|
"classCollection": [32],
|
|
607
675
|
"errorMessage": [32],
|
|
608
676
|
"checkboxItems": [32],
|
|
@@ -610,6 +678,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
610
678
|
"searchValue": [32],
|
|
611
679
|
"searchResults": [32],
|
|
612
680
|
"selectValuesButtonKey": [32],
|
|
681
|
+
"activeTab": [32],
|
|
613
682
|
"setFocus": [64],
|
|
614
683
|
"displayError": [64],
|
|
615
684
|
"setError": [64],
|
|
@@ -630,13 +699,18 @@ function defineCustomElement$1() {
|
|
|
630
699
|
if (typeof customElements === "undefined") {
|
|
631
700
|
return;
|
|
632
701
|
}
|
|
633
|
-
const components = ["mg-input-checkbox", "mg-button", "mg-card", "mg-character-left", "mg-
|
|
702
|
+
const components = ["mg-input-checkbox", "mg-badge", "mg-button", "mg-card", "mg-character-left", "mg-details", "mg-icon", "mg-input", "mg-input-checkbox-paginated", "mg-input-text", "mg-input-title", "mg-popover", "mg-popover-content", "mg-tabs", "mg-tooltip", "mg-tooltip-content"];
|
|
634
703
|
components.forEach(tagName => { switch (tagName) {
|
|
635
704
|
case "mg-input-checkbox":
|
|
636
705
|
if (!customElements.get(tagName)) {
|
|
637
706
|
customElements.define(tagName, MgInputCheckbox$1);
|
|
638
707
|
}
|
|
639
708
|
break;
|
|
709
|
+
case "mg-badge":
|
|
710
|
+
if (!customElements.get(tagName)) {
|
|
711
|
+
defineCustomElement$g();
|
|
712
|
+
}
|
|
713
|
+
break;
|
|
640
714
|
case "mg-button":
|
|
641
715
|
if (!customElements.get(tagName)) {
|
|
642
716
|
defineCustomElement$f();
|
|
@@ -652,22 +726,22 @@ function defineCustomElement$1() {
|
|
|
652
726
|
defineCustomElement$d();
|
|
653
727
|
}
|
|
654
728
|
break;
|
|
655
|
-
case "mg-
|
|
729
|
+
case "mg-details":
|
|
656
730
|
if (!customElements.get(tagName)) {
|
|
657
731
|
defineCustomElement$c();
|
|
658
732
|
}
|
|
659
733
|
break;
|
|
660
|
-
case "mg-
|
|
734
|
+
case "mg-icon":
|
|
661
735
|
if (!customElements.get(tagName)) {
|
|
662
736
|
defineCustomElement$b();
|
|
663
737
|
}
|
|
664
738
|
break;
|
|
665
|
-
case "mg-input
|
|
739
|
+
case "mg-input":
|
|
666
740
|
if (!customElements.get(tagName)) {
|
|
667
741
|
defineCustomElement$a();
|
|
668
742
|
}
|
|
669
743
|
break;
|
|
670
|
-
case "mg-input-
|
|
744
|
+
case "mg-input-checkbox-paginated":
|
|
671
745
|
if (!customElements.get(tagName)) {
|
|
672
746
|
defineCustomElement$9();
|
|
673
747
|
}
|
|
@@ -682,17 +756,17 @@ function defineCustomElement$1() {
|
|
|
682
756
|
defineCustomElement$7();
|
|
683
757
|
}
|
|
684
758
|
break;
|
|
685
|
-
case "mg-
|
|
759
|
+
case "mg-popover":
|
|
686
760
|
if (!customElements.get(tagName)) {
|
|
687
761
|
defineCustomElement$6();
|
|
688
762
|
}
|
|
689
763
|
break;
|
|
690
|
-
case "mg-popover":
|
|
764
|
+
case "mg-popover-content":
|
|
691
765
|
if (!customElements.get(tagName)) {
|
|
692
766
|
defineCustomElement$5();
|
|
693
767
|
}
|
|
694
768
|
break;
|
|
695
|
-
case "mg-
|
|
769
|
+
case "mg-tabs":
|
|
696
770
|
if (!customElements.get(tagName)) {
|
|
697
771
|
defineCustomElement$4();
|
|
698
772
|
}
|