@mgdis/mg-components 6.8.0 → 6.10.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/README.md +17 -78
- package/dist/cjs/app-globals-V2Kpy_OQ.js +8 -0
- package/dist/cjs/app-globals-V2Kpy_OQ.js.map +1 -0
- package/dist/cjs/events.utils-D5SAtkpQ.js +28 -0
- package/dist/cjs/events.utils-D5SAtkpQ.js.map +1 -0
- package/dist/cjs/{index-1a5a1081.js → index-CATFkm3O.js} +248 -196
- package/dist/cjs/index-CATFkm3O.js.map +1 -0
- package/dist/cjs/{index-234e834a.js → index-CfIlskRh.js} +34 -11
- package/dist/cjs/index-CfIlskRh.js.map +1 -0
- package/dist/cjs/index.cjs.js +1 -0
- package/dist/cjs/index.cjs.js.map +1 -1
- package/dist/cjs/index.es-BCLy9yYb.js +250 -0
- package/dist/cjs/index.es-BCLy9yYb.js.map +1 -0
- package/dist/cjs/loader.cjs.js +4 -5
- package/dist/cjs/loader.cjs.js.map +1 -1
- package/dist/cjs/mg-action-more_37.cjs.entry.js +573 -934
- package/dist/cjs/mg-action-more_37.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.cjs.entry.js +21 -15
- package/dist/cjs/mg-alert.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-alert.entry.cjs.js.map +1 -0
- package/dist/cjs/mg-components.cjs.js +8 -7
- package/dist/cjs/mg-components.cjs.js.map +1 -1
- package/dist/cjs/mg-input-combobox.cjs.entry.js +774 -0
- package/dist/cjs/mg-input-combobox.cjs.entry.js.map +1 -0
- package/dist/cjs/mg-input-combobox.entry.cjs.js.map +1 -0
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js +21526 -6868
- package/dist/cjs/mg-input-rich-text-editor.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-input-rich-text-editor.entry.cjs.js.map +1 -0
- package/dist/cjs/{mg-input.conf-5bbcea79.js → mg-input.conf-WTsvDfpC.js} +2 -1
- package/dist/cjs/mg-input.conf-WTsvDfpC.js.map +1 -0
- package/dist/cjs/mg-loader.cjs.entry.js +12 -10
- package/dist/cjs/mg-loader.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-loader.entry.cjs.js.map +1 -0
- package/dist/cjs/mg-progress.cjs.entry.js +14 -16
- package/dist/cjs/mg-progress.cjs.entry.js.map +1 -1
- package/dist/cjs/mg-progress.entry.cjs.js.map +1 -0
- package/dist/collection/collection-manifest.json +4 -3
- package/dist/collection/components/atoms/mg-badge/mg-badge.js +9 -4
- package/dist/collection/components/atoms/mg-badge/mg-badge.js.map +1 -1
- package/dist/collection/components/atoms/mg-button/mg-button.js +7 -6
- package/dist/collection/components/atoms/mg-button/mg-button.js.map +1 -1
- package/dist/collection/components/atoms/mg-tag/mg-tag.js +17 -7
- package/dist/collection/components/atoms/mg-tag/mg-tag.js.map +1 -1
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js +47 -58
- package/dist/collection/components/atoms/mg-tooltip/mg-tooltip.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js +12 -8
- package/dist/collection/components/molecules/inputs/mg-input/mg-input.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js +19 -6
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js +16 -5
- package/dist/collection/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js +2 -0
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js +1443 -0
- package/dist/collection/components/molecules/inputs/mg-input-combobox/mg-input-combobox.js.map +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js +8 -3
- package/dist/collection/components/molecules/inputs/mg-input-date/mg-input-date.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js +9 -4
- package/dist/collection/components/molecules/inputs/mg-input-numeric/mg-input-numeric.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js +12 -7
- package/dist/collection/components/molecules/inputs/mg-input-password/mg-input-password.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-radio/mg-input-radio.js +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/editor/editor.scss +1 -0
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js +46 -41
- package/dist/collection/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js +8 -3
- package/dist/collection/components/molecules/inputs/mg-input-select/mg-input-select.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js +49 -44
- package/dist/collection/components/molecules/inputs/mg-input-text/mg-input-text.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js +28 -23
- package/dist/collection/components/molecules/inputs/mg-input-textarea/mg-input-textarea.js.map +1 -1
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js +8 -3
- package/dist/collection/components/molecules/inputs/mg-input-toggle/mg-input-toggle.js.map +1 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.conf.js.map +1 -1
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js +2 -2
- package/dist/collection/components/molecules/internals/mg-item-more/mg-item-more.js.map +1 -1
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.conf.js.map +1 -0
- package/dist/collection/components/molecules/{menu → menus}/mg-menu/mg-menu.js +10 -10
- package/dist/collection/components/molecules/menus/mg-menu/mg-menu.js.map +1 -0
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.conf.js.map +1 -0
- package/dist/collection/components/molecules/{menu → menus}/mg-menu-item/mg-menu-item.js +9 -9
- package/dist/collection/components/molecules/menus/mg-menu-item/mg-menu-item.js.map +1 -0
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.conf.js.map +1 -1
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js +11 -6
- package/dist/collection/components/molecules/mg-action-more/mg-action-more.js.map +1 -1
- package/dist/collection/components/molecules/mg-alert/mg-alert.js +13 -3
- package/dist/collection/components/molecules/mg-alert/mg-alert.js.map +1 -1
- package/dist/collection/components/molecules/mg-details/mg-details.js +3 -2
- package/dist/collection/components/molecules/mg-details/mg-details.js.map +1 -1
- package/dist/collection/components/molecules/mg-form/mg-form.js +8 -3
- package/dist/collection/components/molecules/mg-form/mg-form.js.map +1 -1
- package/dist/collection/components/molecules/mg-illustrated-message/mg-illustrated-message.js +1 -1
- package/dist/collection/components/molecules/mg-loader/mg-loader.js +10 -3
- package/dist/collection/components/molecules/mg-loader/mg-loader.js.map +1 -1
- package/dist/collection/components/molecules/mg-message/mg-message.js +2 -2
- package/dist/collection/components/molecules/mg-modal/mg-modal.js +4 -4
- package/dist/collection/components/molecules/mg-modal/mg-modal.js.map +1 -1
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js +17 -7
- package/dist/collection/components/molecules/mg-pagination/mg-pagination.js.map +1 -1
- package/dist/collection/components/molecules/mg-panel/mg-panel.js +12 -7
- package/dist/collection/components/molecules/mg-panel/mg-panel.js.map +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover-content/mg-popover-content.js +1 -1
- package/dist/collection/components/molecules/mg-popover/mg-popover.js +56 -81
- package/dist/collection/components/molecules/mg-popover/mg-popover.js.map +1 -1
- package/dist/collection/components/molecules/mg-progress/mg-progress.js +1 -1
- package/dist/collection/components/molecules/mg-skip-links/mg-skip-links.js +1 -1
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js +6 -5
- package/dist/collection/components/molecules/mg-tabs/mg-tabs.js.map +1 -1
- package/dist/collection/locales/en/messages.json +14 -3
- package/dist/collection/locales/fr/messages.json +14 -3
- package/dist/collection/utils/behaviors.utils.js +3 -3
- package/dist/collection/utils/behaviors.utils.js.map +1 -1
- package/dist/collection/utils/events.utils.js +22 -0
- package/dist/collection/utils/events.utils.js.map +1 -0
- package/dist/collection/utils/floating-ui.utils.js +46 -2
- package/dist/collection/utils/floating-ui.utils.js.map +1 -1
- package/dist/collection/utils/playwright.fixture.js +2 -3
- package/dist/collection/utils/playwright.fixture.js.map +1 -1
- package/dist/components/events.utils.js +26 -0
- package/dist/components/events.utils.js.map +1 -0
- package/dist/components/floating-ui.utils.js +48 -423
- package/dist/components/floating-ui.utils.js.map +1 -1
- package/dist/components/index.es.js +161 -67
- package/dist/components/index.es.js.map +1 -1
- package/dist/components/index.js +1 -0
- package/dist/components/index2.js +33 -10
- package/dist/components/index2.js.map +1 -1
- package/dist/components/mg-action-more.js +15 -11
- package/dist/components/mg-action-more.js.map +1 -1
- package/dist/components/mg-alert.js +16 -8
- package/dist/components/mg-alert.js.map +1 -1
- package/dist/components/mg-badge.js +1 -0
- package/dist/components/mg-badge2.js +14 -10
- package/dist/components/mg-badge2.js.map +1 -1
- package/dist/components/mg-button.js +1 -0
- package/dist/components/mg-button2.js +13 -12
- package/dist/components/mg-button2.js.map +1 -1
- package/dist/components/mg-card.js +1 -0
- package/dist/components/mg-card2.js +2 -2
- package/dist/components/mg-card2.js.map +1 -1
- package/dist/components/mg-character-left.js +1 -0
- package/dist/components/mg-character-left2.js +6 -6
- package/dist/components/mg-character-left2.js.map +1 -1
- package/dist/components/mg-details.js +8 -7
- package/dist/components/mg-details.js.map +1 -1
- package/dist/components/mg-divider.js +1 -0
- package/dist/components/mg-divider2.js +2 -2
- package/dist/components/mg-divider2.js.map +1 -1
- package/dist/components/mg-form.js +14 -10
- package/dist/components/mg-form.js.map +1 -1
- package/dist/components/mg-icon.js +1 -0
- package/dist/components/mg-icon2.js +8 -8
- package/dist/components/mg-icon2.js.map +1 -1
- package/dist/components/mg-illustrated-message.js +8 -8
- package/dist/components/mg-illustrated-message.js.map +1 -1
- package/dist/components/mg-input-checkbox-paginated.js +2 -1
- package/dist/components/mg-input-checkbox-paginated2.js +15 -3
- package/dist/components/mg-input-checkbox-paginated2.js.map +1 -1
- package/dist/components/mg-input-checkbox.js +23 -14
- package/dist/components/mg-input-checkbox.js.map +1 -1
- package/dist/components/mg-input-combobox.d.ts +11 -0
- package/dist/components/mg-input-combobox.js +897 -0
- package/dist/components/mg-input-combobox.js.map +1 -0
- package/dist/components/mg-input-date.js +25 -21
- package/dist/components/mg-input-date.js.map +1 -1
- package/dist/components/mg-input-numeric.js +23 -19
- package/dist/components/mg-input-numeric.js.map +1 -1
- package/dist/components/mg-input-password.js +13 -9
- package/dist/components/mg-input-password.js.map +1 -1
- package/dist/components/mg-input-radio.js +11 -11
- package/dist/components/mg-input-radio.js.map +1 -1
- package/dist/components/mg-input-rich-text-editor.js +21527 -6867
- package/dist/components/mg-input-rich-text-editor.js.map +1 -1
- package/dist/components/mg-input-select.js +1 -0
- package/dist/components/mg-input-select2.js +16 -12
- package/dist/components/mg-input-select2.js.map +1 -1
- package/dist/components/mg-input-text.js +1 -0
- package/dist/components/mg-input-text2.js +24 -20
- package/dist/components/mg-input-text2.js.map +1 -1
- package/dist/components/mg-input-textarea.js +17 -13
- package/dist/components/mg-input-textarea.js.map +1 -1
- package/dist/components/mg-input-title.js +1 -0
- package/dist/components/mg-input-title2.js +6 -6
- package/dist/components/mg-input-title2.js.map +1 -1
- package/dist/components/mg-input-toggle.js +14 -10
- package/dist/components/mg-input-toggle.js.map +1 -1
- package/dist/components/mg-input.js +1 -0
- package/dist/components/mg-input2.js +20 -14
- package/dist/components/mg-input2.js.map +1 -1
- package/dist/components/mg-item-more.js +2 -1
- package/dist/components/mg-item-more2.js +22 -23
- package/dist/components/mg-item-more2.js.map +1 -1
- package/dist/components/mg-loader.js +2 -67
- package/dist/components/mg-loader.js.map +1 -1
- package/dist/components/mg-loader2.js +75 -0
- package/dist/components/mg-loader2.js.map +1 -0
- package/dist/components/mg-menu-item.js +1 -0
- package/dist/components/mg-menu-item2.js +18 -18
- package/dist/components/mg-menu-item2.js.map +1 -1
- package/dist/components/mg-menu.js +2 -1
- package/dist/components/mg-message.js +1 -0
- package/dist/components/mg-message2.js +8 -8
- package/dist/components/mg-message2.js.map +1 -1
- package/dist/components/mg-modal.js +13 -13
- package/dist/components/mg-modal.js.map +1 -1
- package/dist/components/mg-pagination.js +1 -0
- package/dist/components/mg-pagination2.js +19 -11
- package/dist/components/mg-pagination2.js.map +1 -1
- package/dist/components/mg-panel.js +18 -14
- package/dist/components/mg-panel.js.map +1 -1
- package/dist/components/mg-popover-content.js +1 -0
- package/dist/components/mg-popover-content2.js +7 -7
- package/dist/components/mg-popover-content2.js.map +1 -1
- package/dist/components/mg-popover.js +1 -0
- package/dist/components/mg-popover2.js +62 -88
- package/dist/components/mg-popover2.js.map +1 -1
- package/dist/components/mg-progress.js +13 -13
- package/dist/components/mg-progress.js.map +1 -1
- package/dist/components/mg-skip-links.js +5 -5
- package/dist/components/mg-skip-links.js.map +1 -1
- package/dist/components/mg-table.js +8 -8
- package/dist/components/mg-table.js.map +1 -1
- package/dist/components/mg-tabs.js +20 -19
- package/dist/components/mg-tabs.js.map +1 -1
- package/dist/components/mg-tag.js +16 -8
- package/dist/components/mg-tag.js.map +1 -1
- package/dist/components/mg-tooltip-content.js +1 -0
- package/dist/components/mg-tooltip-content2.js +3 -3
- package/dist/components/mg-tooltip-content2.js.map +1 -1
- package/dist/components/mg-tooltip.js +1 -0
- package/dist/components/mg-tooltip2.js +58 -68
- package/dist/components/mg-tooltip2.js.map +1 -1
- package/dist/esm/app-globals-DQuL1Twl.js +6 -0
- package/dist/esm/app-globals-DQuL1Twl.js.map +1 -0
- package/dist/esm/events.utils-yMGqY8YG.js +26 -0
- package/dist/esm/events.utils-yMGqY8YG.js.map +1 -0
- package/dist/esm/{index-5059254f.js → index-CAuxALt5.js} +246 -174
- package/dist/esm/index-CAuxALt5.js.map +1 -0
- package/dist/esm/{index-544778a7.js → index-DmsGewMC.js} +34 -11
- package/dist/esm/index-DmsGewMC.js.map +1 -0
- package/dist/esm/index.es-rLV3KFPd.js +223 -0
- package/dist/esm/index.es-rLV3KFPd.js.map +1 -0
- package/dist/esm/index.js +1 -0
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/loader.js +5 -4
- package/dist/esm/loader.js.map +1 -1
- package/dist/esm/mg-action-more_37.entry.js +573 -932
- package/dist/esm/mg-action-more_37.entry.js.map +1 -1
- package/dist/esm/mg-alert.entry.js +21 -13
- package/dist/esm/mg-alert.entry.js.map +1 -1
- package/dist/esm/mg-components.js +7 -5
- package/dist/esm/mg-components.js.map +1 -1
- package/dist/esm/mg-input-combobox.entry.js +772 -0
- package/dist/esm/mg-input-combobox.entry.js.map +1 -0
- package/dist/esm/mg-input-rich-text-editor.entry.js +21529 -6869
- package/dist/esm/mg-input-rich-text-editor.entry.js.map +1 -1
- package/dist/esm/{mg-input.conf-712c7bb6.js → mg-input.conf-CNgv8hc5.js} +3 -2
- package/dist/esm/mg-input.conf-CNgv8hc5.js.map +1 -0
- package/dist/esm/mg-loader.entry.js +12 -8
- package/dist/esm/mg-loader.entry.js.map +1 -1
- package/dist/esm/mg-progress.entry.js +14 -14
- package/dist/esm/mg-progress.entry.js.map +1 -1
- package/dist/mg-components/index.esm.js.map +1 -1
- package/dist/mg-components/loader.esm.js.map +1 -0
- package/dist/mg-components/locales/en/messages.json +14 -3
- package/dist/mg-components/locales/fr/messages.json +14 -3
- package/dist/mg-components/mg-alert.entry.esm.js.map +1 -0
- package/dist/mg-components/mg-components.esm.js +1 -1
- package/dist/mg-components/mg-components.esm.js.map +1 -1
- package/dist/mg-components/mg-input-combobox.entry.esm.js.map +1 -0
- package/dist/mg-components/mg-input-rich-text-editor.entry.esm.js.map +1 -0
- package/dist/mg-components/mg-loader.entry.esm.js.map +1 -0
- package/dist/mg-components/mg-progress.entry.esm.js.map +1 -0
- package/dist/mg-components/p-0f761c6c.entry.js +2 -0
- package/dist/mg-components/p-0f761c6c.entry.js.map +1 -0
- package/dist/mg-components/p-73099ed7.entry.js +11 -0
- package/dist/mg-components/p-73099ed7.entry.js.map +1 -0
- package/dist/mg-components/p-88f77de2.entry.js +2 -0
- package/dist/mg-components/p-88f77de2.entry.js.map +1 -0
- package/dist/mg-components/p-CAuxALt5.js +3 -0
- package/dist/mg-components/p-CAuxALt5.js.map +1 -0
- package/dist/mg-components/p-CNgv8hc5.js +2 -0
- package/dist/mg-components/p-CNgv8hc5.js.map +1 -0
- package/dist/mg-components/p-DK9teKTo.js +2 -0
- package/dist/mg-components/p-DK9teKTo.js.map +1 -0
- package/dist/mg-components/p-DQuL1Twl.js +2 -0
- package/dist/mg-components/p-DQuL1Twl.js.map +1 -0
- package/dist/mg-components/p-ad66e7b3.entry.js +2 -0
- package/dist/mg-components/p-ad66e7b3.entry.js.map +1 -0
- package/dist/mg-components/p-cdbe689e.entry.js +2 -0
- package/dist/mg-components/p-cdbe689e.entry.js.map +1 -0
- package/dist/mg-components/p-d3a868f0.entry.js +2 -0
- package/dist/mg-components/p-d3a868f0.entry.js.map +1 -0
- package/dist/mg-components/p-rLV3KFPd.js +2 -0
- package/dist/mg-components/p-rLV3KFPd.js.map +1 -0
- package/dist/mg-components/p-yMGqY8YG.js +2 -0
- package/dist/mg-components/p-yMGqY8YG.js.map +1 -0
- package/dist/types/components/atoms/mg-tag/mg-tag.d.ts +2 -2
- package/dist/types/components/atoms/mg-tooltip/mg-tooltip.d.ts +6 -6
- package/dist/types/components/molecules/inputs/mg-input/mg-input.d.ts +1 -4
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox-paginated/mg-input-checkbox-paginated.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-checkbox/mg-input-checkbox.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.conf.d.ts +24 -0
- package/dist/types/components/molecules/inputs/mg-input-combobox/mg-input-combobox.d.ts +340 -0
- package/dist/types/components/molecules/inputs/mg-input-date/mg-input-date.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-numeric/mg-input-numeric.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-password/mg-input-password.d.ts +2 -2
- package/dist/types/components/molecules/inputs/mg-input-rich-text-editor/mg-input-rich-text-editor.d.ts +9 -9
- package/dist/types/components/molecules/inputs/mg-input-select/mg-input-select.d.ts +1 -1
- package/dist/types/components/molecules/inputs/mg-input-text/mg-input-text.d.ts +8 -8
- package/dist/types/components/molecules/inputs/mg-input-textarea/mg-input-textarea.d.ts +5 -5
- package/dist/types/components/molecules/inputs/mg-input-toggle/mg-input-toggle.d.ts +1 -1
- package/dist/types/components/molecules/internals/mg-item-more/mg-item-more.conf.d.ts +1 -1
- package/dist/types/components/molecules/mg-action-more/mg-action-more.conf.d.ts +1 -1
- package/dist/types/components/molecules/mg-action-more/mg-action-more.d.ts +1 -1
- package/dist/types/components/molecules/mg-form/mg-form.d.ts +1 -1
- package/dist/types/components/molecules/mg-loader/mg-loader.d.ts +1 -1
- package/dist/types/components/molecules/mg-pagination/mg-pagination.d.ts +2 -2
- package/dist/types/components/molecules/mg-panel/mg-panel.d.ts +1 -1
- package/dist/types/components/molecules/mg-popover/mg-popover.d.ts +6 -9
- package/dist/types/components.d.ts +274 -29
- package/dist/types/stencil-public-runtime.d.ts +1 -0
- package/dist/types/utils/events.utils.d.ts +4 -0
- package/dist/types/utils/floating-ui.utils.d.ts +9 -1
- package/ide/intellij/web-types.json +488 -45
- package/ide/vscode/html-custom-data.json +358 -26
- package/package.json +26 -26
- package/dist/cjs/app-globals-3a1e7e63.js +0 -7
- package/dist/cjs/app-globals-3a1e7e63.js.map +0 -1
- package/dist/cjs/index-1a5a1081.js.map +0 -1
- package/dist/cjs/index-234e834a.js.map +0 -1
- package/dist/cjs/index.es-b90f74d4.js +0 -151
- package/dist/cjs/index.es-b90f74d4.js.map +0 -1
- package/dist/cjs/mg-input.conf-5bbcea79.js.map +0 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.conf.js.map +0 -1
- package/dist/collection/components/molecules/menu/mg-menu/mg-menu.js.map +0 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.conf.js.map +0 -1
- package/dist/collection/components/molecules/menu/mg-menu-item/mg-menu-item.js.map +0 -1
- package/dist/esm/app-globals-0f993ce5.js +0 -5
- package/dist/esm/app-globals-0f993ce5.js.map +0 -1
- package/dist/esm/index-5059254f.js.map +0 -1
- package/dist/esm/index-544778a7.js.map +0 -1
- package/dist/esm/index.es-517b1bf2.js +0 -129
- package/dist/esm/index.es-517b1bf2.js.map +0 -1
- package/dist/esm/mg-input.conf-712c7bb6.js.map +0 -1
- package/dist/mg-components/p-12a1edee.js +0 -2
- package/dist/mg-components/p-12a1edee.js.map +0 -1
- package/dist/mg-components/p-2884f369.js +0 -2
- package/dist/mg-components/p-2884f369.js.map +0 -1
- package/dist/mg-components/p-9bc53279.js +0 -2
- package/dist/mg-components/p-9bc53279.js.map +0 -1
- package/dist/mg-components/p-ad98f3d8.entry.js +0 -2
- package/dist/mg-components/p-ad98f3d8.entry.js.map +0 -1
- package/dist/mg-components/p-c10433db.entry.js +0 -2
- package/dist/mg-components/p-c10433db.entry.js.map +0 -1
- package/dist/mg-components/p-c67e4934.entry.js +0 -2
- package/dist/mg-components/p-c67e4934.entry.js.map +0 -1
- package/dist/mg-components/p-e1255160.js +0 -2
- package/dist/mg-components/p-e1255160.js.map +0 -1
- package/dist/mg-components/p-e39791fa.js +0 -3
- package/dist/mg-components/p-e39791fa.js.map +0 -1
- package/dist/mg-components/p-f72efb64.entry.js +0 -2
- package/dist/mg-components/p-f72efb64.entry.js.map +0 -1
- package/dist/mg-components/p-fd4a7980.entry.js +0 -2
- package/dist/mg-components/p-fd4a7980.entry.js.map +0 -1
- package/loader/package.json +0 -11
- /package/dist/collection/components/molecules/{menu → menus}/mg-menu/mg-menu.conf.js +0 -0
- /package/dist/collection/components/molecules/{menu → menus}/mg-menu-item/mg-menu-item.conf.js +0 -0
- /package/dist/types/components/molecules/{menu → menus}/mg-menu/mg-menu.conf.d.ts +0 -0
- /package/dist/types/components/molecules/{menu → menus}/mg-menu/mg-menu.d.ts +0 -0
- /package/dist/types/components/molecules/{menu → menus}/mg-menu-item/mg-menu-item.conf.d.ts +0 -0
- /package/dist/types/components/molecules/{menu → menus}/mg-menu-item/mg-menu-item.d.ts +0 -0
|
@@ -0,0 +1,774 @@
|
|
|
1
|
+
'use strict';
|
|
2
|
+
|
|
3
|
+
var index = require('./index-CATFkm3O.js');
|
|
4
|
+
var index_es = require('./index.es-BCLy9yYb.js');
|
|
5
|
+
var mgInput_conf = require('./mg-input.conf-WTsvDfpC.js');
|
|
6
|
+
var index$1 = require('./index-CfIlskRh.js');
|
|
7
|
+
var events_utils = require('./events.utils-D5SAtkpQ.js');
|
|
8
|
+
|
|
9
|
+
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__reset{padding-right:var(--mg-b-size-min-height)}.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)*2 + 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)*2 + 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)*2 + 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-c-input-append-x) + 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}";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Check if object is an item
|
|
13
|
+
* @param item - object to check
|
|
14
|
+
* @returns True if object is an item
|
|
15
|
+
*/
|
|
16
|
+
const isItem = (item) => item && typeof item === 'object' && typeof item.title === 'string' && item.value !== undefined;
|
|
17
|
+
/**
|
|
18
|
+
* Check if objects are items
|
|
19
|
+
* @param items - items to check
|
|
20
|
+
* @returns True if objects are items
|
|
21
|
+
*/
|
|
22
|
+
const isItems = (items) => Array.isArray(items) && items.every(isItem);
|
|
23
|
+
/**
|
|
24
|
+
* Check if object is valid combobox fetchmappings
|
|
25
|
+
* @param value - to validate
|
|
26
|
+
* @returns truthy if mapping is valid
|
|
27
|
+
*/
|
|
28
|
+
const isFetchmappings = (value) => {
|
|
29
|
+
const isValidRoot = index_es.ie(value) && Object.hasOwn(value, 'request') && Object.hasOwn(value, 'response');
|
|
30
|
+
if (isValidRoot) {
|
|
31
|
+
const { request, response } = value;
|
|
32
|
+
if ([request, response].some(property => !index_es.ie(property)))
|
|
33
|
+
return false;
|
|
34
|
+
const isValidRequest = typeof request.filter === 'string';
|
|
35
|
+
const isValidResponse = typeof response === 'object' &&
|
|
36
|
+
typeof response.total === 'string' &&
|
|
37
|
+
typeof response.items === 'string' &&
|
|
38
|
+
typeof response.next === 'string' &&
|
|
39
|
+
typeof response.itemTitle === 'string' &&
|
|
40
|
+
typeof response.itemValue === 'string';
|
|
41
|
+
return isValidRequest && isValidResponse;
|
|
42
|
+
}
|
|
43
|
+
else {
|
|
44
|
+
return isValidRoot;
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* Map new URL from old url
|
|
49
|
+
* @param newValue - new URL value
|
|
50
|
+
* @param oldValue - previous URL value
|
|
51
|
+
* @returns updated url
|
|
52
|
+
*/
|
|
53
|
+
const mapUrl = (newValue, oldValue) => {
|
|
54
|
+
if (!Boolean(newValue))
|
|
55
|
+
return;
|
|
56
|
+
else if (URL.canParse(newValue)) {
|
|
57
|
+
return newValue;
|
|
58
|
+
}
|
|
59
|
+
// build new URL
|
|
60
|
+
const params = newValue.includes('?') && newValue.split('?').pop();
|
|
61
|
+
if (Boolean(params)) {
|
|
62
|
+
const { origin, pathname } = new URL(oldValue);
|
|
63
|
+
return `${origin}${pathname}?${params}`;
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
return newValue;
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
const MgInputCombobox = class {
|
|
70
|
+
constructor(hostRef) {
|
|
71
|
+
index.registerInstance(this, hostRef);
|
|
72
|
+
this.valueChange = index.createEvent(this, "value-change");
|
|
73
|
+
this.filterChange = index.createEvent(this, "filter-change");
|
|
74
|
+
this.loadMore = index.createEvent(this, "load-more");
|
|
75
|
+
this.inputValid = index.createEvent(this, "input-valid");
|
|
76
|
+
/************
|
|
77
|
+
* Internal *
|
|
78
|
+
************/
|
|
79
|
+
// Classes
|
|
80
|
+
this.classFocus = 'mg-u-is-focused';
|
|
81
|
+
// hasDisplayedError (triggered by blur event)
|
|
82
|
+
this.hasDisplayedError = false;
|
|
83
|
+
/**
|
|
84
|
+
* Input name
|
|
85
|
+
* If not set the value equals the identifier
|
|
86
|
+
*/
|
|
87
|
+
this.name = this.identifier;
|
|
88
|
+
/**
|
|
89
|
+
* Define if label is displayed on top
|
|
90
|
+
*/
|
|
91
|
+
this.labelOnTop = false;
|
|
92
|
+
/**
|
|
93
|
+
* Define if label is visible
|
|
94
|
+
*/
|
|
95
|
+
this.labelHide = false;
|
|
96
|
+
/**
|
|
97
|
+
* Define if input is required
|
|
98
|
+
*/
|
|
99
|
+
this.required = false;
|
|
100
|
+
/**
|
|
101
|
+
* Define if input is readonly
|
|
102
|
+
*/
|
|
103
|
+
this.readonly = false;
|
|
104
|
+
/**
|
|
105
|
+
* Define if input is disabled
|
|
106
|
+
*/
|
|
107
|
+
this.disabled = false;
|
|
108
|
+
/**
|
|
109
|
+
* Define input width
|
|
110
|
+
*/
|
|
111
|
+
this.mgWidth = 'full';
|
|
112
|
+
/**
|
|
113
|
+
* Define tooltip position
|
|
114
|
+
*/
|
|
115
|
+
this.tooltipPosition = 'input';
|
|
116
|
+
/**
|
|
117
|
+
* Formated items for display
|
|
118
|
+
*/
|
|
119
|
+
this.options = new index_es.Yt([]);
|
|
120
|
+
/**
|
|
121
|
+
* Option filter
|
|
122
|
+
*/
|
|
123
|
+
this.filter = '';
|
|
124
|
+
/**
|
|
125
|
+
* Component classes
|
|
126
|
+
*/
|
|
127
|
+
this.classCollection = new index_es.Zt(['mg-c-input--combobox', 'mg-c-input--has-icon', 'mg-c-input--input-append']);
|
|
128
|
+
/**
|
|
129
|
+
* Popover display state
|
|
130
|
+
*/
|
|
131
|
+
this.popoverDisplay = false;
|
|
132
|
+
/**
|
|
133
|
+
* Handle `click` event on option
|
|
134
|
+
* @param event - option element click event
|
|
135
|
+
*/
|
|
136
|
+
this.handleOptionClick = (event) => {
|
|
137
|
+
this.setValue(this.options.items.find(option => option.value === event.target.id));
|
|
138
|
+
this.popoverDisplay = false;
|
|
139
|
+
};
|
|
140
|
+
/**
|
|
141
|
+
* Handle `click` event on reset button
|
|
142
|
+
* @param event - click event
|
|
143
|
+
*/
|
|
144
|
+
this.handleResetButton = (event) => {
|
|
145
|
+
event.stopPropagation();
|
|
146
|
+
this.reset().then(() => {
|
|
147
|
+
this.input.focus();
|
|
148
|
+
});
|
|
149
|
+
};
|
|
150
|
+
/**
|
|
151
|
+
* Handle `display-change` event on mg-popover
|
|
152
|
+
*/
|
|
153
|
+
this.handlePopoverDisplay = (event) => {
|
|
154
|
+
this.popoverDisplay = event.detail;
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* Handle input event
|
|
158
|
+
*/
|
|
159
|
+
this.handleFilterInput = () => {
|
|
160
|
+
this.checkValidity();
|
|
161
|
+
if (this.hasDisplayedError)
|
|
162
|
+
this.setErrorMessage();
|
|
163
|
+
if (!this.popoverDisplay)
|
|
164
|
+
this.popoverDisplay = true;
|
|
165
|
+
this.filter = this.input.value;
|
|
166
|
+
};
|
|
167
|
+
/**
|
|
168
|
+
* Handle `blur` event
|
|
169
|
+
*/
|
|
170
|
+
this.handleFilterBlur = () => {
|
|
171
|
+
// skip process if popover is displayed
|
|
172
|
+
if (this.popoverDisplay)
|
|
173
|
+
return;
|
|
174
|
+
// Display Error
|
|
175
|
+
this.handlerInProgress = 'blur';
|
|
176
|
+
this.displayError().finally(() => {
|
|
177
|
+
// reset guard
|
|
178
|
+
this.handlerInProgress = undefined;
|
|
179
|
+
});
|
|
180
|
+
};
|
|
181
|
+
/**
|
|
182
|
+
* Handle `focus` event
|
|
183
|
+
*/
|
|
184
|
+
this.handleFilterFocus = () => {
|
|
185
|
+
// ensure visual focus is always clear on focus when component isn't in loading state
|
|
186
|
+
if (!this.isLoading) {
|
|
187
|
+
this.option = null;
|
|
188
|
+
}
|
|
189
|
+
};
|
|
190
|
+
/**
|
|
191
|
+
* Handle load-more <mg-button> `click`
|
|
192
|
+
*/
|
|
193
|
+
this.handleLoadMoreButton = () => {
|
|
194
|
+
this.loadingWrapper({ name: 'load-more', cursor: index_es.Kt.NEXT }).then(() => {
|
|
195
|
+
this.input.focus();
|
|
196
|
+
});
|
|
197
|
+
};
|
|
198
|
+
/**
|
|
199
|
+
* Handle `keypress` event
|
|
200
|
+
* @param event - keyboard event
|
|
201
|
+
*/
|
|
202
|
+
this.handleFilterKeydown = (event) => {
|
|
203
|
+
if (this.disabled || event.ctrlKey || event.shiftKey)
|
|
204
|
+
return;
|
|
205
|
+
let guard = false;
|
|
206
|
+
// override keys actions
|
|
207
|
+
switch (event.key) {
|
|
208
|
+
case events_utils.Keys.TAB:
|
|
209
|
+
case events_utils.Keys.ENTER:
|
|
210
|
+
guard = event.key === events_utils.Keys.ENTER;
|
|
211
|
+
const option = this.option || this.options.items.find(this.isCurrentOption);
|
|
212
|
+
// Sets the value to the content of the focused option in the listbox.
|
|
213
|
+
if (this.popoverDisplay)
|
|
214
|
+
this.setValue(this.page.total > 0 ? option : null);
|
|
215
|
+
// Closes the popover.
|
|
216
|
+
this.popoverDisplay = false;
|
|
217
|
+
break;
|
|
218
|
+
case events_utils.Keys.DOWN:
|
|
219
|
+
case events_utils.Keys.ARROWDOWN:
|
|
220
|
+
case events_utils.Keys.UP:
|
|
221
|
+
case events_utils.Keys.ARROWUP:
|
|
222
|
+
guard = true;
|
|
223
|
+
if (this.isLoading || !(this.page.total > 0)) {
|
|
224
|
+
this.popoverDisplay = true;
|
|
225
|
+
break;
|
|
226
|
+
}
|
|
227
|
+
if (Boolean(event.altKey) && [events_utils.Keys.DOWN, events_utils.Keys.ARROWDOWN].includes(event.key)) {
|
|
228
|
+
// Opens the popover without moving focus or changing selection.
|
|
229
|
+
this.popoverDisplay = true;
|
|
230
|
+
break;
|
|
231
|
+
}
|
|
232
|
+
// define cursor
|
|
233
|
+
let cursor;
|
|
234
|
+
const isNavigationStart = this.popoverDisplay && isItem(this.option);
|
|
235
|
+
if ([events_utils.Keys.DOWN, events_utils.Keys.ARROWDOWN].includes(event.key)) {
|
|
236
|
+
// If the filter is not empty and the popover is displayed, moves visual focus to the first suggested value.
|
|
237
|
+
// If the filter is empty and the popover is not displayed, opens the popover and moves visual focus to the first option.
|
|
238
|
+
// Moves visual focus to the next option.
|
|
239
|
+
// If visual focus is on the last option, moves visual focus to the first option.
|
|
240
|
+
cursor = isNavigationStart ? index_es.Kt.NEXT : index_es.Kt.FIRST;
|
|
241
|
+
}
|
|
242
|
+
else if ([events_utils.Keys.UP, events_utils.Keys.ARROWUP].includes(event.key)) {
|
|
243
|
+
// If the filter is not empty and the popover is displayed, moves visual focus to the last suggested value.
|
|
244
|
+
// If the filter is empty, first opens the popover if it is not already displayed and then moves visual focus to the last option.
|
|
245
|
+
// Moves visual focus to the previous option.
|
|
246
|
+
// If visual focus is on the first option, moves visual focus to the last option.
|
|
247
|
+
cursor = isNavigationStart ? index_es.Kt.PREVIOUS : index_es.Kt.LAST;
|
|
248
|
+
}
|
|
249
|
+
// update scroll and visual focused option in wrapper
|
|
250
|
+
this.loadingWrapper({ name: 'scroll', cursor });
|
|
251
|
+
// open popover
|
|
252
|
+
this.popoverDisplay = true;
|
|
253
|
+
break;
|
|
254
|
+
case events_utils.Keys.LEFT:
|
|
255
|
+
case events_utils.Keys.ARROWLEFT:
|
|
256
|
+
case events_utils.Keys.HOME:
|
|
257
|
+
case events_utils.Keys.RIGHT:
|
|
258
|
+
case events_utils.Keys.ARROWRIGHT:
|
|
259
|
+
case events_utils.Keys.END:
|
|
260
|
+
// skip process if visual focus is not in popover
|
|
261
|
+
if (!isItem(this.option))
|
|
262
|
+
break;
|
|
263
|
+
guard = true;
|
|
264
|
+
// Remove visual focus from popover options
|
|
265
|
+
this.option = null;
|
|
266
|
+
let index;
|
|
267
|
+
if (events_utils.Keys.HOME === event.key) {
|
|
268
|
+
// Moves visual focus to the textbox and places the editing cursor at the beginning of the field.
|
|
269
|
+
index = 0;
|
|
270
|
+
}
|
|
271
|
+
else if (events_utils.Keys.END === event.key) {
|
|
272
|
+
// Moves visual focus to the textbox and places the editing cursor at the end of the field.
|
|
273
|
+
index = this.filter.length;
|
|
274
|
+
}
|
|
275
|
+
if (typeof index === 'number') {
|
|
276
|
+
this.input.setSelectionRange(index, index);
|
|
277
|
+
}
|
|
278
|
+
break;
|
|
279
|
+
case events_utils.Keys.ESC:
|
|
280
|
+
case events_utils.Keys.ESCAPE:
|
|
281
|
+
guard = true;
|
|
282
|
+
if (this.popoverDisplay) {
|
|
283
|
+
// If the popover is displayed, closes it.
|
|
284
|
+
this.popoverDisplay = false;
|
|
285
|
+
}
|
|
286
|
+
else {
|
|
287
|
+
// If the popover is not displayed, clears the filter.
|
|
288
|
+
this.setValue(null);
|
|
289
|
+
this.filter = '';
|
|
290
|
+
// Sets visual focus on the textbox.
|
|
291
|
+
this.option = null;
|
|
292
|
+
}
|
|
293
|
+
break;
|
|
294
|
+
default:
|
|
295
|
+
// Remove visual focus from popover options
|
|
296
|
+
this.option = null;
|
|
297
|
+
break;
|
|
298
|
+
}
|
|
299
|
+
if (guard) {
|
|
300
|
+
event.stopPropagation();
|
|
301
|
+
event.preventDefault();
|
|
302
|
+
}
|
|
303
|
+
};
|
|
304
|
+
/**
|
|
305
|
+
* Scroll to next option from cursor
|
|
306
|
+
* @param index - targeted option index to scroll into
|
|
307
|
+
*/
|
|
308
|
+
this.scrollToIndex = (index) => {
|
|
309
|
+
var _a;
|
|
310
|
+
(_a = this.element.shadowRoot.querySelector(`li:nth-of-type(${(index || 0) + this.page.baseIndex})`)) === null || _a === void 0 ? void 0 : _a.scrollIntoView();
|
|
311
|
+
};
|
|
312
|
+
/**
|
|
313
|
+
* Is option the current value
|
|
314
|
+
* @param option - option to match with
|
|
315
|
+
* @returns true if option is the current value
|
|
316
|
+
*/
|
|
317
|
+
this.isCurrentOption = (option) => (isItem(this.value) ? this.value.value : this.value) === option.value;
|
|
318
|
+
/**
|
|
319
|
+
* get value prop title
|
|
320
|
+
* @returns value title
|
|
321
|
+
*/
|
|
322
|
+
this.getValueTitle = () => {
|
|
323
|
+
if (this.value && isItem(this.value))
|
|
324
|
+
return this.value.title;
|
|
325
|
+
else if (typeof this.value === 'string')
|
|
326
|
+
return this.value;
|
|
327
|
+
else
|
|
328
|
+
return '';
|
|
329
|
+
};
|
|
330
|
+
/**
|
|
331
|
+
* Check if input is valid
|
|
332
|
+
*/
|
|
333
|
+
this.checkValidity = () => {
|
|
334
|
+
this.setValidity(this.readonly || this.disabled || this.input.checkValidity());
|
|
335
|
+
};
|
|
336
|
+
/**
|
|
337
|
+
* Set input error message
|
|
338
|
+
* @param errorMessage - errorMessage override
|
|
339
|
+
*/
|
|
340
|
+
this.setErrorMessage = (errorMessage) => {
|
|
341
|
+
// Set error message
|
|
342
|
+
this.errorMessage = undefined;
|
|
343
|
+
// Does have a custom error message
|
|
344
|
+
if (!this.valid && errorMessage !== undefined) {
|
|
345
|
+
this.errorMessage = errorMessage;
|
|
346
|
+
}
|
|
347
|
+
// required
|
|
348
|
+
else if (!this.valid && this.input.validity.valueMissing) {
|
|
349
|
+
this.errorMessage = this.messages.errors.required;
|
|
350
|
+
}
|
|
351
|
+
};
|
|
352
|
+
/**
|
|
353
|
+
* Get filtered options from `filter` input value
|
|
354
|
+
* @returns filtered options
|
|
355
|
+
*/
|
|
356
|
+
this.optionsFilter = (option) => (this.filter === '' ? true : option.title.toLocaleLowerCase().includes(this.filter.toLocaleLowerCase()));
|
|
357
|
+
/**
|
|
358
|
+
* Loading wrapper with a given action
|
|
359
|
+
* @param action - wrapped loading action
|
|
360
|
+
* @returns promisified action
|
|
361
|
+
*/
|
|
362
|
+
this.loadingWrapper = (action) => {
|
|
363
|
+
let promise;
|
|
364
|
+
let index;
|
|
365
|
+
// cache initial loading action if not defined
|
|
366
|
+
if (!Boolean(this.loadingAction)) {
|
|
367
|
+
this.loadingAction = action.name;
|
|
368
|
+
}
|
|
369
|
+
// update index
|
|
370
|
+
if (Boolean(this.option) && this.loadingAction !== 'load-more') {
|
|
371
|
+
index = this.page.items.findIndex(option => option.value.toString() === this.option.value.toString());
|
|
372
|
+
}
|
|
373
|
+
else if (this.loadingAction === 'load-more') {
|
|
374
|
+
index = this.page.items.length - this.page.baseIndex;
|
|
375
|
+
}
|
|
376
|
+
// when action require a loadMore we fetch the API else we report action to next tick
|
|
377
|
+
// Set "load more" if action match OR if next item not available in the current page
|
|
378
|
+
if (action.name === 'load-more') {
|
|
379
|
+
// wait for new element render and update scroll position
|
|
380
|
+
// set component loading
|
|
381
|
+
this.isLoading = true;
|
|
382
|
+
promise = this.goToNextPage;
|
|
383
|
+
}
|
|
384
|
+
else if (action.cursor === index_es.Kt.NEXT &&
|
|
385
|
+
this.page.items.length <= this.page.total &&
|
|
386
|
+
index + this.page.baseIndex === this.page.items.length &&
|
|
387
|
+
index + this.page.baseIndex < this.page.total) {
|
|
388
|
+
// trigger load-more from button to benefit from `disabled-on-click`
|
|
389
|
+
this.loadMoreElement.click();
|
|
390
|
+
return;
|
|
391
|
+
}
|
|
392
|
+
else if (action.name === 'scroll') {
|
|
393
|
+
promise = index_es.Xt;
|
|
394
|
+
}
|
|
395
|
+
else {
|
|
396
|
+
promise = this.updatePage;
|
|
397
|
+
}
|
|
398
|
+
return promise()
|
|
399
|
+
.then(() => {
|
|
400
|
+
// parse full items list from options
|
|
401
|
+
const options = this.options.items.filter(this.optionsFilter);
|
|
402
|
+
// update visual focus
|
|
403
|
+
if (action.name !== 'load-data') {
|
|
404
|
+
index = this.page.getIndexFromCursor(action.cursor, this.loadingAction === 'load-more' && index >= 0 ? options[index] : this.option);
|
|
405
|
+
}
|
|
406
|
+
this.option = options[index];
|
|
407
|
+
// update scroll position
|
|
408
|
+
this.scrollToIndex(index);
|
|
409
|
+
})
|
|
410
|
+
.finally(() => {
|
|
411
|
+
// reset loading after next render
|
|
412
|
+
requestAnimationFrame(() => {
|
|
413
|
+
this.isLoading = false;
|
|
414
|
+
this.loadingAction = undefined;
|
|
415
|
+
});
|
|
416
|
+
});
|
|
417
|
+
};
|
|
418
|
+
/**
|
|
419
|
+
* Go to next page
|
|
420
|
+
* @returns promise
|
|
421
|
+
*/
|
|
422
|
+
this.goToNextPage = () => {
|
|
423
|
+
this.loadMore.emit();
|
|
424
|
+
if (Boolean(this.fetchurl)) {
|
|
425
|
+
return this.getOptions(typeof this.page.next === 'string' ? this.page.next : undefined).then(nextPage => {
|
|
426
|
+
if (!Boolean(nextPage))
|
|
427
|
+
return;
|
|
428
|
+
// merge items from current page and next page
|
|
429
|
+
const items = [...this.page.items, ...nextPage.items];
|
|
430
|
+
// create new options pagination withe merged items
|
|
431
|
+
this.options = new index_es.Yt(items, { total: nextPage.total, next: nextPage.next, top: items.length });
|
|
432
|
+
});
|
|
433
|
+
}
|
|
434
|
+
else {
|
|
435
|
+
return index_es.Xt(() => {
|
|
436
|
+
if (typeof this.page.next === 'function') {
|
|
437
|
+
const nextPage = this.page.next();
|
|
438
|
+
this.page = new index_es.He(Object.assign(Object.assign({}, nextPage), { items: [...this.page.items, ...nextPage.items] }));
|
|
439
|
+
}
|
|
440
|
+
});
|
|
441
|
+
}
|
|
442
|
+
};
|
|
443
|
+
/**
|
|
444
|
+
* Go to next page
|
|
445
|
+
* @returns promise
|
|
446
|
+
*/
|
|
447
|
+
this.updatePage = async () => {
|
|
448
|
+
if (Boolean(this.fetchurl)) {
|
|
449
|
+
return this.getOptions().then(page => {
|
|
450
|
+
if (!Boolean(page))
|
|
451
|
+
return;
|
|
452
|
+
// reset current options pagination from API response
|
|
453
|
+
this.options = new index_es.Yt(page.items, { total: page.total, next: page.next, top: page.top });
|
|
454
|
+
});
|
|
455
|
+
}
|
|
456
|
+
else {
|
|
457
|
+
this.page = this.options.getPage(0, this.optionsFilter);
|
|
458
|
+
}
|
|
459
|
+
};
|
|
460
|
+
/**
|
|
461
|
+
* Fetch request
|
|
462
|
+
* @param url - to fetch
|
|
463
|
+
* @returns new page from url
|
|
464
|
+
*/
|
|
465
|
+
this.getOptions = async (url = this.fetchurl) => {
|
|
466
|
+
// add text filter
|
|
467
|
+
const updateUrl = (typeof url === 'string' ? url : url.toString()).replaceAll(this.fetchmappings.request.filter, encodeURIComponent(this.filter));
|
|
468
|
+
try {
|
|
469
|
+
const response = await fetch(updateUrl, this.fetchoptions).then(response => response.json());
|
|
470
|
+
if (!response)
|
|
471
|
+
return null;
|
|
472
|
+
const items = index_es.qe(response, this.fetchmappings.response.items).map((item) => ({
|
|
473
|
+
title: index_es.qe(item, this.fetchmappings.response.itemTitle),
|
|
474
|
+
value: index_es.qe(item, this.fetchmappings.response.itemValue),
|
|
475
|
+
}));
|
|
476
|
+
const total = Number(index_es.qe(response, this.fetchmappings.response.total, 0));
|
|
477
|
+
const next = mapUrl(index_es.qe(response, this.fetchmappings.response.next), this.fetchurl.toString());
|
|
478
|
+
return { items, total, next, top: items.length };
|
|
479
|
+
}
|
|
480
|
+
catch (_a) { }
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
watchValue(newValue) {
|
|
484
|
+
this.filter = this.getValueTitle();
|
|
485
|
+
this.valueChange.emit(newValue);
|
|
486
|
+
}
|
|
487
|
+
watchItems(newValue) {
|
|
488
|
+
if (Boolean(this.fetchurl) && !Boolean(newValue)) {
|
|
489
|
+
// skip newValue check
|
|
490
|
+
return;
|
|
491
|
+
}
|
|
492
|
+
else if (Boolean(this.fetchurl) && Boolean(newValue)) {
|
|
493
|
+
throw new Error(`<mg-input-combobox> prop "items" values cannot be use with "fetchurl" prop defined. Passed value: ${index_es.Gt(newValue)}.`);
|
|
494
|
+
}
|
|
495
|
+
// Empty options
|
|
496
|
+
else if (Array.isArray(newValue) && newValue.length === 0) {
|
|
497
|
+
this.options = new index_es.Yt([]);
|
|
498
|
+
}
|
|
499
|
+
// String array
|
|
500
|
+
else if (index_es.Dt(newValue)) {
|
|
501
|
+
this.options = new index_es.Yt(newValue.map(item => ({ title: item, value: item })), { total: newValue.length });
|
|
502
|
+
}
|
|
503
|
+
// Object array
|
|
504
|
+
else if (isItems(newValue)) {
|
|
505
|
+
this.options = new index_es.Yt(newValue, { total: newValue.length });
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
throw new Error(`<mg-input-combobox> prop "items" values must be the same type, string or Option. Passed value: ${index_es.Gt(newValue)}.`);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
watchIdentifier(newValue) {
|
|
512
|
+
if (Boolean(newValue)) {
|
|
513
|
+
this.popoverId = `${newValue}-popover`;
|
|
514
|
+
this.element.dataset.mgPopoverGuard = this.popoverId;
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
watchReadonly(newValue) {
|
|
518
|
+
if (newValue)
|
|
519
|
+
this.classCollection.add(mgInput_conf.classReadonly);
|
|
520
|
+
else
|
|
521
|
+
this.classCollection.delete(mgInput_conf.classReadonly);
|
|
522
|
+
}
|
|
523
|
+
watchValidityChange(newValue, _oldValue, prop) {
|
|
524
|
+
if (this.input === undefined)
|
|
525
|
+
return;
|
|
526
|
+
this.input[prop] = newValue;
|
|
527
|
+
this.checkValidity();
|
|
528
|
+
if (this.hasDisplayedError) {
|
|
529
|
+
this.setErrorMessage();
|
|
530
|
+
this.hasDisplayedError = false;
|
|
531
|
+
}
|
|
532
|
+
}
|
|
533
|
+
watchDisabled(newValue) {
|
|
534
|
+
if (newValue) {
|
|
535
|
+
this.classCollection.add(mgInput_conf.classDisabled);
|
|
536
|
+
}
|
|
537
|
+
else {
|
|
538
|
+
this.classCollection.delete(mgInput_conf.classDisabled);
|
|
539
|
+
}
|
|
540
|
+
}
|
|
541
|
+
watchMgWidth(newValue) {
|
|
542
|
+
// reset width class
|
|
543
|
+
mgInput_conf.widths.forEach(width => {
|
|
544
|
+
this.classCollection.delete(`mg-c-input--width-${width}`);
|
|
545
|
+
});
|
|
546
|
+
// apply new width
|
|
547
|
+
if (newValue !== undefined)
|
|
548
|
+
this.classCollection.add(`mg-c-input--width-${this.mgWidth}`);
|
|
549
|
+
this.classCollection = new index_es.Zt(this.classCollection.classes);
|
|
550
|
+
}
|
|
551
|
+
watchFetchUrl(newValue) {
|
|
552
|
+
if (newValue && !URL.canParse(newValue)) {
|
|
553
|
+
throw new Error(`<mg-input-combobox> prop "fetchurl" value must be URL or string. Passed value: ${index_es.Gt(newValue)}.`);
|
|
554
|
+
}
|
|
555
|
+
}
|
|
556
|
+
watchFetchOptions(newValue) {
|
|
557
|
+
if (this.fetchurl && newValue && !index_es.ie(newValue)) {
|
|
558
|
+
throw new Error(`<mg-input-combobox> prop "fetchoptions" value must be a valid RequestInit. Passed value: ${index_es.Gt(newValue)}.`);
|
|
559
|
+
}
|
|
560
|
+
else {
|
|
561
|
+
new Request(this.fetchurl, newValue);
|
|
562
|
+
}
|
|
563
|
+
}
|
|
564
|
+
watchFetchMappings(newValue) {
|
|
565
|
+
if (Boolean(this.fetchurl) && !Boolean(newValue)) {
|
|
566
|
+
throw new Error(`<mg-input-combobox> prop "fetchmappings" is required with "fetchurl" prop.`);
|
|
567
|
+
}
|
|
568
|
+
else if (Boolean(newValue) && !isFetchmappings(newValue)) {
|
|
569
|
+
throw new Error(`<mg-input-combobox> prop "fetchmappings" value must be { request: RequestMappingType, response: ResponseMappingType }. Passed value: ${index_es.Gt(newValue)}.`);
|
|
570
|
+
}
|
|
571
|
+
}
|
|
572
|
+
watchOptions(newValue) {
|
|
573
|
+
this.page = newValue.getPage(0, Boolean(this.filter) ? this.optionsFilter : undefined);
|
|
574
|
+
}
|
|
575
|
+
watchFilter(newValue) {
|
|
576
|
+
this.loadingWrapper({ name: 'load-data' });
|
|
577
|
+
this.filterChange.emit(newValue);
|
|
578
|
+
}
|
|
579
|
+
watchPopoverDisplay(newValue) {
|
|
580
|
+
if (newValue) {
|
|
581
|
+
this.classCollection.add(this.classFocus);
|
|
582
|
+
this.input.focus();
|
|
583
|
+
this.scrollToIndex(0);
|
|
584
|
+
}
|
|
585
|
+
else {
|
|
586
|
+
// remove visual focus
|
|
587
|
+
this.option = null;
|
|
588
|
+
// reset filter with value
|
|
589
|
+
this.filter = this.getValueTitle();
|
|
590
|
+
this.classCollection.delete(this.classFocus);
|
|
591
|
+
this.handlerInProgress = 'blur';
|
|
592
|
+
this.displayError().finally(() => {
|
|
593
|
+
// reset guard
|
|
594
|
+
this.handlerInProgress = undefined;
|
|
595
|
+
});
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
/**
|
|
599
|
+
* Public method to play input focus
|
|
600
|
+
*/
|
|
601
|
+
async setFocus() {
|
|
602
|
+
this.input.focus();
|
|
603
|
+
}
|
|
604
|
+
/**
|
|
605
|
+
* Display input error if it exists.
|
|
606
|
+
*/
|
|
607
|
+
displayError() {
|
|
608
|
+
// Use `Promise` as requested for stencil method
|
|
609
|
+
// Use `requestAnimationFrame` to ensure:
|
|
610
|
+
// - DOM is fully updated before validation
|
|
611
|
+
// - Async operations are completed
|
|
612
|
+
// - No timing issues with Stencil's render cycle
|
|
613
|
+
// - Keep everything in sync both inside and outside the component
|
|
614
|
+
return new Promise(resolve => {
|
|
615
|
+
requestAnimationFrame(() => {
|
|
616
|
+
this.checkValidity();
|
|
617
|
+
this.setErrorMessage();
|
|
618
|
+
this.hasDisplayedError = this.invalid;
|
|
619
|
+
resolve();
|
|
620
|
+
});
|
|
621
|
+
});
|
|
622
|
+
}
|
|
623
|
+
/**
|
|
624
|
+
* Set an error and display a custom error message.
|
|
625
|
+
* This method can be used to set the component's error state from its concombobox by passing a boolean value to the `valid` parameter.
|
|
626
|
+
* It must be paired with an error message to display for the given concombobox.
|
|
627
|
+
* When used to set validity to `false`, you should use this method again to reset the validity to `true`.
|
|
628
|
+
* @param valid - value indicating the validity
|
|
629
|
+
* @param errorMessage - the error message to display
|
|
630
|
+
*/
|
|
631
|
+
async setError(valid, errorMessage) {
|
|
632
|
+
if (typeof valid !== 'boolean') {
|
|
633
|
+
throw new Error('<mg-input-combobox> method "setError()" param "valid" must be a boolean.');
|
|
634
|
+
}
|
|
635
|
+
else if (!index_es.De(errorMessage)) {
|
|
636
|
+
throw new Error('<mg-input-combobox> method "setError()" param "errorMessage" must be a string.');
|
|
637
|
+
}
|
|
638
|
+
else {
|
|
639
|
+
this.setValidity(valid);
|
|
640
|
+
this.setErrorMessage(valid ? undefined : errorMessage);
|
|
641
|
+
this.hasDisplayedError = this.invalid;
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
/**
|
|
645
|
+
* Reset value, validity and error state
|
|
646
|
+
*/
|
|
647
|
+
async reset() {
|
|
648
|
+
if (this.readonly)
|
|
649
|
+
return;
|
|
650
|
+
this.setValue(null);
|
|
651
|
+
this.option = null;
|
|
652
|
+
this.filter = '';
|
|
653
|
+
this.checkValidity();
|
|
654
|
+
this.errorMessage = undefined;
|
|
655
|
+
this.hasDisplayedError = false;
|
|
656
|
+
}
|
|
657
|
+
/**
|
|
658
|
+
* Set value prop
|
|
659
|
+
* @param newValue - slected option item
|
|
660
|
+
*/
|
|
661
|
+
setValue(newValue) {
|
|
662
|
+
if (!isItem(newValue)) {
|
|
663
|
+
this.value = '';
|
|
664
|
+
}
|
|
665
|
+
else {
|
|
666
|
+
this.value = index_es.Dt(this.items || this.options.items) ? newValue.title : Object.assign({}, newValue);
|
|
667
|
+
}
|
|
668
|
+
}
|
|
669
|
+
/**
|
|
670
|
+
* Method to set validity values
|
|
671
|
+
* @param newValue - valid new value
|
|
672
|
+
*/
|
|
673
|
+
setValidity(newValue) {
|
|
674
|
+
const oldValidValue = this.valid;
|
|
675
|
+
this.valid = newValue;
|
|
676
|
+
this.invalid = !this.valid;
|
|
677
|
+
// We need to send valid event even if it is the same value
|
|
678
|
+
if (this.handlerInProgress === undefined || (this.handlerInProgress === 'blur' && this.valid !== oldValidValue))
|
|
679
|
+
this.inputValid.emit(this.valid);
|
|
680
|
+
}
|
|
681
|
+
/*************
|
|
682
|
+
* Lifecycle *
|
|
683
|
+
*************/
|
|
684
|
+
/**
|
|
685
|
+
* Check if component props are well configured on init
|
|
686
|
+
* @returns timeout
|
|
687
|
+
*/
|
|
688
|
+
componentWillLoad() {
|
|
689
|
+
// Get locales
|
|
690
|
+
this.messages = index$1.initLocales(this.element).messages;
|
|
691
|
+
// Validate
|
|
692
|
+
this.watchIdentifier(this.identifier);
|
|
693
|
+
this.watchItems(this.items);
|
|
694
|
+
if (Boolean(this.fetchurl)) {
|
|
695
|
+
this.watchFetchUrl(this.fetchurl);
|
|
696
|
+
this.watchFetchOptions(this.fetchoptions);
|
|
697
|
+
this.watchFetchMappings(this.fetchmappings);
|
|
698
|
+
this.loadingWrapper({ name: 'load-data' });
|
|
699
|
+
}
|
|
700
|
+
this.watchValue(this.value);
|
|
701
|
+
this.watchOptions(this.options);
|
|
702
|
+
this.watchMgWidth(this.mgWidth);
|
|
703
|
+
this.watchReadonly(this.readonly);
|
|
704
|
+
this.watchDisabled(this.disabled);
|
|
705
|
+
// Check validity when component is ready
|
|
706
|
+
// return a promise to process action only in the FIRST render().
|
|
707
|
+
// https://stenciljs.com/docs/component-lifecycle#componentwillload
|
|
708
|
+
return setTimeout(() => {
|
|
709
|
+
this.checkValidity();
|
|
710
|
+
}, 0);
|
|
711
|
+
}
|
|
712
|
+
/**
|
|
713
|
+
* Render
|
|
714
|
+
* @returns HTML Element
|
|
715
|
+
*/
|
|
716
|
+
render() {
|
|
717
|
+
var _a, _b, _c, _d, _e, _f;
|
|
718
|
+
const listId = `${this.identifier}-list`;
|
|
719
|
+
const readonlyValue = this.getValueTitle();
|
|
720
|
+
const withResetButton = this.value && !this.disabled;
|
|
721
|
+
let popoverContent;
|
|
722
|
+
if (((_a = this.page) === null || _a === void 0 ? void 0 : _a.items.length) > 0)
|
|
723
|
+
popoverContent = 'list';
|
|
724
|
+
else if (((_b = this.page) === null || _b === void 0 ? void 0 : _b.items.length) === 0 && Boolean(this.filter))
|
|
725
|
+
popoverContent = 'notfound';
|
|
726
|
+
else if (((_c = this.page) === null || _c === void 0 ? void 0 : _c.items.length) === 0)
|
|
727
|
+
popoverContent = 'notavailable';
|
|
728
|
+
return (index.h("mg-input", { key: 'b8c4c6d18bb1d16ff0a8494ddb698cb4e0198e43', 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 && index.h("b", { class: "mg-c-input__readonly-value" }, readonlyValue)) : (index.h("mg-popover", { identifier: this.popoverId, placement: "bottom-start", display: this.popoverDisplay, "arrow-hide": true, style: {
|
|
729
|
+
'--mg-c-input-list-width': Boolean((_d = this.input) === null || _d === void 0 ? void 0 : _d.offsetWidth) ? `${this.input.offsetWidth}px` : undefined,
|
|
730
|
+
'--mg-c-input-append-x': withResetButton ? '2' : '1',
|
|
731
|
+
}, "data-fallback-placement": "bottom-end", "onDisplay-change": this.handlePopoverDisplay }, index.h("div", { class: "mg-c-input__input-group-container" }, index.h("mg-icon", { icon: "magnifying-glass" }), index.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": Boolean((_e = this.option) === null || _e === void 0 ? void 0 : _e.value) ? this.option.value : typeof this.value === 'string' ? this.value : (_f = this.value) === null || _f === void 0 ? void 0 : _f.value, onInput: this.handleFilterInput, onBlur: this.handleFilterBlur, onFocus: this.handleFilterFocus, onKeyDown: this.handleFilterKeydown, ref: (el) => {
|
|
732
|
+
if (el !== null)
|
|
733
|
+
this.input = el;
|
|
734
|
+
} }), withResetButton && (index.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 }, index.h("mg-icon", { icon: "cross" }))), index.h("mg-button", { class: "mg-c-input__box-append", variant: "flat", "is-icon": true, label: this.itemsLabel, tabindex: "-1", disabled: this.disabled }, index.h("mg-icon", { icon: `chevron-${this.popoverDisplay ? 'up' : 'down'}` }))), index.h("div", { slot: "content", class: "mg-c-input__popover-container" }, popoverContent === 'list' && [
|
|
735
|
+
// eslint-disable-next-line jsx-a11y/role-supports-aria-props
|
|
736
|
+
index.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 => {
|
|
737
|
+
return (
|
|
738
|
+
// eslint-disable-next-line jsx-a11y/click-events-have-key-events
|
|
739
|
+
index.h("li", { role: "option", class: {
|
|
740
|
+
'mg-c-input__input-list-item': true,
|
|
741
|
+
'mg-c-input__input-list-item--focus-visible': this.option === option,
|
|
742
|
+
'mg-c-input__input-list-item--selected': this.isCurrentOption(option),
|
|
743
|
+
}, key: option.title, id: option.value.toString(), "aria-selected": this.isCurrentOption(option).toString(), onClick: this.handleOptionClick }, option.title, this.isCurrentOption(option) && index.h("mg-icon", { icon: "check" })));
|
|
744
|
+
})),
|
|
745
|
+
this.isLoading && index.h("mg-loader", { key: "loader", message: this.messages.input.combobox.search, class: { 'mg-u-visually-hidden': Boolean(this.page.next) } }),
|
|
746
|
+
this.page.next && (index.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) => {
|
|
747
|
+
if (el !== null)
|
|
748
|
+
this.loadMoreElement = el;
|
|
749
|
+
} }, index.h("mg-icon", { icon: "chevron-down" }), this.messages.input.combobox.loadMore)),
|
|
750
|
+
], popoverContent === 'notfound' && (index.h("p", { id: popoverContent, class: "mg-c-input__popover-info" }, this.messages.input.combobox.notFound)), popoverContent === 'notavailable' && (index.h("p", { id: popoverContent, class: "mg-c-input__popover-info" }, this.messages.input.combobox.notAvailable)))))));
|
|
751
|
+
}
|
|
752
|
+
get element() { return index.getElement(this); }
|
|
753
|
+
static get watchers() { return {
|
|
754
|
+
"value": ["watchValue"],
|
|
755
|
+
"items": ["watchItems"],
|
|
756
|
+
"identifier": ["watchIdentifier"],
|
|
757
|
+
"readonly": ["watchReadonly", "watchValidityChange"],
|
|
758
|
+
"required": ["watchValidityChange"],
|
|
759
|
+
"disabled": ["watchValidityChange", "watchDisabled"],
|
|
760
|
+
"mgWidth": ["watchMgWidth"],
|
|
761
|
+
"fetchurl": ["watchFetchUrl"],
|
|
762
|
+
"fetchoptions": ["watchFetchOptions"],
|
|
763
|
+
"fetchmappings": ["watchFetchMappings"],
|
|
764
|
+
"options": ["watchOptions"],
|
|
765
|
+
"filter": ["watchFilter"],
|
|
766
|
+
"popoverDisplay": ["watchPopoverDisplay"]
|
|
767
|
+
}; }
|
|
768
|
+
};
|
|
769
|
+
MgInputCombobox.style = mgInputComboboxCss;
|
|
770
|
+
|
|
771
|
+
exports.mg_input_combobox = MgInputCombobox;
|
|
772
|
+
//# sourceMappingURL=mg-input-combobox.entry.cjs.js.map
|
|
773
|
+
|
|
774
|
+
//# sourceMappingURL=mg-input-combobox.cjs.entry.js.map
|