@mgdis/mg-components 6.10.0 → 6.11.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-CfIlskRh.js → index-B_WwxtkQ.js} +4 -4
- package/dist/cjs/{index-CfIlskRh.js.map → index-B_WwxtkQ.js.map} +1 -1
- package/dist/cjs/{index.es-BCLy9yYb.js → index.es-C-3Gv8Eu.js} +85 -81
- package/dist/cjs/index.es-C-3Gv8Eu.js.map +1 -0
- package/dist/cjs/loader.cjs.js +1 -1
- package/dist/cjs/mg-action-more_37.cjs.entry.js +1915 -1909
- package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +6 -6
- package/dist/cjs/mg-components.cjs.js +1 -1
- package/dist/cjs/mg-input-combobox.cjs.entry.js +75 -72
- package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -1
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +12 -12
- package/dist/cjs/mg-loader.cjs.entry.js +4 -4
- package/dist/cjs/mg-progress.cjs.entry.js +10 -10
- package/dist/collection/components/atoms/mg-button/mg-button.js +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js +0 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.conf.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +43 -63
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +67 -45
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +25 -30
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +5 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +47 -97
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/components/index.es.js +71 -68
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index2.js +2 -2
- package/dist/components/mg-action-more.js +6 -6
- package/dist/components/mg-alert.js +5 -5
- package/dist/components/mg-badge2.js +6 -6
- package/dist/components/mg-button2.js +7 -7
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-character-left2.js +4 -4
- package/dist/components/mg-details.js +8 -4
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-form.js +7 -7
- package/dist/components/mg-icon2.js +6 -6
- package/dist/components/mg-illustrated-message.js +5 -5
- package/dist/components/mg-input-checkbox.js +9 -9
- package/dist/components/mg-input-combobox.js +74 -71
- package/dist/components/mg-input-combobox.js.map +1 -1
- package/dist/components/mg-input-date.js +17 -17
- package/dist/components/mg-input-numeric.js +13 -13
- package/dist/components/mg-input-password.js +3 -3
- package/dist/components/mg-input-radio.js +7 -7
- package/dist/components/mg-input-rich-text-editor.js +11 -11
- package/dist/components/mg-input-select2.js +32 -37
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text2.js +9 -9
- package/dist/components/mg-input-textarea.js +7 -7
- package/dist/components/mg-input-title2.js +4 -4
- package/dist/components/mg-input-toggle.js +6 -6
- package/dist/components/mg-input2.js +8 -8
- package/dist/components/mg-item-more2.js +7 -7
- package/dist/components/mg-loader2.js +3 -3
- package/dist/components/mg-menu-item2.js +11 -11
- package/dist/components/mg-message2.js +4 -4
- package/dist/components/mg-modal.js +8 -8
- package/dist/components/mg-pagination2.js +6 -6
- package/dist/components/mg-panel.js +9 -9
- package/dist/components/mg-popover-content2.js +4 -4
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-popover2.js +48 -96
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-progress.js +10 -10
- package/dist/components/mg-skip-links.js +2 -2
- package/dist/components/mg-table.js +6 -6
- package/dist/components/mg-tabs.js +12 -12
- package/dist/components/mg-tag.js +4 -4
- package/dist/components/mg-tooltip-content2.js +1 -1
- package/dist/components/mg-tooltip-content2.js.map +1 -1
- package/dist/components/mg-tooltip2.js +47 -66
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/components/popper.js +1793 -0
- package/dist/components/popper.js.map +1 -0
- package/dist/esm/{index-DmsGewMC.js → index-DHpyFawS.js} +4 -4
- package/dist/esm/{index-DmsGewMC.js.map → index-DHpyFawS.js.map} +1 -1
- package/dist/esm/{index.es-rLV3KFPd.js → index.es-lyrZ9KRh.js} +73 -70
- package/dist/esm/index.es-lyrZ9KRh.js.map +1 -0
- package/dist/esm/loader.js +1 -1
- package/dist/esm/mg-action-more_37.entry.js +1915 -1909
- package/dist/esm/mg-action-more_37.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +6 -6
- package/dist/esm/mg-components.js +1 -1
- package/dist/esm/mg-input-combobox.entry.js +75 -72
- package/dist/esm/mg-input-combobox.entry.js.map +1 -1
- package/dist/esm/mg-input-rich-text-editor.entry.js +12 -12
- package/dist/esm/mg-loader.entry.js +4 -4
- package/dist/esm/mg-progress.entry.js +10 -10
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -1
- package/dist/mg-components/{p-ad66e7b3.entry.js → p-596c0e08.entry.js} +2 -2
- package/dist/mg-components/p-8a3bd8ad.entry.js +2 -0
- package/dist/mg-components/p-8a3bd8ad.entry.js.map +1 -0
- package/dist/mg-components/p-98a74b62.entry.js +2 -0
- package/dist/mg-components/{p-cdbe689e.entry.js.map → p-98a74b62.entry.js.map} +1 -1
- package/dist/mg-components/{p-DK9teKTo.js → p-C-vIqOyI.js} +2 -2
- package/dist/mg-components/{p-DK9teKTo.js.map → p-C-vIqOyI.js.map} +1 -1
- package/dist/mg-components/{p-73099ed7.entry.js → p-d4ed3aad.entry.js} +2 -2
- package/dist/mg-components/p-e822bd96.entry.js +2 -0
- package/dist/mg-components/{p-88f77de2.entry.js.map → p-e822bd96.entry.js.map} +1 -1
- package/dist/mg-components/p-fc7b96e6.entry.js +2 -0
- package/dist/mg-components/p-fc7b96e6.entry.js.map +1 -0
- package/dist/mg-components/p-lyrZ9KRh.js +2 -0
- package/dist/mg-components/p-lyrZ9KRh.js.map +1 -0
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.conf.d.ts +0 -6
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +6 -8
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +5 -0
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +0 -9
- package/dist/types/components/molecules/mg-details/mg-details.d.ts +1 -0
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +8 -22
- package/dist/types/components.d.ts +11 -8
- package/ide/intellij/web-types.json +6 -2
- package/ide/vscode/html-custom-data.json +1 -1
- package/package.json +12 -12
- package/dist/cjs/index.es-BCLy9yYb.js.map +0 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js +0 -2
- package/dist/collection/components/molecules/mg-popover/mg-popover.conf.js.map +0 -1
- package/dist/collection/utils/floating-ui.utils.js +0 -74
- package/dist/collection/utils/floating-ui.utils.js.map +0 -1
- package/dist/components/floating-ui.utils.js +0 -1721
- package/dist/components/floating-ui.utils.js.map +0 -1
- package/dist/esm/index.es-rLV3KFPd.js.map +0 -1
- package/dist/mg-components/p-0f761c6c.entry.js +0 -2
- package/dist/mg-components/p-0f761c6c.entry.js.map +0 -1
- package/dist/mg-components/p-88f77de2.entry.js +0 -2
- package/dist/mg-components/p-cdbe689e.entry.js +0 -2
- package/dist/mg-components/p-d3a868f0.entry.js +0 -2
- package/dist/mg-components/p-d3a868f0.entry.js.map +0 -1
- package/dist/mg-components/p-rLV3KFPd.js +0 -2
- package/dist/mg-components/p-rLV3KFPd.js.map +0 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.conf.d.ts +0 -6
- package/dist/types/utils/floating-ui.utils.d.ts +0 -28
- /package/dist/mg-components/{p-ad66e7b3.entry.js.map → p-596c0e08.entry.js.map} +0 -0
- /package/dist/mg-components/{p-73099ed7.entry.js.map → p-d4ed3aad.entry.js.map} +0 -0
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { a as qt, V as Vt, q as qe, Y as Yt } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$a, S as SectionKind, a as MgInputCheckboxList, c as checkboxTypes } from './mg-input-checkbox-paginated2.js';
|
|
4
4
|
import { d as defineCustomElement$b, b as classFieldset, e as classVerticalList, c as classReadonly, a as classDisabled } from './mg-input2.js';
|
|
5
5
|
import { i as initLocales } from './index2.js';
|
|
@@ -86,7 +86,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
86
86
|
/**
|
|
87
87
|
* Component classes
|
|
88
88
|
*/
|
|
89
|
-
this.classCollection = new
|
|
89
|
+
this.classCollection = new qt([this.baseClassName, classFieldset]);
|
|
90
90
|
/**
|
|
91
91
|
* Formated value to display in list
|
|
92
92
|
*/
|
|
@@ -204,7 +204,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
204
204
|
* Method to update searchResults
|
|
205
205
|
*/
|
|
206
206
|
this.updateSearchResults = () => {
|
|
207
|
-
this.searchResults = this.checkboxItems.filter(item =>
|
|
207
|
+
this.searchResults = this.checkboxItems.filter(item => Vt(item.title).includes(Vt(this.searchValue)));
|
|
208
208
|
};
|
|
209
209
|
/**
|
|
210
210
|
* Method to validate if one of inputs value is checked id required
|
|
@@ -236,13 +236,13 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
236
236
|
* @returns message to display
|
|
237
237
|
*/
|
|
238
238
|
this.getSelectValuesButtonMessage = () => {
|
|
239
|
-
if (this.selectValuesButtonKey === 'editButton' &&
|
|
239
|
+
if (this.selectValuesButtonKey === 'editButton' && qe(this.editButtonMessage)) {
|
|
240
240
|
return this.editButtonMessage;
|
|
241
241
|
}
|
|
242
|
-
else if (this.selectValuesButtonKey === 'showButton' &&
|
|
242
|
+
else if (this.selectValuesButtonKey === 'showButton' && qe(this.showButtonMessage)) {
|
|
243
243
|
return this.showButtonMessage;
|
|
244
244
|
}
|
|
245
|
-
else if (this.selectValuesButtonKey === 'selectButton' &&
|
|
245
|
+
else if (this.selectValuesButtonKey === 'selectButton' && qe(this.selectButtonMessage)) {
|
|
246
246
|
return this.selectButtonMessage;
|
|
247
247
|
}
|
|
248
248
|
else {
|
|
@@ -298,12 +298,12 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
298
298
|
this.valueChange.emit(newValue);
|
|
299
299
|
}
|
|
300
300
|
else {
|
|
301
|
-
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${
|
|
301
|
+
throw new Error(`<mg-input-checkbox> prop "value" is required and all values must be the same type, CheckboxItem. Passed value: ${Yt(newValue)}.`);
|
|
302
302
|
}
|
|
303
303
|
}
|
|
304
304
|
validateType(newValue) {
|
|
305
305
|
if (newValue !== undefined && !checkboxTypes.includes(newValue)) {
|
|
306
|
-
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${
|
|
306
|
+
throw new Error(`<mg-input-checkbox> prop "type" must be a CheckboxType. Passed value: ${Yt(newValue)}.`);
|
|
307
307
|
}
|
|
308
308
|
else if (newValue === undefined) {
|
|
309
309
|
this.mode = 'auto';
|
|
@@ -403,7 +403,7 @@ const MgInputCheckbox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCheckbox
|
|
|
403
403
|
if (typeof valid !== 'boolean') {
|
|
404
404
|
throw new Error('<mg-input-checkbox> method "setError()" param "valid" must be a boolean.');
|
|
405
405
|
}
|
|
406
|
-
else if (!
|
|
406
|
+
else if (!qe(errorMessage)) {
|
|
407
407
|
throw new Error('<mg-input-checkbox> method "setError()" param "errorMessage" must be a string.');
|
|
408
408
|
}
|
|
409
409
|
else {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { proxyCustomElement, HTMLElement, createEvent, h } from '@stencil/core/internal/client';
|
|
2
|
-
import {
|
|
2
|
+
import { r as rr, a as qt, H as Ht, t as tr, e as er, b as Je, c as Ge, Y as Yt, G as Gt, d as K, q as qe } from './index.es.js';
|
|
3
3
|
import { d as defineCustomElement$8, c as classReadonly, a as classDisabled, w as widths } from './mg-input2.js';
|
|
4
4
|
import { i as initLocales } from './index2.js';
|
|
5
5
|
import { K as Keys } from './events.utils.js';
|
|
@@ -13,7 +13,7 @@ import { d as defineCustomElement$4 } from './mg-popover-content2.js';
|
|
|
13
13
|
import { d as defineCustomElement$3 } from './mg-tooltip2.js';
|
|
14
14
|
import { d as defineCustomElement$2 } from './mg-tooltip-content2.js';
|
|
15
15
|
|
|
16
|
-
const mgInputComboboxCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--combobox mg-popover{--mg-c-popover-padding-vertical:0;--mg-c-popover-padding-horizontal:0}.mg-c-input.mg-c-input--combobox .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--combobox .mg-c-input__box{cursor:pointer}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-container{display:flex;min-width:var(--mg-c-input-list-width);max-height:calc(50*var(--mg-b-size-8) - var(--mg-b-size-32));flex-direction:column;gap:var(--mg-b-size-4);overflow-y:scroll}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;text-align:center}.mg-c-input.mg-c-input--combobox .mg-c-input__load-more{padding:0 var(--mg-b-size-8) var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-
|
|
16
|
+
const mgInputComboboxCss = ".mg-c-input__box{height:var(--mg-b-size-min-height);box-sizing:border-box;padding:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2) var(--mg-b-size-8);border-width:var(--mg-c-input-border-width);border-style:solid;border-color:var(--mg-c-input-color-border);border-radius:var(--mg-c-input-border-radius);background-color:var(--mg-b-color-light);color:var(--mg-b-color-dark);font-family:inherit;font-size:var(--mg-b-font-size);text-align:var(--mg-c-input-text-align, left)}.mg-c-input__box::placeholder{color:var(--mg-c-input-placeholder-color-text);font-style:italic}.mg-c-input__box:focus{box-shadow:0 0 var(--mg-b-size-4) var(--mg-c-input-color-box-shadow-focus)}.mg-c-input__box:disabled{opacity:var(--mg-b-opacity-element-disabled)}.mg-c-input.mg-c-input--has-error .mg-c-input__box{border-color:var(--mg-b-color-danger)}.mg-c-input.mg-c-input--is-input-group-append{--mg-c-button-border-radius-top-left:0;--mg-c-button-border-radius-bottom-left:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box{margin-right:calc(-1*var(--mg-b-size-border));border-bottom-right-radius:0;border-top-right-radius:0}.mg-c-input.mg-c-input--is-input-group-append .mg-c-input__box:focus-visible{outline-offset:-0.2rem;outline-style:solid;outline-width:.2rem}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]){--mg-c-button-border-radius-top-right:0;--mg-c-button-border-radius-bottom-right:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:not(:last-of-type)){--mg-c-button-border-right-width:0}.mg-c-input.mg-c-input--has-buttons-group-append ::slotted([slot=append-input]:last-of-type){--mg-c-button-border-radius-top-right:var(--mg-c-input-border-radius);--mg-c-button-border-radius-bottom-right:var(--mg-c-input-border-radius)}.mg-c-input.mg-c-input--is-append-input-slot-content:not(.mg-c-input--readonly) ::slotted([slot=append-input]){align-self:start;padding-top:calc((var(--mg-b-size-min-height) - var(--mg-b-size-16))/2)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left>mg-icon:first-of-type,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container>mg-icon:first-of-type{position:absolute;top:50%;left:var(--mg-b-size-8);color:var(--mg-c-input-color-icon);transform:translateY(-50%)}.mg-c-input.mg-c-input--has-icon .mg-c-input__with-character-left .mg-c-input__box,.mg-c-input.mg-c-input--has-icon .mg-c-input__input-group-container .mg-c-input__box{padding-left:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2)}.mg-c-input__input-container{width:100%;flex:1 auto}.mg-c-input.mg-c-input--width-full .mg-c-input__box{width:100%}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left,.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left{width:max-content}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:has(textarea),.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:has(textarea){flex-grow:inherit}.mg-c-input.mg-c-input--width-2 .mg-c-input__box{width:var(--mg-b-size-48)}.mg-c-input.mg-c-input--width-2 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-48) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-4 .mg-c-input__box{width:var(--mg-b-size-72)}.mg-c-input.mg-c-input--width-4 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(var(--mg-b-size-72) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-16 .mg-c-input__box{width:calc(26*var(--mg-b-size-8))}.mg-c-input.mg-c-input--width-16 .mg-c-input__with-character-left:not(:has(textarea)) .mg-c-input__box{width:calc(calc(26 * var(--mg-b-size-8)) + var(--mg-c-character-left-message-length)*(.35ch + .3rem))}.mg-c-input.mg-c-input--width-full:not(.mg-c-input--label-on-top){justify-content:stretch}.mg-c-input.mg-c-input--is-input-group-append ::slotted([slot=append-input]),.mg-c-input.mg-c-input--is-append-input-slot-content ::slotted([slot=append-input]){width:auto}:host(.mg-c-input.mg-c-input--width-full) ::slotted(*:not(mg-input-title)){width:100%;max-width:100%}.mg-c-input__readonly-value{min-height:var(--mg-b-font-size);align-self:flex-start;margin-top:calc((var(--mg-b-size-min-height) - var(--mg-b-font-size)*var(--mg-b-line-height))/2);word-break:break-word}.mg-u-visually-hidden{position:absolute !important;overflow:hidden !important;width:.1rem !important;height:.1rem !important;padding:0 !important;border:0 !important;margin:-0.1rem !important;clip:rect(0.1rem, 0.1rem, 0.1rem, 0.1rem) !important;clip-path:inset(50%) !important;white-space:nowrap !important}*:focus:not(:focus-visible){outline:none}@media (prefers-reduced-motion){*{animation:none !important;transition:none !important}}.mg-c-input.mg-c-input--combobox mg-popover{--mg-c-popover-padding-vertical:0;--mg-c-popover-padding-horizontal:0}.mg-c-input.mg-c-input--combobox .mg-c-input__input-group-container{position:relative}.mg-c-input.mg-c-input--combobox .mg-c-input__box{cursor:pointer}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-container{display:flex;min-width:var(--mg-c-input-list-width);max-height:calc(50*var(--mg-b-size-8) - var(--mg-b-size-32));flex-direction:column;gap:var(--mg-b-size-4);overflow-y:scroll}.mg-c-input.mg-c-input--combobox .mg-c-input__popover-info{padding:var(--mg-b-size-8);margin:0;text-align:center}.mg-c-input.mg-c-input--combobox .mg-c-input__load-more{padding:0 var(--mg-b-size-8) var(--mg-b-size-4)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list{padding:0;margin:0;cursor:pointer;list-style:none}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item{display:flex;padding:var(--mg-b-size-8)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item:hover,.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--focus-visible{background-color:var(--mg-b-color-neutral-20)}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected{font-weight:700}.mg-c-input.mg-c-input--combobox .mg-c-input__input-list-item.mg-c-input__input-list-item--selected mg-icon{margin-left:auto}.mg-c-input.mg-c-input--combobox.mg-c-input--width-2 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-24) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-4 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + var(--mg-b-size-48) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-16 .mg-c-input__box{width:calc(var(--mg-b-size-16) + var(--mg-b-size-8)*2 + calc(23 * var(--mg-b-size-8)) + var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full mg-popover{--mg-c-popover-max-width:var(--mg-c-input-list-width, var(--mg-c-popover-max-width))}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__input-group-container{display:flex;width:100%}.mg-c-input.mg-c-input--combobox.mg-c-input--width-full .mg-c-input__box{flex:1}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box{padding-right:calc(var(--mg-b-size-min-height) + var(--mg-b-size-4))}.mg-c-input.mg-c-input--combobox.mg-c-input--input-append .mg-c-input__box-append{position:absolute;top:0;right:0}";
|
|
17
17
|
|
|
18
18
|
/**
|
|
19
19
|
* Check if object is an item
|
|
@@ -33,10 +33,10 @@ const isItems = (items) => Array.isArray(items) && items.every(isItem);
|
|
|
33
33
|
* @returns truthy if mapping is valid
|
|
34
34
|
*/
|
|
35
35
|
const isFetchmappings = (value) => {
|
|
36
|
-
const isValidRoot =
|
|
36
|
+
const isValidRoot = K(value) && Object.hasOwn(value, 'request') && Object.hasOwn(value, 'response');
|
|
37
37
|
if (isValidRoot) {
|
|
38
38
|
const { request, response } = value;
|
|
39
|
-
if ([request, response].some(property => !
|
|
39
|
+
if ([request, response].some(property => !K(property)))
|
|
40
40
|
return false;
|
|
41
41
|
const isValidRequest = typeof request.filter === 'string';
|
|
42
42
|
const isValidResponse = typeof response === 'object' &&
|
|
@@ -44,35 +44,13 @@ const isFetchmappings = (value) => {
|
|
|
44
44
|
typeof response.items === 'string' &&
|
|
45
45
|
typeof response.next === 'string' &&
|
|
46
46
|
typeof response.itemTitle === 'string' &&
|
|
47
|
-
typeof response.itemValue === 'string';
|
|
47
|
+
(typeof response.itemValue === 'string' || response.itemValue === undefined);
|
|
48
48
|
return isValidRequest && isValidResponse;
|
|
49
49
|
}
|
|
50
50
|
else {
|
|
51
51
|
return isValidRoot;
|
|
52
52
|
}
|
|
53
53
|
};
|
|
54
|
-
/**
|
|
55
|
-
* Map new URL from old url
|
|
56
|
-
* @param newValue - new URL value
|
|
57
|
-
* @param oldValue - previous URL value
|
|
58
|
-
* @returns updated url
|
|
59
|
-
*/
|
|
60
|
-
const mapUrl = (newValue, oldValue) => {
|
|
61
|
-
if (!Boolean(newValue))
|
|
62
|
-
return;
|
|
63
|
-
else if (URL.canParse(newValue)) {
|
|
64
|
-
return newValue;
|
|
65
|
-
}
|
|
66
|
-
// build new URL
|
|
67
|
-
const params = newValue.includes('?') && newValue.split('?').pop();
|
|
68
|
-
if (Boolean(params)) {
|
|
69
|
-
const { origin, pathname } = new URL(oldValue);
|
|
70
|
-
return `${origin}${pathname}?${params}`;
|
|
71
|
-
}
|
|
72
|
-
else {
|
|
73
|
-
return newValue;
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
54
|
const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox extends HTMLElement {
|
|
77
55
|
constructor() {
|
|
78
56
|
super();
|
|
@@ -82,6 +60,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
82
60
|
this.filterChange = createEvent(this, "filter-change", 7);
|
|
83
61
|
this.loadMore = createEvent(this, "load-more", 7);
|
|
84
62
|
this.inputValid = createEvent(this, "input-valid", 7);
|
|
63
|
+
this.fetchError = createEvent(this, "fetch-error", 7);
|
|
85
64
|
/************
|
|
86
65
|
* Internal *
|
|
87
66
|
************/
|
|
@@ -125,7 +104,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
125
104
|
/**
|
|
126
105
|
* Formated items for display
|
|
127
106
|
*/
|
|
128
|
-
this.options = new
|
|
107
|
+
this.options = new rr([]);
|
|
129
108
|
/**
|
|
130
109
|
* Option filter
|
|
131
110
|
*/
|
|
@@ -133,7 +112,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
133
112
|
/**
|
|
134
113
|
* Component classes
|
|
135
114
|
*/
|
|
136
|
-
this.classCollection = new
|
|
115
|
+
this.classCollection = new qt(['mg-c-input--combobox', 'mg-c-input--has-icon', 'mg-c-input--input-append']);
|
|
137
116
|
/**
|
|
138
117
|
* Popover display state
|
|
139
118
|
*/
|
|
@@ -143,7 +122,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
143
122
|
* @param event - option element click event
|
|
144
123
|
*/
|
|
145
124
|
this.handleOptionClick = (event) => {
|
|
146
|
-
this.setValue(this.options.items.find(option => option.value === event.target.id));
|
|
125
|
+
this.setValue(this.options.items.find(option => Ht(option.value) === event.target.id));
|
|
147
126
|
this.popoverDisplay = false;
|
|
148
127
|
};
|
|
149
128
|
/**
|
|
@@ -171,7 +150,14 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
171
150
|
this.setErrorMessage();
|
|
172
151
|
if (!this.popoverDisplay)
|
|
173
152
|
this.popoverDisplay = true;
|
|
174
|
-
|
|
153
|
+
// update filter with debounce to prevent filter update overload
|
|
154
|
+
if (!this.debounce) {
|
|
155
|
+
this.debounce = true;
|
|
156
|
+
setTimeout(() => {
|
|
157
|
+
this.filter = this.input.value;
|
|
158
|
+
this.debounce = false;
|
|
159
|
+
}, 250);
|
|
160
|
+
}
|
|
175
161
|
};
|
|
176
162
|
/**
|
|
177
163
|
* Handle `blur` event
|
|
@@ -200,7 +186,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
200
186
|
* Handle load-more <mg-button> `click`
|
|
201
187
|
*/
|
|
202
188
|
this.handleLoadMoreButton = () => {
|
|
203
|
-
this.loadingWrapper({ name: 'load-more', cursor:
|
|
189
|
+
this.loadingWrapper({ name: 'load-more', cursor: tr.NEXT }).then(() => {
|
|
204
190
|
this.input.focus();
|
|
205
191
|
});
|
|
206
192
|
};
|
|
@@ -246,14 +232,14 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
246
232
|
// If the filter is empty and the popover is not displayed, opens the popover and moves visual focus to the first option.
|
|
247
233
|
// Moves visual focus to the next option.
|
|
248
234
|
// If visual focus is on the last option, moves visual focus to the first option.
|
|
249
|
-
cursor = isNavigationStart ?
|
|
235
|
+
cursor = isNavigationStart ? tr.NEXT : tr.FIRST;
|
|
250
236
|
}
|
|
251
237
|
else if ([Keys.UP, Keys.ARROWUP].includes(event.key)) {
|
|
252
238
|
// If the filter is not empty and the popover is displayed, moves visual focus to the last suggested value.
|
|
253
239
|
// If the filter is empty, first opens the popover if it is not already displayed and then moves visual focus to the last option.
|
|
254
240
|
// Moves visual focus to the previous option.
|
|
255
241
|
// If visual focus is on the first option, moves visual focus to the last option.
|
|
256
|
-
cursor = isNavigationStart ?
|
|
242
|
+
cursor = isNavigationStart ? tr.PREVIOUS : tr.LAST;
|
|
257
243
|
}
|
|
258
244
|
// update scroll and visual focused option in wrapper
|
|
259
245
|
this.loadingWrapper({ name: 'scroll', cursor });
|
|
@@ -390,7 +376,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
390
376
|
this.isLoading = true;
|
|
391
377
|
promise = this.goToNextPage;
|
|
392
378
|
}
|
|
393
|
-
else if (action.cursor ===
|
|
379
|
+
else if (action.cursor === tr.NEXT &&
|
|
394
380
|
this.page.items.length <= this.page.total &&
|
|
395
381
|
index + this.page.baseIndex === this.page.items.length &&
|
|
396
382
|
index + this.page.baseIndex < this.page.total) {
|
|
@@ -399,7 +385,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
399
385
|
return;
|
|
400
386
|
}
|
|
401
387
|
else if (action.name === 'scroll') {
|
|
402
|
-
promise =
|
|
388
|
+
promise = er;
|
|
403
389
|
}
|
|
404
390
|
else {
|
|
405
391
|
promise = this.updatePage;
|
|
@@ -437,14 +423,14 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
437
423
|
// merge items from current page and next page
|
|
438
424
|
const items = [...this.page.items, ...nextPage.items];
|
|
439
425
|
// create new options pagination withe merged items
|
|
440
|
-
this.options = new
|
|
426
|
+
this.options = new rr(items, { total: nextPage.total, next: nextPage.next, top: items.length });
|
|
441
427
|
});
|
|
442
428
|
}
|
|
443
429
|
else {
|
|
444
|
-
return
|
|
430
|
+
return er(() => {
|
|
445
431
|
if (typeof this.page.next === 'function') {
|
|
446
432
|
const nextPage = this.page.next();
|
|
447
|
-
this.page = new
|
|
433
|
+
this.page = new Je(Object.assign(Object.assign({}, nextPage), { items: [...this.page.items, ...nextPage.items] }));
|
|
448
434
|
}
|
|
449
435
|
});
|
|
450
436
|
}
|
|
@@ -459,7 +445,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
459
445
|
if (!Boolean(page))
|
|
460
446
|
return;
|
|
461
447
|
// reset current options pagination from API response
|
|
462
|
-
this.options = new
|
|
448
|
+
this.options = new rr(page.items, { total: page.total, next: page.next, top: page.top });
|
|
463
449
|
});
|
|
464
450
|
}
|
|
465
451
|
else {
|
|
@@ -475,18 +461,23 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
475
461
|
// add text filter
|
|
476
462
|
const updateUrl = (typeof url === 'string' ? url : url.toString()).replaceAll(this.fetchmappings.request.filter, encodeURIComponent(this.filter));
|
|
477
463
|
try {
|
|
478
|
-
const response = await fetch(updateUrl, this.fetchoptions)
|
|
479
|
-
if (!response)
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
464
|
+
const response = await fetch(updateUrl, this.fetchoptions);
|
|
465
|
+
if (!response.ok) {
|
|
466
|
+
this.fetchError.emit(new Error(`${response.status} - ${response.statusText}`));
|
|
467
|
+
return;
|
|
468
|
+
}
|
|
469
|
+
const json = await response.json();
|
|
470
|
+
const items = Ge(json, this.fetchmappings.response.items).map((item) => ({
|
|
471
|
+
title: Ge(item, this.fetchmappings.response.itemTitle),
|
|
472
|
+
value: this.fetchmappings.response.itemValue ? Ge(item, this.fetchmappings.response.itemValue) : item,
|
|
484
473
|
}));
|
|
485
|
-
const total = Number(
|
|
486
|
-
const next =
|
|
474
|
+
const total = Number(Ge(json, this.fetchmappings.response.total, 0));
|
|
475
|
+
const next = Ge(json, this.fetchmappings.response.next);
|
|
487
476
|
return { items, total, next, top: items.length };
|
|
488
477
|
}
|
|
489
|
-
catch (
|
|
478
|
+
catch (error) {
|
|
479
|
+
this.fetchError.emit(error);
|
|
480
|
+
}
|
|
490
481
|
};
|
|
491
482
|
}
|
|
492
483
|
watchValue(newValue) {
|
|
@@ -499,22 +490,22 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
499
490
|
return;
|
|
500
491
|
}
|
|
501
492
|
else if (Boolean(this.fetchurl) && Boolean(newValue)) {
|
|
502
|
-
throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${
|
|
493
|
+
throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${Yt(newValue)}.`);
|
|
503
494
|
}
|
|
504
495
|
// Empty options
|
|
505
496
|
else if (Array.isArray(newValue) && newValue.length === 0) {
|
|
506
|
-
this.options = new
|
|
497
|
+
this.options = new rr([]);
|
|
507
498
|
}
|
|
508
499
|
// String array
|
|
509
|
-
else if (
|
|
510
|
-
this.options = new
|
|
500
|
+
else if (Gt(newValue)) {
|
|
501
|
+
this.options = new rr(newValue.map(item => ({ title: item, value: item })), { total: newValue.length });
|
|
511
502
|
}
|
|
512
503
|
// Object array
|
|
513
504
|
else if (isItems(newValue)) {
|
|
514
|
-
this.options = new
|
|
505
|
+
this.options = new rr(newValue, { total: newValue.length });
|
|
515
506
|
}
|
|
516
507
|
else {
|
|
517
|
-
throw new Error(`<mg-input-combobox> prop "items" values must be the same type, string or Option. Passed value: ${
|
|
508
|
+
throw new Error(`<mg-input-combobox> prop "items" values must be the same type, string or Option. Passed value: ${Yt(newValue)}.`);
|
|
518
509
|
}
|
|
519
510
|
}
|
|
520
511
|
watchIdentifier(newValue) {
|
|
@@ -555,16 +546,16 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
555
546
|
// apply new width
|
|
556
547
|
if (newValue !== undefined)
|
|
557
548
|
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
558
|
-
this.classCollection = new
|
|
549
|
+
this.classCollection = new qt(this.classCollection.classes);
|
|
559
550
|
}
|
|
560
551
|
watchFetchUrl(newValue) {
|
|
561
|
-
if (
|
|
562
|
-
|
|
552
|
+
if (Boolean(newValue)) {
|
|
553
|
+
this.loadingWrapper({ name: 'load-data' });
|
|
563
554
|
}
|
|
564
555
|
}
|
|
565
556
|
watchFetchOptions(newValue) {
|
|
566
|
-
if (this.fetchurl && newValue && !
|
|
567
|
-
throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${
|
|
557
|
+
if (this.fetchurl && newValue && !K(newValue)) {
|
|
558
|
+
throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${Yt(newValue)}.`);
|
|
568
559
|
}
|
|
569
560
|
else {
|
|
570
561
|
new Request(this.fetchurl, newValue);
|
|
@@ -575,7 +566,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
575
566
|
throw new Error(`<mg-input-combobox> prop "fetchmappings" is required with "fetchurl" prop.`);
|
|
576
567
|
}
|
|
577
568
|
else if (Boolean(newValue) && !isFetchmappings(newValue)) {
|
|
578
|
-
throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${
|
|
569
|
+
throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${Yt(newValue)}.`);
|
|
579
570
|
}
|
|
580
571
|
}
|
|
581
572
|
watchOptions(newValue) {
|
|
@@ -641,7 +632,7 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
641
632
|
if (typeof valid !== 'boolean') {
|
|
642
633
|
throw new Error('<mg-input-combobox> method "setError()" param "valid" must be a boolean.');
|
|
643
634
|
}
|
|
644
|
-
else if (!
|
|
635
|
+
else if (!qe(errorMessage)) {
|
|
645
636
|
throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');
|
|
646
637
|
}
|
|
647
638
|
else {
|
|
@@ -671,8 +662,11 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
671
662
|
if (!isItem(newValue)) {
|
|
672
663
|
this.value = '';
|
|
673
664
|
}
|
|
665
|
+
else if (Gt(this.items || this.options.items)) {
|
|
666
|
+
this.value = newValue.title;
|
|
667
|
+
}
|
|
674
668
|
else {
|
|
675
|
-
this.value =
|
|
669
|
+
this.value = Object.assign({}, newValue);
|
|
676
670
|
}
|
|
677
671
|
}
|
|
678
672
|
/**
|
|
@@ -701,7 +695,6 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
701
695
|
this.watchIdentifier(this.identifier);
|
|
702
696
|
this.watchItems(this.items);
|
|
703
697
|
if (Boolean(this.fetchurl)) {
|
|
704
|
-
this.watchFetchUrl(this.fetchurl);
|
|
705
698
|
this.watchFetchOptions(this.fetchoptions);
|
|
706
699
|
this.watchFetchMappings(this.fetchmappings);
|
|
707
700
|
this.loadingWrapper({ name: 'load-data' });
|
|
@@ -734,22 +727,32 @@ const MgInputCombobox$1 = /*@__PURE__*/ proxyCustomElement(class MgInputCombobox
|
|
|
734
727
|
popoverContent = 'notfound';
|
|
735
728
|
else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0)
|
|
736
729
|
popoverContent = 'notavailable';
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
730
|
+
let activeDescendant;
|
|
731
|
+
if (Boolean((_d = this.option) === null || _d === void 0 ? void 0 : _d.value)) {
|
|
732
|
+
activeDescendant = this.option.value;
|
|
733
|
+
}
|
|
734
|
+
else if (typeof this.value === 'string') {
|
|
735
|
+
activeDescendant = this.value;
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
activeDescendant = (_e = this.value) === null || _e === void 0 ? void 0 : _e.value;
|
|
739
|
+
}
|
|
740
|
+
return (h("mg-input", { key: '9247630e9b86d6ca8e9e57089454551cf31f5531', label: this.label, identifier: this.identifier, class: this.classCollection.classes.join(' '), ariaDescribedbyIDs: popoverContent && popoverContent !== 'list' ? [popoverContent] : [], 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 ? (readonlyValue && h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (h("mg-popover", { identifier: this.popoverId, placement: "bottom-start", display: this.popoverDisplay, "arrow-hide": true, style: {
|
|
741
|
+
'--mg-c-input-list-width': Boolean((_f = this.input) === null || _f === void 0 ? void 0 : _f.offsetWidth) ? `${this.input.offsetWidth}px` : undefined,
|
|
742
|
+
}, "data-fallback-placement": "bottom-end", "onDisplay-change": this.handlePopoverDisplay }, h("div", { class: "mg-c-input__input-group-container" }, h("mg-icon", { icon: "magnifying-glass" }), h("input", { type: "text", role: "combobox", class: "mg-c-input__box mg-c-input__box--width", value: this.filter, id: this.identifier, name: this.name, placeholder: this.placeholder, title: this.placeholder, disabled: this.disabled, required: this.required, autocomplete: "off", "aria-autocomplete": "list", "aria-expanded": this.popoverDisplay.toString(), "aria-controls": listId, "aria-invalid": (this.invalid === true).toString(), "aria-activedescendant": Ht(activeDescendant), onInput: this.handleFilterInput, onBlur: this.handleFilterBlur, onFocus: this.handleFilterFocus, onKeyDown: this.handleFilterKeydown, ref: (el) => {
|
|
741
743
|
if (el !== null)
|
|
742
744
|
this.input = el;
|
|
743
|
-
} }), withResetButton
|
|
745
|
+
} }), withResetButton ? (h("mg-button", { class: "mg-c-input__box-append mg-c-input__reset", variant: "flat", "is-icon": true, label: this.messages.general.reset, "aria-controls": this.identifier, tabindex: "-1", onClick: this.handleResetButton }, h("mg-icon", { icon: "cross" }))) : (h("mg-button", { class: "mg-c-input__box-append", variant: "flat", "is-icon": true, label: this.itemsLabel, tabindex: "-1", disabled: this.disabled }, h("mg-icon", { icon: `chevron-${this.popoverDisplay ? 'up' : 'down'}` })))), h("div", { slot: "content", class: "mg-c-input__popover-container" }, popoverContent === 'list' && [
|
|
744
746
|
// eslint-disable-next-line jsx-a11y/role-supports-aria-props
|
|
745
747
|
h("ul", { key: "list", class: "mg-c-input__input-list", role: "listbox", id: listId, "aria-label": this.itemsLabel, "aria-setsize": this.page.total }, this.page.items.map(option => {
|
|
748
|
+
var _a;
|
|
746
749
|
return (
|
|
747
750
|
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
748
751
|
h("li", { role: "option", class: {
|
|
749
752
|
'mg-c-input__input-list-item': true,
|
|
750
|
-
'mg-c-input__input-list-item--focus-visible': this.option === option,
|
|
753
|
+
'mg-c-input__input-list-item--focus-visible': JSON.stringify((_a = this.option) === null || _a === void 0 ? void 0 : _a.value) === JSON.stringify(option.value),
|
|
751
754
|
'mg-c-input__input-list-item--selected': this.isCurrentOption(option),
|
|
752
|
-
}, key: option.title, id: option.value
|
|
755
|
+
}, key: option.title, id: Ht(option.value), "aria-selected": this.isCurrentOption(option).toString(), onClick: this.handleOptionClick }, option.title, this.isCurrentOption(option) && h("mg-icon", { icon: "check" })));
|
|
753
756
|
})),
|
|
754
757
|
this.isLoading && h("mg-loader", { key: "loader", message: this.messages.input.combobox.search, class: { 'mg-u-visually-hidden': Boolean(this.page.next) } }),
|
|
755
758
|
this.page.next && (h("mg-button", { key: "load-more", variant: "flat", class: "mg-c-input__load-more", tabIndex: -1, disabled: this.isLoading, "full-width": true, "disable-on-click": true, onClick: this.handleLoadMoreButton, "aria-controls": listId, ref: (el) => {
|