@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,1296 @@
|
|
|
1
|
+
import { useRoute } from 'vue-router';
|
|
2
|
+
import {
|
|
3
|
+
reflectFiltersToPath,
|
|
4
|
+
reflectSearchToPath,
|
|
5
|
+
useSearch,
|
|
6
|
+
} from './search.composable';
|
|
7
|
+
import { defineComponent, nextTick } from 'vue';
|
|
8
|
+
import { mount } from '@vue/test-utils';
|
|
9
|
+
|
|
10
|
+
vi.mock('vue-router', () => ({
|
|
11
|
+
useRoute: vi.fn(),
|
|
12
|
+
}));
|
|
13
|
+
|
|
14
|
+
const factory = (props?: any) => {
|
|
15
|
+
return mount(
|
|
16
|
+
defineComponent({
|
|
17
|
+
props: {
|
|
18
|
+
persistent: Boolean || undefined,
|
|
19
|
+
defaultFilters: Object as any,
|
|
20
|
+
defaultFiltersOpened: Boolean || undefined,
|
|
21
|
+
},
|
|
22
|
+
setup(props) {
|
|
23
|
+
return useSearch(
|
|
24
|
+
props.persistent,
|
|
25
|
+
props.defaultFilters || undefined,
|
|
26
|
+
props.defaultFiltersOpened || undefined,
|
|
27
|
+
);
|
|
28
|
+
},
|
|
29
|
+
template: '<div/>',
|
|
30
|
+
}),
|
|
31
|
+
{ props: props },
|
|
32
|
+
);
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
let saveUserPrefSpy: any;
|
|
36
|
+
let getUserPrefSpy: any;
|
|
37
|
+
|
|
38
|
+
vi.mock('@/composables/userPref.composable', () => ({
|
|
39
|
+
useUserPref: () => ({
|
|
40
|
+
saveUserPref: saveUserPrefSpy,
|
|
41
|
+
getUserPref: getUserPrefSpy,
|
|
42
|
+
}),
|
|
43
|
+
}));
|
|
44
|
+
|
|
45
|
+
const mockItems = [
|
|
46
|
+
{
|
|
47
|
+
id: 0,
|
|
48
|
+
title: 'little-slug-0',
|
|
49
|
+
checked: true,
|
|
50
|
+
choice: 'choice0',
|
|
51
|
+
level1: { level2: { level3: 'unevaleur' } },
|
|
52
|
+
},
|
|
53
|
+
{
|
|
54
|
+
id: 1,
|
|
55
|
+
title: 'little-slug-1',
|
|
56
|
+
checked: false,
|
|
57
|
+
choice: 'choice1',
|
|
58
|
+
level1: { level2: { level3: 'uneautrevaleur' } },
|
|
59
|
+
},
|
|
60
|
+
{
|
|
61
|
+
id: 2,
|
|
62
|
+
title: 'little-slug-1',
|
|
63
|
+
checked: false,
|
|
64
|
+
level1: { level2: null },
|
|
65
|
+
},
|
|
66
|
+
];
|
|
67
|
+
|
|
68
|
+
describe('search and filter composable', () => {
|
|
69
|
+
let previous: any;
|
|
70
|
+
beforeEach(() => {
|
|
71
|
+
vi.resetAllMocks();
|
|
72
|
+
(useRoute as any).mockImplementation(() => ({ path: 'path' }));
|
|
73
|
+
saveUserPrefSpy = vi.fn().mockImplementation(() => {});
|
|
74
|
+
getUserPrefSpy = vi.fn().mockReturnValue(undefined);
|
|
75
|
+
previous = global.window.location;
|
|
76
|
+
//@ts-ignore
|
|
77
|
+
delete global.window.location;
|
|
78
|
+
});
|
|
79
|
+
afterEach(() => {
|
|
80
|
+
global.window.location = previous;
|
|
81
|
+
});
|
|
82
|
+
|
|
83
|
+
describe('search composable', () => {
|
|
84
|
+
describe('reflectSearchToPath', () => {
|
|
85
|
+
test('should add search value in path when it is modified', () => {
|
|
86
|
+
global.window.location = {
|
|
87
|
+
...previous,
|
|
88
|
+
protocol: 'https:',
|
|
89
|
+
host: 'localhost/',
|
|
90
|
+
pathname: 'path',
|
|
91
|
+
search: '',
|
|
92
|
+
};
|
|
93
|
+
const replaceStateSpy = vi
|
|
94
|
+
.spyOn(global.window.history, 'replaceState')
|
|
95
|
+
.mockImplementation(() => {});
|
|
96
|
+
reflectSearchToPath('toto', 'bms-ui-filter-search');
|
|
97
|
+
const expectedUrl = 'https://localhost/path?bms-ui-filter-search=toto';
|
|
98
|
+
expect(replaceStateSpy).toBeCalledWith(
|
|
99
|
+
{ path: expectedUrl },
|
|
100
|
+
'',
|
|
101
|
+
expectedUrl,
|
|
102
|
+
);
|
|
103
|
+
});
|
|
104
|
+
test('should modify search value in path when it is modified', () => {
|
|
105
|
+
global.window.location = {
|
|
106
|
+
...previous,
|
|
107
|
+
protocol: 'https:',
|
|
108
|
+
host: 'localhost/',
|
|
109
|
+
pathname: 'path',
|
|
110
|
+
search: '?bms-ui-filter-search=toto',
|
|
111
|
+
};
|
|
112
|
+
const replaceStateSpy = vi
|
|
113
|
+
.spyOn(global.window.history, 'replaceState')
|
|
114
|
+
.mockImplementation(() => {});
|
|
115
|
+
reflectSearchToPath('titi', 'bms-ui-filter-search');
|
|
116
|
+
const expectedUrl = 'https://localhost/path?bms-ui-filter-search=titi';
|
|
117
|
+
expect(replaceStateSpy).toBeCalledWith(
|
|
118
|
+
{ path: expectedUrl },
|
|
119
|
+
'',
|
|
120
|
+
expectedUrl,
|
|
121
|
+
);
|
|
122
|
+
});
|
|
123
|
+
test('should delete search value in path when it is deleted', () => {
|
|
124
|
+
global.window.location = {
|
|
125
|
+
...previous,
|
|
126
|
+
protocol: 'https:',
|
|
127
|
+
host: 'localhost/',
|
|
128
|
+
pathname: 'path',
|
|
129
|
+
search: '?bms-ui-filter-search=toto',
|
|
130
|
+
};
|
|
131
|
+
const replaceStateSpy = vi
|
|
132
|
+
.spyOn(global.window.history, 'replaceState')
|
|
133
|
+
.mockImplementation(() => {});
|
|
134
|
+
reflectSearchToPath('', 'bms-ui-filter-search');
|
|
135
|
+
const expectedUrl = 'https://localhost/path';
|
|
136
|
+
expect(replaceStateSpy).toBeCalledWith(
|
|
137
|
+
{ path: expectedUrl },
|
|
138
|
+
'',
|
|
139
|
+
expectedUrl,
|
|
140
|
+
);
|
|
141
|
+
});
|
|
142
|
+
});
|
|
143
|
+
describe('initSearch', () => {
|
|
144
|
+
beforeEach(() => {
|
|
145
|
+
vi.spyOn(global.window.history, 'replaceState').mockImplementation(
|
|
146
|
+
() => {},
|
|
147
|
+
);
|
|
148
|
+
});
|
|
149
|
+
it('should not update search if nothing in path or localStorage', async () => {
|
|
150
|
+
global.window.location = {
|
|
151
|
+
...previous,
|
|
152
|
+
protocol: 'https:',
|
|
153
|
+
host: 'localhost/',
|
|
154
|
+
pathname: 'path',
|
|
155
|
+
};
|
|
156
|
+
const wrapper = factory({ persistent: true });
|
|
157
|
+
await nextTick();
|
|
158
|
+
expect(wrapper.vm.search).toEqual('');
|
|
159
|
+
});
|
|
160
|
+
it('should update search if in path', async () => {
|
|
161
|
+
global.window.location = {
|
|
162
|
+
...previous,
|
|
163
|
+
protocol: 'https:',
|
|
164
|
+
host: 'localhost/',
|
|
165
|
+
pathname: 'path',
|
|
166
|
+
search: '?bms-ui-filter-search=toto',
|
|
167
|
+
};
|
|
168
|
+
const wrapper = factory({ persistent: true });
|
|
169
|
+
await nextTick();
|
|
170
|
+
expect(wrapper.vm.search).toEqual('toto');
|
|
171
|
+
});
|
|
172
|
+
it('should update search if not in path but in localStorage', async () => {
|
|
173
|
+
global.window.location = {
|
|
174
|
+
...previous,
|
|
175
|
+
protocol: 'https:',
|
|
176
|
+
host: 'localhost/',
|
|
177
|
+
pathname: 'path',
|
|
178
|
+
};
|
|
179
|
+
getUserPrefSpy = vi.fn().mockReturnValue('tutu');
|
|
180
|
+
const wrapper = factory({ persistent: true });
|
|
181
|
+
await nextTick();
|
|
182
|
+
expect(wrapper.vm.search).toEqual('tutu');
|
|
183
|
+
});
|
|
184
|
+
});
|
|
185
|
+
describe('search change', async () => {
|
|
186
|
+
test('should update path and localStorage', async () => {
|
|
187
|
+
global.window.location = {
|
|
188
|
+
...previous,
|
|
189
|
+
protocol: 'https:',
|
|
190
|
+
host: 'localhost/',
|
|
191
|
+
pathname: 'path',
|
|
192
|
+
search: '',
|
|
193
|
+
};
|
|
194
|
+
const replaceStateSpy = vi
|
|
195
|
+
.spyOn(global.window.history, 'replaceState')
|
|
196
|
+
.mockImplementation(() => {});
|
|
197
|
+
const wrapper = factory({ persistent: true });
|
|
198
|
+
await nextTick();
|
|
199
|
+
wrapper.vm.search = 'tutu';
|
|
200
|
+
await nextTick();
|
|
201
|
+
const expectedUrl = 'https://localhost/path?bms-ui-filter-search=tutu';
|
|
202
|
+
expect(replaceStateSpy).toBeCalledWith(
|
|
203
|
+
{ path: expectedUrl },
|
|
204
|
+
'',
|
|
205
|
+
expectedUrl,
|
|
206
|
+
);
|
|
207
|
+
expect(saveUserPrefSpy).toHaveBeenCalledTimes(1);
|
|
208
|
+
});
|
|
209
|
+
});
|
|
210
|
+
});
|
|
211
|
+
|
|
212
|
+
describe('filter composable', () => {
|
|
213
|
+
it('can toggle filters', () => {
|
|
214
|
+
const wrapper = factory();
|
|
215
|
+
expect(wrapper.vm.isFilterVisible).toBeFalsy();
|
|
216
|
+
wrapper.vm.toggleFilters();
|
|
217
|
+
expect(wrapper.vm.isFilterVisible).toBeTruthy();
|
|
218
|
+
});
|
|
219
|
+
|
|
220
|
+
it('doesnt filter if no filter values', () => {
|
|
221
|
+
global.window.location = {
|
|
222
|
+
...previous,
|
|
223
|
+
protocol: 'https:',
|
|
224
|
+
host: 'localhost/',
|
|
225
|
+
pathname: 'path',
|
|
226
|
+
};
|
|
227
|
+
const wrapper = factory();
|
|
228
|
+
wrapper.vm.filters = [
|
|
229
|
+
{
|
|
230
|
+
label: 'toto',
|
|
231
|
+
key: 'choice',
|
|
232
|
+
type: 'input',
|
|
233
|
+
},
|
|
234
|
+
];
|
|
235
|
+
expect(wrapper.vm.filterItems(mockItems)).toStrictEqual(mockItems);
|
|
236
|
+
});
|
|
237
|
+
|
|
238
|
+
it('can filter columns via boolean filter', () => {
|
|
239
|
+
global.window.location = {
|
|
240
|
+
...previous,
|
|
241
|
+
protocol: 'https:',
|
|
242
|
+
host: 'localhost/',
|
|
243
|
+
pathname: 'path',
|
|
244
|
+
};
|
|
245
|
+
const wrapper = factory();
|
|
246
|
+
wrapper.vm.filters = [
|
|
247
|
+
{
|
|
248
|
+
label: 'toto',
|
|
249
|
+
key: 'checked',
|
|
250
|
+
type: 'boolean',
|
|
251
|
+
value: 'true',
|
|
252
|
+
},
|
|
253
|
+
];
|
|
254
|
+
expect(wrapper.vm.filterItems(mockItems)).toStrictEqual([mockItems[0]]);
|
|
255
|
+
wrapper.vm.filters = [
|
|
256
|
+
{
|
|
257
|
+
label: 'toto',
|
|
258
|
+
key: 'checked',
|
|
259
|
+
type: 'boolean',
|
|
260
|
+
value: 'false',
|
|
261
|
+
},
|
|
262
|
+
];
|
|
263
|
+
expect(wrapper.vm.filterItems(mockItems)).toStrictEqual([
|
|
264
|
+
mockItems[1],
|
|
265
|
+
mockItems[2],
|
|
266
|
+
]);
|
|
267
|
+
});
|
|
268
|
+
|
|
269
|
+
it('can filter string column via select', () => {
|
|
270
|
+
global.window.location = {
|
|
271
|
+
...previous,
|
|
272
|
+
protocol: 'https:',
|
|
273
|
+
host: 'localhost/',
|
|
274
|
+
pathname: 'path',
|
|
275
|
+
};
|
|
276
|
+
|
|
277
|
+
const wrapper = factory();
|
|
278
|
+
wrapper.vm.filters = [
|
|
279
|
+
{
|
|
280
|
+
label: 'toto',
|
|
281
|
+
key: 'choice',
|
|
282
|
+
type: 'select',
|
|
283
|
+
value: 'choice0',
|
|
284
|
+
},
|
|
285
|
+
];
|
|
286
|
+
expect(wrapper.vm.filterItems(mockItems).map((i) => i.id)).toStrictEqual([
|
|
287
|
+
0,
|
|
288
|
+
]);
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
it('can filter string column via input', () => {
|
|
292
|
+
global.window.location = {
|
|
293
|
+
...previous,
|
|
294
|
+
protocol: 'https:',
|
|
295
|
+
host: 'localhost/',
|
|
296
|
+
pathname: 'path',
|
|
297
|
+
};
|
|
298
|
+
|
|
299
|
+
const wrapper = factory();
|
|
300
|
+
wrapper.vm.filters = [
|
|
301
|
+
{
|
|
302
|
+
label: 'toto',
|
|
303
|
+
key: 'choice',
|
|
304
|
+
type: 'input',
|
|
305
|
+
value: 'CHOICE0',
|
|
306
|
+
},
|
|
307
|
+
];
|
|
308
|
+
expect(wrapper.vm.filterItems(mockItems).map((i) => i.id)).toStrictEqual([
|
|
309
|
+
0,
|
|
310
|
+
]);
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
it('can filter string in complex object column via input', () => {
|
|
314
|
+
global.window.location = {
|
|
315
|
+
...previous,
|
|
316
|
+
protocol: 'https:',
|
|
317
|
+
host: 'localhost/',
|
|
318
|
+
pathname: 'path',
|
|
319
|
+
};
|
|
320
|
+
|
|
321
|
+
const wrapper = factory();
|
|
322
|
+
wrapper.vm.filters = [
|
|
323
|
+
{
|
|
324
|
+
label: 'level3',
|
|
325
|
+
key: 'level1.level2.level3',
|
|
326
|
+
type: 'input',
|
|
327
|
+
value: 'valeur',
|
|
328
|
+
},
|
|
329
|
+
];
|
|
330
|
+
expect(wrapper.vm.filterItems(mockItems).map((i) => i.id)).toStrictEqual([
|
|
331
|
+
0, 1,
|
|
332
|
+
]);
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
describe('reflectFiltersToPath', () => {
|
|
336
|
+
test('should add search value in path when it is modified', () => {
|
|
337
|
+
global.window.location = {
|
|
338
|
+
...previous,
|
|
339
|
+
protocol: 'https:',
|
|
340
|
+
host: 'localhost/',
|
|
341
|
+
pathname: 'path',
|
|
342
|
+
};
|
|
343
|
+
const replaceStateSpy = vi
|
|
344
|
+
.spyOn(global.window.history, 'replaceState')
|
|
345
|
+
.mockImplementation(() => {});
|
|
346
|
+
reflectFiltersToPath([
|
|
347
|
+
{
|
|
348
|
+
label: 'input',
|
|
349
|
+
key: 'choice',
|
|
350
|
+
type: 'input',
|
|
351
|
+
value: 'choice0',
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
label: 'boolean',
|
|
355
|
+
key: 'checked',
|
|
356
|
+
type: 'boolean',
|
|
357
|
+
value: 'false',
|
|
358
|
+
},
|
|
359
|
+
{
|
|
360
|
+
label: 'select',
|
|
361
|
+
key: 'select',
|
|
362
|
+
type: 'select',
|
|
363
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
364
|
+
value: 'val1',
|
|
365
|
+
},
|
|
366
|
+
]);
|
|
367
|
+
const expectedUrl =
|
|
368
|
+
'https://localhost/path?bms-ui-filter-choice=choice0&bms-ui-filter-checked=false&bms-ui-filter-select=val1';
|
|
369
|
+
expect(replaceStateSpy).toBeCalledWith(
|
|
370
|
+
{ path: expectedUrl },
|
|
371
|
+
'',
|
|
372
|
+
expectedUrl,
|
|
373
|
+
);
|
|
374
|
+
});
|
|
375
|
+
test('should modify filter value in path when it is modified', () => {
|
|
376
|
+
global.window.location = {
|
|
377
|
+
...previous,
|
|
378
|
+
protocol: 'https:',
|
|
379
|
+
host: 'localhost/',
|
|
380
|
+
pathname: 'path',
|
|
381
|
+
search:
|
|
382
|
+
'?bms-ui-filter-choice=choice0&bms-ui-filter-checked=false&bms-ui-filter-select=val1',
|
|
383
|
+
};
|
|
384
|
+
const replaceStateSpy = vi
|
|
385
|
+
.spyOn(global.window.history, 'replaceState')
|
|
386
|
+
.mockImplementation(() => {});
|
|
387
|
+
reflectFiltersToPath([
|
|
388
|
+
{
|
|
389
|
+
label: 'input',
|
|
390
|
+
key: 'choice',
|
|
391
|
+
type: 'input',
|
|
392
|
+
value: 'choice1',
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
label: 'boolean',
|
|
396
|
+
key: 'checked',
|
|
397
|
+
type: 'boolean',
|
|
398
|
+
value: 'false',
|
|
399
|
+
},
|
|
400
|
+
{
|
|
401
|
+
label: 'select',
|
|
402
|
+
key: 'select',
|
|
403
|
+
type: 'select',
|
|
404
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
405
|
+
value: 'val1',
|
|
406
|
+
},
|
|
407
|
+
]);
|
|
408
|
+
const expectedUrl =
|
|
409
|
+
'https://localhost/path?bms-ui-filter-choice=choice1&bms-ui-filter-checked=false&bms-ui-filter-select=val1';
|
|
410
|
+
expect(replaceStateSpy).toBeCalledWith(
|
|
411
|
+
{ path: expectedUrl },
|
|
412
|
+
'',
|
|
413
|
+
expectedUrl,
|
|
414
|
+
);
|
|
415
|
+
});
|
|
416
|
+
test('should delete filter value in path when it is deleted', () => {
|
|
417
|
+
global.window.location = {
|
|
418
|
+
...previous,
|
|
419
|
+
protocol: 'https:',
|
|
420
|
+
host: 'localhost/',
|
|
421
|
+
pathname: 'path',
|
|
422
|
+
search:
|
|
423
|
+
'?bms-ui-filter-choice=choice0&bms-ui-filter-checked=false&bms-ui-filter-select=val1',
|
|
424
|
+
};
|
|
425
|
+
const replaceStateSpy = vi
|
|
426
|
+
.spyOn(global.window.history, 'replaceState')
|
|
427
|
+
.mockImplementation(() => {});
|
|
428
|
+
reflectFiltersToPath([
|
|
429
|
+
{
|
|
430
|
+
label: 'input',
|
|
431
|
+
key: 'choice',
|
|
432
|
+
type: 'input',
|
|
433
|
+
value: '',
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
label: 'boolean',
|
|
437
|
+
key: 'checked',
|
|
438
|
+
type: 'boolean',
|
|
439
|
+
value: 'false',
|
|
440
|
+
},
|
|
441
|
+
{
|
|
442
|
+
label: 'select',
|
|
443
|
+
key: 'select',
|
|
444
|
+
type: 'select',
|
|
445
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
446
|
+
value: 'val1',
|
|
447
|
+
},
|
|
448
|
+
]);
|
|
449
|
+
const expectedUrl =
|
|
450
|
+
'https://localhost/path?bms-ui-filter-checked=false&bms-ui-filter-select=val1';
|
|
451
|
+
expect(replaceStateSpy).toBeCalledWith(
|
|
452
|
+
{ path: expectedUrl },
|
|
453
|
+
'',
|
|
454
|
+
expectedUrl,
|
|
455
|
+
);
|
|
456
|
+
});
|
|
457
|
+
});
|
|
458
|
+
|
|
459
|
+
describe('initFilters', () => {
|
|
460
|
+
test('should not init filter values if no reflect', async () => {
|
|
461
|
+
const wrapper = factory({
|
|
462
|
+
persistent: false,
|
|
463
|
+
defaultFilters: [
|
|
464
|
+
{
|
|
465
|
+
label: 'input',
|
|
466
|
+
key: 'choice',
|
|
467
|
+
type: 'input',
|
|
468
|
+
},
|
|
469
|
+
{
|
|
470
|
+
label: 'boolean',
|
|
471
|
+
key: 'checked',
|
|
472
|
+
type: 'boolean',
|
|
473
|
+
},
|
|
474
|
+
{
|
|
475
|
+
label: 'select',
|
|
476
|
+
key: 'select',
|
|
477
|
+
type: 'select',
|
|
478
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
479
|
+
},
|
|
480
|
+
],
|
|
481
|
+
defaultFiltersOpened: false,
|
|
482
|
+
});
|
|
483
|
+
await nextTick();
|
|
484
|
+
expect(wrapper.vm.filters).toStrictEqual([
|
|
485
|
+
{
|
|
486
|
+
label: 'input',
|
|
487
|
+
key: 'choice',
|
|
488
|
+
type: 'input',
|
|
489
|
+
value: null,
|
|
490
|
+
},
|
|
491
|
+
{
|
|
492
|
+
label: 'boolean',
|
|
493
|
+
key: 'checked',
|
|
494
|
+
type: 'boolean',
|
|
495
|
+
value: null,
|
|
496
|
+
},
|
|
497
|
+
{
|
|
498
|
+
label: 'select',
|
|
499
|
+
key: 'select',
|
|
500
|
+
type: 'select',
|
|
501
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
502
|
+
value: null,
|
|
503
|
+
},
|
|
504
|
+
]);
|
|
505
|
+
});
|
|
506
|
+
test('should set filter value with path value', async () => {
|
|
507
|
+
global.window.location = {
|
|
508
|
+
...previous,
|
|
509
|
+
protocol: 'https:',
|
|
510
|
+
host: 'localhost/',
|
|
511
|
+
pathname: 'path',
|
|
512
|
+
search:
|
|
513
|
+
'?bms-ui-filter-choice=choice0&bms-ui-filter-checked=false&bms-ui-filter-select=val1',
|
|
514
|
+
};
|
|
515
|
+
const replaceStateSpy = vi
|
|
516
|
+
.spyOn(global.window.history, 'replaceState')
|
|
517
|
+
.mockImplementation(() => {});
|
|
518
|
+
|
|
519
|
+
const wrapper = factory({
|
|
520
|
+
persistent: true,
|
|
521
|
+
defaultFilters: [
|
|
522
|
+
{
|
|
523
|
+
label: 'input',
|
|
524
|
+
key: 'choice',
|
|
525
|
+
type: 'input',
|
|
526
|
+
},
|
|
527
|
+
{
|
|
528
|
+
label: 'boolean',
|
|
529
|
+
key: 'checked',
|
|
530
|
+
type: 'boolean',
|
|
531
|
+
},
|
|
532
|
+
{
|
|
533
|
+
label: 'select',
|
|
534
|
+
key: 'select',
|
|
535
|
+
type: 'select',
|
|
536
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
537
|
+
},
|
|
538
|
+
],
|
|
539
|
+
});
|
|
540
|
+
await nextTick();
|
|
541
|
+
|
|
542
|
+
expect(wrapper.vm.filters).toStrictEqual([
|
|
543
|
+
{
|
|
544
|
+
label: 'input',
|
|
545
|
+
key: 'choice',
|
|
546
|
+
type: 'input',
|
|
547
|
+
value: 'choice0',
|
|
548
|
+
},
|
|
549
|
+
{
|
|
550
|
+
label: 'boolean',
|
|
551
|
+
key: 'checked',
|
|
552
|
+
type: 'boolean',
|
|
553
|
+
value: false,
|
|
554
|
+
},
|
|
555
|
+
{
|
|
556
|
+
label: 'select',
|
|
557
|
+
key: 'select',
|
|
558
|
+
type: 'select',
|
|
559
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
560
|
+
value: 'val1',
|
|
561
|
+
},
|
|
562
|
+
]);
|
|
563
|
+
});
|
|
564
|
+
test('should get info from localStorage if no value in path', async () => {
|
|
565
|
+
global.window.location = {
|
|
566
|
+
...previous,
|
|
567
|
+
protocol: 'https:',
|
|
568
|
+
host: 'localhost/',
|
|
569
|
+
pathname: 'path',
|
|
570
|
+
};
|
|
571
|
+
const replaceStateSpy = vi
|
|
572
|
+
.spyOn(global.window.history, 'replaceState')
|
|
573
|
+
.mockImplementation(() => {});
|
|
574
|
+
getUserPrefSpy = vi.fn().mockImplementation((...params: any[]) => {
|
|
575
|
+
if (params[0] === 'bms-ui-filter-choice') {
|
|
576
|
+
return 'tutu';
|
|
577
|
+
}
|
|
578
|
+
return undefined;
|
|
579
|
+
});
|
|
580
|
+
|
|
581
|
+
const wrapper = factory({
|
|
582
|
+
persistent: true,
|
|
583
|
+
defaultFilters: [
|
|
584
|
+
{
|
|
585
|
+
label: 'input',
|
|
586
|
+
key: 'choice',
|
|
587
|
+
type: 'input',
|
|
588
|
+
},
|
|
589
|
+
{
|
|
590
|
+
label: 'boolean',
|
|
591
|
+
key: 'checked',
|
|
592
|
+
type: 'boolean',
|
|
593
|
+
},
|
|
594
|
+
{
|
|
595
|
+
label: 'select',
|
|
596
|
+
key: 'select',
|
|
597
|
+
type: 'select',
|
|
598
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
599
|
+
},
|
|
600
|
+
],
|
|
601
|
+
});
|
|
602
|
+
await nextTick();
|
|
603
|
+
expect(wrapper.vm.filters).toStrictEqual([
|
|
604
|
+
{
|
|
605
|
+
label: 'input',
|
|
606
|
+
key: 'choice',
|
|
607
|
+
type: 'input',
|
|
608
|
+
value: 'tutu',
|
|
609
|
+
},
|
|
610
|
+
{
|
|
611
|
+
label: 'boolean',
|
|
612
|
+
key: 'checked',
|
|
613
|
+
type: 'boolean',
|
|
614
|
+
value: null,
|
|
615
|
+
},
|
|
616
|
+
{
|
|
617
|
+
label: 'select',
|
|
618
|
+
key: 'select',
|
|
619
|
+
type: 'select',
|
|
620
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
621
|
+
value: null,
|
|
622
|
+
},
|
|
623
|
+
]);
|
|
624
|
+
});
|
|
625
|
+
});
|
|
626
|
+
|
|
627
|
+
describe('filters change', async () => {
|
|
628
|
+
test('should update path and localStorage', async () => {
|
|
629
|
+
global.window.location = {
|
|
630
|
+
...previous,
|
|
631
|
+
protocol: 'https:',
|
|
632
|
+
host: 'localhost/',
|
|
633
|
+
pathname: 'path',
|
|
634
|
+
};
|
|
635
|
+
const replaceStateSpy = vi
|
|
636
|
+
.spyOn(global.window.history, 'replaceState')
|
|
637
|
+
.mockImplementation(() => {});
|
|
638
|
+
const wrapper = factory({
|
|
639
|
+
persistent: true,
|
|
640
|
+
defaultFilters: [
|
|
641
|
+
{
|
|
642
|
+
label: 'input',
|
|
643
|
+
key: 'choice',
|
|
644
|
+
type: 'input',
|
|
645
|
+
},
|
|
646
|
+
{
|
|
647
|
+
label: 'boolean',
|
|
648
|
+
key: 'checked',
|
|
649
|
+
type: 'boolean',
|
|
650
|
+
},
|
|
651
|
+
{
|
|
652
|
+
label: 'select',
|
|
653
|
+
key: 'select',
|
|
654
|
+
type: 'select',
|
|
655
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
656
|
+
},
|
|
657
|
+
],
|
|
658
|
+
});
|
|
659
|
+
await nextTick();
|
|
660
|
+
expect(saveUserPrefSpy).toHaveBeenCalledTimes(3);
|
|
661
|
+
wrapper.vm.filters = [
|
|
662
|
+
{
|
|
663
|
+
label: 'input',
|
|
664
|
+
key: 'choice',
|
|
665
|
+
type: 'input',
|
|
666
|
+
value: 'tutu',
|
|
667
|
+
},
|
|
668
|
+
{
|
|
669
|
+
label: 'boolean',
|
|
670
|
+
key: 'checked',
|
|
671
|
+
type: 'boolean',
|
|
672
|
+
value: false,
|
|
673
|
+
},
|
|
674
|
+
{
|
|
675
|
+
label: 'select',
|
|
676
|
+
key: 'select',
|
|
677
|
+
type: 'select',
|
|
678
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
679
|
+
value: 'val1',
|
|
680
|
+
},
|
|
681
|
+
];
|
|
682
|
+
await nextTick();
|
|
683
|
+
const expectedUrl =
|
|
684
|
+
'https://localhost/path?bms-ui-filter-choice=tutu&bms-ui-filter-checked=false&bms-ui-filter-select=val1';
|
|
685
|
+
expect(replaceStateSpy).toBeCalledWith(
|
|
686
|
+
{ path: expectedUrl },
|
|
687
|
+
'',
|
|
688
|
+
expectedUrl,
|
|
689
|
+
);
|
|
690
|
+
expect(saveUserPrefSpy).toHaveBeenCalledTimes(6);
|
|
691
|
+
});
|
|
692
|
+
});
|
|
693
|
+
|
|
694
|
+
describe('isSavedFilterActive', () => {
|
|
695
|
+
test('should return false if value are not the same', async () => {
|
|
696
|
+
global.window.location = {
|
|
697
|
+
...previous,
|
|
698
|
+
protocol: 'https:',
|
|
699
|
+
host: 'localhost/',
|
|
700
|
+
pathname: 'path',
|
|
701
|
+
};
|
|
702
|
+
const replaceStateSpy = vi
|
|
703
|
+
.spyOn(global.window.history, 'replaceState')
|
|
704
|
+
.mockImplementation(() => {});
|
|
705
|
+
|
|
706
|
+
const wrapper = factory({
|
|
707
|
+
defaultFilters: [
|
|
708
|
+
{
|
|
709
|
+
label: 'input',
|
|
710
|
+
key: 'choice',
|
|
711
|
+
type: 'input',
|
|
712
|
+
},
|
|
713
|
+
{
|
|
714
|
+
label: 'boolean',
|
|
715
|
+
key: 'checked',
|
|
716
|
+
type: 'boolean',
|
|
717
|
+
},
|
|
718
|
+
{
|
|
719
|
+
label: 'select',
|
|
720
|
+
key: 'select',
|
|
721
|
+
type: 'select',
|
|
722
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
723
|
+
},
|
|
724
|
+
],
|
|
725
|
+
});
|
|
726
|
+
await nextTick();
|
|
727
|
+
wrapper.vm.filters = [
|
|
728
|
+
{
|
|
729
|
+
label: 'input',
|
|
730
|
+
key: 'choice',
|
|
731
|
+
type: 'input',
|
|
732
|
+
value: 'tutu',
|
|
733
|
+
},
|
|
734
|
+
{
|
|
735
|
+
label: 'boolean',
|
|
736
|
+
key: 'checked',
|
|
737
|
+
type: 'boolean',
|
|
738
|
+
value: false,
|
|
739
|
+
},
|
|
740
|
+
{
|
|
741
|
+
label: 'select',
|
|
742
|
+
key: 'select',
|
|
743
|
+
type: 'select',
|
|
744
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
745
|
+
value: 'val1',
|
|
746
|
+
},
|
|
747
|
+
];
|
|
748
|
+
await nextTick();
|
|
749
|
+
expect(
|
|
750
|
+
wrapper.vm.isSavedFilterActive({
|
|
751
|
+
id: 'saved',
|
|
752
|
+
name: 'saved filter',
|
|
753
|
+
route: 'route',
|
|
754
|
+
filters: [
|
|
755
|
+
{
|
|
756
|
+
target: 'choice',
|
|
757
|
+
value: 'tata',
|
|
758
|
+
},
|
|
759
|
+
{
|
|
760
|
+
target: 'checked',
|
|
761
|
+
value: false,
|
|
762
|
+
},
|
|
763
|
+
{
|
|
764
|
+
target: 'select',
|
|
765
|
+
value: 'val1',
|
|
766
|
+
},
|
|
767
|
+
],
|
|
768
|
+
}),
|
|
769
|
+
).toEqual(false);
|
|
770
|
+
});
|
|
771
|
+
test('should return true if value are the same', async () => {
|
|
772
|
+
global.window.location = {
|
|
773
|
+
...previous,
|
|
774
|
+
protocol: 'https:',
|
|
775
|
+
host: 'localhost/',
|
|
776
|
+
pathname: 'path',
|
|
777
|
+
};
|
|
778
|
+
const replaceStateSpy = vi
|
|
779
|
+
.spyOn(global.window.history, 'replaceState')
|
|
780
|
+
.mockImplementation(() => {});
|
|
781
|
+
|
|
782
|
+
const wrapper = factory({
|
|
783
|
+
defaultFilters: [
|
|
784
|
+
{
|
|
785
|
+
label: 'input',
|
|
786
|
+
key: 'choice',
|
|
787
|
+
type: 'input',
|
|
788
|
+
},
|
|
789
|
+
{
|
|
790
|
+
label: 'boolean',
|
|
791
|
+
key: 'checked',
|
|
792
|
+
type: 'boolean',
|
|
793
|
+
},
|
|
794
|
+
{
|
|
795
|
+
label: 'select',
|
|
796
|
+
key: 'select',
|
|
797
|
+
type: 'select',
|
|
798
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
799
|
+
},
|
|
800
|
+
],
|
|
801
|
+
});
|
|
802
|
+
await nextTick();
|
|
803
|
+
wrapper.vm.filters = [
|
|
804
|
+
{
|
|
805
|
+
label: 'input',
|
|
806
|
+
key: 'choice',
|
|
807
|
+
type: 'input',
|
|
808
|
+
value: 'tutu',
|
|
809
|
+
},
|
|
810
|
+
{
|
|
811
|
+
label: 'boolean',
|
|
812
|
+
key: 'checked',
|
|
813
|
+
type: 'boolean',
|
|
814
|
+
value: false,
|
|
815
|
+
},
|
|
816
|
+
{
|
|
817
|
+
label: 'select',
|
|
818
|
+
key: 'select',
|
|
819
|
+
type: 'select',
|
|
820
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
821
|
+
value: 'val1',
|
|
822
|
+
},
|
|
823
|
+
];
|
|
824
|
+
await nextTick();
|
|
825
|
+
expect(
|
|
826
|
+
wrapper.vm.isSavedFilterActive({
|
|
827
|
+
id: 'saved',
|
|
828
|
+
name: 'saved filter',
|
|
829
|
+
route: 'route',
|
|
830
|
+
filters: [
|
|
831
|
+
{
|
|
832
|
+
target: 'choice',
|
|
833
|
+
value: 'tutu',
|
|
834
|
+
},
|
|
835
|
+
{
|
|
836
|
+
target: 'checked',
|
|
837
|
+
value: false,
|
|
838
|
+
},
|
|
839
|
+
{
|
|
840
|
+
target: 'select',
|
|
841
|
+
value: 'val1',
|
|
842
|
+
},
|
|
843
|
+
],
|
|
844
|
+
}),
|
|
845
|
+
).toEqual(true);
|
|
846
|
+
});
|
|
847
|
+
test('should return true if value are similar with nullable', async () => {
|
|
848
|
+
global.window.location = {
|
|
849
|
+
...previous,
|
|
850
|
+
protocol: 'https:',
|
|
851
|
+
host: 'localhost/',
|
|
852
|
+
pathname: 'path',
|
|
853
|
+
};
|
|
854
|
+
const replaceStateSpy = vi
|
|
855
|
+
.spyOn(global.window.history, 'replaceState')
|
|
856
|
+
.mockImplementation(() => {});
|
|
857
|
+
|
|
858
|
+
const wrapper = factory({
|
|
859
|
+
defaultFilters: [
|
|
860
|
+
{
|
|
861
|
+
label: 'input',
|
|
862
|
+
key: 'choice',
|
|
863
|
+
type: 'input',
|
|
864
|
+
},
|
|
865
|
+
{
|
|
866
|
+
label: 'boolean',
|
|
867
|
+
key: 'checked',
|
|
868
|
+
type: 'boolean',
|
|
869
|
+
},
|
|
870
|
+
{
|
|
871
|
+
label: 'select',
|
|
872
|
+
key: 'select',
|
|
873
|
+
type: 'select',
|
|
874
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
875
|
+
},
|
|
876
|
+
],
|
|
877
|
+
});
|
|
878
|
+
await nextTick();
|
|
879
|
+
wrapper.vm.filters = [
|
|
880
|
+
{
|
|
881
|
+
label: 'input',
|
|
882
|
+
key: 'choice',
|
|
883
|
+
type: 'input',
|
|
884
|
+
value: '',
|
|
885
|
+
},
|
|
886
|
+
{
|
|
887
|
+
label: 'boolean',
|
|
888
|
+
key: 'checked',
|
|
889
|
+
type: 'boolean',
|
|
890
|
+
value: false,
|
|
891
|
+
},
|
|
892
|
+
{
|
|
893
|
+
label: 'select',
|
|
894
|
+
key: 'select',
|
|
895
|
+
type: 'select',
|
|
896
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
897
|
+
value: '',
|
|
898
|
+
},
|
|
899
|
+
];
|
|
900
|
+
await nextTick();
|
|
901
|
+
expect(
|
|
902
|
+
wrapper.vm.isSavedFilterActive({
|
|
903
|
+
id: 'saved',
|
|
904
|
+
name: 'saved filter',
|
|
905
|
+
route: 'route',
|
|
906
|
+
filters: [
|
|
907
|
+
{
|
|
908
|
+
target: 'choice',
|
|
909
|
+
value: null,
|
|
910
|
+
},
|
|
911
|
+
{
|
|
912
|
+
target: 'checked',
|
|
913
|
+
value: false,
|
|
914
|
+
},
|
|
915
|
+
{
|
|
916
|
+
target: 'select',
|
|
917
|
+
value: null,
|
|
918
|
+
},
|
|
919
|
+
],
|
|
920
|
+
}),
|
|
921
|
+
).toEqual(true);
|
|
922
|
+
});
|
|
923
|
+
test('should return true if value are similar with nullable 2', async () => {
|
|
924
|
+
global.window.location = {
|
|
925
|
+
...previous,
|
|
926
|
+
protocol: 'https:',
|
|
927
|
+
host: 'localhost/',
|
|
928
|
+
pathname: 'path',
|
|
929
|
+
};
|
|
930
|
+
const replaceStateSpy = vi
|
|
931
|
+
.spyOn(global.window.history, 'replaceState')
|
|
932
|
+
.mockImplementation(() => {});
|
|
933
|
+
|
|
934
|
+
const wrapper = factory({
|
|
935
|
+
defaultFilters: [
|
|
936
|
+
{
|
|
937
|
+
label: 'input',
|
|
938
|
+
key: 'choice',
|
|
939
|
+
type: 'input',
|
|
940
|
+
},
|
|
941
|
+
{
|
|
942
|
+
label: 'boolean',
|
|
943
|
+
key: 'checked',
|
|
944
|
+
type: 'boolean',
|
|
945
|
+
},
|
|
946
|
+
{
|
|
947
|
+
label: 'select',
|
|
948
|
+
key: 'select',
|
|
949
|
+
type: 'select',
|
|
950
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
951
|
+
},
|
|
952
|
+
],
|
|
953
|
+
});
|
|
954
|
+
await nextTick();
|
|
955
|
+
wrapper.vm.filters = [
|
|
956
|
+
{
|
|
957
|
+
label: 'input',
|
|
958
|
+
key: 'choice',
|
|
959
|
+
type: 'input',
|
|
960
|
+
value: null,
|
|
961
|
+
},
|
|
962
|
+
{
|
|
963
|
+
label: 'boolean',
|
|
964
|
+
key: 'checked',
|
|
965
|
+
type: 'boolean',
|
|
966
|
+
value: false,
|
|
967
|
+
},
|
|
968
|
+
{
|
|
969
|
+
label: 'select',
|
|
970
|
+
key: 'select',
|
|
971
|
+
type: 'select',
|
|
972
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
973
|
+
value: null,
|
|
974
|
+
},
|
|
975
|
+
];
|
|
976
|
+
await nextTick();
|
|
977
|
+
expect(
|
|
978
|
+
wrapper.vm.isSavedFilterActive({
|
|
979
|
+
id: 'saved',
|
|
980
|
+
name: 'saved filter',
|
|
981
|
+
route: 'route',
|
|
982
|
+
filters: [
|
|
983
|
+
{
|
|
984
|
+
target: 'choice',
|
|
985
|
+
value: '',
|
|
986
|
+
},
|
|
987
|
+
{
|
|
988
|
+
target: 'checked',
|
|
989
|
+
value: false,
|
|
990
|
+
},
|
|
991
|
+
{
|
|
992
|
+
target: 'select',
|
|
993
|
+
value: '',
|
|
994
|
+
},
|
|
995
|
+
],
|
|
996
|
+
}),
|
|
997
|
+
).toEqual(true);
|
|
998
|
+
});
|
|
999
|
+
});
|
|
1000
|
+
|
|
1001
|
+
describe('resetFilters', () => {
|
|
1002
|
+
test('should reset all filters', async () => {
|
|
1003
|
+
global.window.location = {
|
|
1004
|
+
...previous,
|
|
1005
|
+
protocol: 'https:',
|
|
1006
|
+
host: 'localhost/',
|
|
1007
|
+
pathname: 'path',
|
|
1008
|
+
};
|
|
1009
|
+
const replaceStateSpy = vi
|
|
1010
|
+
.spyOn(global.window.history, 'replaceState')
|
|
1011
|
+
.mockImplementation(() => {});
|
|
1012
|
+
|
|
1013
|
+
const wrapper = factory({
|
|
1014
|
+
defaultFilters: [
|
|
1015
|
+
{
|
|
1016
|
+
label: 'input',
|
|
1017
|
+
key: 'choice',
|
|
1018
|
+
type: 'input',
|
|
1019
|
+
},
|
|
1020
|
+
{
|
|
1021
|
+
label: 'boolean',
|
|
1022
|
+
key: 'checked',
|
|
1023
|
+
type: 'boolean',
|
|
1024
|
+
},
|
|
1025
|
+
{
|
|
1026
|
+
label: 'between',
|
|
1027
|
+
key: 'date',
|
|
1028
|
+
type: 'betweenDate',
|
|
1029
|
+
},
|
|
1030
|
+
{
|
|
1031
|
+
label: 'select',
|
|
1032
|
+
key: 'select',
|
|
1033
|
+
type: 'select',
|
|
1034
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1035
|
+
},
|
|
1036
|
+
],
|
|
1037
|
+
});
|
|
1038
|
+
await nextTick();
|
|
1039
|
+
wrapper.vm.filters = [
|
|
1040
|
+
{
|
|
1041
|
+
label: 'input',
|
|
1042
|
+
key: 'choice',
|
|
1043
|
+
type: 'input',
|
|
1044
|
+
value: 'toto',
|
|
1045
|
+
},
|
|
1046
|
+
{
|
|
1047
|
+
label: 'boolean',
|
|
1048
|
+
key: 'checked',
|
|
1049
|
+
type: 'boolean',
|
|
1050
|
+
value: false,
|
|
1051
|
+
},
|
|
1052
|
+
{
|
|
1053
|
+
label: 'between',
|
|
1054
|
+
key: 'date',
|
|
1055
|
+
type: 'betweenDate',
|
|
1056
|
+
valueFrom: '2009/06/21',
|
|
1057
|
+
valueTo: '2009/12/31',
|
|
1058
|
+
},
|
|
1059
|
+
{
|
|
1060
|
+
label: 'select',
|
|
1061
|
+
key: 'select',
|
|
1062
|
+
type: 'select',
|
|
1063
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1064
|
+
value: 'val1',
|
|
1065
|
+
},
|
|
1066
|
+
];
|
|
1067
|
+
await nextTick();
|
|
1068
|
+
wrapper.vm.resetFilters();
|
|
1069
|
+
await nextTick();
|
|
1070
|
+
expect(wrapper.vm.filters).toEqual([
|
|
1071
|
+
{
|
|
1072
|
+
label: 'input',
|
|
1073
|
+
key: 'choice',
|
|
1074
|
+
type: 'input',
|
|
1075
|
+
value: null,
|
|
1076
|
+
},
|
|
1077
|
+
{
|
|
1078
|
+
label: 'boolean',
|
|
1079
|
+
key: 'checked',
|
|
1080
|
+
type: 'boolean',
|
|
1081
|
+
value: null,
|
|
1082
|
+
},
|
|
1083
|
+
{
|
|
1084
|
+
label: 'between',
|
|
1085
|
+
key: 'date',
|
|
1086
|
+
type: 'betweenDate',
|
|
1087
|
+
valueFrom: null,
|
|
1088
|
+
valueTo: null,
|
|
1089
|
+
},
|
|
1090
|
+
{
|
|
1091
|
+
label: 'select',
|
|
1092
|
+
key: 'select',
|
|
1093
|
+
type: 'select',
|
|
1094
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1095
|
+
value: null,
|
|
1096
|
+
},
|
|
1097
|
+
]);
|
|
1098
|
+
});
|
|
1099
|
+
});
|
|
1100
|
+
|
|
1101
|
+
describe('selectSavedFilter', () => {
|
|
1102
|
+
test('should apply a savedFilter', async () => {
|
|
1103
|
+
global.window.location = {
|
|
1104
|
+
...previous,
|
|
1105
|
+
protocol: 'https:',
|
|
1106
|
+
host: 'localhost/',
|
|
1107
|
+
pathname: 'path',
|
|
1108
|
+
};
|
|
1109
|
+
const replaceStateSpy = vi
|
|
1110
|
+
.spyOn(global.window.history, 'replaceState')
|
|
1111
|
+
.mockImplementation(() => {});
|
|
1112
|
+
|
|
1113
|
+
const wrapper = factory({
|
|
1114
|
+
defaultFilters: [
|
|
1115
|
+
{
|
|
1116
|
+
label: 'input',
|
|
1117
|
+
key: 'choice',
|
|
1118
|
+
type: 'input',
|
|
1119
|
+
},
|
|
1120
|
+
{
|
|
1121
|
+
label: 'boolean',
|
|
1122
|
+
key: 'checked',
|
|
1123
|
+
type: 'boolean',
|
|
1124
|
+
},
|
|
1125
|
+
{
|
|
1126
|
+
label: 'select',
|
|
1127
|
+
key: 'select',
|
|
1128
|
+
type: 'select',
|
|
1129
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1130
|
+
},
|
|
1131
|
+
],
|
|
1132
|
+
});
|
|
1133
|
+
await nextTick();
|
|
1134
|
+
wrapper.vm.filters = [
|
|
1135
|
+
{
|
|
1136
|
+
label: 'input',
|
|
1137
|
+
key: 'choice',
|
|
1138
|
+
type: 'input',
|
|
1139
|
+
value: null,
|
|
1140
|
+
},
|
|
1141
|
+
{
|
|
1142
|
+
label: 'boolean',
|
|
1143
|
+
key: 'checked',
|
|
1144
|
+
type: 'boolean',
|
|
1145
|
+
value: false,
|
|
1146
|
+
},
|
|
1147
|
+
{
|
|
1148
|
+
label: 'select',
|
|
1149
|
+
key: 'select',
|
|
1150
|
+
type: 'select',
|
|
1151
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1152
|
+
value: null,
|
|
1153
|
+
},
|
|
1154
|
+
];
|
|
1155
|
+
await nextTick();
|
|
1156
|
+
wrapper.vm.selectSavedFilter({
|
|
1157
|
+
id: 'saved',
|
|
1158
|
+
name: 'saved filter',
|
|
1159
|
+
route: 'route',
|
|
1160
|
+
filters: [
|
|
1161
|
+
{
|
|
1162
|
+
target: 'choice',
|
|
1163
|
+
value: 'toto',
|
|
1164
|
+
},
|
|
1165
|
+
{
|
|
1166
|
+
target: 'checked',
|
|
1167
|
+
value: true,
|
|
1168
|
+
},
|
|
1169
|
+
{
|
|
1170
|
+
target: 'select',
|
|
1171
|
+
value: 'val1',
|
|
1172
|
+
},
|
|
1173
|
+
],
|
|
1174
|
+
});
|
|
1175
|
+
await nextTick();
|
|
1176
|
+
expect(wrapper.vm.filters).toEqual([
|
|
1177
|
+
{
|
|
1178
|
+
label: 'input',
|
|
1179
|
+
key: 'choice',
|
|
1180
|
+
type: 'input',
|
|
1181
|
+
value: 'toto',
|
|
1182
|
+
},
|
|
1183
|
+
{
|
|
1184
|
+
label: 'boolean',
|
|
1185
|
+
key: 'checked',
|
|
1186
|
+
type: 'boolean',
|
|
1187
|
+
value: true,
|
|
1188
|
+
},
|
|
1189
|
+
{
|
|
1190
|
+
label: 'select',
|
|
1191
|
+
key: 'select',
|
|
1192
|
+
type: 'select',
|
|
1193
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1194
|
+
value: 'val1',
|
|
1195
|
+
},
|
|
1196
|
+
]);
|
|
1197
|
+
});
|
|
1198
|
+
test('should reset filters if the saved filter is already selected', async () => {
|
|
1199
|
+
global.window.location = {
|
|
1200
|
+
...previous,
|
|
1201
|
+
protocol: 'https:',
|
|
1202
|
+
host: 'localhost/',
|
|
1203
|
+
pathname: 'path',
|
|
1204
|
+
};
|
|
1205
|
+
const replaceStateSpy = vi
|
|
1206
|
+
.spyOn(global.window.history, 'replaceState')
|
|
1207
|
+
.mockImplementation(() => {});
|
|
1208
|
+
|
|
1209
|
+
const wrapper = factory({
|
|
1210
|
+
defaultFilters: [
|
|
1211
|
+
{
|
|
1212
|
+
label: 'input',
|
|
1213
|
+
key: 'choice',
|
|
1214
|
+
type: 'input',
|
|
1215
|
+
},
|
|
1216
|
+
{
|
|
1217
|
+
label: 'boolean',
|
|
1218
|
+
key: 'checked',
|
|
1219
|
+
type: 'boolean',
|
|
1220
|
+
},
|
|
1221
|
+
{
|
|
1222
|
+
label: 'select',
|
|
1223
|
+
key: 'select',
|
|
1224
|
+
type: 'select',
|
|
1225
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1226
|
+
},
|
|
1227
|
+
],
|
|
1228
|
+
});
|
|
1229
|
+
await nextTick();
|
|
1230
|
+
wrapper.vm.filters = [
|
|
1231
|
+
{
|
|
1232
|
+
label: 'input',
|
|
1233
|
+
key: 'choice',
|
|
1234
|
+
type: 'input',
|
|
1235
|
+
value: 'toto',
|
|
1236
|
+
},
|
|
1237
|
+
{
|
|
1238
|
+
label: 'boolean',
|
|
1239
|
+
key: 'checked',
|
|
1240
|
+
type: 'boolean',
|
|
1241
|
+
value: true,
|
|
1242
|
+
},
|
|
1243
|
+
{
|
|
1244
|
+
label: 'select',
|
|
1245
|
+
key: 'select',
|
|
1246
|
+
type: 'select',
|
|
1247
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1248
|
+
value: 'val1',
|
|
1249
|
+
},
|
|
1250
|
+
];
|
|
1251
|
+
await nextTick();
|
|
1252
|
+
wrapper.vm.selectSavedFilter({
|
|
1253
|
+
id: 'saved',
|
|
1254
|
+
name: 'saved filter',
|
|
1255
|
+
route: 'route',
|
|
1256
|
+
filters: [
|
|
1257
|
+
{
|
|
1258
|
+
target: 'choice',
|
|
1259
|
+
value: 'toto',
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
target: 'checked',
|
|
1263
|
+
value: true,
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
target: 'select',
|
|
1267
|
+
value: 'val1',
|
|
1268
|
+
},
|
|
1269
|
+
],
|
|
1270
|
+
});
|
|
1271
|
+
await nextTick();
|
|
1272
|
+
expect(wrapper.vm.filters).toEqual([
|
|
1273
|
+
{
|
|
1274
|
+
label: 'input',
|
|
1275
|
+
key: 'choice',
|
|
1276
|
+
type: 'input',
|
|
1277
|
+
value: null,
|
|
1278
|
+
},
|
|
1279
|
+
{
|
|
1280
|
+
label: 'boolean',
|
|
1281
|
+
key: 'checked',
|
|
1282
|
+
type: 'boolean',
|
|
1283
|
+
value: null,
|
|
1284
|
+
},
|
|
1285
|
+
{
|
|
1286
|
+
label: 'select',
|
|
1287
|
+
key: 'select',
|
|
1288
|
+
type: 'select',
|
|
1289
|
+
selectOptions: [{ label: 'label', value: 'val1' }],
|
|
1290
|
+
value: null,
|
|
1291
|
+
},
|
|
1292
|
+
]);
|
|
1293
|
+
});
|
|
1294
|
+
});
|
|
1295
|
+
});
|
|
1296
|
+
});
|