@mgdis/mg-components 6.15.0 → 6.16.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/events.utils-D5SAtkpQ.js +25 -0
- package/dist/cjs/{index-BGxkpQwi.js → index-T3-qWqFE.js} +2 -2
- package/dist/cjs/{index-iUZvsp-F.js → index-YM1EJx9X.js} +8 -20
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_37.cjs.entry.js +68 -305
- package/dist/cjs/mg-alert.cjs.entry.js +2 -2
- package/dist/cjs/mg-components.cjs.js +3 -3
- package/dist/cjs/mg-input-combobox.cjs.entry.js +78 -140
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +3 -3
- package/dist/cjs/{mg-input.conf-CwjEAih3.js → mg-input.conf-WTsvDfpC.js} +0 -7
- package/dist/cjs/mg-loader.cjs.entry.js +2 -2
- package/dist/cjs/mg-progress.cjs.entry.js +1 -1
- package/dist/collection/collection-manifest.json +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.conf.js +0 -6
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +22 -93
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +1 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +13 -69
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +54 -136
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +10 -63
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +6 -54
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +9 -142
- package/dist/collection/locales/en/messages.json +3 -8
- package/dist/collection/locales/fr/messages.json +3 -8
- package/dist/components/index2.js +1 -1
- package/dist/components/index3.js +8 -20
- package/dist/components/mg-details.js +97 -1
- package/dist/components/mg-input-checkbox-paginated2.js +1 -2
- package/dist/components/mg-input-checkbox.js +19 -63
- package/dist/components/mg-input-combobox.js +60 -130
- package/dist/components/mg-input-date.js +1 -7
- package/dist/components/mg-input-numeric.js +1 -7
- package/dist/components/mg-input-password.js +2 -8
- package/dist/components/mg-input-radio.js +12 -53
- package/dist/components/mg-input-rich-text-editor.js +1 -7
- package/dist/components/mg-input-select2.js +8 -44
- package/dist/components/mg-input-text2.js +2 -8
- package/dist/components/mg-input-textarea.js +2 -8
- package/dist/components/mg-input-toggle.js +11 -96
- package/dist/components/mg-input2.js +22 -99
- package/dist/components/mg-pagination.js +2 -8
- package/dist/components/mg-panel.js +7 -13
- package/dist/esm/events.utils-yMGqY8YG.js +23 -0
- package/dist/esm/{index-CKB-AnCZ.js → index-Bab8_u8S.js} +8 -20
- package/dist/esm/{index-DhAOnZJn.js → index-JHj_9FSs.js} +2 -2
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_37.entry.js +64 -301
- package/dist/esm/mg-alert.entry.js +2 -2
- package/dist/esm/mg-components.js +4 -4
- package/dist/esm/mg-input-combobox.entry.js +59 -121
- package/dist/esm/mg-input-rich-text-editor.entry.js +3 -3
- package/dist/esm/{mg-input.conf-BAUTlb6r.js → mg-input.conf-CNgv8hc5.js} +1 -7
- package/dist/esm/mg-loader.entry.js +2 -2
- package/dist/esm/mg-progress.entry.js +1 -1
- package/dist/mg-components/locales/en/messages.json +3 -8
- package/dist/mg-components/locales/fr/messages.json +3 -8
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-420daa1e.entry.js → p-42a90251.entry.js} +1 -1
- package/dist/mg-components/p-54156253.entry.js +1 -0
- package/dist/mg-components/{p-47e19783.entry.js → p-658f828c.entry.js} +1 -1
- package/dist/mg-components/{p-67af6274.entry.js → p-82455ac7.entry.js} +1 -1
- package/dist/mg-components/p-Bab8_u8S.js +1 -0
- package/dist/mg-components/p-CNgv8hc5.js +1 -0
- package/dist/mg-components/{p-DhAOnZJn.js → p-JHj_9FSs.js} +1 -1
- package/dist/mg-components/p-abbd151c.entry.js +1 -0
- package/dist/mg-components/{p-a0fa44cf.entry.js → p-c85b5d10.entry.js} +1 -1
- package/dist/mg-components/p-yMGqY8YG.js +1 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.conf.d.ts +0 -13
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +4 -15
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +3 -21
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +2 -16
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -18
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +4 -40
- package/dist/types/components.d.ts +7 -63
- package/ide/intellij/web-types.json +10 -136
- package/ide/vscode/html-custom-data.json +6 -104
- package/package.json +20 -20
- package/dist/cjs/mg-input.utils-D-ASK4ua.js +0 -49
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.utils.js +0 -21
- package/dist/components/mg-details2.js +0 -99
- package/dist/components/mg-input.utils.js +0 -24
- package/dist/esm/mg-input.utils-BYI03zSi.js +0 -46
- package/dist/mg-components/p-31856cff.entry.js +0 -1
- package/dist/mg-components/p-698dfc6c.entry.js +0 -1
- package/dist/mg-components/p-BAUTlb6r.js +0 -1
- package/dist/mg-components/p-CKB-AnCZ.js +0 -1
- package/dist/mg-components/p-PuX-pdL4.js +0 -1
- package/dist/types/components/molecules/inputs/mg-input/mg-input.utils.d.ts +0 -8
|
@@ -1,8 +1,6 @@
|
|
|
1
1
|
import { h, Host } from "@stencil/core";
|
|
2
|
-
import {
|
|
2
|
+
import { isValideID, isValidString, toString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
3
|
import { tooltipPositions, classFieldset, classReadonly, classDisabled, classVerticalList } from "./mg-input.conf";
|
|
4
|
-
import { initLocales } from "../../../../locales";
|
|
5
|
-
const isValidErrorMessageType = (msg) => isObject(msg) && ['summary', 'details'].every(key => typeof msg[key] === 'string');
|
|
6
4
|
/**
|
|
7
5
|
* @slot - Input content
|
|
8
6
|
*/
|
|
@@ -10,8 +8,6 @@ export class MgInput {
|
|
|
10
8
|
constructor() {
|
|
11
9
|
this.slotLabel = 'label';
|
|
12
10
|
this.slotError = 'error';
|
|
13
|
-
this.slotSummary = 'summary';
|
|
14
|
-
this.slotDetails = 'details';
|
|
15
11
|
this.slotHelpText = 'help-text';
|
|
16
12
|
// style
|
|
17
13
|
this.classInput = 'mg-c-input';
|
|
@@ -53,44 +49,6 @@ export class MgInput {
|
|
|
53
49
|
* Element is disabled
|
|
54
50
|
*/
|
|
55
51
|
this.isVerticalList = false;
|
|
56
|
-
/**
|
|
57
|
-
* Render error message details element
|
|
58
|
-
*/
|
|
59
|
-
this.renderErrorDetailsMessage = (message) => {
|
|
60
|
-
var _a, _b;
|
|
61
|
-
// remove error slot if it is NOT a MG-DETAIL
|
|
62
|
-
if (((_a = this.errorMessageSlotElement) === null || _a === void 0 ? void 0 : _a.nodeName) !== 'MG-DETAILS') {
|
|
63
|
-
(_b = this.errorMessageSlotElement) === null || _b === void 0 ? void 0 : _b.remove();
|
|
64
|
-
}
|
|
65
|
-
// create OR update error summary
|
|
66
|
-
let summarySlotElement = this.element.querySelector(`[slot=${this.slotError}] [slot=${this.slotSummary}]`);
|
|
67
|
-
if (summarySlotElement === null) {
|
|
68
|
-
summarySlotElement = document.createElement('span');
|
|
69
|
-
summarySlotElement.setAttribute('slot', this.slotSummary);
|
|
70
|
-
}
|
|
71
|
-
summarySlotElement.innerHTML = message.summary;
|
|
72
|
-
// create OR update error details
|
|
73
|
-
let detailsSlotElement = this.element.querySelector(`[slot=${this.slotError}] [slot=${this.slotDetails}]`);
|
|
74
|
-
if (detailsSlotElement === null) {
|
|
75
|
-
detailsSlotElement = document.createElement('p');
|
|
76
|
-
detailsSlotElement.setAttribute('slot', this.slotDetails);
|
|
77
|
-
detailsSlotElement.classList.add('mg-c-input__error-details');
|
|
78
|
-
}
|
|
79
|
-
detailsSlotElement.innerHTML = message.details;
|
|
80
|
-
// create error mg-details
|
|
81
|
-
let mgDetails = this.element.querySelector(`mg-details[slot=${this.slotError}]`);
|
|
82
|
-
if (mgDetails === null) {
|
|
83
|
-
mgDetails = document.createElement('mg-details');
|
|
84
|
-
mgDetails.classList.add('mg-c-input__error');
|
|
85
|
-
mgDetails.toggleClosed = this.messages.details.toggleClosed;
|
|
86
|
-
mgDetails.toggleOpened = this.messages.details.toggleOpened;
|
|
87
|
-
mgDetails.hideSummary = true;
|
|
88
|
-
mgDetails.appendChild(summarySlotElement);
|
|
89
|
-
mgDetails.appendChild(detailsSlotElement);
|
|
90
|
-
this.element.appendChild(mgDetails);
|
|
91
|
-
}
|
|
92
|
-
this.errorMessageSlotElement = mgDetails;
|
|
93
|
-
};
|
|
94
52
|
/**
|
|
95
53
|
* Get tooltip node
|
|
96
54
|
* @returns mg-tooltip
|
|
@@ -128,14 +86,16 @@ export class MgInput {
|
|
|
128
86
|
}
|
|
129
87
|
}
|
|
130
88
|
watchErrorMessage(newValue) {
|
|
131
|
-
|
|
89
|
+
var _a;
|
|
90
|
+
if (newValue !== undefined) {
|
|
132
91
|
this.element.classList.add(this.classHasError);
|
|
92
|
+
this.renderErrorMessage();
|
|
133
93
|
}
|
|
134
94
|
else {
|
|
135
95
|
this.element.classList.remove(this.classHasError);
|
|
96
|
+
(_a = this.errorMessageSlotElement) === null || _a === void 0 ? void 0 : _a.remove();
|
|
97
|
+
this.errorMessageSlotElement = undefined;
|
|
136
98
|
}
|
|
137
|
-
// update error message slot
|
|
138
|
-
this.renderErrorMessageSlot();
|
|
139
99
|
}
|
|
140
100
|
watchHelpText(newValue) {
|
|
141
101
|
var _a;
|
|
@@ -164,12 +124,14 @@ export class MgInput {
|
|
|
164
124
|
// Help text
|
|
165
125
|
if (this.helpText !== undefined) {
|
|
166
126
|
this.renderHelpText();
|
|
167
|
-
ariaDescribedbyIDs.
|
|
127
|
+
if (!ariaDescribedbyIDs.has(this.helpTextId))
|
|
128
|
+
ariaDescribedbyIDs.add(this.helpTextId);
|
|
168
129
|
}
|
|
169
130
|
// Error Message
|
|
170
131
|
if (this.errorMessage !== undefined) {
|
|
171
|
-
this.
|
|
172
|
-
ariaDescribedbyIDs.
|
|
132
|
+
this.renderErrorMessage();
|
|
133
|
+
if (!ariaDescribedbyIDs.has(this.helpTextErrorId))
|
|
134
|
+
ariaDescribedbyIDs.add(this.helpTextErrorId);
|
|
173
135
|
}
|
|
174
136
|
this.element.querySelectorAll('input,select,textarea,[role="switch"]').forEach(element => {
|
|
175
137
|
if (ariaDescribedbyIDs.size > 0) {
|
|
@@ -235,41 +197,17 @@ export class MgInput {
|
|
|
235
197
|
this.element.appendChild(labelSlotElement);
|
|
236
198
|
}
|
|
237
199
|
/**
|
|
238
|
-
* Render error message
|
|
200
|
+
* Render error message
|
|
239
201
|
*/
|
|
240
|
-
|
|
241
|
-
var _a;
|
|
242
|
-
// remove error slot if it is a MG-DETAIL
|
|
243
|
-
if (((_a = this.errorMessageSlotElement) === null || _a === void 0 ? void 0 : _a.nodeName) === 'MG-DETAILS') {
|
|
244
|
-
this.errorMessageSlotElement.remove();
|
|
245
|
-
}
|
|
246
|
-
// create element if it does NOT exist
|
|
247
|
-
else if (this.errorMessageSlotElement === null) {
|
|
248
|
-
this.errorMessageSlotElement = document.createElement('div');
|
|
249
|
-
this.element.appendChild(this.errorMessageSlotElement);
|
|
250
|
-
}
|
|
251
|
-
this.errorMessageSlotElement.innerHTML = message;
|
|
252
|
-
}
|
|
253
|
-
/**
|
|
254
|
-
* Render error message slot element
|
|
255
|
-
*/
|
|
256
|
-
renderErrorMessageSlot() {
|
|
257
|
-
var _a;
|
|
202
|
+
renderErrorMessage() {
|
|
258
203
|
this.errorMessageSlotElement = this.element.querySelector(`[slot=${this.slotError}]`);
|
|
259
|
-
if (this.
|
|
260
|
-
|
|
261
|
-
this.renderErrorStringMessage(this.errorMessage);
|
|
262
|
-
}
|
|
263
|
-
else {
|
|
264
|
-
this.renderErrorDetailsMessage(this.errorMessage);
|
|
265
|
-
}
|
|
204
|
+
if (this.errorMessageSlotElement === null) {
|
|
205
|
+
this.errorMessageSlotElement = document.createElement('div');
|
|
266
206
|
this.errorMessageSlotElement.setAttribute('slot', this.slotError);
|
|
267
|
-
this.
|
|
268
|
-
}
|
|
269
|
-
else {
|
|
270
|
-
(_a = this.errorMessageSlotElement) === null || _a === void 0 ? void 0 : _a.remove();
|
|
271
|
-
this.errorMessageSlotElement = undefined;
|
|
207
|
+
this.element.appendChild(this.errorMessageSlotElement);
|
|
272
208
|
}
|
|
209
|
+
this.errorMessageSlotElement.setAttribute('id', this.helpTextErrorId);
|
|
210
|
+
this.errorMessageSlotElement.innerHTML = this.errorMessage;
|
|
273
211
|
}
|
|
274
212
|
/**
|
|
275
213
|
* Render help text message
|
|
@@ -291,9 +229,6 @@ export class MgInput {
|
|
|
291
229
|
* Check if component props are well configured on init
|
|
292
230
|
*/
|
|
293
231
|
componentWillLoad() {
|
|
294
|
-
// Get locales
|
|
295
|
-
this.messages = initLocales(this.element).messages;
|
|
296
|
-
// Validate
|
|
297
232
|
this.watchIdentifier(this.identifier);
|
|
298
233
|
this.watchLabel();
|
|
299
234
|
this.watchClass();
|
|
@@ -318,7 +253,7 @@ export class MgInput {
|
|
|
318
253
|
*/
|
|
319
254
|
render() {
|
|
320
255
|
const isGroup = this.isFieldset && !this.isReadonly;
|
|
321
|
-
return (h(Host, { key: '
|
|
256
|
+
return (h(Host, { key: '7c4c22aaa8f8d250eafa9159a103a11e637b0cca', class: this.element.classList.toString(), role: isGroup ? 'group' : undefined, "aria-labelledby": isGroup ? `${this.identifier}-title` : undefined }, h("div", { key: '2215e7b2d96e08507579a39d8e05b3e8a3d901fb', class: { 'mg-c-input__title': true, 'mg-u-visually-hidden': this.labelHide } }, h("slot", { key: 'a4dbf4e36dd3ae5437d6dcb05d807f4faa0924b7', name: this.slotLabel }), this.tooltip && (this.tooltipPosition === 'label' || this.labelOnTop) && !this.labelHide && this.renderTooltip()), h("div", { key: '8e382a4857f469a9d6f77cad613183798df4d1e1', class: "mg-c-input__input-container" }, h("div", { key: 'f9897f90d44aab19614d4d40d77a8eb270c92847', class: "mg-c-input__input" }, h("slot", { key: 'c8d809d4ff0d0e660849825f016f9267da3a2d7e' }), this.tooltip && !this.labelOnTop && (this.tooltipPosition === 'input' || this.labelHide) && this.renderTooltip()), this.helptextMessageSlotElement && (h("div", { key: 'cebd6c083d088aebcdae6f032c6cdcf2387c3e27', class: "mg-c-input__help-text" }, h("slot", { key: '923fcc78b309d197e32522052b297ef0f58b1495', name: this.slotHelpText }))), !this.isDisabled && this.errorMessage && (h("div", { key: 'e706bff54ce21191a8c0940c60f6e99a91cfb9ec', class: "mg-c-input__error", "aria-live": "assertive" }, h("slot", { key: '6524debd3640df7b5e73ef4aa4415569eef1ecd8', name: this.slotError }))))));
|
|
322
257
|
}
|
|
323
258
|
static get is() { return "mg-input"; }
|
|
324
259
|
static get encapsulation() { return "shadow"; }
|
|
@@ -482,15 +417,9 @@ export class MgInput {
|
|
|
482
417
|
"attribute": "error-message",
|
|
483
418
|
"mutable": false,
|
|
484
419
|
"complexType": {
|
|
485
|
-
"original": "string
|
|
486
|
-
"resolved": "string
|
|
487
|
-
"references": {
|
|
488
|
-
"ErrorMessageDetailsType": {
|
|
489
|
-
"location": "import",
|
|
490
|
-
"path": "./mg-input.conf",
|
|
491
|
-
"id": "src/components/molecules/inputs/mg-input/mg-input.conf.ts::ErrorMessageDetailsType"
|
|
492
|
-
}
|
|
493
|
-
}
|
|
420
|
+
"original": "string",
|
|
421
|
+
"resolved": "string",
|
|
422
|
+
"references": {}
|
|
494
423
|
},
|
|
495
424
|
"required": false,
|
|
496
425
|
"optional": true,
|
package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js
CHANGED
|
@@ -4,8 +4,7 @@ import { h } from "@stencil/core";
|
|
|
4
4
|
* @param props - MgInputCheckboxList Interface Props
|
|
5
5
|
* @returns input template
|
|
6
6
|
*/
|
|
7
|
-
export const MgInputCheckboxList = (props) =>
|
|
8
|
-
props.checkboxes.length > 0 && (h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-labelledby": props.labelledby, id: props.id }, props.checkboxes.map(input => {
|
|
7
|
+
export const MgInputCheckboxList = (props) => (h("ul", { class: "mg-c-input__input-group-container", role: "list", "aria-labelledby": props.labelledby, id: props.id }, props.checkboxes.map(input => {
|
|
9
8
|
var _a, _b;
|
|
10
9
|
return (h("li", { key: input._id, class: { 'mg-c-input__input-group': true, 'mg-c-input__input-group--disabled': props.disabled || input.disabled } }, h("input", { type: "checkbox", id: input._id, name: props.name, value: (_a = input.value) === null || _a === void 0 ? void 0 : _a.toString(), checked: Boolean(input.value), required: input.required, "aria-invalid": ((_b = props.invalid) === null || _b === void 0 ? void 0 : _b.toString()) || 'false', disabled: props.disabled || input.disabled, indeterminate: input.value === null, onInput: input._handleInput, onBlur: input._handleBlur, onKeyDown: input._handleKeydown }), h("label", { htmlFor: input._id }, input.title)));
|
|
11
10
|
})));
|
|
@@ -4,7 +4,6 @@ import { checkboxTypes, SectionKind } from "./mg-input-checkbox.conf";
|
|
|
4
4
|
import { MgInputCheckboxList } from "./MgInputCheckboxList";
|
|
5
5
|
import { classDisabled, classReadonly, classFieldset, classVerticalList } from "../mg-input/mg-input.conf";
|
|
6
6
|
import { initLocales } from "../../../../locales";
|
|
7
|
-
import { defineErrorMessage } from "../mg-input/mg-input.utils";
|
|
8
7
|
import { Status } from "../../mg-tabs/mg-tabs.conf";
|
|
9
8
|
/**
|
|
10
9
|
* type CheckboxItem validation function
|
|
@@ -198,18 +197,8 @@ export class MgInputCheckbox {
|
|
|
198
197
|
* Check if input is valid
|
|
199
198
|
*/
|
|
200
199
|
this.checkValidity = () => {
|
|
201
|
-
this.setValidity(this.readonly || this.disabled || (
|
|
200
|
+
this.setValidity(this.readonly || this.disabled || (!this.hasInvalidInput() && this.validateRequired()));
|
|
202
201
|
};
|
|
203
|
-
/**
|
|
204
|
-
* Test if component has items
|
|
205
|
-
* @returns truthy if component has items
|
|
206
|
-
*/
|
|
207
|
-
this.hasInputValue = () => { var _a; return ((_a = this.value) === null || _a === void 0 ? void 0 : _a.length) > 0; };
|
|
208
|
-
/**
|
|
209
|
-
* Test if component has no value error message displayed
|
|
210
|
-
* @returns truthy if compent display no value error message
|
|
211
|
-
*/
|
|
212
|
-
this.hasNoValueErrorMessageDisplay = () => this.errorMessage === this.messages.errors.noValue;
|
|
213
202
|
/**
|
|
214
203
|
* Set button text locale key
|
|
215
204
|
*/
|
|
@@ -251,25 +240,12 @@ export class MgInputCheckbox {
|
|
|
251
240
|
// Set error message
|
|
252
241
|
this.errorMessage = undefined;
|
|
253
242
|
if (displayError && !this.valid) {
|
|
254
|
-
if (errorMessage !== undefined)
|
|
243
|
+
if (errorMessage !== undefined)
|
|
255
244
|
this.errorMessage = errorMessage;
|
|
256
|
-
|
|
257
|
-
else if (!this.hasInputValue()) {
|
|
258
|
-
this.errorMessage = this.messages.errors.noValue;
|
|
259
|
-
}
|
|
260
|
-
else if (!this.validateRequired()) {
|
|
245
|
+
else if (!this.validateRequired())
|
|
261
246
|
this.errorMessage = this.messages.errors.required;
|
|
262
|
-
}
|
|
263
247
|
}
|
|
264
248
|
};
|
|
265
|
-
/**
|
|
266
|
-
* Reset error message
|
|
267
|
-
*/
|
|
268
|
-
this.resetErrorMessage = () => {
|
|
269
|
-
this.checkValidity();
|
|
270
|
-
this.errorMessage = undefined;
|
|
271
|
-
this.hasDisplayedError = false;
|
|
272
|
-
};
|
|
273
249
|
/**
|
|
274
250
|
* Method to get mg-popover identifier
|
|
275
251
|
* @returns MgPopover identifier
|
|
@@ -298,14 +274,7 @@ export class MgInputCheckbox {
|
|
|
298
274
|
* @returns The rendered readonly value.
|
|
299
275
|
*/
|
|
300
276
|
this.renderReadonly = (readonlyValue) => {
|
|
301
|
-
|
|
302
|
-
if (this.inputVerticalList) {
|
|
303
|
-
return (h("ul", { class: "mg-c-input__readonly-value" }, readonlyValue.map(value => (h("li", { key: value }, h("b", null, value))))));
|
|
304
|
-
}
|
|
305
|
-
else {
|
|
306
|
-
return h("b", { class: "mg-c-input__readonly-value" }, readonlyValue.join(', '));
|
|
307
|
-
}
|
|
308
|
-
}
|
|
277
|
+
return this.inputVerticalList ? (h("ul", { class: "mg-c-input__readonly-value" }, readonlyValue.map(value => (h("li", { key: value }, h("b", null, value)))))) : (h("b", { class: "mg-c-input__readonly-value" }, readonlyValue.join(', ')));
|
|
309
278
|
};
|
|
310
279
|
/**
|
|
311
280
|
* Renders the MgInputCheckboxList component.
|
|
@@ -314,16 +283,9 @@ export class MgInputCheckbox {
|
|
|
314
283
|
this.renderMgInputCheckboxList = () => (h(MgInputCheckboxList, { checkboxes: this.checkboxItems, id: this.checkboxesId, disabled: this.disabled, name: this.name, invalid: this.invalid }));
|
|
315
284
|
}
|
|
316
285
|
validateValue(newValue) {
|
|
317
|
-
if (
|
|
318
|
-
this.displayError();
|
|
319
|
-
}
|
|
320
|
-
else if (newValue.length > 0 && isCheckboxItems(newValue)) {
|
|
286
|
+
if (isCheckboxItems(newValue)) {
|
|
321
287
|
this.checkboxItems = newValue.map((item, index) => (Object.assign(Object.assign({}, item), { _id: `${this.identifier}_${index}`, _handleInput: this.handleInput.bind(this), _handleBlur: this.handleBlur.bind(this), _handleKeydown: this.handleKeydown.bind(this) })));
|
|
322
288
|
this.valueChange.emit(newValue);
|
|
323
|
-
// force to reset error when noValueError is displaied
|
|
324
|
-
if (this.invalid && this.hasNoValueErrorMessageDisplay()) {
|
|
325
|
-
this.resetErrorMessage();
|
|
326
|
-
}
|
|
327
289
|
}
|
|
328
290
|
else {
|
|
329
291
|
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${toString(newValue)}.`);
|
|
@@ -467,7 +429,9 @@ export class MgInputCheckbox {
|
|
|
467
429
|
// - Keep everything in sync both inside and outside the component
|
|
468
430
|
return new Promise(resolve => {
|
|
469
431
|
requestAnimationFrame(() => {
|
|
470
|
-
this.
|
|
432
|
+
this.checkValidity();
|
|
433
|
+
this.errorMessage = undefined;
|
|
434
|
+
this.hasDisplayedError = false;
|
|
471
435
|
resolve();
|
|
472
436
|
});
|
|
473
437
|
});
|
|
@@ -590,9 +554,8 @@ export class MgInputCheckbox {
|
|
|
590
554
|
* @returns HTML Element
|
|
591
555
|
*/
|
|
592
556
|
render() {
|
|
593
|
-
var _a;
|
|
594
557
|
let inputContent;
|
|
595
|
-
const readonlyValue =
|
|
558
|
+
const readonlyValue = this.value.filter(({ value }) => value).map(({ title }) => title);
|
|
596
559
|
if (this.readonly) {
|
|
597
560
|
inputContent = this.renderReadonly(readonlyValue);
|
|
598
561
|
}
|
|
@@ -602,7 +565,7 @@ export class MgInputCheckbox {
|
|
|
602
565
|
else {
|
|
603
566
|
inputContent = this.renderCheckboxMulti();
|
|
604
567
|
}
|
|
605
|
-
return (h("mg-input", { key: '
|
|
568
|
+
return (h("mg-input", { key: '84d13ac702497773013daa72357e4d1dcf4ebb30', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: !this.readonly ? this.required : undefined, tooltip: this.tooltip, tooltipPosition: this.readonly && readonlyValue.length === 0 ? 'label' : this.tooltipPosition, helpText: !this.readonly ? this.helpText : undefined, errorMessage: !this.readonly ? this.errorMessage : undefined }, inputContent));
|
|
606
569
|
}
|
|
607
570
|
static get is() { return "mg-input-checkbox"; }
|
|
608
571
|
static get encapsulation() { return "shadow"; }
|
|
@@ -977,7 +940,7 @@ export class MgInputCheckbox {
|
|
|
977
940
|
"references": {}
|
|
978
941
|
},
|
|
979
942
|
"required": false,
|
|
980
|
-
"optional":
|
|
943
|
+
"optional": false,
|
|
981
944
|
"docs": {
|
|
982
945
|
"tags": [],
|
|
983
946
|
"text": "Overwrite default \"edit\" button message"
|
|
@@ -996,7 +959,7 @@ export class MgInputCheckbox {
|
|
|
996
959
|
"references": {}
|
|
997
960
|
},
|
|
998
961
|
"required": false,
|
|
999
|
-
"optional":
|
|
962
|
+
"optional": false,
|
|
1000
963
|
"docs": {
|
|
1001
964
|
"tags": [],
|
|
1002
965
|
"text": "Overwrite default \"show\" button message"
|
|
@@ -1015,7 +978,7 @@ export class MgInputCheckbox {
|
|
|
1015
978
|
"references": {}
|
|
1016
979
|
},
|
|
1017
980
|
"required": false,
|
|
1018
|
-
"optional":
|
|
981
|
+
"optional": false,
|
|
1019
982
|
"docs": {
|
|
1020
983
|
"tags": [],
|
|
1021
984
|
"text": "Overwrite default \"select\" button message"
|
|
@@ -1023,25 +986,6 @@ export class MgInputCheckbox {
|
|
|
1023
986
|
"getter": false,
|
|
1024
987
|
"setter": false,
|
|
1025
988
|
"reflect": false
|
|
1026
|
-
},
|
|
1027
|
-
"noValueErrorDetail": {
|
|
1028
|
-
"type": "string",
|
|
1029
|
-
"attribute": "no-value-error-detail",
|
|
1030
|
-
"mutable": false,
|
|
1031
|
-
"complexType": {
|
|
1032
|
-
"original": "string",
|
|
1033
|
-
"resolved": "string",
|
|
1034
|
-
"references": {}
|
|
1035
|
-
},
|
|
1036
|
-
"required": false,
|
|
1037
|
-
"optional": true,
|
|
1038
|
-
"docs": {
|
|
1039
|
-
"tags": [],
|
|
1040
|
-
"text": "Define no value error detail"
|
|
1041
|
-
},
|
|
1042
|
-
"getter": false,
|
|
1043
|
-
"setter": false,
|
|
1044
|
-
"reflect": false
|
|
1045
989
|
}
|
|
1046
990
|
};
|
|
1047
991
|
}
|