@ouestfrance/sipa-bms-ui 7.14.1
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 +280 -0
- package/dist/assets/animated-icons/AnimatedActivityIcon.vue.d.ts +133 -0
- package/dist/assets/animated-icons/AnimatedCircleHelpIcon.vue.d.ts +133 -0
- package/dist/assets/animated-icons/AnimatedHomeIcon.vue.d.ts +133 -0
- package/dist/components/button/BmsButton.spec.d.ts +1 -0
- package/dist/components/button/BmsButton.vue.d.ts +24 -0
- package/dist/components/button/BmsIconButton.vue.d.ts +23 -0
- package/dist/components/button/UiButton.vue.d.ts +26 -0
- package/dist/components/button/UiButtonLink.vue.d.ts +20 -0
- package/dist/components/feedback/BmsAlert.vue.d.ts +24 -0
- package/dist/components/feedback/BmsBadge.vue.d.ts +18 -0
- package/dist/components/feedback/BmsCaption.vue.d.ts +6 -0
- package/dist/components/feedback/BmsCircularProgress.spec.d.ts +1 -0
- package/dist/components/feedback/BmsCircularProgress.vue.d.ts +6 -0
- package/dist/components/feedback/BmsLoader.spec.d.ts +1 -0
- package/dist/components/feedback/BmsLoader.vue.d.ts +9 -0
- package/dist/components/feedback/BmsTooltip.vue.d.ts +28 -0
- package/dist/components/feedback/UiTooltip.spec.d.ts +1 -0
- package/dist/components/feedback/UiTooltip.vue.d.ts +27 -0
- package/dist/components/feedback/tooltip.helper.d.ts +45 -0
- package/dist/components/feedback/tooltip.helper.spec.d.ts +1 -0
- package/dist/components/form/BmsAutocomplete.vue.d.ts +31 -0
- package/dist/components/form/BmsBetweenInput.vue.d.ts +32 -0
- package/dist/components/form/BmsChip.vue.d.ts +15 -0
- package/dist/components/form/BmsFilePicker.spec.d.ts +1 -0
- package/dist/components/form/BmsFilePicker.vue.d.ts +12 -0
- package/dist/components/form/BmsInputBooleanCheckbox.vue.d.ts +30 -0
- package/dist/components/form/BmsInputCheckboxCaption.spec.d.ts +1 -0
- package/dist/components/form/BmsInputCheckboxCaption.vue.d.ts +31 -0
- package/dist/components/form/BmsInputCheckboxCaptionGroup.vue.d.ts +25 -0
- package/dist/components/form/BmsInputCheckboxGroup.vue.d.ts +24 -0
- package/dist/components/form/BmsInputCode.vue.d.ts +27 -0
- package/dist/components/form/BmsInputDateTime.vue.d.ts +24 -0
- package/dist/components/form/BmsInputFile.spec.d.ts +1 -0
- package/dist/components/form/BmsInputFile.vue.d.ts +27 -0
- package/dist/components/form/BmsInputNumber.spec.d.ts +1 -0
- package/dist/components/form/BmsInputNumber.vue.d.ts +26 -0
- package/dist/components/form/BmsInputRadio.vue.d.ts +28 -0
- package/dist/components/form/BmsInputRadioCaption.vue.d.ts +30 -0
- package/dist/components/form/BmsInputRadioCaptionGroup.vue.d.ts +30 -0
- package/dist/components/form/BmsInputRadioGroup.vue.d.ts +30 -0
- package/dist/components/form/BmsInputText.spec.d.ts +1 -0
- package/dist/components/form/BmsInputText.vue.d.ts +128 -0
- package/dist/components/form/BmsInputToggle.vue.d.ts +15 -0
- package/dist/components/form/BmsSearch.spec.d.ts +1 -0
- package/dist/components/form/BmsSearch.vue.d.ts +187 -0
- package/dist/components/form/BmsSelect.spec.d.ts +1 -0
- package/dist/components/form/BmsSelect.vue.d.ts +34 -0
- package/dist/components/form/BmsTag.vue.d.ts +25 -0
- package/dist/components/form/BmsTextArea.spec.d.ts +1 -0
- package/dist/components/form/BmsTextArea.vue.d.ts +26 -0
- package/dist/components/form/RawAutocomplete.spec.d.ts +1 -0
- package/dist/components/form/RawAutocomplete.vue.d.ts +130 -0
- package/dist/components/form/RawInputText.vue.d.ts +42 -0
- package/dist/components/form/UiBmsInputCheckbox.vue.d.ts +28 -0
- package/dist/components/form/UiBmsSwitch.vue.d.ts +14 -0
- package/dist/components/layout/BmsCard.vue.d.ts +21 -0
- package/dist/components/layout/BmsContentPageLayout.vue.d.ts +17 -0
- package/dist/components/layout/BmsForm.vue.d.ts +7 -0
- package/dist/components/layout/BmsHeader.vue.d.ts +9 -0
- package/dist/components/layout/BmsHeaderTitle.vue.d.ts +22 -0
- package/dist/components/layout/BmsModal.spec.d.ts +1 -0
- package/dist/components/layout/BmsModal.vue.d.ts +60 -0
- package/dist/components/layout/BmsOverlay.vue.d.ts +13 -0
- package/dist/components/layout/BmsSection.vue.d.ts +15 -0
- package/dist/components/layout/BmsStep.vue.d.ts +27 -0
- package/dist/components/layout/BmsStepper.vue.d.ts +13 -0
- package/dist/components/layout/UiPopoverMenu.vue.d.ts +23 -0
- package/dist/components/navigation/BmsBackButton.vue.d.ts +13 -0
- package/dist/components/navigation/BmsBreadcrumb.vue.d.ts +12 -0
- package/dist/components/navigation/BmsLink.spec.d.ts +1 -0
- package/dist/components/navigation/BmsLink.vue.d.ts +22 -0
- package/dist/components/navigation/BmsMenu.spec.d.ts +1 -0
- package/dist/components/navigation/BmsMenu.vue.d.ts +21 -0
- package/dist/components/navigation/BmsMenuNav.spec.d.ts +1 -0
- package/dist/components/navigation/BmsMenuNav.vue.d.ts +23 -0
- package/dist/components/navigation/BmsShortLinkMenu.vue.d.ts +20 -0
- package/dist/components/navigation/BmsTabs.vue.d.ts +7 -0
- package/dist/components/navigation/BmsTenantSwitcher.vue.d.ts +22 -0
- package/dist/components/navigation/UiMenuItem.vue.d.ts +11 -0
- package/dist/components/navigation/UiTab.vue.d.ts +15 -0
- package/dist/components/navigation/UiTenantImage.vue.d.ts +6 -0
- package/dist/components/navigation/UiTenantLabel.vue.d.ts +12 -0
- package/dist/components/navigation/UiTenantSwitcher.spec.d.ts +1 -0
- package/dist/components/navigation/UiTenantSwitcher.vue.d.ts +189 -0
- package/dist/components/table/BmsEmptyScreen.vue.d.ts +6 -0
- package/dist/components/table/BmsPagination.spec.d.ts +1 -0
- package/dist/components/table/BmsPagination.vue.d.ts +35 -0
- package/dist/components/table/BmsServerTable.vue.d.ts +74 -0
- package/dist/components/table/BmsTable.spec.d.ts +1 -0
- package/dist/components/table/BmsTable.vue.d.ts +53 -0
- package/dist/components/table/BmsTableFilters.spec.d.ts +1 -0
- package/dist/components/table/BmsTableFilters.vue.d.ts +188 -0
- package/dist/components/table/DraggableList.vue.d.ts +26 -0
- package/dist/components/table/UiBmsTable.spec.d.ts +1 -0
- package/dist/components/table/UiBmsTable.vue.d.ts +66 -0
- package/dist/components/table/UiFilterButton.vue.d.ts +13 -0
- package/dist/components/utils/BmsCocarde.vue.d.ts +11 -0
- package/dist/components/utils/BmsProblem.vue.d.ts +9 -0
- package/dist/components/utils/BmsRelativeTime.spec.d.ts +1 -0
- package/dist/components/utils/BmsRelativeTime.vue.d.ts +11 -0
- package/dist/composables/clipboard.composable.d.ts +3 -0
- package/dist/composables/index.d.ts +5 -0
- package/dist/composables/pagination.composable.d.ts +14 -0
- package/dist/composables/pagination.composable.spec.d.ts +1 -0
- package/dist/composables/search.composable.d.ts +52 -0
- package/dist/composables/search.composable.spec.d.ts +1 -0
- package/dist/composables/search.helper.d.ts +7 -0
- package/dist/composables/search.helper.spec.d.ts +1 -0
- package/dist/composables/sort.composable.d.ts +10 -0
- package/dist/composables/sort.composable.spec.d.ts +1 -0
- package/dist/composables/userPref.composable.d.ts +6 -0
- package/dist/composables/userPref.composable.spec.d.ts +1 -0
- package/dist/favicon.ico +0 -0
- package/dist/helpers/cocarde.helper.d.ts +1 -0
- package/dist/helpers/cocarde.helper.spec.d.ts +1 -0
- package/dist/helpers/date.helper.d.ts +26 -0
- package/dist/helpers/date.helper.spec.d.ts +1 -0
- package/dist/helpers/file.helper.d.ts +5 -0
- package/dist/helpers/file.helper.spec.d.ts +1 -0
- package/dist/helpers/index.d.ts +6 -0
- package/dist/helpers/location.helper.d.ts +10 -0
- package/dist/helpers/location.helper.spec.d.ts +1 -0
- package/dist/helpers/problem.helper.d.ts +1 -0
- package/dist/helpers/problem.helper.spec.d.ts +1 -0
- package/dist/helpers/string.helper.d.ts +9 -0
- package/dist/helpers/string.helper.spec.d.ts +1 -0
- package/dist/helpers/table.helper.d.ts +16 -0
- package/dist/helpers/table.helper.spec.d.ts +1 -0
- package/dist/index.d.ts +72 -0
- package/dist/logo.png +0 -0
- package/dist/main.d.ts +0 -0
- package/dist/mockServiceWorker.js +344 -0
- package/dist/models/breadcrumb.model.d.ts +5 -0
- package/dist/models/caption.model.d.ts +6 -0
- package/dist/models/chip.model.d.ts +8 -0
- package/dist/models/cocarde.model.d.ts +4 -0
- package/dist/models/form.model.d.ts +25 -0
- package/dist/models/index.d.ts +14 -0
- package/dist/models/menu.model.d.ts +18 -0
- package/dist/models/modal.model.d.ts +8 -0
- package/dist/models/problem.model.d.ts +14 -0
- package/dist/models/sort.model.d.ts +11 -0
- package/dist/models/status-type.model.d.ts +7 -0
- package/dist/models/tab.model.d.ts +7 -0
- package/dist/models/table.model.d.ts +53 -0
- package/dist/models/tenant.model.d.ts +7 -0
- package/dist/models/tooltip.model.d.ts +6 -0
- package/dist/plugins/confirm/index.d.ts +9 -0
- package/dist/plugins/feature-flipper/FeatureFlipper.vue.d.ts +9 -0
- package/dist/plugins/feature-flipper/FeatureFlipperIndicator.vue.d.ts +6 -0
- package/dist/plugins/feature-flipper/FeatureFlipperModal.vue.d.ts +16 -0
- package/dist/plugins/feature-flipper/featureFlipper.composable.d.ts +10 -0
- package/dist/plugins/feature-flipper/featureFlipper.composable.spec.d.ts +1 -0
- package/dist/plugins/feature-flipper/featureFlipper.model.d.ts +3 -0
- package/dist/plugins/feature-flipper/index.d.ts +4 -0
- package/dist/plugins/field/FieldComponent.spec.d.ts +1 -0
- package/dist/plugins/field/FieldComponent.vue.d.ts +25 -0
- package/dist/plugins/field/FieldDatalist.vue.d.ts +27 -0
- package/dist/plugins/field/index.d.ts +2 -0
- package/dist/plugins/keycloak-auth-adapter/index.d.ts +20 -0
- package/dist/plugins/notifications/NotificationItem.vue.d.ts +12 -0
- package/dist/plugins/notifications/NotificationWidget.vue.d.ts +2 -0
- package/dist/plugins/notifications/index.d.ts +11 -0
- package/dist/plugins/notifications/notification.model.d.ts +20 -0
- package/dist/plugins/router-history/index.d.ts +6 -0
- package/dist/plugins/router-history/router-history.composable.d.ts +7 -0
- package/dist/plugins/router-history/router-history.composable.spec.d.ts +1 -0
- package/dist/plugins/runtime-env/index.d.ts +7 -0
- package/dist/services/index.d.ts +1 -0
- package/dist/services/konami.service.d.ts +2 -0
- package/dist/showroom/App.vue.d.ts +2 -0
- package/dist/showroom/router.d.ts +8 -0
- package/dist/sipa-bms-ui.css +3024 -0
- package/dist/sipa-bms-ui.es.js +102694 -0
- package/dist/sipa-bms-ui.es.js.map +1 -0
- package/dist/sipa-bms-ui.umd.js +102815 -0
- package/dist/sipa-bms-ui.umd.js.map +1 -0
- package/package.json +126 -0
- package/src/assets/animated-icons/AnimatedActivityIcon.vue +77 -0
- package/src/assets/animated-icons/AnimatedCircleHelpIcon.vue +67 -0
- package/src/assets/animated-icons/AnimatedHomeIcon.vue +69 -0
- package/src/assets/empty.svg +1 -0
- package/src/assets/scss/_conf.scss +203 -0
- package/src/assets/scss/_formkit.scss +353 -0
- package/src/assets/scss/app.scss +11 -0
- package/src/assets/scss/global-variables.scss +56 -0
- package/src/components/button/BmsAllButtons.stories.js +56 -0
- package/src/components/button/BmsButton.spec.ts +37 -0
- package/src/components/button/BmsButton.stories.js +84 -0
- package/src/components/button/BmsButton.vue +50 -0
- package/src/components/button/BmsIconButton.stories.js +67 -0
- package/src/components/button/BmsIconButton.vue +34 -0
- package/src/components/button/UiButton.stories.js +131 -0
- package/src/components/button/UiButton.vue +37 -0
- package/src/components/button/UiButtonLink.vue +186 -0
- package/src/components/feedback/BmsAlert.stories.js +75 -0
- package/src/components/feedback/BmsAlert.vue +91 -0
- package/src/components/feedback/BmsBadge.stories.js +34 -0
- package/src/components/feedback/BmsBadge.vue +76 -0
- package/src/components/feedback/BmsCaption.stories.js +59 -0
- package/src/components/feedback/BmsCaption.vue +88 -0
- package/src/components/feedback/BmsCircularProgress.spec.ts +14 -0
- package/src/components/feedback/BmsCircularProgress.stories.js +45 -0
- package/src/components/feedback/BmsCircularProgress.vue +64 -0
- package/src/components/feedback/BmsLoader.spec.ts +7 -0
- package/src/components/feedback/BmsLoader.stories.js +31 -0
- package/src/components/feedback/BmsLoader.vue +82 -0
- package/src/components/feedback/BmsTooltip.stories.js +65 -0
- package/src/components/feedback/BmsTooltip.vue +102 -0
- package/src/components/feedback/Notification.stories.js +37 -0
- package/src/components/feedback/UiTooltip.spec.ts +62 -0
- package/src/components/feedback/UiTooltip.stories.js +71 -0
- package/src/components/feedback/UiTooltip.vue +219 -0
- package/src/components/feedback/tooltip.helper.spec.ts +92 -0
- package/src/components/feedback/tooltip.helper.ts +121 -0
- package/src/components/form/BmsAutocomplete.stories.js +90 -0
- package/src/components/form/BmsAutocomplete.vue +100 -0
- package/src/components/form/BmsBetweenInput.stories.js +69 -0
- package/src/components/form/BmsBetweenInput.vue +146 -0
- package/src/components/form/BmsChip.stories.js +65 -0
- package/src/components/form/BmsChip.vue +92 -0
- package/src/components/form/BmsFilePicker.spec.ts +94 -0
- package/src/components/form/BmsFilePicker.stories.js +53 -0
- package/src/components/form/BmsFilePicker.vue +186 -0
- package/src/components/form/BmsInputBooleanCheckbox.stories.js +90 -0
- package/src/components/form/BmsInputBooleanCheckbox.vue +70 -0
- package/src/components/form/BmsInputCheckboxCaption.spec.ts +45 -0
- package/src/components/form/BmsInputCheckboxCaption.stories.js +92 -0
- package/src/components/form/BmsInputCheckboxCaption.vue +126 -0
- package/src/components/form/BmsInputCheckboxCaptionGroup.stories.js +153 -0
- package/src/components/form/BmsInputCheckboxCaptionGroup.vue +81 -0
- package/src/components/form/BmsInputCheckboxGroup.stories.js +94 -0
- package/src/components/form/BmsInputCheckboxGroup.vue +94 -0
- package/src/components/form/BmsInputCode.stories.js +43 -0
- package/src/components/form/BmsInputCode.vue +71 -0
- package/src/components/form/BmsInputDateTime.stories.js +71 -0
- package/src/components/form/BmsInputDateTime.vue +55 -0
- package/src/components/form/BmsInputFile.spec.ts +90 -0
- package/src/components/form/BmsInputFile.stories.js +156 -0
- package/src/components/form/BmsInputFile.vue +310 -0
- package/src/components/form/BmsInputNumber.spec.ts +40 -0
- package/src/components/form/BmsInputNumber.stories.js +79 -0
- package/src/components/form/BmsInputNumber.vue +67 -0
- package/src/components/form/BmsInputRadio.stories.js +79 -0
- package/src/components/form/BmsInputRadio.vue +121 -0
- package/src/components/form/BmsInputRadioCaption.stories.js +98 -0
- package/src/components/form/BmsInputRadioCaption.vue +110 -0
- package/src/components/form/BmsInputRadioCaptionGroup.stories.js +166 -0
- package/src/components/form/BmsInputRadioCaptionGroup.vue +81 -0
- package/src/components/form/BmsInputRadioGroup.stories.js +108 -0
- package/src/components/form/BmsInputRadioGroup.vue +93 -0
- package/src/components/form/BmsInputText.spec.ts +37 -0
- package/src/components/form/BmsInputText.stories.js +78 -0
- package/src/components/form/BmsInputText.vue +79 -0
- package/src/components/form/BmsInputToggle.stories.js +37 -0
- package/src/components/form/BmsInputToggle.vue +66 -0
- package/src/components/form/BmsSearch.spec.ts +41 -0
- package/src/components/form/BmsSearch.stories.js +70 -0
- package/src/components/form/BmsSearch.vue +62 -0
- package/src/components/form/BmsSelect.spec.ts +57 -0
- package/src/components/form/BmsSelect.stories.js +131 -0
- package/src/components/form/BmsSelect.vue +225 -0
- package/src/components/form/BmsTag.stories.js +64 -0
- package/src/components/form/BmsTag.vue +109 -0
- package/src/components/form/BmsTextArea.spec.ts +37 -0
- package/src/components/form/BmsTextArea.stories.js +74 -0
- package/src/components/form/BmsTextArea.vue +112 -0
- package/src/components/form/Form.stories.js +35 -0
- package/src/components/form/RawAutocomplete.spec.ts +103 -0
- package/src/components/form/RawAutocomplete.vue +218 -0
- package/src/components/form/RawInputText.vue +173 -0
- package/src/components/form/UiBmsInputCheckbox.stories.js +77 -0
- package/src/components/form/UiBmsInputCheckbox.vue +126 -0
- package/src/components/form/UiBmsSwitch.stories.js +40 -0
- package/src/components/form/UiBmsSwitch.vue +80 -0
- package/src/components/layout/BmsCard.stories.js +77 -0
- package/src/components/layout/BmsCard.vue +133 -0
- package/src/components/layout/BmsContentPageLayout.vue +92 -0
- package/src/components/layout/BmsForm.stories.js +30 -0
- package/src/components/layout/BmsForm.vue +42 -0
- package/src/components/layout/BmsHeader.stories.js +29 -0
- package/src/components/layout/BmsHeader.vue +16 -0
- package/src/components/layout/BmsHeaderTitle.stories.js +68 -0
- package/src/components/layout/BmsHeaderTitle.vue +76 -0
- package/src/components/layout/BmsModal.spec.ts +174 -0
- package/src/components/layout/BmsModal.stories.js +153 -0
- package/src/components/layout/BmsModal.vue +359 -0
- package/src/components/layout/BmsOverlay.stories.js +34 -0
- package/src/components/layout/BmsOverlay.vue +28 -0
- package/src/components/layout/BmsSection.stories.js +45 -0
- package/src/components/layout/BmsSection.vue +35 -0
- package/src/components/layout/BmsStep.stories.js +71 -0
- package/src/components/layout/BmsStep.vue +60 -0
- package/src/components/layout/BmsStepper.stories.js +57 -0
- package/src/components/layout/BmsStepper.vue +195 -0
- package/src/components/layout/UiPopoverMenu.vue +167 -0
- package/src/components/navigation/BmsBackButton.stories.js +27 -0
- package/src/components/navigation/BmsBackButton.vue +38 -0
- package/src/components/navigation/BmsBreadcrumb.stories.js +80 -0
- package/src/components/navigation/BmsBreadcrumb.vue +45 -0
- package/src/components/navigation/BmsLink.spec.ts +45 -0
- package/src/components/navigation/BmsLink.vue +59 -0
- package/src/components/navigation/BmsMenu.spec.ts +95 -0
- package/src/components/navigation/BmsMenu.stories.js +85 -0
- package/src/components/navigation/BmsMenu.vue +148 -0
- package/src/components/navigation/BmsMenuNav.spec.ts +140 -0
- package/src/components/navigation/BmsMenuNav.stories.js +187 -0
- package/src/components/navigation/BmsMenuNav.vue +217 -0
- package/src/components/navigation/BmsShortLinkMenu.stories.js +55 -0
- package/src/components/navigation/BmsShortLinkMenu.vue +59 -0
- package/src/components/navigation/BmsTabs.stories.js +30 -0
- package/src/components/navigation/BmsTabs.vue +46 -0
- package/src/components/navigation/BmsTenantSwitcher.stories.js +89 -0
- package/src/components/navigation/BmsTenantSwitcher.vue +135 -0
- package/src/components/navigation/UiMenuItem.stories.js +73 -0
- package/src/components/navigation/UiMenuItem.vue +116 -0
- package/src/components/navigation/UiMenuItemStatus.stories.js +58 -0
- package/src/components/navigation/UiTab.stories.js +56 -0
- package/src/components/navigation/UiTab.vue +71 -0
- package/src/components/navigation/UiTenantImage.vue +22 -0
- package/src/components/navigation/UiTenantLabel.vue +94 -0
- package/src/components/navigation/UiTenantSwitcher.spec.ts +167 -0
- package/src/components/navigation/UiTenantSwitcher.stories.js +70 -0
- package/src/components/navigation/UiTenantSwitcher.vue +161 -0
- package/src/components/table/BmsEmptyScreen.stories.js +32 -0
- package/src/components/table/BmsEmptyScreen.vue +54 -0
- package/src/components/table/BmsPagination.spec.ts +73 -0
- package/src/components/table/BmsPagination.stories.js +34 -0
- package/src/components/table/BmsPagination.vue +154 -0
- package/src/components/table/BmsServerTable.stories.js +422 -0
- package/src/components/table/BmsServerTable.vue +402 -0
- package/src/components/table/BmsTable.spec.ts +309 -0
- package/src/components/table/BmsTable.stories.js +930 -0
- package/src/components/table/BmsTable.vue +308 -0
- package/src/components/table/BmsTableFilters.spec.ts +494 -0
- package/src/components/table/BmsTableFilters.stories.js +114 -0
- package/src/components/table/BmsTableFilters.vue +268 -0
- package/src/components/table/DraggableList.stories.js +29 -0
- package/src/components/table/DraggableList.vue +179 -0
- package/src/components/table/UiBmsTable.spec.ts +373 -0
- package/src/components/table/UiBmsTable.stories.js +563 -0
- package/src/components/table/UiBmsTable.vue +617 -0
- package/src/components/table/UiFilterButton.stories.js +37 -0
- package/src/components/table/UiFilterButton.vue +85 -0
- package/src/components/utils/BmsCocarde.stories.js +47 -0
- package/src/components/utils/BmsCocarde.vue +66 -0
- package/src/components/utils/BmsProblem.stories.js +82 -0
- package/src/components/utils/BmsProblem.vue +223 -0
- package/src/components/utils/BmsRelativeTime.spec.ts +41 -0
- package/src/components/utils/BmsRelativeTime.stories.js +48 -0
- package/src/components/utils/BmsRelativeTime.vue +57 -0
- package/src/composables/clipboard.composable.ts +14 -0
- package/src/composables/index.ts +5 -0
- package/src/composables/pagination.composable.spec.ts +258 -0
- package/src/composables/pagination.composable.ts +111 -0
- package/src/composables/search.composable.spec.ts +1296 -0
- package/src/composables/search.composable.ts +316 -0
- package/src/composables/search.helper.spec.ts +339 -0
- package/src/composables/search.helper.ts +103 -0
- package/src/composables/sort.composable.spec.ts +349 -0
- package/src/composables/sort.composable.ts +129 -0
- package/src/composables/userPref.composable.spec.ts +115 -0
- package/src/composables/userPref.composable.ts +43 -0
- package/src/documentation/ColorTile.vue +23 -0
- package/src/documentation/assets/BmsIcon.png +0 -0
- package/src/documentation/assets/CoverBmsUI.png +0 -0
- package/src/documentation/assets/button/CoverPrimaryButton.png +0 -0
- package/src/documentation/assets/button/CoverSecondaryButton.png +0 -0
- package/src/documentation/assets/button/DoButtonLabel.png +0 -0
- package/src/documentation/assets/button/DontButtonLabel.png +0 -0
- package/src/documentation/assets/button/PrimaryButtonRepresentation.png +0 -0
- package/src/documentation/assets/cards/CardRepresentation.png +0 -0
- package/src/documentation/assets/cards/CoverCard.png +0 -0
- package/src/documentation/assets/chip/ChipRepresentation.png +0 -0
- package/src/documentation/assets/chip/CoverChips.png +0 -0
- package/src/documentation/assets/fields/Anatomy.png +0 -0
- package/src/documentation/assets/fields/CaptionRepresentation.png +0 -0
- package/src/documentation/assets/fields/CaptionTextRepresentation.png +0 -0
- package/src/documentation/assets/fields/CoverFieldsAnatomy.png +0 -0
- package/src/documentation/assets/fields/CoverInputFile.png +0 -0
- package/src/documentation/assets/fields/CoverInputText.png +0 -0
- package/src/documentation/assets/fields/CoverRadioCaptionGroup.png +0 -0
- package/src/documentation/assets/fields/CoverRadioGroup.png +0 -0
- package/src/documentation/assets/fields/CoverSearch.png +0 -0
- package/src/documentation/assets/fields/CoverSelect.png +0 -0
- package/src/documentation/assets/fields/CoverTextArea.png +0 -0
- package/src/documentation/assets/fields/FieldLabel.png +0 -0
- package/src/documentation/assets/fields/InputMediaRepresentation.png +0 -0
- package/src/documentation/assets/fields/InputRepresentation.png +0 -0
- package/src/documentation/assets/fields/InputSearchRepresentation.png +0 -0
- package/src/documentation/assets/fields/InputText.png +0 -0
- package/src/documentation/assets/fields/InputTextAreaRepresentation.png +0 -0
- package/src/documentation/assets/fields/LabelDo.png +0 -0
- package/src/documentation/assets/fields/LabelDont.png +0 -0
- package/src/documentation/assets/fields/LabelRepresentation.png +0 -0
- package/src/documentation/assets/fields/RadioCaptionGroupRepresentation.png +0 -0
- package/src/documentation/assets/fields/RadioGroupRepresentation.png +0 -0
- package/src/documentation/assets/fields/SelectRepresentation.png +0 -0
- package/src/documentation/assets/tag/CoverTag.png +0 -0
- package/src/documentation/assets/tag/TagRepresentation.png +0 -0
- package/src/documentation/button.mdx +24 -0
- package/src/documentation/card.mdx +28 -0
- package/src/documentation/chip.mdx +28 -0
- package/src/documentation/colors.mdx +118 -0
- package/src/documentation/fields.mdx +52 -0
- package/src/documentation/fields_text.mdx +31 -0
- package/src/documentation/icons.mdx +33 -0
- package/src/documentation/inputFile.mdx +28 -0
- package/src/documentation/primaryButton.mdx +20 -0
- package/src/documentation/principles.mdx +23 -0
- package/src/documentation/radioCaptionGroup.mdx +34 -0
- package/src/documentation/radioGroup.mdx +34 -0
- package/src/documentation/search.mdx +28 -0
- package/src/documentation/secondaryButton.mdx +17 -0
- package/src/documentation/select.mdx +31 -0
- package/src/documentation/tag.mdx +28 -0
- package/src/documentation/template_field_dependency.mdx +19 -0
- package/src/documentation/textArea.mdx +27 -0
- package/src/documentation/typography.mdx +93 -0
- package/src/documentation/typography.stories.js +26 -0
- package/src/helpers/cocarde.helper.spec.ts +14 -0
- package/src/helpers/cocarde.helper.ts +22 -0
- package/src/helpers/date.helper.spec.ts +91 -0
- package/src/helpers/date.helper.ts +105 -0
- package/src/helpers/file.helper.spec.ts +60 -0
- package/src/helpers/file.helper.ts +24 -0
- package/src/helpers/index.ts +6 -0
- package/src/helpers/location.helper.spec.ts +195 -0
- package/src/helpers/location.helper.ts +53 -0
- package/src/helpers/problem.helper.spec.ts +21 -0
- package/src/helpers/problem.helper.ts +4 -0
- package/src/helpers/string.helper.spec.ts +186 -0
- package/src/helpers/string.helper.ts +83 -0
- package/src/helpers/table.helper.spec.ts +141 -0
- package/src/helpers/table.helper.ts +88 -0
- package/src/index.ts +203 -0
- package/src/main.ts +25 -0
- package/src/models/breadcrumb.model.ts +6 -0
- package/src/models/caption.model.ts +7 -0
- package/src/models/chip.model.ts +8 -0
- package/src/models/cocarde.model.ts +4 -0
- package/src/models/form.model.ts +30 -0
- package/src/models/index.ts +14 -0
- package/src/models/menu.model.ts +20 -0
- package/src/models/modal.model.ts +9 -0
- package/src/models/problem.model.ts +10 -0
- package/src/models/sort.model.ts +13 -0
- package/src/models/status-type.model.ts +7 -0
- package/src/models/tab.model.ts +7 -0
- package/src/models/table.model.ts +58 -0
- package/src/models/tenant.model.ts +7 -0
- package/src/models/tooltip.model.ts +6 -0
- package/src/pages/Form.stories.js +83 -0
- package/src/pages/List.stories.js +88 -0
- package/src/plugins/confirm/index.ts +109 -0
- package/src/plugins/feature-flipper/FeatureFlipper.vue +23 -0
- package/src/plugins/feature-flipper/FeatureFlipperIndicator.vue +27 -0
- package/src/plugins/feature-flipper/FeatureFlipperModal.vue +68 -0
- package/src/plugins/feature-flipper/featureFlipper.composable.spec.ts +107 -0
- package/src/plugins/feature-flipper/featureFlipper.composable.ts +68 -0
- package/src/plugins/feature-flipper/featureFlipper.model.ts +1 -0
- package/src/plugins/feature-flipper/index.ts +15 -0
- package/src/plugins/field/FieldComponent.spec.ts +34 -0
- package/src/plugins/field/FieldComponent.stories.js +78 -0
- package/src/plugins/field/FieldComponent.vue +208 -0
- package/src/plugins/field/FieldDatalist.stories.js +35 -0
- package/src/plugins/field/FieldDatalist.vue +68 -0
- package/src/plugins/field/index.ts +31 -0
- package/src/plugins/keycloak-auth-adapter/index.ts +102 -0
- package/src/plugins/notifications/NotificationItem.stories.js +60 -0
- package/src/plugins/notifications/NotificationItem.vue +116 -0
- package/src/plugins/notifications/NotificationWidget.vue +129 -0
- package/src/plugins/notifications/index.ts +83 -0
- package/src/plugins/notifications/notification.model.ts +24 -0
- package/src/plugins/notifications/notifications.spec.js +78 -0
- package/src/plugins/router-history/index.ts +23 -0
- package/src/plugins/router-history/router-history.composable.spec.ts +323 -0
- package/src/plugins/router-history/router-history.composable.ts +47 -0
- package/src/plugins/runtime-env/index.ts +19 -0
- package/src/services/index.ts +1 -0
- package/src/services/konami.service.ts +28 -0
- package/src/showroom/App.vue +109 -0
- package/src/showroom/db.json +1967 -0
- package/src/showroom/pages/autocomplete.vue +54 -0
- package/src/showroom/pages/draggable-list.vue +20 -0
- package/src/showroom/pages/file-picker.vue +74 -0
- package/src/showroom/pages/forms.vue +389 -0
- package/src/showroom/pages/index.vue +209 -0
- package/src/showroom/pages/paginated-cards.vue +48 -0
- package/src/showroom/pages/server-table.vue +160 -0
- package/src/showroom/pages/stepper.vue +37 -0
- package/src/showroom/pages/table.vue +192 -0
- package/src/showroom/pages/tabs/[tabName].vue +28 -0
- package/src/showroom/router.ts +15 -0
- package/src/showroom/server.js +45 -0
- package/src/vite-env.d.ts +9 -0
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import BmsTextArea from '@/components/form/BmsTextArea.vue';
|
|
2
|
+
import { within } from 'storybook/test';
|
|
3
|
+
|
|
4
|
+
import template from '@/documentation/template_field_dependency.mdx';
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
parameters: {
|
|
8
|
+
docs: {
|
|
9
|
+
page: template,
|
|
10
|
+
},
|
|
11
|
+
},
|
|
12
|
+
title: 'Composants/form/TextArea',
|
|
13
|
+
component: BmsTextArea,
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
const Template = (args) => ({
|
|
17
|
+
setup() {
|
|
18
|
+
return { args };
|
|
19
|
+
},
|
|
20
|
+
components: {
|
|
21
|
+
BmsTextArea,
|
|
22
|
+
},
|
|
23
|
+
template: `
|
|
24
|
+
<BmsTextArea v-bind="args">
|
|
25
|
+
</BmsTextArea>
|
|
26
|
+
`,
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
export const Default = Template.bind({});
|
|
30
|
+
Default.args = {
|
|
31
|
+
label: 'My label',
|
|
32
|
+
placeholder: 'Placeholder',
|
|
33
|
+
captions: ['There is more information'],
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
export const WithValue = Template.bind({});
|
|
37
|
+
WithValue.args = {
|
|
38
|
+
label: 'My label',
|
|
39
|
+
modelValue: 'Une valeur',
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const Disabled = Template.bind({});
|
|
43
|
+
Disabled.args = {
|
|
44
|
+
label: 'My label',
|
|
45
|
+
modelValue: 'Une valeur',
|
|
46
|
+
disabled: true,
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
export const WithIcons = Template.bind({});
|
|
50
|
+
WithIcons.args = {
|
|
51
|
+
label: 'My label',
|
|
52
|
+
modelValue: 'Une valeur',
|
|
53
|
+
iconStart: true,
|
|
54
|
+
iconEnd: true,
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
export const WithErrors = Template.bind({});
|
|
58
|
+
WithErrors.args = {
|
|
59
|
+
label: 'My label',
|
|
60
|
+
modelValue: 'Une valeur',
|
|
61
|
+
errors: ['Error 1', 'Error 2'],
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export const WithFocusState = {
|
|
65
|
+
args: {
|
|
66
|
+
modelValue: '',
|
|
67
|
+
},
|
|
68
|
+
|
|
69
|
+
play: async ({ canvasElement }) => {
|
|
70
|
+
const canvas = within(canvasElement);
|
|
71
|
+
await canvas.getByRole('input').click();
|
|
72
|
+
await canvas.getByRole('input').focus();
|
|
73
|
+
},
|
|
74
|
+
};
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<field
|
|
3
|
+
:label="label"
|
|
4
|
+
:errors="errors"
|
|
5
|
+
:captions="captions"
|
|
6
|
+
:required="required"
|
|
7
|
+
:optional="optional"
|
|
8
|
+
:helperText="helperText"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
>
|
|
11
|
+
<textarea
|
|
12
|
+
ref="textArea"
|
|
13
|
+
:value="modelValue"
|
|
14
|
+
role="input"
|
|
15
|
+
:class="classes"
|
|
16
|
+
:required="required"
|
|
17
|
+
:placeholder="placeholder"
|
|
18
|
+
@input="onInput"
|
|
19
|
+
@keydown.enter.stop
|
|
20
|
+
cols="10"
|
|
21
|
+
>
|
|
22
|
+
{{ modelValue }}
|
|
23
|
+
</textarea>
|
|
24
|
+
</field>
|
|
25
|
+
</template>
|
|
26
|
+
|
|
27
|
+
<script lang="ts" setup>
|
|
28
|
+
import { Ref, computed, ref } from 'vue';
|
|
29
|
+
import { Caption } from '@/models/caption.model';
|
|
30
|
+
|
|
31
|
+
export interface Props {
|
|
32
|
+
modelValue: string;
|
|
33
|
+
label?: string;
|
|
34
|
+
required?: boolean;
|
|
35
|
+
optional?: boolean;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
helperText?: string;
|
|
38
|
+
placeholder?: string;
|
|
39
|
+
captions?: string[];
|
|
40
|
+
errors?: string[] | Caption[];
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
44
|
+
label: '',
|
|
45
|
+
required: false,
|
|
46
|
+
disabled: false,
|
|
47
|
+
});
|
|
48
|
+
|
|
49
|
+
const textArea: Ref<HTMLElement | null> = ref(null);
|
|
50
|
+
|
|
51
|
+
const $emits = defineEmits<{
|
|
52
|
+
(e: 'update:modelValue', value: string): void;
|
|
53
|
+
}>();
|
|
54
|
+
|
|
55
|
+
const onInput = (e: Event) => {
|
|
56
|
+
if (!props.disabled)
|
|
57
|
+
$emits('update:modelValue', (e?.target as HTMLInputElement).value);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
const classes = computed(() => {
|
|
61
|
+
return { 'is-error': props.errors?.length, 'is-disabled': props.disabled };
|
|
62
|
+
});
|
|
63
|
+
|
|
64
|
+
const setFocus = () => {
|
|
65
|
+
if (textArea.value) {
|
|
66
|
+
textArea.value.focus();
|
|
67
|
+
}
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
defineExpose({
|
|
71
|
+
setFocus,
|
|
72
|
+
});
|
|
73
|
+
</script>
|
|
74
|
+
|
|
75
|
+
<style scoped lang="scss">
|
|
76
|
+
.field__input {
|
|
77
|
+
textarea {
|
|
78
|
+
display: flex;
|
|
79
|
+
align-items: center;
|
|
80
|
+
|
|
81
|
+
width: 100%;
|
|
82
|
+
padding: 1em;
|
|
83
|
+
margin: 0.5em 0;
|
|
84
|
+
border-radius: var(--bms-border-radius);
|
|
85
|
+
border: 1px solid var(--field-border-color);
|
|
86
|
+
background-color: var(--textarea-background-color);
|
|
87
|
+
min-height: 96px;
|
|
88
|
+
outline: none;
|
|
89
|
+
font: inherit;
|
|
90
|
+
color: inherit;
|
|
91
|
+
&:hover {
|
|
92
|
+
--field-border-color: var(--bms-grey-100);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
&:active,
|
|
96
|
+
&:focus {
|
|
97
|
+
--field-border-color: var(--field-border-color-active);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
&.is-error {
|
|
101
|
+
--field-border-color: var(--bms-red-100);
|
|
102
|
+
--textarea-background-color: var(--bms-red-25);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
&.is-disabled {
|
|
106
|
+
--field-border-color: var(--bms-grey-25);
|
|
107
|
+
--textarea-background-color: var(--bms-grey-25);
|
|
108
|
+
pointer-events: none;
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
</style>
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import template from '@/documentation/template_field_dependency.mdx';
|
|
2
|
+
|
|
3
|
+
export default {
|
|
4
|
+
parameters: {
|
|
5
|
+
docs: {
|
|
6
|
+
page: template,
|
|
7
|
+
},
|
|
8
|
+
},
|
|
9
|
+
title: 'Composants/form/Formkit Exemple',
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
const Template = () => ({
|
|
13
|
+
template: `
|
|
14
|
+
<FormKit type="form" >
|
|
15
|
+
<FormKit
|
|
16
|
+
type="text"
|
|
17
|
+
label="Champ texte"
|
|
18
|
+
placeholder="Placeholder"
|
|
19
|
+
/>
|
|
20
|
+
<FormKit
|
|
21
|
+
type="select"
|
|
22
|
+
label="Select"
|
|
23
|
+
:options="['titi', 'toto']"
|
|
24
|
+
/>
|
|
25
|
+
<FormKit
|
|
26
|
+
type="select"
|
|
27
|
+
disabled
|
|
28
|
+
label="Select disabled"
|
|
29
|
+
/>
|
|
30
|
+
</FormKit>
|
|
31
|
+
`,
|
|
32
|
+
});
|
|
33
|
+
|
|
34
|
+
export const Default = Template.bind({});
|
|
35
|
+
Default.args = {};
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import RawAutocomplete, {
|
|
2
|
+
type Props,
|
|
3
|
+
} from '@/components/form/RawAutocomplete.vue';
|
|
4
|
+
import { mount } from '@vue/test-utils';
|
|
5
|
+
import { field } from '@/plugins/field';
|
|
6
|
+
import { nextTick } from 'vue';
|
|
7
|
+
|
|
8
|
+
const factory = (props?: Props) => {
|
|
9
|
+
const wrapper = mount(RawAutocomplete, {
|
|
10
|
+
global: {
|
|
11
|
+
plugins: [field],
|
|
12
|
+
},
|
|
13
|
+
props: {
|
|
14
|
+
options: [
|
|
15
|
+
{ label: 'titi', value: 'i' },
|
|
16
|
+
{ label: 'toto', value: 'o' },
|
|
17
|
+
{ label: 'tutu', value: 'u' },
|
|
18
|
+
],
|
|
19
|
+
modelValue: '',
|
|
20
|
+
...props,
|
|
21
|
+
},
|
|
22
|
+
attachTo: document.body,
|
|
23
|
+
});
|
|
24
|
+
|
|
25
|
+
const inputElement = wrapper.get('input');
|
|
26
|
+
return { wrapper, inputElement };
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
describe('BmsAutocomplete', () => {
|
|
30
|
+
it('should mount component correctly', async () => {
|
|
31
|
+
const { wrapper } = factory();
|
|
32
|
+
|
|
33
|
+
expect(wrapper.text()).toContain('titi');
|
|
34
|
+
expect(wrapper.text()).toContain('toto');
|
|
35
|
+
expect(wrapper.text()).toContain('tutu');
|
|
36
|
+
});
|
|
37
|
+
|
|
38
|
+
it('should show options on click', async () => {
|
|
39
|
+
const { wrapper, inputElement } = factory();
|
|
40
|
+
const menu = wrapper.get('[data-testid="autocomplete-menu"]');
|
|
41
|
+
|
|
42
|
+
expect(menu.isVisible()).toBeFalsy();
|
|
43
|
+
await inputElement.trigger('input');
|
|
44
|
+
expect(menu.isVisible()).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
|
|
47
|
+
it('should load with default value', async () => {
|
|
48
|
+
const { inputElement } = factory({ modelValue: 'i' } as Props);
|
|
49
|
+
expect(inputElement.element.value).toStrictEqual('titi');
|
|
50
|
+
});
|
|
51
|
+
|
|
52
|
+
it('should change input value if parent modelvalue change', async () => {
|
|
53
|
+
const { wrapper, inputElement } = factory({ modelValue: 'i' } as Props);
|
|
54
|
+
expect(inputElement.element.value).toStrictEqual('titi');
|
|
55
|
+
wrapper.setProps({ modelValue: 'u' });
|
|
56
|
+
await nextTick();
|
|
57
|
+
expect(inputElement.element.value).toStrictEqual('tutu');
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
it('should reset input value if parent modelvalue change for unknown value', async () => {
|
|
61
|
+
const { wrapper, inputElement } = factory({ modelValue: 'i' } as Props);
|
|
62
|
+
expect(inputElement.element.value).toStrictEqual('titi');
|
|
63
|
+
wrapper.setProps({ modelValue: 'not_found' });
|
|
64
|
+
await nextTick();
|
|
65
|
+
expect(inputElement.element.value).toStrictEqual('');
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
it('should not reset input value if parent modelvalue change for nullable value', async () => {
|
|
69
|
+
const { wrapper, inputElement } = factory({ modelValue: 'i' } as Props);
|
|
70
|
+
expect(inputElement.element.value).toStrictEqual('titi');
|
|
71
|
+
wrapper.setProps({ modelValue: undefined });
|
|
72
|
+
await nextTick();
|
|
73
|
+
expect(inputElement.element.value).toStrictEqual('titi');
|
|
74
|
+
});
|
|
75
|
+
|
|
76
|
+
it('should populate input on option selection', async () => {
|
|
77
|
+
const { wrapper, inputElement } = factory();
|
|
78
|
+
const titi = wrapper.get('[data-testid="i"]');
|
|
79
|
+
expect(inputElement.element.value).toStrictEqual('');
|
|
80
|
+
await titi.trigger('click');
|
|
81
|
+
expect(inputElement.element.value).toStrictEqual('titi');
|
|
82
|
+
});
|
|
83
|
+
|
|
84
|
+
it('should be able to select with keyboard', async () => {
|
|
85
|
+
const { wrapper, inputElement } = factory();
|
|
86
|
+
const titi = wrapper.get('[data-testid="i"]');
|
|
87
|
+
|
|
88
|
+
expect(titi.classes()).toStrictEqual([]);
|
|
89
|
+
await inputElement.trigger('focus');
|
|
90
|
+
await inputElement.trigger('keydown.down');
|
|
91
|
+
expect(titi.classes()).toStrictEqual(['selected']);
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
it('should filter options', async () => {
|
|
95
|
+
const { wrapper, inputElement } = factory();
|
|
96
|
+
|
|
97
|
+
await inputElement.setValue('ti');
|
|
98
|
+
|
|
99
|
+
expect(wrapper.text()).toContain('titi');
|
|
100
|
+
expect(wrapper.text()).not.toContain('toto');
|
|
101
|
+
expect(wrapper.text()).not.toContain('tutu');
|
|
102
|
+
});
|
|
103
|
+
});
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<field
|
|
3
|
+
:label="label"
|
|
4
|
+
:errors="errors"
|
|
5
|
+
:captions="captions"
|
|
6
|
+
:required="required"
|
|
7
|
+
:optional="optional"
|
|
8
|
+
:helperText="helperText"
|
|
9
|
+
:disabled="disabled"
|
|
10
|
+
>
|
|
11
|
+
<RawInputText
|
|
12
|
+
ref="autocompleteInput"
|
|
13
|
+
v-model="inputText"
|
|
14
|
+
:type="InputType.TEXT"
|
|
15
|
+
:disabled="disabled"
|
|
16
|
+
@keyDown="keyDown"
|
|
17
|
+
@keyUp="keyUp"
|
|
18
|
+
@keyEnter="keyEnter"
|
|
19
|
+
:class="classes"
|
|
20
|
+
:placeholder="placeholder"
|
|
21
|
+
:required="required"
|
|
22
|
+
@input="onInput"
|
|
23
|
+
v-model:focus="isInputFocused"
|
|
24
|
+
>
|
|
25
|
+
<template #icon-start>
|
|
26
|
+
<slot name="icon-start"></slot>
|
|
27
|
+
</template>
|
|
28
|
+
<template #icon-end>
|
|
29
|
+
<slot name="icon-end"></slot>
|
|
30
|
+
</template>
|
|
31
|
+
</RawInputText>
|
|
32
|
+
<template #datalist>
|
|
33
|
+
<FieldDatalist
|
|
34
|
+
data-testid="autocomplete-menu"
|
|
35
|
+
v-show="isInputFocused"
|
|
36
|
+
:options="filteredMenuItems"
|
|
37
|
+
:currentSelectedItemIndex="currentSelectedItemIndex"
|
|
38
|
+
@select="
|
|
39
|
+
(optionValue: string) => selectItem({ value: optionValue, label: '' })
|
|
40
|
+
"
|
|
41
|
+
>
|
|
42
|
+
<template #option="{ option }: { option: any }">
|
|
43
|
+
<slot name="option" :option="option">{{ option }}</slot>
|
|
44
|
+
</template>
|
|
45
|
+
</FieldDatalist>
|
|
46
|
+
</template>
|
|
47
|
+
</field>
|
|
48
|
+
</template>
|
|
49
|
+
|
|
50
|
+
<script setup lang="ts">
|
|
51
|
+
import { searchString } from '@/helpers/string.helper';
|
|
52
|
+
import FieldDatalist from '@/plugins/field/FieldDatalist.vue';
|
|
53
|
+
import { computed, ref, Ref, watch } from 'vue';
|
|
54
|
+
import { Caption } from '@/models/caption.model';
|
|
55
|
+
import RawInputText from '@/components/form/RawInputText.vue';
|
|
56
|
+
import { InputType } from '@/models';
|
|
57
|
+
|
|
58
|
+
export interface Props {
|
|
59
|
+
options: any[];
|
|
60
|
+
modelValue?: string | null;
|
|
61
|
+
label?: string;
|
|
62
|
+
required?: boolean;
|
|
63
|
+
optional?: boolean;
|
|
64
|
+
disabled?: boolean;
|
|
65
|
+
helperText?: string;
|
|
66
|
+
placeholder?: string;
|
|
67
|
+
captions?: string[] | Caption[];
|
|
68
|
+
errors?: string[] | Caption[];
|
|
69
|
+
open?: boolean;
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
73
|
+
modelValue: null,
|
|
74
|
+
open: false,
|
|
75
|
+
});
|
|
76
|
+
|
|
77
|
+
const emits = defineEmits<{
|
|
78
|
+
(e: 'update:modelValue', payload: string | null): void;
|
|
79
|
+
}>();
|
|
80
|
+
|
|
81
|
+
const getValidOptionByLabel = (label: string) =>
|
|
82
|
+
props.options.find((o) => o.label === label);
|
|
83
|
+
|
|
84
|
+
const getValidOptionByValue = (value: string | null) =>
|
|
85
|
+
props.options.find((o) => o.value === value);
|
|
86
|
+
|
|
87
|
+
const inputText = ref<string>(
|
|
88
|
+
getValidOptionByValue(props.modelValue)?.label ?? '',
|
|
89
|
+
);
|
|
90
|
+
const isInputFocused = ref<boolean>(props.open);
|
|
91
|
+
const currentSelectedItemIndex = ref<number>(-1);
|
|
92
|
+
const autocompleteInput: Ref<HTMLElement | null> = ref(null);
|
|
93
|
+
|
|
94
|
+
const classes = computed(() => {
|
|
95
|
+
return { 'is-error': props.errors?.length, 'is-disabled': props.disabled };
|
|
96
|
+
});
|
|
97
|
+
|
|
98
|
+
const filteredMenuItems = computed(() =>
|
|
99
|
+
props.options.filter((o) => searchString(o.label, inputText.value)),
|
|
100
|
+
);
|
|
101
|
+
|
|
102
|
+
const selectItem = (option: { label: string; value: string | null }) => {
|
|
103
|
+
const existingOption =
|
|
104
|
+
getValidOptionByLabel(option.label) || getValidOptionByValue(option.value);
|
|
105
|
+
if (existingOption) {
|
|
106
|
+
inputText.value = existingOption.label;
|
|
107
|
+
} else {
|
|
108
|
+
inputText.value = option.label;
|
|
109
|
+
}
|
|
110
|
+
isInputFocused.value = false;
|
|
111
|
+
};
|
|
112
|
+
|
|
113
|
+
watch(inputText, function emitUpdate(newLabel) {
|
|
114
|
+
const option = getValidOptionByLabel(newLabel);
|
|
115
|
+
if (option) selectItem(option);
|
|
116
|
+
emits('update:modelValue', option?.value ?? null);
|
|
117
|
+
});
|
|
118
|
+
|
|
119
|
+
watch(
|
|
120
|
+
() => props.modelValue,
|
|
121
|
+
function updateFromProps(newValue) {
|
|
122
|
+
const option = getValidOptionByValue(newValue);
|
|
123
|
+
if (option) {
|
|
124
|
+
selectItem(option);
|
|
125
|
+
// drop input value only if parent set nullable value
|
|
126
|
+
} else if (props.modelValue !== undefined && props.modelValue !== null) {
|
|
127
|
+
inputText.value = '';
|
|
128
|
+
}
|
|
129
|
+
},
|
|
130
|
+
);
|
|
131
|
+
|
|
132
|
+
const onInput = () => {
|
|
133
|
+
isInputFocused.value = true;
|
|
134
|
+
currentSelectedItemIndex.value = -1;
|
|
135
|
+
};
|
|
136
|
+
|
|
137
|
+
const keyDown = () => {
|
|
138
|
+
if (currentSelectedItemIndex.value < filteredMenuItems.value.length - 1) {
|
|
139
|
+
currentSelectedItemIndex.value++;
|
|
140
|
+
} else {
|
|
141
|
+
currentSelectedItemIndex.value = 0;
|
|
142
|
+
}
|
|
143
|
+
};
|
|
144
|
+
|
|
145
|
+
const keyUp = () => {
|
|
146
|
+
if (currentSelectedItemIndex.value > 0) {
|
|
147
|
+
currentSelectedItemIndex.value--;
|
|
148
|
+
} else {
|
|
149
|
+
currentSelectedItemIndex.value = props.options.length - 1;
|
|
150
|
+
}
|
|
151
|
+
};
|
|
152
|
+
|
|
153
|
+
const keyEnter = () => {
|
|
154
|
+
if (currentSelectedItemIndex.value >= 0) {
|
|
155
|
+
selectItem(filteredMenuItems.value[currentSelectedItemIndex.value]);
|
|
156
|
+
currentSelectedItemIndex.value = -1;
|
|
157
|
+
} else {
|
|
158
|
+
isInputFocused.value = false;
|
|
159
|
+
}
|
|
160
|
+
};
|
|
161
|
+
|
|
162
|
+
const setFocus = () => {
|
|
163
|
+
if (autocompleteInput.value) {
|
|
164
|
+
autocompleteInput.value.focus();
|
|
165
|
+
}
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
defineExpose({
|
|
169
|
+
setFocus,
|
|
170
|
+
});
|
|
171
|
+
</script>
|
|
172
|
+
|
|
173
|
+
<style scoped lang="scss">
|
|
174
|
+
.field__input {
|
|
175
|
+
.autocomplete-wrapper {
|
|
176
|
+
width: 100%;
|
|
177
|
+
padding: 0.7em;
|
|
178
|
+
margin: 0.5em 0;
|
|
179
|
+
border-radius: var(--bms-border-radius);
|
|
180
|
+
border: 1px solid var(--field-border-color);
|
|
181
|
+
background-color: var(--input-background-color);
|
|
182
|
+
height: 48px;
|
|
183
|
+
|
|
184
|
+
&:hover {
|
|
185
|
+
--field-border-color: var(--bms-grey-100);
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
&:has(input:focus) {
|
|
189
|
+
--field-border-color: var(--field-border-color-active);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
&.is-error {
|
|
193
|
+
--field-border-color: var(--bms-red-100);
|
|
194
|
+
--input-background-color: var(--bms-red-25);
|
|
195
|
+
}
|
|
196
|
+
|
|
197
|
+
&.is-disabled {
|
|
198
|
+
--field-border-color: var(--bms-grey-25);
|
|
199
|
+
--input-background-color: var(--bms-grey-25);
|
|
200
|
+
pointer-events: none;
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
input {
|
|
204
|
+
outline: none;
|
|
205
|
+
appearance: none;
|
|
206
|
+
border: 0;
|
|
207
|
+
padding: 0;
|
|
208
|
+
margin: 0;
|
|
209
|
+
font: inherit;
|
|
210
|
+
color: inherit;
|
|
211
|
+
height: 24px;
|
|
212
|
+
line-height: 1;
|
|
213
|
+
width: 100%;
|
|
214
|
+
background-color: transparent;
|
|
215
|
+
}
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
</style>
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<span class="input-wrapper" :class="classes">
|
|
3
|
+
<template class="field__input-label">
|
|
4
|
+
<slot name="label"></slot>
|
|
5
|
+
</template>
|
|
6
|
+
<span class="field__input-icon field__input-icon--start">
|
|
7
|
+
<slot name="icon-start"></slot>
|
|
8
|
+
</span>
|
|
9
|
+
<input
|
|
10
|
+
ref="input"
|
|
11
|
+
role="input"
|
|
12
|
+
:type="type"
|
|
13
|
+
:value="modelValue"
|
|
14
|
+
:placeholder="placeholder"
|
|
15
|
+
:required="required"
|
|
16
|
+
:disabled="disabled"
|
|
17
|
+
@input="onInput"
|
|
18
|
+
@keydown.up="$emits('keyUp')"
|
|
19
|
+
@keydown.down="$emits('keyDown')"
|
|
20
|
+
@keydown.enter="$emits('keyEnter')"
|
|
21
|
+
/>
|
|
22
|
+
<span class="field__input-icon field__input-icon--end">
|
|
23
|
+
<slot name="icon-end"></slot>
|
|
24
|
+
</span>
|
|
25
|
+
</span>
|
|
26
|
+
</template>
|
|
27
|
+
|
|
28
|
+
<script lang="ts" setup>
|
|
29
|
+
import { computed, onMounted, Ref, ref } from 'vue';
|
|
30
|
+
import { Caption, InputType } from '@/models';
|
|
31
|
+
|
|
32
|
+
export interface Props {
|
|
33
|
+
modelValue: string | number;
|
|
34
|
+
required?: boolean;
|
|
35
|
+
placeholder?: string;
|
|
36
|
+
disabled?: boolean;
|
|
37
|
+
focus?: boolean;
|
|
38
|
+
type?:
|
|
39
|
+
| InputType.TEXT
|
|
40
|
+
| InputType.NUMBER
|
|
41
|
+
| InputType.DATE
|
|
42
|
+
| InputType.DATETIME;
|
|
43
|
+
errors?: string[] | Caption[];
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
const props = withDefaults(defineProps<Props>(), {
|
|
47
|
+
type: InputType.TEXT,
|
|
48
|
+
required: false,
|
|
49
|
+
disabled: false,
|
|
50
|
+
focus: false,
|
|
51
|
+
});
|
|
52
|
+
const input: Ref<HTMLElement | null> = ref(null);
|
|
53
|
+
|
|
54
|
+
const $emits = defineEmits<{
|
|
55
|
+
(e: 'update:modelValue', value: string): void;
|
|
56
|
+
(e: 'update:focus', value: boolean): void;
|
|
57
|
+
(e: 'keyUp'): void;
|
|
58
|
+
(e: 'keyDown'): void;
|
|
59
|
+
(e: 'keyEnter'): void;
|
|
60
|
+
}>();
|
|
61
|
+
|
|
62
|
+
onMounted(() => {
|
|
63
|
+
document.body.addEventListener('click', (ev) => {
|
|
64
|
+
if ((ev.target as any) === input.value) {
|
|
65
|
+
$emits('update:focus', !props.focus);
|
|
66
|
+
ev.stopPropagation();
|
|
67
|
+
} else {
|
|
68
|
+
$emits('update:focus', false);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
});
|
|
72
|
+
const setFocus = () => {
|
|
73
|
+
if (input.value) {
|
|
74
|
+
input.value.focus();
|
|
75
|
+
$emits('update:focus', true);
|
|
76
|
+
}
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
defineExpose({
|
|
80
|
+
setFocus,
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
const onInput = (e: Event) => {
|
|
84
|
+
if (!props.disabled)
|
|
85
|
+
$emits('update:modelValue', (e?.target as HTMLInputElement).value);
|
|
86
|
+
};
|
|
87
|
+
|
|
88
|
+
const classes = computed(() => {
|
|
89
|
+
return { 'is-error': props.errors?.length, 'is-disabled': props.disabled };
|
|
90
|
+
});
|
|
91
|
+
</script>
|
|
92
|
+
|
|
93
|
+
<style scoped lang="scss">
|
|
94
|
+
.input-wrapper {
|
|
95
|
+
display: flex;
|
|
96
|
+
align-items: center;
|
|
97
|
+
|
|
98
|
+
width: 100%;
|
|
99
|
+
padding: 1em;
|
|
100
|
+
margin: 0.5em 0;
|
|
101
|
+
border-radius: var(--bms-border-radius);
|
|
102
|
+
border: 1px solid var(--field-border-color);
|
|
103
|
+
background-color: var(--input-background-color);
|
|
104
|
+
height: 48px;
|
|
105
|
+
|
|
106
|
+
&:hover {
|
|
107
|
+
--field-border-color: var(--bms-grey-100);
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
&:has(input:focus) {
|
|
111
|
+
box-shadow: 0 0 4px 4px var(--bms-main-25);
|
|
112
|
+
--field-border-color: var(--field-border-color-active);
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
&.is-error {
|
|
116
|
+
--field-border-color: var(--bms-red-100);
|
|
117
|
+
--input-background-color: var(--bms-red-25);
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
&.is-disabled {
|
|
121
|
+
--field-border-color: var(--bms-grey-25);
|
|
122
|
+
--input-background-color: var(--bms-grey-25);
|
|
123
|
+
|
|
124
|
+
input {
|
|
125
|
+
pointer-events: none;
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
.field__input-label {
|
|
130
|
+
display: block;
|
|
131
|
+
color: var(--bms-grey-50);
|
|
132
|
+
font-size: 12px;
|
|
133
|
+
line-height: 0.2em;
|
|
134
|
+
margin-top: 6px;
|
|
135
|
+
margin-bottom: 4px;
|
|
136
|
+
}
|
|
137
|
+
.field__input-icon {
|
|
138
|
+
display: flex;
|
|
139
|
+
|
|
140
|
+
&--start {
|
|
141
|
+
margin-right: 0.5em;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
&--end {
|
|
145
|
+
margin-left: 0.5em;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
:deep(svg) {
|
|
149
|
+
width: 1em;
|
|
150
|
+
height: 1em;
|
|
151
|
+
display: block;
|
|
152
|
+
}
|
|
153
|
+
|
|
154
|
+
&:empty {
|
|
155
|
+
display: none;
|
|
156
|
+
}
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
input {
|
|
160
|
+
outline: none;
|
|
161
|
+
appearance: none;
|
|
162
|
+
border: 0;
|
|
163
|
+
padding: 0;
|
|
164
|
+
margin: 0;
|
|
165
|
+
font: inherit;
|
|
166
|
+
color: inherit;
|
|
167
|
+
height: 24px;
|
|
168
|
+
line-height: 1;
|
|
169
|
+
width: 100%;
|
|
170
|
+
background-color: transparent;
|
|
171
|
+
}
|
|
172
|
+
}
|
|
173
|
+
</style>
|