@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,129 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<Teleport to="body">
|
|
3
|
+
<div class="bms-notifications">
|
|
4
|
+
<div class="bms-notifications__list">
|
|
5
|
+
<TransitionGroup name="bms-notifactions-transition">
|
|
6
|
+
<NotificationItem
|
|
7
|
+
v-for="notification in notifications"
|
|
8
|
+
:key="notification.id"
|
|
9
|
+
:notification="notification"
|
|
10
|
+
class="bms-notifications__item"
|
|
11
|
+
@close="close(notification)"
|
|
12
|
+
@open-details="openDetails(notification)"
|
|
13
|
+
/>
|
|
14
|
+
</TransitionGroup>
|
|
15
|
+
</div>
|
|
16
|
+
</div>
|
|
17
|
+
</Teleport>
|
|
18
|
+
<BmsModal
|
|
19
|
+
:model-value="openNotification"
|
|
20
|
+
:type="
|
|
21
|
+
openNotification?.type === NotificationType.error
|
|
22
|
+
? StatusType.Danger
|
|
23
|
+
: StatusType.Default
|
|
24
|
+
"
|
|
25
|
+
title="Détails"
|
|
26
|
+
:buttons="modalButtons"
|
|
27
|
+
@submit="closeDetails"
|
|
28
|
+
@close="closeDetails"
|
|
29
|
+
priority
|
|
30
|
+
>
|
|
31
|
+
<template #default>
|
|
32
|
+
<BmsProblem
|
|
33
|
+
v-if="isProblem(openNotification?.details)"
|
|
34
|
+
:problem="openNotification?.details as Problem"
|
|
35
|
+
/>
|
|
36
|
+
<template v-else>{{ openNotification?.details }}</template>
|
|
37
|
+
</template>
|
|
38
|
+
</BmsModal>
|
|
39
|
+
</template>
|
|
40
|
+
|
|
41
|
+
<script setup lang="ts">
|
|
42
|
+
import { Ref, inject, ref } from 'vue';
|
|
43
|
+
import { BmsNotificationsInstance } from './index';
|
|
44
|
+
import { Notification, NotificationType } from './notification.model';
|
|
45
|
+
import NotificationItem from './NotificationItem.vue';
|
|
46
|
+
import {
|
|
47
|
+
BmsModal,
|
|
48
|
+
BmsProblem,
|
|
49
|
+
ModalActionButton,
|
|
50
|
+
StatusType,
|
|
51
|
+
type Problem,
|
|
52
|
+
isProblem,
|
|
53
|
+
} from '@/index';
|
|
54
|
+
|
|
55
|
+
const notifications: Notification[] | undefined = inject('notifications');
|
|
56
|
+
const notify: any = inject(BmsNotificationsInstance);
|
|
57
|
+
const openNotification: Ref<Notification | null> = ref(null);
|
|
58
|
+
|
|
59
|
+
const modalButtons: ModalActionButton[] = [
|
|
60
|
+
{
|
|
61
|
+
label: 'Fermer',
|
|
62
|
+
role: 'submit',
|
|
63
|
+
action: () => {
|
|
64
|
+
closeDetails();
|
|
65
|
+
return Promise.resolve(false);
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
];
|
|
69
|
+
|
|
70
|
+
const close = (notification: Notification) => {
|
|
71
|
+
notify.dismiss(notification.id);
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const openDetails = (notification: Notification) => {
|
|
75
|
+
close(notification);
|
|
76
|
+
openNotification.value = notification;
|
|
77
|
+
};
|
|
78
|
+
|
|
79
|
+
const closeDetails = () => {
|
|
80
|
+
openNotification.value = null;
|
|
81
|
+
};
|
|
82
|
+
</script>
|
|
83
|
+
|
|
84
|
+
<style lang="scss" scoped>
|
|
85
|
+
.bms-notifications {
|
|
86
|
+
--bms-notifications-width: 360px;
|
|
87
|
+
--bms-notifications-margin: 1em 0 0;
|
|
88
|
+
--bms-notifications-left: initial;
|
|
89
|
+
--bms-notifications-right: 1em;
|
|
90
|
+
--bms-notifications-bottom: 1em;
|
|
91
|
+
--bms-notifications-top: initial;
|
|
92
|
+
--bms-notifications-transition-duration: 0.4s;
|
|
93
|
+
--bms-notifications-transition-timing-function: ease-in-out;
|
|
94
|
+
--bms-notifications-enter-translate: 2em;
|
|
95
|
+
|
|
96
|
+
position: fixed;
|
|
97
|
+
left: var(--bms-notifications-left);
|
|
98
|
+
right: var(--bms-notifications-right);
|
|
99
|
+
bottom: var(--bms-notifications-bottom);
|
|
100
|
+
top: var(--bms-notifications-top);
|
|
101
|
+
width: 100%;
|
|
102
|
+
max-width: var(--bms-notifications-width);
|
|
103
|
+
z-index: 20;
|
|
104
|
+
|
|
105
|
+
&__item {
|
|
106
|
+
&:not(:first-child) {
|
|
107
|
+
margin: var(--bms-notifications-margin);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.bms-notifactions-transition-move,
|
|
113
|
+
.bms-notifactions-transition-enter-active,
|
|
114
|
+
.bms-notifactions-transition-leave-active {
|
|
115
|
+
transition: all var(--bms-notifications-transition-duration)
|
|
116
|
+
var(--bms-notifications-transition-timing-function);
|
|
117
|
+
}
|
|
118
|
+
.bms-notifactions-transition-enter-from,
|
|
119
|
+
.bms-notifactions-transition-leave-to {
|
|
120
|
+
opacity: 0;
|
|
121
|
+
}
|
|
122
|
+
.bms-notifactions-transition-enter-from {
|
|
123
|
+
transform: translateX(var(--bms-notifications-enter-translate));
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
.bms-notifactions-transition-leave-active {
|
|
127
|
+
position: absolute;
|
|
128
|
+
}
|
|
129
|
+
</style>
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { v4 as uuid } from 'uuid';
|
|
2
|
+
import type { App, InjectionKey, Ref } from 'vue';
|
|
3
|
+
import { inject, ref } from 'vue';
|
|
4
|
+
import {
|
|
5
|
+
Notification,
|
|
6
|
+
NotificationInstance,
|
|
7
|
+
NotificationSettings,
|
|
8
|
+
NotificationType,
|
|
9
|
+
} from './notification.model';
|
|
10
|
+
import NotificationWidget from './NotificationWidget.vue';
|
|
11
|
+
import { Problem } from '@/models';
|
|
12
|
+
|
|
13
|
+
export const BmsNotificationsInstance =
|
|
14
|
+
Symbol() as InjectionKey<NotificationInstance>;
|
|
15
|
+
|
|
16
|
+
export const notifications = {
|
|
17
|
+
install(app: App, pluginSettings?: NotificationSettings) {
|
|
18
|
+
const notifications = ref<Notification[]>([]);
|
|
19
|
+
const settings: NotificationSettings = Object.assign(
|
|
20
|
+
{},
|
|
21
|
+
{
|
|
22
|
+
display: 10,
|
|
23
|
+
delay: 4000,
|
|
24
|
+
},
|
|
25
|
+
pluginSettings,
|
|
26
|
+
);
|
|
27
|
+
|
|
28
|
+
app.provide<Ref<Notification[]>>('notifications', notifications);
|
|
29
|
+
|
|
30
|
+
const notify = (
|
|
31
|
+
type: NotificationType,
|
|
32
|
+
text: string,
|
|
33
|
+
time: number,
|
|
34
|
+
details?: string | Problem,
|
|
35
|
+
) => {
|
|
36
|
+
const newNotification = { type, text, details, id: uuid() };
|
|
37
|
+
|
|
38
|
+
notifications.value.push(newNotification);
|
|
39
|
+
notifications.value = notifications.value.slice(-settings.display);
|
|
40
|
+
|
|
41
|
+
if (time > 0) {
|
|
42
|
+
setTimeout(() => {
|
|
43
|
+
notifications.value = notifications.value.filter(
|
|
44
|
+
(notification) => notification.id !== newNotification.id,
|
|
45
|
+
);
|
|
46
|
+
}, time);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const dismiss = (id: string) => {
|
|
51
|
+
notifications.value = notifications.value.filter(
|
|
52
|
+
(notification) => notification.id !== id,
|
|
53
|
+
);
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
app.provide<NotificationInstance>(BmsNotificationsInstance, {
|
|
57
|
+
success: (text: string, details: string = '', time = settings.delay) => {
|
|
58
|
+
notify(NotificationType.success, text, time, details);
|
|
59
|
+
},
|
|
60
|
+
error: (text: string, details: string | Problem = '', time = 0) => {
|
|
61
|
+
notify(NotificationType.error, text, time, details);
|
|
62
|
+
},
|
|
63
|
+
dismiss: (id: string) => {
|
|
64
|
+
dismiss(id);
|
|
65
|
+
},
|
|
66
|
+
});
|
|
67
|
+
|
|
68
|
+
app.component('bms-notifications', NotificationWidget);
|
|
69
|
+
},
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
export function useNotifications() {
|
|
73
|
+
const notify = inject(BmsNotificationsInstance, {
|
|
74
|
+
success: () => {},
|
|
75
|
+
error: () => {},
|
|
76
|
+
dismiss: () => {},
|
|
77
|
+
});
|
|
78
|
+
|
|
79
|
+
return {
|
|
80
|
+
success: notify.success,
|
|
81
|
+
error: notify.error,
|
|
82
|
+
};
|
|
83
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { Problem } from '@/models/problem.model';
|
|
2
|
+
|
|
3
|
+
export interface Notification {
|
|
4
|
+
id: string;
|
|
5
|
+
details?: string | Problem;
|
|
6
|
+
type: NotificationType;
|
|
7
|
+
text: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
export interface NotificationSettings {
|
|
11
|
+
display: number;
|
|
12
|
+
delay: number;
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
export enum NotificationType {
|
|
16
|
+
success = 'success',
|
|
17
|
+
error = 'error',
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
export interface NotificationInstance {
|
|
21
|
+
success: (text: string, details?: string, time?: number) => void;
|
|
22
|
+
error: (text: string, details?: string | Problem, time?: number) => void;
|
|
23
|
+
dismiss: (id: string) => void;
|
|
24
|
+
}
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { config, mount } from '@vue/test-utils';
|
|
2
|
+
import { beforeEach, describe, expect, it, vi } from 'vitest';
|
|
3
|
+
import { defineComponent, inject, nextTick } from 'vue';
|
|
4
|
+
import { BmsNotificationsInstance, notifications } from './index';
|
|
5
|
+
|
|
6
|
+
const MyComponent = defineComponent({
|
|
7
|
+
template: `
|
|
8
|
+
<bms-notifications></bms-notifications>`,
|
|
9
|
+
setup() {
|
|
10
|
+
const notify = inject(BmsNotificationsInstance);
|
|
11
|
+
|
|
12
|
+
const notifySuccess = (time, details = '') => {
|
|
13
|
+
notify.success('This is a success', details, time);
|
|
14
|
+
};
|
|
15
|
+
const notifyError = (time, details = '') => {
|
|
16
|
+
notify.error('This is an error', details, time);
|
|
17
|
+
};
|
|
18
|
+
return { notifySuccess, notifyError };
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
const intersectionObserverMock = () => ({
|
|
23
|
+
observe: () => null,
|
|
24
|
+
});
|
|
25
|
+
|
|
26
|
+
const factory = () => mount(MyComponent, { global: { stubs: ['teleport'] } });
|
|
27
|
+
|
|
28
|
+
config.global.plugins = [notifications];
|
|
29
|
+
|
|
30
|
+
describe('Notifications', () => {
|
|
31
|
+
beforeEach(() => {
|
|
32
|
+
vi.resetAllMocks();
|
|
33
|
+
vi.useFakeTimers();
|
|
34
|
+
window.IntersectionObserver = vi
|
|
35
|
+
.fn()
|
|
36
|
+
.mockImplementation(intersectionObserverMock);
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
it('should display success notification', async () => {
|
|
40
|
+
const wrapper = factory();
|
|
41
|
+
wrapper.vm.notifySuccess(0);
|
|
42
|
+
vi.runAllTimers();
|
|
43
|
+
await nextTick();
|
|
44
|
+
expect(wrapper.find('.bms-notification--success').exists()).toBeTruthy();
|
|
45
|
+
});
|
|
46
|
+
it('should display error notification', async () => {
|
|
47
|
+
const wrapper = factory();
|
|
48
|
+
wrapper.vm.notifyError(0);
|
|
49
|
+
vi.runAllTimers();
|
|
50
|
+
await nextTick();
|
|
51
|
+
expect(wrapper.find('.bms-notification--error').exists()).toBeTruthy();
|
|
52
|
+
});
|
|
53
|
+
|
|
54
|
+
it('should display success notification and hide it after some time', async () => {
|
|
55
|
+
const wrapper = factory();
|
|
56
|
+
wrapper.vm.notifySuccess(3000);
|
|
57
|
+
vi.runAllTimers();
|
|
58
|
+
await nextTick();
|
|
59
|
+
expect(wrapper.find('.bms-notification--success').exists()).toBeFalsy();
|
|
60
|
+
});
|
|
61
|
+
it('should display error notification and hide it after some time', async () => {
|
|
62
|
+
const wrapper = factory();
|
|
63
|
+
wrapper.vm.notifyError(3000);
|
|
64
|
+
vi.runAllTimers();
|
|
65
|
+
await nextTick();
|
|
66
|
+
expect(wrapper.find('.bms-notification--error').exists()).toBeFalsy();
|
|
67
|
+
expect(wrapper.find('.ui-modal').exists()).toBeFalsy();
|
|
68
|
+
});
|
|
69
|
+
it('should display modal when click on the see details', async () => {
|
|
70
|
+
const wrapper = factory();
|
|
71
|
+
wrapper.vm.notifyError(0, 'details');
|
|
72
|
+
vi.runAllTimers();
|
|
73
|
+
await nextTick();
|
|
74
|
+
expect(wrapper.find('.bms-notification--error').exists()).toBeTruthy();
|
|
75
|
+
await wrapper.find('.details').trigger('click');
|
|
76
|
+
expect(wrapper.find('.ui-modal').exists()).toBeTruthy();
|
|
77
|
+
});
|
|
78
|
+
});
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { App } from 'vue';
|
|
2
|
+
import { watch } from 'vue';
|
|
3
|
+
import { useRouterHistory } from './router-history.composable';
|
|
4
|
+
import { useRoute } from 'vue-router';
|
|
5
|
+
|
|
6
|
+
export const routerHistoryPlugin = {
|
|
7
|
+
install(app: App) {
|
|
8
|
+
app.component('bms-router-history', {
|
|
9
|
+
setup() {
|
|
10
|
+
const { addHistoryRoute } = useRouterHistory();
|
|
11
|
+
const currentRoute = useRoute();
|
|
12
|
+
watch(currentRoute, () => {
|
|
13
|
+
addHistoryRoute({ ...currentRoute });
|
|
14
|
+
});
|
|
15
|
+
},
|
|
16
|
+
render() {
|
|
17
|
+
return '';
|
|
18
|
+
},
|
|
19
|
+
});
|
|
20
|
+
},
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export { useRouterHistory };
|
|
@@ -0,0 +1,323 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils';
|
|
2
|
+
import { useRouterHistory } from './router-history.composable';
|
|
3
|
+
import { defineComponent } from 'vue';
|
|
4
|
+
import { RouteLocationNamedRaw } from 'vue-router';
|
|
5
|
+
|
|
6
|
+
const pushMock = vi.fn();
|
|
7
|
+
vi.mock('vue-router', () => ({
|
|
8
|
+
useRouter: vi.fn().mockImplementation(() => ({ push: pushMock })),
|
|
9
|
+
}));
|
|
10
|
+
|
|
11
|
+
const factory = (props?: any) => {
|
|
12
|
+
return mount(
|
|
13
|
+
defineComponent({
|
|
14
|
+
setup() {
|
|
15
|
+
return useRouterHistory();
|
|
16
|
+
},
|
|
17
|
+
template: '<div/>',
|
|
18
|
+
}),
|
|
19
|
+
{ props: props },
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
describe('Router History Composable', () => {
|
|
24
|
+
beforeEach(() => {
|
|
25
|
+
vi.resetAllMocks();
|
|
26
|
+
console.warn = vi.fn();
|
|
27
|
+
});
|
|
28
|
+
describe('goBack', () => {
|
|
29
|
+
const wrapper = factory();
|
|
30
|
+
it('should throw error if no route in history', async () => {
|
|
31
|
+
wrapper.vm.historyRoutes = [];
|
|
32
|
+
try {
|
|
33
|
+
await wrapper.vm.goBack();
|
|
34
|
+
} catch (e) {
|
|
35
|
+
expect(e).toBeTruthy();
|
|
36
|
+
expect(console.warn).toHaveBeenCalled();
|
|
37
|
+
expect(wrapper.vm.historyRoutes.length).toEqual(0);
|
|
38
|
+
}
|
|
39
|
+
});
|
|
40
|
+
it('should throw error and reset history and go to fallback if available', async () => {
|
|
41
|
+
wrapper.vm.historyRoutes = [
|
|
42
|
+
{
|
|
43
|
+
path: '/id0',
|
|
44
|
+
name: 'id0',
|
|
45
|
+
matched: [],
|
|
46
|
+
fullPath: '',
|
|
47
|
+
query: {},
|
|
48
|
+
hash: '',
|
|
49
|
+
meta: {},
|
|
50
|
+
params: {},
|
|
51
|
+
redirectedFrom: undefined,
|
|
52
|
+
},
|
|
53
|
+
];
|
|
54
|
+
try {
|
|
55
|
+
await wrapper.vm.goBack({
|
|
56
|
+
path: 'toto',
|
|
57
|
+
name: 'toto',
|
|
58
|
+
query: {},
|
|
59
|
+
hash: '',
|
|
60
|
+
params: {},
|
|
61
|
+
} as any);
|
|
62
|
+
} catch (e) {
|
|
63
|
+
expect(e).toBeTruthy();
|
|
64
|
+
expect(console.warn).not.toHaveBeenCalled();
|
|
65
|
+
expect(wrapper.vm.historyRoutes.length).toEqual(0);
|
|
66
|
+
expect(pushMock).toHaveBeenCalledWith({
|
|
67
|
+
path: 'toto',
|
|
68
|
+
name: 'toto',
|
|
69
|
+
matched: [],
|
|
70
|
+
fullPath: '',
|
|
71
|
+
query: {},
|
|
72
|
+
hash: '',
|
|
73
|
+
meta: {},
|
|
74
|
+
params: {},
|
|
75
|
+
redirectedFrom: undefined,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
});
|
|
79
|
+
it('should throw error and reset history and go to / if no fallback available', async () => {
|
|
80
|
+
wrapper.vm.historyRoutes = [
|
|
81
|
+
{
|
|
82
|
+
path: '/id0',
|
|
83
|
+
name: 'id0',
|
|
84
|
+
matched: [],
|
|
85
|
+
fullPath: '',
|
|
86
|
+
query: {},
|
|
87
|
+
hash: '',
|
|
88
|
+
meta: {},
|
|
89
|
+
params: {},
|
|
90
|
+
redirectedFrom: undefined,
|
|
91
|
+
},
|
|
92
|
+
];
|
|
93
|
+
try {
|
|
94
|
+
await wrapper.vm.goBack();
|
|
95
|
+
} catch (e) {
|
|
96
|
+
expect(e).toBeTruthy();
|
|
97
|
+
expect(console.warn).not.toHaveBeenCalled();
|
|
98
|
+
expect(wrapper.vm.historyRoutes.length).toEqual(0);
|
|
99
|
+
expect(pushMock).toHaveBeenCalledWith({ path: '/' });
|
|
100
|
+
}
|
|
101
|
+
});
|
|
102
|
+
it('should push route and remove corresponding historyRoutes', async () => {
|
|
103
|
+
wrapper.vm.historyRoutes = [
|
|
104
|
+
{
|
|
105
|
+
path: '/id0',
|
|
106
|
+
name: 'id0',
|
|
107
|
+
matched: [],
|
|
108
|
+
fullPath: '',
|
|
109
|
+
query: {},
|
|
110
|
+
hash: '',
|
|
111
|
+
meta: {},
|
|
112
|
+
params: {},
|
|
113
|
+
redirectedFrom: undefined,
|
|
114
|
+
},
|
|
115
|
+
{
|
|
116
|
+
path: '/id1',
|
|
117
|
+
name: 'id1',
|
|
118
|
+
matched: [],
|
|
119
|
+
fullPath: '',
|
|
120
|
+
query: {},
|
|
121
|
+
hash: '',
|
|
122
|
+
meta: {},
|
|
123
|
+
params: {},
|
|
124
|
+
redirectedFrom: undefined,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
path: '/id2',
|
|
128
|
+
name: 'id2',
|
|
129
|
+
matched: [],
|
|
130
|
+
fullPath: '',
|
|
131
|
+
query: {},
|
|
132
|
+
hash: '',
|
|
133
|
+
meta: {},
|
|
134
|
+
params: {},
|
|
135
|
+
redirectedFrom: undefined,
|
|
136
|
+
},
|
|
137
|
+
];
|
|
138
|
+
await wrapper.vm.goBack();
|
|
139
|
+
expect(pushMock).toHaveBeenCalledWith({
|
|
140
|
+
path: '/id1',
|
|
141
|
+
name: 'id1',
|
|
142
|
+
matched: [],
|
|
143
|
+
fullPath: '',
|
|
144
|
+
query: {},
|
|
145
|
+
hash: '',
|
|
146
|
+
meta: {},
|
|
147
|
+
params: {},
|
|
148
|
+
redirectedFrom: undefined,
|
|
149
|
+
});
|
|
150
|
+
expect(wrapper.vm.historyRoutes).toEqual([
|
|
151
|
+
{
|
|
152
|
+
path: '/id0',
|
|
153
|
+
name: 'id0',
|
|
154
|
+
matched: [],
|
|
155
|
+
fullPath: '',
|
|
156
|
+
query: {},
|
|
157
|
+
hash: '',
|
|
158
|
+
meta: {},
|
|
159
|
+
params: {},
|
|
160
|
+
redirectedFrom: undefined,
|
|
161
|
+
},
|
|
162
|
+
]);
|
|
163
|
+
});
|
|
164
|
+
});
|
|
165
|
+
describe('addHistoryRoute', () => {
|
|
166
|
+
const wrapper = factory();
|
|
167
|
+
it('should add history Route', () => {
|
|
168
|
+
wrapper.vm.historyRoutes = [
|
|
169
|
+
{
|
|
170
|
+
path: '/id0',
|
|
171
|
+
name: 'id0',
|
|
172
|
+
matched: [],
|
|
173
|
+
fullPath: '',
|
|
174
|
+
query: {},
|
|
175
|
+
hash: '',
|
|
176
|
+
meta: {},
|
|
177
|
+
params: {},
|
|
178
|
+
redirectedFrom: undefined,
|
|
179
|
+
},
|
|
180
|
+
];
|
|
181
|
+
wrapper.vm.addHistoryRoute({
|
|
182
|
+
path: '/id1',
|
|
183
|
+
name: 'id1',
|
|
184
|
+
matched: [],
|
|
185
|
+
fullPath: '',
|
|
186
|
+
query: {},
|
|
187
|
+
hash: '',
|
|
188
|
+
meta: {},
|
|
189
|
+
params: {},
|
|
190
|
+
redirectedFrom: undefined,
|
|
191
|
+
});
|
|
192
|
+
expect(wrapper.vm.historyRoutes).toEqual([
|
|
193
|
+
{
|
|
194
|
+
path: '/id0',
|
|
195
|
+
name: 'id0',
|
|
196
|
+
matched: [],
|
|
197
|
+
fullPath: '',
|
|
198
|
+
query: {},
|
|
199
|
+
hash: '',
|
|
200
|
+
meta: {},
|
|
201
|
+
params: {},
|
|
202
|
+
redirectedFrom: undefined,
|
|
203
|
+
},
|
|
204
|
+
{
|
|
205
|
+
path: '/id1',
|
|
206
|
+
name: 'id1',
|
|
207
|
+
matched: [],
|
|
208
|
+
fullPath: '',
|
|
209
|
+
query: {},
|
|
210
|
+
hash: '',
|
|
211
|
+
meta: {},
|
|
212
|
+
params: {},
|
|
213
|
+
redirectedFrom: undefined,
|
|
214
|
+
},
|
|
215
|
+
]);
|
|
216
|
+
});
|
|
217
|
+
it('should add history Route if empty', () => {
|
|
218
|
+
wrapper.vm.historyRoutes = [];
|
|
219
|
+
wrapper.vm.addHistoryRoute({
|
|
220
|
+
path: '/id1',
|
|
221
|
+
name: 'id1',
|
|
222
|
+
matched: [],
|
|
223
|
+
fullPath: '',
|
|
224
|
+
query: {},
|
|
225
|
+
hash: '',
|
|
226
|
+
meta: {},
|
|
227
|
+
params: {},
|
|
228
|
+
redirectedFrom: undefined,
|
|
229
|
+
});
|
|
230
|
+
expect(wrapper.vm.historyRoutes).toEqual([
|
|
231
|
+
{
|
|
232
|
+
path: '/id1',
|
|
233
|
+
name: 'id1',
|
|
234
|
+
matched: [],
|
|
235
|
+
fullPath: '',
|
|
236
|
+
query: {},
|
|
237
|
+
hash: '',
|
|
238
|
+
meta: {},
|
|
239
|
+
params: {},
|
|
240
|
+
redirectedFrom: undefined,
|
|
241
|
+
},
|
|
242
|
+
]);
|
|
243
|
+
});
|
|
244
|
+
it('should replace history Route if previous route has same name', () => {
|
|
245
|
+
wrapper.vm.historyRoutes = [
|
|
246
|
+
{
|
|
247
|
+
path: '/id0',
|
|
248
|
+
name: 'name0',
|
|
249
|
+
matched: [],
|
|
250
|
+
fullPath: '',
|
|
251
|
+
query: {},
|
|
252
|
+
hash: '',
|
|
253
|
+
meta: {},
|
|
254
|
+
params: {},
|
|
255
|
+
redirectedFrom: undefined,
|
|
256
|
+
},
|
|
257
|
+
];
|
|
258
|
+
wrapper.vm.addHistoryRoute({
|
|
259
|
+
path: '/id1',
|
|
260
|
+
name: 'name0',
|
|
261
|
+
matched: [],
|
|
262
|
+
fullPath: '',
|
|
263
|
+
query: {},
|
|
264
|
+
hash: '',
|
|
265
|
+
meta: {},
|
|
266
|
+
params: {},
|
|
267
|
+
redirectedFrom: undefined,
|
|
268
|
+
});
|
|
269
|
+
expect(wrapper.vm.historyRoutes).toEqual([
|
|
270
|
+
{
|
|
271
|
+
path: '/id1',
|
|
272
|
+
name: 'name0',
|
|
273
|
+
matched: [],
|
|
274
|
+
fullPath: '',
|
|
275
|
+
query: {},
|
|
276
|
+
hash: '',
|
|
277
|
+
meta: {},
|
|
278
|
+
params: {},
|
|
279
|
+
redirectedFrom: undefined,
|
|
280
|
+
},
|
|
281
|
+
]);
|
|
282
|
+
});
|
|
283
|
+
it('should replace history Route if previous route has same path', () => {
|
|
284
|
+
wrapper.vm.historyRoutes = [
|
|
285
|
+
{
|
|
286
|
+
path: '/id0',
|
|
287
|
+
name: 'name0',
|
|
288
|
+
matched: [],
|
|
289
|
+
fullPath: '',
|
|
290
|
+
query: {},
|
|
291
|
+
hash: '',
|
|
292
|
+
meta: {},
|
|
293
|
+
params: {},
|
|
294
|
+
redirectedFrom: undefined,
|
|
295
|
+
},
|
|
296
|
+
];
|
|
297
|
+
wrapper.vm.addHistoryRoute({
|
|
298
|
+
path: '/id0',
|
|
299
|
+
name: 'name1',
|
|
300
|
+
matched: [],
|
|
301
|
+
fullPath: '',
|
|
302
|
+
query: {},
|
|
303
|
+
hash: '',
|
|
304
|
+
meta: {},
|
|
305
|
+
params: {},
|
|
306
|
+
redirectedFrom: undefined,
|
|
307
|
+
});
|
|
308
|
+
expect(wrapper.vm.historyRoutes).toEqual([
|
|
309
|
+
{
|
|
310
|
+
path: '/id0',
|
|
311
|
+
name: 'name1',
|
|
312
|
+
matched: [],
|
|
313
|
+
fullPath: '',
|
|
314
|
+
query: {},
|
|
315
|
+
hash: '',
|
|
316
|
+
meta: {},
|
|
317
|
+
params: {},
|
|
318
|
+
redirectedFrom: undefined,
|
|
319
|
+
},
|
|
320
|
+
]);
|
|
321
|
+
});
|
|
322
|
+
});
|
|
323
|
+
});
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { Ref, ref } from 'vue';
|
|
2
|
+
import {
|
|
3
|
+
RouteLocationNormalizedLoaded,
|
|
4
|
+
RouteLocationRaw,
|
|
5
|
+
useRouter,
|
|
6
|
+
} from 'vue-router';
|
|
7
|
+
|
|
8
|
+
const historyRoutes: Ref<RouteLocationNormalizedLoaded[]> = ref([]);
|
|
9
|
+
|
|
10
|
+
export const useRouterHistory = () => {
|
|
11
|
+
const router = useRouter();
|
|
12
|
+
|
|
13
|
+
const goBack = async (fallback?: RouteLocationRaw) => {
|
|
14
|
+
if (historyRoutes.value.length === 0) {
|
|
15
|
+
console.warn(
|
|
16
|
+
'You need to install the RouterHistory plugin. See Readme#router-history for more info',
|
|
17
|
+
);
|
|
18
|
+
throw new Error('History Router plugin is not installed');
|
|
19
|
+
}
|
|
20
|
+
if (historyRoutes.value.length > 1) {
|
|
21
|
+
const target = historyRoutes.value[historyRoutes.value.length - 2];
|
|
22
|
+
historyRoutes.value = historyRoutes.value.slice(0, -2);
|
|
23
|
+
await router.push(target);
|
|
24
|
+
} else {
|
|
25
|
+
historyRoutes.value = [];
|
|
26
|
+
await router.push(fallback || { path: '/' });
|
|
27
|
+
}
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
const addHistoryRoute = (route: RouteLocationNormalizedLoaded) => {
|
|
31
|
+
const lastRoute = historyRoutes.value.at(-1);
|
|
32
|
+
if (
|
|
33
|
+
lastRoute &&
|
|
34
|
+
((lastRoute.name && lastRoute.name === route.name) ||
|
|
35
|
+
(lastRoute.path && lastRoute.path === route.path))
|
|
36
|
+
) {
|
|
37
|
+
historyRoutes.value.pop();
|
|
38
|
+
}
|
|
39
|
+
historyRoutes.value.push(route);
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
return {
|
|
43
|
+
historyRoutes,
|
|
44
|
+
addHistoryRoute,
|
|
45
|
+
goBack,
|
|
46
|
+
};
|
|
47
|
+
};
|