@mgdis/mg-components 6.17.0 → 6.18.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-DCZEYvlH.js +4 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_37.cjs.entry.js +411 -168
- package/dist/cjs/mg-alert.cjs.entry.js +1 -1
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-fieldset.cjs.entry.js +141 -0
- package/dist/cjs/mg-input-combobox.cjs.entry.js +71 -55
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +33 -20
- package/dist/cjs/{mg-input.conf-WTsvDfpC.js → mg-input.conf-HYIzRsy7.js} +5 -0
- package/dist/cjs/mg-loader.cjs.entry.js +1 -1
- package/dist/cjs/mg-progress.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +4 -0
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +178 -18
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +36 -16
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +78 -55
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +41 -22
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +32 -12
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +30 -12
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +31 -12
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +40 -20
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +31 -12
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +44 -25
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +31 -13
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +36 -11
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +5 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +404 -0
- package/dist/collection/components/molecules/mg-form/mg-form.js +13 -4
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +2 -2
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +40 -9
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +1 -1
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-alert.js +1 -1
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-fieldset.d.ts +11 -0
- package/dist/components/mg-fieldset.js +209 -0
- package/dist/components/mg-form.js +4 -3
- package/dist/components/mg-illustrated-message.js +1 -1
- package/dist/components/mg-input-checkbox-paginated2.js +1 -1
- package/dist/components/mg-input-checkbox.js +28 -15
- package/dist/components/mg-input-combobox.js +71 -55
- package/dist/components/mg-input-date.js +33 -21
- package/dist/components/mg-input-numeric.js +24 -11
- package/dist/components/mg-input-password.js +22 -11
- package/dist/components/mg-input-radio.js +23 -11
- package/dist/components/mg-input-rich-text-editor.js +32 -19
- package/dist/components/mg-input-select2.js +24 -12
- package/dist/components/mg-input-text2.js +36 -24
- package/dist/components/mg-input-textarea.js +23 -12
- package/dist/components/mg-input-toggle.js +35 -10
- package/dist/components/mg-input2.js +117 -18
- package/dist/components/mg-item-more2.js +5 -1
- package/dist/components/mg-loader2.js +1 -1
- package/dist/components/mg-message2.js +2 -2
- package/dist/components/mg-modal.js +2 -2
- package/dist/components/mg-panel.js +36 -7
- package/dist/components/mg-popover-content2.js +1 -1
- package/dist/components/mg-popover2.js +1 -1
- package/dist/components/mg-progress.js +1 -1
- package/dist/components/mg-skip-links.js +1 -1
- package/dist/components/mg-tabs2.js +1 -1
- package/dist/esm/{index-WtiuOkLj.js → index-C7xjtdiw.js} +1 -1
- package/dist/esm/index-T6kOJXP1.js +4 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_37.entry.js +412 -169
- package/dist/esm/mg-alert.entry.js +2 -2
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-fieldset.entry.js +139 -0
- package/dist/esm/mg-input-combobox.entry.js +72 -56
- package/dist/esm/mg-input-rich-text-editor.entry.js +34 -21
- package/dist/esm/{mg-input.conf-CNgv8hc5.js → mg-input.conf-D9V2v4n2.js} +5 -1
- package/dist/esm/mg-loader.entry.js +2 -2
- package/dist/esm/mg-progress.entry.js +2 -2
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/p-2bab89c2.entry.js +1 -0
- package/dist/mg-components/{p-0e6b40d6.entry.js → p-5abc77cd.entry.js} +1 -1
- package/dist/mg-components/p-7d2e43b2.entry.js +1 -0
- package/dist/mg-components/{p-5dc3a1fb.entry.js → p-92e5e5a6.entry.js} +1 -1
- package/dist/mg-components/{p-c5da335e.entry.js → p-952288bd.entry.js} +1 -1
- package/dist/mg-components/{p-WtiuOkLj.js → p-C7xjtdiw.js} +1 -1
- package/dist/mg-components/p-D9V2v4n2.js +1 -0
- package/dist/mg-components/p-f2cddd52.entry.js +1 -0
- package/dist/mg-components/{p-397bf67b.entry.js → p-f6afaeb8.entry.js} +1 -1
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +32 -1
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +4 -3
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +4 -2
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -2
- package/dist/types/components/molecules/mg-fieldset/mg-fieldset.d.ts +105 -0
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +8 -1
- package/dist/types/components.d.ts +168 -18
- package/ide/intellij/web-types.json +272 -9
- package/ide/vscode/html-custom-data.json +243 -5
- package/package.json +15 -15
- package/dist/mg-components/p-8a69175b.entry.js +0 -1
- package/dist/mg-components/p-CNgv8hc5.js +0 -1
- package/dist/mg-components/p-d84d87ea.entry.js +0 -1
|
@@ -0,0 +1,404 @@
|
|
|
1
|
+
import { h } from "@stencil/core";
|
|
2
|
+
import { ClassList, isValidString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
|
+
import { classReadonly } from "../inputs/mg-input/mg-input.conf";
|
|
4
|
+
export class MgFieldset {
|
|
5
|
+
constructor() {
|
|
6
|
+
/**
|
|
7
|
+
* Fieldset name
|
|
8
|
+
* If not set the value equals the identifier
|
|
9
|
+
*/
|
|
10
|
+
this.name = this.identifier;
|
|
11
|
+
/**
|
|
12
|
+
* Define if legend is visible
|
|
13
|
+
*/
|
|
14
|
+
this.legendHide = false;
|
|
15
|
+
/**
|
|
16
|
+
* Define if legend border is visible.
|
|
17
|
+
*/
|
|
18
|
+
this.legendBorderDisplay = false;
|
|
19
|
+
/**
|
|
20
|
+
* Define if inputs are readonly
|
|
21
|
+
*/
|
|
22
|
+
this.readonly = false;
|
|
23
|
+
/**
|
|
24
|
+
* Define if inputs are disabled
|
|
25
|
+
*/
|
|
26
|
+
this.disabled = false;
|
|
27
|
+
/**
|
|
28
|
+
* Component classes
|
|
29
|
+
*/
|
|
30
|
+
this.classCollection = new ClassList(['mg-c-input--fieldset']);
|
|
31
|
+
/**
|
|
32
|
+
* Check if fieldset is valid
|
|
33
|
+
*/
|
|
34
|
+
this.checkValidity = () => {
|
|
35
|
+
var _a;
|
|
36
|
+
this.valid = !(this.mgInputs.some(input => input.invalid) || ((_a = this.errorMessage) === null || _a === void 0 ? void 0 : _a.length) > 0);
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Set mgInputs
|
|
40
|
+
*/
|
|
41
|
+
this.setMgInputs = () => {
|
|
42
|
+
// Get slotted mgInputs
|
|
43
|
+
this.mgInputs = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-INPUT'));
|
|
44
|
+
// Set inputs readonly or disabled based on form configuration
|
|
45
|
+
// Othewise listen to events
|
|
46
|
+
this.mgInputs.forEach(input => {
|
|
47
|
+
if (this.readonly) {
|
|
48
|
+
input.readonly = true;
|
|
49
|
+
}
|
|
50
|
+
else if (this.disabled) {
|
|
51
|
+
input.disabled = true;
|
|
52
|
+
}
|
|
53
|
+
else {
|
|
54
|
+
input.addEventListener('input-valid', this.checkValidity);
|
|
55
|
+
}
|
|
56
|
+
});
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
watchLegendBorderDisplay(newValue) {
|
|
60
|
+
if (newValue && !isValidString(this.legendHeading)) {
|
|
61
|
+
throw new Error('<mg-fieldset> prop "legendBorderDisplay" must not be paired with the prop "legendHeading".');
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
watchReadonly(newValue) {
|
|
65
|
+
if (newValue) {
|
|
66
|
+
this.classCollection.add(classReadonly);
|
|
67
|
+
}
|
|
68
|
+
else {
|
|
69
|
+
this.classCollection.delete(classReadonly);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
handleAttributeChange() {
|
|
73
|
+
this.setMgInputs();
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Component is not a candidate for constraint validation.
|
|
77
|
+
* You can use this method to define the `errorMessage` and set the `valid` state to `false`.
|
|
78
|
+
* @param errorMessage - error message to display. Use a valid `string` to define an error or `undefined` to delete the error
|
|
79
|
+
*/
|
|
80
|
+
async setCustomValidity(errorMessage) {
|
|
81
|
+
if (isValidString(errorMessage)) {
|
|
82
|
+
this.errorMessage = errorMessage;
|
|
83
|
+
}
|
|
84
|
+
else {
|
|
85
|
+
this.errorMessage = undefined;
|
|
86
|
+
}
|
|
87
|
+
this.checkValidity();
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Display inputs error if it exists.
|
|
91
|
+
*/
|
|
92
|
+
async displayError() {
|
|
93
|
+
if (!this.readonly) {
|
|
94
|
+
this.mgInputs.forEach(input => {
|
|
95
|
+
input.displayError();
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
/*************
|
|
100
|
+
* Lifecycle *
|
|
101
|
+
*************/
|
|
102
|
+
/**
|
|
103
|
+
* Check if component props are well configured on init
|
|
104
|
+
*/
|
|
105
|
+
componentWillLoad() {
|
|
106
|
+
this.watchReadonly(this.readonly);
|
|
107
|
+
this.watchLegendBorderDisplay(this.legendBorderDisplay);
|
|
108
|
+
this.setMgInputs();
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Add slot listeners
|
|
112
|
+
*/
|
|
113
|
+
componentDidLoad() {
|
|
114
|
+
// Update mgInputs when mgForm content change
|
|
115
|
+
const observerOptions = { childList: true, subtree: true };
|
|
116
|
+
new MutationObserver(mutations => {
|
|
117
|
+
if (mutations.some(mutation => Object.keys(observerOptions).includes(mutation.type))) {
|
|
118
|
+
this.setMgInputs();
|
|
119
|
+
}
|
|
120
|
+
}).observe(this.element, observerOptions);
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Render
|
|
124
|
+
* @returns HTML Element
|
|
125
|
+
*/
|
|
126
|
+
render() {
|
|
127
|
+
return (h("mg-input", { key: 'b8b7c203bb2ed22cc9344389af5a6ae8d85af6d5', label: this.legend, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: !this.legendHide, labelHeading: this.legendHeading, labelBorderDisplay: this.legendHeading && this.legendBorderDisplay, labelHide: this.legendHide, inputsOnBottom: this.legendHeading !== undefined, tooltip: this.tooltip, tooltipPosition: 'label', helpText: this.helpText, errorMessage: !this.valid && isValidString(this.errorMessage) ? this.errorMessage : undefined }, h("span", { key: 'c0e7480b14b0a8e136dd951bdce7275b65b59b48', class: "mg-c-input__input-group" }, h("slot", { key: '021e7b126cef9437e64622d8ef59219b09c06e9f' }))));
|
|
128
|
+
}
|
|
129
|
+
static get is() { return "mg-fieldset"; }
|
|
130
|
+
static get encapsulation() { return "shadow"; }
|
|
131
|
+
static get properties() {
|
|
132
|
+
return {
|
|
133
|
+
"identifier": {
|
|
134
|
+
"type": "string",
|
|
135
|
+
"mutable": false,
|
|
136
|
+
"complexType": {
|
|
137
|
+
"original": "string",
|
|
138
|
+
"resolved": "string",
|
|
139
|
+
"references": {}
|
|
140
|
+
},
|
|
141
|
+
"required": true,
|
|
142
|
+
"optional": false,
|
|
143
|
+
"docs": {
|
|
144
|
+
"tags": [],
|
|
145
|
+
"text": "Identifier is used for the element ID (id is a reserved prop in Stencil.js)"
|
|
146
|
+
},
|
|
147
|
+
"getter": false,
|
|
148
|
+
"setter": false,
|
|
149
|
+
"reflect": false,
|
|
150
|
+
"attribute": "identifier"
|
|
151
|
+
},
|
|
152
|
+
"name": {
|
|
153
|
+
"type": "string",
|
|
154
|
+
"mutable": false,
|
|
155
|
+
"complexType": {
|
|
156
|
+
"original": "string",
|
|
157
|
+
"resolved": "string",
|
|
158
|
+
"references": {}
|
|
159
|
+
},
|
|
160
|
+
"required": false,
|
|
161
|
+
"optional": false,
|
|
162
|
+
"docs": {
|
|
163
|
+
"tags": [],
|
|
164
|
+
"text": "Fieldset name\nIf not set the value equals the identifier"
|
|
165
|
+
},
|
|
166
|
+
"getter": false,
|
|
167
|
+
"setter": false,
|
|
168
|
+
"reflect": false,
|
|
169
|
+
"attribute": "name",
|
|
170
|
+
"defaultValue": "this.identifier"
|
|
171
|
+
},
|
|
172
|
+
"legend": {
|
|
173
|
+
"type": "string",
|
|
174
|
+
"mutable": false,
|
|
175
|
+
"complexType": {
|
|
176
|
+
"original": "string",
|
|
177
|
+
"resolved": "string",
|
|
178
|
+
"references": {}
|
|
179
|
+
},
|
|
180
|
+
"required": true,
|
|
181
|
+
"optional": false,
|
|
182
|
+
"docs": {
|
|
183
|
+
"tags": [],
|
|
184
|
+
"text": "Fieldset legend"
|
|
185
|
+
},
|
|
186
|
+
"getter": false,
|
|
187
|
+
"setter": false,
|
|
188
|
+
"reflect": false,
|
|
189
|
+
"attribute": "legend"
|
|
190
|
+
},
|
|
191
|
+
"legendHide": {
|
|
192
|
+
"type": "boolean",
|
|
193
|
+
"mutable": false,
|
|
194
|
+
"complexType": {
|
|
195
|
+
"original": "boolean",
|
|
196
|
+
"resolved": "boolean",
|
|
197
|
+
"references": {}
|
|
198
|
+
},
|
|
199
|
+
"required": false,
|
|
200
|
+
"optional": false,
|
|
201
|
+
"docs": {
|
|
202
|
+
"tags": [],
|
|
203
|
+
"text": "Define if legend is visible"
|
|
204
|
+
},
|
|
205
|
+
"getter": false,
|
|
206
|
+
"setter": false,
|
|
207
|
+
"reflect": false,
|
|
208
|
+
"attribute": "legend-hide",
|
|
209
|
+
"defaultValue": "false"
|
|
210
|
+
},
|
|
211
|
+
"legendHeading": {
|
|
212
|
+
"type": "string",
|
|
213
|
+
"mutable": false,
|
|
214
|
+
"complexType": {
|
|
215
|
+
"original": "labelHeading",
|
|
216
|
+
"resolved": "\"h1\" | \"h2\" | \"h3\" | \"h4\" | \"h5\" | \"h6\"",
|
|
217
|
+
"references": {
|
|
218
|
+
"labelHeading": {
|
|
219
|
+
"location": "import",
|
|
220
|
+
"path": "../inputs/mg-input/mg-input.conf",
|
|
221
|
+
"id": "src/components/molecules/inputs/mg-input/mg-input.conf.ts::labelHeading"
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"required": false,
|
|
226
|
+
"optional": true,
|
|
227
|
+
"docs": {
|
|
228
|
+
"tags": [],
|
|
229
|
+
"text": "Define legend heading, use to define legend with associated semantic"
|
|
230
|
+
},
|
|
231
|
+
"getter": false,
|
|
232
|
+
"setter": false,
|
|
233
|
+
"reflect": false,
|
|
234
|
+
"attribute": "legend-heading"
|
|
235
|
+
},
|
|
236
|
+
"legendBorderDisplay": {
|
|
237
|
+
"type": "boolean",
|
|
238
|
+
"mutable": false,
|
|
239
|
+
"complexType": {
|
|
240
|
+
"original": "boolean",
|
|
241
|
+
"resolved": "boolean",
|
|
242
|
+
"references": {}
|
|
243
|
+
},
|
|
244
|
+
"required": false,
|
|
245
|
+
"optional": false,
|
|
246
|
+
"docs": {
|
|
247
|
+
"tags": [],
|
|
248
|
+
"text": "Define if legend border is visible."
|
|
249
|
+
},
|
|
250
|
+
"getter": false,
|
|
251
|
+
"setter": false,
|
|
252
|
+
"reflect": false,
|
|
253
|
+
"attribute": "legend-border-display",
|
|
254
|
+
"defaultValue": "false"
|
|
255
|
+
},
|
|
256
|
+
"readonly": {
|
|
257
|
+
"type": "boolean",
|
|
258
|
+
"mutable": false,
|
|
259
|
+
"complexType": {
|
|
260
|
+
"original": "boolean",
|
|
261
|
+
"resolved": "boolean",
|
|
262
|
+
"references": {}
|
|
263
|
+
},
|
|
264
|
+
"required": false,
|
|
265
|
+
"optional": false,
|
|
266
|
+
"docs": {
|
|
267
|
+
"tags": [],
|
|
268
|
+
"text": "Define if inputs are readonly"
|
|
269
|
+
},
|
|
270
|
+
"getter": false,
|
|
271
|
+
"setter": false,
|
|
272
|
+
"reflect": false,
|
|
273
|
+
"attribute": "readonly",
|
|
274
|
+
"defaultValue": "false"
|
|
275
|
+
},
|
|
276
|
+
"disabled": {
|
|
277
|
+
"type": "boolean",
|
|
278
|
+
"mutable": false,
|
|
279
|
+
"complexType": {
|
|
280
|
+
"original": "boolean",
|
|
281
|
+
"resolved": "boolean",
|
|
282
|
+
"references": {}
|
|
283
|
+
},
|
|
284
|
+
"required": false,
|
|
285
|
+
"optional": false,
|
|
286
|
+
"docs": {
|
|
287
|
+
"tags": [],
|
|
288
|
+
"text": "Define if inputs are disabled"
|
|
289
|
+
},
|
|
290
|
+
"getter": false,
|
|
291
|
+
"setter": false,
|
|
292
|
+
"reflect": false,
|
|
293
|
+
"attribute": "disabled",
|
|
294
|
+
"defaultValue": "false"
|
|
295
|
+
},
|
|
296
|
+
"tooltip": {
|
|
297
|
+
"type": "string",
|
|
298
|
+
"mutable": false,
|
|
299
|
+
"complexType": {
|
|
300
|
+
"original": "string",
|
|
301
|
+
"resolved": "string",
|
|
302
|
+
"references": {}
|
|
303
|
+
},
|
|
304
|
+
"required": false,
|
|
305
|
+
"optional": true,
|
|
306
|
+
"docs": {
|
|
307
|
+
"tags": [],
|
|
308
|
+
"text": "Add a tooltip message next to the fieldset"
|
|
309
|
+
},
|
|
310
|
+
"getter": false,
|
|
311
|
+
"setter": false,
|
|
312
|
+
"reflect": false,
|
|
313
|
+
"attribute": "tooltip"
|
|
314
|
+
},
|
|
315
|
+
"helpText": {
|
|
316
|
+
"type": "string",
|
|
317
|
+
"mutable": false,
|
|
318
|
+
"complexType": {
|
|
319
|
+
"original": "string",
|
|
320
|
+
"resolved": "string",
|
|
321
|
+
"references": {}
|
|
322
|
+
},
|
|
323
|
+
"required": false,
|
|
324
|
+
"optional": true,
|
|
325
|
+
"docs": {
|
|
326
|
+
"tags": [],
|
|
327
|
+
"text": "Add a help text under the fieldset, usually expected data format and example"
|
|
328
|
+
},
|
|
329
|
+
"getter": false,
|
|
330
|
+
"setter": false,
|
|
331
|
+
"reflect": false,
|
|
332
|
+
"attribute": "help-text"
|
|
333
|
+
}
|
|
334
|
+
};
|
|
335
|
+
}
|
|
336
|
+
static get states() {
|
|
337
|
+
return {
|
|
338
|
+
"errorMessage": {},
|
|
339
|
+
"valid": {},
|
|
340
|
+
"classCollection": {}
|
|
341
|
+
};
|
|
342
|
+
}
|
|
343
|
+
static get methods() {
|
|
344
|
+
return {
|
|
345
|
+
"setCustomValidity": {
|
|
346
|
+
"complexType": {
|
|
347
|
+
"signature": "(errorMessage?: string) => Promise<void>",
|
|
348
|
+
"parameters": [{
|
|
349
|
+
"name": "errorMessage",
|
|
350
|
+
"type": "string",
|
|
351
|
+
"docs": "- error message to display. Use a valid `string` to define an error or `undefined` to delete the error"
|
|
352
|
+
}],
|
|
353
|
+
"references": {
|
|
354
|
+
"Promise": {
|
|
355
|
+
"location": "global",
|
|
356
|
+
"id": "global::Promise"
|
|
357
|
+
}
|
|
358
|
+
},
|
|
359
|
+
"return": "Promise<void>"
|
|
360
|
+
},
|
|
361
|
+
"docs": {
|
|
362
|
+
"text": "Component is not a candidate for constraint validation.\nYou can use this method to define the `errorMessage` and set the `valid` state to `false`.",
|
|
363
|
+
"tags": [{
|
|
364
|
+
"name": "param",
|
|
365
|
+
"text": "errorMessage - error message to display. Use a valid `string` to define an error or `undefined` to delete the error"
|
|
366
|
+
}]
|
|
367
|
+
}
|
|
368
|
+
},
|
|
369
|
+
"displayError": {
|
|
370
|
+
"complexType": {
|
|
371
|
+
"signature": "() => Promise<void>",
|
|
372
|
+
"parameters": [],
|
|
373
|
+
"references": {
|
|
374
|
+
"Promise": {
|
|
375
|
+
"location": "global",
|
|
376
|
+
"id": "global::Promise"
|
|
377
|
+
}
|
|
378
|
+
},
|
|
379
|
+
"return": "Promise<void>"
|
|
380
|
+
},
|
|
381
|
+
"docs": {
|
|
382
|
+
"text": "Display inputs error if it exists.",
|
|
383
|
+
"tags": []
|
|
384
|
+
}
|
|
385
|
+
}
|
|
386
|
+
};
|
|
387
|
+
}
|
|
388
|
+
static get elementRef() { return "element"; }
|
|
389
|
+
static get watchers() {
|
|
390
|
+
return [{
|
|
391
|
+
"propName": "legendBorderDisplay",
|
|
392
|
+
"methodName": "watchLegendBorderDisplay"
|
|
393
|
+
}, {
|
|
394
|
+
"propName": "readonly",
|
|
395
|
+
"methodName": "watchReadonly"
|
|
396
|
+
}, {
|
|
397
|
+
"propName": "readonly",
|
|
398
|
+
"methodName": "handleAttributeChange"
|
|
399
|
+
}, {
|
|
400
|
+
"propName": "disabled",
|
|
401
|
+
"methodName": "handleAttributeChange"
|
|
402
|
+
}];
|
|
403
|
+
}
|
|
404
|
+
}
|
|
@@ -151,11 +151,12 @@ export class MgForm {
|
|
|
151
151
|
this.setRequiredMessage();
|
|
152
152
|
}
|
|
153
153
|
/**
|
|
154
|
-
* Display
|
|
154
|
+
* Display inputs/fieldsets errors if it exists.
|
|
155
155
|
*/
|
|
156
156
|
async displayError() {
|
|
157
157
|
if (!this.readonly) {
|
|
158
|
-
this.
|
|
158
|
+
const mgFieldsets = Array.from(this.element.querySelectorAll('*')).filter((node) => node.nodeName.startsWith('MG-FIELDSET'));
|
|
159
|
+
[...mgFieldsets, ...this.mgInputs].forEach(input => {
|
|
159
160
|
var _a;
|
|
160
161
|
(_a = input.displayError) === null || _a === void 0 ? void 0 : _a.call(input);
|
|
161
162
|
});
|
|
@@ -231,7 +232,7 @@ export class MgForm {
|
|
|
231
232
|
* @returns HTML Element
|
|
232
233
|
*/
|
|
233
234
|
render() {
|
|
234
|
-
return (h("form", { key: '
|
|
235
|
+
return (h("form", { key: '8b698b2a33af00e36691abab5adff5488b736218', class: this.classCollection.join(), id: this.identifier, name: this.name, onSubmit: this.handleFormSubmit, role: this.ariaRole }, this.requiredMessageText && h("p", { key: '2e1fb5c4030ecb99d1f18c57d5c3fe238db4d12e', innerHTML: this.requiredMessageText }), h("slot", { key: '568fb8ac9ab0e3521899c05472592ebd15cc91fa' }), !this.readonly && !this.disabled && h("slot", { key: 'd4f38320de58f3b1d491083a34d1b5366d22b935', name: "actions" })));
|
|
235
236
|
}
|
|
236
237
|
static get is() { return "mg-form"; }
|
|
237
238
|
static get encapsulation() { return "shadow"; }
|
|
@@ -506,12 +507,20 @@ export class MgForm {
|
|
|
506
507
|
"Promise": {
|
|
507
508
|
"location": "global",
|
|
508
509
|
"id": "global::Promise"
|
|
510
|
+
},
|
|
511
|
+
"Node": {
|
|
512
|
+
"location": "global",
|
|
513
|
+
"id": "global::Node"
|
|
514
|
+
},
|
|
515
|
+
"HTMLMgFieldsetElement": {
|
|
516
|
+
"location": "global",
|
|
517
|
+
"id": "global::HTMLMgFieldsetElement"
|
|
509
518
|
}
|
|
510
519
|
},
|
|
511
520
|
"return": "Promise<void>"
|
|
512
521
|
},
|
|
513
522
|
"docs": {
|
|
514
|
-
"text": "Display
|
|
523
|
+
"text": "Display inputs/fieldsets errors if it exists.",
|
|
515
524
|
"tags": []
|
|
516
525
|
}
|
|
517
526
|
},
|
package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js
CHANGED
|
@@ -81,7 +81,7 @@ export class MgIllustratedMessage {
|
|
|
81
81
|
* @returns HTML Element
|
|
82
82
|
*/
|
|
83
83
|
render() {
|
|
84
|
-
return (h("div", { key: '
|
|
84
|
+
return (h("div", { key: 'c9d8c8bfd2792b1cf5e78ab9d168d597b20e9a1e', class: this.classCollection.join() }, h("div", { key: 'cc8fa03147b9e59e6e8e015be9ed2b8dddd92ded', class: "mg-c-illustrated-message__illustration" }, h("slot", { key: '83a4ec2223c4e74511beb7c0abfa10e77cee425d', name: "illustration" })), h("div", { key: 'dbb4d13ca5324cab889fa2acc9b9b22522d7a8ec', class: "mg-c-illustrated-message__slots" }, h("slot", { key: '9e74d84becf29539ec9c37e8ad1e317714f3c86c', name: "title" }), h("slot", { key: 'ae97d25c19b76ca092560d2555ebd6a87f542ffe', name: "details" }))));
|
|
85
85
|
}
|
|
86
86
|
static get is() { return "mg-illustrated-message"; }
|
|
87
87
|
static get encapsulation() { return "shadow"; }
|
|
@@ -29,7 +29,7 @@ export class MgLoader {
|
|
|
29
29
|
* @returns HTML Element
|
|
30
30
|
*/
|
|
31
31
|
render() {
|
|
32
|
-
return (h("div", { key: '
|
|
32
|
+
return (h("div", { key: '739b4cbacd8a8da056dbb1445c40fac2cf26766a', class: "mg-c-loader", "aria-live": "polite" }, h("mg-icon", { key: '95d3cbf26fcd6dbf0dad4853bf55aa66385f1aba', icon: "loader", spin: true }), h("span", { key: 'f6322cd3054d8976bd2ec24f86a2d6bb60ca7ae1', class: { 'mg-u-visually-hidden': this.messageHide } }, this.message || this.messages.loader.inProgress)));
|
|
33
33
|
}
|
|
34
34
|
static get is() { return "mg-loader"; }
|
|
35
35
|
static get encapsulation() { return "shadow"; }
|
|
@@ -86,9 +86,9 @@ export class MgMessage {
|
|
|
86
86
|
* @returns HTML Element
|
|
87
87
|
*/
|
|
88
88
|
render() {
|
|
89
|
-
return (h("div", { key: '
|
|
89
|
+
return (h("div", { key: 'f99bf527eb2c6005eeaec11f89aaa08f8865ea57', class: this.classCollection.join() }, h("mg-card", { key: 'beede3cd97b022d947c216b6bba454a104ba5790', shadow: true }, this.variantStyle === 'bar-left' && h("span", { key: '515828d725a996c9d57b39ad75e9373150a1b78a', class: "mg-c-message__bar" }), h("span", { key: '02ae41c66af25c2611b9b6cb8c87a1ad99346fa3', class: "mg-c-message__icon" }, h("mg-icon", { key: '3eadb40ed0dfa5ec51155608a67769c5fee3d402', icon: this.getIcon() })), h("div", { key: 'b832251e8f330d00b512bcd508ae9bf6e5f511cb', class: "mg-c-message__content" }, h("span", { key: 'c3520fc49bd5c3c187a83823050ceb9ca8c12d46', class: "mg-c-message__content-slot" }, h("slot", { key: 'f4064dff9536cbb76e45c5c4c1a89621da9531b2' })), this.hasActions && [
|
|
90
90
|
h("span", { class: "mg-c-message__content-separator", key: "content-separator" }),
|
|
91
|
-
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '
|
|
91
|
+
h("span", { class: "mg-c-message__content-actions-slot", key: "content-actions-slot" }, h("slot", { key: '5585f7c14c2c3896cfdb5319414cd82f4d4b3a8b', name: "actions" })),
|
|
92
92
|
]))));
|
|
93
93
|
}
|
|
94
94
|
static get is() { return "mg-message"; }
|
|
@@ -106,11 +106,11 @@ export class MgModal {
|
|
|
106
106
|
* @returns HTML Element
|
|
107
107
|
*/
|
|
108
108
|
render() {
|
|
109
|
-
return (h("dialog", { key: '
|
|
109
|
+
return (h("dialog", { key: '2d99322fd3c80b8cbfea70589cf579e0c1c6f06b', role: this.dialogRole, id: this.identifier, class: this.classCollection.join(), "aria-labelledby": this.titleId, ref: (el) => {
|
|
110
110
|
if (el !== null) {
|
|
111
111
|
this.dialog = el;
|
|
112
112
|
}
|
|
113
|
-
} }, h("mg-card", { key: '
|
|
113
|
+
} }, h("mg-card", { key: '32692a6d41ef30b3d3e61ddcfea47350d374ed09', shadow: true }, h("div", { key: 'c87bb43bb069671b65a9759ee293e77975707597', class: "mg-c-modal__dialog" }, h("header", { key: '1272a946878efcf8c69f3b09852ba6938cbe31b0', class: "mg-c-modal__header" }, this.closeButton && (h("span", { key: '0704656c7c5ac4c8d405f2cd673e91f72763ee8f', class: "mg-c-modal__close-button" }, h("mg-button", { key: '4402971c763ee34145de5bd69d367fde68f9d1a2', "is-icon": true, variant: "flat", label: this.messages.modal.closeButton, onClick: this.handleClose }, h("mg-icon", { key: '9e16add6a3e387971507a252671c895b6c94a586', icon: "cross" })))), h("h1", { key: '3e4fc2b4419398528565d382b728b8b752758ddd', class: "mg-c-modal__title", id: this.titleId }, this.modalTitle)), h("article", { key: '170ff6bd9592687baa4c561615f540ad1c7400e4', class: "mg-c-modal__content" }, h("slot", { key: 'cb710e2a57e4c997deac367169b56047af1200b1' })), this.hasActions && (h("footer", { key: '1e08d67caeaaaf75eb97faa11528719ea537c24c', class: "mg-c-modal__footer" }, h("slot", { key: '461ec8e4117477aef08dc6d346ad0bf6007ec12d', name: "actions" })))))));
|
|
114
114
|
}
|
|
115
115
|
static get is() { return "mg-modal"; }
|
|
116
116
|
static get encapsulation() { return "shadow"; }
|
|
@@ -4,6 +4,7 @@ import { initLocales } from "../../../locales";
|
|
|
4
4
|
import { expandToggleDisplays, titlePositions } from "./mg-panel.conf";
|
|
5
5
|
/**
|
|
6
6
|
* @slot - Panel content
|
|
7
|
+
* @slot panel-title - Panel title content (replaces panel-title prop when used)
|
|
7
8
|
* @slot header-right - Header right panel content
|
|
8
9
|
*/
|
|
9
10
|
export class MgPanel {
|
|
@@ -48,6 +49,13 @@ export class MgPanel {
|
|
|
48
49
|
/************
|
|
49
50
|
* Methods *
|
|
50
51
|
************/
|
|
52
|
+
/**
|
|
53
|
+
* Check if panel-title slot is used
|
|
54
|
+
* @returns true if slot is used
|
|
55
|
+
*/
|
|
56
|
+
this.hasPanelTitleSlot = () => {
|
|
57
|
+
return this.element.querySelector('[slot="panel-title"]') !== null;
|
|
58
|
+
};
|
|
51
59
|
/**
|
|
52
60
|
* Toggle is editing state
|
|
53
61
|
*/
|
|
@@ -101,7 +109,7 @@ export class MgPanel {
|
|
|
101
109
|
* Render collapse button
|
|
102
110
|
* @returns collpase button
|
|
103
111
|
*/
|
|
104
|
-
this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", "aria-expanded": this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.panelTitle }, h("span", { class: "mg-c-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: { 'mg-c-panel__collapse-button-icon': true, 'mg-c-panel__collapse-button-icon--reverse': !this.expanded } }), !this.isEditing && this.expandToggleDisplay !== 'icon' && this.panelTitle)));
|
|
112
|
+
this.renderCollapseButton = () => (h("mg-button", { onClick: this.handleCollapseButton, variant: "flat", "aria-expanded": this.expanded.toString(), "aria-controls": `${this.identifier}-content`, disabled: this.expandToggleDisabled, isIcon: this.expandToggleDisplay === 'icon', label: this.expandToggleDisplay === 'icon' ? this.panelTitle : undefined }, h("span", { class: "mg-c-panel__collapse-button-content" }, h("mg-icon", { icon: "chevron-up", class: { 'mg-c-panel__collapse-button-icon': true, 'mg-c-panel__collapse-button-icon--reverse': !this.expanded } }), !this.isEditing && this.expandToggleDisplay !== 'icon' && (this.hasPanelTitleSlot() ? h("slot", { name: "panel-title" }) : this.panelTitle))));
|
|
105
113
|
/**
|
|
106
114
|
* Render edit button
|
|
107
115
|
* @returns edit Button
|
|
@@ -118,7 +126,8 @@ export class MgPanel {
|
|
|
118
126
|
*/
|
|
119
127
|
this.renderTitle = () => {
|
|
120
128
|
const elementsToRender = [this.renderCollapseButton()];
|
|
121
|
-
if
|
|
129
|
+
// Add edit functionality only if not using slot and title is editable
|
|
130
|
+
if (this.titleEditable && !this.hasPanelTitleSlot()) {
|
|
122
131
|
if (!this.isEditing)
|
|
123
132
|
elementsToRender.push(this.renderEditButton());
|
|
124
133
|
else
|
|
@@ -144,14 +153,24 @@ export class MgPanel {
|
|
|
144
153
|
}
|
|
145
154
|
}
|
|
146
155
|
validatePanelTitle(newValue) {
|
|
147
|
-
if (
|
|
148
|
-
|
|
149
|
-
|
|
156
|
+
if (newValue !== undefined) {
|
|
157
|
+
if (!isValidString(newValue)) {
|
|
158
|
+
throw new Error(`<mg-panel> prop "panelTitle" must be a string. Passed value: ${toString(newValue)}.`);
|
|
159
|
+
}
|
|
160
|
+
else {
|
|
161
|
+
this.titleChange.emit(newValue);
|
|
162
|
+
}
|
|
163
|
+
}
|
|
150
164
|
}
|
|
151
165
|
validateTitlePattern(newValue) {
|
|
152
166
|
if (newValue !== undefined && !this.titleEditable)
|
|
153
167
|
throw new Error(`<mg-panel> prop "titleEditable" must be set to "true".`);
|
|
154
168
|
}
|
|
169
|
+
validateTitleEditable(newValue) {
|
|
170
|
+
if (newValue && this.hasPanelTitleSlot()) {
|
|
171
|
+
throw new Error(`<mg-panel> prop "titleEditable" cannot be used with panel-title slot.`);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
155
174
|
validateTitlePosition(newValue) {
|
|
156
175
|
if (!titlePositions.includes(newValue))
|
|
157
176
|
throw new Error(`<mg-panel> prop "titlePosition" must be one of: ${titlePositions.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
@@ -164,6 +183,9 @@ export class MgPanel {
|
|
|
164
183
|
throw new Error(`<mg-panel> prop "expandToggleDisplay" must be one of: ${expandToggleDisplays.join(', ')}. Passed value: ${toString(newValue)}.`);
|
|
165
184
|
if (newValue === 'icon' && this.titleEditable)
|
|
166
185
|
this.titleEditable = false;
|
|
186
|
+
if (newValue === 'icon' && this.hasPanelTitleSlot()) {
|
|
187
|
+
throw new Error(`<mg-panel> prop "expandToggleDisplay" cannot be "icon" when panel-title slot is used.`);
|
|
188
|
+
}
|
|
167
189
|
}
|
|
168
190
|
/*************
|
|
169
191
|
* Lifecycle *
|
|
@@ -178,9 +200,15 @@ export class MgPanel {
|
|
|
178
200
|
this.watchIdentifier(this.identifier);
|
|
179
201
|
this.validateTitlePattern(this.titlePattern);
|
|
180
202
|
this.validateTitlePattern(this.titlePatternErrorMessage);
|
|
181
|
-
|
|
203
|
+
// Only validate panelTitle if slot is not used
|
|
204
|
+
if (!this.hasPanelTitleSlot()) {
|
|
205
|
+
if (!isValidString(this.panelTitle))
|
|
206
|
+
throw new Error(`<mg-panel> prop "panelTitle" is required when panel-title slot is not used.`);
|
|
207
|
+
this.validatePanelTitle(this.panelTitle);
|
|
208
|
+
}
|
|
182
209
|
this.validateExpandToggleDisplay(this.expandToggleDisplay);
|
|
183
210
|
this.validateTitlePosition(this.titlePosition);
|
|
211
|
+
this.validateTitleEditable(this.titleEditable);
|
|
184
212
|
}
|
|
185
213
|
/**
|
|
186
214
|
* Edit DOM after render
|
|
@@ -196,7 +224,7 @@ export class MgPanel {
|
|
|
196
224
|
*/
|
|
197
225
|
render() {
|
|
198
226
|
const headerId = `${this.identifier}-header`;
|
|
199
|
-
return (h("section", { key: '
|
|
227
|
+
return (h("section", { key: '3662204d763051c34ea13de4b7b3f7abc7914b81', class: this.classCollection.join(), id: this.identifier }, h("mg-card", { key: '46f113258172b1d040f65a4d312554b0c0551489', shadow: this.shadow }, h("header", { key: '1d7e7a48a5c4f89d141a5a7e46b220d4f9c082a5', class: { 'mg-c-panel__header': true, 'mg-c-panel__header--reverse': this.titlePosition === 'right' }, id: headerId }, this.renderHeaderChildren()), h("article", { key: 'ab0aec831cc79d982b7556d6e245c80ae2979083', class: "mg-c-panel__content", id: `${this.identifier}-content`, "aria-labelledby": headerId, hidden: !this.expanded }, h("slot", { key: 'e831573fe9d5ff783073d123b7e2a54baad73bfc' })))));
|
|
200
228
|
}
|
|
201
229
|
static get is() { return "mg-panel"; }
|
|
202
230
|
static get encapsulation() { return "shadow"; }
|
|
@@ -240,8 +268,8 @@ export class MgPanel {
|
|
|
240
268
|
"resolved": "string",
|
|
241
269
|
"references": {}
|
|
242
270
|
},
|
|
243
|
-
"required":
|
|
244
|
-
"optional":
|
|
271
|
+
"required": false,
|
|
272
|
+
"optional": true,
|
|
245
273
|
"docs": {
|
|
246
274
|
"tags": [],
|
|
247
275
|
"text": "Panel title"
|
|
@@ -487,6 +515,9 @@ export class MgPanel {
|
|
|
487
515
|
}, {
|
|
488
516
|
"propName": "titlePatternErrorMessage",
|
|
489
517
|
"methodName": "validateTitlePattern"
|
|
518
|
+
}, {
|
|
519
|
+
"propName": "titleEditable",
|
|
520
|
+
"methodName": "validateTitleEditable"
|
|
490
521
|
}, {
|
|
491
522
|
"propName": "titlePosition",
|
|
492
523
|
"methodName": "validateTitlePosition"
|
package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js
CHANGED
|
@@ -46,7 +46,7 @@ export class MgPopoverContent {
|
|
|
46
46
|
* @returns HTML Element
|
|
47
47
|
*/
|
|
48
48
|
render() {
|
|
49
|
-
return (h(Host, { key: '
|
|
49
|
+
return (h(Host, { key: '054fc82954b39a488f7fe5cb391d89b5fa4a61fe' }, h("mg-card", { key: 'bb89bada37069b50295bd93d988667c3b85eada3', class: this.classCollection.join(), shadow: true }, this.closeButton && (h("mg-button", { key: 'a59d6610574b964be1e2ce34ccd8e31c1395b6ff', "is-icon": true, variant: "flat", label: this.messages.general.close, onClick: this.handleCloseButton }, h("mg-icon", { key: '5bcc9e4eb21396f4fc66a6f1e4d6c5cdf68ec1f4', icon: "cross" }))), h("div", { key: '57be2022f3b61220e1249faeaf2acee9960027fe', class: "mg-c-popover-content__title" }, h("slot", { key: 'c7870e86a9f105cf6b9d4520c77874bce9235d72', name: "title" })), h("slot", { key: '5af8462232625d9c7d694bab46351d5e646f62ca', name: "content" })), h("slot", { key: '599863410dd7d751e82c440cd6c4fb7f2c48d9f3', name: "arrow" })));
|
|
50
50
|
}
|
|
51
51
|
static get is() { return "mg-popover-content"; }
|
|
52
52
|
static get encapsulation() { return "shadow"; }
|
|
@@ -242,7 +242,7 @@ export class MgPopover {
|
|
|
242
242
|
* @returns HTML Element
|
|
243
243
|
*/
|
|
244
244
|
render() {
|
|
245
|
-
return (h(Host, { key: '
|
|
245
|
+
return (h(Host, { key: '2c1506b8e2da100519aeeae75fc5c378a81c473c' }, h("slot", { key: 'f9aea885e8cbc168614c05761829f0a0740eba9e' }), h("slot", { key: 'fa6106a660a73b3761d4783f8d46d401c47b4eb6', name: "content" })));
|
|
246
246
|
}
|
|
247
247
|
static get is() { return "mg-popover"; }
|
|
248
248
|
static get encapsulation() { return "shadow"; }
|