@mgdis/mg-components 5.12.0 → 5.13.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/loader.cjs.js +1 -1
- package/dist/cjs/{mg-action-more_31.cjs.entry.js → mg-action-more_32.cjs.entry.js} +325 -137
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +1 -1
- package/dist/cjs/{mg-menu.conf-79f0c761.js → mg-menu.conf-857748e1.js} +20 -2
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +15 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +259 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +16 -0
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +41 -3
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +106 -100
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +1 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.css +3 -5
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +1 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.css +3 -0
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +19 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.conf.js +8 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +9 -5
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +133 -47
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +1 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/collection/locales/en/messages.json +13 -1
- package/dist/collection/locales/fr/messages.json +7 -1
- package/dist/collection/stories/icon-gallery.js +9 -0
- package/dist/collection/variables.css +7 -2
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +20 -2
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-input-checkbox-paginated.d.ts +11 -0
- package/dist/components/mg-input-checkbox-paginated.js +6 -0
- package/dist/components/mg-input-checkbox-paginated2.js +205 -0
- package/dist/components/mg-input-checkbox.js +114 -108
- package/dist/components/mg-menu-item2.js +1 -1
- package/dist/components/mg-menu2.js +1 -1
- package/dist/components/mg-pagination2.js +4 -2
- package/dist/components/mg-panel.js +83 -37
- package/dist/components/mg-tabs.js +1 -1
- package/dist/esm/loader.js +1 -1
- package/dist/esm/{mg-action-more_31.entry.js → mg-action-more_32.entry.js} +325 -138
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +1 -1
- package/dist/esm/{mg-menu.conf-850d4c6e.js → mg-menu.conf-c31828ca.js} +20 -2
- package/dist/mg-components/locales/en/messages.json +13 -1
- package/dist/mg-components/locales/fr/messages.json +7 -1
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-622e2323.js +1 -0
- package/dist/mg-components/p-bda0b795.entry.js +1 -0
- package/dist/mg-components/{p-67ba5d05.entry.js → p-d37b29bb.entry.js} +1 -1
- package/dist/mg-components/variables.css +7 -2
- package/dist/types/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.d.ts +8 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +103 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +50 -12
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +48 -53
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -1
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +0 -1
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +4 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.conf.d.ts +16 -0
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +44 -10
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +0 -1
- package/dist/types/components.d.ts +125 -19
- package/dist/types/locales/index.d.ts +18 -0
- package/dist/types/stories/icon-gallery.d.ts +6 -0
- package/package.json +23 -13
- package/dist/mg-components/p-60b7afd9.entry.js +0 -1
- package/dist/mg-components/p-689503fc.js +0 -1
|
@@ -17,7 +17,7 @@ const patchBrowser = () => {
|
|
|
17
17
|
};
|
|
18
18
|
|
|
19
19
|
patchBrowser().then(options => {
|
|
20
|
-
return index.bootstrapLazy([["mg-action-
|
|
20
|
+
return index.bootstrapLazy([["mg-action-more_32.cjs",[[1,"mg-input-checkbox",{"value":[1040],"type":[1025],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"displaySelectedValues":[4,"display-selected-values"],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"checkboxItems":[32],"displaySearchInput":[32],"searchValue":[32],"searchResults":[32],"displayError":[64]}],[1,"mg-action-more",{"icon":[16],"button":[16],"items":[16],"displayChevron":[4,"display-chevron"],"expanded":[32]}],[1,"mg-panel",{"identifier":[1],"panelTitle":[1025,"panel-title"],"titlePattern":[1,"title-pattern"],"titlePatternErrorMessage":[1,"title-pattern-error-message"],"titleEditable":[1028,"title-editable"],"titlePosition":[1,"title-position"],"expanded":[1028],"expandToggleDisplay":[1,"expand-toggle-display"],"expandToggleDisabled":[4,"expand-toggle-disabled"],"classCollection":[32],"isEditing":[32],"updatedPanelTitle":[32]}],[1,"mg-input-textarea",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"rows":[2],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"resizable":[1],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-date",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"min":[1],"max":[1],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-numeric",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"type":[1],"currency":[1],"max":[2],"min":[2],"integerLength":[2,"integer-length"],"decimalLength":[2,"decimal-length"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"hasFocus":[32],"displayError":[64]}],[1,"mg-input-password",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"displayError":[64]}],[1,"mg-input-radio",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"inputVerticalList":[4,"input-vertical-list"],"required":[4],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"options":[32],"displayError":[64]}],[1,"mg-input-toggle",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"isOnOff":[4,"is-on-off"],"isIcon":[4,"is-icon"],"readonly":[4],"disabled":[4],"tooltip":[1],"helpText":[1,"help-text"],"classCollection":[32],"options":[32],"checked":[32]}],[1,"mg-message",{"identifier":[1],"delay":[2],"variant":[1],"closeButton":[1028,"close-button"],"hide":[1028],"classCollection":[32],"hasActions":[32]}],[1,"mg-modal",{"identifier":[1],"modalTitle":[1,"modal-title"],"closeButton":[4,"close-button"],"hide":[1028],"hasActions":[32],"hasContent":[32],"classCollection":[32]},[[8,"keydown","handleKeyDown"]]],[1,"mg-tabs",{"identifier":[1],"label":[1],"size":[1],"items":[16],"activeTab":[1538,"active-tab"],"tabs":[32],"classCollection":[32]}],[1,"mg-details",{"toggleClosed":[1,"toggle-closed"],"toggleOpened":[1,"toggle-opened"],"hideSummary":[4,"hide-summary"],"expanded":[1028]}],[1,"mg-divider",{"size":[1]}],[1,"mg-form",{"identifier":[1],"name":[1],"readonly":[4],"disabled":[4],"valid":[1028],"invalid":[1028],"classCollection":[32],"requiredMessage":[32],"displayError":[64]}],[1,"mg-illustrated-message",{"size":[1],"direction":[1]}],[1,"mg-skip-links",{"links":[16]}],[1,"mg-tag",{"variant":[1],"outline":[4],"soft":[4],"classCollection":[32]}],[2,"mg-input-checkbox-paginated",{"readonly":[4],"disabled":[4],"name":[1],"checkboxes":[16],"sectionKind":[1,"section-kind"],"messages":[16],"titleKind":[32],"currentPage":[32],"itemsExpanded":[32]}],[1,"mg-menu-item",{"identifier":[1],"href":[1],"status":[1537],"expanded":[1028],"size":[32],"navigationButtonClassList":[32],"direction":[32],"isInMainMenu":[32],"isItemMore":[32],"hasChildren":[32],"displayNotificationBadge":[32]}],[1,"mg-pagination",{"identifier":[1],"label":[1025],"hideNavigationLabels":[4,"hide-navigation-labels"],"hidePageCount":[4,"hide-page-count"],"totalPages":[2,"total-pages"],"currentPage":[1538,"current-page"]}],[1,"mg-input-text",{"value":[1537],"identifier":[1],"name":[1],"label":[1],"type":[1],"icon":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1],"maxlength":[2],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"pattern":[1],"patternErrorMessage":[1,"pattern-error-message"],"tooltip":[1],"displayCharacterLeft":[4,"display-character-left"],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"setFocus":[64],"displayError":[64]}],[1,"mg-menu",{"label":[1],"direction":[513],"itemmore":[16],"size":[1],"isChildMenu":[32]}],[1,"mg-input-select",{"value":[1032],"items":[16],"identifier":[1],"name":[1],"label":[1],"labelOnTop":[4,"label-on-top"],"labelHide":[4,"label-hide"],"placeholder":[1025],"placeholderHide":[4,"placeholder-hide"],"placeholderDisabled":[4,"placeholder-disabled"],"required":[4],"readonly":[4],"disabled":[4],"mgWidth":[8,"mg-width"],"tooltip":[1],"helpText":[1,"help-text"],"valid":[1028],"invalid":[1028],"classCollection":[32],"errorMessage":[32],"options":[32],"valueExist":[32],"readonlyValue":[32],"displayError":[64]}],[1,"mg-popover",{"identifier":[1],"placement":[1],"arrowHide":[4,"arrow-hide"],"closeButton":[4,"close-button"],"display":[1028],"disabled":[4],"classCollection":[32]}],[1,"mg-badge",{"value":[8],"label":[1],"variant":[1],"outline":[4],"classCollection":[32]}],[2,"mg-character-left",{"identifier":[1],"characters":[1],"maxlength":[2]}],[1,"mg-card",{"variant":[1],"variantStyle":[1025,"variant-style"],"classCollection":[32]}],[1,"mg-button",{"variant":[1],"identifier":[1],"label":[1],"type":[1],"fullWidth":[4,"full-width"],"form":[1],"disabled":[1028],"isIcon":[4,"is-icon"],"disableOnClick":[4,"disable-on-click"],"loading":[32],"classCollection":[32]}],[6,"mg-input-title",{"identifier":[1],"required":[4],"isLegend":[4,"is-legend"],"tagName":[32]}],[1,"mg-tooltip",{"identifier":[1],"message":[1],"placement":[1],"display":[1028],"disabled":[4]}],[1,"mg-icon",{"icon":[1],"size":[1],"variant":[1],"variantStyle":[1025,"variant-style"],"spin":[4],"classCollection":[32]}]]],["mg-item-more.cjs",[[1,"mg-item-more",{"icon":[16],"slotlabel":[16],"size":[1],"parentMenu":[32]}]]]], options);
|
|
21
21
|
});
|
|
22
22
|
|
|
23
23
|
exports.setNonce = index.setNonce;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
Object.defineProperty(exports, '__esModule', { value: true });
|
|
4
4
|
|
|
5
5
|
const index = require('./index-03d2557d.js');
|
|
6
|
-
const mgMenu_conf = require('./mg-menu.conf-
|
|
6
|
+
const mgMenu_conf = require('./mg-menu.conf-857748e1.js');
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
9
|
* MgItemMore type guard
|
|
@@ -29,7 +29,19 @@ const input$1 = {
|
|
|
29
29
|
result: "result",
|
|
30
30
|
results: "results",
|
|
31
31
|
searchResults: "Search result(s) list.",
|
|
32
|
-
noResult: "No result."
|
|
32
|
+
noResult: "No result.",
|
|
33
|
+
sections: {
|
|
34
|
+
selected: {
|
|
35
|
+
title: "Selected",
|
|
36
|
+
titlePlurial: "Selected",
|
|
37
|
+
action: "Unselect all"
|
|
38
|
+
},
|
|
39
|
+
notSelected: {
|
|
40
|
+
title: "Not selected",
|
|
41
|
+
titlePlurial: "Not selected",
|
|
42
|
+
action: "Select all"
|
|
43
|
+
}
|
|
44
|
+
}
|
|
33
45
|
}
|
|
34
46
|
};
|
|
35
47
|
const form$1 = {
|
|
@@ -116,7 +128,13 @@ const input = {
|
|
|
116
128
|
result: "resultat",
|
|
117
129
|
results: "resultats",
|
|
118
130
|
searchResults: "List de resultat(s) de la recherche.",
|
|
119
|
-
noResult: "Aucun resultat."
|
|
131
|
+
noResult: "Aucun resultat.",
|
|
132
|
+
checkedItem: "Sélectionné",
|
|
133
|
+
checkedItems: "Sélectionnés",
|
|
134
|
+
notCheckedItem: "Non sélectionné",
|
|
135
|
+
notCheckedItems: "Non sélectionnés",
|
|
136
|
+
unselectAll: "Tout désélectionner",
|
|
137
|
+
selectAll: "Tout sélectionner"
|
|
120
138
|
}
|
|
121
139
|
};
|
|
122
140
|
const form = {
|
|
@@ -14,6 +14,7 @@
|
|
|
14
14
|
"./components/atoms/mg-tag/mg-tag.js",
|
|
15
15
|
"./components/atoms/mg-tooltip/mg-tooltip.js",
|
|
16
16
|
"./components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js",
|
|
17
|
+
"./components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js",
|
|
17
18
|
"./components/molecules/inputs/mg-input-date/mg-input-date.js",
|
|
18
19
|
"./components/molecules/inputs/mg-input-numeric/mg-input-numeric.js",
|
|
19
20
|
"./components/molecules/inputs/mg-input-password/mg-input-password.js",
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { h } from '@stencil/core';
|
|
2
|
+
/**
|
|
3
|
+
* Get checkboxes list template
|
|
4
|
+
* @param props - MgInputCheckboxList Interface Props
|
|
5
|
+
* @returns input template
|
|
6
|
+
*/
|
|
7
|
+
export const MgInputCheckboxList = (props) => (
|
|
8
|
+
// eslint-disable-next-line jsx-a11y/no-redundant-roles
|
|
9
|
+
h("ul", { class: {
|
|
10
|
+
'mg-input__input-group-container': true,
|
|
11
|
+
'mg-input__input-group-container--vertical': props.inputVerticalList || (props.type === 'multi' && !props.readonly),
|
|
12
|
+
'mg-input__input-checkbox-multi-inputs': props.type === 'multi' && !props.readonly,
|
|
13
|
+
}, role: "list", "aria-describedby": props.displaySearchInput ? 'search-results' : undefined, "aria-label": props.displaySearchInput ? props.messages.searchResults : undefined, "aria-live": props.displaySearchInput ? 'polite' : undefined, id: props.id }, props.checkboxes
|
|
14
|
+
.filter(item => !props.readonly || item.value)
|
|
15
|
+
.map(input => (h("li", { key: input.id, class: { 'mg-input__input-group': true, 'mg-input__input-group--disabled': props.disabled || input.disabled } }, h("input", { type: "checkbox", id: input.id, name: props.name, value: input.value && input.value.toString(), checked: Boolean(input.value), required: input.required, disabled: props.readonly || props.disabled || input.disabled, indeterminate: input.value === null, onInput: input.handleInput, onBlur: input.handleBlur, onKeyDown: input.handleKeydown }), h("label", { htmlFor: input.id }, input.title))))));
|
|
@@ -0,0 +1,259 @@
|
|
|
1
|
+
import { h, Host } from '@stencil/core';
|
|
2
|
+
import { SectionKind, SectionTitleKind } from '../mg-input-checkbox.conf';
|
|
3
|
+
import { MgInputCheckboxList } from '../MgInputCheckboxList';
|
|
4
|
+
/**
|
|
5
|
+
* Internal component use to manage sections instances
|
|
6
|
+
*/
|
|
7
|
+
export class MgInputCheckboxPaginated {
|
|
8
|
+
constructor() {
|
|
9
|
+
/*************
|
|
10
|
+
* Constantes *
|
|
11
|
+
*************/
|
|
12
|
+
this.offset = 10;
|
|
13
|
+
/***********
|
|
14
|
+
* Methods *
|
|
15
|
+
***********/
|
|
16
|
+
/**
|
|
17
|
+
* Mass action handler
|
|
18
|
+
*/
|
|
19
|
+
this.massActionHandler = () => {
|
|
20
|
+
this.massAction.emit(this.sectionKind);
|
|
21
|
+
};
|
|
22
|
+
/**
|
|
23
|
+
* Toogle items button handler
|
|
24
|
+
*/
|
|
25
|
+
this.handleToggleClick = () => {
|
|
26
|
+
this.itemsExpanded = !this.itemsExpanded;
|
|
27
|
+
};
|
|
28
|
+
/**
|
|
29
|
+
* Method to get a array range
|
|
30
|
+
* @param from - array start index
|
|
31
|
+
* @param to - array end index
|
|
32
|
+
* @returns array's range
|
|
33
|
+
*/
|
|
34
|
+
this.getArrayRange = (array, from, to) => array.slice(from, to);
|
|
35
|
+
/**
|
|
36
|
+
* Method to get page count from items
|
|
37
|
+
* @param items - items to count
|
|
38
|
+
* @returns page count from items
|
|
39
|
+
*/
|
|
40
|
+
this.getPageCount = (item) => Math.ceil(item.length / this.offset);
|
|
41
|
+
/**
|
|
42
|
+
* Handle mg-pagination current page change event
|
|
43
|
+
* @param event - pagination current page change event
|
|
44
|
+
*/
|
|
45
|
+
this.handleCurrentPageChange = (event) => {
|
|
46
|
+
this.currentPage = Number(event.detail);
|
|
47
|
+
};
|
|
48
|
+
this.readonly = undefined;
|
|
49
|
+
this.disabled = undefined;
|
|
50
|
+
this.name = undefined;
|
|
51
|
+
this.checkboxes = [];
|
|
52
|
+
this.sectionKind = undefined;
|
|
53
|
+
this.messages = undefined;
|
|
54
|
+
this.titleKind = undefined;
|
|
55
|
+
this.currentPage = 1;
|
|
56
|
+
this.itemsExpanded = true;
|
|
57
|
+
}
|
|
58
|
+
validateCheckboxes(newValue, oldValue) {
|
|
59
|
+
// after each array.length update we reset pagination
|
|
60
|
+
// when items fill on page, we set current page to 1
|
|
61
|
+
if (this.getPageCount(newValue) === 1)
|
|
62
|
+
this.currentPage = 1;
|
|
63
|
+
// 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
|
|
64
|
+
else if (this.getPageCount(oldValue) === this.currentPage && this.getPageCount(newValue) < this.currentPage)
|
|
65
|
+
this.currentPage = this.getPageCount(newValue);
|
|
66
|
+
}
|
|
67
|
+
validateSectionKind(newValue) {
|
|
68
|
+
if (newValue === SectionKind.SELECTED)
|
|
69
|
+
this.titleKind = SectionTitleKind.BUTTON;
|
|
70
|
+
else
|
|
71
|
+
this.titleKind = SectionTitleKind.TEXT;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Get from and to index
|
|
75
|
+
* @returns [from,to] index
|
|
76
|
+
*/
|
|
77
|
+
getFromToIndexes() {
|
|
78
|
+
const isFirstPage = this.currentPage === 1;
|
|
79
|
+
const checkboxItemsFromIndex = isFirstPage ? 0 : (this.currentPage - 1) * this.offset;
|
|
80
|
+
const checkboxItemsToIndex = isFirstPage ? this.offset : this.currentPage * this.offset;
|
|
81
|
+
return [checkboxItemsFromIndex, checkboxItemsToIndex];
|
|
82
|
+
}
|
|
83
|
+
/*************
|
|
84
|
+
* Lifecycle *
|
|
85
|
+
*************/
|
|
86
|
+
/**
|
|
87
|
+
* Check if component props are well configured on init
|
|
88
|
+
*/
|
|
89
|
+
componentWillLoad() {
|
|
90
|
+
this.validateSectionKind(this.sectionKind);
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* Render
|
|
94
|
+
* @returns HTML Element
|
|
95
|
+
*/
|
|
96
|
+
render() {
|
|
97
|
+
const [checkboxItemsFromIndex, checkboxItemsToIndex] = this.getFromToIndexes();
|
|
98
|
+
const itemsContainerId = `items-${this.sectionKind}-container`;
|
|
99
|
+
const getText = (checkboxes) => h("em", null, `${this.messages[checkboxes.length > 1 ? 'titlePlurial' : 'title']} (${checkboxes.length})`);
|
|
100
|
+
return (h(Host, { hidden: this.checkboxes.length < 1 }, h("div", { class: "mg-input__input-checkbox-multi-section-header" }, this.titleKind === SectionTitleKind.BUTTON ? (h("mg-button", { variant: "flat", onClick: this.handleToggleClick, "aria-controls": itemsContainerId, "aria-expanded": this.itemsExpanded.toString() }, h("mg-icon", { icon: this.itemsExpanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: "mg-input__input-checkbox-multi-text" }, getText(this.checkboxes)))) : (h("p", { class: "mg-input__input-checkbox-multi-title" }, getText(this.checkboxes))), ((this.sectionKind === SectionKind.SELECTED && this.itemsExpanded) || this.sectionKind === SectionKind.NOT_SELECTED) && (h("mg-button", { variant: "link", onClick: this.massActionHandler }, this.messages.action)), this.getPageCount(this.checkboxes) > 1 && (h("mg-pagination", { key: "search-pagination", totalPages: this.getPageCount(this.checkboxes), currentPage: this.currentPage > 1 ? this.currentPage : 1, "onCurrent-page-change": this.handleCurrentPageChange, hideNavigationLabels: true, hidePageCount: true, identifier: `input-checkbox-pagination-${this.sectionKind}` }))), h("div", { hidden: !this.itemsExpanded, id: itemsContainerId, class: "mg-input__input-checkbox-multi-section-content" }, h(MgInputCheckboxList, { checkboxes: this.getArrayRange(this.checkboxes, checkboxItemsFromIndex, checkboxItemsToIndex), inputVerticalList: true, type: 'multi', displaySearchInput: true, messages: this.messages, id: `items-${this.sectionKind}`, readonly: this.readonly, disabled: this.disabled, name: this.name }))));
|
|
101
|
+
}
|
|
102
|
+
static get is() { return "mg-input-checkbox-paginated"; }
|
|
103
|
+
static get encapsulation() { return "scoped"; }
|
|
104
|
+
static get properties() {
|
|
105
|
+
return {
|
|
106
|
+
"readonly": {
|
|
107
|
+
"type": "boolean",
|
|
108
|
+
"mutable": false,
|
|
109
|
+
"complexType": {
|
|
110
|
+
"original": "boolean",
|
|
111
|
+
"resolved": "boolean",
|
|
112
|
+
"references": {}
|
|
113
|
+
},
|
|
114
|
+
"required": false,
|
|
115
|
+
"optional": false,
|
|
116
|
+
"docs": {
|
|
117
|
+
"tags": [],
|
|
118
|
+
"text": "Define if mg-input-checkbox-list is readonly"
|
|
119
|
+
},
|
|
120
|
+
"attribute": "readonly",
|
|
121
|
+
"reflect": false
|
|
122
|
+
},
|
|
123
|
+
"disabled": {
|
|
124
|
+
"type": "boolean",
|
|
125
|
+
"mutable": false,
|
|
126
|
+
"complexType": {
|
|
127
|
+
"original": "boolean",
|
|
128
|
+
"resolved": "boolean",
|
|
129
|
+
"references": {}
|
|
130
|
+
},
|
|
131
|
+
"required": false,
|
|
132
|
+
"optional": false,
|
|
133
|
+
"docs": {
|
|
134
|
+
"tags": [],
|
|
135
|
+
"text": "Define if mg-input-checkbox-list is disabled"
|
|
136
|
+
},
|
|
137
|
+
"attribute": "disabled",
|
|
138
|
+
"reflect": false
|
|
139
|
+
},
|
|
140
|
+
"name": {
|
|
141
|
+
"type": "string",
|
|
142
|
+
"mutable": false,
|
|
143
|
+
"complexType": {
|
|
144
|
+
"original": "string",
|
|
145
|
+
"resolved": "string",
|
|
146
|
+
"references": {}
|
|
147
|
+
},
|
|
148
|
+
"required": false,
|
|
149
|
+
"optional": false,
|
|
150
|
+
"docs": {
|
|
151
|
+
"tags": [],
|
|
152
|
+
"text": "Define mg-input-checkbox input name"
|
|
153
|
+
},
|
|
154
|
+
"attribute": "name",
|
|
155
|
+
"reflect": false
|
|
156
|
+
},
|
|
157
|
+
"checkboxes": {
|
|
158
|
+
"type": "unknown",
|
|
159
|
+
"mutable": false,
|
|
160
|
+
"complexType": {
|
|
161
|
+
"original": "CheckboxItem[]",
|
|
162
|
+
"resolved": "CheckboxItem[]",
|
|
163
|
+
"references": {
|
|
164
|
+
"CheckboxItem": {
|
|
165
|
+
"location": "import",
|
|
166
|
+
"path": "../mg-input-checkbox.conf"
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
},
|
|
170
|
+
"required": false,
|
|
171
|
+
"optional": false,
|
|
172
|
+
"docs": {
|
|
173
|
+
"tags": [],
|
|
174
|
+
"text": "Define checkboxes to paginate"
|
|
175
|
+
},
|
|
176
|
+
"defaultValue": "[]"
|
|
177
|
+
},
|
|
178
|
+
"sectionKind": {
|
|
179
|
+
"type": "string",
|
|
180
|
+
"mutable": false,
|
|
181
|
+
"complexType": {
|
|
182
|
+
"original": "SectionKind",
|
|
183
|
+
"resolved": "SectionKind.NOT_SELECTED | SectionKind.SELECTED",
|
|
184
|
+
"references": {
|
|
185
|
+
"SectionKind": {
|
|
186
|
+
"location": "import",
|
|
187
|
+
"path": "../mg-input-checkbox.conf"
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
"required": false,
|
|
192
|
+
"optional": false,
|
|
193
|
+
"docs": {
|
|
194
|
+
"tags": [],
|
|
195
|
+
"text": "Define section kind"
|
|
196
|
+
},
|
|
197
|
+
"attribute": "section-kind",
|
|
198
|
+
"reflect": false
|
|
199
|
+
},
|
|
200
|
+
"messages": {
|
|
201
|
+
"type": "unknown",
|
|
202
|
+
"mutable": false,
|
|
203
|
+
"complexType": {
|
|
204
|
+
"original": "Record<string, string>",
|
|
205
|
+
"resolved": "{ [x: string]: string; }",
|
|
206
|
+
"references": {
|
|
207
|
+
"Record": {
|
|
208
|
+
"location": "global"
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
},
|
|
212
|
+
"required": false,
|
|
213
|
+
"optional": false,
|
|
214
|
+
"docs": {
|
|
215
|
+
"tags": [],
|
|
216
|
+
"text": "Define component message"
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
};
|
|
220
|
+
}
|
|
221
|
+
static get states() {
|
|
222
|
+
return {
|
|
223
|
+
"titleKind": {},
|
|
224
|
+
"currentPage": {},
|
|
225
|
+
"itemsExpanded": {}
|
|
226
|
+
};
|
|
227
|
+
}
|
|
228
|
+
static get events() {
|
|
229
|
+
return [{
|
|
230
|
+
"method": "massAction",
|
|
231
|
+
"name": "mass-action",
|
|
232
|
+
"bubbles": true,
|
|
233
|
+
"cancelable": true,
|
|
234
|
+
"composed": true,
|
|
235
|
+
"docs": {
|
|
236
|
+
"tags": [],
|
|
237
|
+
"text": "Emit 'mass-action' event\nused to informe that select-all/unselect-all button listner is triggered"
|
|
238
|
+
},
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "MgInputCheckboxPaginated['sectionKind']",
|
|
241
|
+
"resolved": "SectionKind.NOT_SELECTED | SectionKind.SELECTED",
|
|
242
|
+
"references": {
|
|
243
|
+
"MgInputCheckboxPaginated": {
|
|
244
|
+
"location": "global"
|
|
245
|
+
}
|
|
246
|
+
}
|
|
247
|
+
}
|
|
248
|
+
}];
|
|
249
|
+
}
|
|
250
|
+
static get watchers() {
|
|
251
|
+
return [{
|
|
252
|
+
"propName": "checkboxes",
|
|
253
|
+
"methodName": "validateCheckboxes"
|
|
254
|
+
}, {
|
|
255
|
+
"propName": "sectionKind",
|
|
256
|
+
"methodName": "validateSectionKind"
|
|
257
|
+
}];
|
|
258
|
+
}
|
|
259
|
+
}
|
package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js
CHANGED
|
@@ -2,3 +2,19 @@
|
|
|
2
2
|
* List of all availables checkbox type
|
|
3
3
|
*/
|
|
4
4
|
export const checkboxTypes = ['checkbox', 'multi'];
|
|
5
|
+
/**
|
|
6
|
+
* mg-input-checkbox-paginated section kind
|
|
7
|
+
*/
|
|
8
|
+
export var SectionKind;
|
|
9
|
+
(function (SectionKind) {
|
|
10
|
+
SectionKind["SELECTED"] = "selected";
|
|
11
|
+
SectionKind["NOT_SELECTED"] = "not-selected";
|
|
12
|
+
})(SectionKind || (SectionKind = {}));
|
|
13
|
+
/**
|
|
14
|
+
* mg-input-checkbox-paginated section title kind
|
|
15
|
+
*/
|
|
16
|
+
export var SectionTitleKind;
|
|
17
|
+
(function (SectionTitleKind) {
|
|
18
|
+
SectionTitleKind["BUTTON"] = "button";
|
|
19
|
+
SectionTitleKind["TEXT"] = "text";
|
|
20
|
+
})(SectionTitleKind || (SectionTitleKind = {}));
|
|
@@ -191,7 +191,8 @@ fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container {
|
|
|
191
191
|
.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-values-container {
|
|
192
192
|
display: flex;
|
|
193
193
|
flex-wrap: wrap;
|
|
194
|
-
gap: 0.4rem;
|
|
194
|
+
gap: calc(0.4rem * 1);
|
|
195
|
+
flex-direction: row;
|
|
195
196
|
margin: 0;
|
|
196
197
|
padding: 0;
|
|
197
198
|
list-style: none;
|
|
@@ -204,26 +205,63 @@ fieldset.mg-input.mg-input--label-on-top .mg-input__input-group-container {
|
|
|
204
205
|
min-height: var(--default-size);
|
|
205
206
|
min-width: var(--default-size);
|
|
206
207
|
padding: calc((var(--default-size) - 0.2rem - var(--font-size) * var(--line-height)) / 2) 1.1rem;
|
|
207
|
-
background-color: var(--mg-color-dark-5-hsl);
|
|
208
|
+
background-color: hsl(var(--mg-color-dark-5-hsl));
|
|
208
209
|
border-radius: 0.3rem;
|
|
209
210
|
font-size: var(--font-size);
|
|
210
211
|
}
|
|
211
212
|
.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-no-result {
|
|
212
213
|
text-align: center;
|
|
213
214
|
}
|
|
215
|
+
.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-text, .mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-title {
|
|
216
|
+
display: inline;
|
|
217
|
+
margin: 0;
|
|
218
|
+
color: hsl(var(--mg-color-dark-40-hsl));
|
|
219
|
+
}
|
|
220
|
+
.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-title {
|
|
221
|
+
margin: 0 1.1rem;
|
|
222
|
+
}
|
|
223
|
+
.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-sections {
|
|
224
|
+
display: flex;
|
|
225
|
+
flex-wrap: wrap;
|
|
226
|
+
gap: calc(0.4rem * 1);
|
|
227
|
+
flex-direction: column;
|
|
228
|
+
}
|
|
229
|
+
.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-sections-container {
|
|
230
|
+
display: flex;
|
|
231
|
+
flex-wrap: nowrap;
|
|
232
|
+
gap: calc(0.4rem * 0);
|
|
233
|
+
flex-direction: column;
|
|
234
|
+
max-height: 80vh;
|
|
235
|
+
padding-right: 1rem;
|
|
236
|
+
overflow-y: auto;
|
|
237
|
+
}
|
|
238
|
+
.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-section-header {
|
|
239
|
+
display: flex;
|
|
240
|
+
flex-wrap: wrap;
|
|
241
|
+
gap: calc(0.4rem * 2);
|
|
242
|
+
flex-direction: row;
|
|
243
|
+
align-items: center;
|
|
244
|
+
min-height: var(--default-size);
|
|
245
|
+
}
|
|
214
246
|
.mg-input.mg-input--checkbox-multi .mg-input__input-checkbox-multi-inputs {
|
|
215
247
|
margin: 0;
|
|
248
|
+
padding: 0.4rem calc(0.4rem * 2) 0.4rem calc(0.4rem / 2);
|
|
216
249
|
}
|
|
217
250
|
.mg-input.mg-input--checkbox-multi:not(.mg-input--label-on-top) mg-tooltip {
|
|
218
251
|
margin-left: var(--mg-inputs-spacer);
|
|
219
252
|
}
|
|
220
253
|
.mg-input.mg-input--checkbox-multi mg-popover {
|
|
221
254
|
--mg-popover-min-width: 7rem;
|
|
255
|
+
--mg-card-padding: calc(0.4rem * 2);
|
|
222
256
|
}
|
|
223
257
|
.mg-input.mg-input--checkbox-multi mg-popover [slot=content] {
|
|
224
258
|
display: flex;
|
|
225
|
-
flex-
|
|
259
|
+
flex-wrap: wrap;
|
|
226
260
|
gap: calc(0.4rem * 2);
|
|
261
|
+
flex-direction: column;
|
|
262
|
+
}
|
|
263
|
+
.mg-input.mg-input--checkbox-multi mg-popover [slot=content] .mg-input__input-group {
|
|
264
|
+
margin-left: calc(0.4rem * 2);
|
|
227
265
|
}
|
|
228
266
|
.mg-input.mg-input--checkbox-multi mg-input-text {
|
|
229
267
|
--mg-inputs-margin-bottom: 0;
|