@mgdis/mg-components 6.24.0 → 6.25.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-Acmyl4hv.js +5 -0
- package/dist/cjs/{index-BxB20_Vw.js → index-B6J2EllP.js} +3 -1
- package/dist/cjs/{index-BEF-cqV9.js → index-BmFwLEZT.js} +5 -1
- package/dist/cjs/{index-CpENFzEo.js → index-DrZECzp6.js} +14 -6
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/mg-action-more_36.cjs.entry.js +385 -259
- package/dist/cjs/mg-alert.cjs.entry.js +7 -8
- package/dist/cjs/mg-breadcrumb.cjs.entry.js +27 -10
- package/dist/cjs/mg-components.cjs.js +2 -2
- package/dist/cjs/mg-fieldset.cjs.entry.js +8 -8
- package/dist/cjs/mg-illustration.cjs.entry.js +57 -0
- package/dist/cjs/mg-input-combobox.cjs.entry.js +40 -23
- package/dist/cjs/mg-input-file.cjs.entry.js +12 -11
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +2565 -4011
- package/dist/cjs/mg-loader.cjs.entry.js +5 -5
- package/dist/cjs/mg-progress.cjs.entry.js +3 -3
- package/dist/collection/assets/illustrations/index.js +1 -0
- package/dist/collection/collection-manifest.json +1 -0
- package/dist/collection/components/atoms/internals/mg-character-left/mg-character-left.js +1 -1
- package/dist/collection/components/atoms/internals/mg-input-title/mg-input-title.js +1 -1
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +4 -1
- package/dist/collection/components/atoms/mg-card/mg-card.js +1 -1
- package/dist/collection/components/atoms/mg-divider/mg-divider.conf.js +4 -0
- package/dist/collection/components/atoms/mg-divider/mg-divider.js +62 -3
- package/dist/collection/components/atoms/mg-icon/mg-icon.js +1 -1
- package/dist/collection/components/atoms/mg-illustration/mg-illustration.conf.js +1 -0
- package/dist/collection/components/atoms/mg-illustration/mg-illustration.js +95 -0
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip-content/mg-tooltip-content.js +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +9 -7
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +49 -19
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxList.js +5 -2
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/MgInputCheckboxPaginated.js +5 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +30 -22
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +69 -25
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +14 -8
- package/dist/collection/components/molecules/inputs/mg-input-file/mg-input-file.js +8 -7
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +21 -12
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +7 -7
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +15 -10
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js +29 -3
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +260 -7
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +21 -19
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +18 -13
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +7 -7
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +10 -9
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +1 -1
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js +7 -5
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js +18 -17
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +7 -4
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +6 -7
- package/dist/collection/components/molecules/mg-breadcrumb/mg-breadcrumb.js +49 -6
- package/dist/collection/components/molecules/mg-details/mg-details.js +1 -1
- package/dist/collection/components/molecules/mg-fieldset/mg-fieldset.js +6 -6
- package/dist/collection/components/molecules/mg-form/mg-form.js +16 -13
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +2 -2
- 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-pagination/mg-pagination.js +8 -4
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +13 -4
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +2 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +21 -37
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +5 -3
- package/dist/collection/components/molecules/mg-table/mg-table.js +10 -6
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +12 -9
- package/dist/collection/utils/behaviors.utils.js +3 -3
- package/dist/collection/utils/playwright.fixture.js +7 -2
- package/dist/components/mg-action-more.js +1 -1
- package/dist/components/mg-alert.js +1 -1
- package/dist/components/mg-badge2.js +1 -1
- package/dist/components/mg-breadcrumb.js +1 -1
- package/dist/components/mg-button2.js +1 -1
- package/dist/components/mg-card2.js +1 -1
- package/dist/components/mg-character-left2.js +1 -1
- package/dist/components/mg-details.js +1 -1
- package/dist/components/mg-divider2.js +1 -1
- package/dist/components/mg-fieldset.js +1 -1
- package/dist/components/mg-form.js +1 -1
- package/dist/components/mg-icon2.js +1 -1
- package/dist/components/mg-illustrated-message.js +1 -1
- package/dist/components/mg-illustration.d.ts +11 -0
- package/dist/components/mg-illustration.js +1 -0
- package/dist/components/mg-input-checkbox.js +1 -1
- package/dist/components/mg-input-combobox.js +1 -1
- package/dist/components/mg-input-date.js +1 -1
- package/dist/components/mg-input-file.js +1 -1
- package/dist/components/mg-input-numeric.js +1 -1
- package/dist/components/mg-input-password.js +1 -1
- package/dist/components/mg-input-radio.js +1 -1
- package/dist/components/mg-input-rich-text-editor.js +294 -284
- package/dist/components/mg-input-select2.js +1 -1
- package/dist/components/mg-input-text2.js +1 -1
- package/dist/components/mg-input-textarea.js +1 -1
- package/dist/components/mg-input-title2.js +1 -1
- package/dist/components/mg-input-toggle.js +1 -1
- package/dist/components/mg-input2.js +1 -1
- package/dist/components/mg-item-more2.js +1 -1
- package/dist/components/mg-loader2.js +1 -1
- package/dist/components/mg-menu-item2.js +1 -1
- package/dist/components/mg-message2.js +1 -1
- package/dist/components/mg-modal.js +1 -1
- package/dist/components/mg-pagination.js +1 -1
- package/dist/components/mg-panel.js +1 -1
- 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-table.js +1 -1
- package/dist/components/mg-tabs2.js +1 -1
- package/dist/components/mg-tag.js +1 -1
- package/dist/components/mg-tooltip-content2.js +1 -1
- package/dist/components/mg-tooltip2.js +1 -1
- package/dist/custom-elements.json +178 -48
- package/dist/esm/{index-C7xjtdiw.js → index-91BOpzAB.js} +14 -6
- package/dist/esm/{index-DSEloqPn.js → index-BfblyCaJ.js} +3 -1
- package/dist/esm/index-Ci9Hv7DG.js +3 -0
- package/dist/esm/{index-DshvCiTL.js → index-D4bO_UCn.js} +5 -1
- package/dist/esm/loader.js +3 -3
- package/dist/esm/mg-action-more_36.entry.js +382 -256
- package/dist/esm/mg-alert.entry.js +7 -8
- package/dist/esm/mg-breadcrumb.entry.js +27 -10
- package/dist/esm/mg-components.js +3 -3
- package/dist/esm/mg-fieldset.entry.js +8 -8
- package/dist/esm/mg-illustration.entry.js +55 -0
- package/dist/esm/mg-input-combobox.entry.js +40 -23
- package/dist/esm/mg-input-file.entry.js +12 -11
- package/dist/esm/mg-input-rich-text-editor.entry.js +2550 -3996
- package/dist/esm/mg-loader.entry.js +5 -5
- package/dist/esm/mg-progress.entry.js +3 -3
- package/dist/mg-components/mg-components.css +1 -1
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/{p-cdb01923.entry.js → p-3ad7441c.entry.js} +1 -1
- package/dist/mg-components/p-413b4536.entry.js +1 -0
- package/dist/mg-components/p-4693077a.entry.js +1 -0
- package/dist/mg-components/p-5dff879a.entry.js +1 -0
- package/dist/mg-components/{p-08d3d957.entry.js → p-96fc508e.entry.js} +1 -1
- package/dist/mg-components/p-Ci9Hv7DG.js +1 -0
- package/dist/mg-components/p-D4bO_UCn.js +2 -0
- package/dist/mg-components/{p-d0b6d8f5.entry.js → p-ad533d08.entry.js} +1 -1
- package/dist/mg-components/p-b20f3698.entry.js +1 -0
- package/dist/mg-components/p-d0d12800.entry.js +1 -0
- package/dist/mg-components/p-ec4bd337.entry.js +1667 -0
- package/dist/mg-components/p-f8e58181.entry.js +1 -0
- package/dist/types/assets/illustrations/index.d.ts +21 -0
- package/dist/types/components/atoms/mg-divider/mg-divider.conf.d.ts +9 -0
- package/dist/types/components/atoms/mg-divider/mg-divider.d.ts +13 -0
- package/dist/types/components/atoms/mg-illustration/mg-illustration.conf.d.ts +5 -0
- package/dist/types/components/atoms/mg-illustration/mg-illustration.d.ts +24 -0
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +18 -0
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +10 -5
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-radio/mg-input-radio.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.conf.d.ts +4 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.conf.d.ts +25 -0
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +61 -2
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +2 -2
- package/dist/types/components/molecules/menus/mg-menu-item/mg-menu-item.d.ts +2 -2
- package/dist/types/components/molecules/mg-alert/mg-alert.d.ts +2 -2
- package/dist/types/components/molecules/mg-breadcrumb/mg-breadcrumb.d.ts +11 -0
- package/dist/types/components/molecules/mg-popover/mg-popover-content/mg-popover-content.d.ts +1 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +3 -3
- package/dist/types/components/molecules/mg-skip-links/mg-skip-links.d.ts +1 -1
- package/dist/types/components/molecules/mg-tabs/mg-tabs.d.ts +1 -1
- package/dist/types/components.d.ts +145 -40
- package/ide/intellij/web-types.json +134 -64
- package/ide/vscode/css-custom-data.json +6 -2
- package/ide/vscode/html-custom-data.json +190 -32
- package/package.json +21 -21
- package/dist/mg-components/p-13feb37a.entry.js +0 -1
- package/dist/mg-components/p-7c63e469.entry.js +0 -1
- package/dist/mg-components/p-7fd3e519.entry.js +0 -1
- package/dist/mg-components/p-9953b835.entry.js +0 -1
- package/dist/mg-components/p-9c0a9fc7.entry.js +0 -1657
- package/dist/mg-components/p-DshvCiTL.js +0 -2
- package/dist/mg-components/p-a338088e.entry.js +0 -1
- /package/dist/mg-components/{p-C7xjtdiw.js → p-91BOpzAB.js} +0 -0
- /package/dist/mg-components/{p-DSEloqPn.js → p-BfblyCaJ.js} +0 -0
|
@@ -3,7 +3,7 @@ import { ClassList, isValidString, toString } from "@mgdis/core-ui-helpers/dist/
|
|
|
3
3
|
import { normalizeBooleanAttributes } from "@mgdis/core-ui-helpers/dist/stencil";
|
|
4
4
|
import { localeCurrency, localeNumber, localePercent, localeUnit } from "@mgdis/core-ui-helpers/dist/locale";
|
|
5
5
|
import { types, formats } from "./mg-input-numeric.conf";
|
|
6
|
-
import { classReadonly, classDisabled, widths } from "../mg-input/mg-input.conf";
|
|
6
|
+
import { classReadonly, classDisabled, widths, } from "../mg-input/mg-input.conf";
|
|
7
7
|
import { initLocales } from "../../../../locales/";
|
|
8
8
|
/**
|
|
9
9
|
* @slot append-input - Content to display next to the input
|
|
@@ -137,7 +137,9 @@ export class MgInputNumeric {
|
|
|
137
137
|
else {
|
|
138
138
|
const formattedMin = this.formatErrorValue(this.min);
|
|
139
139
|
const formattedMax = this.formatErrorValue(this.max);
|
|
140
|
-
this.errorMessage = this.messages.input.numeric.error[inputError]
|
|
140
|
+
this.errorMessage = this.messages.input.numeric.error[inputError]
|
|
141
|
+
.replace('{min}', formattedMin)
|
|
142
|
+
.replace('{max}', formattedMax);
|
|
141
143
|
}
|
|
142
144
|
}
|
|
143
145
|
};
|
|
@@ -146,7 +148,7 @@ export class MgInputNumeric {
|
|
|
146
148
|
* @returns error code
|
|
147
149
|
*/
|
|
148
150
|
this.getInputError = () => {
|
|
149
|
-
const hasNotEmptyValues = (toControl) => !toControl.some(value => [null, undefined].includes(value));
|
|
151
|
+
const hasNotEmptyValues = (toControl) => !toControl.some((value) => [null, undefined].includes(value));
|
|
150
152
|
// required
|
|
151
153
|
if (!this.input.checkValidity() && this.input.validity.valueMissing) {
|
|
152
154
|
return 'required';
|
|
@@ -160,7 +162,8 @@ export class MgInputNumeric {
|
|
|
160
162
|
return 'max';
|
|
161
163
|
}
|
|
162
164
|
// both min and max values are set
|
|
163
|
-
if (hasNotEmptyValues([this.min, this.max, this.numericValue]) &&
|
|
165
|
+
if (hasNotEmptyValues([this.min, this.max, this.numericValue]) &&
|
|
166
|
+
(this.numericValue < this.min || this.numericValue > this.max)) {
|
|
164
167
|
return 'minMax';
|
|
165
168
|
}
|
|
166
169
|
return null;
|
|
@@ -275,7 +278,7 @@ export class MgInputNumeric {
|
|
|
275
278
|
}
|
|
276
279
|
watchMgWidth(newValue) {
|
|
277
280
|
// reset width class
|
|
278
|
-
widths.forEach(width => {
|
|
281
|
+
widths.forEach((width) => {
|
|
279
282
|
this.classCollection.delete(`mg-c-input--width-${width}`);
|
|
280
283
|
});
|
|
281
284
|
// apply new width
|
|
@@ -319,7 +322,7 @@ export class MgInputNumeric {
|
|
|
319
322
|
// - Async operations are completed
|
|
320
323
|
// - No timing issues with Stencil's render cycle
|
|
321
324
|
// - Keep everything in sync both inside and outside the component
|
|
322
|
-
return new Promise(resolve => {
|
|
325
|
+
return new Promise((resolve) => {
|
|
323
326
|
requestAnimationFrame(() => {
|
|
324
327
|
this.checkValidity();
|
|
325
328
|
this.setErrorMessage();
|
|
@@ -366,7 +369,7 @@ export class MgInputNumeric {
|
|
|
366
369
|
// - Async operations are completed
|
|
367
370
|
// - No timing issues with Stencil's render cycle
|
|
368
371
|
// - Keep everything in sync both inside and outside the component
|
|
369
|
-
return new Promise(resolve => {
|
|
372
|
+
return new Promise((resolve) => {
|
|
370
373
|
requestAnimationFrame(() => {
|
|
371
374
|
// unlock validity check by reseting customErrorMessage
|
|
372
375
|
this.customErrorMessage = { lock: false };
|
|
@@ -401,7 +404,10 @@ export class MgInputNumeric {
|
|
|
401
404
|
* @returns Returns true if the value is valid, otherwise false.
|
|
402
405
|
*/
|
|
403
406
|
isValidValue(value, regex, integer, decimal) {
|
|
404
|
-
return (['', '-'].includes(value) ||
|
|
407
|
+
return (['', '-'].includes(value) ||
|
|
408
|
+
(regex.exec(value) !== null &&
|
|
409
|
+
integer.length <= this.integerLength &&
|
|
410
|
+
decimal.length <= (this.type === 'integer' ? 0 : this.decimalLength)));
|
|
405
411
|
}
|
|
406
412
|
/**
|
|
407
413
|
* Updates the component values based on the validated input value.
|
|
@@ -412,7 +418,10 @@ export class MgInputNumeric {
|
|
|
412
418
|
if (this.input !== undefined) {
|
|
413
419
|
this.input.value = this.value;
|
|
414
420
|
}
|
|
415
|
-
this.numericValue =
|
|
421
|
+
this.numericValue =
|
|
422
|
+
!['', null].includes(this.value) && !isNaN(parseFloat(this.value))
|
|
423
|
+
? parseFloat(this.value.replace(',', '.'))
|
|
424
|
+
: null;
|
|
416
425
|
if (newValue === null || (newValue === this.storedValue && !Object.is(this.numericValue, -0))) {
|
|
417
426
|
this.valueChange.emit(this.numericValue);
|
|
418
427
|
}
|
|
@@ -462,7 +471,7 @@ export class MgInputNumeric {
|
|
|
462
471
|
* @returns HTML Element
|
|
463
472
|
*/
|
|
464
473
|
render() {
|
|
465
|
-
return (h("mg-input", { key: '
|
|
474
|
+
return (h("mg-input", { key: 'dbf435211890922742cbead9ab3a738b5219df44', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.formatHelpText(this.helpText), errorMessage: this.errorMessage }, this.readonly
|
|
466
475
|
? this.readonlyValue && this.renderReadonly()
|
|
467
476
|
: [
|
|
468
477
|
h("input", { key: "input", type: "text", class: "mg-c-input__box mg-c-input__box--width", value: this.displayValue(), id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, autocomplete: "off", "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onFocus: this.handleFocus, onBlur: this.handleBlur, ref: (el) => {
|
|
@@ -1030,7 +1039,7 @@ export class MgInputNumeric {
|
|
|
1030
1039
|
"composed": true,
|
|
1031
1040
|
"docs": {
|
|
1032
1041
|
"tags": [],
|
|
1033
|
-
"text": "
|
|
1042
|
+
"text": "Emitted event when value change"
|
|
1034
1043
|
},
|
|
1035
1044
|
"complexType": {
|
|
1036
1045
|
"original": "number",
|
|
@@ -1045,7 +1054,7 @@ export class MgInputNumeric {
|
|
|
1045
1054
|
"composed": true,
|
|
1046
1055
|
"docs": {
|
|
1047
1056
|
"tags": [],
|
|
1048
|
-
"text": "
|
|
1057
|
+
"text": "Emitted event when checking validity"
|
|
1049
1058
|
},
|
|
1050
1059
|
"complexType": {
|
|
1051
1060
|
"original": "HTMLMgInputNumericElement['valid']",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { ClassList, isValidString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
3
|
import { normalizeBooleanAttributes } from "@mgdis/core-ui-helpers/dist/stencil";
|
|
4
|
-
import { classReadonly, classDisabled, widths } from "../mg-input/mg-input.conf";
|
|
4
|
+
import { classReadonly, classDisabled, widths, } from "../mg-input/mg-input.conf";
|
|
5
5
|
import { initLocales } from "../../../../locales";
|
|
6
6
|
export class MgInputPassword {
|
|
7
7
|
constructor() {
|
|
@@ -127,7 +127,7 @@ export class MgInputPassword {
|
|
|
127
127
|
}
|
|
128
128
|
watchMgWidth(newValue) {
|
|
129
129
|
// reset width class
|
|
130
|
-
widths.forEach(width => {
|
|
130
|
+
widths.forEach((width) => {
|
|
131
131
|
this.classCollection.delete(`mg-c-input--width-${width}`);
|
|
132
132
|
});
|
|
133
133
|
// apply new width
|
|
@@ -151,7 +151,7 @@ export class MgInputPassword {
|
|
|
151
151
|
// - Async operations are completed
|
|
152
152
|
// - No timing issues with Stencil's render cycle
|
|
153
153
|
// - Keep everything in sync both inside and outside the component
|
|
154
|
-
return new Promise(resolve => {
|
|
154
|
+
return new Promise((resolve) => {
|
|
155
155
|
requestAnimationFrame(() => {
|
|
156
156
|
this.checkValidity();
|
|
157
157
|
this.setErrorMessage();
|
|
@@ -198,7 +198,7 @@ export class MgInputPassword {
|
|
|
198
198
|
// - Async operations are completed
|
|
199
199
|
// - No timing issues with Stencil's render cycle
|
|
200
200
|
// - Keep everything in sync both inside and outside the component
|
|
201
|
-
return new Promise(resolve => {
|
|
201
|
+
return new Promise((resolve) => {
|
|
202
202
|
requestAnimationFrame(() => {
|
|
203
203
|
// unlock validity check by reseting customErrorMessage
|
|
204
204
|
this.customErrorMessage = { lock: false };
|
|
@@ -250,7 +250,7 @@ export class MgInputPassword {
|
|
|
250
250
|
* @returns HTML Element
|
|
251
251
|
*/
|
|
252
252
|
render() {
|
|
253
|
-
return (h("mg-input", { key: '
|
|
253
|
+
return (h("mg-input", { key: '0a59c7177c65ccb255164e4ef45945b1ade5ad70', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && this.value === undefined ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.value !== undefined && h("b", { class: "mg-c-input__readonly-value" }, '•'.repeat(this.value.length))) : (h("span", { class: "mg-c-input__input-group" }, h("input", { type: this.displayPassword ? 'text' : 'password', class: "mg-c-input__box mg-c-input__box--width", value: this.value, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, maxlength: this.maxlength, "aria-invalid": (this.invalid === true).toString(), onInput: this.handleInput, onBlur: this.handleBlur, ref: (el) => {
|
|
254
254
|
if (el !== null)
|
|
255
255
|
this.input = el;
|
|
256
256
|
} }), h("mg-button", { label: this.messages.input.password[this.displayPassword ? 'hide' : 'display'], disabled: this.disabled, variant: "flat", class: "mg-c-input__append-button", "is-icon": true, onClick: this.toggleDisplayPassword, "aria-controls": this.identifier }, h("mg-icon", { class: "mg-c-input__input-icon", icon: (this.displayPassword ? 'eye-slash' : 'eye') }))))));
|
|
@@ -632,7 +632,7 @@ export class MgInputPassword {
|
|
|
632
632
|
"composed": true,
|
|
633
633
|
"docs": {
|
|
634
634
|
"tags": [],
|
|
635
|
-
"text": "
|
|
635
|
+
"text": "Emitted event when value change"
|
|
636
636
|
},
|
|
637
637
|
"complexType": {
|
|
638
638
|
"original": "HTMLMgInputPasswordElement['value']",
|
|
@@ -652,7 +652,7 @@ export class MgInputPassword {
|
|
|
652
652
|
"composed": true,
|
|
653
653
|
"docs": {
|
|
654
654
|
"tags": [],
|
|
655
|
-
"text": "
|
|
655
|
+
"text": "Emitted event when checking validity"
|
|
656
656
|
},
|
|
657
657
|
"complexType": {
|
|
658
658
|
"original": "HTMLMgInputPasswordElement['valid']",
|
|
@@ -1,14 +1,16 @@
|
|
|
1
1
|
import { h } from "@stencil/core";
|
|
2
2
|
import { ClassList, allItemsAreString, isValidString, toString } from "@mgdis/core-ui-helpers/dist/utils";
|
|
3
3
|
import { normalizeBooleanAttributes } from "@mgdis/core-ui-helpers/dist/stencil";
|
|
4
|
-
import { classReadonly, classDisabled, classFieldset } from "../mg-input/mg-input.conf";
|
|
4
|
+
import { classReadonly, classDisabled, classFieldset, } from "../mg-input/mg-input.conf";
|
|
5
5
|
import { initLocales } from "../../../../locales";
|
|
6
6
|
/**
|
|
7
7
|
* type Option validation function
|
|
8
8
|
* @param option - radio option
|
|
9
9
|
* @returns radio option type is valid
|
|
10
10
|
*/
|
|
11
|
-
const isOption = (option) => typeof option === 'object' &&
|
|
11
|
+
const isOption = (option) => typeof option === 'object' &&
|
|
12
|
+
typeof option.title === 'string' &&
|
|
13
|
+
option.value !== undefined;
|
|
12
14
|
export class MgInputRadio {
|
|
13
15
|
constructor() {
|
|
14
16
|
/************
|
|
@@ -114,7 +116,7 @@ export class MgInputRadio {
|
|
|
114
116
|
this.readonlyValue = newValue;
|
|
115
117
|
}
|
|
116
118
|
else if (Array.isArray(this.items) && this.items.every(isOption)) {
|
|
117
|
-
this.readonlyValue = (_a = this.items.find(item => item.value === newValue)) === null || _a === void 0 ? void 0 : _a.title;
|
|
119
|
+
this.readonlyValue = (_a = this.items.find((item) => item.value === newValue)) === null || _a === void 0 ? void 0 : _a.title;
|
|
118
120
|
}
|
|
119
121
|
else {
|
|
120
122
|
this.readonlyValue = null;
|
|
@@ -128,10 +130,10 @@ export class MgInputRadio {
|
|
|
128
130
|
}
|
|
129
131
|
// String array
|
|
130
132
|
else if (allItemsAreString(newValue)) {
|
|
131
|
-
this.options = newValue.map(item => ({ title: item, value: item, disabled: this.disabled }));
|
|
133
|
+
this.options = newValue.map((item) => ({ title: item, value: item, disabled: this.disabled }));
|
|
132
134
|
}
|
|
133
135
|
// Object array
|
|
134
|
-
else if (newValue && newValue.every(item => isOption(item))) {
|
|
136
|
+
else if (newValue && newValue.every((item) => isOption(item))) {
|
|
135
137
|
this.options = newValue;
|
|
136
138
|
}
|
|
137
139
|
else {
|
|
@@ -151,7 +153,7 @@ export class MgInputRadio {
|
|
|
151
153
|
this.classCollection.delete(classReadonly);
|
|
152
154
|
}
|
|
153
155
|
handleValidityChange(newValue, _oldValue, prop) {
|
|
154
|
-
this.inputs.forEach(input => {
|
|
156
|
+
this.inputs.forEach((input) => {
|
|
155
157
|
input[prop] = newValue;
|
|
156
158
|
});
|
|
157
159
|
this.checkValidity();
|
|
@@ -184,7 +186,7 @@ export class MgInputRadio {
|
|
|
184
186
|
// - Async operations are completed
|
|
185
187
|
// - No timing issues with Stencil's render cycle
|
|
186
188
|
// - Keep everything in sync both inside and outside the component
|
|
187
|
-
return new Promise(resolve => {
|
|
189
|
+
return new Promise((resolve) => {
|
|
188
190
|
requestAnimationFrame(() => {
|
|
189
191
|
this.checkValidity();
|
|
190
192
|
this.setErrorMessage();
|
|
@@ -231,7 +233,7 @@ export class MgInputRadio {
|
|
|
231
233
|
// - Async operations are completed
|
|
232
234
|
// - No timing issues with Stencil's render cycle
|
|
233
235
|
// - Keep everything in sync both inside and outside the component
|
|
234
|
-
return new Promise(resolve => {
|
|
236
|
+
return new Promise((resolve) => {
|
|
235
237
|
requestAnimationFrame(() => {
|
|
236
238
|
// unlock validity check by reseting customErrorMessage
|
|
237
239
|
this.customErrorMessage = { lock: false };
|
|
@@ -286,7 +288,10 @@ export class MgInputRadio {
|
|
|
286
288
|
* @returns HTML Element
|
|
287
289
|
*/
|
|
288
290
|
render() {
|
|
289
|
-
return (h("mg-input", { key: '
|
|
291
|
+
return (h("mg-input", { key: '763e021cdda0735dcbd62700f09cbc32c0de7377', label: this.label, identifier: this.identifier, class: this.classCollection.join(), labelOnTop: this.labelOnTop, labelHide: this.labelHide, required: this.required, tooltip: this.tooltip, tooltipPosition: this.readonly && !this.value ? 'label' : this.tooltipPosition, helpText: this.helpText, errorMessage: this.errorMessage }, this.readonly ? (this.readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, this.readonlyValue)) : (h("div", { class: "mg-c-input__input-group-container" }, this.options.map((input, index) => (h("div", { key: input.title, class: {
|
|
292
|
+
'mg-c-input__input-group': true,
|
|
293
|
+
'mg-c-input__input-group--disabled': this.disabled || input.disabled,
|
|
294
|
+
} }, h("input", { type: "radio", id: this.identifier + '_' + index, name: this.identifier, value: index, checked: JSON.stringify(this.value) === JSON.stringify(this.options[index].value), disabled: this.disabled || input.disabled, required: this.required, onBlur: this.handleBlur, onInput: this.handleInput, ref: (el) => {
|
|
290
295
|
if (el !== null)
|
|
291
296
|
this.inputs[index] = el;
|
|
292
297
|
} }), h("label", { htmlFor: this.identifier + '_' + index }, input.title))))))));
|
|
@@ -668,7 +673,7 @@ export class MgInputRadio {
|
|
|
668
673
|
"composed": true,
|
|
669
674
|
"docs": {
|
|
670
675
|
"tags": [],
|
|
671
|
-
"text": "
|
|
676
|
+
"text": "Emitted event when checking validity"
|
|
672
677
|
},
|
|
673
678
|
"complexType": {
|
|
674
679
|
"original": "HTMLMgInputRadioElement['valid']",
|
package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/index.js
CHANGED
|
@@ -13,6 +13,8 @@ import "jodit/esm/plugins/delete/delete.js";
|
|
|
13
13
|
import "jodit/esm/plugins/file/file.js";
|
|
14
14
|
import "jodit/esm/plugins/print/print.js";
|
|
15
15
|
import "jodit/esm/plugins/source/source.js";
|
|
16
|
+
// Reuse the design system icon set (same source as mg-icon) to render custom action icons
|
|
17
|
+
import { icons } from "../../../../../assets/icons";
|
|
16
18
|
const DEFAULT_ROWS = 5;
|
|
17
19
|
/**
|
|
18
20
|
* Converts rows count to Jodit editor min-height CSS value.
|
|
@@ -53,7 +55,24 @@ export const rowsToEditorHeight = (rows) => {
|
|
|
53
55
|
* @returns Configured Jodit editor instance
|
|
54
56
|
*/
|
|
55
57
|
export const defineEditor = (element, editorElement, config) => {
|
|
56
|
-
const { value, modules, readOnly, disabled, placeholder, rows = DEFAULT_ROWS, handleTextChange, handleFocus, handleBlur } = config;
|
|
58
|
+
const { value, modules, customActions, readOnly, disabled, placeholder, rows = DEFAULT_ROWS, handleTextChange, handleFocus, handleBlur, handleCustomAction, handleSelectionChange, } = config;
|
|
59
|
+
// Translate consumer-declared custom actions into Jodit toolbar controls.
|
|
60
|
+
// This keeps the public API decoupled from Jodit: consumers never manipulate Jodit controls directly.
|
|
61
|
+
// `tooltip` is used by Jodit to set the button `aria-label`. The `icon` is an mg-icon name resolved
|
|
62
|
+
// to its SVG from the shared design system icon set, then rendered as-is by Jodit (it returns the
|
|
63
|
+
// string when it contains `<svg`). Using currentColor SVGs, the icon inherits the button color.
|
|
64
|
+
// `mods: { stroke: false }` adds the `jodit-toolbar-button_stroke_false` class so Jodit stops applying
|
|
65
|
+
// a stroke to the icon (its default `.jodit-icon` rule sets both fill and stroke, which distorts the
|
|
66
|
+
// design system icons that are meant to be filled only).
|
|
67
|
+
const customControls = (customActions !== null && customActions !== void 0 ? customActions : []).map((action) => ({
|
|
68
|
+
name: action.name,
|
|
69
|
+
tooltip: action.label,
|
|
70
|
+
icon: icons[action.icon],
|
|
71
|
+
mods: { stroke: false },
|
|
72
|
+
exec: () => {
|
|
73
|
+
handleCustomAction === null || handleCustomAction === void 0 ? void 0 : handleCustomAction(action.name);
|
|
74
|
+
},
|
|
75
|
+
}));
|
|
57
76
|
// Configure Jodit
|
|
58
77
|
// Note: Using Record<string, unknown> to avoid TypeScript complexity issues with Jodit's deeply nested Config type
|
|
59
78
|
// The actual configuration follows Jodit's Config interface from jodit/esm/types
|
|
@@ -68,6 +87,9 @@ export const defineEditor = (element, editorElement, config) => {
|
|
|
68
87
|
// When disabled, use -1 to exclude the editor from Tab navigation
|
|
69
88
|
tabIndex: disabled === true ? -1 : 0,
|
|
70
89
|
buttons: modules,
|
|
90
|
+
// Append custom action buttons after the built-in modules via Jodit's native `extraButtons`
|
|
91
|
+
// (it does `buttons.concat(extraButtons)`), preceded by a separator when there are any.
|
|
92
|
+
extraButtons: customControls.length > 0 ? ['|', ...customControls] : [],
|
|
71
93
|
// Disable features we don't want
|
|
72
94
|
showXPathInStatusbar: false,
|
|
73
95
|
showCharsCounter: false,
|
|
@@ -129,7 +151,7 @@ export const defineEditor = (element, editorElement, config) => {
|
|
|
129
151
|
// Find all buttons within the toolbar, excluding disabled ones
|
|
130
152
|
const buttons = Array.from(toolbarEl.querySelectorAll('button:not([disabled])'));
|
|
131
153
|
// Filter out buttons that are not visible or are in popups/dropdowns
|
|
132
|
-
return buttons.filter(button => {
|
|
154
|
+
return buttons.filter((button) => {
|
|
133
155
|
const isVisible = button.offsetParent !== null;
|
|
134
156
|
const isInToolbar = toolbarEl.contains(button);
|
|
135
157
|
// Exclude buttons in popups or dropdowns (they have their own navigation)
|
|
@@ -207,7 +229,7 @@ export const defineEditor = (element, editorElement, config) => {
|
|
|
207
229
|
* Without aria-hidden, VoiceOver announces them as images.
|
|
208
230
|
*/
|
|
209
231
|
const hideToolbarSvgsFromScreenReaders = () => {
|
|
210
|
-
toolbarElement.querySelectorAll('svg').forEach(svg => {
|
|
232
|
+
toolbarElement.querySelectorAll('svg').forEach((svg) => {
|
|
211
233
|
svg.setAttribute('aria-hidden', 'true');
|
|
212
234
|
});
|
|
213
235
|
};
|
|
@@ -310,6 +332,10 @@ export const defineEditor = (element, editorElement, config) => {
|
|
|
310
332
|
joditInstance.events.on('change', handleTextChange);
|
|
311
333
|
joditInstance.events.on('focus', handleFocus);
|
|
312
334
|
joditInstance.events.on('blur', handleBlur);
|
|
335
|
+
// Notify selection changes so consumers can react (e.g. enable/disable custom AI actions)
|
|
336
|
+
if (handleSelectionChange !== undefined) {
|
|
337
|
+
joditInstance.events.on('changeSelection', handleSelectionChange);
|
|
338
|
+
}
|
|
313
339
|
// Return the Jodit instance directly
|
|
314
340
|
return joditInstance;
|
|
315
341
|
};
|