@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
|
@@ -4,6 +4,8 @@ import { checkboxTypes, SectionKind } from "./mg-input-checkbox.conf";
|
|
|
4
4
|
import { MgInputCheckboxList } from "./MgInputCheckboxList";
|
|
5
5
|
import { classDisabled, classReadonly, classFieldset, classVerticalList } from "../mg-input/mg-input.conf";
|
|
6
6
|
import { initLocales } from "../../../../locales";
|
|
7
|
+
import { defineErrorMessage } from "../mg-input/mg-input.utils";
|
|
8
|
+
import { Status } from "../../mg-tabs/mg-tabs.conf";
|
|
7
9
|
/**
|
|
8
10
|
* type CheckboxItem validation function
|
|
9
11
|
* @param items - Checkbox item
|
|
@@ -26,6 +28,7 @@ export class MgInputCheckbox {
|
|
|
26
28
|
this.searchStart = 10;
|
|
27
29
|
// popover variables
|
|
28
30
|
this.hasOpenedPopover = false;
|
|
31
|
+
this.checkboxesId = 'checkboxes-list';
|
|
29
32
|
/**
|
|
30
33
|
* Define input name
|
|
31
34
|
* If not set the value equals the identifier
|
|
@@ -84,6 +87,10 @@ export class MgInputCheckbox {
|
|
|
84
87
|
* Select values button text local key
|
|
85
88
|
*/
|
|
86
89
|
this.selectValuesButtonKey = 'editButton';
|
|
90
|
+
/**
|
|
91
|
+
* Define <mg-tabs> active-tab
|
|
92
|
+
*/
|
|
93
|
+
this.activeTab = 1;
|
|
87
94
|
/**
|
|
88
95
|
* Handle input event
|
|
89
96
|
* @param event - input event
|
|
@@ -132,6 +139,14 @@ export class MgInputCheckbox {
|
|
|
132
139
|
this.searchValue = event.detail;
|
|
133
140
|
event.stopPropagation();
|
|
134
141
|
};
|
|
142
|
+
/**
|
|
143
|
+
* Handle <mg-tabs> tab-change event
|
|
144
|
+
* @param event - tab change event
|
|
145
|
+
*/
|
|
146
|
+
this.handleActiveTabChange = (event) => {
|
|
147
|
+
this.activeTab = event.detail;
|
|
148
|
+
this.resetTabsLimit();
|
|
149
|
+
};
|
|
135
150
|
/**
|
|
136
151
|
* popover display-change handler
|
|
137
152
|
* @param event - mg-popover display-change custom event
|
|
@@ -145,26 +160,11 @@ export class MgInputCheckbox {
|
|
|
145
160
|
if (!event.detail) {
|
|
146
161
|
// reset search value
|
|
147
162
|
this.searchValue = '';
|
|
148
|
-
|
|
149
|
-
Array.from(this.element.shadowRoot.querySelectorAll('mg-input-checkbox-paginated')).forEach(element => {
|
|
150
|
-
element.currentPage = 1;
|
|
151
|
-
});
|
|
163
|
+
this.resetTabsLimit();
|
|
152
164
|
this.checkValidity();
|
|
153
165
|
}
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
* Handle select all button
|
|
157
|
-
* @param event - mass action event trigger a global select/unselect on values
|
|
158
|
-
*/
|
|
159
|
-
this.handleMassAction = (event) => {
|
|
160
|
-
const displayItems = this.getDisplayItems();
|
|
161
|
-
// update only displayed items
|
|
162
|
-
displayItems.forEach(item => {
|
|
163
|
-
if (item.disabled !== true) {
|
|
164
|
-
item.value = event.detail !== SectionKind.SELECTED;
|
|
165
|
-
}
|
|
166
|
-
});
|
|
167
|
-
this.updateValues();
|
|
166
|
+
// init active tab to selected if some values are checked
|
|
167
|
+
this.activeTab = this.checkboxItems.some(items => items.value) ? 2 : 1;
|
|
168
168
|
};
|
|
169
169
|
/**
|
|
170
170
|
* Update values
|
|
@@ -198,8 +198,18 @@ export class MgInputCheckbox {
|
|
|
198
198
|
* Check if input is valid
|
|
199
199
|
*/
|
|
200
200
|
this.checkValidity = () => {
|
|
201
|
-
this.setValidity(this.readonly || this.disabled || (!this.hasInvalidInput() && this.validateRequired()));
|
|
201
|
+
this.setValidity(this.readonly || this.disabled || (this.hasInputValue() && !this.hasInvalidInput() && this.validateRequired()));
|
|
202
202
|
};
|
|
203
|
+
/**
|
|
204
|
+
* Test if component has items
|
|
205
|
+
* @returns truthy if component has items
|
|
206
|
+
*/
|
|
207
|
+
this.hasInputValue = () => { var _a; return ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) > 0; };
|
|
208
|
+
/**
|
|
209
|
+
* Test if component has no value error message displayed
|
|
210
|
+
* @returns truthy if compent display no value error message
|
|
211
|
+
*/
|
|
212
|
+
this.hasNoValueErrorMessageDisplay = () => this.errorMessage === this.messages.errors.noValue;
|
|
203
213
|
/**
|
|
204
214
|
* Set button text locale key
|
|
205
215
|
*/
|
|
@@ -241,12 +251,25 @@ export class MgInputCheckbox {
|
|
|
241
251
|
// Set error message
|
|
242
252
|
this.errorMessage = undefined;
|
|
243
253
|
if (displayError && !this.valid) {
|
|
244
|
-
if (errorMessage !== undefined)
|
|
254
|
+
if (errorMessage !== undefined) {
|
|
245
255
|
this.errorMessage = errorMessage;
|
|
246
|
-
|
|
256
|
+
}
|
|
257
|
+
else if (!this.hasInputValue()) {
|
|
258
|
+
this.errorMessage = this.messages.errors.noValue;
|
|
259
|
+
}
|
|
260
|
+
else if (!this.validateRequired()) {
|
|
247
261
|
this.errorMessage = this.messages.errors.required;
|
|
262
|
+
}
|
|
248
263
|
}
|
|
249
264
|
};
|
|
265
|
+
/**
|
|
266
|
+
* Reset error message
|
|
267
|
+
*/
|
|
268
|
+
this.resetErrorMessage = () => {
|
|
269
|
+
this.checkValidity();
|
|
270
|
+
this.errorMessage = undefined;
|
|
271
|
+
this.hasDisplayedError = false;
|
|
272
|
+
};
|
|
250
273
|
/**
|
|
251
274
|
* Method to get mg-popover identifier
|
|
252
275
|
* @returns MgPopover identifier
|
|
@@ -262,23 +285,45 @@ export class MgInputCheckbox {
|
|
|
262
285
|
* @returns selected checkboxItems
|
|
263
286
|
*/
|
|
264
287
|
this.getSelectedItems = () => this.checkboxItems.filter(({ value }) => value);
|
|
288
|
+
/**
|
|
289
|
+
* Reset <mg-input-checkbox-paginated> limit state
|
|
290
|
+
*/
|
|
291
|
+
this.resetTabsLimit = () => {
|
|
292
|
+
Array.from(this.element.shadowRoot.querySelectorAll('mg-input-checkbox-paginated')).forEach(component => {
|
|
293
|
+
component.resetLimit();
|
|
294
|
+
});
|
|
295
|
+
};
|
|
265
296
|
/**
|
|
266
297
|
* Renders the readonly value of the input.
|
|
267
298
|
* @returns The rendered readonly value.
|
|
268
299
|
*/
|
|
269
300
|
this.renderReadonly = (readonlyValue) => {
|
|
270
|
-
|
|
301
|
+
if (Array.isArray(readonlyValue)) {
|
|
302
|
+
if (this.inputVerticalList) {
|
|
303
|
+
return (h("ul", { class: "mg-c-input__readonly-value" }, readonlyValue.map(value => (h("li", { key: value }, h("b", null, value))))));
|
|
304
|
+
}
|
|
305
|
+
else {
|
|
306
|
+
return h("b", { class: "mg-c-input__readonly-value" }, readonlyValue.join(', '));
|
|
307
|
+
}
|
|
308
|
+
}
|
|
271
309
|
};
|
|
272
310
|
/**
|
|
273
311
|
* Renders the MgInputCheckboxList component.
|
|
274
312
|
* @returns The rendered MgInputCheckboxList component.
|
|
275
313
|
*/
|
|
276
|
-
this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems,
|
|
314
|
+
this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems, id: this.checkboxesId, disabled: this.disabled, name: this.name, invalid: this.invalid }));
|
|
277
315
|
}
|
|
278
316
|
validateValue(newValue) {
|
|
279
|
-
if (
|
|
317
|
+
if ([null, undefined].includes(newValue) || newValue.length === 0) {
|
|
318
|
+
this.displayError();
|
|
319
|
+
}
|
|
320
|
+
else if (newValue.length > 0 && isCheckboxItems(newValue)) {
|
|
280
321
|
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) })));
|
|
281
322
|
this.valueChange.emit(newValue);
|
|
323
|
+
// force to reset error when noValueError is displaied
|
|
324
|
+
if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
|
|
325
|
+
this.resetErrorMessage();
|
|
326
|
+
}
|
|
282
327
|
}
|
|
283
328
|
else {
|
|
284
329
|
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${toString(newValue)}.`);
|
|
@@ -422,9 +467,7 @@ export class MgInputCheckbox {
|
|
|
422
467
|
// - Keep everything in sync both inside and outside the component
|
|
423
468
|
return new Promise(resolve => {
|
|
424
469
|
requestAnimationFrame(() => {
|
|
425
|
-
this.
|
|
426
|
-
this.errorMessage = undefined;
|
|
427
|
-
this.hasDisplayedError = false;
|
|
470
|
+
this.resetErrorMessage();
|
|
428
471
|
resolve();
|
|
429
472
|
});
|
|
430
473
|
});
|
|
@@ -497,23 +540,30 @@ export class MgInputCheckbox {
|
|
|
497
540
|
* @param checkboxes - checkboxes to render
|
|
498
541
|
* @returns render sections of checkboxes
|
|
499
542
|
*/
|
|
500
|
-
|
|
543
|
+
renderCheckboxTabs(checkboxes, checkboxPaginatedProps) {
|
|
544
|
+
const handleMassAction = (kind) => () => {
|
|
545
|
+
const displayItems = this.getDisplayItems();
|
|
546
|
+
// update only displayed items
|
|
547
|
+
displayItems.forEach(item => {
|
|
548
|
+
if (!item.disabled) {
|
|
549
|
+
item.value = kind !== SectionKind.SELECTED;
|
|
550
|
+
}
|
|
551
|
+
});
|
|
552
|
+
this.updateValues();
|
|
553
|
+
};
|
|
501
554
|
const [checkedValues, notCheckedValues] = checkboxes.reduce((acc, curr) => {
|
|
502
555
|
acc[curr.value ? 0 : 1].push(curr);
|
|
503
556
|
return acc;
|
|
504
557
|
}, [[], []]);
|
|
505
|
-
const baseSection = {
|
|
506
|
-
readonly: this.readonly,
|
|
507
|
-
disabled: this.disabled,
|
|
508
|
-
identifier: this.identifier,
|
|
509
|
-
};
|
|
510
558
|
const sections = [
|
|
511
|
-
Object.assign(Object.assign({},
|
|
512
|
-
Object.assign(Object.assign({},
|
|
559
|
+
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) }),
|
|
560
|
+
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) }),
|
|
513
561
|
];
|
|
514
|
-
return sections
|
|
515
|
-
|
|
516
|
-
|
|
562
|
+
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) => ({
|
|
563
|
+
label: section.messages.title,
|
|
564
|
+
badge: { value: section.checkboxes.length, label: this.messages.input.checkbox.sections.badge.label, role: 'information' },
|
|
565
|
+
status: key + 1 === this.activeTab ? Status.ACTIVE : Status.VISIBLE,
|
|
566
|
+
})), 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))))))));
|
|
517
567
|
}
|
|
518
568
|
/**
|
|
519
569
|
* render checkbox multi element
|
|
@@ -522,22 +572,27 @@ export class MgInputCheckbox {
|
|
|
522
572
|
renderCheckboxMulti() {
|
|
523
573
|
const selectedValuesNb = this.getSelectedItems().length;
|
|
524
574
|
const checkboxes = this.getDisplayItems();
|
|
575
|
+
const checkboxPaginatedProps = {
|
|
576
|
+
readonly: this.readonly,
|
|
577
|
+
disabled: this.disabled,
|
|
578
|
+
identifier: this.identifier,
|
|
579
|
+
};
|
|
525
580
|
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) => {
|
|
526
581
|
if (el !== null)
|
|
527
582
|
this.mgPopover = el;
|
|
528
583
|
} }, 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 ? ([
|
|
529
|
-
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
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
]) : (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)))));
|
|
584
|
+
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 }),
|
|
585
|
+
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)),
|
|
586
|
+
]) : (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)))));
|
|
533
587
|
}
|
|
534
588
|
/**
|
|
535
589
|
* Render
|
|
536
590
|
* @returns HTML Element
|
|
537
591
|
*/
|
|
538
592
|
render() {
|
|
593
|
+
var _a;
|
|
539
594
|
let inputContent;
|
|
540
|
-
const readonlyValue = this.value.filter(({ value }) => value).map(({ title }) => title);
|
|
595
|
+
const readonlyValue = ((_a = this.value) !== null && _a !== void 0 ? _a : []).filter(({ value }) => value).map(({ title }) => title);
|
|
541
596
|
if (this.readonly) {
|
|
542
597
|
inputContent = this.renderReadonly(readonlyValue);
|
|
543
598
|
}
|
|
@@ -547,7 +602,7 @@ export class MgInputCheckbox {
|
|
|
547
602
|
else {
|
|
548
603
|
inputContent = this.renderCheckboxMulti();
|
|
549
604
|
}
|
|
550
|
-
return (h("mg-input", { key: '
|
|
605
|
+
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));
|
|
551
606
|
}
|
|
552
607
|
static get is() { return "mg-input-checkbox"; }
|
|
553
608
|
static get encapsulation() { return "shadow"; }
|
|
@@ -922,7 +977,7 @@ export class MgInputCheckbox {
|
|
|
922
977
|
"references": {}
|
|
923
978
|
},
|
|
924
979
|
"required": false,
|
|
925
|
-
"optional":
|
|
980
|
+
"optional": true,
|
|
926
981
|
"docs": {
|
|
927
982
|
"tags": [],
|
|
928
983
|
"text": "Overwrite default \"edit\" button message"
|
|
@@ -941,7 +996,7 @@ export class MgInputCheckbox {
|
|
|
941
996
|
"references": {}
|
|
942
997
|
},
|
|
943
998
|
"required": false,
|
|
944
|
-
"optional":
|
|
999
|
+
"optional": true,
|
|
945
1000
|
"docs": {
|
|
946
1001
|
"tags": [],
|
|
947
1002
|
"text": "Overwrite default \"show\" button message"
|
|
@@ -960,7 +1015,7 @@ export class MgInputCheckbox {
|
|
|
960
1015
|
"references": {}
|
|
961
1016
|
},
|
|
962
1017
|
"required": false,
|
|
963
|
-
"optional":
|
|
1018
|
+
"optional": true,
|
|
964
1019
|
"docs": {
|
|
965
1020
|
"tags": [],
|
|
966
1021
|
"text": "Overwrite default \"select\" button message"
|
|
@@ -968,6 +1023,25 @@ export class MgInputCheckbox {
|
|
|
968
1023
|
"getter": false,
|
|
969
1024
|
"setter": false,
|
|
970
1025
|
"reflect": false
|
|
1026
|
+
},
|
|
1027
|
+
"noValueErrorDetail": {
|
|
1028
|
+
"type": "string",
|
|
1029
|
+
"attribute": "no-value-error-detail",
|
|
1030
|
+
"mutable": false,
|
|
1031
|
+
"complexType": {
|
|
1032
|
+
"original": "string",
|
|
1033
|
+
"resolved": "string",
|
|
1034
|
+
"references": {}
|
|
1035
|
+
},
|
|
1036
|
+
"required": false,
|
|
1037
|
+
"optional": true,
|
|
1038
|
+
"docs": {
|
|
1039
|
+
"tags": [],
|
|
1040
|
+
"text": "Define no value error detail"
|
|
1041
|
+
},
|
|
1042
|
+
"getter": false,
|
|
1043
|
+
"setter": false,
|
|
1044
|
+
"reflect": false
|
|
971
1045
|
}
|
|
972
1046
|
};
|
|
973
1047
|
}
|
|
@@ -979,7 +1053,8 @@ export class MgInputCheckbox {
|
|
|
979
1053
|
"displaySearchInput": {},
|
|
980
1054
|
"searchValue": {},
|
|
981
1055
|
"searchResults": {},
|
|
982
|
-
"selectValuesButtonKey": {}
|
|
1056
|
+
"selectValuesButtonKey": {},
|
|
1057
|
+
"activeTab": {}
|
|
983
1058
|
};
|
|
984
1059
|
}
|
|
985
1060
|
static get events() {
|