@mgdis/mg-components 5.9.1 → 5.10.1
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 +345 -648
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +19 -43
- package/dist/cjs/{mg-menu.conf-9afe6571.js → mg-menu.conf-196151fe.js} +16 -21
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -12
- package/dist/collection/components/atoms/mg-button/mg-button.js +18 -27
- package/dist/collection/components/atoms/mg-card/mg-card.js +22 -15
- package/dist/collection/components/atoms/mg-character-left/mg-character-left.js +1 -4
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +1 -2
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +26 -23
- package/dist/collection/components/atoms/mg-input-title/mg-input-title.js +1 -4
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +11 -16
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +12 -34
- package/dist/collection/components/molecules/inputs/MgInput.conf.js +4 -1
- package/dist/collection/components/molecules/inputs/MgInput.js +26 -24
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +10 -20
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +7 -17
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +14 -34
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +6 -13
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -27
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -45
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +17 -43
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +14 -22
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +17 -28
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +11 -29
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +20 -47
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -23
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -27
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -4
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +4 -12
- package/dist/collection/components/molecules/mg-message/mg-message.js +12 -20
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +8 -17
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +11 -19
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +11 -30
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +8 -21
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +3 -8
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +20 -36
- package/dist/collection/locales/index.js +2 -3
- package/dist/collection/utils/behaviors.utils.js +16 -32
- package/dist/collection/utils/components.utils.js +22 -33
- package/dist/collection/utils/locale.utils.js +14 -18
- package/dist/collection/utils/unit.test.utils.js +7 -15
- package/dist/components/MgInput.js +30 -24
- package/dist/components/components.utils.js +22 -33
- package/dist/components/index2.js +16 -21
- package/dist/components/mg-action-more.js +9 -21
- package/dist/components/mg-badge2.js +9 -12
- package/dist/components/mg-button2.js +18 -27
- package/dist/components/mg-card2.js +20 -13
- package/dist/components/mg-character-left2.js +1 -4
- package/dist/components/mg-details.js +1 -6
- package/dist/components/mg-divider.js +1 -2
- package/dist/components/mg-form.js +7 -23
- package/dist/components/mg-icon2.js +26 -23
- package/dist/components/mg-illustrated-message.js +1 -4
- package/dist/components/mg-input-checkbox.js +9 -16
- package/dist/components/mg-input-date.js +6 -13
- package/dist/components/mg-input-numeric.js +13 -30
- package/dist/components/mg-input-password.js +5 -9
- package/dist/components/mg-input-radio.js +9 -23
- package/dist/components/mg-input-select2.js +20 -41
- package/dist/components/mg-input-text2.js +15 -35
- package/dist/components/mg-input-textarea.js +13 -18
- package/dist/components/mg-input-title2.js +1 -4
- package/dist/components/mg-input-toggle.js +16 -24
- package/dist/components/mg-item-more.js +18 -42
- package/dist/components/mg-menu-item2.js +17 -44
- package/dist/components/mg-menu2.js +9 -27
- package/dist/components/mg-message.js +12 -20
- package/dist/components/mg-modal.js +8 -17
- package/dist/components/mg-pagination.js +11 -19
- package/dist/components/mg-panel.js +11 -30
- package/dist/components/mg-popover2.js +8 -21
- package/dist/components/mg-skip-links.js +3 -8
- package/dist/components/mg-tabs.js +20 -36
- package/dist/components/mg-tag.js +11 -16
- package/dist/components/mg-tooltip2.js +12 -34
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +345 -648
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +19 -43
- package/dist/esm/{mg-menu.conf-881fbd82.js → mg-menu.conf-9ca023ee.js} +16 -21
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-67ce7cb8.entry.js → p-97aaca3e.entry.js} +1 -1
- package/dist/mg-components/p-d891e707.entry.js +1 -0
- package/dist/types/components/atoms/mg-badge/mg-badge.d.ts +2 -5
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -14
- package/dist/types/components/atoms/mg-card/mg-card.d.ts +11 -8
- package/dist/types/components/atoms/mg-character-left/mg-character-left.d.ts +1 -4
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +1 -2
- package/dist/types/components/atoms/mg-icon/mg-icon.d.ts +8 -7
- package/dist/types/components/atoms/mg-input-title/mg-input-title.d.ts +1 -4
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +3 -8
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +11 -33
- package/dist/types/components/molecules/inputs/MgInput.conf.d.ts +2 -1
- package/dist/types/components/molecules/inputs/MgInput.d.ts +5 -6
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +5 -11
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -11
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +7 -26
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +3 -7
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +5 -18
- 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 -22
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +3 -23
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -9
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -11
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +10 -29
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +21 -49
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +3 -15
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -6
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +3 -19
- package/dist/types/components/molecules/mg-illustrated-message/mg-illustrated-message.d.ts +1 -4
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +2 -12
- package/dist/types/components/molecules/mg-message/mg-message.d.ts +4 -12
- package/dist/types/components/molecules/mg-modal/mg-modal.d.ts +3 -12
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +5 -14
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +4 -23
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -16
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +2 -7
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +15 -30
- package/dist/types/components.d.ts +22 -34
- package/dist/types/locales/index.d.ts +2 -3
- package/dist/types/utils/behaviors.utils.d.ts +14 -29
- package/dist/types/utils/components.utils.d.ts +19 -29
- package/dist/types/utils/locale.utils.d.ts +14 -18
- package/dist/types/utils/unit.test.utils.d.ts +11 -24
- package/package.json +11 -12
- package/dist/mg-components/p-9a93b7af.entry.js +0 -1
- /package/dist/mg-components/{p-367f92d2.js → p-0d3146d9.js} +0 -0
|
@@ -15,33 +15,27 @@ export class MgMenuItem {
|
|
|
15
15
|
**********/
|
|
16
16
|
/**
|
|
17
17
|
* Toggle expanded prop value
|
|
18
|
-
*
|
|
19
|
-
* @returns {void}
|
|
20
18
|
*/
|
|
21
19
|
this.toggleExpanded = () => {
|
|
22
20
|
this.expanded = !this.expanded;
|
|
23
21
|
};
|
|
24
22
|
/**
|
|
25
23
|
* Does an Element have given Status
|
|
26
|
-
*
|
|
27
|
-
* @param
|
|
28
|
-
* @
|
|
29
|
-
* @returns {boolean} true if element with status is found
|
|
24
|
+
* @param mgMenuItemElement - to parse
|
|
25
|
+
* @param status - to check
|
|
26
|
+
* @returns true if element with status is found
|
|
30
27
|
*/
|
|
31
28
|
this.hasStatus = (mgMenuItemElement, status) => mgMenuItemElement.status === status;
|
|
32
29
|
/**
|
|
33
30
|
* Is component contextual direction match the given direction
|
|
34
|
-
*
|
|
35
|
-
* @param
|
|
36
|
-
* @
|
|
37
|
-
* @returns {boolean} true is direction match the direction propertie
|
|
31
|
+
* @param direction - in parent menu
|
|
32
|
+
* @param compareWith - direction to compare with. Default: `this.direction`
|
|
33
|
+
* @returns true is direction match the direction propertie
|
|
38
34
|
*/
|
|
39
35
|
this.isDirection = (direction, compareWith = this.direction) => direction === compareWith;
|
|
40
36
|
/**
|
|
41
37
|
* Update displayNotificationBadge
|
|
42
38
|
* current component notification badge have priority over the slot badge when submenu contain badge
|
|
43
|
-
*
|
|
44
|
-
* @returns {void} update displayNotificationBadge value
|
|
45
39
|
*/
|
|
46
40
|
this.updateDisplayNotificationBadge = () => {
|
|
47
41
|
const childMenu = this.element.querySelector('mg-menu');
|
|
@@ -51,8 +45,7 @@ export class MgMenuItem {
|
|
|
51
45
|
};
|
|
52
46
|
/**
|
|
53
47
|
* Method to control if one of component children have active status
|
|
54
|
-
*
|
|
55
|
-
* @returns {boolean} truthy if component has active child
|
|
48
|
+
* @returns truthy if component has active child
|
|
56
49
|
*/
|
|
57
50
|
this.hasActiveChild = () => {
|
|
58
51
|
var _a;
|
|
@@ -60,9 +53,7 @@ export class MgMenuItem {
|
|
|
60
53
|
};
|
|
61
54
|
/**
|
|
62
55
|
* Validate slots
|
|
63
|
-
*
|
|
64
|
-
* @param {boolean} guard prevent action whith guard. Default: false.
|
|
65
|
-
* @returns {void}
|
|
56
|
+
* @param guard - prevent action whith guard. Default: false.
|
|
66
57
|
*/
|
|
67
58
|
this.validateSlot = (guard = false) => {
|
|
68
59
|
// slot title AND metadata validation
|
|
@@ -80,9 +71,7 @@ export class MgMenuItem {
|
|
|
80
71
|
};
|
|
81
72
|
/**
|
|
82
73
|
* Update status
|
|
83
|
-
*
|
|
84
|
-
* @param {Status[]} guard status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
|
|
85
|
-
* @returns {void}
|
|
74
|
+
* @param guard - status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
|
|
86
75
|
*/
|
|
87
76
|
this.updateStatus = (guard = []) => {
|
|
88
77
|
if (![Status.HIDDEN, Status.DISABLED, ...guard].includes(this.status)) {
|
|
@@ -91,8 +80,6 @@ export class MgMenuItem {
|
|
|
91
80
|
};
|
|
92
81
|
/**
|
|
93
82
|
* Init event-listeners
|
|
94
|
-
*
|
|
95
|
-
* @returns {void}
|
|
96
83
|
*/
|
|
97
84
|
this.initListeners = () => {
|
|
98
85
|
var _a;
|
|
@@ -108,14 +95,12 @@ export class MgMenuItem {
|
|
|
108
95
|
};
|
|
109
96
|
/**
|
|
110
97
|
* Get mg-popover identifier
|
|
111
|
-
*
|
|
112
|
-
* @returns {MgPopover['identifier']} generated mg-popover identifier
|
|
98
|
+
* @returns generated mg-popover identifier
|
|
113
99
|
*/
|
|
114
100
|
this.getPopoverIdentifier = () => `${this.identifier}-popover`;
|
|
115
101
|
/**
|
|
116
102
|
* Condition to know if component should display a mg-popover
|
|
117
|
-
*
|
|
118
|
-
* @returns {boolean} truthy if component display popover
|
|
103
|
+
* @returns truthy if component display popover
|
|
119
104
|
*/
|
|
120
105
|
this.displayPopover = () => this.isDirection(Direction.HORIZONTAL) && this.hasChildren && this.href === undefined;
|
|
121
106
|
/************
|
|
@@ -123,9 +108,7 @@ export class MgMenuItem {
|
|
|
123
108
|
************/
|
|
124
109
|
/**
|
|
125
110
|
* Handle interacrtive element click
|
|
126
|
-
*
|
|
127
|
-
* @param {MouseEvent} event click on element
|
|
128
|
-
* @returns {void}
|
|
111
|
+
* @param event - click on element
|
|
129
112
|
*/
|
|
130
113
|
this.handleElementCLick = (event) => {
|
|
131
114
|
if ((this.hasChildren && !this.isInMainMenu) || this.status === Status.DISABLED) {
|
|
@@ -138,17 +121,14 @@ export class MgMenuItem {
|
|
|
138
121
|
};
|
|
139
122
|
/**
|
|
140
123
|
* Handle popover element display-change event
|
|
141
|
-
*
|
|
142
|
-
* @param {CustomEvent} event popover display event
|
|
143
|
-
* @returns {void}
|
|
124
|
+
* @param event - popover display event
|
|
144
125
|
*/
|
|
145
126
|
this.handlePopoverDisplay = (event) => {
|
|
146
127
|
this.expanded = event.detail;
|
|
147
128
|
};
|
|
148
129
|
/**
|
|
149
130
|
* Render slot
|
|
150
|
-
*
|
|
151
|
-
* @returns {HTMLElement} HTML Element
|
|
131
|
+
* @returns HTML Element
|
|
152
132
|
*/
|
|
153
133
|
this.renderSlot = () => h("slot", null);
|
|
154
134
|
this.identifier = createID('mg-menu-item');
|
|
@@ -214,8 +194,6 @@ export class MgMenuItem {
|
|
|
214
194
|
}
|
|
215
195
|
/**
|
|
216
196
|
* Render popover clickoutside guard for content slot
|
|
217
|
-
*
|
|
218
|
-
* @returns {void}
|
|
219
197
|
*/
|
|
220
198
|
updatePopoverGuard() {
|
|
221
199
|
if (this.displayPopover())
|
|
@@ -228,8 +206,6 @@ export class MgMenuItem {
|
|
|
228
206
|
*************/
|
|
229
207
|
/**
|
|
230
208
|
* Validate props
|
|
231
|
-
*
|
|
232
|
-
* @returns {void}
|
|
233
209
|
*/
|
|
234
210
|
componentWillLoad() {
|
|
235
211
|
// has children items that is NOT [slot='image' | 'information' | 'label' | 'metadata'] element
|
|
@@ -245,8 +221,7 @@ export class MgMenuItem {
|
|
|
245
221
|
}
|
|
246
222
|
/**
|
|
247
223
|
* Check if component slots configuration
|
|
248
|
-
*
|
|
249
|
-
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
224
|
+
* @returns timeout
|
|
250
225
|
*/
|
|
251
226
|
componentDidLoad() {
|
|
252
227
|
// validation
|
|
@@ -285,8 +260,7 @@ export class MgMenuItem {
|
|
|
285
260
|
}
|
|
286
261
|
/**
|
|
287
262
|
* Render ineractive element
|
|
288
|
-
*
|
|
289
|
-
* @returns {HTMLElement} HTML Element
|
|
263
|
+
* @returns HTML Element
|
|
290
264
|
*/
|
|
291
265
|
renderInteractiveElement() {
|
|
292
266
|
const TagName = this.href !== undefined ? 'a' : 'button';
|
|
@@ -298,8 +272,7 @@ export class MgMenuItem {
|
|
|
298
272
|
}
|
|
299
273
|
/**
|
|
300
274
|
* Render
|
|
301
|
-
*
|
|
302
|
-
* @returns {HTMLElement} HTML Element
|
|
275
|
+
* @returns HTML Element
|
|
303
276
|
*/
|
|
304
277
|
render() {
|
|
305
278
|
const getContainerClasses = () => ({
|
|
@@ -337,7 +310,7 @@ export class MgMenuItem {
|
|
|
337
310
|
"optional": false,
|
|
338
311
|
"docs": {
|
|
339
312
|
"tags": [],
|
|
340
|
-
"text": "Identifier is used to control mg-popover
|
|
313
|
+
"text": "Identifier is used to control mg-popover"
|
|
341
314
|
},
|
|
342
315
|
"attribute": "identifier",
|
|
343
316
|
"reflect": false,
|
|
@@ -377,7 +350,7 @@ export class MgMenuItem {
|
|
|
377
350
|
"optional": false,
|
|
378
351
|
"docs": {
|
|
379
352
|
"tags": [],
|
|
380
|
-
"text": "Define menu-item status.
|
|
353
|
+
"text": "Define menu-item status."
|
|
381
354
|
},
|
|
382
355
|
"attribute": "status",
|
|
383
356
|
"reflect": true,
|
|
@@ -395,7 +368,7 @@ export class MgMenuItem {
|
|
|
395
368
|
"optional": false,
|
|
396
369
|
"docs": {
|
|
397
370
|
"tags": [],
|
|
398
|
-
"text": "Define menu-item content expanded.
|
|
371
|
+
"text": "Define menu-item content expanded."
|
|
399
372
|
},
|
|
400
373
|
"attribute": "expanded",
|
|
401
374
|
"reflect": false,
|
|
@@ -5,9 +5,8 @@ import { Direction } from '../menu/mg-menu/mg-menu.conf';
|
|
|
5
5
|
import { createID } from '../../../utils/components.utils';
|
|
6
6
|
/**
|
|
7
7
|
* MgActionMore['items'] type guard
|
|
8
|
-
*
|
|
9
|
-
* @
|
|
10
|
-
* @returns {boolean} return true if type is valid
|
|
8
|
+
* @param prop - commponent items prop
|
|
9
|
+
* @returns return true if type is valid
|
|
11
10
|
*/
|
|
12
11
|
const isMgActionMoreItems = (prop) => {
|
|
13
12
|
const items = prop;
|
|
@@ -15,9 +14,8 @@ const isMgActionMoreItems = (prop) => {
|
|
|
15
14
|
};
|
|
16
15
|
/**
|
|
17
16
|
* MgActionMore['button'] type guard
|
|
18
|
-
*
|
|
19
|
-
* @
|
|
20
|
-
* @returns {boolean} return true if type is valid
|
|
17
|
+
* @param prop - commponent button prop
|
|
18
|
+
* @returns return true if type is valid
|
|
21
19
|
*/
|
|
22
20
|
const isMgActionMoreButton = (prop) => {
|
|
23
21
|
const button = prop;
|
|
@@ -25,9 +23,8 @@ const isMgActionMoreButton = (prop) => {
|
|
|
25
23
|
};
|
|
26
24
|
/**
|
|
27
25
|
* MgActionMore['icon'] type guard
|
|
28
|
-
*
|
|
29
|
-
* @
|
|
30
|
-
* @returns {boolean} return true if type is valid
|
|
26
|
+
* @param prop - commponent icon prop
|
|
27
|
+
* @returns return true if type is valid
|
|
31
28
|
*/
|
|
32
29
|
const isMgActionMoreIcon = (prop) => {
|
|
33
30
|
const icon = prop;
|
|
@@ -45,26 +42,20 @@ export class MgActionMore {
|
|
|
45
42
|
***********/
|
|
46
43
|
/**
|
|
47
44
|
* Toogle expanded props
|
|
48
|
-
*
|
|
49
|
-
* @returns {void}
|
|
50
45
|
*/
|
|
51
46
|
this.toggleExpanded = () => {
|
|
52
47
|
this.expanded = !this.expanded;
|
|
53
48
|
};
|
|
54
49
|
/**
|
|
55
50
|
* Button click handler
|
|
56
|
-
*
|
|
57
|
-
* @returns {void}
|
|
58
51
|
*/
|
|
59
52
|
this.handleButton = () => {
|
|
60
53
|
this.toggleExpanded();
|
|
61
54
|
};
|
|
62
55
|
/**
|
|
63
56
|
* Item click handler
|
|
64
|
-
*
|
|
65
|
-
* @param
|
|
66
|
-
* @param {MgActionMoreItemType['mouseEventHandler']} customHandler item['mouseEventHandler']
|
|
67
|
-
* @returns {void}
|
|
57
|
+
* @param event - click event
|
|
58
|
+
* @param customHandler - item['mouseEventHandler']
|
|
68
59
|
*/
|
|
69
60
|
this.handleItemClick = (event, customHandler) => {
|
|
70
61
|
this.expanded = false;
|
|
@@ -101,8 +92,6 @@ export class MgActionMore {
|
|
|
101
92
|
*************/
|
|
102
93
|
/**
|
|
103
94
|
* Validate props
|
|
104
|
-
*
|
|
105
|
-
* @returns {void}
|
|
106
95
|
*/
|
|
107
96
|
componentWillLoad() {
|
|
108
97
|
this.messages = initLocales(this.element).messages.actionMore;
|
|
@@ -113,8 +102,7 @@ export class MgActionMore {
|
|
|
113
102
|
}
|
|
114
103
|
/**
|
|
115
104
|
* Render
|
|
116
|
-
*
|
|
117
|
-
* @returns {HTMLElement} HTML Element
|
|
105
|
+
* @returns HTML Element
|
|
118
106
|
*/
|
|
119
107
|
render() {
|
|
120
108
|
const buttonLabel = this.button.label || this.messages.label;
|
|
@@ -164,7 +152,7 @@ export class MgActionMore {
|
|
|
164
152
|
"optional": false,
|
|
165
153
|
"docs": {
|
|
166
154
|
"tags": [],
|
|
167
|
-
"text": "Define displaied icon
|
|
155
|
+
"text": "Define displaied icon"
|
|
168
156
|
},
|
|
169
157
|
"defaultValue": "{ icon: 'ellipsis' }"
|
|
170
158
|
},
|
|
@@ -185,7 +173,7 @@ export class MgActionMore {
|
|
|
185
173
|
"optional": false,
|
|
186
174
|
"docs": {
|
|
187
175
|
"tags": [],
|
|
188
|
-
"text": "Define button properties
|
|
176
|
+
"text": "Define button properties"
|
|
189
177
|
},
|
|
190
178
|
"defaultValue": "{ variant: 'flat', isIcon: true }"
|
|
191
179
|
},
|
|
@@ -3,8 +3,6 @@ export class MgDetails {
|
|
|
3
3
|
constructor() {
|
|
4
4
|
/**
|
|
5
5
|
* Handle details toggle
|
|
6
|
-
*
|
|
7
|
-
* @returns {void}
|
|
8
6
|
*/
|
|
9
7
|
this.handleToggle = () => {
|
|
10
8
|
this.expanded = this.details.open;
|
|
@@ -27,8 +25,6 @@ export class MgDetails {
|
|
|
27
25
|
*************/
|
|
28
26
|
/**
|
|
29
27
|
* Check if component props are well configured on init
|
|
30
|
-
*
|
|
31
|
-
* @returns {void}
|
|
32
28
|
*/
|
|
33
29
|
componentWillLoad() {
|
|
34
30
|
this.validateTitles(this.toggleClosed);
|
|
@@ -36,8 +32,7 @@ export class MgDetails {
|
|
|
36
32
|
}
|
|
37
33
|
/**
|
|
38
34
|
* Render
|
|
39
|
-
*
|
|
40
|
-
* @returns {HTMLElement} HTML Element
|
|
35
|
+
* @returns HTML Element
|
|
41
36
|
*/
|
|
42
37
|
render() {
|
|
43
38
|
return (h("details", { class: "mg-details", onToggle: this.handleToggle, open: this.expanded, ref: el => (this.details = el) }, h("summary", null, h("slot", { name: "summary" }), h("span", { class: "mg-details__toggle" }, h("mg-icon", { icon: this.expanded ? 'chevron-up' : 'chevron-down', size: "small" }), h("span", { class: { 'sr-only': this.hideSummary } }, this.expanded ? this.toggleOpened : this.toggleClosed))), h("div", { class: "mg-details__details" }, h("slot", { name: "details" }))));
|
|
@@ -7,14 +7,11 @@ export class MgForm {
|
|
|
7
7
|
this.classAllRequired = 'mg-form--all-required';
|
|
8
8
|
/**
|
|
9
9
|
* Define required message based on mg-inputs required elements
|
|
10
|
-
* Also
|
|
11
|
-
*
|
|
12
|
-
* @returns {void}
|
|
13
10
|
*/
|
|
14
11
|
this.setRequiredMessage = () => {
|
|
15
12
|
// init required message
|
|
16
13
|
this.requiredMessage = null;
|
|
17
|
-
this.
|
|
14
|
+
this.classCollection.delete(this.classAllRequired);
|
|
18
15
|
// If the form is disabled or readonly none of them are required
|
|
19
16
|
// Check if all fields are not editable (readonly or disabled)
|
|
20
17
|
if (!this.disabled && !this.readonly && !this.mgInputs.every(input => input.disabled || input.readonly)) {
|
|
@@ -24,7 +21,7 @@ export class MgForm {
|
|
|
24
21
|
// mg-input-toggle can not be required
|
|
25
22
|
if (requiredInputs.length > 0 && requiredInputs.length === this.mgInputs.filter(input => input.nodeName !== 'MG-INPUT-TOGGLE').length) {
|
|
26
23
|
this.requiredMessage = requiredInputs.length === 1 ? this.messages.form.allRequiredSingle : this.messages.form.allRequired;
|
|
27
|
-
this.
|
|
24
|
+
this.classCollection.add(this.classAllRequired);
|
|
28
25
|
}
|
|
29
26
|
// Some fields are required
|
|
30
27
|
else if (requiredInputs.length > 0) {
|
|
@@ -34,8 +31,6 @@ export class MgForm {
|
|
|
34
31
|
};
|
|
35
32
|
/**
|
|
36
33
|
* Check if form is valid
|
|
37
|
-
*
|
|
38
|
-
* @returns {void}
|
|
39
34
|
*/
|
|
40
35
|
this.checkValidity = () => {
|
|
41
36
|
// Update required on input event
|
|
@@ -47,9 +42,7 @@ export class MgForm {
|
|
|
47
42
|
};
|
|
48
43
|
/**
|
|
49
44
|
* Handle Form Submit
|
|
50
|
-
*
|
|
51
|
-
* @param {SubmitEvent} event submit event
|
|
52
|
-
* @returns {void}
|
|
45
|
+
* @param event - submit event
|
|
53
46
|
*/
|
|
54
47
|
this.handleFormSubmit = (event) => {
|
|
55
48
|
event.preventDefault();
|
|
@@ -57,8 +50,6 @@ export class MgForm {
|
|
|
57
50
|
};
|
|
58
51
|
/**
|
|
59
52
|
* Set mgInputs
|
|
60
|
-
*
|
|
61
|
-
* @returns {void}
|
|
62
53
|
*/
|
|
63
54
|
this.setMgInputs = () => {
|
|
64
55
|
// Get slotted mgInputs
|
|
@@ -80,7 +71,7 @@ export class MgForm {
|
|
|
80
71
|
this.disabled = false;
|
|
81
72
|
this.valid = undefined;
|
|
82
73
|
this.invalid = undefined;
|
|
83
|
-
this.
|
|
74
|
+
this.classCollection = new ClassList(['mg-form']);
|
|
84
75
|
this.requiredMessage = undefined;
|
|
85
76
|
}
|
|
86
77
|
handleAttributeChange() {
|
|
@@ -89,8 +80,6 @@ export class MgForm {
|
|
|
89
80
|
}
|
|
90
81
|
/**
|
|
91
82
|
* Public method to display errors
|
|
92
|
-
*
|
|
93
|
-
* @returns {Promise<void>}
|
|
94
83
|
*/
|
|
95
84
|
async displayError() {
|
|
96
85
|
if (!this.readonly) {
|
|
@@ -105,8 +94,6 @@ export class MgForm {
|
|
|
105
94
|
*************/
|
|
106
95
|
/**
|
|
107
96
|
* Check if component props are well configured on init
|
|
108
|
-
*
|
|
109
|
-
* @returns {void}
|
|
110
97
|
*/
|
|
111
98
|
componentWillLoad() {
|
|
112
99
|
// Get locales
|
|
@@ -133,8 +120,6 @@ export class MgForm {
|
|
|
133
120
|
}
|
|
134
121
|
/**
|
|
135
122
|
* Add slot listeners
|
|
136
|
-
*
|
|
137
|
-
* @returns {void}
|
|
138
123
|
*/
|
|
139
124
|
componentDidLoad() {
|
|
140
125
|
this.mgButtons.forEach(mgButton => {
|
|
@@ -152,11 +137,10 @@ export class MgForm {
|
|
|
152
137
|
}
|
|
153
138
|
/**
|
|
154
139
|
* Render
|
|
155
|
-
*
|
|
156
|
-
* @returns {HTMLElement} HTML Element
|
|
140
|
+
* @returns HTML Element
|
|
157
141
|
*/
|
|
158
142
|
render() {
|
|
159
|
-
return (h("form", { class: this.
|
|
143
|
+
return (h("form", { class: this.classCollection.join(), id: this.identifier, name: this.name, ref: el => (this.form = el), onSubmit: this.handleFormSubmit }, this.requiredMessage && h("p", { innerHTML: this.requiredMessage }), h("slot", null), !this.readonly && !this.disabled && h("slot", { name: "actions" })));
|
|
160
144
|
}
|
|
161
145
|
static get is() { return "mg-form"; }
|
|
162
146
|
static get encapsulation() { return "shadow"; }
|
|
@@ -282,7 +266,7 @@ export class MgForm {
|
|
|
282
266
|
}
|
|
283
267
|
static get states() {
|
|
284
268
|
return {
|
|
285
|
-
"
|
|
269
|
+
"classCollection": {},
|
|
286
270
|
"requiredMessage": {}
|
|
287
271
|
};
|
|
288
272
|
}
|
|
@@ -334,10 +318,7 @@ export class MgForm {
|
|
|
334
318
|
},
|
|
335
319
|
"docs": {
|
|
336
320
|
"text": "Public method to display errors",
|
|
337
|
-
"tags": [
|
|
338
|
-
"name": "returns",
|
|
339
|
-
"text": undefined
|
|
340
|
-
}]
|
|
321
|
+
"tags": []
|
|
341
322
|
}
|
|
342
323
|
}
|
|
343
324
|
};
|
package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js
CHANGED
|
@@ -10,8 +10,6 @@ export class MgIllustratedMessage {
|
|
|
10
10
|
*************/
|
|
11
11
|
/**
|
|
12
12
|
* Check if component props are well configured on init
|
|
13
|
-
*
|
|
14
|
-
* @returns {void}
|
|
15
13
|
*/
|
|
16
14
|
componentDidLoad() {
|
|
17
15
|
const headingTags = ['h1', 'h2', 'h3', 'h4', 'h5', 'h6'];
|
|
@@ -26,8 +24,7 @@ export class MgIllustratedMessage {
|
|
|
26
24
|
}
|
|
27
25
|
/**
|
|
28
26
|
* Render
|
|
29
|
-
*
|
|
30
|
-
* @returns {HTMLElement} HTML Element
|
|
27
|
+
* @returns HTML Element
|
|
31
28
|
*/
|
|
32
29
|
render() {
|
|
33
30
|
return (h("div", { class: {
|
|
@@ -13,8 +13,7 @@ export class MgItemMore {
|
|
|
13
13
|
***********/
|
|
14
14
|
/**
|
|
15
15
|
* render mg-item-more overflow element
|
|
16
|
-
*
|
|
17
|
-
* @returns {HTMLMgItemMoreElement} mg-item-more element
|
|
16
|
+
* @returns mg-item-more element
|
|
18
17
|
*/
|
|
19
18
|
this.renderMgMenuItemOverflowElement = () => {
|
|
20
19
|
// create menu items proxy element from item clones
|
|
@@ -63,16 +62,12 @@ export class MgItemMore {
|
|
|
63
62
|
*************/
|
|
64
63
|
/**
|
|
65
64
|
* Disconnect overflow ResizeObserver
|
|
66
|
-
*
|
|
67
|
-
* @returns {void} run overflow resize obeserver disconnexion
|
|
68
65
|
*/
|
|
69
66
|
disconnectedCallback() {
|
|
70
67
|
this.overflowBehavior.disconnect();
|
|
71
68
|
}
|
|
72
69
|
/**
|
|
73
70
|
* Set variables and validate props
|
|
74
|
-
*
|
|
75
|
-
* @returns {void}
|
|
76
71
|
*/
|
|
77
72
|
componentWillLoad() {
|
|
78
73
|
// init variables
|
|
@@ -86,16 +81,13 @@ export class MgItemMore {
|
|
|
86
81
|
}
|
|
87
82
|
/**
|
|
88
83
|
* Add overflow behavior
|
|
89
|
-
*
|
|
90
|
-
* @returns {void}
|
|
91
84
|
*/
|
|
92
85
|
componentDidLoad() {
|
|
93
86
|
this.overflowBehavior = new OverflowBehavior(this.parentMenu, this.renderMgMenuItemOverflowElement);
|
|
94
87
|
}
|
|
95
88
|
/**
|
|
96
89
|
* Render
|
|
97
|
-
*
|
|
98
|
-
* @returns {HTMLElement} HTML Element
|
|
90
|
+
* @returns HTML Element
|
|
99
91
|
*/
|
|
100
92
|
render() {
|
|
101
93
|
return (h(Host, { role: "menuitem", "aria-haspopup": "true" }, h("mg-menu-item", { "data-overflow-more": true, "data-size": this.parentMenu.size }, h("mg-icon", { icon: this.icon.icon, slot: "image" }), h("span", { class: { 'sr-only': !this.slotlabel.display }, slot: "label" }, this.slotlabel.label), h("mg-menu", { direction: Direction.VERTICAL, label: this.messages.moreLabel, size: this.size }))));
|
|
@@ -131,7 +123,7 @@ export class MgItemMore {
|
|
|
131
123
|
"optional": false,
|
|
132
124
|
"docs": {
|
|
133
125
|
"tags": [],
|
|
134
|
-
"text": "Define icon
|
|
126
|
+
"text": "Define icon"
|
|
135
127
|
},
|
|
136
128
|
"defaultValue": "{ icon: 'ellipsis-vertical' }"
|
|
137
129
|
},
|
|
@@ -152,7 +144,7 @@ export class MgItemMore {
|
|
|
152
144
|
"optional": false,
|
|
153
145
|
"docs": {
|
|
154
146
|
"tags": [],
|
|
155
|
-
"text": "Define slot label element
|
|
147
|
+
"text": "Define slot label element"
|
|
156
148
|
},
|
|
157
149
|
"defaultValue": "{ display: false }"
|
|
158
150
|
},
|
|
@@ -18,25 +18,19 @@ export class MgMessage {
|
|
|
18
18
|
this.isHovered = false;
|
|
19
19
|
/**
|
|
20
20
|
* Set timer
|
|
21
|
-
*
|
|
22
|
-
* @returns {void}
|
|
23
21
|
*/
|
|
24
22
|
this.setTimer = () => {
|
|
25
23
|
this.storedTimer = setTimeout(() => (this.hide = true), this.delay * 1000);
|
|
26
24
|
};
|
|
27
25
|
/**
|
|
28
26
|
* Clear timer
|
|
29
|
-
*
|
|
30
|
-
* @returns {void}
|
|
31
27
|
*/
|
|
32
28
|
this.clearTimer = () => {
|
|
33
29
|
clearTimeout(this.storedTimer);
|
|
34
30
|
};
|
|
35
31
|
/**
|
|
36
32
|
* Event to add on element
|
|
37
|
-
*
|
|
38
|
-
* @param {MouseEvent | FocusEvent} event event
|
|
39
|
-
* @returns {void}
|
|
33
|
+
* @param event - event
|
|
40
34
|
*/
|
|
41
35
|
this.timerEvents = (event) => {
|
|
42
36
|
this.clearTimer();
|
|
@@ -59,8 +53,7 @@ export class MgMessage {
|
|
|
59
53
|
};
|
|
60
54
|
/**
|
|
61
55
|
* Get icon corresponding to variant
|
|
62
|
-
*
|
|
63
|
-
* @returns {string} icon
|
|
56
|
+
* @returns icon
|
|
64
57
|
*/
|
|
65
58
|
this.getIcon = () => {
|
|
66
59
|
switch (this.variant) {
|
|
@@ -81,11 +74,11 @@ export class MgMessage {
|
|
|
81
74
|
this.variant = variants[0];
|
|
82
75
|
this.closeButton = false;
|
|
83
76
|
this.hide = false;
|
|
84
|
-
this.
|
|
77
|
+
this.classCollection = new ClassList(['mg-message']);
|
|
85
78
|
this.hasActions = false;
|
|
86
79
|
}
|
|
87
80
|
validateDelay(newValue) {
|
|
88
|
-
if (newValue && newValue < 2) {
|
|
81
|
+
if (newValue !== undefined && newValue < 2) {
|
|
89
82
|
throw new Error(`<mg-message> prop "delay" must be greater than 2 seconds.`);
|
|
90
83
|
}
|
|
91
84
|
}
|
|
@@ -95,9 +88,9 @@ export class MgMessage {
|
|
|
95
88
|
}
|
|
96
89
|
else {
|
|
97
90
|
if (oldValue !== undefined) {
|
|
98
|
-
this.
|
|
91
|
+
this.classCollection.delete(`mg-message--${oldValue}`);
|
|
99
92
|
}
|
|
100
|
-
this.
|
|
93
|
+
this.classCollection.add(`mg-message--${newValue}`);
|
|
101
94
|
}
|
|
102
95
|
}
|
|
103
96
|
validateCloseButton(newValue) {
|
|
@@ -109,7 +102,7 @@ export class MgMessage {
|
|
|
109
102
|
validateHide(newValue) {
|
|
110
103
|
if (newValue) {
|
|
111
104
|
this.componentHide.emit();
|
|
112
|
-
this.
|
|
105
|
+
this.classCollection.add(this.classHide);
|
|
113
106
|
// Remove event Listener
|
|
114
107
|
['focusin', 'mouseenter'].forEach(event => {
|
|
115
108
|
this.element.removeEventListener(event, this.timerEvents);
|
|
@@ -119,7 +112,7 @@ export class MgMessage {
|
|
|
119
112
|
}
|
|
120
113
|
else {
|
|
121
114
|
this.componentShow.emit();
|
|
122
|
-
this.
|
|
115
|
+
this.classCollection.delete(this.classHide);
|
|
123
116
|
// If delay is set
|
|
124
117
|
if (this.delay > 1) {
|
|
125
118
|
// Start timer
|
|
@@ -146,7 +139,7 @@ export class MgMessage {
|
|
|
146
139
|
this.hasActions = this.element.querySelector('[slot="actions"]') !== null;
|
|
147
140
|
this.validateCloseButton(this.closeButton);
|
|
148
141
|
if (this.closeButton) {
|
|
149
|
-
this.
|
|
142
|
+
this.classCollection.add('mg-message--close-button');
|
|
150
143
|
this.closeButtonId = `${this.identifier}-close-button`;
|
|
151
144
|
}
|
|
152
145
|
this.validateDelay(this.delay);
|
|
@@ -154,11 +147,10 @@ export class MgMessage {
|
|
|
154
147
|
}
|
|
155
148
|
/**
|
|
156
149
|
* Render
|
|
157
|
-
*
|
|
158
|
-
* @returns {HTMLElement} HTML Element
|
|
150
|
+
* @returns HTML Element
|
|
159
151
|
*/
|
|
160
152
|
render() {
|
|
161
|
-
return (h("div", { id: this.identifier, class: this.
|
|
153
|
+
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" })))))));
|
|
162
154
|
}
|
|
163
155
|
static get is() { return "mg-message"; }
|
|
164
156
|
static get encapsulation() { return "shadow"; }
|
|
@@ -272,7 +264,7 @@ export class MgMessage {
|
|
|
272
264
|
}
|
|
273
265
|
static get states() {
|
|
274
266
|
return {
|
|
275
|
-
"
|
|
267
|
+
"classCollection": {},
|
|
276
268
|
"hasActions": {}
|
|
277
269
|
};
|
|
278
270
|
}
|