@cnamts/synapse 1.0.0 → 1.0.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/dist/DateFilter-BmRuzQ9Z.js +98 -0
- package/dist/NumberFilter-CnIPDHqx.js +121 -0
- package/dist/PeriodFilter-CZwZ8CnQ.js +112 -0
- package/dist/SelectFilter-Cj-GW2Cc.js +97 -0
- package/dist/TextFilter-DTxZHJwX.js +114 -0
- package/dist/{components/BackBtn → common}/constants/ExpertiseLevelEnum.d.ts +3 -0
- package/dist/components/BackBtn/AccessibiliteItems.d.ts +1 -1
- package/dist/components/BackToTopBtn/AccessibiliteItems.d.ts +1 -1
- package/dist/components/ChipList/AccessibiliteItems.d.ts +1 -1
- package/dist/components/CollapsibleList/AccessibiliteItems.d.ts +1 -1
- package/dist/components/ContextualMenu/AccessibiliteItems.d.ts +1 -1
- package/dist/components/CookieBanner/AccessibiliteItems.d.ts +1 -1
- package/dist/components/CopyBtn/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Customs/SyBtnSelect/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Customs/SyInputSelect/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Customs/SySelect/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Customs/SyTextField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/DataList/AccessibiliteItems.d.ts +1 -1
- package/dist/components/DataListGroup/AccessibiliteItems.d.ts +1 -1
- package/dist/components/DatePicker/AccessibiliteItems.d.ts +1 -1
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +4162 -0
- package/dist/components/DatePicker/{DatePicker.d.ts → DatePicker/DatePicker.d.ts} +142 -102
- package/dist/components/DatePicker/{DateTextInput.d.ts → DateTextInput/DateTextInput.d.ts} +32 -26
- package/dist/components/DatePicker/composables/index.d.ts +15 -0
- package/dist/components/DatePicker/composables/useDateFormatValidation.d.ts +25 -0
- package/dist/components/DatePicker/composables/useDateInputEditing.d.ts +33 -0
- package/dist/components/DatePicker/composables/useDatePickerViewMode.d.ts +16 -0
- package/dist/components/DatePicker/composables/useDatePickerVisibility.d.ts +27 -0
- package/dist/components/DatePicker/composables/useDateRangeInput.d.ts +29 -0
- package/dist/components/DatePicker/composables/useDateRangeValidation.d.ts +11 -0
- package/dist/components/DatePicker/composables/useDateSelection.d.ts +10 -0
- package/dist/components/DatePicker/composables/useDateValidation.d.ts +35 -0
- package/dist/components/DatePicker/composables/useDisplayedDateString.d.ts +16 -0
- package/dist/components/DatePicker/composables/useIconState.d.ts +17 -0
- package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +30 -0
- package/dist/components/DatePicker/composables/useInputHandler.d.ts +32 -0
- package/dist/components/DatePicker/composables/useManualDateValidation.d.ts +33 -0
- package/dist/components/DatePicker/composables/useMonthButtonCustomization.d.ts +9 -0
- package/dist/components/DatePicker/composables/useTodayButton.d.ts +16 -0
- package/dist/components/DatePicker/composables/useWeekendDays.d.ts +11 -0
- package/dist/components/DatePicker/constants/messages.d.ts +29 -0
- package/dist/components/DatePicker/types.d.ts +13 -0
- package/dist/components/DialogBox/AccessibiliteItems.d.ts +1 -1
- package/dist/components/DownloadBtn/AccessibiliteItems.d.ts +1 -1
- package/dist/components/ErrorPage/AccessibiliteItems.d.ts +1 -1
- package/dist/components/ExternalLinks/AccessibiliteItems.d.ts +1 -1
- package/dist/components/FileList/AccessibiliteItems.d.ts +1 -1
- package/dist/components/FilePreview/AccessibiliteItems.d.ts +1 -1
- package/dist/components/FileUpload/AccessibiliteItems.d.ts +1 -1
- package/dist/components/FilterInline/AccessibiliteItems.d.ts +1 -1
- package/dist/components/FilterSideBar/AccessibiliteItems.d.ts +1 -1
- package/dist/components/FilterSideBar/FilterSideBar.d.ts +395 -1
- package/dist/components/FooterBar/AccessibiliteItems.d.ts +1 -1
- package/dist/components/FranceConnectBtn/AccessibiliteItems.d.ts +1 -1
- package/dist/components/HeaderBar/AccessibiliteItems.d.ts +1 -1
- package/dist/components/HeaderBar/HeaderBurgerMenu/AccessibiliteItems.d.ts +1 -1
- package/dist/components/HeaderLoading/AccessibiliteItems.d.ts +1 -1
- package/dist/components/HeaderToolbar/AccessibiliteItems.d.ts +1 -1
- package/dist/components/LangBtn/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Logo/AccessibiliteItems.d.ts +1 -1
- package/dist/components/LogoBrandSection/AccessibiliteItems.d.ts +1 -1
- package/dist/components/MaintenancePage/AccessibiliteItems.d.ts +1 -1
- package/dist/components/NirField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/NotFoundPage/AccessibiliteItems.d.ts +1 -1
- package/dist/components/NotificationBar/AccessibiliteItems.d.ts +1 -1
- package/dist/components/PageContainer/AccessibiliteItems.d.ts +1 -1
- package/dist/components/PaginatedTable/AccessibiliteItems.d.ts +1 -1
- package/dist/components/PasswordField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/PeriodField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/PeriodField/PeriodField.d.ts +171 -37
- package/dist/components/PhoneField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/RangeField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/RatingPicker/AccessibiliteItems.d.ts +1 -1
- package/dist/components/SearchListField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/SelectBtnField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/SkipLink/AccessibiliteItems.d.ts +1 -1
- package/dist/components/SocialMediaLinks/AccessibiliteItems.d.ts +1 -1
- package/dist/components/SubHeader/AccessibiliteItems.d.ts +1 -1
- package/dist/components/SyAlert/AccessibiliteItems.d.ts +1 -1
- package/dist/components/TableToolbar/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +647 -0
- package/dist/components/Tables/SyTable/SyTable.d.ts +666 -0
- package/dist/components/Tables/common/SyTableFilter.d.ts +126 -0
- package/dist/components/Tables/common/TableHeader.d.ts +33 -0
- package/dist/components/Tables/common/constants/StateEnum.d.ts +6 -0
- package/dist/components/Tables/common/filters/DateFilter.d.ts +121 -0
- package/dist/components/Tables/common/filters/NumberFilter.d.ts +132 -0
- package/dist/components/Tables/common/filters/PeriodFilter.d.ts +135 -0
- package/dist/components/Tables/common/filters/SelectFilter.d.ts +120 -0
- package/dist/components/Tables/common/filters/TextFilter.d.ts +132 -0
- package/dist/components/Tables/common/formatters.d.ts +17 -0
- package/dist/components/Tables/common/locales.d.ts +7 -0
- package/dist/components/Tables/common/tableAccessibilityUtils.d.ts +8 -0
- package/dist/components/Tables/common/tableFilterUtils.d.ts +2 -0
- package/dist/components/Tables/common/tableStorageUtils.d.ts +29 -0
- package/dist/components/Tables/common/tableUtils.d.ts +42 -0
- package/dist/components/Tables/common/types.d.ts +80 -0
- package/dist/components/Tables/common/useTableFilter.d.ts +9 -0
- package/dist/components/Tables/index.d.ts +2 -0
- package/dist/components/UploadWorkflow/AccessibiliteItems.d.ts +1 -1
- package/dist/components/UserMenuBtn/AccessibiliteItems.d.ts +1 -1
- package/dist/components/index.d.ts +3 -1
- package/dist/design-system-v3.js +100 -11944
- package/dist/design-system-v3.umd.cjs +22 -4
- package/dist/designTokens/index.d.ts +3 -1
- package/dist/designTokens/tokens/cnam/cnamFonts.d.ts +140 -0
- package/dist/designTokens/tokens/pa/paFonts.d.ts +140 -0
- package/dist/designTokens/utils/createFontVariables.d.ts +39 -0
- package/dist/designTokens/utils/index.d.ts +2 -1
- package/dist/main-WDqeoGM-.js +14788 -0
- package/dist/style.css +1 -1
- package/dist/utils/rules/isRequired/index.d.ts +1 -1
- package/dist/vite-env.d.ts +12 -0
- package/package.json +3 -3
- package/src/assets/_spacers.scss +37 -1
- package/src/assets/_typography.scss +158 -0
- package/src/assets/settings.scss +7 -0
- package/src/common/constants/ExpertiseLevelEnum.ts +7 -0
- package/src/components/BackBtn/AccessibiliteItems.ts +1 -1
- package/src/components/BackToTopBtn/AccessibiliteItems.ts +1 -1
- package/src/components/ChipList/AccessibiliteItems.ts +1 -1
- package/src/components/CollapsibleList/AccessibiliteItems.ts +1 -1
- package/src/components/ContextualMenu/AccessibiliteItems.ts +1 -1
- package/src/components/CookieBanner/AccessibiliteItems.ts +1 -1
- package/src/components/CopyBtn/AccessibiliteItems.ts +1 -1
- package/src/components/Customs/SyBtnSelect/AccessibiliteItems.ts +1 -1
- package/src/components/Customs/SyInputSelect/AccessibiliteItems.ts +1 -1
- package/src/components/Customs/SySelect/AccessibiliteItems.ts +1 -1
- package/src/components/Customs/SySelect/SySelect.vue +3 -9
- package/src/components/Customs/SySelect/tests/SySelect.spec.ts +4 -2
- package/src/components/Customs/SyTextField/AccessibiliteItems.ts +1 -1
- package/src/components/DataList/AccessibiliteItems.ts +1 -1
- package/src/components/DataListGroup/AccessibiliteItems.ts +1 -1
- package/src/components/DatePicker/AccessibiliteItems.ts +1 -1
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.mdx +212 -0
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +1097 -0
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +497 -180
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +941 -0
- package/src/components/DatePicker/DatePicker/DatePicker.mdx +176 -0
- package/src/components/DatePicker/{tests → DatePicker}/DatePicker.spec.ts +1 -1
- package/src/components/DatePicker/{DatePicker.stories.ts → DatePicker/DatePicker.stories.ts} +115 -400
- package/src/components/DatePicker/{DatePicker.vue → DatePicker/DatePicker.vue} +302 -84
- package/src/components/DatePicker/DatePickerOverview.mdx +227 -0
- package/src/components/DatePicker/{DatePickerValidation.mdx → DatePickerValidationExample/DatePickerValidation.mdx} +3 -3
- package/src/components/DatePicker/{DatePickerValidation.stories.ts → DatePickerValidationExample/DatePickerValidation.stories.ts} +2 -2
- package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +310 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +278 -0
- package/src/components/DatePicker/{tests → DateTextInput}/DateTextInput.spec.ts +8 -7
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +916 -0
- package/src/components/DatePicker/DateTextInput/NoCalendar.mdx +64 -0
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +572 -0
- package/src/components/DatePicker/composables/index.ts +22 -0
- package/src/components/DatePicker/composables/tests/useDateFormatValidation.spec.ts +165 -0
- package/src/components/DatePicker/composables/tests/useDateInputEditing.spec.ts +359 -0
- package/src/components/DatePicker/composables/tests/useDatePickerViewMode.spec.ts +160 -0
- package/src/components/DatePicker/composables/tests/useDatePickerVisibility.spec.ts +339 -0
- package/src/components/DatePicker/composables/tests/useDateRangeInput.spec.ts +277 -0
- package/src/components/DatePicker/composables/tests/useDateRangeValidation.spec.ts +107 -0
- package/src/components/DatePicker/composables/tests/useDateSelection.spec.ts +171 -0
- package/src/components/DatePicker/composables/tests/useDateValidation.spec.ts +245 -0
- package/src/components/DatePicker/composables/tests/useDisplayedDateString.spec.ts +98 -0
- package/src/components/DatePicker/composables/tests/useIconState.spec.ts +130 -0
- package/src/components/DatePicker/composables/tests/useInputBlurHandler.spec.ts +278 -0
- package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +233 -0
- package/src/components/DatePicker/composables/tests/useMonthButtonCustomization.spec.ts +100 -0
- package/src/components/DatePicker/composables/tests/useTodayButton.spec.ts +97 -0
- package/src/components/DatePicker/composables/tests/useWeekendDays.spec.ts +28 -0
- package/src/components/DatePicker/composables/useDateFormatValidation.ts +95 -0
- package/src/components/DatePicker/composables/useDateInputEditing.ts +326 -0
- package/src/components/DatePicker/composables/useDatePickerViewMode.ts +61 -0
- package/src/components/DatePicker/composables/useDatePickerVisibility.ts +146 -0
- package/src/components/DatePicker/composables/useDateRangeInput.ts +375 -0
- package/src/components/DatePicker/composables/useDateRangeValidation.ts +48 -0
- package/src/components/DatePicker/composables/useDateSelection.ts +121 -0
- package/src/components/DatePicker/composables/useDateValidation.ts +225 -0
- package/src/components/DatePicker/composables/useDisplayedDateString.ts +58 -0
- package/src/components/DatePicker/composables/useIconState.ts +53 -0
- package/src/components/DatePicker/composables/useInputBlurHandler.ts +101 -0
- package/src/components/DatePicker/composables/useInputHandler.ts +436 -0
- package/src/components/DatePicker/composables/useManualDateValidation.ts +161 -0
- package/src/components/DatePicker/composables/useMonthButtonCustomization.ts +89 -0
- package/src/components/DatePicker/composables/useTodayButton.ts +43 -0
- package/src/components/DatePicker/composables/useWeekendDays.ts +21 -0
- package/src/components/DatePicker/constants/messages.ts +50 -0
- package/src/components/DatePicker/docExamples/DatePickerBidirectionalValidation.vue +4 -4
- package/src/components/DatePicker/docExamples/DatePickerValidationExamples.vue +1 -1
- package/src/components/DatePicker/playground/ComplexDatePickerPlayground.vue +172 -0
- package/src/components/DatePicker/types.ts +15 -0
- package/src/components/DialogBox/AccessibiliteItems.ts +1 -1
- package/src/components/DownloadBtn/AccessibiliteItems.ts +1 -1
- package/src/components/ErrorPage/AccessibiliteItems.ts +1 -1
- package/src/components/ExternalLinks/AccessibiliteItems.ts +1 -1
- package/src/components/FileList/AccessibiliteItems.ts +1 -1
- package/src/components/FilePreview/AccessibiliteItems.ts +1 -1
- package/src/components/FileUpload/AccessibiliteItems.ts +1 -1
- package/src/components/FilterInline/AccessibiliteItems.ts +1 -1
- package/src/components/FilterSideBar/AccessibiliteItems.ts +1 -1
- package/src/components/FilterSideBar/FilterSideBar.vue +108 -90
- package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +27 -0
- package/src/components/FilterSideBar/tests/__snapshots__/FilterSideBar.spec.ts.snap +114 -109
- package/src/components/FooterBar/AccessibiliteItems.ts +1 -1
- package/src/components/FooterBar/FooterBar.vue +2 -1
- package/src/components/FranceConnectBtn/AccessibiliteItems.ts +1 -1
- package/src/components/HeaderBar/AccessibiliteItems.ts +1 -1
- package/src/components/HeaderBar/HeaderBurgerMenu/AccessibiliteItems.ts +1 -1
- package/src/components/HeaderLoading/AccessibiliteItems.ts +1 -1
- package/src/components/HeaderToolbar/AccessibiliteItems.ts +1 -1
- package/src/components/LangBtn/AccessibiliteItems.ts +1 -1
- package/src/components/Logo/Accessibilite.stories.ts +4 -0
- package/src/components/Logo/AccessibiliteItems.ts +1 -1
- package/src/components/LogoBrandSection/AccessibiliteItems.ts +1 -1
- package/src/components/MaintenancePage/AccessibiliteItems.ts +1 -1
- package/src/components/NirField/AccessibiliteItems.ts +1 -1
- package/src/components/NotFoundPage/AccessibiliteItems.ts +1 -1
- package/src/components/NotificationBar/AccessibiliteItems.ts +1 -1
- package/src/components/PageContainer/AccessibiliteItems.ts +1 -1
- package/src/components/PaginatedTable/AccessibiliteItems.ts +1 -1
- package/src/components/PaginatedTable/PaginatedTable.stories.ts +19 -0
- package/src/components/PaginatedTable/PaginatedTable.vue +51 -13
- package/src/components/PaginatedTable/tests/PaginatedTable.spec.ts +0 -2
- package/src/components/PasswordField/AccessibiliteItems.ts +1 -1
- package/src/components/PeriodField/AccessibiliteItems.ts +1 -1
- package/src/components/PeriodField/PeriodField.vue +13 -1
- package/src/components/PhoneField/AccessibiliteItems.ts +1 -1
- package/src/components/RangeField/AccessibiliteItems.ts +1 -1
- package/src/components/RatingPicker/AccessibiliteItems.ts +1 -1
- package/src/components/SearchListField/AccessibiliteItems.ts +1 -1
- package/src/components/SelectBtnField/AccessibiliteItems.ts +1 -1
- package/src/components/SkipLink/AccessibiliteItems.ts +1 -1
- package/src/components/SocialMediaLinks/AccessibiliteItems.ts +1 -1
- package/src/components/SubHeader/AccessibiliteItems.ts +1 -1
- package/src/components/SyAlert/AccessibiliteItems.ts +1 -1
- package/src/components/TableToolbar/AccessibiliteItems.ts +1 -1
- package/src/components/TableToolbar/TableToolbar.stories.ts +110 -56
- package/src/components/Tables/SyServerTable/FilterRules.stories.ts +83 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +160 -0
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +2887 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +302 -0
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +450 -0
- package/src/components/Tables/SyServerTable/tests/__snapshots__/SyServerTable.spec.ts.snap +521 -0
- package/src/components/Tables/SyTable/FilterRules.stories.ts +235 -0
- package/src/components/Tables/SyTable/SyTable.mdx +129 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +1966 -0
- package/src/components/Tables/SyTable/SyTable.vue +317 -0
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +345 -0
- package/src/components/Tables/SyTable/tests/__snapshots__/SyTable.spec.ts.snap +521 -0
- package/src/components/Tables/common/SyTableFilter.vue +342 -0
- package/src/components/Tables/common/TableHeader.vue +221 -0
- package/src/components/Tables/common/constants/StateEnum.ts +6 -0
- package/src/components/Tables/common/filters/DateFilter.vue +140 -0
- package/src/components/Tables/common/filters/NumberFilter.vue +234 -0
- package/src/components/Tables/common/filters/PeriodFilter.vue +147 -0
- package/src/components/Tables/common/filters/SelectFilter.vue +126 -0
- package/src/components/Tables/common/filters/TextFilter.vue +191 -0
- package/src/components/Tables/common/filters/tests/DateFilter.spec.ts +187 -0
- package/src/components/Tables/common/filters/tests/NumberFilter.spec.ts +280 -0
- package/src/components/Tables/common/filters/tests/PeriodFilter.spec.ts +192 -0
- package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +219 -0
- package/src/components/Tables/common/filters/tests/TextFilter.spec.ts +260 -0
- package/src/components/Tables/common/formatters.ts +72 -0
- package/src/components/Tables/common/locales.ts +7 -0
- package/src/components/Tables/common/tableAccessibilityUtils.ts +61 -0
- package/src/components/Tables/common/tableFilterUtils.ts +327 -0
- package/src/components/Tables/common/tableStorageUtils.ts +102 -0
- package/src/components/Tables/common/tableStyles.scss +54 -0
- package/src/components/Tables/common/tableUtils.ts +115 -0
- package/src/components/Tables/common/tests/SyTableFilter.spec.ts +312 -0
- package/src/components/Tables/common/tests/resize.spec.ts +161 -0
- package/src/components/Tables/common/tests/tableFilterUtils.spec.ts +106 -0
- package/src/components/Tables/common/tests/tableUtils.spec.ts +272 -0
- package/src/components/Tables/common/types.ts +81 -0
- package/src/components/Tables/common/useTableFilter.ts +19 -0
- package/src/components/Tables/index.ts +3 -0
- package/src/components/UploadWorkflow/AccessibiliteItems.ts +1 -1
- package/src/components/UserMenuBtn/AccessibiliteItems.ts +1 -1
- package/src/components/index.ts +3 -1
- package/src/composables/date/useDateFormatDayjs.ts +8 -3
- package/src/composables/date/useDateInitializationDayjs.ts +28 -36
- package/src/composables/rules/useFieldValidation.ts +1 -2
- package/src/designTokens/index.ts +4 -0
- package/src/designTokens/tokens/cnam/cnamFonts.ts +140 -0
- package/src/designTokens/tokens/pa/paFonts.ts +140 -0
- package/src/designTokens/utils/createFontVariables.ts +143 -0
- package/src/designTokens/utils/index.ts +2 -1
- package/src/stories/Demarrer/Accueil.stories.ts +12 -3
- package/src/utils/rules/isHolidayDay/IsHolidayDay.stories.ts +1 -1
- package/src/utils/rules/isRequired/index.ts +2 -1
- package/src/vite-env.d.ts +12 -0
- package/src/vuetifyConfig.ts +10 -3
- package/dist/components/BackToTopBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/ChipList/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/CollapsibleList/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/ContextualMenu/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/CookieBanner/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/CopyBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/Customs/SyBtnSelect/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/Customs/SyInputSelect/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/Customs/SySelect/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/Customs/SyTextField/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/DataList/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/DataListGroup/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/DatePicker/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/DialogBox/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/DownloadBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/ErrorPage/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/ExternalLinks/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/FileList/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/FilePreview/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/FileUpload/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/FilterInline/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/FilterSideBar/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/FooterBar/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/FranceConnectBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/HeaderBar/HeaderBurgerMenu/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/HeaderBar/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/HeaderLoading/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/HeaderToolbar/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/LangBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/Logo/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/LogoBrandSection/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/MaintenancePage/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/NirField/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/NotFoundPage/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/NotificationBar/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/PageContainer/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/PaginatedTable/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/PasswordField/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/PeriodField/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/PhoneField/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/RangeField/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/RatingPicker/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/SearchListField/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/SelectBtnField/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/SkipLink/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/SocialMediaLinks/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/SubHeader/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/SyAlert/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/TableToolbar/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/dist/components/UserMenuBtn/constants/ExpertiseLevelEnum.d.ts +0 -4
- package/src/components/BackBtn/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/BackToTopBtn/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/ChipList/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/CollapsibleList/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/ContextualMenu/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/CookieBanner/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/CopyBtn/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/Customs/SyBtnSelect/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/Customs/SyInputSelect/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/Customs/SySelect/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/Customs/SyTextField/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/DataList/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/DataListGroup/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/DatePicker/DatePicker.mdx +0 -222
- package/src/components/DatePicker/DateTextInput.vue +0 -504
- package/src/components/DatePicker/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/DialogBox/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/DownloadBtn/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/ErrorPage/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/ExternalLinks/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/FileList/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/FilePreview/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/FileUpload/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/FilterInline/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/FilterSideBar/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/FooterBar/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/FranceConnectBtn/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/HeaderBar/HeaderBurgerMenu/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/HeaderBar/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/HeaderLoading/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/HeaderToolbar/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/LangBtn/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/Logo/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/LogoBrandSection/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/MaintenancePage/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/NirField/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/NotFoundPage/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/NotificationBar/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/PageContainer/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/PaginatedTable/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/PasswordField/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/PeriodField/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/PhoneField/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/RangeField/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/RatingPicker/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/SearchListField/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/SelectBtnField/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/SkipLink/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/SocialMediaLinks/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/SubHeader/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/SyAlert/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/TableToolbar/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +0 -4
- package/src/components/UserMenuBtn/constants/ExpertiseLevelEnum.ts +0 -4
- /package/src/components/DatePicker/{examples → playground}/DatePickerHolidayRule.vue +0 -0
|
@@ -0,0 +1,342 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { ref, watch, provide, defineAsyncComponent, markRaw, shallowRef, computed } from 'vue'
|
|
3
|
+
import type { FilterOption, TableColumnHeader } from './types'
|
|
4
|
+
import { filterItems } from './tableFilterUtils'
|
|
5
|
+
import type { DateValue } from '@/composables/date/useDateInitializationDayjs'
|
|
6
|
+
|
|
7
|
+
// Utilisation de shallowRef pour stocker les composants chargés dynamiquement
|
|
8
|
+
const loadedComponents = shallowRef<Record<string, unknown>>({})
|
|
9
|
+
|
|
10
|
+
// Fonction pour charger et récupérer un composant de filtre à la demande
|
|
11
|
+
function getFilterComponent(filterType?: string, filterOptions?: unknown) {
|
|
12
|
+
// Déterminer le type de composant à charger
|
|
13
|
+
let componentType = 'text'
|
|
14
|
+
|
|
15
|
+
if (filterType === 'select' || filterOptions) {
|
|
16
|
+
componentType = 'select'
|
|
17
|
+
}
|
|
18
|
+
else if (filterType === 'date') {
|
|
19
|
+
componentType = 'date'
|
|
20
|
+
}
|
|
21
|
+
else if (filterType === 'period') {
|
|
22
|
+
componentType = 'period'
|
|
23
|
+
}
|
|
24
|
+
else if (filterType === 'number') {
|
|
25
|
+
componentType = 'number'
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// Si le composant est déjà chargé, le retourner
|
|
29
|
+
if (loadedComponents.value[componentType]) {
|
|
30
|
+
return loadedComponents.value[componentType]
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Sinon, charger le composant de manière asynchrone
|
|
34
|
+
let asyncComponent
|
|
35
|
+
switch (componentType) {
|
|
36
|
+
case 'select':
|
|
37
|
+
asyncComponent = markRaw(defineAsyncComponent(() => import('./filters/SelectFilter.vue')))
|
|
38
|
+
Object.defineProperty(asyncComponent, 'name', { value: 'SelectFilter' })
|
|
39
|
+
break
|
|
40
|
+
case 'date':
|
|
41
|
+
asyncComponent = markRaw(defineAsyncComponent(() => import('./filters/DateFilter.vue')))
|
|
42
|
+
Object.defineProperty(asyncComponent, 'name', { value: 'DateFilter' })
|
|
43
|
+
break
|
|
44
|
+
case 'period':
|
|
45
|
+
asyncComponent = markRaw(defineAsyncComponent(() => import('./filters/PeriodFilter.vue')))
|
|
46
|
+
Object.defineProperty(asyncComponent, 'name', { value: 'PeriodFilter' })
|
|
47
|
+
break
|
|
48
|
+
case 'number':
|
|
49
|
+
asyncComponent = markRaw(defineAsyncComponent(() => import('./filters/NumberFilter.vue')))
|
|
50
|
+
Object.defineProperty(asyncComponent, 'name', { value: 'NumberFilter' })
|
|
51
|
+
break
|
|
52
|
+
default:
|
|
53
|
+
asyncComponent = markRaw(defineAsyncComponent(() => import('./filters/TextFilter.vue')))
|
|
54
|
+
Object.defineProperty(asyncComponent, 'name', { value: 'TextFilter' })
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
// Stocker le composant pour éviter de le recharger
|
|
58
|
+
loadedComponents.value[componentType] = asyncComponent
|
|
59
|
+
return asyncComponent
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const props = defineProps({
|
|
63
|
+
header: {
|
|
64
|
+
type: Object as () => TableColumnHeader,
|
|
65
|
+
required: true,
|
|
66
|
+
},
|
|
67
|
+
// Propriété pour déterminer si le filtre doit être affiché
|
|
68
|
+
filterable: {
|
|
69
|
+
type: Boolean,
|
|
70
|
+
default: true,
|
|
71
|
+
},
|
|
72
|
+
filters: {
|
|
73
|
+
type: Array as () => FilterOption[],
|
|
74
|
+
default: () => [],
|
|
75
|
+
},
|
|
76
|
+
// Propriétés customisables des champs de saisie
|
|
77
|
+
inputConfig: {
|
|
78
|
+
type: Object as () => {
|
|
79
|
+
disableErrorHandling?: boolean
|
|
80
|
+
variant?: string
|
|
81
|
+
hideDetails?: boolean
|
|
82
|
+
density?: 'default' | 'comfortable' | 'compact'
|
|
83
|
+
clearable?: boolean
|
|
84
|
+
},
|
|
85
|
+
default: () => ({}),
|
|
86
|
+
},
|
|
87
|
+
// Propriétés de configuration des champs de saisie
|
|
88
|
+
disableErrorHandling: {
|
|
89
|
+
type: Boolean,
|
|
90
|
+
default: true,
|
|
91
|
+
},
|
|
92
|
+
variant: {
|
|
93
|
+
type: String,
|
|
94
|
+
default: 'outlined',
|
|
95
|
+
},
|
|
96
|
+
hideDetails: {
|
|
97
|
+
type: Boolean,
|
|
98
|
+
default: true,
|
|
99
|
+
},
|
|
100
|
+
density: {
|
|
101
|
+
type: String as () => 'default' | 'comfortable' | 'compact',
|
|
102
|
+
default: 'compact',
|
|
103
|
+
},
|
|
104
|
+
clearable: {
|
|
105
|
+
type: Boolean,
|
|
106
|
+
default: true,
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
const emit = defineEmits(['update:filters'])
|
|
111
|
+
|
|
112
|
+
// Utilisation d'un seul ref pour stocker tous les filtres, organisés par type
|
|
113
|
+
const filtersMap = ref<{
|
|
114
|
+
text: Record<string, string>
|
|
115
|
+
number: Record<string, number>
|
|
116
|
+
date: Record<string, DateValue>
|
|
117
|
+
period: Record<string, { from: string | null, to: string | null }>
|
|
118
|
+
select: Record<string, string | number | Record<string, unknown> | undefined>
|
|
119
|
+
}>({
|
|
120
|
+
text: {},
|
|
121
|
+
number: {},
|
|
122
|
+
date: {},
|
|
123
|
+
period: {},
|
|
124
|
+
select: {},
|
|
125
|
+
})
|
|
126
|
+
|
|
127
|
+
// Computed properties pour accéder aux différents types de filtres
|
|
128
|
+
const textFilters = computed(() => filtersMap.value.text)
|
|
129
|
+
const numberFilters = computed(() => filtersMap.value.number)
|
|
130
|
+
const dateFilters = computed(() => filtersMap.value.date)
|
|
131
|
+
const periodFilters = computed(() => filtersMap.value.period)
|
|
132
|
+
const selectFilters = computed(() => filtersMap.value.select)
|
|
133
|
+
|
|
134
|
+
// Fonction pour traiter un filtre individuel
|
|
135
|
+
function processFilter(filter: FilterOption) {
|
|
136
|
+
const key = filter.key
|
|
137
|
+
const value = filter.value
|
|
138
|
+
|
|
139
|
+
switch (filter.type) {
|
|
140
|
+
case 'text':
|
|
141
|
+
filtersMap.value.text[key] = value as string
|
|
142
|
+
break
|
|
143
|
+
case 'number':
|
|
144
|
+
filtersMap.value.number[key] = value as number
|
|
145
|
+
break
|
|
146
|
+
case 'date':
|
|
147
|
+
filtersMap.value.date[key] = value as DateValue
|
|
148
|
+
break
|
|
149
|
+
case 'period':
|
|
150
|
+
if (value && typeof value === 'object' && 'from' in value && 'to' in value) {
|
|
151
|
+
const periodValue = value as { from: Date | string | null, to: Date | string | null }
|
|
152
|
+
|
|
153
|
+
const from = periodValue.from instanceof Date
|
|
154
|
+
? periodValue.from.toLocaleDateString('fr-FR')
|
|
155
|
+
: periodValue.from
|
|
156
|
+
|
|
157
|
+
const to = periodValue.to instanceof Date
|
|
158
|
+
? periodValue.to.toLocaleDateString('fr-FR')
|
|
159
|
+
: periodValue.to
|
|
160
|
+
|
|
161
|
+
filtersMap.value.period[key] = { from, to }
|
|
162
|
+
}
|
|
163
|
+
break
|
|
164
|
+
case 'select':
|
|
165
|
+
filtersMap.value.select[key] = value !== null ? value as string | number | Record<string, unknown> : undefined
|
|
166
|
+
break
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
// Initialise les filtres à partir des props, sans deep watching
|
|
171
|
+
watch(() => props.filters, (newFilters) => {
|
|
172
|
+
// Efface tous les filtres si le tableau de filtres est vide
|
|
173
|
+
if (newFilters.length === 0) {
|
|
174
|
+
filtersMap.value = {
|
|
175
|
+
text: {},
|
|
176
|
+
number: {},
|
|
177
|
+
date: {},
|
|
178
|
+
period: {},
|
|
179
|
+
select: {},
|
|
180
|
+
}
|
|
181
|
+
return
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
// Traiter uniquement les filtres qui ont changé
|
|
185
|
+
newFilters.forEach(processFilter)
|
|
186
|
+
}, { immediate: true })
|
|
187
|
+
|
|
188
|
+
// Expose la fonction de filtrage via le modèle provide/inject
|
|
189
|
+
provide('filterItems', filterItems)
|
|
190
|
+
|
|
191
|
+
// Exporte la fonction filterItems pour l'importation directe
|
|
192
|
+
defineExpose({ filterItems })
|
|
193
|
+
|
|
194
|
+
// Fonction pour mettre à jour les filtres (utilisée par les composants enfants)
|
|
195
|
+
function updateFilters(newFilters: FilterOption[]) {
|
|
196
|
+
emit('update:filters', newFilters)
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// Fonction pour obtenir la valeur du filtre en fonction du type de filtre
|
|
200
|
+
function getFilterValue(header: TableColumnHeader) {
|
|
201
|
+
const key = String(header.key || header.value || '')
|
|
202
|
+
|
|
203
|
+
if (header.filterType === 'select' || header.filterOptions) {
|
|
204
|
+
return selectFilters.value[key]
|
|
205
|
+
}
|
|
206
|
+
else if (header.filterType === 'date') {
|
|
207
|
+
return dateFilters.value[key]
|
|
208
|
+
}
|
|
209
|
+
else if (header.filterType === 'period') {
|
|
210
|
+
return periodFilters.value[key] || { from: null, to: null }
|
|
211
|
+
}
|
|
212
|
+
else if (header.filterType === 'number') {
|
|
213
|
+
return numberFilters.value[key]
|
|
214
|
+
}
|
|
215
|
+
else {
|
|
216
|
+
return textFilters.value[key]
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
// Fonction pour mettre à jour un filtre spécifique
|
|
221
|
+
function updateFilter(header: TableColumnHeader, value: unknown) {
|
|
222
|
+
const key = String(header.key || header.value || '')
|
|
223
|
+
|
|
224
|
+
if (header.filterType === 'select' || header.filterOptions) {
|
|
225
|
+
filtersMap.value.select[key] = value as string | number | Record<string, unknown> | undefined
|
|
226
|
+
}
|
|
227
|
+
else if (header.filterType === 'date') {
|
|
228
|
+
filtersMap.value.date[key] = value as DateValue
|
|
229
|
+
}
|
|
230
|
+
else if (header.filterType === 'period') {
|
|
231
|
+
filtersMap.value.period[key] = value as { from: string | null, to: string | null }
|
|
232
|
+
}
|
|
233
|
+
else if (header.filterType === 'number') {
|
|
234
|
+
filtersMap.value.number[key] = value as number
|
|
235
|
+
}
|
|
236
|
+
else if (header.filterType === 'custom') {
|
|
237
|
+
// Pour les filtres personnalisés, nous stockons la valeur dans selectFilters
|
|
238
|
+
// car ils fonctionnent généralement comme des sélecteurs
|
|
239
|
+
filtersMap.value.select[key] = value as string | number | Record<string, unknown> | undefined
|
|
240
|
+
}
|
|
241
|
+
else {
|
|
242
|
+
filtersMap.value.text[key] = value as string
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
// Créer un tableau de FilterOption à partir des données des filtres
|
|
246
|
+
const newFilters: FilterOption[] = []
|
|
247
|
+
|
|
248
|
+
// Ajouter les filtres de texte
|
|
249
|
+
Object.entries(filtersMap.value.text).forEach(([filterKey, filterValue]) => {
|
|
250
|
+
if (filterValue !== undefined && filterValue !== '') {
|
|
251
|
+
newFilters.push({ key: filterKey, value: filterValue, type: 'text' })
|
|
252
|
+
}
|
|
253
|
+
})
|
|
254
|
+
|
|
255
|
+
// Ajouter les filtres numériques
|
|
256
|
+
Object.entries(filtersMap.value.number).forEach(([filterKey, filterValue]) => {
|
|
257
|
+
if (filterValue !== undefined && filterValue !== null) {
|
|
258
|
+
newFilters.push({ key: filterKey, value: filterValue, type: 'number' })
|
|
259
|
+
}
|
|
260
|
+
})
|
|
261
|
+
|
|
262
|
+
// Ajouter les filtres de date
|
|
263
|
+
Object.entries(filtersMap.value.date).forEach(([filterKey, filterValue]) => {
|
|
264
|
+
if (filterValue !== undefined && filterValue !== null) {
|
|
265
|
+
newFilters.push({ key: filterKey, value: filterValue, type: 'date' })
|
|
266
|
+
}
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
// Ajouter les filtres de période
|
|
270
|
+
Object.entries(filtersMap.value.period).forEach(([filterKey, filterValue]) => {
|
|
271
|
+
if (filterValue && (filterValue.from || filterValue.to)) {
|
|
272
|
+
newFilters.push({ key: filterKey, value: filterValue, type: 'period' })
|
|
273
|
+
}
|
|
274
|
+
})
|
|
275
|
+
|
|
276
|
+
// Ajouter les filtres de sélection et personnalisés
|
|
277
|
+
Object.entries(filtersMap.value.select).forEach(([filterKey, filterValue]) => {
|
|
278
|
+
if (filterValue !== undefined && filterValue !== null) {
|
|
279
|
+
// Déterminer si c'est un filtre personnalisé en vérifiant les en-têtes
|
|
280
|
+
const matchingHeader = props.header.key === filterKey || props.header.value === filterKey
|
|
281
|
+
const filterType = matchingHeader && props.header.filterType === 'custom' ? 'custom' : 'select'
|
|
282
|
+
newFilters.push({ key: filterKey, value: filterValue, type: filterType })
|
|
283
|
+
}
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
updateFilters(newFilters)
|
|
287
|
+
}
|
|
288
|
+
</script>
|
|
289
|
+
|
|
290
|
+
<template>
|
|
291
|
+
<div
|
|
292
|
+
v-if="props.filterable"
|
|
293
|
+
class="sy-table-filter"
|
|
294
|
+
>
|
|
295
|
+
<div class="sy-table-filter-item">
|
|
296
|
+
<!-- Utilise le slot personnalisé si filterType est 'custom', sinon utilise le composant dynamique -->
|
|
297
|
+
<template v-if="props.header.filterType === 'custom'">
|
|
298
|
+
<slot
|
|
299
|
+
name="custom-filter"
|
|
300
|
+
:header="props.header"
|
|
301
|
+
:value="getFilterValue(props.header)"
|
|
302
|
+
:update-filter="(value) => updateFilter(props.header, value)"
|
|
303
|
+
>
|
|
304
|
+
<!-- Contenu par défaut si aucun slot n'est fourni -->
|
|
305
|
+
<div class="custom-filter-placeholder">
|
|
306
|
+
Filtre personnalisé
|
|
307
|
+
</div>
|
|
308
|
+
</slot>
|
|
309
|
+
</template>
|
|
310
|
+
<component
|
|
311
|
+
:is="getFilterComponent(props.header.filterType, props.header.filterOptions)"
|
|
312
|
+
v-else
|
|
313
|
+
:header="props.header"
|
|
314
|
+
:filters="props.filters"
|
|
315
|
+
:filter-value="getFilterValue(props.header)"
|
|
316
|
+
:input-config="props.inputConfig"
|
|
317
|
+
:disable-error-handling="props.disableErrorHandling"
|
|
318
|
+
:variant="props.variant"
|
|
319
|
+
:hide-details="props.hideDetails"
|
|
320
|
+
:density="props.density"
|
|
321
|
+
:clearable="props.clearable"
|
|
322
|
+
@update:filters="updateFilters"
|
|
323
|
+
/>
|
|
324
|
+
</div>
|
|
325
|
+
</div>
|
|
326
|
+
</template>
|
|
327
|
+
|
|
328
|
+
<style lang="scss" scoped>
|
|
329
|
+
.sy-table-filter {
|
|
330
|
+
display: flex;
|
|
331
|
+
flex-wrap: wrap;
|
|
332
|
+
gap: 16px;
|
|
333
|
+
padding: 16px 0;
|
|
334
|
+
background-color: var(--v-theme-surface);
|
|
335
|
+
border-bottom: 1px solid var(--v-border-color);
|
|
336
|
+
|
|
337
|
+
&-item {
|
|
338
|
+
min-width: 200px;
|
|
339
|
+
flex: 1;
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
</style>
|
|
@@ -0,0 +1,221 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed, nextTick, onMounted, ref, inject, watch, type Ref } from 'vue'
|
|
3
|
+
import type { VDataTable, VDataTableServer } from 'vuetify/components'
|
|
4
|
+
import { locales } from './locales'
|
|
5
|
+
|
|
6
|
+
// Define a type for our column structure
|
|
7
|
+
type TableColumn = {
|
|
8
|
+
key: string | null
|
|
9
|
+
title?: string
|
|
10
|
+
value: unknown
|
|
11
|
+
sortable: boolean
|
|
12
|
+
rowspan?: number
|
|
13
|
+
colspan?: number
|
|
14
|
+
width?: number | string
|
|
15
|
+
sortBy?: string
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// Define a type for the header parameters
|
|
19
|
+
interface TableData {
|
|
20
|
+
columns: TableColumn[]
|
|
21
|
+
sortBy?: unknown
|
|
22
|
+
someSelected?: boolean
|
|
23
|
+
allSelected?: boolean
|
|
24
|
+
getSortIcon: (column: unknown) => string | undefined
|
|
25
|
+
toggleSort: (column: unknown) => void
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const props = withDefaults(defineProps<{
|
|
29
|
+
column: TableColumn
|
|
30
|
+
headerParams: TableData
|
|
31
|
+
table: VDataTable | VDataTableServer | null | undefined
|
|
32
|
+
resizableColumns?: boolean
|
|
33
|
+
storageKey?: string
|
|
34
|
+
}>(), {
|
|
35
|
+
resizableColumns: false,
|
|
36
|
+
storageKey: undefined,
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
const header = computed(() => {
|
|
40
|
+
return props.headerParams.columns.find(header => header.key === props.column.key)
|
|
41
|
+
})
|
|
42
|
+
|
|
43
|
+
const isLastColumn = computed(() => {
|
|
44
|
+
const columnIndex = props.headerParams.columns.findIndex(header => header.key === props.column.key)
|
|
45
|
+
return columnIndex === props.headerParams.columns.length - 1
|
|
46
|
+
})
|
|
47
|
+
|
|
48
|
+
const wrapper = ref<HTMLElement | null>(null)
|
|
49
|
+
|
|
50
|
+
const initialWidth = ref<number | null>(null)
|
|
51
|
+
|
|
52
|
+
// Inject stored column widths if available
|
|
53
|
+
const storedColumnWidths = inject<Ref<Record<string, number | string>>>('columnWidths', ref({}))
|
|
54
|
+
|
|
55
|
+
onMounted(() => {
|
|
56
|
+
nextTick(() => {
|
|
57
|
+
if (wrapper.value) {
|
|
58
|
+
initialWidth.value = wrapper.value.offsetWidth
|
|
59
|
+
|
|
60
|
+
// Apply stored width if available for this column
|
|
61
|
+
if (header.value?.key && storedColumnWidths?.value?.[header.value.key]) {
|
|
62
|
+
header.value.width = storedColumnWidths.value[header.value.key]
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
})
|
|
66
|
+
})
|
|
67
|
+
|
|
68
|
+
// Re-apply column width on header changes (ex when table re-renders due to pagination)
|
|
69
|
+
watch(
|
|
70
|
+
() => props.column,
|
|
71
|
+
() => {
|
|
72
|
+
nextTick(() => {
|
|
73
|
+
if (header.value?.key && storedColumnWidths?.value?.[header.value.key]) {
|
|
74
|
+
header.value.width = storedColumnWidths.value[header.value.key]
|
|
75
|
+
}
|
|
76
|
+
})
|
|
77
|
+
},
|
|
78
|
+
{ immediate: true },
|
|
79
|
+
)
|
|
80
|
+
|
|
81
|
+
// Watch for changes to column widths and apply them
|
|
82
|
+
watch(
|
|
83
|
+
() => storedColumnWidths?.value,
|
|
84
|
+
(newWidths) => {
|
|
85
|
+
if (newWidths && header.value?.key && newWidths[header.value.key]) {
|
|
86
|
+
header.value.width = newWidths[header.value.key]
|
|
87
|
+
}
|
|
88
|
+
},
|
|
89
|
+
{ deep: true },
|
|
90
|
+
)
|
|
91
|
+
|
|
92
|
+
const updateColumnWidth = inject<(key: string, width: number | string) => void>('updateColumnWidth', () => {})
|
|
93
|
+
|
|
94
|
+
function resetColumnWidth() {
|
|
95
|
+
if (header.value && initialWidth.value) {
|
|
96
|
+
header.value.width = initialWidth.value
|
|
97
|
+
|
|
98
|
+
// Save the reset width to localStorage if column key exists
|
|
99
|
+
if (header.value.key) {
|
|
100
|
+
updateColumnWidth(header.value.key, initialWidth.value)
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
function startResize(event: MouseEvent) {
|
|
106
|
+
const startX = event.clientX
|
|
107
|
+
const startWidth = wrapper.value!.offsetWidth + 24 + 1 / 2 * 16
|
|
108
|
+
|
|
109
|
+
function onMouseMove(e: MouseEvent) {
|
|
110
|
+
const newWidth = Math.max(50, startWidth + (e.clientX - startX))
|
|
111
|
+
if (wrapper.value) {
|
|
112
|
+
header.value!.width = newWidth
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
function onMouseUp() {
|
|
117
|
+
document.removeEventListener('mousemove', onMouseMove)
|
|
118
|
+
document.removeEventListener('mouseup', onMouseUp)
|
|
119
|
+
|
|
120
|
+
// Save column width to localStorage if column key exists
|
|
121
|
+
if (header.value?.key) {
|
|
122
|
+
updateColumnWidth(header.value.key, header.value.width || initialWidth.value || 0)
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
document.addEventListener('mousemove', onMouseMove)
|
|
127
|
+
document.addEventListener('mouseup', onMouseUp)
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
const tableWidth = ref(0)
|
|
131
|
+
onMounted(async () => {
|
|
132
|
+
await nextTick()
|
|
133
|
+
if (props.table) {
|
|
134
|
+
tableWidth.value = props.table.$el.offsetWidth
|
|
135
|
+
}
|
|
136
|
+
})
|
|
137
|
+
window.addEventListener('resize', () => {
|
|
138
|
+
if (props.table) {
|
|
139
|
+
tableWidth.value = props.table.$el.offsetWidth
|
|
140
|
+
}
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
function resizeKeyboardColumn(increment: number) {
|
|
144
|
+
const currentWidth = wrapper.value?.offsetWidth || 0
|
|
145
|
+
if (wrapper.value) {
|
|
146
|
+
const newWidth = Math.max(50, currentWidth + increment)
|
|
147
|
+
header.value!.width = newWidth
|
|
148
|
+
|
|
149
|
+
// Save column width to localStorage if column key exists
|
|
150
|
+
if (header.value?.key) {
|
|
151
|
+
updateColumnWidth(header.value.key, newWidth)
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
</script>
|
|
156
|
+
|
|
157
|
+
<template>
|
|
158
|
+
<div
|
|
159
|
+
ref="wrapper"
|
|
160
|
+
class="v-data-table-header__content d-flex align-center h-100"
|
|
161
|
+
>
|
|
162
|
+
<div class="col-title">
|
|
163
|
+
{{ column.title }}
|
|
164
|
+
</div>
|
|
165
|
+
<VIcon
|
|
166
|
+
v-if="header!.sortable"
|
|
167
|
+
class="v-data-table-header__sort-icon"
|
|
168
|
+
:class="`mr-2 ${column.sortBy ? 'text-primary' : ''}`"
|
|
169
|
+
:icon="headerParams.getSortIcon(column)"
|
|
170
|
+
:title="locales.columnOrder(column.title!)"
|
|
171
|
+
:aria-label="locales.columnOrder(column.title!)"
|
|
172
|
+
@click="headerParams.toggleSort(column)"
|
|
173
|
+
/>
|
|
174
|
+
<button
|
|
175
|
+
v-if="props.resizableColumns && !isLastColumn"
|
|
176
|
+
type="button"
|
|
177
|
+
class="resizer"
|
|
178
|
+
tabindex="0"
|
|
179
|
+
role="separator"
|
|
180
|
+
:aria-valuenow="(column.width as number)"
|
|
181
|
+
:aria-valuemin="0"
|
|
182
|
+
:aria-valuemax="tableWidth"
|
|
183
|
+
:aria-label="locales.ResizableColumn"
|
|
184
|
+
@mousedown="startResize"
|
|
185
|
+
@dblclick="resetColumnWidth"
|
|
186
|
+
@keydown.right.prevent="resizeKeyboardColumn(10)"
|
|
187
|
+
@keydown.left.prevent="resizeKeyboardColumn(-10)"
|
|
188
|
+
/>
|
|
189
|
+
</div>
|
|
190
|
+
</template>
|
|
191
|
+
|
|
192
|
+
<style lang="scss" scoped>
|
|
193
|
+
.resizer {
|
|
194
|
+
margin-left: auto;
|
|
195
|
+
flex: 0 0 auto;
|
|
196
|
+
cursor: col-resize;
|
|
197
|
+
background-color: #f0f0f0;
|
|
198
|
+
position: relative;
|
|
199
|
+
width: 1rem;
|
|
200
|
+
height: 100%;
|
|
201
|
+
left: calc(24px - 1rem / 2);
|
|
202
|
+
|
|
203
|
+
&::after {
|
|
204
|
+
content: '';
|
|
205
|
+
position: absolute;
|
|
206
|
+
top: 0;
|
|
207
|
+
left: 50%;
|
|
208
|
+
transform: translateX(-50%);
|
|
209
|
+
width: 0.1rem;
|
|
210
|
+
height: 100%;
|
|
211
|
+
background:
|
|
212
|
+
repeating-linear-gradient(
|
|
213
|
+
transparent,
|
|
214
|
+
#a7a7a7 0,
|
|
215
|
+
#a7a7a7 5px,
|
|
216
|
+
transparent 5px,
|
|
217
|
+
transparent 7px
|
|
218
|
+
);
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
</style>
|
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
<script setup lang="ts">
|
|
2
|
+
import { computed } from 'vue'
|
|
3
|
+
import type { FilterOption, TableColumnHeader } from '../types'
|
|
4
|
+
import DatePicker from '@/components/DatePicker/DatePicker/DatePicker.vue'
|
|
5
|
+
import type { DateValue } from '@/composables/date/useDateInitializationDayjs'
|
|
6
|
+
import { useDateFormat } from '@/composables/date/useDateFormatDayjs'
|
|
7
|
+
const { parseDate } = useDateFormat()
|
|
8
|
+
|
|
9
|
+
const props = defineProps({
|
|
10
|
+
header: {
|
|
11
|
+
type: Object as () => TableColumnHeader,
|
|
12
|
+
required: true,
|
|
13
|
+
},
|
|
14
|
+
filters: {
|
|
15
|
+
type: Array as () => FilterOption[],
|
|
16
|
+
default: () => [],
|
|
17
|
+
},
|
|
18
|
+
filterValue: {
|
|
19
|
+
type: [String, Date, Object, null] as unknown as () => DateValue,
|
|
20
|
+
default: null,
|
|
21
|
+
},
|
|
22
|
+
inputConfig: {
|
|
23
|
+
type: Object as () => {
|
|
24
|
+
disableErrorHandling?: boolean
|
|
25
|
+
variant?: string
|
|
26
|
+
hideDetails?: boolean
|
|
27
|
+
density?: 'default' | 'comfortable' | 'compact'
|
|
28
|
+
backgroundColor?: string
|
|
29
|
+
clearable?: boolean
|
|
30
|
+
},
|
|
31
|
+
default: () => ({}),
|
|
32
|
+
},
|
|
33
|
+
disableErrorHandling: {
|
|
34
|
+
type: Boolean,
|
|
35
|
+
default: false,
|
|
36
|
+
},
|
|
37
|
+
variant: {
|
|
38
|
+
type: String,
|
|
39
|
+
default: 'outlined',
|
|
40
|
+
},
|
|
41
|
+
hideDetails: {
|
|
42
|
+
type: Boolean,
|
|
43
|
+
default: true,
|
|
44
|
+
},
|
|
45
|
+
density: {
|
|
46
|
+
type: String as () => 'default' | 'comfortable' | 'compact',
|
|
47
|
+
default: 'compact',
|
|
48
|
+
},
|
|
49
|
+
backgroundColor: {
|
|
50
|
+
type: String,
|
|
51
|
+
default: 'white',
|
|
52
|
+
},
|
|
53
|
+
clearable: {
|
|
54
|
+
type: Boolean,
|
|
55
|
+
default: true,
|
|
56
|
+
},
|
|
57
|
+
})
|
|
58
|
+
|
|
59
|
+
const emit = defineEmits(['update:filters'])
|
|
60
|
+
|
|
61
|
+
// Fonction pour générer une clé unique à partir des propriétés du header
|
|
62
|
+
function generateUniqueKey() {
|
|
63
|
+
return String(props.header.key || props.header.value || (props.header.title ? `filter_${props.header.title}` : `filter_${Date.now()}`))
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
const modelValue = computed({
|
|
67
|
+
get: () => props.filterValue,
|
|
68
|
+
set: (val) => {
|
|
69
|
+
// Générer une clé unique en utilisant la fonction dédiée
|
|
70
|
+
const key = generateUniqueKey()
|
|
71
|
+
if (!key) return
|
|
72
|
+
|
|
73
|
+
if (val === null) {
|
|
74
|
+
// Effacer le filtre si la valeur est null
|
|
75
|
+
const newFilters = props.filters.filter(f => f.key !== key)
|
|
76
|
+
emit('update:filters', newFilters)
|
|
77
|
+
return
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
// Créer ou mettre à jour le filtre avec l'objet Date approprié
|
|
81
|
+
const existingFilterIndex = props.filters.findIndex(f => f.key === key)
|
|
82
|
+
const newFilters = [...props.filters]
|
|
83
|
+
|
|
84
|
+
// Convertir la chaîne en objet Date si nécessaire
|
|
85
|
+
let dateValue = val
|
|
86
|
+
if (typeof val === 'string' && val.trim() !== '') {
|
|
87
|
+
// Si la valeur est une chaîne formatée avec toLocaleDateString, la convertir en Date
|
|
88
|
+
const parsedDate = parseDate(val, props.header.dateFormat || 'DD/MM/YYYY')
|
|
89
|
+
if (parsedDate) {
|
|
90
|
+
// Pour les tests, on garde le format original de la chaîne
|
|
91
|
+
dateValue = val
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (existingFilterIndex >= 0) {
|
|
96
|
+
newFilters[existingFilterIndex].value = dateValue
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
newFilters.push({
|
|
100
|
+
key,
|
|
101
|
+
value: dateValue,
|
|
102
|
+
type: 'date',
|
|
103
|
+
})
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
emit('update:filters', newFilters)
|
|
107
|
+
},
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
// Gérer l'événement d'effacement
|
|
111
|
+
function handleClear() {
|
|
112
|
+
// Utiliser la fonction generateUniqueKey pour obtenir la clé
|
|
113
|
+
const key = generateUniqueKey()
|
|
114
|
+
const newFilters = props.filters.filter(f => f.key !== key)
|
|
115
|
+
emit('update:filters', newFilters)
|
|
116
|
+
}
|
|
117
|
+
</script>
|
|
118
|
+
|
|
119
|
+
<template>
|
|
120
|
+
<DatePicker
|
|
121
|
+
v-model="modelValue"
|
|
122
|
+
:label="header.title"
|
|
123
|
+
:clearable="inputConfig?.clearable ?? clearable"
|
|
124
|
+
:density="inputConfig?.density ?? density"
|
|
125
|
+
:hide-details="inputConfig?.hideDetails ?? hideDetails"
|
|
126
|
+
:hide-messages="header.hideMessages"
|
|
127
|
+
:variant="inputConfig?.variant ?? variant"
|
|
128
|
+
:disable-error-handling="inputConfig?.disableErrorHandling ?? disableErrorHandling"
|
|
129
|
+
:bg-color="inputConfig?.backgroundColor ?? backgroundColor"
|
|
130
|
+
:format="header.dateFormat"
|
|
131
|
+
class="filter-input"
|
|
132
|
+
@click:clear="handleClear"
|
|
133
|
+
/>
|
|
134
|
+
</template>
|
|
135
|
+
|
|
136
|
+
<style lang="scss" scoped>
|
|
137
|
+
.filter-input {
|
|
138
|
+
width: 100%;
|
|
139
|
+
}
|
|
140
|
+
</style>
|