@mgdis/mg-components 5.7.0 → 5.8.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 +351 -600
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-item-more.cjs.entry.js +273 -0
- package/dist/cjs/mg-menu.conf-9afe6571.js +242 -0
- package/dist/collection/collection-manifest.json +2 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +24 -0
- package/dist/collection/components/atoms/mg-icon/mg-icon.conf.js +8 -0
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +6 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +14 -10
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +91 -21
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js +0 -13
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js +80 -76
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.css +7 -5
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js +174 -78
- package/dist/collection/components/molecules/mg-form/mg-form.js +1 -1
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.conf.js +1 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.css +30 -0
- package/dist/collection/components/molecules/mg-item-more/mg-item-more.js +200 -0
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.css +0 -2
- package/dist/collection/styles/navigation-button.scss +1 -1
- package/dist/collection/utils/behaviors.utils.js +33 -29
- package/dist/collection/utils/components.utils.js +2 -4
- package/dist/collection/utils/unit.test.utils.js +25 -0
- package/dist/components/components.utils.js +2 -4
- package/dist/components/index.d.ts +1 -0
- package/dist/components/index.js +1 -0
- package/dist/components/mg-action-more.js +2 -1
- package/dist/components/mg-button2.js +4 -1
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-icon2.js +8 -0
- package/dist/components/mg-input-checkbox.js +5 -4
- package/dist/components/mg-input-select2.js +83 -17
- package/dist/components/mg-item-more.d.ts +11 -0
- package/dist/components/mg-item-more.js +336 -0
- package/dist/components/mg-menu-item2.js +138 -251
- package/dist/components/mg-menu.conf.js +14 -0
- package/dist/components/mg-menu2.js +76 -111
- package/dist/components/mg-tabs.js +1 -1
- package/dist/components/mg-tooltip2.js +6 -2
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_31.entry.js +321 -570
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-item-more.entry.js +269 -0
- package/dist/esm/mg-menu.conf-881fbd82.js +235 -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-1221773c.entry.js +1 -0
- package/dist/mg-components/p-30bc87db.entry.js +1 -0
- package/dist/mg-components/p-367f92d2.js +1 -0
- package/dist/mg-components/styles/navigation-button.scss +1 -1
- package/dist/types/components/atoms/mg-button/mg-button.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +3 -3
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +39 -4
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.conf.d.ts +3 -27
- package/dist/types/components/molecules/menu/mg-menu/mg-menu.d.ts +38 -30
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.conf.d.ts +5 -0
- package/dist/types/components/molecules/menu/mg-menu-item/mg-menu-item.d.ts +69 -16
- package/dist/types/components/molecules/mg-item-more/mg-item-more.conf.d.ts +26 -0
- package/dist/types/components/molecules/mg-item-more/mg-item-more.d.ts +74 -0
- package/dist/types/components.d.ts +75 -17
- package/dist/types/utils/behaviors.utils.d.ts +12 -5
- package/dist/types/utils/components.utils.d.ts +2 -2
- package/dist/types/utils/unit.test.utils.d.ts +11 -0
- package/package.json +1 -1
- package/dist/mg-components/p-4cfd5423.entry.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const e=(e,a,n)=>new Intl.NumberFormat(a,{style:"currency",currency:n}).format(e),a=(e,a)=>new Intl.NumberFormat(a).format(e),n=/^\d{4}-(0[1-9]|1[0-2])-(0[1-9]|[12]\d|3[01])$/,t=(e,a)=>"string"==typeof e&&""!==e&&n.test(e)?new Intl.DateTimeFormat(a).format(new Date(e)):"",r={en:{errors:{required:"This field is required.",date:{badInput:'The date format must be <span aria-hidden="true">mm/dd/yyyy</span><span class="sr-only">m m / d d / y y y y</span> and the date must be greater than {min}',min:"The date cannot be earlier than {min}",max:"The date cannot be later than {max}",minMax:"The date must be between {min} and {max}"},numeric:{min:"The value cannot be less than {min}",max:"The value cannot be greater than {max}",minMax:"The value must be between {min} et {max}"}},nbCharLeft:"{counter} characters left.",input:{select:{placeholder:"Select a value"}},form:{required:'Fields with a <strong class="is-asterisk">*</strong> are required',requiredSingle:'Field with a <strong class="is-asterisk">*</strong> is required',allRequired:"All fields are required",allRequiredSingle:"The field is required"},message:{closeButton:"Close message"},modal:{closeButton:"Close modal"},pagination:{label:"Pagination",page:"page",pages:"pages",nextPage:"Next page",previousPage:"Previous page",selectPage:"Select the page to display."},panel:{editLabel:"Edit section title."},skipLinks:{navLabel:"Quick access"},general:{confirm:"Confirm",cancel:"Cancel",close:"Close",next:"next",previous:"previous"},plusMenu:{moreLabel:"Additional menu",badgeLabel:"Include notification(s)"},actionMore:{label:"Actions"}},fr:{errors:{required:"Ce champ est obligatoire.",date:{badInput:'Le format de la date doit être du type <span aria-hidden="true">jj/mm/aaaa</span><span class="sr-only">j j / m m / a a a a</span> et la date supérieure au {min}',min:"La date ne peut pas être antérieure au {min}",max:"La date ne peut pas être postérieure au {max}",minMax:"La date doit être comprise entre le {min} et le {max}"},numeric:{min:"La valeur ne peut pas être inférieure à {min}",max:"La valeur ne peut pas être supérieure à {max}",minMax:"La valeur doit être comprise entre {min} et {max}"}},nbCharLeft:"{counter} caractères disponibles.",input:{select:{placeholder:"Sélectionnez une valeur"}},form:{required:'Les champs marqués d\'un <strong class="is-asterisk">*</strong> sont obligatoires',requiredSingle:'Le champ marqué d\'un <strong class="is-asterisk">*</strong> est obligatoire',allRequired:"Tous les champs sont obligatoires",allRequiredSingle:"Le champ est obligatoire"},message:{closeButton:"Fermer le message"},modal:{closeButton:"Fermer la modale"},pagination:{label:"Pagination",page:"page",pages:"pages",nextPage:"Page suivante",previousPage:"Page précédente",selectPage:"Sélectionner la page à afficher."},panel:{editLabel:"Modifier le titre de la section."},skipLinks:{navLabel:"Accès rapide"},general:{confirm:"Valider",cancel:"Annuler",close:"Fermer",next:"suivant",previous:"précédent"},plusMenu:{moreLabel:"Menu complémentaire",badgeLabel:"Notification(s) incluse(s)"},actionMore:{label:"Actions"}}},i=e=>((e,a)=>{const n=e.closest("[lang]"),t=Intl.NumberFormat.supportedLocalesOf(null==n?void 0:n.lang),r=t.length>0?t[0]:navigator.language||"en",i=r.split("-").shift();return{locale:r,messages:a[i]||a.en}})(e,r);var s;!function(e){e.VERTICAL="vertical",e.HORIZONTAL="horizontal"}(s||(s={}));const l=["regular","medium","large"];export{s as D,e as a,a as b,n as d,i,t as l,l as s}
|
|
@@ -9,7 +9,7 @@ $navigation-button-column-gap: 1rem;
|
|
|
9
9
|
.#{$element}.#{$element}--size-#{$name} .#{$element}__navigation-button,
|
|
10
10
|
.#{$element}__navigation-button.#{$element}__navigation-button--size-#{$name} {
|
|
11
11
|
padding: #{map.get($size, 'vertical')} #{map.get($size, 'horizontal')};
|
|
12
|
-
height:
|
|
12
|
+
height: #{map.get($size, 'height')};
|
|
13
13
|
&,
|
|
14
14
|
::slotted([slot='label']),
|
|
15
15
|
::slotted([slot='metadata']) {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { EventEmitter } from '../../../stencil-public-runtime';
|
|
1
2
|
import { VariantType, ButtonType } from './mg-button.conf';
|
|
2
3
|
import { ClassList } from '../../../utils/components.utils';
|
|
3
4
|
export declare class MgButton {
|
|
@@ -69,6 +70,10 @@ export declare class MgButton {
|
|
|
69
70
|
* Component classes
|
|
70
71
|
*/
|
|
71
72
|
classList: ClassList;
|
|
73
|
+
/**
|
|
74
|
+
* Emmited event when disabled change
|
|
75
|
+
*/
|
|
76
|
+
disabledChange: EventEmitter<MgButton['disabled']>;
|
|
72
77
|
/**
|
|
73
78
|
* Trigger actions onClick event
|
|
74
79
|
*
|
|
@@ -21,7 +21,7 @@ export declare class MgInputCheckbox {
|
|
|
21
21
|
* Required
|
|
22
22
|
*/
|
|
23
23
|
value: CheckboxValue[];
|
|
24
|
-
validateValue(newValue:
|
|
24
|
+
validateValue(newValue: MgInputCheckbox['value']): void;
|
|
25
25
|
/**
|
|
26
26
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
27
27
|
*/
|
|
@@ -91,11 +91,11 @@ export declare class MgInputCheckbox {
|
|
|
91
91
|
/**
|
|
92
92
|
* Emitted event when value change
|
|
93
93
|
*/
|
|
94
|
-
valueChange: EventEmitter<
|
|
94
|
+
valueChange: EventEmitter<MgInputCheckbox['value']>;
|
|
95
95
|
/**
|
|
96
96
|
* Emited event when checking validity
|
|
97
97
|
*/
|
|
98
|
-
inputValid: EventEmitter<
|
|
98
|
+
inputValid: EventEmitter<MgInputCheckbox['valid']>;
|
|
99
99
|
/**
|
|
100
100
|
* Public method to display errors
|
|
101
101
|
*
|
|
@@ -20,12 +20,12 @@ export declare class MgInputSelect {
|
|
|
20
20
|
* Component value
|
|
21
21
|
*/
|
|
22
22
|
value: any;
|
|
23
|
-
|
|
23
|
+
validateValue(newValue: MgInputSelect['value']): void;
|
|
24
24
|
/**
|
|
25
25
|
* Items are the possible options to select
|
|
26
26
|
*/
|
|
27
|
-
items: string
|
|
28
|
-
validateItems(newValue:
|
|
27
|
+
items: (string | SelectOption)[];
|
|
28
|
+
validateItems(newValue: MgInputSelect['items']): void;
|
|
29
29
|
/**
|
|
30
30
|
* Identifier is used for the element ID (id is a reserved prop in Stencil.js)
|
|
31
31
|
*/
|
|
@@ -116,7 +116,7 @@ export declare class MgInputSelect {
|
|
|
116
116
|
/**
|
|
117
117
|
* Emited event when value change
|
|
118
118
|
*/
|
|
119
|
-
valueChange: EventEmitter<
|
|
119
|
+
valueChange: EventEmitter<MgInputSelect['value']>;
|
|
120
120
|
/**
|
|
121
121
|
* Emited event when checking validity
|
|
122
122
|
*/
|
|
@@ -129,12 +129,40 @@ export declare class MgInputSelect {
|
|
|
129
129
|
displayError(): Promise<void>;
|
|
130
130
|
/**
|
|
131
131
|
* Handle input event
|
|
132
|
+
*
|
|
133
|
+
* @returns {void}
|
|
132
134
|
*/
|
|
133
135
|
private handleInput;
|
|
136
|
+
/**
|
|
137
|
+
* Method to compare item.title with input.value
|
|
138
|
+
*
|
|
139
|
+
* @param {SelectOption} item item to compare with
|
|
140
|
+
* @returns {boolean} truthy if input.value is an item
|
|
141
|
+
*/
|
|
142
|
+
private isInputValue;
|
|
143
|
+
/**
|
|
144
|
+
* value props setter
|
|
145
|
+
*
|
|
146
|
+
* @param {MgInputSelect['value']} newValue value to update with
|
|
147
|
+
* @returns {void}
|
|
148
|
+
*/
|
|
149
|
+
private setValue;
|
|
150
|
+
/**
|
|
151
|
+
* Update value from input.value
|
|
152
|
+
*
|
|
153
|
+
* @returns {void}
|
|
154
|
+
*/
|
|
155
|
+
private updateValue;
|
|
134
156
|
/**
|
|
135
157
|
* Handle blur event
|
|
136
158
|
*/
|
|
137
159
|
private handleBlur;
|
|
160
|
+
/**
|
|
161
|
+
* Input value is disabled
|
|
162
|
+
*
|
|
163
|
+
* @returns {boolean} truthy if input value is disabled
|
|
164
|
+
*/
|
|
165
|
+
private isDisabledValue;
|
|
138
166
|
/**
|
|
139
167
|
* Check if input is valid
|
|
140
168
|
*/
|
|
@@ -152,6 +180,13 @@ export declare class MgInputSelect {
|
|
|
152
180
|
* @returns {ReturnType<typeof setTimeout>} timeout
|
|
153
181
|
*/
|
|
154
182
|
componentWillLoad(): ReturnType<typeof setTimeout>;
|
|
183
|
+
/**
|
|
184
|
+
* Render option
|
|
185
|
+
*
|
|
186
|
+
* @param {SelectOption} option to render
|
|
187
|
+
* @returns {HTMLElement} render option
|
|
188
|
+
*/
|
|
189
|
+
private renderOption;
|
|
155
190
|
/**
|
|
156
191
|
* Render
|
|
157
192
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { MgMenu } from './mg-menu';
|
|
1
|
+
import { MgItemMore } from '../../mg-item-more/mg-item-more';
|
|
3
2
|
/**
|
|
4
3
|
* Menu direction type
|
|
5
4
|
*/
|
|
@@ -8,32 +7,9 @@ export declare enum Direction {
|
|
|
8
7
|
HORIZONTAL = "horizontal"
|
|
9
8
|
}
|
|
10
9
|
/**
|
|
11
|
-
*
|
|
10
|
+
* ItemMore prop type
|
|
12
11
|
*/
|
|
13
|
-
export type
|
|
14
|
-
moreLabel: string;
|
|
15
|
-
badgeLabel: string;
|
|
16
|
-
};
|
|
17
|
-
/**
|
|
18
|
-
* more item type
|
|
19
|
-
*/
|
|
20
|
-
export type MoreItemType = {
|
|
21
|
-
mgIcon?: {
|
|
22
|
-
icon: MgIcon['icon'];
|
|
23
|
-
};
|
|
24
|
-
slotLabel?: {
|
|
25
|
-
label?: string;
|
|
26
|
-
display?: boolean;
|
|
27
|
-
};
|
|
28
|
-
size?: MgMenu['size'];
|
|
29
|
-
};
|
|
30
|
-
/**
|
|
31
|
-
* More item type guard
|
|
32
|
-
*
|
|
33
|
-
* @param {unknown} element element to control
|
|
34
|
-
* @returns {boolean} truthy if element is more-item
|
|
35
|
-
*/
|
|
36
|
-
export declare const isMoreItem: (element: unknown) => element is MoreItemType;
|
|
12
|
+
export type ItemMoreType = Pick<MgItemMore, 'icon' | 'slotlabel' | 'size'>;
|
|
37
13
|
/**
|
|
38
14
|
* List of all possibles sizes
|
|
39
15
|
*/
|
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { Direction
|
|
1
|
+
import { Direction } from './mg-menu.conf';
|
|
2
|
+
import type { MenuSizeType, ItemMoreType } from './mg-menu.conf';
|
|
2
3
|
export declare class MgMenu {
|
|
3
4
|
/************
|
|
4
5
|
* Internal *
|
|
5
6
|
************/
|
|
6
7
|
private readonly name;
|
|
7
|
-
private messages;
|
|
8
8
|
private menuItems;
|
|
9
9
|
private focusedMenuItem;
|
|
10
|
-
private overflowBehavior;
|
|
11
10
|
/**************
|
|
12
11
|
* Decorators *
|
|
13
12
|
**************/
|
|
@@ -27,11 +26,11 @@ export declare class MgMenu {
|
|
|
27
26
|
direction: Direction;
|
|
28
27
|
validateDirection(newValue: MgMenu['direction']): void;
|
|
29
28
|
/**
|
|
30
|
-
* Customize mg-
|
|
29
|
+
* Customize "mg-item-more" element
|
|
31
30
|
* Used with direction: 'vertical' to manage overflow
|
|
32
31
|
*/
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
itemmore: ItemMoreType;
|
|
33
|
+
validateItemMore(newValue: MgMenu['itemmore']): void;
|
|
35
34
|
/**
|
|
36
35
|
* Define mg-menu size
|
|
37
36
|
* Default: 'regular'
|
|
@@ -42,11 +41,9 @@ export declare class MgMenu {
|
|
|
42
41
|
* is this menu a child menu. Used for conditional render.
|
|
43
42
|
*/
|
|
44
43
|
isChildMenu: boolean;
|
|
45
|
-
|
|
46
|
-
*
|
|
47
|
-
|
|
48
|
-
*/
|
|
49
|
-
hasOverflow: boolean;
|
|
44
|
+
/*************
|
|
45
|
+
* Methods *
|
|
46
|
+
*************/
|
|
50
47
|
/**
|
|
51
48
|
* Close matching menu-item
|
|
52
49
|
*
|
|
@@ -55,9 +52,26 @@ export declare class MgMenu {
|
|
|
55
52
|
* @returns {void}
|
|
56
53
|
*/
|
|
57
54
|
private closeMenuItem;
|
|
58
|
-
|
|
59
|
-
*
|
|
60
|
-
|
|
55
|
+
/**
|
|
56
|
+
* get mg-item-more element
|
|
57
|
+
*
|
|
58
|
+
* @returns {HTMLMgItemMoreElement} mg-item-more element
|
|
59
|
+
*/
|
|
60
|
+
private getItemMore;
|
|
61
|
+
/**
|
|
62
|
+
* get mg-item-more >>> mg-menu-item element
|
|
63
|
+
*
|
|
64
|
+
* @returns {HTMLMgMenuItemElement} mg-item-more >>> mg-menu-item element
|
|
65
|
+
*/
|
|
66
|
+
private getItemMoreMenuItem;
|
|
67
|
+
/**
|
|
68
|
+
* Set item listend
|
|
69
|
+
*
|
|
70
|
+
* @param {HTMLMgMenuItemElement} item mg-menu-item element
|
|
71
|
+
* @param {MgMenu['focusedMenuItem']} index number
|
|
72
|
+
* @returns {void}
|
|
73
|
+
*/
|
|
74
|
+
private setItemListener;
|
|
61
75
|
/**
|
|
62
76
|
* Store menu-items on component init and add listeners
|
|
63
77
|
*
|
|
@@ -65,11 +79,17 @@ export declare class MgMenu {
|
|
|
65
79
|
*/
|
|
66
80
|
private initMenuItemsListeners;
|
|
67
81
|
/**
|
|
68
|
-
*
|
|
82
|
+
* Handle item-loaded event on mg-item-more element
|
|
83
|
+
*
|
|
84
|
+
* @returns {void}
|
|
85
|
+
*/
|
|
86
|
+
private handleItemLoaded;
|
|
87
|
+
/**
|
|
88
|
+
* render mg-item-more
|
|
69
89
|
*
|
|
70
|
-
* @returns {
|
|
90
|
+
* @returns {void}
|
|
71
91
|
*/
|
|
72
|
-
private
|
|
92
|
+
private renderMgItemMore;
|
|
73
93
|
/*************
|
|
74
94
|
* Lifecycle *
|
|
75
95
|
*************/
|
|
@@ -86,23 +106,11 @@ export declare class MgMenu {
|
|
|
86
106
|
*/
|
|
87
107
|
componentDidLoad(): ReturnType<typeof setTimeout>;
|
|
88
108
|
/**
|
|
89
|
-
*
|
|
109
|
+
* Add listeners to items
|
|
90
110
|
*
|
|
91
111
|
* @returns {void}
|
|
92
112
|
*/
|
|
93
113
|
componentDidRender(): void;
|
|
94
|
-
/**
|
|
95
|
-
* Disconnect overflow ResizeObserver
|
|
96
|
-
*
|
|
97
|
-
* @returns {void} run overflow resize obeserver disconnexion
|
|
98
|
-
*/
|
|
99
|
-
disconnectedCallback(): void;
|
|
100
|
-
/**
|
|
101
|
-
* Render mg-menu-item more element for overflow behavior
|
|
102
|
-
*
|
|
103
|
-
* @returns {HTMLElement} rendered mg-menu-item more element
|
|
104
|
-
*/
|
|
105
|
-
private renderMgMenuItemMore;
|
|
106
114
|
/**
|
|
107
115
|
* Render
|
|
108
116
|
*
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { MgMenu } from '../mg-menu/mg-menu';
|
|
1
2
|
/**
|
|
2
3
|
* Available menu-item positions
|
|
3
4
|
*/
|
|
@@ -14,3 +15,7 @@ export declare enum Status {
|
|
|
14
15
|
DISABLED = "disabled",
|
|
15
16
|
ACTIVE = "active"
|
|
16
17
|
}
|
|
18
|
+
/**
|
|
19
|
+
* Direction type
|
|
20
|
+
*/
|
|
21
|
+
export type DirectionType = MgMenu['direction'];
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { EventEmitter } from '../../../../stencil-public-runtime';
|
|
2
2
|
import { ClassList } from '../../../../utils/components.utils';
|
|
3
|
-
import { MgMenu } from '../mg-menu/mg-menu';
|
|
4
|
-
import { MenuSizeType } from '../mg-menu/mg-menu.conf';
|
|
5
3
|
import { Status } from './mg-menu-item.conf';
|
|
4
|
+
import type { MenuSizeType } from '../mg-menu/mg-menu.conf';
|
|
5
|
+
import type { DirectionType } from './mg-menu-item.conf';
|
|
6
6
|
export declare class MgMenuItem {
|
|
7
7
|
/************
|
|
8
8
|
* Internal *
|
|
@@ -20,6 +20,11 @@ export declare class MgMenuItem {
|
|
|
20
20
|
/************
|
|
21
21
|
* Props *
|
|
22
22
|
************/
|
|
23
|
+
/**
|
|
24
|
+
* Identifier is used to control mg-popover
|
|
25
|
+
* Default: createID('mg-menu-item');
|
|
26
|
+
*/
|
|
27
|
+
identifier: string;
|
|
23
28
|
/**
|
|
24
29
|
* Define menu-item href
|
|
25
30
|
* when defined menu-item contain an anchor instead of button
|
|
@@ -42,6 +47,10 @@ export declare class MgMenuItem {
|
|
|
42
47
|
* Emited event when status change
|
|
43
48
|
*/
|
|
44
49
|
statusChange: EventEmitter<MgMenuItem['status']>;
|
|
50
|
+
/**
|
|
51
|
+
* Emited event when item is loaded
|
|
52
|
+
*/
|
|
53
|
+
itemLoaded: EventEmitter<void>;
|
|
45
54
|
/**********
|
|
46
55
|
* States *
|
|
47
56
|
*********/
|
|
@@ -57,11 +66,16 @@ export declare class MgMenuItem {
|
|
|
57
66
|
/**
|
|
58
67
|
* Parent menu direction
|
|
59
68
|
*/
|
|
60
|
-
direction:
|
|
69
|
+
direction: DirectionType;
|
|
70
|
+
validateDirection(newValue: MgMenuItem['direction']): void;
|
|
61
71
|
/**
|
|
62
72
|
* Does component is in main menu
|
|
63
73
|
*/
|
|
64
74
|
isInMainMenu: boolean;
|
|
75
|
+
/**
|
|
76
|
+
* Does element is item-more
|
|
77
|
+
*/
|
|
78
|
+
isItemMore: boolean;
|
|
65
79
|
/**
|
|
66
80
|
* Does component have children. Default: false.
|
|
67
81
|
*/
|
|
@@ -92,9 +106,61 @@ export declare class MgMenuItem {
|
|
|
92
106
|
* Is component contextual direction match the given direction
|
|
93
107
|
*
|
|
94
108
|
* @param {MgMenuItem['direction']} direction in parent menu
|
|
109
|
+
* @param {MgMenuItem['direction']} compareWith direction to compare with. Default: `this.direction`
|
|
95
110
|
* @returns {boolean} true is direction match the direction propertie
|
|
96
111
|
*/
|
|
97
112
|
private isDirection;
|
|
113
|
+
/**
|
|
114
|
+
* Update displayNotificationBadge
|
|
115
|
+
* current component notification badge have priority over the slot badge when submenu contain badge
|
|
116
|
+
*
|
|
117
|
+
* @returns {void} update displayNotificationBadge value
|
|
118
|
+
*/
|
|
119
|
+
private updateDisplayNotificationBadge;
|
|
120
|
+
/**
|
|
121
|
+
* Method to control if one of component children have active status
|
|
122
|
+
*
|
|
123
|
+
* @returns {boolean} truthy if component has active child
|
|
124
|
+
*/
|
|
125
|
+
private hasActiveChild;
|
|
126
|
+
/**
|
|
127
|
+
* Validate slots
|
|
128
|
+
*
|
|
129
|
+
* @param {boolean} guard prevent action whith guard. Default: false.
|
|
130
|
+
* @returns {void}
|
|
131
|
+
*/
|
|
132
|
+
private validateSlot;
|
|
133
|
+
/**
|
|
134
|
+
* Update status
|
|
135
|
+
*
|
|
136
|
+
* @param {Status[]} guard status to exclude from process in addition to [Status.HIDDEN, Status.DISABLED] . Default: [].
|
|
137
|
+
* @returns {void}
|
|
138
|
+
*/
|
|
139
|
+
private updateStatus;
|
|
140
|
+
/**
|
|
141
|
+
* Init event-listeners
|
|
142
|
+
*
|
|
143
|
+
* @returns {void}
|
|
144
|
+
*/
|
|
145
|
+
private initListeners;
|
|
146
|
+
/**
|
|
147
|
+
* Get mg-popover identifier
|
|
148
|
+
*
|
|
149
|
+
* @returns {MgPopover['identifier']} generated mg-popover identifier
|
|
150
|
+
*/
|
|
151
|
+
private getPopoverIdentifier;
|
|
152
|
+
/**
|
|
153
|
+
* Render popover clickoutside guard for content slot
|
|
154
|
+
*
|
|
155
|
+
* @returns {void}
|
|
156
|
+
*/
|
|
157
|
+
private updatePopoverGuard;
|
|
158
|
+
/**
|
|
159
|
+
* Condition to know if component should display a mg-popover
|
|
160
|
+
*
|
|
161
|
+
* @returns {boolean} truthy if component display popover
|
|
162
|
+
*/
|
|
163
|
+
private displayPopover;
|
|
98
164
|
/************
|
|
99
165
|
* Handlers *
|
|
100
166
|
************/
|
|
@@ -112,19 +178,6 @@ export declare class MgMenuItem {
|
|
|
112
178
|
* @returns {void}
|
|
113
179
|
*/
|
|
114
180
|
private handlePopoverDisplay;
|
|
115
|
-
/**
|
|
116
|
-
* Update displayNotificationBadge
|
|
117
|
-
* current component notification badge have priority over the slot badge when submenu contain badge
|
|
118
|
-
*
|
|
119
|
-
* @returns {void} update displayNotificationBadge value
|
|
120
|
-
*/
|
|
121
|
-
private updateDisplayNotificationBadge;
|
|
122
|
-
/**
|
|
123
|
-
* Method to control if one of component children have active status
|
|
124
|
-
*
|
|
125
|
-
* @returns {boolean} truthy if component has active child
|
|
126
|
-
*/
|
|
127
|
-
private hasActiveChild;
|
|
128
181
|
/*************
|
|
129
182
|
* Lifecycle *
|
|
130
183
|
*************/
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { MgIcon } from '../../atoms/mg-icon/mg-icon';
|
|
2
|
+
import { MgMenu } from '../menu/mg-menu/mg-menu';
|
|
3
|
+
/**
|
|
4
|
+
* message type
|
|
5
|
+
*/
|
|
6
|
+
export type MessageType = {
|
|
7
|
+
moreLabel: string;
|
|
8
|
+
badgeLabel: string;
|
|
9
|
+
};
|
|
10
|
+
/**
|
|
11
|
+
* SlotLabel prop type
|
|
12
|
+
*/
|
|
13
|
+
export type SlotLabelType = {
|
|
14
|
+
label?: string;
|
|
15
|
+
display?: boolean;
|
|
16
|
+
};
|
|
17
|
+
/**
|
|
18
|
+
* icon prop type
|
|
19
|
+
*/
|
|
20
|
+
export type IconType = {
|
|
21
|
+
icon: MgIcon['icon'];
|
|
22
|
+
};
|
|
23
|
+
/**
|
|
24
|
+
* size type
|
|
25
|
+
*/
|
|
26
|
+
export type SizeType = MgMenu['size'];
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import type { IconType, SizeType, SlotLabelType } from './mg-item-more.conf';
|
|
2
|
+
export declare class MgItemMore {
|
|
3
|
+
/************
|
|
4
|
+
* Internal *
|
|
5
|
+
************/
|
|
6
|
+
private readonly name;
|
|
7
|
+
private messages;
|
|
8
|
+
private menuItems;
|
|
9
|
+
private overflowBehavior;
|
|
10
|
+
/**************
|
|
11
|
+
* Decorators *
|
|
12
|
+
**************/
|
|
13
|
+
/**
|
|
14
|
+
* Get component DOM element
|
|
15
|
+
*/
|
|
16
|
+
element: HTMLMgItemMoreElement;
|
|
17
|
+
/**
|
|
18
|
+
* Define icon
|
|
19
|
+
* Default: {icon: 'ellipsis-vertical'}
|
|
20
|
+
*/
|
|
21
|
+
icon: IconType;
|
|
22
|
+
validateIcon(newValue: MgItemMore['icon']): void;
|
|
23
|
+
/**
|
|
24
|
+
* Define slot label element
|
|
25
|
+
* Default: {display: false}
|
|
26
|
+
*/
|
|
27
|
+
slotlabel: SlotLabelType;
|
|
28
|
+
validateSlotLabel(newValue: MgItemMore['slotlabel']): void;
|
|
29
|
+
/**
|
|
30
|
+
* Define component child menu size.
|
|
31
|
+
*/
|
|
32
|
+
size: SizeType;
|
|
33
|
+
validateSize(newValue: MgItemMore['size']): void;
|
|
34
|
+
/**
|
|
35
|
+
* Define component parent menu.
|
|
36
|
+
*/
|
|
37
|
+
parentMenu: HTMLMgMenuElement;
|
|
38
|
+
/***********
|
|
39
|
+
* Methods *
|
|
40
|
+
***********/
|
|
41
|
+
/**
|
|
42
|
+
* render mg-item-more overflow element
|
|
43
|
+
*
|
|
44
|
+
* @returns {HTMLMgItemMoreElement} mg-item-more element
|
|
45
|
+
*/
|
|
46
|
+
private renderMgMenuItemOverflowElement;
|
|
47
|
+
/*************
|
|
48
|
+
* Lifecycle *
|
|
49
|
+
*************/
|
|
50
|
+
/**
|
|
51
|
+
* Disconnect overflow ResizeObserver
|
|
52
|
+
*
|
|
53
|
+
* @returns {void} run overflow resize obeserver disconnexion
|
|
54
|
+
*/
|
|
55
|
+
disconnectedCallback(): void;
|
|
56
|
+
/**
|
|
57
|
+
* Set variables and validate props
|
|
58
|
+
*
|
|
59
|
+
* @returns {void}
|
|
60
|
+
*/
|
|
61
|
+
componentWillLoad(): void;
|
|
62
|
+
/**
|
|
63
|
+
* Add overflow behavior
|
|
64
|
+
*
|
|
65
|
+
* @returns {void}
|
|
66
|
+
*/
|
|
67
|
+
componentDidLoad(): void;
|
|
68
|
+
/**
|
|
69
|
+
* Render
|
|
70
|
+
*
|
|
71
|
+
* @returns {HTMLElement} HTML Element
|
|
72
|
+
*/
|
|
73
|
+
render(): HTMLElement;
|
|
74
|
+
}
|