@mgdis/mg-components 5.10.0 → 5.11.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-9e1091ab.js → index-03d2557d.js} +3 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_31.cjs.entry.js +444 -455
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-item-more.cjs.entry.js +20 -29
- package/dist/cjs/{mg-menu.conf-1942ac70.js → mg-menu.conf-05ec32a3.js} +30 -16
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +8 -9
- package/dist/collection/components/atoms/mg-button/mg-button.js +16 -20
- package/dist/collection/components/atoms/mg-card/mg-card.css +2 -0
- package/dist/collection/components/atoms/mg-card/mg-card.js +10 -12
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -2
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -1
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +17 -19
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -2
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -13
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +20 -25
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +26 -18
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.css +18 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +126 -19
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -12
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -22
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -10
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -18
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -32
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +16 -31
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +13 -17
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.css +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -23
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -18
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -29
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -15
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -19
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -2
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -7
- package/dist/collection/components/molecules/mg-message/mg-message.css +1 -0
- package/dist/collection/components/molecules/mg-message/mg-message.js +11 -14
- package/dist/collection/components/molecules/mg-modal/mg-modal.css +1 -0
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +7 -11
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -13
- package/dist/collection/components/molecules/mg-panel/mg-panel.css +1 -0
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +6 -15
- package/dist/collection/components/molecules/mg-popover/mg-popover.css +2 -0
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +16 -16
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +2 -4
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -24
- package/dist/collection/locales/en/messages.json +7 -0
- package/dist/collection/locales/fr/messages.json +7 -0
- package/dist/collection/locales/index.js +2 -2
- package/dist/collection/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/collection/utils/behaviors.utils.js +16 -22
- package/dist/collection/utils/components.utils.js +21 -23
- package/dist/collection/utils/locale.utils.js +14 -14
- package/dist/collection/utils/unit.test.utils.js +7 -10
- package/dist/components/MgInput.js +30 -18
- package/dist/components/components.utils.js +21 -23
- package/dist/components/index2.js +30 -16
- package/dist/components/mg-action-more.js +9 -13
- package/dist/components/mg-badge2.js +8 -9
- package/dist/components/mg-button2.js +16 -20
- package/dist/components/mg-card2.js +9 -11
- package/dist/components/mg-character-left2.js +1 -2
- package/dist/components/mg-details.js +1 -3
- package/dist/components/mg-divider.js +1 -1
- package/dist/components/mg-form.js +7 -15
- package/dist/components/mg-icon2.js +17 -19
- package/dist/components/mg-illustrated-message.js +1 -2
- package/dist/components/mg-input-checkbox.js +126 -21
- package/dist/components/mg-input-date.js +7 -9
- package/dist/components/mg-input-numeric.js +14 -19
- package/dist/components/mg-input-password.js +6 -7
- package/dist/components/mg-input-radio.js +10 -15
- package/dist/components/mg-input-select2.js +21 -29
- package/dist/components/mg-input-text2.js +15 -24
- package/dist/components/mg-input-textarea.js +13 -14
- package/dist/components/mg-input-title2.js +1 -2
- package/dist/components/mg-input-toggle.js +17 -20
- package/dist/components/mg-item-more.js +18 -27
- package/dist/components/mg-menu-item2.js +17 -26
- package/dist/components/mg-menu2.js +9 -16
- package/dist/components/mg-message.js +12 -15
- package/dist/components/mg-modal.js +8 -12
- package/dist/components/mg-pagination.js +11 -13
- package/dist/components/mg-panel.js +7 -16
- package/dist/components/mg-popover2.js +17 -17
- package/dist/components/mg-skip-links.js +2 -4
- package/dist/components/mg-tabs.js +20 -24
- package/dist/components/mg-tag.js +11 -13
- package/dist/components/mg-tooltip2.js +20 -25
- package/dist/esm/{index-3249671d.js → index-407d5211.js} +3 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_31.entry.js +444 -455
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-item-more.entry.js +20 -29
- package/dist/esm/{mg-menu.conf-2cc1bb67.js → mg-menu.conf-c8aa56ce.js} +30 -16
- package/dist/mg-components/locales/en/messages.json +7 -0
- package/dist/mg-components/locales/fr/messages.json +7 -0
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-3bf533f7.js +2 -0
- package/dist/mg-components/p-51c2def3.entry.js +1 -0
- package/dist/mg-components/p-b14be68b.js +1 -0
- package/dist/mg-components/{p-a56a3157.entry.js → p-d3ed97d3.entry.js} +1 -1
- package/dist/mg-components/styles/reset-mg-card-slotted-variables.scss +1 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -3
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -9
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +2 -6
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -2
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -1
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +3 -5
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -2
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -5
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +15 -21
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -5
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.conf.d.ts +8 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +40 -7
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -6
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -14
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -4
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -10
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.conf.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +9 -13
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -12
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -5
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -6
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -18
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -31
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -10
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -3
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -11
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -2
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -7
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -7
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -7
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -9
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -13
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +7 -9
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -4
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -19
- package/dist/types/components.d.ts +31 -35
- package/dist/types/locales/index.d.ts +16 -2
- package/dist/types/utils/behaviors.utils.d.ts +14 -20
- package/dist/types/utils/components.utils.d.ts +18 -20
- package/dist/types/utils/locale.utils.d.ts +14 -14
- package/dist/types/utils/unit.test.utils.d.ts +11 -17
- package/package.json +4 -4
- package/dist/mg-components/p-73156ac9.js +0 -1
- package/dist/mg-components/p-8fbc0d87.js +0 -2
- package/dist/mg-components/p-eb32bb18.entry.js +0 -1
|
@@ -46,29 +46,27 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
46
46
|
**********/
|
|
47
47
|
/**
|
|
48
48
|
* Toggle expanded prop value
|
|
49
|
-
* @returns {void}
|
|
50
49
|
*/
|
|
51
50
|
this.toggleExpanded = () => {
|
|
52
51
|
this.expanded = !this.expanded;
|
|
53
52
|
};
|
|
54
53
|
/**
|
|
55
54
|
* Does an Element have given Status
|
|
56
|
-
* @param
|
|
57
|
-
* @param
|
|
58
|
-
* @returns
|
|
55
|
+
* @param mgMenuItemElement - to parse
|
|
56
|
+
* @param status - to check
|
|
57
|
+
* @returns true if element with status is found
|
|
59
58
|
*/
|
|
60
59
|
this.hasStatus = (mgMenuItemElement, status) => mgMenuItemElement.status === status;
|
|
61
60
|
/**
|
|
62
61
|
* Is component contextual direction match the given direction
|
|
63
|
-
* @param
|
|
64
|
-
* @param
|
|
65
|
-
* @returns
|
|
62
|
+
* @param direction - in parent menu
|
|
63
|
+
* @param compareWith - direction to compare with. Default: `this.direction`
|
|
64
|
+
* @returns true is direction match the direction propertie
|
|
66
65
|
*/
|
|
67
66
|
this.isDirection = (direction, compareWith = this.direction) => direction === compareWith;
|
|
68
67
|
/**
|
|
69
68
|
* Update displayNotificationBadge
|
|
70
69
|
* current component notification badge have priority over the slot badge when submenu contain badge
|
|
71
|
-
* @returns {void} update displayNotificationBadge value
|
|
72
70
|
*/
|
|
73
71
|
this.updateDisplayNotificationBadge = () => {
|
|
74
72
|
const childMenu = this.element.querySelector('mg-menu');
|
|
@@ -78,7 +76,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
78
76
|
};
|
|
79
77
|
/**
|
|
80
78
|
* Method to control if one of component children have active status
|
|
81
|
-
* @returns
|
|
79
|
+
* @returns truthy if component has active child
|
|
82
80
|
*/
|
|
83
81
|
this.hasActiveChild = () => {
|
|
84
82
|
var _a;
|
|
@@ -86,8 +84,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
86
84
|
};
|
|
87
85
|
/**
|
|
88
86
|
* Validate slots
|
|
89
|
-
* @param
|
|
90
|
-
* @returns {void}
|
|
87
|
+
* @param guard - prevent action whith guard. Default: false.
|
|
91
88
|
*/
|
|
92
89
|
this.validateSlot = (guard = false) => {
|
|
93
90
|
// slot title AND metadata validation
|
|
@@ -105,8 +102,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
105
102
|
};
|
|
106
103
|
/**
|
|
107
104
|
* Update status
|
|
108
|
-
* @param
|
|
109
|
-
* @returns {void}
|
|
105
|
+
* @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
|
|
110
106
|
*/
|
|
111
107
|
this.updateStatus = (guard = []) => {
|
|
112
108
|
if (![Status.HIDDEN, Status.DISABLED, ...guard].includes(this.status)) {
|
|
@@ -115,7 +111,6 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
115
111
|
};
|
|
116
112
|
/**
|
|
117
113
|
* Init event-listeners
|
|
118
|
-
* @returns {void}
|
|
119
114
|
*/
|
|
120
115
|
this.initListeners = () => {
|
|
121
116
|
var _a;
|
|
@@ -131,12 +126,12 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
131
126
|
};
|
|
132
127
|
/**
|
|
133
128
|
* Get mg-popover identifier
|
|
134
|
-
* @returns
|
|
129
|
+
* @returns generated mg-popover identifier
|
|
135
130
|
*/
|
|
136
131
|
this.getPopoverIdentifier = () => `${this.identifier}-popover`;
|
|
137
132
|
/**
|
|
138
133
|
* Condition to know if component should display a mg-popover
|
|
139
|
-
* @returns
|
|
134
|
+
* @returns truthy if component display popover
|
|
140
135
|
*/
|
|
141
136
|
this.displayPopover = () => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
|
|
142
137
|
/************
|
|
@@ -144,8 +139,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
144
139
|
************/
|
|
145
140
|
/**
|
|
146
141
|
* Handle interacrtive element click
|
|
147
|
-
* @param
|
|
148
|
-
* @returns {void}
|
|
142
|
+
* @param event - click on element
|
|
149
143
|
*/
|
|
150
144
|
this.handleElementCLick = (event) => {
|
|
151
145
|
if ((this.hasChildren && !this.isInMainMenu) || this.status === Status.DISABLED) {
|
|
@@ -158,15 +152,14 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
158
152
|
};
|
|
159
153
|
/**
|
|
160
154
|
* Handle popover element display-change event
|
|
161
|
-
* @param
|
|
162
|
-
* @returns {void}
|
|
155
|
+
* @param event - popover display event
|
|
163
156
|
*/
|
|
164
157
|
this.handlePopoverDisplay = (event) => {
|
|
165
158
|
this.expanded = event.detail;
|
|
166
159
|
};
|
|
167
160
|
/**
|
|
168
161
|
* Render slot
|
|
169
|
-
* @returns
|
|
162
|
+
* @returns HTML Element
|
|
170
163
|
*/
|
|
171
164
|
this.renderSlot = () => h("slot", null);
|
|
172
165
|
this.identifier = createID('mg-menu-item');
|
|
@@ -232,7 +225,6 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
232
225
|
}
|
|
233
226
|
/**
|
|
234
227
|
* Render popover clickoutside guard for content slot
|
|
235
|
-
* @returns {void}
|
|
236
228
|
*/
|
|
237
229
|
updatePopoverGuard() {
|
|
238
230
|
if (this.displayPopover())
|
|
@@ -245,7 +237,6 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
245
237
|
*************/
|
|
246
238
|
/**
|
|
247
239
|
* Validate props
|
|
248
|
-
* @returns {void}
|
|
249
240
|
*/
|
|
250
241
|
componentWillLoad() {
|
|
251
242
|
// has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
|
|
@@ -261,7 +252,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
261
252
|
}
|
|
262
253
|
/**
|
|
263
254
|
* Check if component slots configuration
|
|
264
|
-
* @returns
|
|
255
|
+
* @returns timeout
|
|
265
256
|
*/
|
|
266
257
|
componentDidLoad() {
|
|
267
258
|
// validation
|
|
@@ -300,7 +291,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
300
291
|
}
|
|
301
292
|
/**
|
|
302
293
|
* Render ineractive element
|
|
303
|
-
* @returns
|
|
294
|
+
* @returns HTML Element
|
|
304
295
|
*/
|
|
305
296
|
renderInteractiveElement() {
|
|
306
297
|
const TagName = this.href !== undefined ? 'a' : 'button';
|
|
@@ -312,7 +303,7 @@ const MgMenuItem = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
312
303
|
}
|
|
313
304
|
/**
|
|
314
305
|
* Render
|
|
315
|
-
* @returns
|
|
306
|
+
* @returns HTML Element
|
|
316
307
|
*/
|
|
317
308
|
render() {
|
|
318
309
|
const getContainerClasses = () => ({
|
|
@@ -19,9 +19,8 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
19
19
|
*************/
|
|
20
20
|
/**
|
|
21
21
|
* Close matching menu-item
|
|
22
|
-
* @param
|
|
23
|
-
* @param
|
|
24
|
-
* @returns {void}
|
|
22
|
+
* @param item - menu-item to close
|
|
23
|
+
* @param condition - addionnal condition
|
|
25
24
|
*/
|
|
26
25
|
this.closeMenuItem = (item, condition) => {
|
|
27
26
|
if (!this.isChildMenu && condition) {
|
|
@@ -30,19 +29,18 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
30
29
|
};
|
|
31
30
|
/**
|
|
32
31
|
* get mg-item-more element
|
|
33
|
-
* @returns
|
|
32
|
+
* @returns mg-item-more element
|
|
34
33
|
*/
|
|
35
34
|
this.getItemMore = () => this.element.querySelector('mg-item-more');
|
|
36
35
|
/**
|
|
37
|
-
* get mg-item-more
|
|
38
|
-
* @returns
|
|
36
|
+
* get mg-item-more child mg-menu-item element
|
|
37
|
+
* @returns mg-menu-item element
|
|
39
38
|
*/
|
|
40
39
|
this.getItemMoreMenuItem = () => { var _a, _b; return (_b = (_a = this.getItemMore()) === null || _a === void 0 ? void 0 : _a.shadowRoot) === null || _b === void 0 ? void 0 : _b.querySelector('mg-menu-item'); };
|
|
41
40
|
/**
|
|
42
41
|
* Set item listend
|
|
43
|
-
* @param
|
|
44
|
-
* @param
|
|
45
|
-
* @returns {void}
|
|
42
|
+
* @param item - mg-menu-item element
|
|
43
|
+
* @param index - number
|
|
46
44
|
*/
|
|
47
45
|
this.setItemListener = (item, index) => {
|
|
48
46
|
['click', 'focus'].forEach(trigger => {
|
|
@@ -57,7 +55,6 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
57
55
|
};
|
|
58
56
|
/**
|
|
59
57
|
* Store menu-items on component init and add listeners
|
|
60
|
-
* @returns {void}
|
|
61
58
|
*/
|
|
62
59
|
this.initMenuItemsListeners = () => {
|
|
63
60
|
// add listeners on menu item and edit index
|
|
@@ -67,14 +64,12 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
67
64
|
};
|
|
68
65
|
/**
|
|
69
66
|
* Handle item-loaded event on mg-item-more element
|
|
70
|
-
* @returns {void}
|
|
71
67
|
*/
|
|
72
68
|
this.handleItemLoaded = () => {
|
|
73
69
|
this.setItemListener(this.getItemMoreMenuItem(), this.menuItems.length);
|
|
74
70
|
};
|
|
75
71
|
/**
|
|
76
72
|
* render mg-item-more
|
|
77
|
-
* @returns {void}
|
|
78
73
|
*/
|
|
79
74
|
this.renderMgItemMore = () => {
|
|
80
75
|
// /!\ externalise item tag name to get a string type and bypass type checking when value is used in next createElement
|
|
@@ -116,7 +111,6 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
116
111
|
*************/
|
|
117
112
|
/**
|
|
118
113
|
* Validate props
|
|
119
|
-
* @returns {void}
|
|
120
114
|
*/
|
|
121
115
|
componentWillLoad() {
|
|
122
116
|
this.validateDirection(this.direction);
|
|
@@ -126,7 +120,7 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
126
120
|
}
|
|
127
121
|
/**
|
|
128
122
|
* Check if component slots configuration
|
|
129
|
-
* @returns
|
|
123
|
+
* @returns timeout
|
|
130
124
|
*/
|
|
131
125
|
componentDidLoad() {
|
|
132
126
|
// update props and states after componentDidLoad hook
|
|
@@ -156,14 +150,13 @@ const MgMenu = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
156
150
|
}
|
|
157
151
|
/**
|
|
158
152
|
* Add listeners to items
|
|
159
|
-
* @returns {void}
|
|
160
153
|
*/
|
|
161
154
|
componentDidRender() {
|
|
162
155
|
this.initMenuItemsListeners();
|
|
163
156
|
}
|
|
164
157
|
/**
|
|
165
158
|
* Render
|
|
166
|
-
* @returns
|
|
159
|
+
* @returns HTML Element
|
|
167
160
|
*/
|
|
168
161
|
render() {
|
|
169
162
|
return (h(Host, { role: this.isChildMenu ? 'menu' : 'menubar', "aria-label": this.label }, h("slot", null)));
|
|
@@ -10,7 +10,7 @@ import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
|
10
10
|
*/
|
|
11
11
|
const variants = ['info', 'warning', 'success', 'danger'];
|
|
12
12
|
|
|
13
|
-
const mgMessageCss = ":host{--mg-card-padding:0;--mg-card-border-radius:var(--mg-message-border-radius);--mg-card-border:none;--mg-card-overflow:hidden}.mg-message{display:inline-block;min-height:var(--default-size)}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{--mg-card-padding:0 3.4rem 0 0}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset}.mg-message,mg-message{max-width:100%}";
|
|
13
|
+
const mgMessageCss = ":host{--mg-card-padding:0;--mg-card-border-radius:var(--mg-message-border-radius);--mg-card-border:none;--mg-card-overflow:hidden}.mg-message{display:inline-block;min-height:var(--default-size)}.mg-message.mg-message--info .mg-message__icon{color:hsl(var(--color-info))}.mg-message.mg-message--warning .mg-message__icon{color:hsl(var(--color-warning))}.mg-message.mg-message--success .mg-message__icon{color:hsl(var(--color-success))}.mg-message.mg-message--danger .mg-message__icon{color:hsl(var(--color-danger))}.mg-message.mg-message--close-button{--mg-card-padding:0 3.4rem 0 0}.mg-message.mg-message--hide{display:none}.mg-message ::slotted(*){margin:0;padding:0}.mg-message__icon{position:absolute;top:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2);left:1.3rem;line-height:1}.mg-message__content{display:flex;flex-wrap:wrap;justify-content:flex-end;align-content:stretch;padding:0 1rem 0 3.8rem}.mg-message__content-slot{flex-grow:1;margin:0.84rem 0}.mg-message__content-separator{display:inline-block;width:4.5rem;height:0}.mg-message__content-actions-slot{padding:1rem 0;text-align:right}.mg-message__close-button{position:absolute;top:0;right:0}.mg-message ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset;--mg-card-min-width:unset}.mg-message,mg-message{max-width:100%}";
|
|
14
14
|
|
|
15
15
|
const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
16
16
|
constructor() {
|
|
@@ -33,22 +33,19 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
33
33
|
this.isHovered = false;
|
|
34
34
|
/**
|
|
35
35
|
* Set timer
|
|
36
|
-
* @returns {void}
|
|
37
36
|
*/
|
|
38
37
|
this.setTimer = () => {
|
|
39
38
|
this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
|
|
40
39
|
};
|
|
41
40
|
/**
|
|
42
41
|
* Clear timer
|
|
43
|
-
* @returns {void}
|
|
44
42
|
*/
|
|
45
43
|
this.clearTimer = () => {
|
|
46
44
|
clearTimeout(this.storedTimer);
|
|
47
45
|
};
|
|
48
46
|
/**
|
|
49
47
|
* Event to add on element
|
|
50
|
-
* @param
|
|
51
|
-
* @returns {void}
|
|
48
|
+
* @param event - event
|
|
52
49
|
*/
|
|
53
50
|
this.timerEvents = (event) => {
|
|
54
51
|
this.clearTimer();
|
|
@@ -71,7 +68,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
71
68
|
};
|
|
72
69
|
/**
|
|
73
70
|
* Get icon corresponding to variant
|
|
74
|
-
* @returns
|
|
71
|
+
* @returns icon
|
|
75
72
|
*/
|
|
76
73
|
this.getIcon = () => {
|
|
77
74
|
switch (this.variant) {
|
|
@@ -90,7 +87,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
90
87
|
this.variant = variants[0];
|
|
91
88
|
this.closeButton = false;
|
|
92
89
|
this.hide = false;
|
|
93
|
-
this.
|
|
90
|
+
this.classCollection = new ClassList(['mg-message']);
|
|
94
91
|
this.hasActions = false;
|
|
95
92
|
}
|
|
96
93
|
validateDelay(newValue) {
|
|
@@ -104,9 +101,9 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
104
101
|
}
|
|
105
102
|
else {
|
|
106
103
|
if (oldValue !== undefined) {
|
|
107
|
-
this.
|
|
104
|
+
this.classCollection.delete(`mg-message--${oldValue}`);
|
|
108
105
|
}
|
|
109
|
-
this.
|
|
106
|
+
this.classCollection.add(`mg-message--${newValue}`);
|
|
110
107
|
}
|
|
111
108
|
}
|
|
112
109
|
validateCloseButton(newValue) {
|
|
@@ -118,7 +115,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
118
115
|
validateHide(newValue) {
|
|
119
116
|
if (newValue) {
|
|
120
117
|
this.componentHide.emit();
|
|
121
|
-
this.
|
|
118
|
+
this.classCollection.add(this.classHide);
|
|
122
119
|
// Remove event Listener
|
|
123
120
|
['focusin', 'mouseenter'].forEach(event => {
|
|
124
121
|
this.element.removeEventListener(event, this.timerEvents);
|
|
@@ -128,7 +125,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
125
|
}
|
|
129
126
|
else {
|
|
130
127
|
this.componentShow.emit();
|
|
131
|
-
this.
|
|
128
|
+
this.classCollection.delete(this.classHide);
|
|
132
129
|
// If delay is set
|
|
133
130
|
if (this.delay > 1) {
|
|
134
131
|
// Start timer
|
|
@@ -155,7 +152,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
155
152
|
this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
|
|
156
153
|
this.validateCloseButton(this.closeButton);
|
|
157
154
|
if (this.closeButton) {
|
|
158
|
-
this.
|
|
155
|
+
this.classCollection.add('mg-message--close-button');
|
|
159
156
|
this.closeButtonId = `${this.identifier}-close-button`;
|
|
160
157
|
}
|
|
161
158
|
this.validateDelay(this.delay);
|
|
@@ -163,10 +160,10 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
163
160
|
}
|
|
164
161
|
/**
|
|
165
162
|
* Render
|
|
166
|
-
* @returns
|
|
163
|
+
* @returns HTML Element
|
|
167
164
|
*/
|
|
168
165
|
render() {
|
|
169
|
-
return (h("div", { id: this.identifier, class: this.
|
|
166
|
+
return (h("div", { id: this.identifier, class: this.classCollection.join(), role: this.variant === 'info' ? 'status' : 'alert' }, h("mg-card", { variant: this.variant, "variant-style": "bar-left" }, h("span", { class: "mg-message__icon" }, h("mg-icon", { icon: this.getIcon() })), h("div", { class: "mg-message__content" }, h("span", { class: "mg-message__content-slot" }, h("slot", null)), this.hasActions && h("span", { class: "mg-message__content-separator" }), this.hasActions && (h("span", { class: "mg-message__content-actions-slot" }, h("slot", { name: "actions" })))), this.closeButton && (h("span", { class: "mg-message__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.message.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))))));
|
|
170
167
|
}
|
|
171
168
|
get element() { return this; }
|
|
172
169
|
static get watchers() { return {
|
|
@@ -182,7 +179,7 @@ const MgMessage$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
182
179
|
"variant": [1],
|
|
183
180
|
"closeButton": [1028, "close-button"],
|
|
184
181
|
"hide": [1028],
|
|
185
|
-
"
|
|
182
|
+
"classCollection": [32],
|
|
186
183
|
"hasActions": [32]
|
|
187
184
|
}]);
|
|
188
185
|
function defineCustomElement$1() {
|
|
@@ -5,7 +5,7 @@ import { d as defineCustomElement$4 } from './mg-button2.js';
|
|
|
5
5
|
import { d as defineCustomElement$3 } from './mg-card2.js';
|
|
6
6
|
import { d as defineCustomElement$2 } from './mg-icon2.js';
|
|
7
7
|
|
|
8
|
-
const mgModalCss = ":host{--mg-card-border-radius:var(--mg-modal-border-radius);--mg-card-padding:1.5rem 2.5rem;--mg-card-border:none}.mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:hsl(var(--color-light), 0.85)}.mg-modal mg-card{display:flex;width:60rem;max-width:100%;max-height:100%}.mg-modal__dialog{display:flex;position:relative;flex-direction:column;align-self:center;row-gap:3rem;height:fit-content;max-height:100%}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}.mg-modal ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset}";
|
|
8
|
+
const mgModalCss = ":host{--mg-card-border-radius:var(--mg-modal-border-radius);--mg-card-padding:1.5rem 2.5rem;--mg-card-border:none}.mg-modal{display:flex;justify-content:center;align-items:center;position:fixed;top:0;right:0;bottom:0;left:0;z-index:2000;padding:2rem 0;background-color:hsl(var(--color-light), 0.85)}.mg-modal mg-card{display:flex;width:60rem;max-width:100%;max-height:100%}.mg-modal__dialog{display:flex;position:relative;flex-direction:column;align-self:center;row-gap:3rem;height:fit-content;max-height:100%}.mg-modal__header{margin-bottom:0.5rem}.mg-modal__title{margin:0;font-family:var(--font-family-heading);font-size:var(--mg-modal-title-font-size);font-weight:600}.mg-modal__close-button{float:right;height:var(--mg-modal-title-font-size);margin-top:calc((var(--default-size) - var(--mg-modal-title-font-size) * var(--line-height)) / 2 * -1);margin-right:calc((var(--default-size) - var(--mg-icon-regular-size)) / 2 * -1)}.mg-modal__content{overflow-y:auto}.mg-modal__content::slotted(*){font-size:var(--mg-modal-content-font-size)}.mg-modal.mg-modal--hide{display:none}.mg-modal ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset;--mg-card-min-width:unset}";
|
|
9
9
|
|
|
10
10
|
const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
11
11
|
constructor() {
|
|
@@ -55,7 +55,6 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
55
55
|
*************/
|
|
56
56
|
/**
|
|
57
57
|
* Handle close button
|
|
58
|
-
* @returns {void}
|
|
59
58
|
*/
|
|
60
59
|
this.handleClose = () => {
|
|
61
60
|
this.hide = true;
|
|
@@ -66,7 +65,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
66
65
|
this.hide = false;
|
|
67
66
|
this.hasActions = false;
|
|
68
67
|
this.hasContent = false;
|
|
69
|
-
this.
|
|
68
|
+
this.classCollection = new ClassList(['mg-modal']);
|
|
70
69
|
}
|
|
71
70
|
validateModalTitle(newValue) {
|
|
72
71
|
if (typeof newValue !== 'string' || newValue.trim() === '') {
|
|
@@ -76,19 +75,18 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
76
75
|
validateHide(newValue) {
|
|
77
76
|
if (newValue) {
|
|
78
77
|
this.componentHide.emit();
|
|
79
|
-
this.
|
|
78
|
+
this.classCollection.add(this.classHide);
|
|
80
79
|
document.body.style.overflow = this.bodyOverflow;
|
|
81
80
|
}
|
|
82
81
|
else {
|
|
83
82
|
this.componentShow.emit();
|
|
84
|
-
this.
|
|
83
|
+
this.classCollection.delete(this.classHide);
|
|
85
84
|
document.body.style.overflow = 'hidden';
|
|
86
85
|
}
|
|
87
86
|
}
|
|
88
87
|
/**
|
|
89
88
|
* Handle 'escape' key down
|
|
90
|
-
* @param
|
|
91
|
-
* @returns {void}
|
|
89
|
+
* @param event - keydown event
|
|
92
90
|
*/
|
|
93
91
|
handleKeyDown(event) {
|
|
94
92
|
// we can use 'Escape button" when this not a blocking modal, induced by closeButton value.
|
|
@@ -101,7 +99,6 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
101
99
|
*************/
|
|
102
100
|
/**
|
|
103
101
|
* Check if component props are well configured on init
|
|
104
|
-
* @returns {void}
|
|
105
102
|
*/
|
|
106
103
|
componentWillLoad() {
|
|
107
104
|
// Store body overflow
|
|
@@ -120,7 +117,6 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
120
117
|
}
|
|
121
118
|
/**
|
|
122
119
|
* Add observer on component to set focus when displayed
|
|
123
|
-
* @returns {void}
|
|
124
120
|
*/
|
|
125
121
|
componentDidLoad() {
|
|
126
122
|
new MutationObserver(mutationList => {
|
|
@@ -135,10 +131,10 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
135
131
|
}
|
|
136
132
|
/**
|
|
137
133
|
* Render
|
|
138
|
-
* @returns
|
|
134
|
+
* @returns HTML Element
|
|
139
135
|
*/
|
|
140
136
|
render() {
|
|
141
|
-
return (h("div", { role: "alertdialog", id: this.identifier, class: this.
|
|
137
|
+
return (h("div", { role: "alertdialog", id: this.identifier, class: this.classCollection.join(), tabindex: "-1", "aria-labelledby": this.titleId, "aria-modal": "true", "aria-hidden": this.hide }, h("mg-card", null, h("div", { class: "mg-modal__dialog" }, h("header", { class: "mg-modal__header" }, this.closeButton && (h("span", { class: "mg-modal__close-button" }, h("mg-button", { identifier: this.closeButtonId, "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { icon: "cross" })))), h("h1", { class: "mg-modal__title", id: this.titleId }, this.modalTitle)), this.hasContent && (h("article", { class: "mg-modal__content" }, h("slot", { name: "content" }))), this.hasActions && (h("footer", { class: "mg-modal__footer" }, h("slot", { name: "actions" })))))));
|
|
142
138
|
}
|
|
143
139
|
get element() { return this; }
|
|
144
140
|
static get watchers() { return {
|
|
@@ -153,7 +149,7 @@ const MgModal$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
153
149
|
"hide": [1028],
|
|
154
150
|
"hasActions": [32],
|
|
155
151
|
"hasContent": [32],
|
|
156
|
-
"
|
|
152
|
+
"classCollection": [32]
|
|
157
153
|
}, [[8, "keydown", "handleKeyDown"]]]);
|
|
158
154
|
function defineCustomElement$1() {
|
|
159
155
|
if (typeof customElements === "undefined") {
|
|
@@ -18,6 +18,7 @@ const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1
|
|
|
18
18
|
/**
|
|
19
19
|
* Range generator
|
|
20
20
|
*
|
|
21
|
+
* ```
|
|
21
22
|
* start by get the range length, add "+ 1" to include last value, ex: Math.ceil((3 + 1 - 1) / 1) => 3
|
|
22
23
|
* then with Array(Math.ceil...) we get the final array with empty values, ex: Array(Math.ceil(2 + 1 - 1) / 1)) => [empty, empty, empty]
|
|
23
24
|
* then with Array(Math.ceil...).keys() we get the Array Iterator from empty values
|
|
@@ -25,14 +26,15 @@ const mgPaginationCss = ".sr-only{border:0 !important;clip:rect(1px, 1px, 1px, 1
|
|
|
25
26
|
* ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()) => [0, 1, 2]
|
|
26
27
|
* finaly we map values from "start" range and apply the "step" coefficiant,
|
|
27
28
|
* ex: Array.from(Array(Math.ceil((2 + 1 - 1) / 1) || 1).keys()).map(x => 1 + x * 1) => [1, 2, 3]
|
|
29
|
+
* ```
|
|
28
30
|
*
|
|
29
31
|
* range(1, 1) = [1]
|
|
30
32
|
* range(1, 5) = [1, 2, 3, 4, 5]
|
|
31
33
|
* range(10, 20, 2) = [10, 12, 14, 16, 18, 20]
|
|
32
|
-
* @param
|
|
33
|
-
* @param
|
|
34
|
-
* @param
|
|
35
|
-
* @returns
|
|
34
|
+
* @param start - start range
|
|
35
|
+
* @param end - start end
|
|
36
|
+
* @param step - step size
|
|
37
|
+
* @returns range numbers
|
|
36
38
|
*/
|
|
37
39
|
const range = (start, end, step = 1) => Array.from(Array(Math.ceil((end + 1 - start) / step)).keys()).map(x => start + x * step);
|
|
38
40
|
const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
@@ -43,8 +45,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
43
45
|
this.currentPageChange = createEvent(this, "current-page-change", 7);
|
|
44
46
|
/**
|
|
45
47
|
* Change current page from target
|
|
46
|
-
* @param
|
|
47
|
-
* @returns {void}
|
|
48
|
+
* @param target - target page
|
|
48
49
|
*/
|
|
49
50
|
this.goToPage = (target) => {
|
|
50
51
|
this.currentPage = target;
|
|
@@ -54,8 +55,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
54
55
|
************/
|
|
55
56
|
/**
|
|
56
57
|
* select handler
|
|
57
|
-
* @param
|
|
58
|
-
* @returns {void}
|
|
58
|
+
* @param event - value change event
|
|
59
59
|
*/
|
|
60
60
|
this.handleSelect = (event) => {
|
|
61
61
|
const to = Number(event.target.value);
|
|
@@ -63,9 +63,8 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
63
63
|
};
|
|
64
64
|
/**
|
|
65
65
|
* Go to 'previous/next' page button handler
|
|
66
|
-
* @param
|
|
67
|
-
* @param
|
|
68
|
-
* @returns {void}
|
|
66
|
+
* @param action - navigation action
|
|
67
|
+
* @param disabled - button disable state
|
|
69
68
|
*/
|
|
70
69
|
this.handleGoToPage = (action, disabled) => {
|
|
71
70
|
!disabled && this.goToPage(action === NavigationAction.NEXT ? this.currentPage + 1 : this.currentPage - 1);
|
|
@@ -95,7 +94,6 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
95
94
|
*************/
|
|
96
95
|
/**
|
|
97
96
|
* Check if props are well configured on init
|
|
98
|
-
* @returns {void}
|
|
99
97
|
*/
|
|
100
98
|
componentWillLoad() {
|
|
101
99
|
// Get locales
|
|
@@ -110,7 +108,7 @@ const MgPagination$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElemen
|
|
|
110
108
|
}
|
|
111
109
|
/**
|
|
112
110
|
* Render
|
|
113
|
-
* @returns
|
|
111
|
+
* @returns HTML Element
|
|
114
112
|
*/
|
|
115
113
|
render() {
|
|
116
114
|
const navigationActionButton = (disabled, action) => (h("mg-button", { identifier: `${this.identifier}-button-${action}`, label: this.messages.pagination[`${action}Page`],
|
|
@@ -9,7 +9,7 @@ import { d as defineCustomElement$4 } from './mg-input-text2.js';
|
|
|
9
9
|
import { d as defineCustomElement$3 } from './mg-input-title2.js';
|
|
10
10
|
import { d as defineCustomElement$2 } from './mg-tooltip2.js';
|
|
11
11
|
|
|
12
|
-
const mgPanelCss = ":host{--mg-card-border:none;--mg-card-padding:0;--mg-card-border-radius:var(--mg-panel-border-radius);--mg-card-background:hsl(var(--mg-panel-background));--mg-card-box-shadow:var(--mg-panel-box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto;min-height:var(--default-size);align-items:center}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}.mg-panel ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset}";
|
|
12
|
+
const mgPanelCss = ":host{--mg-card-border:none;--mg-card-padding:0;--mg-card-border-radius:var(--mg-panel-border-radius);--mg-card-background:hsl(var(--mg-panel-background));--mg-card-box-shadow:var(--mg-panel-box-shadow)}.mg-panel__header{display:flex;flex-wrap:wrap;justify-content:space-between;padding:0 1rem 0 0.3rem;align-items:flex-start}.mg-panel__header-left,.mg-panel__header-right{display:flex;margin:0.3rem 0}.mg-panel__header-right{padding-left:0.3rem;flex:1 auto;min-height:var(--default-size);align-items:center}.mg-panel__header-left mg-input-text{flex-grow:1;margin-left:0.3rem}.mg-panel__header-left mg-button+mg-button:not([slot=append-input]){margin-left:0.3rem}.mg-panel__header-left.mg-panel__header-left--full{flex:1 1 auto}.mg-panel__collapse-button-content{--font-size:1.4rem;--mg-button-font-weight:600}.mg-panel__content{padding:var(--mg-panel-content-padding)}.mg-panel ::slotted([slot=header-right]){display:flex;flex-wrap:wrap;gap:1rem;margin-left:auto}.mg-panel ::slotted(*){--mg-card-border:var(--mg-card-border-default);--mg-card-padding:var(--mg-card-padding-default);--mg-card-border-radius:var(--mg-card-border-radius-default);--mg-card-background:var(--mg-card-background-default);--mg-card-box-shadow:var(--mg-card-box-shadow-default);--mg-card-max-width:unset;--mg-card-min-width:unset}";
|
|
13
13
|
|
|
14
14
|
const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
15
15
|
constructor() {
|
|
@@ -23,7 +23,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
23
23
|
************/
|
|
24
24
|
/**
|
|
25
25
|
* Toggle is editing state
|
|
26
|
-
* @returns {void}
|
|
27
26
|
*/
|
|
28
27
|
this.toggleIsEditing = () => {
|
|
29
28
|
this.isEditing = !this.isEditing;
|
|
@@ -33,7 +32,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
33
32
|
************/
|
|
34
33
|
/**
|
|
35
34
|
* Collapse button click handler
|
|
36
|
-
* @returns {void}
|
|
37
35
|
*/
|
|
38
36
|
this.handleCollapseButton = () => {
|
|
39
37
|
if (!this.expandToggleDisabled) {
|
|
@@ -42,22 +40,19 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
42
40
|
};
|
|
43
41
|
/**
|
|
44
42
|
* Edit button click handler
|
|
45
|
-
* @returns {void}
|
|
46
43
|
*/
|
|
47
44
|
this.handleEditButton = () => {
|
|
48
45
|
this.toggleIsEditing();
|
|
49
46
|
};
|
|
50
47
|
/**
|
|
51
48
|
* Update title handler
|
|
52
|
-
* @param
|
|
53
|
-
* @returns {void}
|
|
49
|
+
* @param event - input value change event
|
|
54
50
|
*/
|
|
55
51
|
this.handleUpdateTitle = (event) => {
|
|
56
52
|
this.updatedPanelTitle = event.detail;
|
|
57
53
|
};
|
|
58
54
|
/**
|
|
59
55
|
* Cancel edition button handler
|
|
60
|
-
* @returns {void}
|
|
61
56
|
*/
|
|
62
57
|
this.handleCancelEditButton = () => {
|
|
63
58
|
this.updatedPanelTitle = undefined;
|
|
@@ -65,7 +60,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
65
60
|
};
|
|
66
61
|
/**
|
|
67
62
|
* Validate edition button handler
|
|
68
|
-
* @returns {void}
|
|
69
63
|
*/
|
|
70
64
|
this.handleValidateEditButton = () => {
|
|
71
65
|
if (this.editInputElement.valid) {
|
|
@@ -76,8 +70,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
76
70
|
};
|
|
77
71
|
/**
|
|
78
72
|
* Header left conditional render
|
|
79
|
-
* @
|
|
80
|
-
* @returns {HTMLMgButtonElement | HTMLElement | HTMLElement[]} header left element
|
|
73
|
+
* @returns header left element
|
|
81
74
|
*/
|
|
82
75
|
this.headerLeft = () => {
|
|
83
76
|
const collapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", identifier: `${this.identifier}-collapse-button`, "aria-expanded": this.expanded !== undefined && this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled }, h("span", { class: "mg-panel__collapse-button-content" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down' }), !this.isEditing && this.panelTitle)));
|
|
@@ -102,7 +95,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
102
95
|
this.expanded = false;
|
|
103
96
|
this.expandToggleDisabled = undefined;
|
|
104
97
|
this.titleEditable = false;
|
|
105
|
-
this.
|
|
98
|
+
this.classCollection = new ClassList(['mg-panel']);
|
|
106
99
|
this.isEditing = false;
|
|
107
100
|
this.updatedPanelTitle = undefined;
|
|
108
101
|
}
|
|
@@ -128,7 +121,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
128
121
|
*************/
|
|
129
122
|
/**
|
|
130
123
|
* Check if props are well configured on init
|
|
131
|
-
* @returns {void}
|
|
132
124
|
*/
|
|
133
125
|
componentWillLoad() {
|
|
134
126
|
// Get locales
|
|
@@ -139,7 +131,6 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
139
131
|
}
|
|
140
132
|
/**
|
|
141
133
|
* Edit DOM after render
|
|
142
|
-
* @returns {void}
|
|
143
134
|
*/
|
|
144
135
|
componentDidRender() {
|
|
145
136
|
// when we are editing we get focus on edition input
|
|
@@ -149,10 +140,10 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
149
140
|
}
|
|
150
141
|
/**
|
|
151
142
|
* Render component
|
|
152
|
-
* @returns
|
|
143
|
+
* @returns html element
|
|
153
144
|
*/
|
|
154
145
|
render() {
|
|
155
|
-
return (h("section", { class: this.
|
|
146
|
+
return (h("section", { class: this.classCollection.join(), id: this.identifier }, h("mg-card", null, h("header", { class: "mg-panel__header", id: `${this.identifier}-header` }, h("div", { class: `mg-panel__header-left ${this.isEditing ? 'mg-panel__header-left--full' : ''}` }, this.headerLeft()), h("div", { class: "mg-panel__header-right" }, h("slot", { name: "header-right" }))), h("article", { class: "mg-panel__content", id: `${this.identifier}-content`, "aria-labelledby": `${this.identifier}-header`, hidden: !this.expanded }, h("slot", null)))));
|
|
156
147
|
}
|
|
157
148
|
get element() { return this; }
|
|
158
149
|
static get watchers() { return {
|
|
@@ -169,7 +160,7 @@ const MgPanel$1 = /*@__PURE__*/ proxyCustomElement(class extends HTMLElement {
|
|
|
169
160
|
"expanded": [1028],
|
|
170
161
|
"expandToggleDisabled": [4, "expand-toggle-disabled"],
|
|
171
162
|
"titleEditable": [4, "title-editable"],
|
|
172
|
-
"
|
|
163
|
+
"classCollection": [32],
|
|
173
164
|
"isEditing": [32],
|
|
174
165
|
"updatedPanelTitle": [32]
|
|
175
166
|
}]);
|