@mgdis/mg-components 6.14.0 → 6.16.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-DUJwxnoi.js → index-CpENFzEo.js} +2 -2
- package/dist/cjs/{index-DzBkSgSK.js → index-T3-qWqFE.js} +8 -2
- package/dist/cjs/{index-CwjAofQ1.js → index-YM1EJx9X.js} +43 -31
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +136 -150
- 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 +15 -13
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +1247 -16003
- 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-checkbox/MgInputCheckboxList.js +1 -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 +55 -36
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +11 -9
- 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 +1 -1
- 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 +1 -1
- 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 +1 -1
- 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 +19 -15
- package/dist/collection/locales/fr/messages.json +20 -16
- package/dist/components/index2.js +3 -3
- package/dist/components/index3.js +43 -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 +2 -2
- 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 +42 -124
- package/dist/components/mg-input-checkbox.js +89 -59
- package/dist/components/mg-input-combobox.js +14 -12
- package/dist/components/mg-input-date.js +2 -2
- package/dist/components/mg-input-numeric.js +7 -2
- package/dist/components/mg-input-password.js +2 -2
- package/dist/components/mg-input-radio.js +2 -2
- package/dist/components/mg-input-rich-text-editor.js +1247 -16003
- package/dist/components/mg-input-select2.js +2 -2
- package/dist/components/mg-input-text2.js +2 -2
- package/dist/components/mg-input-textarea.js +2 -2
- package/dist/components/mg-input-title2.js +1 -1
- package/dist/components/mg-input-toggle.js +2 -2
- package/dist/components/mg-input2.js +1 -1
- 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 +227 -1
- package/dist/components/mg-panel.js +3 -3
- 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-Bab8_u8S.js} +43 -31
- package/dist/esm/{index-Degtjvph.js → index-JHj_9FSs.js} +8 -2
- 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 +136 -150
- 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 +15 -13
- package/dist/esm/mg-input-rich-text-editor.entry.js +1248 -16004
- 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 +19 -15
- package/dist/mg-components/locales/fr/messages.json +20 -16
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-056ba467.entry.js → p-42a90251.entry.js} +1 -1
- package/dist/mg-components/p-54156253.entry.js +1 -0
- package/dist/mg-components/{p-d13a6fdc.entry.js → p-658f828c.entry.js} +1 -1
- package/dist/mg-components/{p-c522f3c1.entry.js → p-82455ac7.entry.js} +1 -1
- package/dist/mg-components/p-Bab8_u8S.js +1 -0
- package/dist/mg-components/p-JHj_9FSs.js +2 -0
- package/dist/mg-components/p-WtiuOkLj.js +1 -0
- package/dist/mg-components/p-abbd151c.entry.js +1 -0
- package/dist/mg-components/p-c85b5d10.entry.js +1 -0
- package/dist/types/assets/icons/index.d.ts +6 -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 +15 -6
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +1 -1
- package/dist/types/components.d.ts +6 -33
- package/ide/intellij/web-types.json +13 -13
- package/ide/vscode/html-custom-data.json +39 -3
- package/package.json +23 -23
- package/dist/components/mg-pagination2.js +0 -229
- 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-Degtjvph.js +0 -2
- package/dist/mg-components/p-Dr7GYvIz.js +0 -1
- package/dist/mg-components/p-cac23bd7.entry.js +0 -1
- package/dist/mg-components/p-e75f5383.entry.js +0 -10
|
@@ -14,8 +14,8 @@
|
|
|
14
14
|
"components/atoms/mg-tooltip/mg-tooltip.js",
|
|
15
15
|
"components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js",
|
|
16
16
|
"components/molecules/inputs/mg-input/mg-input.js",
|
|
17
|
-
"components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js",
|
|
18
17
|
"components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js",
|
|
18
|
+
"components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js",
|
|
19
19
|
"components/molecules/inputs/mg-input-combobox/mg-input-combobox.js",
|
|
20
20
|
"components/molecules/inputs/mg-input-date/mg-input-date.js",
|
|
21
21
|
"components/molecules/inputs/mg-input-numeric/mg-input-numeric.js",
|
|
@@ -45,7 +45,7 @@
|
|
|
45
45
|
],
|
|
46
46
|
"compiler": {
|
|
47
47
|
"name": "@stencil/core",
|
|
48
|
-
"version": "4.36.
|
|
48
|
+
"version": "4.36.3",
|
|
49
49
|
"typescriptVersion": "5.5.4"
|
|
50
50
|
},
|
|
51
51
|
"collections": [],
|
|
@@ -139,7 +139,7 @@ export class MgIcon {
|
|
|
139
139
|
"mutable": false,
|
|
140
140
|
"complexType": {
|
|
141
141
|
"original": "IconType",
|
|
142
|
-
"resolved": "\"filter\" | \"link\" | \"picture\" | \"table\" | \"circle\" | \"download\" | \"key\" | \"list\" | \"copy\" | \"history\" | \"location\" | \"loader\" | \"address-card\" | \"address-card-outline\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"arrows-up-down\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building-outline\" | \"calculator\" | \"calculator-outline\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-outline\" | \"comment-sms\" | \"conversation\" | \"conversation-outline\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-outline\" | \"eye-slash\" | \"eye-slash-outline\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-download\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-checked\" | \"floppy-disk-checked-outline\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-euro\" | \"hand-euro-outline\" | \"hand-up\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"laptop\" | \"layers\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-outline\" | \"paper-plane-slash\" | \"paper-plane-slash-outline\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"tag\" | \"tag-outline\" | \"tags\" | \"tags-outline\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"universal-access-outline\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-group-outline\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"",
|
|
142
|
+
"resolved": "\"filter\" | \"link\" | \"picture\" | \"table\" | \"circle\" | \"download\" | \"key\" | \"list\" | \"copy\" | \"history\" | \"location\" | \"loader\" | \"address-card\" | \"address-card-outline\" | \"align-center\" | \"align-justify\" | \"align-left\" | \"align-right\" | \"api\" | \"archive\" | \"archive-outline\" | \"arrow-clock\" | \"arrow-down\" | \"arrow-down-a-z\" | \"arrow-down-right\" | \"arrow-left\" | \"arrow-right\" | \"arrow-rotate\" | \"arrow-rotate-backward\" | \"arrow-up\" | \"arrow-up-right\" | \"arrow-up-right-square\" | \"arrow-up-z-a\" | \"arrows-compare\" | \"arrows-right-down\" | \"arrows-right-left\" | \"arrows-rotate\" | \"arrows-rotate-backward\" | \"arrows-up-down\" | \"ban\" | \"bell\" | \"bell-outline\" | \"book\" | \"book-outline\" | \"briefcase\" | \"briefcase-outline\" | \"building-outline\" | \"calculator\" | \"calculator-outline\" | \"calendar\" | \"calendar-euro\" | \"calendar-euro-outline\" | \"calendar-outline\" | \"check\" | \"check-circle\" | \"check-circle-outline\" | \"chevron-down\" | \"chevron-down-circle\" | \"chevron-left\" | \"chevron-left-circle\" | \"chevron-right\" | \"chevron-right-circle\" | \"chevron-up\" | \"chevron-up-circle\" | \"clock\" | \"clock-outline\" | \"code-square-outline\" | \"cog\" | \"cog-outline\" | \"comment\" | \"comment-exclamation\" | \"comment-exclamation-outline\" | \"comment-outline\" | \"comment-question\" | \"comment-question-outline\" | \"comment-sms\" | \"conversation\" | \"conversation-outline\" | \"copy-file\" | \"copy-file-outline\" | \"copy-outline\" | \"credit-card\" | \"cross\" | \"cross-circle\" | \"cross-circle-outline\" | \"dashboard\" | \"dashboard-outline\" | \"earth\" | \"earth-outline\" | \"ellipsis\" | \"ellipsis-vertical\" | \"euro\" | \"euro-circle\" | \"exclamation-circle\" | \"exclamation-circle-outline\" | \"exclamation-stamp\" | \"exclamation-triangle\" | \"exclamation-triangle-outline\" | \"eye\" | \"eye-outline\" | \"eye-slash\" | \"eye-slash-outline\" | \"fax\" | \"fax-outline\" | \"file\" | \"file-cog\" | \"file-download\" | \"file-excel\" | \"file-excel-outline\" | \"file-outline\" | \"file-pdf\" | \"file-pdf-outline\" | \"file-text\" | \"file-text-outline\" | \"file-upload\" | \"file-word\" | \"file-word-outline\" | \"filter-outline\" | \"floppy-disk\" | \"floppy-disk-checked\" | \"floppy-disk-checked-outline\" | \"floppy-disk-outline\" | \"folder\" | \"folder-check\" | \"folder-check-outline\" | \"folder-lines\" | \"folder-lines-outline\" | \"folder-link\" | \"folder-link-outline\" | \"folder-outline\" | \"folder-star\" | \"folders\" | \"folders-outline\" | \"gavel\" | \"gavel-outline\" | \"graduation-cap\" | \"graduation-cap-outline\" | \"hand-euro\" | \"hand-euro-outline\" | \"hand-up\" | \"home\" | \"home-outline\" | \"info-circle\" | \"info-circle-outline\" | \"interrogation-circle\" | \"interrogation-circle-outline\" | \"laptop\" | \"layers\" | \"life-ring\" | \"lines-rectangle\" | \"lines-rectangle-outline\" | \"location-outline\" | \"lock\" | \"lock-outline\" | \"log-in\" | \"log-out\" | \"magnifying-glass\" | \"mail\" | \"mail-open\" | \"mail-open-outline\" | \"mail-outline\" | \"messages-square\" | \"messages-square-outline\" | \"mobile\" | \"mobile-outline\" | \"notes\" | \"notes-outline\" | \"paper-plane\" | \"paper-plane-outline\" | \"paper-plane-slash\" | \"paper-plane-slash-outline\" | \"paperclip\" | \"pen\" | \"pen-circle\" | \"pen-fancy\" | \"pen-fancy-files-outline\" | \"pen-fancy-outline\" | \"pen-outline\" | \"phone\" | \"phone-outline\" | \"picture-outline\" | \"play-circle\" | \"plus\" | \"plus-circle\" | \"share\" | \"share-outline\" | \"shuffle\" | \"sitemap\" | \"sliders\" | \"sliders-outline\" | \"squares\" | \"star\" | \"star-outline\" | \"tag\" | \"tag-outline\" | \"tags\" | \"tags-outline\" | \"thumb-down\" | \"thumb-down-outline\" | \"thumb-up\" | \"thumb-up-outline\" | \"thumbtack\" | \"thumbtack-outline\" | \"trash\" | \"trash-outline\" | \"universal-access\" | \"universal-access-outline\" | \"unlink\" | \"unlock\" | \"unlock-outline\" | \"upload\" | \"user\" | \"user-circle\" | \"user-group\" | \"user-group-outline\" | \"user-lock\" | \"user-outline\" | \"user-pen-fancy-outline\" | \"user-plus\" | \"user-question-outline\" | \"user-shield\" | \"user-shield-outline\" | \"users\" | \"users-outline\" | \"wallet\" | \"wallet-outline\"",
|
|
143
143
|
"references": {
|
|
144
144
|
"IconType": {
|
|
145
145
|
"location": "import",
|
package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js
CHANGED
|
@@ -4,7 +4,7 @@ import { h } from "@stencil/core";
|
|
|
4
4
|
* @param props - MgInputCheckboxList Interface Props
|
|
5
5
|
* @returns input template
|
|
6
6
|
*/
|
|
7
|
-
export const MgInputCheckboxList = (props) => (h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-
|
|
7
|
+
export const MgInputCheckboxList = (props) => (h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-labelledby": props.labelledby, id: props.id }, props.checkboxes.map(input => {
|
|
8
8
|
var _a, _b;
|
|
9
9
|
return (h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } }, h("input", { type: "checkbox", id: input._id, name: props.name, value: (_a = input.value) === null || _a === void 0 ? void 0 : _a.toString(), checked: Boolean(input.value), required: input.required, "aria-invalid": ((_b = props.invalid) === null || _b === void 0 ? void 0 : _b.toString()) || 'false', disabled: props.disabled || input.disabled, indeterminate: input.value === null, onInput: input._handleInput, onBlur: input._handleBlur, onKeyDown: input._handleKeydown }), h("label", { htmlFor: input._id }, input.title)));
|
|
10
10
|
})));
|
|
@@ -1,16 +1,13 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import { SectionKind } from "../mg-input-checkbox.conf";
|
|
3
2
|
import { MgInputCheckboxList } from "../MgInputCheckboxList";
|
|
3
|
+
import { formatID } from "@mgdis/core-ui-helpers/dist/utils";
|
|
4
4
|
/**
|
|
5
5
|
* Internal component use to manage sections instances
|
|
6
6
|
* @internal
|
|
7
7
|
*/
|
|
8
8
|
export class MgInputCheckboxPaginated {
|
|
9
9
|
constructor() {
|
|
10
|
-
|
|
11
|
-
* Constantes *
|
|
12
|
-
*************/
|
|
13
|
-
this.offset = 10;
|
|
10
|
+
this.step = 10;
|
|
14
11
|
/*************
|
|
15
12
|
* Decorators *
|
|
16
13
|
*************/
|
|
@@ -23,76 +20,45 @@ export class MgInputCheckboxPaginated {
|
|
|
23
20
|
*/
|
|
24
21
|
this.disabled = false;
|
|
25
22
|
/**
|
|
26
|
-
*
|
|
27
|
-
*/
|
|
28
|
-
this.currentPage = 1;
|
|
29
|
-
/**
|
|
30
|
-
* Define checkboxes to paginate
|
|
31
|
-
*/
|
|
32
|
-
this.checkboxes = [];
|
|
33
|
-
/**
|
|
34
|
-
* Is checked items values expanded
|
|
23
|
+
* Page items limit to display
|
|
35
24
|
*/
|
|
36
|
-
this.
|
|
25
|
+
this.limit = this.step;
|
|
37
26
|
/***********
|
|
38
27
|
* Methods *
|
|
39
28
|
***********/
|
|
40
29
|
/**
|
|
41
|
-
*
|
|
30
|
+
* Component has next checkboxes to display
|
|
31
|
+
* @returns truthy if have next elements
|
|
42
32
|
*/
|
|
43
|
-
this.
|
|
44
|
-
this.
|
|
33
|
+
this.hasNext = () => {
|
|
34
|
+
return this.checkboxes.length > this.limit;
|
|
45
35
|
};
|
|
46
36
|
/**
|
|
47
|
-
*
|
|
37
|
+
* Set items from checkboxes and limit
|
|
48
38
|
*/
|
|
49
|
-
this.
|
|
50
|
-
this.
|
|
39
|
+
this.setItems = () => {
|
|
40
|
+
this.items = this.checkboxes.slice(0, this.limit);
|
|
51
41
|
};
|
|
52
42
|
/**
|
|
53
|
-
*
|
|
54
|
-
* @param from - array start index
|
|
55
|
-
* @param to - array end index
|
|
56
|
-
* @returns array's range
|
|
57
|
-
*/
|
|
58
|
-
this.getArrayRange = (array, from, to) => array.slice(from, to);
|
|
59
|
-
/**
|
|
60
|
-
* Method to get page count from items
|
|
61
|
-
* @param items - items to count
|
|
62
|
-
* @returns page count from items
|
|
63
|
-
*/
|
|
64
|
-
this.getPageCount = (items) => ((items === null || items === void 0 ? void 0 : items.length) > 0 ? Math.ceil(items.length / this.offset) : 0);
|
|
65
|
-
/**
|
|
66
|
-
* Handle mg-pagination current page change event
|
|
67
|
-
* @param event - pagination current page change event
|
|
43
|
+
* Handle load-more <mg-button> click event
|
|
68
44
|
*/
|
|
69
|
-
this.
|
|
70
|
-
this.
|
|
45
|
+
this.handleLoadMore = () => {
|
|
46
|
+
if (this.hasNext()) {
|
|
47
|
+
this.limit += this.step;
|
|
48
|
+
}
|
|
71
49
|
};
|
|
72
50
|
}
|
|
73
|
-
watchCheckboxes(
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
if (pageCountNewValue === 1 || (pageCountNewValue !== 0 && this.currentPage === 0)) {
|
|
79
|
-
this.currentPage = 1;
|
|
80
|
-
}
|
|
81
|
-
// when old items page numbers match the current page AND new items page number is lower than current page, we set the new last page
|
|
82
|
-
else if (pageCountOldValue === this.currentPage && pageCountNewValue < this.currentPage) {
|
|
83
|
-
this.currentPage--;
|
|
84
|
-
}
|
|
85
|
-
this.sectionKind = newValue[0].value ? SectionKind.SELECTED : SectionKind.NOT_SELECTED;
|
|
51
|
+
watchCheckboxes() {
|
|
52
|
+
this.setItems();
|
|
53
|
+
}
|
|
54
|
+
watchLimit() {
|
|
55
|
+
this.setItems();
|
|
86
56
|
}
|
|
87
57
|
/**
|
|
88
|
-
*
|
|
89
|
-
* @returns [from,to] index
|
|
58
|
+
* Method to reset limit
|
|
90
59
|
*/
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
const from = isFirstPage ? 0 : (this.currentPage - 1) * this.offset;
|
|
94
|
-
const to = isFirstPage ? this.offset : this.currentPage * this.offset;
|
|
95
|
-
return [from, to];
|
|
60
|
+
async resetLimit() {
|
|
61
|
+
this.limit = this.step;
|
|
96
62
|
}
|
|
97
63
|
/*************
|
|
98
64
|
* Lifecycle *
|
|
@@ -101,18 +67,16 @@ export class MgInputCheckboxPaginated {
|
|
|
101
67
|
* Validate props
|
|
102
68
|
*/
|
|
103
69
|
componentWillLoad() {
|
|
104
|
-
this.watchCheckboxes(
|
|
70
|
+
this.watchCheckboxes();
|
|
105
71
|
}
|
|
106
72
|
/**
|
|
107
73
|
* Render
|
|
108
74
|
* @returns HTML Element
|
|
109
75
|
*/
|
|
110
76
|
render() {
|
|
111
|
-
const
|
|
112
|
-
const
|
|
113
|
-
|
|
114
|
-
return (h(Host, { key: 'ee67aa1705efa2b88010748b6978e0c1dec6e4de', hidden: this.checkboxes.length < 1 }, h("div", { key: 'b713e2a0e21f57d3b238b72163f3d7a4781b7026', class: "mg-c-input__section-header" }, this.sectionKind === SectionKind.SELECTED ? (h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.expanded.toString() }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), h("span", { class: "mg-c-input__section-header-title" }, getText(this.checkboxes)))) : (h("p", { class: "mg-c-input__section-header-title mg-c-input__section-header-title--static" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.expanded && this.checkboxes.some(checkbox => checkbox.value === true && checkbox.disabled !== true)) ||
|
|
115
|
-
(this.sectionKind === SectionKind.NOT_SELECTED && this.checkboxes.some(checkbox => checkbox.value === false && checkbox.disabled !== true))) && (h("mg-tooltip", { key: '7e5cba3b03cdc7bab68650b9aed36c195ca4dfe6', class: "mg-c-input__section-header-tootlip", message: this.messages.tooltip }, h("mg-button", { key: '4980f26ade12cbfaa6ef6041fa84918900cb652a', variant: "link", onClick: this.massActionHandler }, this.messages.action))), this.expanded && this.getPageCount(this.checkboxes) > 1 && (h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { key: '950b07ea9c59e8bc21e236bf32e3bf0a9318a008', hidden: !this.expanded, id: itemsContainerId, class: "mg-c-input__section-content" }, h(MgInputCheckboxList, { key: '276f679e01756d6d60f043dc1c04807b5058750a', checkboxes: this.getArrayRange(this.checkboxes, from, to), displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, disabled: this.disabled, name: this.name, invalid: this.invalid }))));
|
|
77
|
+
const listId = formatID(this.messages.label);
|
|
78
|
+
const tabId = 'tab-info';
|
|
79
|
+
return (h(Host, { key: '8e58037e78fcd7990bbd681053758b0ec4d0c4e0' }, h("slot", { key: 'c64e9c8f65a526b2289d3663fff64df02a282c96', name: "header-action" }), h("div", { key: 'c5953bb7e970384b231865d7fa4708fe2da4b407', class: "mg-c-input__tabs-content" }, h("p", { key: 'c0899cb7e7a6dea282f05aacf0fb05acd60a9d20', id: tabId, class: { 'mg-c-input__popover-info': true, 'mg-u-visually-hidden': this.items.length !== 0 }, "aria-live": this.items.length !== 0 ? 'polite' : undefined }, this.items.length === 0 ? this.messages.noValue : this.messages.values.replace('{count}', this.items.length.toString())), this.items.length > 0 && (h(MgInputCheckboxList, { key: '0bb1b4160d75b00d3fb5d9c08f3a560a16105e57', checkboxes: this.items, labelledby: tabId, id: listId, disabled: this.disabled, name: this.name, invalid: this.invalid })), this.hasNext() && (h("mg-button", { key: "load-more", variant: "flat", class: "mg-c-input__load-more", tabIndex: -1, "full-width": true, onClick: this.handleLoadMore, "aria-controls": listId }, h("mg-icon", { key: 'fd1560d7254f437f284925427130f69539b5fd3b', icon: "chevron-down" }), this.messages.showMore)))));
|
|
116
80
|
}
|
|
117
81
|
static get is() { return "mg-input-checkbox-paginated"; }
|
|
118
82
|
static get encapsulation() { return "scoped"; }
|
|
@@ -196,26 +160,6 @@ export class MgInputCheckboxPaginated {
|
|
|
196
160
|
"setter": false,
|
|
197
161
|
"reflect": false
|
|
198
162
|
},
|
|
199
|
-
"currentPage": {
|
|
200
|
-
"type": "number",
|
|
201
|
-
"attribute": "current-page",
|
|
202
|
-
"mutable": true,
|
|
203
|
-
"complexType": {
|
|
204
|
-
"original": "number",
|
|
205
|
-
"resolved": "number",
|
|
206
|
-
"references": {}
|
|
207
|
-
},
|
|
208
|
-
"required": false,
|
|
209
|
-
"optional": false,
|
|
210
|
-
"docs": {
|
|
211
|
-
"tags": [],
|
|
212
|
-
"text": "Current page"
|
|
213
|
-
},
|
|
214
|
-
"getter": false,
|
|
215
|
-
"setter": false,
|
|
216
|
-
"reflect": false,
|
|
217
|
-
"defaultValue": "1"
|
|
218
|
-
},
|
|
219
163
|
"checkboxes": {
|
|
220
164
|
"type": "unknown",
|
|
221
165
|
"attribute": "checkboxes",
|
|
@@ -238,8 +182,7 @@ export class MgInputCheckboxPaginated {
|
|
|
238
182
|
"text": "Define checkboxes to paginate"
|
|
239
183
|
},
|
|
240
184
|
"getter": false,
|
|
241
|
-
"setter": false
|
|
242
|
-
"defaultValue": "[]"
|
|
185
|
+
"setter": false
|
|
243
186
|
},
|
|
244
187
|
"messages": {
|
|
245
188
|
"type": "unknown",
|
|
@@ -268,37 +211,37 @@ export class MgInputCheckboxPaginated {
|
|
|
268
211
|
}
|
|
269
212
|
static get states() {
|
|
270
213
|
return {
|
|
271
|
-
"
|
|
214
|
+
"limit": {}
|
|
272
215
|
};
|
|
273
216
|
}
|
|
274
|
-
static get
|
|
275
|
-
return
|
|
276
|
-
|
|
277
|
-
"name": "mass-action",
|
|
278
|
-
"bubbles": true,
|
|
279
|
-
"cancelable": true,
|
|
280
|
-
"composed": true,
|
|
281
|
-
"docs": {
|
|
282
|
-
"tags": [],
|
|
283
|
-
"text": "Emit 'mass-action' event\nused to informe that select-all/unselect-all button listner is triggered"
|
|
284
|
-
},
|
|
217
|
+
static get methods() {
|
|
218
|
+
return {
|
|
219
|
+
"resetLimit": {
|
|
285
220
|
"complexType": {
|
|
286
|
-
"
|
|
287
|
-
"
|
|
221
|
+
"signature": "() => Promise<void>",
|
|
222
|
+
"parameters": [],
|
|
288
223
|
"references": {
|
|
289
|
-
"
|
|
290
|
-
"location": "
|
|
291
|
-
"
|
|
292
|
-
"id": "src/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.ts::SectionKindType"
|
|
224
|
+
"Promise": {
|
|
225
|
+
"location": "global",
|
|
226
|
+
"id": "global::Promise"
|
|
293
227
|
}
|
|
294
|
-
}
|
|
228
|
+
},
|
|
229
|
+
"return": "Promise<void>"
|
|
230
|
+
},
|
|
231
|
+
"docs": {
|
|
232
|
+
"text": "Method to reset limit",
|
|
233
|
+
"tags": []
|
|
295
234
|
}
|
|
296
|
-
}
|
|
235
|
+
}
|
|
236
|
+
};
|
|
297
237
|
}
|
|
298
238
|
static get watchers() {
|
|
299
239
|
return [{
|
|
300
240
|
"propName": "checkboxes",
|
|
301
241
|
"methodName": "watchCheckboxes"
|
|
242
|
+
}, {
|
|
243
|
+
"propName": "limit",
|
|
244
|
+
"methodName": "watchLimit"
|
|
302
245
|
}];
|
|
303
246
|
}
|
|
304
247
|
}
|
|
@@ -4,6 +4,7 @@ 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 { Status } from "../../mg-tabs/mg-tabs.conf";
|
|
7
8
|
/**
|
|
8
9
|
* type CheckboxItem validation function
|
|
9
10
|
* @param items - Checkbox item
|
|
@@ -26,6 +27,7 @@ export class MgInputCheckbox {
|
|
|
26
27
|
this.searchStart = 10;
|
|
27
28
|
// popover variables
|
|
28
29
|
this.hasOpenedPopover = false;
|
|
30
|
+
this.checkboxesId = 'checkboxes-list';
|
|
29
31
|
/**
|
|
30
32
|
* Define input name
|
|
31
33
|
* If not set the value equals the identifier
|
|
@@ -84,6 +86,10 @@ export class MgInputCheckbox {
|
|
|
84
86
|
* Select values button text local key
|
|
85
87
|
*/
|
|
86
88
|
this.selectValuesButtonKey = 'editButton';
|
|
89
|
+
/**
|
|
90
|
+
* Define <mg-tabs> active-tab
|
|
91
|
+
*/
|
|
92
|
+
this.activeTab = 1;
|
|
87
93
|
/**
|
|
88
94
|
* Handle input event
|
|
89
95
|
* @param event - input event
|
|
@@ -132,6 +138,14 @@ export class MgInputCheckbox {
|
|
|
132
138
|
this.searchValue = event.detail;
|
|
133
139
|
event.stopPropagation();
|
|
134
140
|
};
|
|
141
|
+
/**
|
|
142
|
+
* Handle <mg-tabs> tab-change event
|
|
143
|
+
* @param event - tab change event
|
|
144
|
+
*/
|
|
145
|
+
this.handleActiveTabChange = (event) => {
|
|
146
|
+
this.activeTab = event.detail;
|
|
147
|
+
this.resetTabsLimit();
|
|
148
|
+
};
|
|
135
149
|
/**
|
|
136
150
|
* popover display-change handler
|
|
137
151
|
* @param event - mg-popover display-change custom event
|
|
@@ -145,26 +159,11 @@ export class MgInputCheckbox {
|
|
|
145
159
|
if (!event.detail) {
|
|
146
160
|
// reset search value
|
|
147
161
|
this.searchValue = '';
|
|
148
|
-
|
|
149
|
-
Array.from(this.element.shadowRoot.querySelectorAll('mg-input-checkbox-paginated')).forEach(element => {
|
|
150
|
-
element.currentPage = 1;
|
|
151
|
-
});
|
|
162
|
+
this.resetTabsLimit();
|
|
152
163
|
this.checkValidity();
|
|
153
164
|
}
|
|
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();
|
|
165
|
+
// init active tab to selected if some values are checked
|
|
166
|
+
this.activeTab = this.checkboxItems.some(items => items.value) ? 2 : 1;
|
|
168
167
|
};
|
|
169
168
|
/**
|
|
170
169
|
* Update values
|
|
@@ -262,6 +261,14 @@ export class MgInputCheckbox {
|
|
|
262
261
|
* @returns selected checkboxItems
|
|
263
262
|
*/
|
|
264
263
|
this.getSelectedItems = () => this.checkboxItems.filter(({ value }) => value);
|
|
264
|
+
/**
|
|
265
|
+
* Reset <mg-input-checkbox-paginated> limit state
|
|
266
|
+
*/
|
|
267
|
+
this.resetTabsLimit = () => {
|
|
268
|
+
Array.from(this.element.shadowRoot.querySelectorAll('mg-input-checkbox-paginated')).forEach(component => {
|
|
269
|
+
component.resetLimit();
|
|
270
|
+
});
|
|
271
|
+
};
|
|
265
272
|
/**
|
|
266
273
|
* Renders the readonly value of the input.
|
|
267
274
|
* @returns The rendered readonly value.
|
|
@@ -273,7 +280,7 @@ export class MgInputCheckbox {
|
|
|
273
280
|
* Renders the MgInputCheckboxList component.
|
|
274
281
|
* @returns The rendered MgInputCheckboxList component.
|
|
275
282
|
*/
|
|
276
|
-
this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems,
|
|
283
|
+
this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems, id: this.checkboxesId, disabled: this.disabled, name: this.name, invalid: this.invalid }));
|
|
277
284
|
}
|
|
278
285
|
validateValue(newValue) {
|
|
279
286
|
if (isCheckboxItems(newValue)) {
|
|
@@ -497,23 +504,30 @@ export class MgInputCheckbox {
|
|
|
497
504
|
* @param checkboxes - checkboxes to render
|
|
498
505
|
* @returns render sections of checkboxes
|
|
499
506
|
*/
|
|
500
|
-
|
|
507
|
+
renderCheckboxTabs(checkboxes, checkboxPaginatedProps) {
|
|
508
|
+
const handleMassAction = (kind) => () => {
|
|
509
|
+
const displayItems = this.getDisplayItems();
|
|
510
|
+
// update only displayed items
|
|
511
|
+
displayItems.forEach(item => {
|
|
512
|
+
if (!item.disabled) {
|
|
513
|
+
item.value = kind !== SectionKind.SELECTED;
|
|
514
|
+
}
|
|
515
|
+
});
|
|
516
|
+
this.updateValues();
|
|
517
|
+
};
|
|
501
518
|
const [checkedValues, notCheckedValues] = checkboxes.reduce((acc, curr) => {
|
|
502
519
|
acc[curr.value ? 0 : 1].push(curr);
|
|
503
520
|
return acc;
|
|
504
521
|
}, [[], []]);
|
|
505
|
-
const baseSection = {
|
|
506
|
-
readonly: this.readonly,
|
|
507
|
-
disabled: this.disabled,
|
|
508
|
-
identifier: this.identifier,
|
|
509
|
-
};
|
|
510
522
|
const sections = [
|
|
511
|
-
Object.assign(Object.assign({},
|
|
512
|
-
Object.assign(Object.assign({},
|
|
523
|
+
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) }),
|
|
524
|
+
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
525
|
];
|
|
514
|
-
return sections
|
|
515
|
-
|
|
516
|
-
|
|
526
|
+
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) => ({
|
|
527
|
+
label: section.messages.title,
|
|
528
|
+
badge: { value: section.checkboxes.length, label: this.messages.input.checkbox.sections.badge.label, role: 'information' },
|
|
529
|
+
status: key + 1 === this.activeTab ? Status.ACTIVE : Status.VISIBLE,
|
|
530
|
+
})), 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
531
|
}
|
|
518
532
|
/**
|
|
519
533
|
* render checkbox multi element
|
|
@@ -522,14 +536,18 @@ export class MgInputCheckbox {
|
|
|
522
536
|
renderCheckboxMulti() {
|
|
523
537
|
const selectedValuesNb = this.getSelectedItems().length;
|
|
524
538
|
const checkboxes = this.getDisplayItems();
|
|
539
|
+
const checkboxPaginatedProps = {
|
|
540
|
+
readonly: this.readonly,
|
|
541
|
+
disabled: this.disabled,
|
|
542
|
+
identifier: this.identifier,
|
|
543
|
+
};
|
|
525
544
|
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
545
|
if (el !== null)
|
|
527
546
|
this.mgPopover = el;
|
|
528
547
|
} }, 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)))));
|
|
548
|
+
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 }),
|
|
549
|
+
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)),
|
|
550
|
+
]) : (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
551
|
}
|
|
534
552
|
/**
|
|
535
553
|
* Render
|
|
@@ -547,7 +565,7 @@ export class MgInputCheckbox {
|
|
|
547
565
|
else {
|
|
548
566
|
inputContent = this.renderCheckboxMulti();
|
|
549
567
|
}
|
|
550
|
-
return (h("mg-input", { key: '
|
|
568
|
+
return (h("mg-input", { key: '84d13ac702497773013daa72357e4d1dcf4ebb30', 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 ? this.errorMessage : undefined }, inputContent));
|
|
551
569
|
}
|
|
552
570
|
static get is() { return "mg-input-checkbox"; }
|
|
553
571
|
static get encapsulation() { return "shadow"; }
|
|
@@ -979,7 +997,8 @@ export class MgInputCheckbox {
|
|
|
979
997
|
"displaySearchInput": {},
|
|
980
998
|
"searchValue": {},
|
|
981
999
|
"searchResults": {},
|
|
982
|
-
"selectValuesButtonKey": {}
|
|
1000
|
+
"selectValuesButtonKey": {},
|
|
1001
|
+
"activeTab": {}
|
|
983
1002
|
};
|
|
984
1003
|
}
|
|
985
1004
|
static get events() {
|
|
@@ -175,6 +175,7 @@ export class MgInputCombobox {
|
|
|
175
175
|
* @param event - keyboard event
|
|
176
176
|
*/
|
|
177
177
|
this.handleFilterKeydown = (event) => {
|
|
178
|
+
var _a;
|
|
178
179
|
if (this.disabled || event.ctrlKey || event.shiftKey)
|
|
179
180
|
return;
|
|
180
181
|
let guard = false;
|
|
@@ -183,10 +184,11 @@ export class MgInputCombobox {
|
|
|
183
184
|
case Keys.TAB:
|
|
184
185
|
case Keys.ENTER:
|
|
185
186
|
guard = event.key === Keys.ENTER;
|
|
186
|
-
const option = this.option
|
|
187
|
+
const option = (_a = this.option) !== null && _a !== void 0 ? _a : this.options.items.find(this.isCurrentOption);
|
|
187
188
|
// Sets the value to the content of the focused option in the listbox.
|
|
188
|
-
if (this.popoverDisplay)
|
|
189
|
-
this.setValue(
|
|
189
|
+
if (this.popoverDisplay) {
|
|
190
|
+
this.setValue(option);
|
|
191
|
+
}
|
|
190
192
|
// Closes the popover.
|
|
191
193
|
this.popoverDisplay = false;
|
|
192
194
|
break;
|
|
@@ -353,8 +355,8 @@ export class MgInputCombobox {
|
|
|
353
355
|
else if (this.loadingAction === 'load-more') {
|
|
354
356
|
index = this.page.items.length - this.page.baseIndex;
|
|
355
357
|
}
|
|
356
|
-
// when action require a
|
|
357
|
-
// Set "
|
|
358
|
+
// when action require a showMore we fetch the API else we report action to next tick
|
|
359
|
+
// Set "Show more" if action match OR if next item not available in the current page
|
|
358
360
|
if (action.name === 'load-more') {
|
|
359
361
|
// wait for new element render and update scroll position
|
|
360
362
|
// set component loading
|
|
@@ -400,7 +402,7 @@ export class MgInputCombobox {
|
|
|
400
402
|
* @returns promise
|
|
401
403
|
*/
|
|
402
404
|
this.goToNextPage = () => {
|
|
403
|
-
this.
|
|
405
|
+
this.showMore.emit();
|
|
404
406
|
if (Boolean(this.fetchurl)) {
|
|
405
407
|
return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {
|
|
406
408
|
if (!Boolean(nextPage))
|
|
@@ -739,7 +741,7 @@ export class MgInputCombobox {
|
|
|
739
741
|
else {
|
|
740
742
|
activeDescendant = (_e = this.value) === null || _e === void 0 ? void 0 : _e.value;
|
|
741
743
|
}
|
|
742
|
-
return (h("mg-input", { key: '
|
|
744
|
+
return (h("mg-input", { key: '79e5263cd3b1c0fa0b3f386a547f2bdd48a33b28', label: this.label, identifier: this.identifier, class: this.classCollection.classes.join(' '), ariaDescribedbyIDs: popoverContent && popoverContent !== 'list' ? popoverContent : undefined, labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("mg-popover", { identifier: this.popoverId, placement: "bottom-start", display: this.popoverDisplay, "arrow-hide": true, style: {
|
|
743
745
|
'--mg-c-input-list-width': Boolean((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) ? `${this.input.offsetWidth}px` : undefined,
|
|
744
746
|
}, "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) => {
|
|
745
747
|
if (el !== null)
|
|
@@ -760,7 +762,7 @@ export class MgInputCombobox {
|
|
|
760
762
|
this.page.next && (h("mg-button", { key: "load-more", variant: "flat", class: "mg-c-input__load-more", tabIndex: -1, disabled: this.isLoading, "full-width": true, "disable-on-click": true, onClick: this.handleLoadMoreButton, "aria-controls": listId, ref: (el) => {
|
|
761
763
|
if (el !== null)
|
|
762
764
|
this.loadMoreElement = el;
|
|
763
|
-
} }, h("mg-icon", { icon: "chevron-down" }), this.messages.input.
|
|
765
|
+
} }, h("mg-icon", { icon: "chevron-down" }), this.messages.input.showMore)),
|
|
764
766
|
], popoverContent === 'notfound' && (h("p", { id: popoverContent, class: "mg-c-input__popover-info" }, this.messages.input.combobox.notFound)), popoverContent === 'notavailable' && (h("p", { id: popoverContent, class: "mg-c-input__popover-info" }, this.messages.input.combobox.notAvailable)))))));
|
|
765
767
|
}
|
|
766
768
|
static get is() { return "mg-input-combobox"; }
|
|
@@ -1291,7 +1293,7 @@ export class MgInputCombobox {
|
|
|
1291
1293
|
"references": {}
|
|
1292
1294
|
}
|
|
1293
1295
|
}, {
|
|
1294
|
-
"method": "
|
|
1296
|
+
"method": "showMore",
|
|
1295
1297
|
"name": "load-more",
|
|
1296
1298
|
"bubbles": true,
|
|
1297
1299
|
"cancelable": true,
|
|
@@ -362,7 +362,7 @@ export class MgInputDate {
|
|
|
362
362
|
* @returns HTML Element
|
|
363
363
|
*/
|
|
364
364
|
render() {
|
|
365
|
-
return (h("mg-input", { key: '
|
|
365
|
+
return (h("mg-input", { key: '71daaa8818ab7120c61a45399ae016a4621c8f50', 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) => {
|
|
366
366
|
if (el !== null)
|
|
367
367
|
this.input = el;
|
|
368
368
|
} }))));
|
|
@@ -241,6 +241,11 @@ export class MgInputNumeric {
|
|
|
241
241
|
var _a;
|
|
242
242
|
// has input value is always render as string we get a stringified value or a '' for nullish value, so we test string type
|
|
243
243
|
if (typeof newValue === 'string') {
|
|
244
|
+
// Check if integer value starts with '0' (leading zero)
|
|
245
|
+
if (newValue.startsWith('0') && parseInt(newValue, 10) > 0) {
|
|
246
|
+
// Remove leading zero
|
|
247
|
+
newValue = newValue.substring(1);
|
|
248
|
+
}
|
|
244
249
|
// Split number and decimal
|
|
245
250
|
const [integer, decimal = ''] = newValue.replace('-', '').split(/[.,]/);
|
|
246
251
|
// Regex
|
|
@@ -457,7 +462,7 @@ export class MgInputNumeric {
|
|
|
457
462
|
* @returns HTML Element
|
|
458
463
|
*/
|
|
459
464
|
render() {
|
|
460
|
-
return (h("mg-input", { key: '
|
|
465
|
+
return (h("mg-input", { key: 'ca551b49b1b4dc98fd4e943e51de8a32bc78882b', 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
|
|
461
466
|
? this.readonlyValue && this.renderReadonly()
|
|
462
467
|
: [
|
|
463
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) => {
|
|
@@ -237,7 +237,7 @@ export class MgInputPassword {
|
|
|
237
237
|
* @returns HTML Element
|
|
238
238
|
*/
|
|
239
239
|
render() {
|
|
240
|
-
return (h("mg-input", { key: '
|
|
240
|
+
return (h("mg-input", { key: '4bdaa6d26811f66fa43b580ac6e85c61b308ee92', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
241
241
|
if (el !== null)
|
|
242
242
|
this.input = el;
|
|
243
243
|
} }), h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, h("mg-icon", { class: "mg-c-input__input-icon", icon: this.displayPassword ? 'eye-slash' : 'eye' }))))));
|
|
@@ -272,7 +272,7 @@ export class MgInputRadio {
|
|
|
272
272
|
* @returns HTML Element
|
|
273
273
|
*/
|
|
274
274
|
render() {
|
|
275
|
-
return (h("mg-input", { key: '
|
|
275
|
+
return (h("mg-input", { key: '048aa732e7f8593701c9397e571b97584bc5e37b', 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 ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("ul", { class: "mg-c-input__input-group-container", role: "list" }, this.options.map((input, index) => (h("li", { key: input.title, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': this.disabled || input.disabled } }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
|
|
276
276
|
if (el !== null)
|
|
277
277
|
this.inputs[index] = el;
|
|
278
278
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
|