@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,88 @@
|
|
|
1
|
+
import BmsContentPageLayout from '../components/layout/BmsContentPageLayout.vue';
|
|
2
|
+
import BmsHeaderTitle from '../components/layout/BmsHeaderTitle.vue';
|
|
3
|
+
import BmsTable from '../components/table/BmsTable.vue';
|
|
4
|
+
import BmsBreadcrumb from '../components/navigation/BmsBreadcrumb.vue';
|
|
5
|
+
import BmsButton from '../components/button/BmsButton.vue';
|
|
6
|
+
import BmsShortLinkMenu from '../components/navigation/BmsShortLinkMenu.vue';
|
|
7
|
+
|
|
8
|
+
export default {
|
|
9
|
+
components: { BmsShortLinkMenu, BmsButton, BmsBreadcrumb, BmsTable },
|
|
10
|
+
title: 'Pages/List',
|
|
11
|
+
component: BmsContentPageLayout,
|
|
12
|
+
argTypes: {},
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const Template = (args) => ({
|
|
16
|
+
components: {
|
|
17
|
+
BmsContentPageLayout,
|
|
18
|
+
BmsHeaderTitle,
|
|
19
|
+
BmsBreadcrumb,
|
|
20
|
+
BmsTable,
|
|
21
|
+
BmsButton,
|
|
22
|
+
BmsShortLinkMenu,
|
|
23
|
+
},
|
|
24
|
+
setup() {
|
|
25
|
+
return { args };
|
|
26
|
+
},
|
|
27
|
+
template: `
|
|
28
|
+
<BmsContentPageLayout>
|
|
29
|
+
<template #header>
|
|
30
|
+
<BmsHeaderTitle title="Le Titre de la page" activity-url="/auditMe" documentation-url="/helpme">
|
|
31
|
+
<template #subtitle>Un complement à mon titre ?</template>
|
|
32
|
+
|
|
33
|
+
</BmsHeaderTitle>
|
|
34
|
+
</template>
|
|
35
|
+
<template #breadcrumb>
|
|
36
|
+
<BmsBreadcrumb :breadcrumbs="args.breadcrumb"/>
|
|
37
|
+
</template>
|
|
38
|
+
<template #default>
|
|
39
|
+
|
|
40
|
+
<BmsTable :headers="args.headers" :items="args.items">
|
|
41
|
+
<template #alert-action>
|
|
42
|
+
<BmsButton :mode="StatusType.Danger">Supprimer</BmsButton>
|
|
43
|
+
</template>
|
|
44
|
+
<template #custom-actions>
|
|
45
|
+
<BmsButton>Action 1</BmsButton>
|
|
46
|
+
<BmsButton>Action 2</BmsButton>
|
|
47
|
+
</template>
|
|
48
|
+
<template #default="{ row }">
|
|
49
|
+
</template>
|
|
50
|
+
</BmsTable>
|
|
51
|
+
</template>
|
|
52
|
+
</BmsContentPageLayout>
|
|
53
|
+
`,
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
export const Default = Template.bind({});
|
|
57
|
+
Default.args = {
|
|
58
|
+
headers: [
|
|
59
|
+
{
|
|
60
|
+
label: 'Column 1',
|
|
61
|
+
key: 'col1',
|
|
62
|
+
align: 'start',
|
|
63
|
+
},
|
|
64
|
+
{
|
|
65
|
+
label: 'Column 2',
|
|
66
|
+
key: 'col2',
|
|
67
|
+
align: 'center',
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
label: 'Column 3',
|
|
71
|
+
key: 'col3',
|
|
72
|
+
align: 'end',
|
|
73
|
+
},
|
|
74
|
+
],
|
|
75
|
+
items: [
|
|
76
|
+
{
|
|
77
|
+
col1: 'Value1',
|
|
78
|
+
col2: 'Value2',
|
|
79
|
+
col3: 'Value3',
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
col1: 'Value2',
|
|
83
|
+
col2: 'Value2',
|
|
84
|
+
col3: 'Value3',
|
|
85
|
+
},
|
|
86
|
+
],
|
|
87
|
+
breadcrumb: [{ label: 'form', to: '/exposed' }, { label: 'list' }],
|
|
88
|
+
};
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
import { App, createApp, defineComponent, h, inject, nextTick, ref } from 'vue';
|
|
2
|
+
import BmsModal from '../../components/layout/BmsModal.vue';
|
|
3
|
+
import { InjectionKey } from 'vue';
|
|
4
|
+
import { NotificationInstance } from '@/plugins/notifications/notification.model';
|
|
5
|
+
|
|
6
|
+
const createConfirmComponent = (
|
|
7
|
+
modalOptions: { question: string; title: string },
|
|
8
|
+
resolve: Function,
|
|
9
|
+
reject: Function,
|
|
10
|
+
) => {
|
|
11
|
+
return defineComponent({
|
|
12
|
+
props: {
|
|
13
|
+
question: {
|
|
14
|
+
type: String,
|
|
15
|
+
},
|
|
16
|
+
title: {
|
|
17
|
+
type: String,
|
|
18
|
+
},
|
|
19
|
+
},
|
|
20
|
+
components: { BmsModal },
|
|
21
|
+
setup() {
|
|
22
|
+
const isActive = ref<boolean>(true);
|
|
23
|
+
const confirm = () => {
|
|
24
|
+
close();
|
|
25
|
+
return resolve();
|
|
26
|
+
};
|
|
27
|
+
const discard = () => {
|
|
28
|
+
close();
|
|
29
|
+
return reject();
|
|
30
|
+
};
|
|
31
|
+
const close = () => {
|
|
32
|
+
isActive.value = false;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
return {
|
|
36
|
+
question: modalOptions.question,
|
|
37
|
+
title: modalOptions.title,
|
|
38
|
+
isActive,
|
|
39
|
+
confirm,
|
|
40
|
+
discard,
|
|
41
|
+
};
|
|
42
|
+
},
|
|
43
|
+
render() {
|
|
44
|
+
return h(
|
|
45
|
+
//@ts-ignore
|
|
46
|
+
BmsModal,
|
|
47
|
+
{
|
|
48
|
+
title: this.title,
|
|
49
|
+
modelValue: this.isActive,
|
|
50
|
+
submitAction: this.confirm,
|
|
51
|
+
cancelAction: this.discard,
|
|
52
|
+
submitLabel: 'Confirmer',
|
|
53
|
+
onClose: this.discard,
|
|
54
|
+
},
|
|
55
|
+
{ default: () => h('p', this.question) },
|
|
56
|
+
);
|
|
57
|
+
},
|
|
58
|
+
});
|
|
59
|
+
};
|
|
60
|
+
export const ConfirmInstance = Symbol() as InjectionKey<NotificationInstance>;
|
|
61
|
+
|
|
62
|
+
export const confirmPlugin = {
|
|
63
|
+
install(app: App) {
|
|
64
|
+
app.provide(
|
|
65
|
+
'$confirm',
|
|
66
|
+
async (question: string, title?: string): Promise<boolean> => {
|
|
67
|
+
let confirmApp: App | undefined;
|
|
68
|
+
return new Promise(async (higherResolve, higherReject) => {
|
|
69
|
+
try {
|
|
70
|
+
await new Promise(async (resolve, reject) => {
|
|
71
|
+
const component = createConfirmComponent(
|
|
72
|
+
{ question, title: title || 'Confirmer' },
|
|
73
|
+
resolve,
|
|
74
|
+
reject,
|
|
75
|
+
);
|
|
76
|
+
await nextTick();
|
|
77
|
+
confirmApp = createApp(component);
|
|
78
|
+
confirmApp.mount('#confirm');
|
|
79
|
+
});
|
|
80
|
+
higherResolve(true);
|
|
81
|
+
} catch (e) {
|
|
82
|
+
higherResolve(false);
|
|
83
|
+
} finally {
|
|
84
|
+
if (confirmApp) {
|
|
85
|
+
confirmApp.unmount();
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
});
|
|
89
|
+
},
|
|
90
|
+
);
|
|
91
|
+
app.component('bms-confirm', {
|
|
92
|
+
render() {
|
|
93
|
+
return h('div', { id: 'confirm' });
|
|
94
|
+
},
|
|
95
|
+
});
|
|
96
|
+
},
|
|
97
|
+
};
|
|
98
|
+
|
|
99
|
+
export function useConfirm() {
|
|
100
|
+
const confirm = inject(
|
|
101
|
+
'$confirm',
|
|
102
|
+
(question: string, title?: string): Promise<boolean> => {
|
|
103
|
+
return Promise.resolve(true);
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
return {
|
|
107
|
+
confirm,
|
|
108
|
+
};
|
|
109
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<FeatureFlipperModal v-model="isModalOpened">
|
|
3
|
+
<template #additional><slot name="additional"></slot></template>
|
|
4
|
+
</FeatureFlipperModal>
|
|
5
|
+
<FeatureFlipperIndicator @click="openModal" />
|
|
6
|
+
</template>
|
|
7
|
+
|
|
8
|
+
<script lang="ts" setup>
|
|
9
|
+
import FeatureFlipperModal from './FeatureFlipperModal.vue';
|
|
10
|
+
import konami from '@/services/konami.service';
|
|
11
|
+
import { ref } from 'vue';
|
|
12
|
+
import FeatureFlipperIndicator from './FeatureFlipperIndicator.vue';
|
|
13
|
+
|
|
14
|
+
const isModalOpened = ref(false);
|
|
15
|
+
const openModal = () => {
|
|
16
|
+
isModalOpened.value = true;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
// To be able to call featureFlipper() directly in console
|
|
20
|
+
(window as any).featureFlipper = openModal;
|
|
21
|
+
|
|
22
|
+
konami(openModal);
|
|
23
|
+
</script>
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<div v-if="isFeatureFlippingOn" class="feature-flip-indicator">
|
|
3
|
+
<BmsButton @click="emit('click')" :mode="StatusType.Danger">
|
|
4
|
+
<template #start>
|
|
5
|
+
<FlaskConicalIcon />
|
|
6
|
+
</template>
|
|
7
|
+
Dev Features
|
|
8
|
+
</BmsButton>
|
|
9
|
+
</div>
|
|
10
|
+
</template>
|
|
11
|
+
|
|
12
|
+
<script lang="ts" setup>
|
|
13
|
+
import { FlaskConicalIcon } from 'lucide-vue-next';
|
|
14
|
+
import { computed, ComputedRef } from 'vue';
|
|
15
|
+
import BmsButton from '@/components/button/BmsButton.vue';
|
|
16
|
+
import { useFeatureFlipper } from './featureFlipper.composable';
|
|
17
|
+
import { StatusType } from '@/models';
|
|
18
|
+
|
|
19
|
+
const { features } = useFeatureFlipper();
|
|
20
|
+
const emit = defineEmits(['click']);
|
|
21
|
+
|
|
22
|
+
const isFeatureFlippingOn: ComputedRef<boolean> = computed(
|
|
23
|
+
() =>
|
|
24
|
+
Object.keys(features.value).filter((name) => features.value[name]).length >
|
|
25
|
+
0,
|
|
26
|
+
);
|
|
27
|
+
</script>
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
<template>
|
|
2
|
+
<BmsModal
|
|
3
|
+
v-model="isModalOpened"
|
|
4
|
+
:buttons="[]"
|
|
5
|
+
title="Feature Flipper"
|
|
6
|
+
@close="onClose"
|
|
7
|
+
>
|
|
8
|
+
<div class="content">
|
|
9
|
+
<p v-if="Object.keys(features).length === 0">
|
|
10
|
+
Pas de fonctionnalité disponible pour le feature flipping
|
|
11
|
+
</p>
|
|
12
|
+
<div
|
|
13
|
+
v-else
|
|
14
|
+
v-for="name of Object.keys(features)"
|
|
15
|
+
class="feature"
|
|
16
|
+
:key="name"
|
|
17
|
+
>
|
|
18
|
+
<label :for="name">{{ name }}</label>
|
|
19
|
+
<input
|
|
20
|
+
type="checkbox"
|
|
21
|
+
:name="name"
|
|
22
|
+
:checked="isFeatureEnabled(name)"
|
|
23
|
+
@change="toggleFeature(name)"
|
|
24
|
+
/>
|
|
25
|
+
</div>
|
|
26
|
+
<slot name="additional"></slot>
|
|
27
|
+
</div>
|
|
28
|
+
</BmsModal>
|
|
29
|
+
</template>
|
|
30
|
+
|
|
31
|
+
<script lang="ts" setup>
|
|
32
|
+
import { BmsModal } from '@/index';
|
|
33
|
+
import { computed } from 'vue';
|
|
34
|
+
import { useFeatureFlipper } from './featureFlipper.composable';
|
|
35
|
+
|
|
36
|
+
const { features, isFeatureEnabled, toggleFeature } = useFeatureFlipper();
|
|
37
|
+
|
|
38
|
+
const props = defineProps<{ modelValue: boolean }>();
|
|
39
|
+
const emits = defineEmits<{
|
|
40
|
+
(e: 'update:modelValue', payload: boolean): void;
|
|
41
|
+
}>();
|
|
42
|
+
|
|
43
|
+
const isModalOpened = computed({
|
|
44
|
+
get: () => props.modelValue,
|
|
45
|
+
set: (newModelValue) => {
|
|
46
|
+
emits('update:modelValue', newModelValue);
|
|
47
|
+
},
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
const onClose = () => {
|
|
51
|
+
isModalOpened.value = false;
|
|
52
|
+
};
|
|
53
|
+
</script>
|
|
54
|
+
|
|
55
|
+
<style lang="scss" scoped>
|
|
56
|
+
.content {
|
|
57
|
+
display: flex;
|
|
58
|
+
flex-direction: column;
|
|
59
|
+
align-items: center;
|
|
60
|
+
}
|
|
61
|
+
.feature {
|
|
62
|
+
width: 30%;
|
|
63
|
+
display: flex;
|
|
64
|
+
justify-content: space-between;
|
|
65
|
+
margin: 8px;
|
|
66
|
+
font-weight: bold;
|
|
67
|
+
}
|
|
68
|
+
</style>
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
vi.mock('@/features.ts', () => ({
|
|
2
|
+
default: { feature1: true, feature2: false },
|
|
3
|
+
}));
|
|
4
|
+
|
|
5
|
+
import { useFeatureFlipper } from './featureFlipper.composable';
|
|
6
|
+
import { describe, expect, it } from 'vitest';
|
|
7
|
+
|
|
8
|
+
const initialFeatures = { feature1: true, feature2: false };
|
|
9
|
+
|
|
10
|
+
describe('featureFlipper', () => {
|
|
11
|
+
const {
|
|
12
|
+
resetFeatures,
|
|
13
|
+
fetchFeatures,
|
|
14
|
+
features,
|
|
15
|
+
isFeatureEnabled,
|
|
16
|
+
toggleFeature,
|
|
17
|
+
} = useFeatureFlipper();
|
|
18
|
+
beforeEach(() => {
|
|
19
|
+
vi.resetAllMocks();
|
|
20
|
+
vi.resetModules();
|
|
21
|
+
vi.stubGlobal('localStorage', {
|
|
22
|
+
getItem: vi.fn(),
|
|
23
|
+
setItem: vi.fn(),
|
|
24
|
+
});
|
|
25
|
+
resetFeatures(initialFeatures);
|
|
26
|
+
});
|
|
27
|
+
|
|
28
|
+
describe('fetchFeatures', () => {
|
|
29
|
+
it('should return value in localStorage', () => {
|
|
30
|
+
(localStorage.getItem as any).mockReturnValue(
|
|
31
|
+
'{"feature1": false, "feature2": true}',
|
|
32
|
+
);
|
|
33
|
+
fetchFeatures();
|
|
34
|
+
expect(features.value).toEqual({
|
|
35
|
+
feature1: false,
|
|
36
|
+
feature2: true,
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
it('should return defaultValues if localStorage invalid', () => {
|
|
40
|
+
(localStorage.getItem as any).mockReturnValue(
|
|
41
|
+
'{"feature1": false, "feature2": true',
|
|
42
|
+
);
|
|
43
|
+
fetchFeatures();
|
|
44
|
+
expect(features.value).toEqual({
|
|
45
|
+
feature1: true,
|
|
46
|
+
feature2: false,
|
|
47
|
+
});
|
|
48
|
+
});
|
|
49
|
+
it('should return value only present in initialValues', () => {
|
|
50
|
+
(localStorage.getItem as any).mockReturnValue(
|
|
51
|
+
'{"feature1": false, "feature2": true, "feature3": true}',
|
|
52
|
+
);
|
|
53
|
+
fetchFeatures();
|
|
54
|
+
expect(features.value).toEqual({
|
|
55
|
+
feature1: false,
|
|
56
|
+
feature2: true,
|
|
57
|
+
});
|
|
58
|
+
});
|
|
59
|
+
it('should return value with all in initialValues', () => {
|
|
60
|
+
(localStorage.getItem as any).mockReturnValue('{"feature1": false}');
|
|
61
|
+
fetchFeatures();
|
|
62
|
+
expect(features.value).toEqual({
|
|
63
|
+
feature1: false,
|
|
64
|
+
feature2: false,
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
describe('isFeatureEnabled', () => {
|
|
70
|
+
it('should return value in localStorage', () => {
|
|
71
|
+
(localStorage.getItem as any).mockReturnValue(
|
|
72
|
+
'{"feature1": false, "feature2": true}',
|
|
73
|
+
);
|
|
74
|
+
fetchFeatures();
|
|
75
|
+
expect(isFeatureEnabled('feature1')).toEqual(false);
|
|
76
|
+
});
|
|
77
|
+
it('should return defaultValue if not in localStorage', () => {
|
|
78
|
+
(localStorage.getItem as any).mockReturnValue('{"feature2": true}');
|
|
79
|
+
fetchFeatures();
|
|
80
|
+
expect(isFeatureEnabled('feature1')).toEqual(true);
|
|
81
|
+
});
|
|
82
|
+
it('should return false if does not exist', () => {
|
|
83
|
+
(localStorage.getItem as any).mockReturnValue('{"feature2": true}');
|
|
84
|
+
fetchFeatures();
|
|
85
|
+
expect(isFeatureEnabled('tartampion')).toEqual(false);
|
|
86
|
+
});
|
|
87
|
+
it('should return false if exist in localStorage but not in setup file', () => {
|
|
88
|
+
(localStorage.getItem as any).mockReturnValue('{"tartampion": true}');
|
|
89
|
+
fetchFeatures();
|
|
90
|
+
expect(isFeatureEnabled('tartampion')).toEqual(false);
|
|
91
|
+
});
|
|
92
|
+
});
|
|
93
|
+
|
|
94
|
+
describe('toggleFeature', () => {
|
|
95
|
+
it('should change feature in localStorage', () => {
|
|
96
|
+
toggleFeature('feature1');
|
|
97
|
+
expect(localStorage.setItem).toHaveBeenCalledWith(
|
|
98
|
+
'features',
|
|
99
|
+
'{"feature1":false,"feature2":false}',
|
|
100
|
+
);
|
|
101
|
+
});
|
|
102
|
+
it('should not do something if feature is not valid', () => {
|
|
103
|
+
toggleFeature('invalid');
|
|
104
|
+
expect(localStorage.setItem).not.toHaveBeenCalled();
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Ref, ref } from 'vue';
|
|
2
|
+
import { FeatureFlipperFeatures } from './featureFlipper.model';
|
|
3
|
+
|
|
4
|
+
const features: Ref<FeatureFlipperFeatures> = ref({});
|
|
5
|
+
|
|
6
|
+
export const useFeatureFlipper = () => {
|
|
7
|
+
const isFeatureEnabled = (name: string): boolean => {
|
|
8
|
+
if (
|
|
9
|
+
import.meta.env.STORYBOOK === 'true' ||
|
|
10
|
+
import.meta.env.VITE_CYPRESS === 'true'
|
|
11
|
+
) {
|
|
12
|
+
return true;
|
|
13
|
+
}
|
|
14
|
+
return features.value[name] || false;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
const fetchFeatures = () => {
|
|
18
|
+
const storage = getFeaturesFromStorage();
|
|
19
|
+
features.value = Object.keys(features.value).reduce(
|
|
20
|
+
(accumulator, featureName) => {
|
|
21
|
+
accumulator[featureName] =
|
|
22
|
+
storage[featureName] === undefined
|
|
23
|
+
? features.value[featureName]
|
|
24
|
+
: storage[featureName];
|
|
25
|
+
return accumulator;
|
|
26
|
+
},
|
|
27
|
+
{} as FeatureFlipperFeatures,
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
const setFeaturesInStorage = (features: FeatureFlipperFeatures) => {
|
|
32
|
+
localStorage.setItem('features', JSON.stringify(features));
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
const getFeaturesFromStorage = () => {
|
|
36
|
+
try {
|
|
37
|
+
return JSON.parse(localStorage.getItem('features') || '{}');
|
|
38
|
+
} catch (e) {
|
|
39
|
+
return {};
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const toggleFeature = (featureName: string) => {
|
|
44
|
+
if (features.value[featureName] !== undefined) {
|
|
45
|
+
features.value[featureName] = !features.value[featureName];
|
|
46
|
+
setFeaturesInStorage(features.value);
|
|
47
|
+
}
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
const resetFeatures = (initFeatures: FeatureFlipperFeatures) => {
|
|
51
|
+
features.value = { ...initFeatures };
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
const initFeatures = (initFeatures: FeatureFlipperFeatures) => {
|
|
55
|
+
resetFeatures(initFeatures);
|
|
56
|
+
fetchFeatures();
|
|
57
|
+
setFeaturesInStorage(features.value);
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
return {
|
|
61
|
+
isFeatureEnabled,
|
|
62
|
+
toggleFeature,
|
|
63
|
+
fetchFeatures,
|
|
64
|
+
resetFeatures,
|
|
65
|
+
initFeatures,
|
|
66
|
+
features,
|
|
67
|
+
};
|
|
68
|
+
};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export type FeatureFlipperFeatures = { [name: string]: boolean };
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { App, Plugin } from 'vue';
|
|
2
|
+
import { useFeatureFlipper } from '@/plugins/feature-flipper/featureFlipper.composable';
|
|
3
|
+
import { FeatureFlipperFeatures } from './featureFlipper.model';
|
|
4
|
+
import FeatureFlipper from './FeatureFlipper.vue';
|
|
5
|
+
|
|
6
|
+
export const featureFlipperPlugin: Plugin = {
|
|
7
|
+
install: (app: App, initialFeatures: FeatureFlipperFeatures) => {
|
|
8
|
+
const { initFeatures } = useFeatureFlipper();
|
|
9
|
+
initFeatures(initialFeatures);
|
|
10
|
+
app.component('bms-feature-flipper', FeatureFlipper);
|
|
11
|
+
},
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export * from './featureFlipper.composable';
|
|
15
|
+
export * from './featureFlipper.model';
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import FieldComponent from '@/plugins/field/FieldComponent.vue';
|
|
2
|
+
import { mount, shallowMount } from '@vue/test-utils';
|
|
3
|
+
import { BmsCaption } from '@/index';
|
|
4
|
+
|
|
5
|
+
describe('FieldComponent', () => {
|
|
6
|
+
it('should display label', async () => {
|
|
7
|
+
const wrapper = shallowMount(FieldComponent, {
|
|
8
|
+
slots: {
|
|
9
|
+
default: '<input type="text" />',
|
|
10
|
+
},
|
|
11
|
+
props: {
|
|
12
|
+
label: 'Set a value',
|
|
13
|
+
},
|
|
14
|
+
} as any);
|
|
15
|
+
|
|
16
|
+
expect(wrapper.text()).toContain('Set a value');
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it('should display errors', async () => {
|
|
20
|
+
const wrapper = mount(FieldComponent, {
|
|
21
|
+
slots: {
|
|
22
|
+
default: '<input type="text" />',
|
|
23
|
+
},
|
|
24
|
+
props: {
|
|
25
|
+
errors: ['An error on the field', 'Seconds Errors'],
|
|
26
|
+
},
|
|
27
|
+
} as any);
|
|
28
|
+
|
|
29
|
+
const bmsCaptions = wrapper.findAllComponents(BmsCaption);
|
|
30
|
+
expect(bmsCaptions.length).toBe(2);
|
|
31
|
+
expect(bmsCaptions[0].html()).toContain('An error on the field');
|
|
32
|
+
expect(bmsCaptions[1].html()).toContain('Seconds Errors');
|
|
33
|
+
});
|
|
34
|
+
});
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import FieldComponent from './FieldComponent.vue';
|
|
2
|
+
import { Album, Flashlight } from 'lucide-vue-next';
|
|
3
|
+
import { StatusType } from '@/models/status-type.model';
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Composants/form/FieldComponent',
|
|
7
|
+
component: FieldComponent,
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
const Template = (args) => ({
|
|
11
|
+
setup() {
|
|
12
|
+
return { args };
|
|
13
|
+
},
|
|
14
|
+
components: {
|
|
15
|
+
FieldComponent,
|
|
16
|
+
Flashlight,
|
|
17
|
+
Album,
|
|
18
|
+
},
|
|
19
|
+
template: `
|
|
20
|
+
<field v-bind="args">
|
|
21
|
+
<template #icon-start v-if="args.iconStart">
|
|
22
|
+
<Flashlight/>
|
|
23
|
+
</template>
|
|
24
|
+
<p>slot for my input here</p>
|
|
25
|
+
<template #icon-end v-if="args.iconEnd">
|
|
26
|
+
<Album/>
|
|
27
|
+
</template>
|
|
28
|
+
</field>
|
|
29
|
+
`,
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
export const Default = Template.bind({});
|
|
33
|
+
Default.args = {
|
|
34
|
+
label: 'My label',
|
|
35
|
+
captions: ['Helping text'],
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
export const WithIcons = Template.bind({});
|
|
39
|
+
WithIcons.args = {
|
|
40
|
+
label: 'My label',
|
|
41
|
+
errors: ['Error1', 'Error2'],
|
|
42
|
+
iconStart: true,
|
|
43
|
+
iconEnd: true,
|
|
44
|
+
};
|
|
45
|
+
export const WithCaptionsMode = Template.bind({});
|
|
46
|
+
WithCaptionsMode.args = {
|
|
47
|
+
label: 'My label',
|
|
48
|
+
captions: [
|
|
49
|
+
{ label: 'Caption for field 1', mode: StatusType.Default },
|
|
50
|
+
{ label: 'Caption for field 2', mode: StatusType.Success },
|
|
51
|
+
{ label: 'Caption for field 3', mode: StatusType.Warning },
|
|
52
|
+
{ label: 'Caption for field 4', mode: StatusType.Danger },
|
|
53
|
+
],
|
|
54
|
+
};
|
|
55
|
+
|
|
56
|
+
export const WithHelper = Template.bind({});
|
|
57
|
+
WithHelper.args = {
|
|
58
|
+
label: 'My label',
|
|
59
|
+
helperText: 'This is a helper text',
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export const Required = Template.bind({});
|
|
63
|
+
Required.args = {
|
|
64
|
+
label: 'My label',
|
|
65
|
+
required: true,
|
|
66
|
+
};
|
|
67
|
+
|
|
68
|
+
export const Optional = Template.bind({});
|
|
69
|
+
Optional.args = {
|
|
70
|
+
label: 'My label',
|
|
71
|
+
optional: true,
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export const Error = Template.bind({});
|
|
75
|
+
Error.args = {
|
|
76
|
+
label: 'My label',
|
|
77
|
+
errors: ['Error1', 'Error2'],
|
|
78
|
+
};
|