wcs-core 4.2.0 → 5.0.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/{accessibility-e99b032d.js → accessibility-c0c4e648.js} +8 -2
- package/dist/cjs/accessibility-c0c4e648.js.map +1 -0
- package/dist/cjs/button-interface-044a8a8a.js +12 -0
- package/dist/cjs/button-interface-044a8a8a.js.map +1 -0
- package/dist/cjs/grid-pagination-3511fdfa.js +111 -0
- package/dist/cjs/grid-pagination-3511fdfa.js.map +1 -0
- package/dist/cjs/{helpers-4a14051a.js → helpers-6280db6e.js} +75 -2
- package/dist/cjs/helpers-6280db6e.js.map +1 -0
- package/dist/cjs/{index-ca67a6dc.js → index-749d999e.js} +4 -1
- package/dist/cjs/index-749d999e.js.map +1 -0
- package/dist/cjs/{isEqual-9ea7ee49.js → keyboard-event-1cad4036.js} +77 -1
- package/dist/cjs/keyboard-event-1cad4036.js.map +1 -0
- package/dist/cjs/loader.cjs.js +2 -2
- package/dist/cjs/{select-arrow-c9583ea9.js → select-arrow-8169c0cb.js} +2 -2
- package/dist/cjs/{select-arrow-c9583ea9.js.map → select-arrow-8169c0cb.js.map} +1 -1
- package/dist/cjs/wcs-accordion-content.cjs.entry.js +1 -1
- package/dist/cjs/wcs-accordion-header.cjs.entry.js +1 -1
- package/dist/cjs/wcs-accordion-panel.cjs.entry.js +2 -2
- package/dist/cjs/wcs-accordion.cjs.entry.js +1 -1
- package/dist/cjs/wcs-action-bar.cjs.entry.js +1 -1
- package/dist/cjs/wcs-app.cjs.entry.js +1 -1
- package/dist/cjs/wcs-badge.cjs.entry.js +3 -2
- package/dist/cjs/wcs-badge.cjs.entry.js.map +1 -1
- package/dist/cjs/{wcs-button.cjs.entry.js → wcs-button_2.cjs.entry.js} +21 -12
- package/dist/cjs/wcs-button_2.cjs.entry.js.map +1 -0
- package/dist/cjs/wcs-card-body.cjs.entry.js +1 -1
- package/dist/cjs/wcs-card.cjs.entry.js +1 -1
- package/dist/cjs/wcs-checkbox.cjs.entry.js +5 -2
- package/dist/cjs/wcs-checkbox.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-com-nav-category.cjs.entry.js +2 -2
- package/dist/cjs/wcs-com-nav-submenu.cjs.entry.js +2 -2
- package/dist/cjs/wcs-com-nav.cjs.entry.js +2 -2
- package/dist/cjs/wcs-counter.cjs.entry.js +16 -6
- package/dist/cjs/wcs-counter.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-divider.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown-divider.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown-divider.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-dropdown-header.cjs.entry.js +1 -1
- package/dist/cjs/wcs-dropdown-header.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-dropdown-item.cjs.entry.js +2 -2
- package/dist/cjs/wcs-dropdown-item.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-dropdown.cjs.entry.js +12 -6
- package/dist/cjs/wcs-dropdown.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-editable-field.cjs.entry.js +18 -3
- package/dist/cjs/wcs-editable-field.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-error_2.cjs.entry.js +36 -2
- package/dist/cjs/wcs-error_2.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-field-content.cjs.entry.js +1 -1
- package/dist/cjs/wcs-field-label.cjs.entry.js +1 -1
- package/dist/cjs/wcs-field.cjs.entry.js +1 -1
- package/dist/cjs/wcs-footer.cjs.entry.js +1 -1
- package/dist/cjs/wcs-galactic-menu.cjs.entry.js +2 -2
- package/dist/cjs/wcs-galactic.cjs.entry.js +1 -1
- package/dist/cjs/wcs-grid-column.cjs.entry.js +25 -4
- package/dist/cjs/wcs-grid-column.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-grid-custom-cell.cjs.entry.js +1 -1
- package/dist/cjs/wcs-grid-pagination.cjs.entry.js +2 -2
- package/dist/cjs/wcs-grid.cjs.entry.js +320 -65
- package/dist/cjs/wcs-grid.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-header.cjs.entry.js +1 -1
- package/dist/cjs/wcs-hint.cjs.entry.js +1 -1
- package/dist/cjs/wcs-horizontal-stepper.cjs.entry.js +1 -1
- package/dist/cjs/wcs-icon.cjs.entry.js +1 -1
- package/dist/cjs/wcs-input.cjs.entry.js +15 -15
- package/dist/cjs/wcs-input.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-label.cjs.entry.js +1 -1
- package/dist/cjs/wcs-label.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-list-item-properties.cjs.entry.js +1 -1
- package/dist/cjs/wcs-list-item-property.cjs.entry.js +1 -1
- package/dist/cjs/wcs-list-item.cjs.entry.js +1 -1
- package/dist/cjs/wcs-mat-icon.cjs.entry.js +2 -2
- package/dist/cjs/wcs-mat-icon.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-modal.cjs.entry.js +35 -5
- package/dist/cjs/wcs-modal.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-native-select.cjs.entry.js +6 -3
- package/dist/cjs/wcs-native-select.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-nav-item.cjs.entry.js +2 -2
- package/dist/cjs/wcs-nav.cjs.entry.js +1 -1
- package/dist/cjs/wcs-progress-bar.cjs.entry.js +4 -6
- package/dist/cjs/wcs-progress-bar.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-progress-radial.cjs.entry.js +14 -6
- package/dist/cjs/wcs-progress-radial.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-radio-group.cjs.entry.js +22 -15
- package/dist/cjs/wcs-radio-group.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-radio.cjs.entry.js +14 -7
- package/dist/cjs/wcs-radio.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-select_2.cjs.entry.js +603 -111
- package/dist/cjs/wcs-select_2.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-skeleton-circle.cjs.entry.js +1 -1
- package/dist/cjs/wcs-skeleton-rectangle.cjs.entry.js +1 -1
- package/dist/cjs/wcs-skeleton-text.cjs.entry.js +1 -1
- package/dist/cjs/wcs-switch.cjs.entry.js +5 -2
- package/dist/cjs/wcs-switch.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tab.cjs.entry.js +4 -1
- package/dist/cjs/wcs-tab.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tabs.cjs.entry.js +4 -4
- package/dist/cjs/wcs-tabs.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-textarea.cjs.entry.js +13 -11
- package/dist/cjs/wcs-textarea.cjs.entry.js.map +1 -1
- package/dist/cjs/wcs-tooltip.cjs.entry.js +1 -1
- package/dist/cjs/wcs.cjs.js +2 -2
- package/dist/collection/components/badge/badge-interface.js.map +1 -1
- package/dist/collection/components/badge/badge.css +19 -1
- package/dist/collection/components/badge/badge.js +24 -0
- package/dist/collection/components/badge/badge.js.map +1 -1
- package/dist/collection/components/button/button.css +1 -1
- package/dist/collection/components/checkbox/checkbox.js +34 -1
- package/dist/collection/components/checkbox/checkbox.js.map +1 -1
- package/dist/collection/components/counter/counter.css +6 -1
- package/dist/collection/components/counter/counter.js +61 -3
- package/dist/collection/components/counter/counter.js.map +1 -1
- package/dist/collection/components/dropdown/dropdown.css +15 -4
- package/dist/collection/components/dropdown/dropdown.js +37 -1
- package/dist/collection/components/dropdown/dropdown.js.map +1 -1
- package/dist/collection/components/dropdown-divider/dropdown-divider.js +3 -0
- package/dist/collection/components/dropdown-divider/dropdown-divider.js.map +1 -1
- package/dist/collection/components/dropdown-header/dropdown-header.js +4 -0
- package/dist/collection/components/dropdown-header/dropdown-header.js.map +1 -1
- package/dist/collection/components/dropdown-item/dropdown-item.js +5 -1
- package/dist/collection/components/dropdown-item/dropdown-item.js.map +1 -1
- package/dist/collection/components/editable-field/editable-field.js +17 -2
- package/dist/collection/components/editable-field/editable-field.js.map +1 -1
- package/dist/collection/components/error/error.js +1 -1
- package/dist/collection/components/error/error.js.map +1 -1
- package/dist/collection/components/form-field/form-field.js +31 -0
- package/dist/collection/components/form-field/form-field.js.map +1 -1
- package/dist/collection/components/grid/grid-interface.js.map +1 -1
- package/dist/collection/components/grid/grid-keyboard-event.js +52 -0
- package/dist/collection/components/grid/grid-keyboard-event.js.map +1 -0
- package/dist/collection/components/grid/grid.css +5 -0
- package/dist/collection/components/grid/grid.js +265 -29
- package/dist/collection/components/grid/grid.js.map +1 -1
- package/dist/collection/components/grid-column/grid-column.css +5 -0
- package/dist/collection/components/grid-column/grid-column.js +60 -1
- package/dist/collection/components/grid-column/grid-column.js.map +1 -1
- package/dist/collection/components/grid-column/grid-sort-arrow.js +1 -1
- package/dist/collection/components/grid-column/grid-sort-arrow.js.map +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination-arrow.js +32 -23
- package/dist/collection/components/grid-pagination/grid-pagination-arrow.js.map +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination.css +17 -0
- package/dist/collection/components/grid-pagination/grid-pagination.js +1 -1
- package/dist/collection/components/grid-pagination/grid-pagination.js.map +1 -1
- package/dist/collection/components/input/input.js +64 -28
- package/dist/collection/components/input/input.js.map +1 -1
- package/dist/collection/components/label/label.js.map +1 -1
- package/dist/collection/components/mat-icon/mat-icon.js +1 -1
- package/dist/collection/components/mat-icon/mat-icon.js.map +1 -1
- package/dist/collection/components/modal/modal.css +2 -2
- package/dist/collection/components/modal/modal.js +73 -2
- package/dist/collection/components/modal/modal.js.map +1 -1
- package/dist/collection/components/native-select/native-select.css +6 -5
- package/dist/collection/components/native-select/native-select.js +29 -0
- package/dist/collection/components/native-select/native-select.js.map +1 -1
- package/dist/collection/components/progress-bar/progress-bar.css +12 -11
- package/dist/collection/components/progress-bar/progress-bar.js +22 -13
- package/dist/collection/components/progress-bar/progress-bar.js.map +1 -1
- package/dist/collection/components/progress-radial/progress-radial.css +5 -0
- package/dist/collection/components/progress-radial/progress-radial.js +18 -7
- package/dist/collection/components/progress-radial/progress-radial.js.map +1 -1
- package/dist/collection/components/radio/radio.css +8 -16
- package/dist/collection/components/radio/radio.js +12 -5
- package/dist/collection/components/radio/radio.js.map +1 -1
- package/dist/collection/components/radio-group/radio-group.js +50 -13
- package/dist/collection/components/radio-group/radio-group.js.map +1 -1
- package/dist/collection/components/select/select-interface.js +10 -0
- package/dist/collection/components/select/select-interface.js.map +1 -1
- package/dist/collection/components/select/select-keyboard-event.js +306 -0
- package/dist/collection/components/select/select-keyboard-event.js.map +1 -0
- package/dist/collection/components/select/select.css +59 -6
- package/dist/collection/components/select/select.js +435 -111
- package/dist/collection/components/select/select.js.map +1 -1
- package/dist/collection/components/select-option/select-option.css +15 -0
- package/dist/collection/components/select-option/select-option.js +30 -5
- package/dist/collection/components/select-option/select-option.js.map +1 -1
- package/dist/collection/components/switch/switch.js +34 -1
- package/dist/collection/components/switch/switch.js.map +1 -1
- package/dist/collection/components/tab/tab.css +7 -0
- package/dist/collection/components/tab/tab.js +11 -1
- package/dist/collection/components/tab/tab.js.map +1 -1
- package/dist/collection/components/tabs/tabs.js +7 -3
- package/dist/collection/components/tabs/tabs.js.map +1 -1
- package/dist/collection/components/textarea/textarea.css +8 -3
- package/dist/collection/components/textarea/textarea.js +41 -12
- package/dist/collection/components/textarea/textarea.js.map +1 -1
- package/dist/collection/utils/accessibility.js +7 -1
- package/dist/collection/utils/accessibility.js.map +1 -1
- package/dist/collection/utils/helpers.js +76 -1
- package/dist/collection/utils/helpers.js.map +1 -1
- package/dist/collection/utils/keyboard-event.js +74 -0
- package/dist/collection/utils/keyboard-event.js.map +1 -0
- package/dist/collection/utils/mutable-aria-attribute.js +4 -0
- package/dist/collection/utils/mutable-aria-attribute.js.map +1 -0
- package/dist/esm/{accessibility-ffa12842.js → accessibility-64feea8a.js} +8 -2
- package/dist/esm/accessibility-64feea8a.js.map +1 -0
- package/dist/esm/button-interface-c21c265f.js +9 -0
- package/dist/esm/button-interface-c21c265f.js.map +1 -0
- package/dist/esm/grid-pagination-f7b01e2e.js +109 -0
- package/dist/esm/grid-pagination-f7b01e2e.js.map +1 -0
- package/dist/esm/{helpers-1d55b67f.js → helpers-a21ae7d0.js} +75 -3
- package/dist/esm/helpers-a21ae7d0.js.map +1 -0
- package/dist/esm/{index-dc4d96d4.js → index-4f282598.js} +4 -1
- package/dist/esm/index-4f282598.js.map +1 -0
- package/dist/esm/{isEqual-20881bca.js → keyboard-event-ba3d20e7.js} +77 -2
- package/dist/esm/keyboard-event-ba3d20e7.js.map +1 -0
- package/dist/esm/loader.js +3 -3
- package/dist/esm/{select-arrow-81d069f7.js → select-arrow-28e8687b.js} +2 -2
- package/dist/esm/{select-arrow-81d069f7.js.map → select-arrow-28e8687b.js.map} +1 -1
- package/dist/esm/wcs-accordion-content.entry.js +1 -1
- package/dist/esm/wcs-accordion-header.entry.js +1 -1
- package/dist/esm/wcs-accordion-panel.entry.js +2 -2
- package/dist/esm/wcs-accordion.entry.js +1 -1
- package/dist/esm/wcs-action-bar.entry.js +1 -1
- package/dist/esm/wcs-app.entry.js +1 -1
- package/dist/esm/wcs-badge.entry.js +3 -2
- package/dist/esm/wcs-badge.entry.js.map +1 -1
- package/dist/esm/{wcs-button.entry.js → wcs-button_2.entry.js} +19 -11
- package/dist/esm/wcs-button_2.entry.js.map +1 -0
- package/dist/esm/wcs-card-body.entry.js +1 -1
- package/dist/esm/wcs-card.entry.js +1 -1
- package/dist/esm/wcs-checkbox.entry.js +5 -2
- package/dist/esm/wcs-checkbox.entry.js.map +1 -1
- package/dist/esm/wcs-com-nav-category.entry.js +2 -2
- package/dist/esm/wcs-com-nav-submenu.entry.js +2 -2
- package/dist/esm/wcs-com-nav.entry.js +2 -2
- package/dist/esm/wcs-counter.entry.js +16 -6
- package/dist/esm/wcs-counter.entry.js.map +1 -1
- package/dist/esm/wcs-divider.entry.js +1 -1
- package/dist/esm/wcs-dropdown-divider.entry.js +1 -1
- package/dist/esm/wcs-dropdown-divider.entry.js.map +1 -1
- package/dist/esm/wcs-dropdown-header.entry.js +1 -1
- package/dist/esm/wcs-dropdown-header.entry.js.map +1 -1
- package/dist/esm/wcs-dropdown-item.entry.js +2 -2
- package/dist/esm/wcs-dropdown-item.entry.js.map +1 -1
- package/dist/esm/wcs-dropdown.entry.js +12 -6
- package/dist/esm/wcs-dropdown.entry.js.map +1 -1
- package/dist/esm/wcs-editable-field.entry.js +18 -3
- package/dist/esm/wcs-editable-field.entry.js.map +1 -1
- package/dist/esm/wcs-error_2.entry.js +36 -2
- package/dist/esm/wcs-error_2.entry.js.map +1 -1
- package/dist/esm/wcs-field-content.entry.js +1 -1
- package/dist/esm/wcs-field-label.entry.js +1 -1
- package/dist/esm/wcs-field.entry.js +1 -1
- package/dist/esm/wcs-footer.entry.js +1 -1
- package/dist/esm/wcs-galactic-menu.entry.js +2 -2
- package/dist/esm/wcs-galactic.entry.js +1 -1
- package/dist/esm/wcs-grid-column.entry.js +25 -4
- package/dist/esm/wcs-grid-column.entry.js.map +1 -1
- package/dist/esm/wcs-grid-custom-cell.entry.js +1 -1
- package/dist/esm/wcs-grid-pagination.entry.js +2 -2
- package/dist/esm/wcs-grid.entry.js +282 -27
- package/dist/esm/wcs-grid.entry.js.map +1 -1
- package/dist/esm/wcs-header.entry.js +1 -1
- package/dist/esm/wcs-hint.entry.js +1 -1
- package/dist/esm/wcs-horizontal-stepper.entry.js +1 -1
- package/dist/esm/wcs-icon.entry.js +1 -1
- package/dist/esm/wcs-input.entry.js +15 -15
- package/dist/esm/wcs-input.entry.js.map +1 -1
- package/dist/esm/wcs-label.entry.js +1 -1
- package/dist/esm/wcs-label.entry.js.map +1 -1
- package/dist/esm/wcs-list-item-properties.entry.js +1 -1
- package/dist/esm/wcs-list-item-property.entry.js +1 -1
- package/dist/esm/wcs-list-item.entry.js +1 -1
- package/dist/esm/wcs-mat-icon.entry.js +2 -2
- package/dist/esm/wcs-mat-icon.entry.js.map +1 -1
- package/dist/esm/wcs-modal.entry.js +35 -5
- package/dist/esm/wcs-modal.entry.js.map +1 -1
- package/dist/esm/wcs-native-select.entry.js +6 -3
- package/dist/esm/wcs-native-select.entry.js.map +1 -1
- package/dist/esm/wcs-nav-item.entry.js +2 -2
- package/dist/esm/wcs-nav.entry.js +1 -1
- package/dist/esm/wcs-progress-bar.entry.js +4 -6
- package/dist/esm/wcs-progress-bar.entry.js.map +1 -1
- package/dist/esm/wcs-progress-radial.entry.js +14 -6
- package/dist/esm/wcs-progress-radial.entry.js.map +1 -1
- package/dist/esm/wcs-radio-group.entry.js +22 -15
- package/dist/esm/wcs-radio-group.entry.js.map +1 -1
- package/dist/esm/wcs-radio.entry.js +14 -7
- package/dist/esm/wcs-radio.entry.js.map +1 -1
- package/dist/esm/wcs-select_2.entry.js +602 -110
- package/dist/esm/wcs-select_2.entry.js.map +1 -1
- package/dist/esm/wcs-skeleton-circle.entry.js +1 -1
- package/dist/esm/wcs-skeleton-rectangle.entry.js +1 -1
- package/dist/esm/wcs-skeleton-text.entry.js +1 -1
- package/dist/esm/wcs-switch.entry.js +5 -2
- package/dist/esm/wcs-switch.entry.js.map +1 -1
- package/dist/esm/wcs-tab.entry.js +4 -1
- package/dist/esm/wcs-tab.entry.js.map +1 -1
- package/dist/esm/wcs-tabs.entry.js +4 -4
- package/dist/esm/wcs-tabs.entry.js.map +1 -1
- package/dist/esm/wcs-textarea.entry.js +13 -11
- package/dist/esm/wcs-textarea.entry.js.map +1 -1
- package/dist/esm/wcs-tooltip.entry.js +1 -1
- package/dist/esm/wcs.js +3 -3
- package/dist/types/components/badge/badge-interface.d.ts +2 -0
- package/dist/types/components/badge/badge.d.ts +5 -1
- package/dist/types/components/checkbox/checkbox.d.ts +4 -1
- package/dist/types/components/counter/counter.d.ts +8 -1
- package/dist/types/components/dropdown/dropdown.d.ts +10 -1
- package/dist/types/components/dropdown-divider/dropdown-divider.d.ts +3 -0
- package/dist/types/components/dropdown-header/dropdown-header.d.ts +4 -0
- package/dist/types/components/dropdown-item/dropdown-item.d.ts +7 -0
- package/dist/types/components/editable-field/editable-field.d.ts +7 -0
- package/dist/types/components/form-field/form-field.d.ts +4 -0
- package/dist/types/components/grid/grid-interface.d.ts +14 -2
- package/dist/types/components/grid/grid-keyboard-event.d.ts +16 -0
- package/dist/types/components/grid/grid.d.ts +59 -4
- package/dist/types/components/grid-column/grid-column.d.ts +17 -0
- package/dist/types/components/input/input.d.ts +40 -17
- package/dist/types/components/modal/modal.d.ts +37 -1
- package/dist/types/components/native-select/native-select.d.ts +3 -1
- package/dist/types/components/progress-bar/progress-bar.d.ts +8 -3
- package/dist/types/components/progress-radial/progress-radial.d.ts +12 -0
- package/dist/types/components/radio/radio.d.ts +3 -0
- package/dist/types/components/radio-group/radio-group.d.ts +3 -1
- package/dist/types/components/select/select-interface.d.ts +12 -0
- package/dist/types/components/select/select-keyboard-event.d.ts +38 -0
- package/dist/types/components/select/select.d.ts +76 -15
- package/dist/types/components/select-option/select-option.d.ts +10 -4
- package/dist/types/components/switch/switch.d.ts +4 -1
- package/dist/types/components/tab/tab.d.ts +3 -0
- package/dist/types/components/tabs/tabs.d.ts +4 -0
- package/dist/types/components/textarea/textarea.d.ts +8 -4
- package/dist/types/components.d.ts +357 -55
- package/dist/types/utils/accessibility.d.ts +4 -0
- package/dist/types/utils/helpers.d.ts +12 -1
- package/dist/types/utils/keyboard-event.d.ts +13 -0
- package/dist/types/utils/mutable-aria-attribute.d.ts +5 -0
- package/dist/wcs/{p-7a3f70da.entry.js → p-00f6a79a.entry.js} +2 -2
- package/dist/wcs/{p-ee453b6e.entry.js → p-016e4dd9.entry.js} +2 -2
- package/dist/wcs/p-0ae177cf.js +2 -0
- package/dist/wcs/p-0ae177cf.js.map +1 -0
- package/dist/wcs/{p-f06f48f3.entry.js → p-0d02d9e4.entry.js} +2 -2
- package/dist/wcs/p-0d02d9e4.entry.js.map +1 -0
- package/dist/wcs/{p-30d8f9c3.entry.js → p-11ab4ffc.entry.js} +2 -2
- package/dist/wcs/p-13548191.entry.js +2 -0
- package/dist/wcs/p-13548191.entry.js.map +1 -0
- package/dist/wcs/p-13ffe5f3.entry.js +2 -0
- package/dist/wcs/p-13ffe5f3.entry.js.map +1 -0
- package/dist/wcs/{p-dfddec76.entry.js → p-17442a2f.entry.js} +2 -2
- package/dist/wcs/p-1d49a02e.entry.js +2 -0
- package/dist/wcs/p-1d49a02e.entry.js.map +1 -0
- package/dist/wcs/{p-d6c3e615.js → p-24611014.js} +2 -2
- package/dist/wcs/p-250b3794.entry.js +2 -0
- package/dist/wcs/{p-91b3e4b5.entry.js.map → p-250b3794.entry.js.map} +1 -1
- package/dist/wcs/{p-292ca644.entry.js → p-2d62b3dd.entry.js} +2 -2
- package/dist/wcs/{p-d6b3f742.entry.js → p-33a5594d.entry.js} +2 -2
- package/dist/wcs/p-33a570ee.js +2 -0
- package/dist/wcs/p-33a570ee.js.map +1 -0
- package/dist/wcs/{p-e86c6cbb.entry.js → p-34079054.entry.js} +2 -2
- package/dist/wcs/{p-e86c6cbb.entry.js.map → p-34079054.entry.js.map} +1 -1
- package/dist/wcs/{p-257b15b9.entry.js → p-36e83879.entry.js} +2 -2
- package/dist/wcs/p-44410e32.entry.js +2 -0
- package/dist/wcs/p-44410e32.entry.js.map +1 -0
- package/dist/wcs/{p-7269272f.entry.js → p-46184d47.entry.js} +2 -2
- package/dist/wcs/p-46975b1e.entry.js +2 -0
- package/dist/wcs/p-46975b1e.entry.js.map +1 -0
- package/dist/wcs/{p-4a9f8e94.entry.js → p-46d56c4e.entry.js} +3 -3
- package/dist/wcs/{p-fc3f5b53.entry.js → p-4820154c.entry.js} +2 -2
- package/dist/wcs/p-49b0de03.entry.js +2 -0
- package/dist/wcs/p-49b0de03.entry.js.map +1 -0
- package/dist/wcs/{p-ff9967eb.entry.js → p-4af68f13.entry.js} +2 -2
- package/dist/wcs/{p-1f8c73eb.entry.js → p-5f0ab1dc.entry.js} +2 -2
- package/dist/wcs/p-5f0ab1dc.entry.js.map +1 -0
- package/dist/wcs/p-5f3e6b0c.entry.js +2 -0
- package/dist/wcs/p-5f3e6b0c.entry.js.map +1 -0
- package/dist/wcs/{p-50dce764.entry.js → p-61b934a7.entry.js} +2 -2
- package/dist/wcs/p-64855188.js +2 -0
- package/dist/wcs/p-64855188.js.map +1 -0
- package/dist/wcs/p-680b107c.entry.js +2 -0
- package/dist/wcs/p-68d654da.js +2 -0
- package/dist/wcs/p-68d654da.js.map +1 -0
- package/dist/wcs/p-69d1223c.js +3 -0
- package/dist/wcs/p-69d1223c.js.map +1 -0
- package/dist/wcs/p-6f538b67.entry.js +2 -0
- package/dist/wcs/p-6f538b67.entry.js.map +1 -0
- package/dist/wcs/p-7c145ed0.entry.js +2 -0
- package/dist/wcs/p-7c145ed0.entry.js.map +1 -0
- package/dist/wcs/p-8724a296.entry.js +2 -0
- package/dist/wcs/p-8724a296.entry.js.map +1 -0
- package/dist/wcs/{p-d084dd61.entry.js → p-88b1cdfe.entry.js} +2 -2
- package/dist/wcs/{p-c7494651.entry.js → p-8ff7e463.entry.js} +2 -2
- package/dist/wcs/p-90a7fd68.entry.js +2 -0
- package/dist/wcs/p-90a7fd68.entry.js.map +1 -0
- package/dist/wcs/{p-cfcacc44.entry.js → p-914aa964.entry.js} +2 -2
- package/dist/wcs/p-93fcef08.entry.js +2 -0
- package/dist/wcs/p-93fcef08.entry.js.map +1 -0
- package/dist/wcs/{p-429bd9fb.entry.js → p-9b1c73b3.entry.js} +2 -2
- package/dist/wcs/p-9cc48d75.js +2 -0
- package/dist/wcs/p-9cc48d75.js.map +1 -0
- package/dist/wcs/p-a3518f66.entry.js +2 -0
- package/dist/wcs/p-a361d9f1.entry.js +2 -0
- package/dist/wcs/{p-31a8d23f.entry.js → p-a85208ca.entry.js} +2 -2
- package/dist/wcs/{p-d3f1cafe.entry.js → p-b91323fc.entry.js} +2 -2
- package/dist/wcs/{p-47d8ece5.entry.js → p-bd4029f8.entry.js} +2 -2
- package/dist/wcs/{p-e348058b.entry.js → p-bed4e3ce.entry.js} +2 -2
- package/dist/wcs/{p-f489793d.entry.js → p-c261353f.entry.js} +2 -2
- package/dist/wcs/p-c261353f.entry.js.map +1 -0
- package/dist/wcs/p-c3227f01.entry.js +2 -0
- package/dist/wcs/p-c3227f01.entry.js.map +1 -0
- package/dist/wcs/{p-810aff71.entry.js → p-c38adf4b.entry.js} +2 -2
- package/dist/wcs/{p-2185bf8b.entry.js → p-c6a8c6f9.entry.js} +2 -2
- package/dist/wcs/p-c9478849.entry.js +2 -0
- package/dist/wcs/p-c9478849.entry.js.map +1 -0
- package/dist/wcs/p-ce3ef5d0.entry.js +2 -0
- package/dist/wcs/p-ce3ef5d0.entry.js.map +1 -0
- package/dist/wcs/{p-54e29233.entry.js → p-ce40b012.entry.js} +2 -2
- package/dist/wcs/{p-54e29233.entry.js.map → p-ce40b012.entry.js.map} +1 -1
- package/dist/wcs/p-d6c482fc.entry.js +2 -0
- package/dist/wcs/p-d6c482fc.entry.js.map +1 -0
- package/dist/wcs/{p-1e43122f.entry.js → p-d84cee70.entry.js} +2 -2
- package/dist/wcs/p-d895b92c.entry.js +16 -0
- package/dist/wcs/p-d895b92c.entry.js.map +1 -0
- package/dist/wcs/p-dca2f42c.entry.js +2 -0
- package/dist/wcs/{p-7519a270.entry.js → p-e0d5908a.entry.js} +2 -2
- package/dist/wcs/{p-a5cd4c07.entry.js → p-e487ff2c.entry.js} +2 -2
- package/dist/wcs/p-e487ff2c.entry.js.map +1 -0
- package/dist/wcs/{p-3b1fc676.entry.js → p-e52c11e4.entry.js} +2 -2
- package/dist/wcs/{p-0ede0c37.entry.js → p-e7661047.entry.js} +2 -2
- package/dist/wcs/p-ea6e33ee.entry.js +2 -0
- package/dist/wcs/{p-cc03627c.entry.js → p-f7ce4e0d.entry.js} +2 -2
- package/dist/wcs/{p-b6160b7c.entry.js → p-faf04401.entry.js} +2 -2
- package/dist/wcs/p-fc1767ae.entry.js +2 -0
- package/dist/wcs/p-fc1767ae.entry.js.map +1 -0
- package/dist/wcs/p-feebc469.entry.js +2 -0
- package/dist/wcs/p-feebc469.entry.js.map +1 -0
- package/dist/wcs/wcs.css +1 -1
- package/dist/wcs/wcs.esm.js +1 -1
- package/dist/wcs/wcs.esm.js.map +1 -1
- package/package.json +1 -1
- package/dist/cjs/accessibility-e99b032d.js.map +0 -1
- package/dist/cjs/grid-pagination-4b55c908.js +0 -101
- package/dist/cjs/grid-pagination-4b55c908.js.map +0 -1
- package/dist/cjs/helpers-4a14051a.js.map +0 -1
- package/dist/cjs/index-ca67a6dc.js.map +0 -1
- package/dist/cjs/isEqual-9ea7ee49.js.map +0 -1
- package/dist/cjs/wcs-button.cjs.entry.js.map +0 -1
- package/dist/cjs/wcs-spinner.cjs.entry.js +0 -22
- package/dist/cjs/wcs-spinner.cjs.entry.js.map +0 -1
- package/dist/esm/accessibility-ffa12842.js.map +0 -1
- package/dist/esm/grid-pagination-41354861.js +0 -99
- package/dist/esm/grid-pagination-41354861.js.map +0 -1
- package/dist/esm/helpers-1d55b67f.js.map +0 -1
- package/dist/esm/index-dc4d96d4.js.map +0 -1
- package/dist/esm/isEqual-20881bca.js.map +0 -1
- package/dist/esm/wcs-button.entry.js.map +0 -1
- package/dist/esm/wcs-spinner.entry.js +0 -18
- package/dist/esm/wcs-spinner.entry.js.map +0 -1
- package/dist/wcs/p-02b95dbf.entry.js +0 -2
- package/dist/wcs/p-02b95dbf.entry.js.map +0 -1
- package/dist/wcs/p-0f8db386.js +0 -2
- package/dist/wcs/p-0f8db386.js.map +0 -1
- package/dist/wcs/p-17630eea.entry.js +0 -2
- package/dist/wcs/p-1f8c73eb.entry.js.map +0 -1
- package/dist/wcs/p-269d244c.entry.js +0 -2
- package/dist/wcs/p-269d244c.entry.js.map +0 -1
- package/dist/wcs/p-2f63d6c5.entry.js +0 -2
- package/dist/wcs/p-2f63d6c5.entry.js.map +0 -1
- package/dist/wcs/p-39821dd2.entry.js +0 -2
- package/dist/wcs/p-39821dd2.entry.js.map +0 -1
- package/dist/wcs/p-3dc6b507.js +0 -2
- package/dist/wcs/p-3dc6b507.js.map +0 -1
- package/dist/wcs/p-463667c9.entry.js +0 -2
- package/dist/wcs/p-475ac7c5.js +0 -2
- package/dist/wcs/p-475ac7c5.js.map +0 -1
- package/dist/wcs/p-4ffe4539.entry.js +0 -2
- package/dist/wcs/p-4ffe4539.entry.js.map +0 -1
- package/dist/wcs/p-57560d7d.entry.js +0 -2
- package/dist/wcs/p-57560d7d.entry.js.map +0 -1
- package/dist/wcs/p-61cab06f.entry.js +0 -2
- package/dist/wcs/p-61cab06f.entry.js.map +0 -1
- package/dist/wcs/p-627bbb6a.entry.js +0 -2
- package/dist/wcs/p-627bbb6a.entry.js.map +0 -1
- package/dist/wcs/p-6de70331.entry.js +0 -2
- package/dist/wcs/p-6de70331.entry.js.map +0 -1
- package/dist/wcs/p-747a5962.entry.js +0 -2
- package/dist/wcs/p-8181f8cd.js +0 -2
- package/dist/wcs/p-8181f8cd.js.map +0 -1
- package/dist/wcs/p-8c4ed883.entry.js +0 -2
- package/dist/wcs/p-8c4ed883.entry.js.map +0 -1
- package/dist/wcs/p-8d57835f.entry.js +0 -2
- package/dist/wcs/p-8fed8b1c.entry.js +0 -2
- package/dist/wcs/p-8fed8b1c.entry.js.map +0 -1
- package/dist/wcs/p-91b3e4b5.entry.js +0 -2
- package/dist/wcs/p-9910fedd.entry.js +0 -2
- package/dist/wcs/p-9910fedd.entry.js.map +0 -1
- package/dist/wcs/p-9d798de4.entry.js +0 -2
- package/dist/wcs/p-9d798de4.entry.js.map +0 -1
- package/dist/wcs/p-9ecdeaf9.entry.js +0 -2
- package/dist/wcs/p-9ecdeaf9.entry.js.map +0 -1
- package/dist/wcs/p-a2df3a49.js +0 -3
- package/dist/wcs/p-a2df3a49.js.map +0 -1
- package/dist/wcs/p-a5cd4c07.entry.js.map +0 -1
- package/dist/wcs/p-ac106663.entry.js +0 -2
- package/dist/wcs/p-ac106663.entry.js.map +0 -1
- package/dist/wcs/p-cb90bc3a.entry.js +0 -2
- package/dist/wcs/p-cb90bc3a.entry.js.map +0 -1
- package/dist/wcs/p-cdd172b4.entry.js +0 -2
- package/dist/wcs/p-d5a0e271.entry.js +0 -2
- package/dist/wcs/p-d5a0e271.entry.js.map +0 -1
- package/dist/wcs/p-ec84d6fd.entry.js +0 -16
- package/dist/wcs/p-ec84d6fd.entry.js.map +0 -1
- package/dist/wcs/p-ed3132be.entry.js +0 -2
- package/dist/wcs/p-ed3132be.entry.js.map +0 -1
- package/dist/wcs/p-f06f48f3.entry.js.map +0 -1
- package/dist/wcs/p-f20b9024.entry.js +0 -2
- package/dist/wcs/p-f20b9024.entry.js.map +0 -1
- package/dist/wcs/p-f489793d.entry.js.map +0 -1
- /package/dist/wcs/{p-7a3f70da.entry.js.map → p-00f6a79a.entry.js.map} +0 -0
- /package/dist/wcs/{p-ee453b6e.entry.js.map → p-016e4dd9.entry.js.map} +0 -0
- /package/dist/wcs/{p-30d8f9c3.entry.js.map → p-11ab4ffc.entry.js.map} +0 -0
- /package/dist/wcs/{p-dfddec76.entry.js.map → p-17442a2f.entry.js.map} +0 -0
- /package/dist/wcs/{p-d6c3e615.js.map → p-24611014.js.map} +0 -0
- /package/dist/wcs/{p-292ca644.entry.js.map → p-2d62b3dd.entry.js.map} +0 -0
- /package/dist/wcs/{p-d6b3f742.entry.js.map → p-33a5594d.entry.js.map} +0 -0
- /package/dist/wcs/{p-257b15b9.entry.js.map → p-36e83879.entry.js.map} +0 -0
- /package/dist/wcs/{p-7269272f.entry.js.map → p-46184d47.entry.js.map} +0 -0
- /package/dist/wcs/{p-4a9f8e94.entry.js.map → p-46d56c4e.entry.js.map} +0 -0
- /package/dist/wcs/{p-fc3f5b53.entry.js.map → p-4820154c.entry.js.map} +0 -0
- /package/dist/wcs/{p-ff9967eb.entry.js.map → p-4af68f13.entry.js.map} +0 -0
- /package/dist/wcs/{p-50dce764.entry.js.map → p-61b934a7.entry.js.map} +0 -0
- /package/dist/wcs/{p-17630eea.entry.js.map → p-680b107c.entry.js.map} +0 -0
- /package/dist/wcs/{p-d084dd61.entry.js.map → p-88b1cdfe.entry.js.map} +0 -0
- /package/dist/wcs/{p-c7494651.entry.js.map → p-8ff7e463.entry.js.map} +0 -0
- /package/dist/wcs/{p-cfcacc44.entry.js.map → p-914aa964.entry.js.map} +0 -0
- /package/dist/wcs/{p-429bd9fb.entry.js.map → p-9b1c73b3.entry.js.map} +0 -0
- /package/dist/wcs/{p-8d57835f.entry.js.map → p-a3518f66.entry.js.map} +0 -0
- /package/dist/wcs/{p-463667c9.entry.js.map → p-a361d9f1.entry.js.map} +0 -0
- /package/dist/wcs/{p-31a8d23f.entry.js.map → p-a85208ca.entry.js.map} +0 -0
- /package/dist/wcs/{p-d3f1cafe.entry.js.map → p-b91323fc.entry.js.map} +0 -0
- /package/dist/wcs/{p-47d8ece5.entry.js.map → p-bd4029f8.entry.js.map} +0 -0
- /package/dist/wcs/{p-e348058b.entry.js.map → p-bed4e3ce.entry.js.map} +0 -0
- /package/dist/wcs/{p-810aff71.entry.js.map → p-c38adf4b.entry.js.map} +0 -0
- /package/dist/wcs/{p-2185bf8b.entry.js.map → p-c6a8c6f9.entry.js.map} +0 -0
- /package/dist/wcs/{p-1e43122f.entry.js.map → p-d84cee70.entry.js.map} +0 -0
- /package/dist/wcs/{p-747a5962.entry.js.map → p-dca2f42c.entry.js.map} +0 -0
- /package/dist/wcs/{p-7519a270.entry.js.map → p-e0d5908a.entry.js.map} +0 -0
- /package/dist/wcs/{p-3b1fc676.entry.js.map → p-e52c11e4.entry.js.map} +0 -0
- /package/dist/wcs/{p-0ede0c37.entry.js.map → p-e7661047.entry.js.map} +0 -0
- /package/dist/wcs/{p-cdd172b4.entry.js.map → p-ea6e33ee.entry.js.map} +0 -0
- /package/dist/wcs/{p-cc03627c.entry.js.map → p-f7ce4e0d.entry.js.map} +0 -0
- /package/dist/wcs/{p-b6160b7c.entry.js.map → p-faf04401.entry.js.map} +0 -0
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import { h, Host } from '@stencil/core';
|
|
2
2
|
import { interpret, Machine } from 'xstate';
|
|
3
|
-
import { isWcsSelectSize, WcsSelectSizeValue } from './select-interface';
|
|
3
|
+
import { isWcsSelectSize, WcsDefaultSelectFilterFn, WcsSelectSizeValue } from './select-interface';
|
|
4
4
|
import { SelectArrow } from './select-arrow';
|
|
5
|
-
import {
|
|
5
|
+
import { isElement, generateUniqueId, findItemLabel } from '../../utils/helpers';
|
|
6
6
|
import { SelectChips } from './select-chips';
|
|
7
7
|
import { MDCRipple } from '@material/ripple';
|
|
8
8
|
import { createPopper } from '@popperjs/core';
|
|
9
9
|
import { isEqual } from 'lodash-es';
|
|
10
|
+
import { getActionForKeyboardEvent } from './select-keyboard-event';
|
|
11
|
+
import { isFocusable } from '../../utils/accessibility';
|
|
10
12
|
const SELECT_MACHINE_CONFIG = {
|
|
11
13
|
key: 'select',
|
|
12
14
|
initial: 'closed',
|
|
@@ -30,12 +32,11 @@ const SELECT_MACHINE_CONFIG = {
|
|
|
30
32
|
}
|
|
31
33
|
};
|
|
32
34
|
/**
|
|
33
|
-
*
|
|
35
|
+
* The select component (also named combobox) is a form component that allows users to select one or more options
|
|
36
|
+
* from a list.
|
|
37
|
+
* Use it with several slotted `wcs-select-option` inside.
|
|
34
38
|
*
|
|
35
|
-
* @
|
|
36
|
-
* <wcs-select>
|
|
37
|
-
* <wcs-select-option value="1">One</wcs-select-option>
|
|
38
|
-
* </wcs-select>```
|
|
39
|
+
* @slot filter-no-result Contains the customizable "No result found" div (autocomplete mode only).
|
|
39
40
|
*/
|
|
40
41
|
export class Select {
|
|
41
42
|
constructor() {
|
|
@@ -43,16 +44,19 @@ export class Select {
|
|
|
43
44
|
this.optionsId = generateUniqueId("OPTIONS");
|
|
44
45
|
this.expanded = false;
|
|
45
46
|
this.size = 'm';
|
|
46
|
-
this.hasLoaded = false;
|
|
47
47
|
this.displayText = undefined;
|
|
48
48
|
this.focused = undefined;
|
|
49
49
|
this.value = undefined;
|
|
50
50
|
this.placeholder = undefined;
|
|
51
51
|
this.disabled = false;
|
|
52
52
|
this.multiple = false;
|
|
53
|
+
this.autocomplete = false;
|
|
54
|
+
this.filterFn = undefined;
|
|
53
55
|
this.chips = false;
|
|
54
56
|
this.name = undefined;
|
|
55
57
|
this.compareWith = (optionValue, selectedValue) => isEqual(optionValue, selectedValue);
|
|
58
|
+
this.showNoResultFoundLabel = false;
|
|
59
|
+
this.autocompleteValue = undefined;
|
|
56
60
|
this.overlayDirection = 'bottom';
|
|
57
61
|
}
|
|
58
62
|
/** Open the component. */
|
|
@@ -65,7 +69,6 @@ export class Select {
|
|
|
65
69
|
}
|
|
66
70
|
onValueChangeHandler(newValue) {
|
|
67
71
|
this.updateSelectedValue(newValue);
|
|
68
|
-
this.emitChange(this.value);
|
|
69
72
|
}
|
|
70
73
|
updateSelectedValue(value) {
|
|
71
74
|
// If no value is passed, the select is reset.
|
|
@@ -102,6 +105,9 @@ export class Select {
|
|
|
102
105
|
const isSelected = this.compareWith(opt.value, value);
|
|
103
106
|
if (isSelected) {
|
|
104
107
|
this.displayText = opt.innerText;
|
|
108
|
+
if (this.autocomplete) {
|
|
109
|
+
this.autocompleteValue = opt.innerText;
|
|
110
|
+
}
|
|
105
111
|
}
|
|
106
112
|
opt.selected = isSelected;
|
|
107
113
|
});
|
|
@@ -114,6 +120,9 @@ export class Select {
|
|
|
114
120
|
reset() {
|
|
115
121
|
this.values = [];
|
|
116
122
|
this.displayText = undefined;
|
|
123
|
+
if (this.autocomplete) {
|
|
124
|
+
this.autocompleteValue = undefined;
|
|
125
|
+
}
|
|
117
126
|
this.options.forEach((opt) => {
|
|
118
127
|
opt.selected = false;
|
|
119
128
|
});
|
|
@@ -144,8 +153,6 @@ export class Select {
|
|
|
144
153
|
if (this.labelElement) {
|
|
145
154
|
this.labelElement.id = this.selectId + "-lbl";
|
|
146
155
|
}
|
|
147
|
-
// TODO: is this still usefull for anything ?
|
|
148
|
-
this.hasLoaded = true;
|
|
149
156
|
}
|
|
150
157
|
createPopperInstance() {
|
|
151
158
|
return createPopper(this.controlEl, this.optionsEl, {
|
|
@@ -184,16 +191,24 @@ export class Select {
|
|
|
184
191
|
});
|
|
185
192
|
observer.observe(this.el, { childList: true });
|
|
186
193
|
}
|
|
194
|
+
componentWillRender() {
|
|
195
|
+
if (this.multiple) {
|
|
196
|
+
this.options
|
|
197
|
+
.forEach((opt) => opt.multiple = true);
|
|
198
|
+
}
|
|
199
|
+
}
|
|
187
200
|
componentWillLoad() {
|
|
188
201
|
if (!isWcsSelectSize(this.size)) {
|
|
189
202
|
console.error(`Invalid size value for wcs-select : "${this.size}". Must be one of "${WcsSelectSizeValue.join(', ')}"`);
|
|
190
203
|
this.size = "m"; // Default fallback value
|
|
191
204
|
}
|
|
192
205
|
}
|
|
193
|
-
|
|
194
|
-
if (this.
|
|
195
|
-
this.
|
|
196
|
-
|
|
206
|
+
async setAriaAttribute(attr, value) {
|
|
207
|
+
if (this.autocomplete === false) {
|
|
208
|
+
this.el.setAttribute(attr, value);
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
this.autocompleteInput.setAttribute(attr, value);
|
|
197
212
|
}
|
|
198
213
|
}
|
|
199
214
|
get options() {
|
|
@@ -206,7 +221,7 @@ export class Select {
|
|
|
206
221
|
}
|
|
207
222
|
get notDisabledOptions() {
|
|
208
223
|
var _a;
|
|
209
|
-
const opts = (_a = this.el) === null || _a === void 0 ? void 0 : _a.querySelectorAll('wcs-select-option:not([disabled])');
|
|
224
|
+
const opts = (_a = this.el) === null || _a === void 0 ? void 0 : _a.querySelectorAll('wcs-select-option:not([disabled]):not([aria-hidden])');
|
|
210
225
|
if (opts && opts.length !== 0) {
|
|
211
226
|
return opts;
|
|
212
227
|
}
|
|
@@ -216,15 +231,25 @@ export class Select {
|
|
|
216
231
|
return {
|
|
217
232
|
actions: {
|
|
218
233
|
open: () => {
|
|
219
|
-
var _a;
|
|
234
|
+
var _a, _b;
|
|
220
235
|
if (!this.disabled) {
|
|
221
236
|
this.expanded = true;
|
|
222
237
|
this.focused = false;
|
|
238
|
+
if (this.multiple === false && this.autocomplete && this.hasValue === false) {
|
|
239
|
+
// If we open the select in single autocomplete mode, we update the autocomplete value at
|
|
240
|
+
// the blur event so that the displayed value reflect the current select value.
|
|
241
|
+
// Indeed, we have to tell the component to take the current filter state manually at the
|
|
242
|
+
// opening (because the input event of the autocomplete field is not fired at this point).
|
|
243
|
+
this.handleAutocompleteValueChange((_a = this.autocompleteValue) !== null && _a !== void 0 ? _a : '');
|
|
244
|
+
}
|
|
245
|
+
this.clearHighlightOnLastHighlightedOption();
|
|
223
246
|
if (this.notDisabledOptions.length > 0) {
|
|
224
|
-
this.lastFocusedOptionElement = (
|
|
247
|
+
this.lastFocusedOptionElement = (_b = this.lastModifiedOptionElement) !== null && _b !== void 0 ? _b : this.notDisabledOptions[0];
|
|
225
248
|
requestAnimationFrame(() => {
|
|
226
|
-
var _a;
|
|
227
|
-
|
|
249
|
+
var _a, _b;
|
|
250
|
+
this.autocomplete
|
|
251
|
+
? (_a = this.autocompleteInput) === null || _a === void 0 ? void 0 : _a.focus()
|
|
252
|
+
: (_b = this.lastFocusedOptionElement) === null || _b === void 0 ? void 0 : _b.focus();
|
|
228
253
|
});
|
|
229
254
|
}
|
|
230
255
|
}
|
|
@@ -232,12 +257,21 @@ export class Select {
|
|
|
232
257
|
close: (_, event) => {
|
|
233
258
|
var _a, _b;
|
|
234
259
|
if (event.type === 'CLOSE') {
|
|
260
|
+
this.clearHighlightOnLastHighlightedOption();
|
|
235
261
|
if ((_a = event.value) === null || _a === void 0 ? void 0 : _a.shouldBlur) {
|
|
236
|
-
(_b = this.el.closest("wcs-select")) === null || _b === void 0 ? void 0 : _b.focus();
|
|
237
262
|
this.focused = false;
|
|
238
263
|
}
|
|
239
264
|
else {
|
|
240
|
-
this.
|
|
265
|
+
if (this.autocomplete && ((_b = event.value) === null || _b === void 0 ? void 0 : _b.fromKeyboard)) {
|
|
266
|
+
// If we're in autocomplete mode, a keyboard event (e.g. escape) doesn't change the
|
|
267
|
+
// focus (so this.el.focus() aren't called because the select was already focused)
|
|
268
|
+
// but you still have to go back to the autocomplete input.
|
|
269
|
+
this.focusAutocompleteInput();
|
|
270
|
+
}
|
|
271
|
+
else {
|
|
272
|
+
// Otherwise, we focus the select element
|
|
273
|
+
this.el.focus();
|
|
274
|
+
}
|
|
241
275
|
this.focused = true;
|
|
242
276
|
}
|
|
243
277
|
}
|
|
@@ -245,7 +279,24 @@ export class Select {
|
|
|
245
279
|
},
|
|
246
280
|
selectOption: (_, event) => {
|
|
247
281
|
if (event.type === 'OPTION_SELECTED') {
|
|
248
|
-
this.
|
|
282
|
+
if (this.multiple) {
|
|
283
|
+
this.handleOptionSelectedOnMultiple(event.value.option);
|
|
284
|
+
}
|
|
285
|
+
else {
|
|
286
|
+
this.handleOptionSelectedOnSingle(event.value.option);
|
|
287
|
+
this.stateService.send('CLOSE', { value: { fromKeyboard: event.value.fromKeyboard } });
|
|
288
|
+
}
|
|
289
|
+
if (this.autocomplete) {
|
|
290
|
+
if (this.multiple) {
|
|
291
|
+
requestAnimationFrame(() => {
|
|
292
|
+
this.autocompleteInput.focus();
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
else {
|
|
296
|
+
this.autocompleteValue = event.value.option.displayText;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
this.emitChange(this.value);
|
|
249
300
|
}
|
|
250
301
|
}
|
|
251
302
|
},
|
|
@@ -254,28 +305,18 @@ export class Select {
|
|
|
254
305
|
}
|
|
255
306
|
};
|
|
256
307
|
}
|
|
257
|
-
|
|
258
|
-
if (this.multiple) {
|
|
259
|
-
this.handleClickOnMultiple(event);
|
|
260
|
-
}
|
|
261
|
-
else {
|
|
262
|
-
this.handleNormalClick(event);
|
|
263
|
-
}
|
|
264
|
-
}
|
|
265
|
-
handleClickOnMultiple(event) {
|
|
308
|
+
handleOptionSelectedOnMultiple(event) {
|
|
266
309
|
const index = this.values.findIndex(v => v.value === event.value);
|
|
267
310
|
if (index === -1) {
|
|
268
311
|
const { value, displayText, chipColor, chipBackgroundColor } = event;
|
|
269
312
|
this.values.push({ value, displayText, chipColor, chipBackgroundColor });
|
|
270
313
|
event.source.selected = true;
|
|
271
|
-
this.lastSelectedOptionElement = event.source;
|
|
272
314
|
}
|
|
273
315
|
else {
|
|
274
316
|
event.source.selected = false;
|
|
275
317
|
this.values.splice(index, 1);
|
|
276
|
-
if (this.lastSelectedOptionElement === event.source)
|
|
277
|
-
this.lastSelectedOptionElement = null;
|
|
278
318
|
}
|
|
319
|
+
this.lastModifiedOptionElement = event.source;
|
|
279
320
|
this.updateValueWithValues();
|
|
280
321
|
}
|
|
281
322
|
updateValueWithValues() {
|
|
@@ -284,7 +325,7 @@ export class Select {
|
|
|
284
325
|
? this.values.map(v => v.displayText).join(', ')
|
|
285
326
|
: undefined;
|
|
286
327
|
}
|
|
287
|
-
|
|
328
|
+
handleOptionSelectedOnSingle(event) {
|
|
288
329
|
// Reset other options to false if they were selected.
|
|
289
330
|
this.options
|
|
290
331
|
.forEach(option => {
|
|
@@ -294,8 +335,7 @@ export class Select {
|
|
|
294
335
|
event.source.selected = true;
|
|
295
336
|
this.value = event.value;
|
|
296
337
|
this.displayText = event.displayText;
|
|
297
|
-
this.
|
|
298
|
-
this.stateService.send('CLOSE');
|
|
338
|
+
this.lastModifiedOptionElement = event.source;
|
|
299
339
|
}
|
|
300
340
|
disconnectedCallback() {
|
|
301
341
|
var _a;
|
|
@@ -331,107 +371,207 @@ export class Select {
|
|
|
331
371
|
// TODO: Move this logic in the state machine
|
|
332
372
|
// FIXME: Doesnt work with single + disabled option
|
|
333
373
|
if (this.expanded && !clickOnCurrentSelect) {
|
|
334
|
-
this.stateService.send('CLOSE');
|
|
374
|
+
this.stateService.send({ type: 'CLOSE', value: { shouldBlur: true, fromKeyboard: false } });
|
|
335
375
|
}
|
|
336
376
|
}
|
|
337
377
|
onKeyDown(_event) {
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
378
|
+
const currentState = this.stateService.getSnapshot().matches("closed") ? 'closed' : 'opened';
|
|
379
|
+
let type;
|
|
380
|
+
if (this.autocomplete) {
|
|
381
|
+
type = this.multiple ? 'autocomplete_multiple' : 'autocomplete_unique';
|
|
382
|
+
}
|
|
383
|
+
else {
|
|
384
|
+
type = this.multiple ? 'multiple' : 'unique';
|
|
385
|
+
}
|
|
386
|
+
const actionsFromKeyboardEvents = getActionForKeyboardEvent(_event, currentState, type);
|
|
387
|
+
// If we have at least one associated actions, we prevent the default behavior of the event.
|
|
388
|
+
// Except if the action is a focus move (we have to handle the preventDefault behavior ourselves in the action implementation)
|
|
389
|
+
if (actionsFromKeyboardEvents.length != 0 && actionsFromKeyboardEvents.filter(a => a.kind === 'MoveFocus').length === 0) {
|
|
390
|
+
_event.preventDefault();
|
|
391
|
+
}
|
|
392
|
+
for (const actionFromKeyboardEvent of actionsFromKeyboardEvents) {
|
|
393
|
+
this.doActionFromKeyboardEventAssociatedAction(actionFromKeyboardEvent, _event);
|
|
394
|
+
}
|
|
395
|
+
}
|
|
396
|
+
doActionFromKeyboardEventAssociatedAction(actionFromKeyboardEvent, event) {
|
|
397
|
+
var _a, _b;
|
|
398
|
+
switch (actionFromKeyboardEvent.kind) {
|
|
399
|
+
case "CloseSelect":
|
|
400
|
+
this.stateService.send({
|
|
401
|
+
type: 'CLOSE',
|
|
402
|
+
value: { shouldBlur: actionFromKeyboardEvent.shouldBlur, fromKeyboard: true }
|
|
403
|
+
});
|
|
404
|
+
break;
|
|
405
|
+
case "OpenSelect":
|
|
343
406
|
this.stateService.send('OPEN');
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
407
|
+
break;
|
|
408
|
+
case "SelectOption":
|
|
409
|
+
switch (actionFromKeyboardEvent.target) {
|
|
410
|
+
case "next":
|
|
411
|
+
this.selectClosestOption('next');
|
|
412
|
+
break;
|
|
413
|
+
case "previous":
|
|
414
|
+
this.selectClosestOption('previous');
|
|
415
|
+
break;
|
|
416
|
+
case "first":
|
|
417
|
+
this.selectFirstOption();
|
|
418
|
+
break;
|
|
419
|
+
case "last":
|
|
420
|
+
this.selectLastOption();
|
|
421
|
+
break;
|
|
422
|
+
case "lastHighlighted": {
|
|
423
|
+
// We have to handle enterKey here because with autocomplete mode, a wcs-select-option
|
|
424
|
+
// is only highlighted, therefore the event is not fired
|
|
425
|
+
const indexToSelect = Array.from(this.notDisabledOptions).indexOf(this.lastHighlightedOptionElement);
|
|
426
|
+
if (indexToSelect !== -1) {
|
|
427
|
+
this.lastModifiedOptionElement = this.lastHighlightedOptionElement;
|
|
428
|
+
this.selectOption(indexToSelect, true);
|
|
429
|
+
}
|
|
430
|
+
break;
|
|
431
|
+
}
|
|
355
432
|
}
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
433
|
+
break;
|
|
434
|
+
case "ClearAutocompleteInput":
|
|
435
|
+
this.autocompleteValue = '';
|
|
436
|
+
break;
|
|
437
|
+
case "ClearHighlight":
|
|
438
|
+
this.clearHighlightOnLastHighlightedOption();
|
|
439
|
+
break;
|
|
440
|
+
case "HighlightOption":
|
|
441
|
+
switch (actionFromKeyboardEvent.target) {
|
|
442
|
+
case "next":
|
|
443
|
+
this.highlightClosestOption('next');
|
|
444
|
+
break;
|
|
445
|
+
case "previous":
|
|
446
|
+
this.highlightClosestOption('previous');
|
|
447
|
+
break;
|
|
448
|
+
case "first":
|
|
449
|
+
this.highlightFirstOption();
|
|
450
|
+
break;
|
|
451
|
+
case "last":
|
|
452
|
+
this.highlightLastOption();
|
|
453
|
+
break;
|
|
454
|
+
default:
|
|
455
|
+
break;
|
|
359
456
|
}
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
457
|
+
break;
|
|
458
|
+
case "FocusOption":
|
|
459
|
+
switch (actionFromKeyboardEvent.target) {
|
|
460
|
+
case "next":
|
|
461
|
+
this.focusClosestOption('next');
|
|
462
|
+
break;
|
|
463
|
+
case "previous":
|
|
464
|
+
this.focusClosestOption('previous');
|
|
465
|
+
break;
|
|
466
|
+
case "first":
|
|
467
|
+
this.focusFirstOption();
|
|
468
|
+
break;
|
|
469
|
+
case "last":
|
|
470
|
+
this.focusLastOption();
|
|
471
|
+
break;
|
|
472
|
+
case "lastFocused":
|
|
473
|
+
if (this.lastFocusedOptionElement != null) {
|
|
474
|
+
this.focusOption(Array.from(this.notDisabledOptions).indexOf(this.lastFocusedOptionElement));
|
|
475
|
+
}
|
|
476
|
+
break;
|
|
477
|
+
default:
|
|
478
|
+
break;
|
|
363
479
|
}
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
480
|
+
break;
|
|
481
|
+
case "MoveFocus":
|
|
482
|
+
switch (actionFromKeyboardEvent.target) {
|
|
483
|
+
case "previous": {
|
|
484
|
+
let elementToFocus = (_a = this.el.previousElementSibling) !== null && _a !== void 0 ? _a : this.el.parentElement;
|
|
485
|
+
while (elementToFocus) {
|
|
486
|
+
if (isFocusable(elementToFocus))
|
|
487
|
+
break;
|
|
488
|
+
elementToFocus = (_b = elementToFocus.previousElementSibling) !== null && _b !== void 0 ? _b : elementToFocus.parentElement;
|
|
489
|
+
}
|
|
490
|
+
if (elementToFocus) {
|
|
491
|
+
event.preventDefault();
|
|
492
|
+
elementToFocus.focus();
|
|
493
|
+
}
|
|
494
|
+
break;
|
|
495
|
+
}
|
|
496
|
+
default:
|
|
497
|
+
break;
|
|
367
498
|
}
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
else if (this.stateService.getSnapshot().matches("opened")) {
|
|
372
|
-
if (isEscapeKey(_event) || (_event.altKey && isUpArrowKey(_event))) {
|
|
373
|
-
this.stateService.send({ type: "CLOSE", value: { shouldBlur: false } });
|
|
374
|
-
}
|
|
375
|
-
else if (isTabKey(_event) || (_event.shiftKey && isTabKey(_event))) {
|
|
376
|
-
this.stateService.send({ type: "CLOSE", value: { shouldBlur: true } });
|
|
377
|
-
}
|
|
378
|
-
else if (isDownArrowKey(_event)) {
|
|
379
|
-
_event.preventDefault();
|
|
380
|
-
this.focusClosestOption("next");
|
|
381
|
-
}
|
|
382
|
-
else if (isUpArrowKey(_event)) {
|
|
383
|
-
_event.preventDefault();
|
|
384
|
-
this.focusClosestOption("previous");
|
|
385
|
-
}
|
|
386
|
-
else if (isPageUpKey(_event) || isHomeKey(_event)) {
|
|
387
|
-
_event.preventDefault();
|
|
388
|
-
this.focusFirstOption();
|
|
389
|
-
}
|
|
390
|
-
else if (isPageDownKey(_event)) {
|
|
391
|
-
_event.preventDefault();
|
|
392
|
-
this.focusLastOption();
|
|
393
|
-
}
|
|
499
|
+
break;
|
|
500
|
+
default:
|
|
501
|
+
throw new Error("Internal error");
|
|
394
502
|
}
|
|
395
503
|
}
|
|
396
504
|
getClosestActiveOptionIndexForState(direction, state) {
|
|
397
|
-
let
|
|
398
|
-
|
|
505
|
+
let concernedOption;
|
|
506
|
+
switch (state) {
|
|
507
|
+
case 'focused':
|
|
508
|
+
concernedOption = this.lastFocusedOptionElement;
|
|
509
|
+
break;
|
|
510
|
+
case 'modified':
|
|
511
|
+
concernedOption = this.lastModifiedOptionElement;
|
|
512
|
+
break;
|
|
513
|
+
case 'highlighted':
|
|
514
|
+
concernedOption = this.lastHighlightedOptionElement;
|
|
515
|
+
break;
|
|
516
|
+
default:
|
|
517
|
+
concernedOption = null;
|
|
518
|
+
}
|
|
519
|
+
let currentIndex = Array.from(this.notDisabledOptions).indexOf(concernedOption);
|
|
520
|
+
const MIN_INDEX = 0;
|
|
521
|
+
const MAX_INDEX = this.notDisabledOptions.length - 1;
|
|
522
|
+
if (direction === 'next' && currentIndex < MAX_INDEX) {
|
|
399
523
|
currentIndex++;
|
|
400
524
|
}
|
|
401
|
-
else if (direction === 'previous' && currentIndex >
|
|
525
|
+
else if (direction === 'previous' && currentIndex > MIN_INDEX) {
|
|
402
526
|
currentIndex--;
|
|
403
527
|
}
|
|
404
528
|
else {
|
|
405
|
-
|
|
529
|
+
if (!this.autocomplete)
|
|
530
|
+
return 'nothing';
|
|
531
|
+
// Used to scroll options infinitely with keyboard (autocomplete mode only)
|
|
532
|
+
if (direction === 'next' && currentIndex >= MAX_INDEX) {
|
|
533
|
+
currentIndex = 0;
|
|
534
|
+
}
|
|
535
|
+
if (direction === 'previous' && currentIndex === MIN_INDEX) {
|
|
536
|
+
currentIndex = MAX_INDEX;
|
|
537
|
+
}
|
|
406
538
|
}
|
|
407
539
|
return currentIndex;
|
|
408
540
|
}
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
541
|
+
/**
|
|
542
|
+
* Selects the non-disabled option with the index passed as a parameter.
|
|
543
|
+
* The method sends an event to the state machine (the same as when clicking on an option with the mouse)
|
|
544
|
+
* @param indexToSelect Option index within non-deactivated options list
|
|
545
|
+
* @param fromKeyboard
|
|
546
|
+
* @private
|
|
547
|
+
*/
|
|
548
|
+
selectOption(indexToSelect, fromKeyboard = false) {
|
|
549
|
+
const optionToSelect = this.notDisabledOptions[indexToSelect];
|
|
550
|
+
if (!optionToSelect)
|
|
551
|
+
return;
|
|
412
552
|
this.sendOptionSelectedToStateMachine({
|
|
413
|
-
source:
|
|
414
|
-
value:
|
|
415
|
-
displayText:
|
|
416
|
-
});
|
|
553
|
+
source: optionToSelect,
|
|
554
|
+
value: optionToSelect.value,
|
|
555
|
+
displayText: optionToSelect.innerText
|
|
556
|
+
}, fromKeyboard);
|
|
417
557
|
}
|
|
418
558
|
selectClosestOption(direction) {
|
|
419
|
-
const indexToSelect = this.getClosestActiveOptionIndexForState(direction, '
|
|
559
|
+
const indexToSelect = this.getClosestActiveOptionIndexForState(direction, 'modified');
|
|
420
560
|
if (indexToSelect === 'nothing')
|
|
421
561
|
return;
|
|
422
|
-
this.selectOption(indexToSelect);
|
|
562
|
+
this.selectOption(indexToSelect, true);
|
|
423
563
|
}
|
|
424
564
|
selectFirstOption() {
|
|
425
565
|
if (this.notDisabledOptions.length < 1) {
|
|
426
566
|
return;
|
|
427
567
|
}
|
|
428
|
-
this.selectOption(0);
|
|
568
|
+
this.selectOption(0, true);
|
|
429
569
|
}
|
|
430
570
|
selectLastOption() {
|
|
431
571
|
if (this.notDisabledOptions.length < 1) {
|
|
432
572
|
return;
|
|
433
573
|
}
|
|
434
|
-
this.selectOption(this.notDisabledOptions.length - 1);
|
|
574
|
+
this.selectOption(this.notDisabledOptions.length - 1, true);
|
|
435
575
|
}
|
|
436
576
|
focusOption(indexToFocus) {
|
|
437
577
|
var _a;
|
|
@@ -454,8 +594,8 @@ export class Select {
|
|
|
454
594
|
selectedOptionChanged(event) {
|
|
455
595
|
this.sendOptionSelectedToStateMachine(event.detail);
|
|
456
596
|
}
|
|
457
|
-
sendOptionSelectedToStateMachine(event) {
|
|
458
|
-
this.stateService.send({ type: 'OPTION_SELECTED', value: event });
|
|
597
|
+
sendOptionSelectedToStateMachine(event, fromKeyboard = false) {
|
|
598
|
+
this.stateService.send({ type: 'OPTION_SELECTED', value: { option: event, fromKeyboard } });
|
|
459
599
|
}
|
|
460
600
|
onSlotchange() {
|
|
461
601
|
this.updateSelectedValue(this.value);
|
|
@@ -468,22 +608,115 @@ export class Select {
|
|
|
468
608
|
}
|
|
469
609
|
});
|
|
470
610
|
}
|
|
611
|
+
//region Autocomplete mode
|
|
612
|
+
highlightOption(indexToHighlight) {
|
|
613
|
+
this.clearHighlightOnLastHighlightedOption();
|
|
614
|
+
this.lastHighlightedOptionElement = this.notDisabledOptions[indexToHighlight];
|
|
615
|
+
if (this.lastHighlightedOptionElement) {
|
|
616
|
+
this.lastHighlightedOptionElement.highlighted = true;
|
|
617
|
+
this.autocompleteInput.setAttribute("aria-activedescendant", this.lastHighlightedOptionElement.id);
|
|
618
|
+
requestAnimationFrame(() => {
|
|
619
|
+
this.lastHighlightedOptionElement.scrollIntoView({ block: "nearest", inline: "nearest" });
|
|
620
|
+
});
|
|
621
|
+
}
|
|
622
|
+
}
|
|
623
|
+
highlightFirstOption() {
|
|
624
|
+
this.highlightOption(0);
|
|
625
|
+
}
|
|
626
|
+
highlightLastOption() {
|
|
627
|
+
this.highlightOption(this.notDisabledOptions.length - 1);
|
|
628
|
+
}
|
|
629
|
+
highlightClosestOption(direction) {
|
|
630
|
+
const indexToHighlight = this.getClosestActiveOptionIndexForState(direction, 'highlighted');
|
|
631
|
+
if (indexToHighlight === 'nothing')
|
|
632
|
+
return;
|
|
633
|
+
this.highlightOption(indexToHighlight);
|
|
634
|
+
}
|
|
635
|
+
/**
|
|
636
|
+
* This method removes the highlight that applies to the last highlighted option if any.
|
|
637
|
+
* This is used only for accessibility of autocomplete mode.
|
|
638
|
+
* @private
|
|
639
|
+
*/
|
|
640
|
+
clearHighlightOnLastHighlightedOption() {
|
|
641
|
+
if (this.lastHighlightedOptionElement) {
|
|
642
|
+
this.lastHighlightedOptionElement.highlighted = false;
|
|
643
|
+
this.lastHighlightedOptionElement = null;
|
|
644
|
+
}
|
|
645
|
+
}
|
|
646
|
+
onAutocompleteInputEvent(e) {
|
|
647
|
+
var _a;
|
|
648
|
+
const filter = (_a = this.autocompleteInput.value) !== null && _a !== void 0 ? _a : '';
|
|
649
|
+
this.handleAutocompleteValueChange(filter);
|
|
650
|
+
// Avoid the inputEvent event to bubble and be emitted, we rather use wcsFilterChange in this case :
|
|
651
|
+
e.stopPropagation();
|
|
652
|
+
}
|
|
653
|
+
handleAutocompleteValueChange(filter) {
|
|
654
|
+
var _a, _b;
|
|
655
|
+
this.clearHighlightOnLastHighlightedOption();
|
|
656
|
+
const newValueIsDifferentFromLastModifiedOption = this.lastModifiedOptionElement == null || ((_a = this.lastModifiedOptionElement) === null || _a === void 0 ? void 0 : _a.textContent) !== this.autocompleteValue;
|
|
657
|
+
if (!this.expanded && newValueIsDifferentFromLastModifiedOption) {
|
|
658
|
+
this.open();
|
|
659
|
+
}
|
|
660
|
+
if (filter.length) {
|
|
661
|
+
const [matchingOptions, optionsToHide] = [[], []];
|
|
662
|
+
const filteringFunction = (_b = this.filterFn) !== null && _b !== void 0 ? _b : WcsDefaultSelectFilterFn;
|
|
663
|
+
this.options.forEach((optionEl) => (filteringFunction(optionEl, filter) ? matchingOptions : optionsToHide).push(optionEl));
|
|
664
|
+
this.showNoResultFoundLabel = matchingOptions.length === 0;
|
|
665
|
+
matchingOptions.forEach(o => {
|
|
666
|
+
o.hidden = false;
|
|
667
|
+
o.removeAttribute("aria-hidden");
|
|
668
|
+
});
|
|
669
|
+
optionsToHide.forEach(o => {
|
|
670
|
+
o.hidden = true;
|
|
671
|
+
o.setAttribute("aria-hidden", "true");
|
|
672
|
+
});
|
|
673
|
+
}
|
|
674
|
+
else {
|
|
675
|
+
this.showNoResultFoundLabel = false;
|
|
676
|
+
this.options.forEach(o => {
|
|
677
|
+
o.hidden = false;
|
|
678
|
+
o.removeAttribute("aria-hidden");
|
|
679
|
+
});
|
|
680
|
+
}
|
|
681
|
+
this.autocompleteValue = filter;
|
|
682
|
+
this.wcsFilterChange.emit({
|
|
683
|
+
value: filter,
|
|
684
|
+
});
|
|
685
|
+
}
|
|
686
|
+
onFocus() {
|
|
687
|
+
if (this.autocomplete) {
|
|
688
|
+
this.focusAutocompleteInput();
|
|
689
|
+
}
|
|
690
|
+
}
|
|
691
|
+
focusAutocompleteInput() {
|
|
692
|
+
var _a;
|
|
693
|
+
(_a = this.autocompleteInput) === null || _a === void 0 ? void 0 : _a.focus();
|
|
694
|
+
}
|
|
695
|
+
//endregion
|
|
471
696
|
componentDidRender() {
|
|
472
697
|
var _a;
|
|
473
698
|
(_a = this.popper) === null || _a === void 0 ? void 0 : _a.update();
|
|
474
699
|
}
|
|
475
700
|
render() {
|
|
701
|
+
var _a;
|
|
476
702
|
const ariaLabelValue = `${this.labelElement ? this.labelElement.innerText : ''} ${this.hasValue ? this.displayText : ''}`.trimEnd();
|
|
477
|
-
return (h(Host, Object.assign({ class: this.expanded ? 'expanded ' : '', overlayDirection: this.overlayDirection }, this.focusedAttributes(), { role: "combobox", "aria-haspopup": "listbox", "aria-
|
|
703
|
+
return (h(Host, Object.assign({ class: this.expanded ? 'expanded ' : '', overlayDirection: this.overlayDirection }, this.focusedAttributes(), { role: !this.autocomplete ? "combobox" : null, "aria-haspopup": !this.autocomplete ? "listbox" : null, "aria-owns": !this.autocomplete ? this.optionsId : null, "aria-controls": !this.autocomplete ? this.optionsId : null, "aria-disabled": this.disabled ? 'true' : null, "aria-expanded": this.expanded ? 'true' : 'false', "aria-multiselectable": this.multiple ? 'true' : 'false', "aria-label": ariaLabelValue }), h("div", { class: "wcs-select-control" }, h("div", { class: "wcs-select-value-container" }, this.hasValue
|
|
478
704
|
?
|
|
479
705
|
(this.chips ?
|
|
480
706
|
this.values.map((option) => h(SelectChips, { disabled: this.disabled, option: option, onRemove: this.removeChip.bind(this) }))
|
|
481
|
-
:
|
|
482
|
-
|
|
707
|
+
: (!this.autocomplete || this.autocomplete && this.multiple) &&
|
|
708
|
+
h("label", { class: "wcs-select-value" }, this.displayText))
|
|
709
|
+
: !this.autocomplete && h("label", { class: "wcs-select-placeholder" }, this.placeholder), this.autocomplete && h("input", { class: "autocomplete-field", value: this.autocompleteValue, role: "combobox", "aria-haspopup": "listbox", "aria-label": ariaLabelValue, "aria-disabled": this.disabled ? 'true' : null, "aria-expanded": this.expanded ? 'true' : 'false', "aria-controls": this.optionsId, "aria-owns": this.optionsId, "aria-multiselectable": this.multiple ? 'true' : 'false', "aria-autocomplete": "list", onBlur: (e) => this.onAutocompleteFieldBlur(e), placeholder: ((_a = this.values) === null || _a === void 0 ? void 0 : _a.length) ? null : this.placeholder, onInput: (e) => this.onAutocompleteInputEvent(e), ref: el => this.autocompleteInput = el })), h(SelectArrow, { up: this.expanded })), h("div", { class: "wcs-select-options", id: this.optionsId, role: "listbox" }, h("slot", { name: "options", onSlotchange: this.onSlotchange.bind(this) }), (this.autocomplete && this.showNoResultFoundLabel) &&
|
|
710
|
+
h("div", { class: "noresult-container" }, h("slot", { name: "filter-no-result" }, h("span", null, "Aucun r\u00E9sultat"))))));
|
|
483
711
|
}
|
|
484
712
|
focusedAttributes() {
|
|
485
713
|
return !this.disabled ? { tabIndex: 0 } : {};
|
|
486
714
|
}
|
|
715
|
+
onAutocompleteFieldBlur(_e) {
|
|
716
|
+
if (this.multiple === false && this.autocomplete === true) {
|
|
717
|
+
this.autocompleteValue = this.displayText;
|
|
718
|
+
}
|
|
719
|
+
}
|
|
487
720
|
static get is() { return "wcs-select"; }
|
|
488
721
|
static get encapsulation() { return "shadow"; }
|
|
489
722
|
static get originalStyleUrls() {
|
|
@@ -591,6 +824,44 @@ export class Select {
|
|
|
591
824
|
"reflect": true,
|
|
592
825
|
"defaultValue": "false"
|
|
593
826
|
},
|
|
827
|
+
"autocomplete": {
|
|
828
|
+
"type": "boolean",
|
|
829
|
+
"mutable": false,
|
|
830
|
+
"complexType": {
|
|
831
|
+
"original": "boolean",
|
|
832
|
+
"resolved": "boolean",
|
|
833
|
+
"references": {}
|
|
834
|
+
},
|
|
835
|
+
"required": false,
|
|
836
|
+
"optional": false,
|
|
837
|
+
"docs": {
|
|
838
|
+
"tags": [],
|
|
839
|
+
"text": "If `true`, the select acts as an autocomplete field to filter your results."
|
|
840
|
+
},
|
|
841
|
+
"attribute": "autocomplete",
|
|
842
|
+
"reflect": true,
|
|
843
|
+
"defaultValue": "false"
|
|
844
|
+
},
|
|
845
|
+
"filterFn": {
|
|
846
|
+
"type": "unknown",
|
|
847
|
+
"mutable": false,
|
|
848
|
+
"complexType": {
|
|
849
|
+
"original": "WcsSelectFilterFn",
|
|
850
|
+
"resolved": "(optionEl: HTMLWcsSelectOptionElement, filter: string) => boolean",
|
|
851
|
+
"references": {
|
|
852
|
+
"WcsSelectFilterFn": {
|
|
853
|
+
"location": "import",
|
|
854
|
+
"path": "./select-interface"
|
|
855
|
+
}
|
|
856
|
+
}
|
|
857
|
+
},
|
|
858
|
+
"required": false,
|
|
859
|
+
"optional": false,
|
|
860
|
+
"docs": {
|
|
861
|
+
"tags": [],
|
|
862
|
+
"text": "Customizable sort function to change the comparison of values. If not provided, uses the default behavior :\n`option.textContent.toLowerCase().startsWith(filter.toLowerCase())`"
|
|
863
|
+
}
|
|
864
|
+
},
|
|
594
865
|
"chips": {
|
|
595
866
|
"type": "boolean",
|
|
596
867
|
"mutable": false,
|
|
@@ -647,9 +918,10 @@ export class Select {
|
|
|
647
918
|
static get states() {
|
|
648
919
|
return {
|
|
649
920
|
"expanded": {},
|
|
650
|
-
"hasLoaded": {},
|
|
651
921
|
"displayText": {},
|
|
652
922
|
"focused": {},
|
|
923
|
+
"showNoResultFoundLabel": {},
|
|
924
|
+
"autocompleteValue": {},
|
|
653
925
|
"overlayDirection": {}
|
|
654
926
|
};
|
|
655
927
|
}
|
|
@@ -704,6 +976,26 @@ export class Select {
|
|
|
704
976
|
"resolved": "void",
|
|
705
977
|
"references": {}
|
|
706
978
|
}
|
|
979
|
+
}, {
|
|
980
|
+
"method": "wcsFilterChange",
|
|
981
|
+
"name": "wcsFilterChange",
|
|
982
|
+
"bubbles": true,
|
|
983
|
+
"cancelable": true,
|
|
984
|
+
"composed": true,
|
|
985
|
+
"docs": {
|
|
986
|
+
"tags": [],
|
|
987
|
+
"text": "Emitted when the autocomplete filter has changed."
|
|
988
|
+
},
|
|
989
|
+
"complexType": {
|
|
990
|
+
"original": "SelectFilerChangeEventDetail",
|
|
991
|
+
"resolved": "SelectFilerChangeEventDetail",
|
|
992
|
+
"references": {
|
|
993
|
+
"SelectFilerChangeEventDetail": {
|
|
994
|
+
"location": "import",
|
|
995
|
+
"path": "./select-interface"
|
|
996
|
+
}
|
|
997
|
+
}
|
|
998
|
+
}
|
|
707
999
|
}];
|
|
708
1000
|
}
|
|
709
1001
|
static get methods() {
|
|
@@ -739,6 +1031,32 @@ export class Select {
|
|
|
739
1031
|
"text": "Close the component.",
|
|
740
1032
|
"tags": []
|
|
741
1033
|
}
|
|
1034
|
+
},
|
|
1035
|
+
"setAriaAttribute": {
|
|
1036
|
+
"complexType": {
|
|
1037
|
+
"signature": "(attr: AriaAttributeName, value: string) => Promise<void>",
|
|
1038
|
+
"parameters": [{
|
|
1039
|
+
"tags": [],
|
|
1040
|
+
"text": ""
|
|
1041
|
+
}, {
|
|
1042
|
+
"tags": [],
|
|
1043
|
+
"text": ""
|
|
1044
|
+
}],
|
|
1045
|
+
"references": {
|
|
1046
|
+
"Promise": {
|
|
1047
|
+
"location": "global"
|
|
1048
|
+
},
|
|
1049
|
+
"AriaAttributeName": {
|
|
1050
|
+
"location": "import",
|
|
1051
|
+
"path": "../../utils/mutable-aria-attribute"
|
|
1052
|
+
}
|
|
1053
|
+
},
|
|
1054
|
+
"return": "Promise<void>"
|
|
1055
|
+
},
|
|
1056
|
+
"docs": {
|
|
1057
|
+
"text": "",
|
|
1058
|
+
"tags": []
|
|
1059
|
+
}
|
|
742
1060
|
}
|
|
743
1061
|
};
|
|
744
1062
|
}
|
|
@@ -774,6 +1092,12 @@ export class Select {
|
|
|
774
1092
|
"target": undefined,
|
|
775
1093
|
"capture": false,
|
|
776
1094
|
"passive": false
|
|
1095
|
+
}, {
|
|
1096
|
+
"name": "focus",
|
|
1097
|
+
"method": "onFocus",
|
|
1098
|
+
"target": undefined,
|
|
1099
|
+
"capture": false,
|
|
1100
|
+
"passive": false
|
|
777
1101
|
}];
|
|
778
1102
|
}
|
|
779
1103
|
}
|