@cnamts/synapse 1.0.0 → 1.0.2
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 +1 -1
- package/dist/DateFilter-YWOTbfeL.js +98 -0
- package/dist/NumberFilter-DMmMgALM.js +121 -0
- package/dist/PeriodFilter-Bok5BHcn.js +112 -0
- package/dist/SelectFilter-BKud2WhN.js +136 -0
- package/dist/TextFilter-DvMf2thH.js +114 -0
- package/dist/{components/BackBtn → common}/constants/ExpertiseLevelEnum.d.ts +3 -0
- package/dist/components/Accordion/Accordion.d.ts +2 -1
- package/dist/components/Accordion/composables/useAccordionGroupCommunication.d.ts +5 -0
- package/dist/components/Accordion/composables/useAccordionKeyboardNavigation.d.ts +12 -0
- package/dist/components/Accordion/composables/useAccordionState.d.ts +13 -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/SyCheckbox/SyCheckbox.d.ts +85 -0
- package/dist/components/Customs/SyInputSelect/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Customs/SyInputSelect/SyInputSelect.d.ts +2 -0
- package/dist/components/Customs/SySelect/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Customs/SySelect/SySelect.d.ts +33 -13
- package/dist/components/Customs/SyTextField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +2 -2
- 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 +4295 -0
- package/dist/components/DatePicker/{DatePicker.d.ts → DatePicker/DatePicker.d.ts} +158 -104
- package/dist/components/DatePicker/{DateTextInput.d.ts → DateTextInput/DateTextInput.d.ts} +35 -27
- package/dist/components/DatePicker/composables/index.d.ts +17 -0
- package/dist/components/DatePicker/composables/useAsteriskDisplay.d.ts +14 -0
- package/dist/components/DatePicker/composables/useDateAutoClamp.d.ts +16 -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 +19 -0
- package/dist/components/DatePicker/composables/useIconState.d.ts +17 -0
- package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +31 -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 +12 -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/NirField/NirField.d.ts +7 -3
- package/dist/components/NirField/nirValidation.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/PasswordField/PasswordField.d.ts +2 -0
- package/dist/components/PeriodField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/PeriodField/PeriodField.d.ts +219 -41
- package/dist/components/PhoneField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/PhoneField/PhoneField.d.ts +2 -2
- package/dist/components/RangeField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/RangeField/RangeField.d.ts +2 -0
- package/dist/components/RatingPicker/AccessibiliteItems.d.ts +1 -1
- package/dist/components/SearchListField/AccessibiliteItems.d.ts +1 -1
- package/dist/components/SearchListField/SearchListField.d.ts +9 -0
- 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/SyTextArea/SyTextArea.d.ts +2 -0
- package/dist/components/TableToolbar/AccessibiliteItems.d.ts +1 -1
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +652 -0
- package/dist/components/Tables/SyTable/SyTable.d.ts +671 -0
- package/dist/components/Tables/common/SyTableFilter.d.ts +126 -0
- package/dist/components/Tables/common/SyTablePagination.d.ts +1636 -0
- package/dist/components/Tables/common/TableHeader.d.ts +15 -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/filters/getFilterComponent.d.ts +1 -0
- package/dist/components/Tables/common/filters/locales.d.ts +4 -0
- package/dist/components/Tables/common/filters/logics/date.d.ts +1 -0
- package/dist/components/Tables/common/filters/logics/number.d.ts +1 -0
- package/dist/components/Tables/common/filters/logics/period.d.ts +1 -0
- package/dist/components/Tables/common/filters/logics/select.d.ts +1 -0
- package/dist/components/Tables/common/filters/logics/text.d.ts +1 -0
- package/dist/components/Tables/common/formatters.d.ts +17 -0
- package/dist/components/Tables/common/locales.d.ts +28 -0
- package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +267 -0
- package/dist/components/Tables/common/organizeColumns/sortHeaders.d.ts +2 -0
- package/dist/components/Tables/common/tableAccessibilityUtils.d.ts +8 -0
- package/dist/components/Tables/common/tableFilterUtils.d.ts +3 -0
- package/dist/components/Tables/common/tableStorageUtils.d.ts +69 -0
- package/dist/components/Tables/common/tableUtils.d.ts +79 -0
- package/dist/components/Tables/common/types.d.ts +91 -0
- package/dist/components/Tables/common/usePagination.d.ts +22 -0
- package/dist/components/Tables/common/useTableCheckbox.d.ts +20 -0
- package/dist/components/Tables/common/useTableFilter.d.ts +9 -0
- package/dist/components/Tables/common/useTableHeaders.d.ts +76 -0
- package/dist/components/Tables/common/useTableItems.d.ts +24 -0
- package/dist/components/Tables/common/useTableOptions.d.ts +18 -0
- package/dist/components/Tables/index.d.ts +2 -0
- package/dist/components/ToolbarContainer/ToolbarContainer.d.ts +11 -0
- package/dist/components/UploadWorkflow/AccessibiliteItems.d.ts +1 -1
- package/dist/components/UserMenuBtn/AccessibiliteItems.d.ts +1 -1
- package/dist/components/UserMenuBtn/UserMenuBtn.d.ts +9 -2
- package/dist/components/index.d.ts +9 -5
- package/dist/design-system-v3.js +102 -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-Cx8qG7YR.js +16344 -0
- package/dist/stories/Accessibilite/Vuetify/VuetifyItems.d.ts +14 -2
- package/dist/stories/DesignTokens/StylesTypographiques.stories.new.d.ts +8 -0
- package/dist/stories/DesignTokens/TypographyDisplay.d.ts +28 -0
- package/dist/stories/DesignTokens/vue-shims.d.ts +6 -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/common/imgs/accessibility-svgrepo-com.svg +4 -0
- package/src/components/Accordion/Accessibilite/AccessibilityGuide.mdx +249 -0
- package/src/components/Accordion/Accordion.vue +48 -76
- package/src/components/Accordion/composables/__tests__/useAccordionGroupCommunication.spec.ts +146 -0
- package/src/components/Accordion/composables/__tests__/useAccordionKeyboardNavigation.spec.ts +209 -0
- package/src/components/Accordion/composables/__tests__/useAccordionState.spec.ts +144 -0
- package/src/components/Accordion/composables/useAccordionGroupCommunication.ts +52 -0
- package/src/components/Accordion/composables/useAccordionKeyboardNavigation.ts +111 -0
- package/src/components/Accordion/composables/useAccordionState.ts +59 -0
- package/src/components/Accordion/tests/__snapshots__/accordion.spec.ts.snap +3 -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/SyCheckbox/Accessibilite.mdx +303 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +50 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +630 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +326 -0
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +201 -0
- package/src/components/Customs/SyInputSelect/AccessibiliteItems.ts +1 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +1 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.vue +8 -1
- package/src/components/Customs/SySelect/AccessibiliteItems.ts +1 -1
- package/src/components/Customs/SySelect/SySelect.stories.ts +160 -0
- package/src/components/Customs/SySelect/SySelect.vue +292 -39
- package/src/components/Customs/SySelect/tests/SySelect.spec.ts +234 -2
- package/src/components/Customs/SyTextField/AccessibiliteItems.ts +1 -1
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +3 -2
- package/src/components/Customs/SyTextField/SyTextField.vue +19 -8
- 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 +1307 -0
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +769 -204
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.events.spec.ts +161 -0
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +943 -0
- package/src/components/DatePicker/DatePicker/DatePicker.mdx +176 -0
- package/src/components/DatePicker/{DatePicker.stories.ts → DatePicker/DatePicker.stories.ts} +356 -519
- package/src/components/DatePicker/{DatePicker.vue → DatePicker/DatePicker.vue} +435 -89
- package/src/components/DatePicker/DatePicker/tests/DatePicker.events.spec.ts +189 -0
- package/src/components/DatePicker/{tests → DatePicker/tests}/DatePicker.spec.ts +0 -14
- 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 +320 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +148 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +278 -0
- package/src/components/DatePicker/{tests → DateTextInput}/DateTextInput.spec.ts +10 -7
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +1111 -0
- package/src/components/DatePicker/DateTextInput/NoCalendar.mdx +64 -0
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +782 -0
- package/src/components/DatePicker/composables/index.ts +24 -0
- package/src/components/DatePicker/composables/tests/useDateAutoClamp.spec.ts +190 -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 +456 -0
- package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +233 -0
- package/src/components/DatePicker/composables/tests/useMonthButtonCustomization.spec.ts +125 -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/useAsteriskDisplay.ts +31 -0
- package/src/components/DatePicker/composables/useDateAutoClamp.ts +136 -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 +378 -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 +70 -0
- package/src/components/DatePicker/composables/useIconState.ts +53 -0
- package/src/components/DatePicker/composables/useInputBlurHandler.ts +165 -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 +187 -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/DiacriticPicker/DiacriticPicker.stories.ts +10 -0
- package/src/components/DialogBox/AccessibiliteItems.ts +1 -1
- package/src/components/DownloadBtn/AccessibiliteItems.ts +1 -1
- package/src/components/ErrorPage/Accessibilite.stories.ts +8 -0
- package/src/components/ErrorPage/AccessibiliteItems.ts +1 -1
- package/src/components/ErrorPage/ErrorPage.vue +12 -6
- package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +4 -4
- 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/NirField/NirField.mdx +22 -9
- package/src/components/NirField/NirField.stories.ts +26 -2
- package/src/components/NirField/NirField.vue +209 -22
- package/src/components/NirField/nirValidation.ts +17 -3
- package/src/components/NirField/tests/NirField.spec.ts +2 -2
- package/src/components/NotFoundPage/Accessibilite.stories.ts +8 -0
- package/src/components/NotFoundPage/AccessibiliteItems.ts +1 -1
- package/src/components/NotFoundPage/NotFoundPage.vue +2 -1
- package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +8 -6
- 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.mdx +2 -0
- 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/PasswordField/PasswordField.stories.ts +4 -0
- package/src/components/PasswordField/PasswordField.vue +3 -0
- package/src/components/PeriodField/AccessibiliteItems.ts +1 -1
- package/src/components/PeriodField/PeriodField.vue +15 -1
- package/src/components/PhoneField/AccessibiliteItems.ts +1 -1
- package/src/components/PhoneField/PhoneField.stories.ts +15 -15
- package/src/components/PhoneField/PhoneField.vue +1 -1
- package/src/components/RangeField/AccessibiliteItems.ts +1 -1
- package/src/components/RangeField/RangeField.stories.ts +9 -0
- package/src/components/RangeField/RangeField.vue +4 -0
- package/src/components/RangeField/tests/__snapshots__/RangeField.spec.ts.snap +12 -0
- package/src/components/RatingPicker/AccessibiliteItems.ts +1 -1
- package/src/components/SearchListField/AccessibiliteItems.ts +1 -1
- package/src/components/SearchListField/SearchListField.vue +5 -0
- 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/SyTextArea/SyTextArea.vue +3 -0
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +0 -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 +700 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +170 -0
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +4354 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +391 -0
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +702 -0
- package/src/components/Tables/SyTable/FilterRules.stories.ts +418 -0
- package/src/components/Tables/SyTable/SyTable.mdx +139 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +2754 -0
- package/src/components/Tables/SyTable/SyTable.vue +397 -0
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +707 -0
- package/src/components/Tables/common/SyTableFilter.vue +289 -0
- package/src/components/Tables/common/SyTablePagination.vue +375 -0
- package/src/components/Tables/common/TableHeader.vue +205 -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 +235 -0
- package/src/components/Tables/common/filters/TextFilter.vue +191 -0
- package/src/components/Tables/common/filters/getFilterComponent.ts +54 -0
- package/src/components/Tables/common/filters/locales.ts +4 -0
- package/src/components/Tables/common/filters/logics/date.ts +12 -0
- package/src/components/Tables/common/filters/logics/number.ts +48 -0
- package/src/components/Tables/common/filters/logics/period.ts +25 -0
- package/src/components/Tables/common/filters/logics/select.ts +27 -0
- package/src/components/Tables/common/filters/logics/tests/TextFilterLogic.spec.ts +177 -0
- package/src/components/Tables/common/filters/logics/text.ts +62 -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 +31 -0
- package/src/components/Tables/common/organizeColumns/OrganizeColumns.vue +269 -0
- package/src/components/Tables/common/organizeColumns/sortHeaders.ts +9 -0
- package/src/components/Tables/common/tableAccessibilityUtils.ts +61 -0
- package/src/components/Tables/common/tableFilterUtils.ts +75 -0
- package/src/components/Tables/common/tableStorageUtils.ts +127 -0
- package/src/components/Tables/common/tableStyles.scss +80 -0
- package/src/components/Tables/common/tableUtils.ts +102 -0
- package/src/components/Tables/common/tests/SyTableFilter.spec.ts +312 -0
- package/src/components/Tables/common/tests/SyTablePagination.spec.ts +170 -0
- package/src/components/Tables/common/tests/filterByRange.spec.ts +215 -0
- package/src/components/Tables/common/tests/resize.spec.ts +161 -0
- package/src/components/Tables/common/tests/tableFilterUtils.spec.ts +92 -0
- package/src/components/Tables/common/tests/tableUtils.spec.ts +228 -0
- package/src/components/Tables/common/types.ts +92 -0
- package/src/components/Tables/common/usePagination.ts +83 -0
- package/src/components/Tables/common/useTableCheckbox.ts +58 -0
- package/src/components/Tables/common/useTableFilter.ts +19 -0
- package/src/components/Tables/common/useTableHeaders.ts +88 -0
- package/src/components/Tables/common/useTableItems.ts +87 -0
- package/src/components/Tables/common/useTableOptions.ts +93 -0
- package/src/components/Tables/index.ts +3 -0
- package/src/components/ToolbarContainer/ToolbarContainer.mdx +16 -0
- package/src/components/ToolbarContainer/ToolbarContainer.stories.ts +675 -0
- package/src/components/ToolbarContainer/ToolbarContainer.vue +128 -0
- package/src/components/ToolbarContainer/tests/ToolbarContainer.spec.ts +156 -0
- package/src/components/UploadWorkflow/AccessibiliteItems.ts +1 -1
- package/src/components/UserMenuBtn/AccessibiliteItems.ts +1 -1
- package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +74 -0
- package/src/components/UserMenuBtn/UserMenuBtn.vue +19 -17
- package/src/components/index.ts +9 -5
- 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/Accessibilite/Aculturation/AuditDesignSystem.mdx +293 -20
- package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +448 -54
- package/src/stories/Accessibilite/Audit/RGAA.mdx +231 -23
- package/src/stories/Accessibilite/Avancement/Avancement.mdx +591 -7
- package/src/stories/Accessibilite/Avancement/Avancement.stories.ts +139 -38
- package/src/stories/Accessibilite/Introduction.mdx +258 -18
- package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +221 -31
- package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +204 -22
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +537 -24
- package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +577 -70
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +382 -31
- package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +419 -81
- package/src/stories/Accessibilite/Vuetify/Vuetify.mdx +132 -6
- package/src/stories/Accessibilite/Vuetify/Vuetify.stories.ts +370 -146
- package/src/stories/Accessibilite/Vuetify/VuetifyItems.ts +35 -57
- package/src/stories/Demarrer/Accueil.stories.ts +32 -8
- package/src/stories/DesignTokens/StylesTypographiques.mdx +10 -9
- package/src/stories/DesignTokens/StylesTypographiques.stories.new.ts +397 -0
- package/src/stories/DesignTokens/StylesTypographiques.stories.ts +397 -0
- package/src/stories/DesignTokens/TypographyDisplay.vue +155 -0
- package/src/stories/DesignTokens/vue-shims.d.ts +6 -0
- package/src/stories/GuideDuDev/LesBreackingChanges.mdx +0 -2
- package/src/stories/GuideDuDev/MigrationDepuisBridge.mdx +1 -1
- package/src/stories/GuideDuDev/MigrationDepuisVue2.mdx +1 -1
- package/src/stories/GuideDuDev/PortailAgent.mdx +10 -0
- package/src/stories/GuideDuDev/PortailAgent.stories.ts +506 -0
- package/src/stories/GuideDuDev/Theme.mdx +41 -0
- 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/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +0 -886
- 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/stories/DesignTokens/ThemePA.mdx +0 -35
- /package/src/components/DatePicker/{examples → playground}/DatePickerHolidayRule.vue +0 -0
|
@@ -0,0 +1,1111 @@
|
|
|
1
|
+
<script lang="ts" setup>
|
|
2
|
+
import { ref, computed, watch, onMounted } from 'vue'
|
|
3
|
+
import { nextTick } from 'vue'
|
|
4
|
+
import SyTextField from '../../Customs/SyTextField/SyTextField.vue'
|
|
5
|
+
import { useValidation, type ValidationRule, type ValidationResult } from '@/composables/validation/useValidation'
|
|
6
|
+
import dayjs from 'dayjs'
|
|
7
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
|
8
|
+
import { useDateRangeInput, useDateRangeValidation, useDateFormatValidation, useDateValidation, useDateInputEditing, useManualDateValidation, useDateAutoClamp } from '../composables'
|
|
9
|
+
import { type DateObjectValue } from '../types'
|
|
10
|
+
import { useDateFormat } from '@/composables/date/useDateFormatDayjs'
|
|
11
|
+
import { type DateValue } from '@/composables/date/useDateInitializationDayjs'
|
|
12
|
+
import { DATE_PICKER_MESSAGES } from '../constants/messages'
|
|
13
|
+
|
|
14
|
+
// Initialiser les plugins dayjs
|
|
15
|
+
dayjs.extend(customParseFormat)
|
|
16
|
+
|
|
17
|
+
const props = withDefaults(defineProps<{
|
|
18
|
+
modelValue?: DateValue
|
|
19
|
+
placeholder?: string
|
|
20
|
+
format?: string
|
|
21
|
+
dateFormatReturn?: string
|
|
22
|
+
label?: string
|
|
23
|
+
required?: boolean
|
|
24
|
+
disabled?: boolean
|
|
25
|
+
readonly?: boolean
|
|
26
|
+
isOutlined?: boolean
|
|
27
|
+
displayIcon?: boolean
|
|
28
|
+
displayAppendIcon?: boolean
|
|
29
|
+
noIcon?: boolean
|
|
30
|
+
customRules?: ValidationRule[]
|
|
31
|
+
customWarningRules?: ValidationRule[]
|
|
32
|
+
displayPrependIcon?: boolean
|
|
33
|
+
disableErrorHandling?: boolean
|
|
34
|
+
showSuccessMessages?: boolean
|
|
35
|
+
bgColor?: string
|
|
36
|
+
displayRange?: boolean
|
|
37
|
+
autoClamp?: boolean
|
|
38
|
+
}>(), {
|
|
39
|
+
modelValue: null,
|
|
40
|
+
placeholder: DATE_PICKER_MESSAGES.PLACEHOLDER_DEFAULT,
|
|
41
|
+
format: DATE_PICKER_MESSAGES.FORMAT_DEFAULT,
|
|
42
|
+
dateFormatReturn: undefined,
|
|
43
|
+
label: undefined,
|
|
44
|
+
required: false,
|
|
45
|
+
disabled: false,
|
|
46
|
+
readonly: false,
|
|
47
|
+
isOutlined: true,
|
|
48
|
+
displayIcon: true,
|
|
49
|
+
displayAppendIcon: false,
|
|
50
|
+
noIcon: false,
|
|
51
|
+
customRules: () => [],
|
|
52
|
+
customWarningRules: () => [],
|
|
53
|
+
displayPrependIcon: true,
|
|
54
|
+
disableErrorHandling: false,
|
|
55
|
+
showSuccessMessages: true,
|
|
56
|
+
bgColor: 'white',
|
|
57
|
+
displayRange: false,
|
|
58
|
+
autoClamp: true,
|
|
59
|
+
})
|
|
60
|
+
|
|
61
|
+
const emit = defineEmits<{
|
|
62
|
+
(e: 'update:model-value', value: DateValue): void
|
|
63
|
+
(e: 'focus'): void
|
|
64
|
+
(e: 'blur'): void
|
|
65
|
+
(e: 'input', value: string): void
|
|
66
|
+
(e: 'date-selected', value: DateValue): void
|
|
67
|
+
}>()
|
|
68
|
+
|
|
69
|
+
const {
|
|
70
|
+
errors,
|
|
71
|
+
warnings,
|
|
72
|
+
successes,
|
|
73
|
+
hasError,
|
|
74
|
+
clearValidation,
|
|
75
|
+
validateField,
|
|
76
|
+
} = !props.readonly
|
|
77
|
+
? useValidation({
|
|
78
|
+
showSuccessMessages: props.showSuccessMessages,
|
|
79
|
+
fieldIdentifier: props.label || props.placeholder,
|
|
80
|
+
disableErrorHandling: props.disableErrorHandling,
|
|
81
|
+
})
|
|
82
|
+
: {
|
|
83
|
+
errors: ref<string[]>([]),
|
|
84
|
+
warnings: ref<string[]>([]),
|
|
85
|
+
successes: ref<string[]>([]),
|
|
86
|
+
hasError: ref(false),
|
|
87
|
+
clearValidation: () => {},
|
|
88
|
+
validateField: () => ({ hasError: false, hasWarning: false, hasSuccess: false, state: { errors: [], warnings: [], successes: [] } }),
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
const errorMessages = errors
|
|
92
|
+
const warningMessages = warnings
|
|
93
|
+
const successMessages = successes
|
|
94
|
+
|
|
95
|
+
// Fonction intermédiaire pour adapter validateField à la signature attendue par useDateValidation
|
|
96
|
+
const validateFieldAdapter = (value: unknown, rules?: ValidationRule[], warningRules?: ValidationRule[]): ValidationResult => {
|
|
97
|
+
// Si validateField est une fonction vide (cas readonly), retourner un résultat par défaut
|
|
98
|
+
if (typeof validateField === 'function' && validateField.toString().includes('() => {}')) {
|
|
99
|
+
return {
|
|
100
|
+
hasError: false,
|
|
101
|
+
hasWarning: false,
|
|
102
|
+
hasSuccess: false,
|
|
103
|
+
state: {
|
|
104
|
+
errors: [],
|
|
105
|
+
warnings: [],
|
|
106
|
+
successes: [],
|
|
107
|
+
},
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
const result = validateField(value, rules, warningRules)
|
|
112
|
+
if (!result) {
|
|
113
|
+
return {
|
|
114
|
+
hasError: false,
|
|
115
|
+
hasWarning: false,
|
|
116
|
+
hasSuccess: false,
|
|
117
|
+
state: {
|
|
118
|
+
errors: [],
|
|
119
|
+
warnings: [],
|
|
120
|
+
successes: [],
|
|
121
|
+
},
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
return result
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
const inputValue = ref('')
|
|
128
|
+
|
|
129
|
+
// Utilisation des composables pour la gestion des plages de dates
|
|
130
|
+
const { parseDate, formatDate } = useDateFormat()
|
|
131
|
+
|
|
132
|
+
// Utilisation du composable pour l'auto-clamping des dates invalides
|
|
133
|
+
const { autoClampDate } = useDateAutoClamp()
|
|
134
|
+
|
|
135
|
+
// Référence pour stocker les dates sélectionnées (pour le mode plage)
|
|
136
|
+
const selectedDates = ref<DateObjectValue>(null)
|
|
137
|
+
|
|
138
|
+
// Utilisation du composable pour la saisie des plages de dates
|
|
139
|
+
const {
|
|
140
|
+
handleRangeInput,
|
|
141
|
+
resetState,
|
|
142
|
+
isValidRange,
|
|
143
|
+
initializeWithDates,
|
|
144
|
+
formatRangeForDisplay,
|
|
145
|
+
parseRangeInput,
|
|
146
|
+
handleKeydown: handleKeydownRangeDate,
|
|
147
|
+
handlePaste: handlePasteRangeDate,
|
|
148
|
+
} = useDateRangeInput(
|
|
149
|
+
props.format,
|
|
150
|
+
props.displayRange,
|
|
151
|
+
parseDate,
|
|
152
|
+
formatDate,
|
|
153
|
+
)
|
|
154
|
+
|
|
155
|
+
// Utilisation du composable pour la validation des plages de dates
|
|
156
|
+
const { currentRangeIsValid, getRangeValidationError } = useDateRangeValidation(selectedDates, props.displayRange)
|
|
157
|
+
|
|
158
|
+
// Variable pour éviter les mises à jour récursives
|
|
159
|
+
const isUpdatingFromInternal = ref(false)
|
|
160
|
+
|
|
161
|
+
const isFocused = ref(false)
|
|
162
|
+
const hasInteracted = ref(false)
|
|
163
|
+
|
|
164
|
+
// Utilisation du composable pour la validation du format des dates
|
|
165
|
+
const { validateDateFormat: validateDateFormatFn } = useDateFormatValidation({
|
|
166
|
+
format: props.format,
|
|
167
|
+
dateFormatReturn: props.dateFormatReturn,
|
|
168
|
+
required: props.required,
|
|
169
|
+
hasInteracted,
|
|
170
|
+
disableErrorHandling: props.disableErrorHandling,
|
|
171
|
+
})
|
|
172
|
+
|
|
173
|
+
// Utilisation du composable pour la validation des dates
|
|
174
|
+
const { validateDates } = useDateValidation({
|
|
175
|
+
noCalendar: false,
|
|
176
|
+
required: props.required,
|
|
177
|
+
displayRange: props.displayRange,
|
|
178
|
+
disableErrorHandling: props.disableErrorHandling,
|
|
179
|
+
customRules: props.customRules,
|
|
180
|
+
customWarningRules: props.customWarningRules,
|
|
181
|
+
selectedDates,
|
|
182
|
+
isUpdatingFromInternal,
|
|
183
|
+
currentRangeIsValid,
|
|
184
|
+
getRangeValidationError,
|
|
185
|
+
clearValidation,
|
|
186
|
+
validateField: validateFieldAdapter,
|
|
187
|
+
errors,
|
|
188
|
+
warnings,
|
|
189
|
+
successes,
|
|
190
|
+
})
|
|
191
|
+
|
|
192
|
+
// Utilisation du composable pour gérer l'édition manuelle des dates
|
|
193
|
+
const ariaLabel = ref('')
|
|
194
|
+
|
|
195
|
+
const updateDisplayValue = (value: string) => {
|
|
196
|
+
inputValue.value = value
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
const updateAriaLabel = (value: string) => {
|
|
200
|
+
ariaLabel.value = value
|
|
201
|
+
}
|
|
202
|
+
|
|
203
|
+
const { formatDateInput, handleKeydown: handleKeydownSingleDate, handlePaste: handlePasteSingleDate } = useDateInputEditing({
|
|
204
|
+
format: props.format,
|
|
205
|
+
updateDisplayValue,
|
|
206
|
+
updateAriaLabel,
|
|
207
|
+
accessiblePlaceholders: true,
|
|
208
|
+
})
|
|
209
|
+
|
|
210
|
+
const validateDateFormat = (dateStr: string): { isValid: boolean, message: string } => {
|
|
211
|
+
if (props.readonly) return { isValid: true, message: '' }
|
|
212
|
+
|
|
213
|
+
// Si nous sommes en mode plage de dates et que la chaîne contient un séparateur de plage
|
|
214
|
+
if (props.displayRange && dateStr.includes(' - ')) {
|
|
215
|
+
// Diviser la chaîne en deux parties
|
|
216
|
+
const parts = dateStr.split(' - ')
|
|
217
|
+
const startDateStr = parts[0]?.trim() || ''
|
|
218
|
+
const endDateStr = parts[1]?.trim() || ''
|
|
219
|
+
|
|
220
|
+
// Valider chaque partie séparément
|
|
221
|
+
const startValidation = validateDateFormatFn(startDateStr)
|
|
222
|
+
const endValidation = endDateStr ? validateDateFormatFn(endDateStr) : { isValid: true, message: '' }
|
|
223
|
+
|
|
224
|
+
// Si les deux parties sont valides ou si la première est valide et la seconde est vide
|
|
225
|
+
if (startValidation.isValid && endValidation.isValid) {
|
|
226
|
+
return { isValid: true, message: '' }
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
// Si la première partie est invalide
|
|
230
|
+
if (!startValidation.isValid) {
|
|
231
|
+
return {
|
|
232
|
+
isValid: false,
|
|
233
|
+
message: `${DATE_PICKER_MESSAGES.ERROR_INVALID_FORMAT_START} (${props.format})`,
|
|
234
|
+
}
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
// Si la seconde partie est invalide
|
|
238
|
+
if (!endValidation.isValid) {
|
|
239
|
+
return {
|
|
240
|
+
isValid: false,
|
|
241
|
+
message: `${DATE_PICKER_MESSAGES.ERROR_INVALID_FORMAT_END} (${props.format})`,
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
// Utiliser le composable pour la validation standard
|
|
247
|
+
return validateDateFormatFn(dateStr)
|
|
248
|
+
}
|
|
249
|
+
|
|
250
|
+
// Initialiser le composable pour la validation manuelle des dates
|
|
251
|
+
const { validateManualInput } = useManualDateValidation({
|
|
252
|
+
format: props.format,
|
|
253
|
+
required: props.required,
|
|
254
|
+
disableErrorHandling: props.disableErrorHandling,
|
|
255
|
+
customRules: props.customRules,
|
|
256
|
+
customWarningRules: props.customWarningRules,
|
|
257
|
+
hasInteracted,
|
|
258
|
+
errors,
|
|
259
|
+
clearValidation,
|
|
260
|
+
validateDateFormat,
|
|
261
|
+
isDateComplete: (value: string) => value.length >= props.format.length,
|
|
262
|
+
parseDate,
|
|
263
|
+
validateField,
|
|
264
|
+
})
|
|
265
|
+
|
|
266
|
+
const validateRules = (value: string) => {
|
|
267
|
+
clearValidation()
|
|
268
|
+
|
|
269
|
+
// Cas spécial : champ vide
|
|
270
|
+
if (!value && props.required && hasInteracted.value) {
|
|
271
|
+
if (props.readonly) return true
|
|
272
|
+
if (!props.disableErrorHandling) {
|
|
273
|
+
errors.value.push(DATE_PICKER_MESSAGES.ERROR_REQUIRED)
|
|
274
|
+
}
|
|
275
|
+
return false
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
if (!value && !props.required) {
|
|
279
|
+
return true
|
|
280
|
+
}
|
|
281
|
+
|
|
282
|
+
// Traitement spécifique pour les plages de dates
|
|
283
|
+
if (props.displayRange && value.includes(' - ')) {
|
|
284
|
+
// Extraire les deux dates de la plage
|
|
285
|
+
const [startDateStr, endDateStr] = value.split(' - ')
|
|
286
|
+
|
|
287
|
+
// Si la plage est incomplète (seulement la première date suivie du séparateur)
|
|
288
|
+
if (startDateStr && !endDateStr) {
|
|
289
|
+
// Utiliser le composable pour valider uniquement la première date
|
|
290
|
+
return validateManualInput(startDateStr)
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
// Si nous avons les deux dates (plage complète)
|
|
294
|
+
if (startDateStr && endDateStr) {
|
|
295
|
+
// Valider le format des deux dates
|
|
296
|
+
const formatValidation = validateDateFormat(value)
|
|
297
|
+
if (!formatValidation.isValid) {
|
|
298
|
+
if (!props.disableErrorHandling && formatValidation.message) {
|
|
299
|
+
errors.value.push(formatValidation.message)
|
|
300
|
+
}
|
|
301
|
+
return false
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
// Valider chaque date séparément
|
|
305
|
+
const startDate = parseDate(startDateStr, props.format)
|
|
306
|
+
const endDate = parseDate(endDateStr, props.format)
|
|
307
|
+
|
|
308
|
+
if (startDate && endDate) {
|
|
309
|
+
// Appliquer les règles à chaque date individuellement
|
|
310
|
+
validateField(
|
|
311
|
+
startDate,
|
|
312
|
+
props.customRules,
|
|
313
|
+
props.customWarningRules,
|
|
314
|
+
)
|
|
315
|
+
|
|
316
|
+
// Si pas d'erreur sur la première date, valider la seconde
|
|
317
|
+
if (errors.value.length === 0) {
|
|
318
|
+
validateField(
|
|
319
|
+
endDate,
|
|
320
|
+
props.customRules,
|
|
321
|
+
props.customWarningRules,
|
|
322
|
+
)
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
else {
|
|
328
|
+
// Utiliser le composable pour la validation standard d'une date unique
|
|
329
|
+
return validateManualInput(value)
|
|
330
|
+
}
|
|
331
|
+
|
|
332
|
+
return !hasError.value
|
|
333
|
+
}
|
|
334
|
+
|
|
335
|
+
const isOnError = computed(() => warningMessages.value.length === 0 && successMessages.value.length === 0 && errorMessages.value.length > 0)
|
|
336
|
+
const isOnWarning = computed(() => errorMessages.value.length === 0 && successMessages.value.length === 0 && warningMessages.value.length > 0)
|
|
337
|
+
const isOnSuccess = computed(() => errorMessages.value.length === 0 && warningMessages.value.length === 0 && successMessages.value.length > 0)
|
|
338
|
+
|
|
339
|
+
// Raccourcis pour vérifier la présence d'erreurs, d'avertissements ou de succès
|
|
340
|
+
const hasWarning = computed(() => warningMessages.value.length > 0)
|
|
341
|
+
|
|
342
|
+
const getIcon = computed(() => {
|
|
343
|
+
if (errorMessages.value.length > 0) {
|
|
344
|
+
return 'error'
|
|
345
|
+
}
|
|
346
|
+
if (warningMessages.value.length > 0) {
|
|
347
|
+
return 'warning'
|
|
348
|
+
}
|
|
349
|
+
if (successMessages.value.length > 0 && !warningMessages.value.length) {
|
|
350
|
+
return 'success'
|
|
351
|
+
}
|
|
352
|
+
return undefined
|
|
353
|
+
})
|
|
354
|
+
|
|
355
|
+
const handleKeydown = (event: KeyboardEvent & { target: HTMLInputElement }) => {
|
|
356
|
+
// Utiliser l'implémentation du composable approprié en fonction du mode
|
|
357
|
+
if (props.displayRange) {
|
|
358
|
+
handleKeydownRangeDate(event)
|
|
359
|
+
}
|
|
360
|
+
else {
|
|
361
|
+
handleKeydownSingleDate(event)
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
|
|
365
|
+
const handlePaste = (event: ClipboardEvent) => {
|
|
366
|
+
// Utiliser l'implémentation du composable approprié en fonction du mode
|
|
367
|
+
if (props.displayRange) {
|
|
368
|
+
handlePasteRangeDate(event)
|
|
369
|
+
}
|
|
370
|
+
else {
|
|
371
|
+
handlePasteSingleDate(event)
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
|
|
375
|
+
const inputRef = ref<InstanceType<typeof SyTextField> | null>(null)
|
|
376
|
+
|
|
377
|
+
const isFormatting = ref(false)
|
|
378
|
+
|
|
379
|
+
watch(inputValue, async (newValue, oldValue) => {
|
|
380
|
+
if (isFormatting.value || newValue === oldValue) return
|
|
381
|
+
|
|
382
|
+
try {
|
|
383
|
+
isFormatting.value = true
|
|
384
|
+
|
|
385
|
+
if (!newValue) {
|
|
386
|
+
emit('update:model-value', null)
|
|
387
|
+
validateRules('')
|
|
388
|
+
// Réinitialiser l'état du composable pour les plages de dates
|
|
389
|
+
if (props.displayRange) {
|
|
390
|
+
resetState()
|
|
391
|
+
selectedDates.value = null
|
|
392
|
+
}
|
|
393
|
+
return
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
// Appliquer l'auto-clamping si activé
|
|
397
|
+
if (props.autoClamp) {
|
|
398
|
+
// Pour les plages de dates, traiter chaque partie séparément
|
|
399
|
+
if (props.displayRange && newValue.includes(' - ')) {
|
|
400
|
+
const parts = newValue.split(' - ')
|
|
401
|
+
const startDateStr = parts[0]?.trim() || ''
|
|
402
|
+
const endDateStr = parts[1]?.trim() || ''
|
|
403
|
+
|
|
404
|
+
// Appliquer l'auto-clamping à chaque partie si nécessaire
|
|
405
|
+
let adjusted = false
|
|
406
|
+
let clampedStart = startDateStr
|
|
407
|
+
let clampedEnd = endDateStr
|
|
408
|
+
|
|
409
|
+
if (startDateStr) {
|
|
410
|
+
const startResult = autoClampDate(startDateStr, props.format)
|
|
411
|
+
if (startResult.adjusted) {
|
|
412
|
+
clampedStart = startResult.clampedDate
|
|
413
|
+
adjusted = true
|
|
414
|
+
}
|
|
415
|
+
}
|
|
416
|
+
|
|
417
|
+
if (endDateStr) {
|
|
418
|
+
const endResult = autoClampDate(endDateStr, props.format)
|
|
419
|
+
if (endResult.adjusted) {
|
|
420
|
+
clampedEnd = endResult.clampedDate
|
|
421
|
+
adjusted = true
|
|
422
|
+
}
|
|
423
|
+
}
|
|
424
|
+
|
|
425
|
+
// Si un ajustement a été fait, mettre à jour la valeur
|
|
426
|
+
if (adjusted) {
|
|
427
|
+
const clampedValue = clampedEnd
|
|
428
|
+
? `${clampedStart} - ${clampedEnd}`
|
|
429
|
+
: clampedStart
|
|
430
|
+
newValue = clampedValue
|
|
431
|
+
inputValue.value = clampedValue
|
|
432
|
+
|
|
433
|
+
// Mettre à jour le modèle avec les dates ajustées
|
|
434
|
+
const startDate = clampedStart ? parseDate(clampedStart, props.format) : null
|
|
435
|
+
const endDate = clampedEnd ? parseDate(clampedEnd, props.format) : null
|
|
436
|
+
|
|
437
|
+
if (startDate) {
|
|
438
|
+
// Mettre à jour les dates sélectionnées
|
|
439
|
+
if (endDate) {
|
|
440
|
+
selectedDates.value = [startDate, endDate]
|
|
441
|
+
|
|
442
|
+
// Formater les dates pour le modèle
|
|
443
|
+
const format = props.dateFormatReturn || props.format
|
|
444
|
+
const formattedStartDate = formatDate(startDate, format)
|
|
445
|
+
const formattedEndDate = formatDate(endDate, format)
|
|
446
|
+
|
|
447
|
+
// Émettre la plage de dates mise à jour
|
|
448
|
+
emit('update:model-value', [formattedStartDate, formattedEndDate])
|
|
449
|
+
}
|
|
450
|
+
else {
|
|
451
|
+
selectedDates.value = [startDate]
|
|
452
|
+
|
|
453
|
+
// Émettre la date de début mise à jour
|
|
454
|
+
const format = props.dateFormatReturn || props.format
|
|
455
|
+
const formattedStartDate = formatDate(startDate, format)
|
|
456
|
+
emit('update:model-value', formattedStartDate)
|
|
457
|
+
}
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
else {
|
|
462
|
+
// Pour une date unique
|
|
463
|
+
const result = autoClampDate(newValue, props.format)
|
|
464
|
+
if (result.adjusted) {
|
|
465
|
+
newValue = result.clampedDate
|
|
466
|
+
inputValue.value = result.clampedDate
|
|
467
|
+
|
|
468
|
+
// Mettre à jour le modèle avec la date ajustée
|
|
469
|
+
const date = parseDate(result.clampedDate, props.format)
|
|
470
|
+
if (date) {
|
|
471
|
+
const formattedDate = props.dateFormatReturn && props.dateFormatReturn !== props.format
|
|
472
|
+
? formatDate(date, props.dateFormatReturn)
|
|
473
|
+
: formatDate(date, props.format)
|
|
474
|
+
emit('update:model-value', formattedDate)
|
|
475
|
+
}
|
|
476
|
+
}
|
|
477
|
+
}
|
|
478
|
+
}
|
|
479
|
+
|
|
480
|
+
const input = inputRef.value?.$el.querySelector('input')
|
|
481
|
+
const cursorPos = input?.selectionStart || 0
|
|
482
|
+
|
|
483
|
+
// Utiliser le composable de plage de dates si le mode plage est activé
|
|
484
|
+
if (props.displayRange) {
|
|
485
|
+
// S'assurer que newValue est une chaîne de caractères
|
|
486
|
+
if (typeof newValue !== 'string') {
|
|
487
|
+
// Si newValue n'est pas une chaîne, on ne peut pas appliquer le formatage
|
|
488
|
+
return
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
// Appliquer le formatage automatique aux dates saisies
|
|
492
|
+
const cleanedInput = newValue.replace(/[^\d]/g, '')
|
|
493
|
+
let formattedInput = ''
|
|
494
|
+
|
|
495
|
+
// Si l'entrée contient un séparateur de plage, traiter chaque partie séparément
|
|
496
|
+
if (newValue.includes(' - ')) {
|
|
497
|
+
const parts = newValue.split(' - ')
|
|
498
|
+
const firstPart = parts[0]
|
|
499
|
+
const secondPart = parts[1] || ''
|
|
500
|
+
|
|
501
|
+
// Formater la première partie
|
|
502
|
+
const formattedFirst = firstPart.length > 0 ? formatDateInput(firstPart).formatted : ''
|
|
503
|
+
|
|
504
|
+
// Formater la seconde partie
|
|
505
|
+
const formattedSecond = secondPart.length > 0 ? formatDateInput(secondPart).formatted : ''
|
|
506
|
+
|
|
507
|
+
// Combiner les deux parties
|
|
508
|
+
formattedInput = `${formattedFirst} - ${formattedSecond}`
|
|
509
|
+
|
|
510
|
+
newValue = formattedInput
|
|
511
|
+
}
|
|
512
|
+
else if (cleanedInput.length > 0) {
|
|
513
|
+
// Appliquer le formatage automatique à une date unique
|
|
514
|
+
const { formatted } = formatDateInput(newValue)
|
|
515
|
+
formattedInput = formatted
|
|
516
|
+
newValue = formattedInput
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
// Gérer la saisie de plage de dates avec le newValue formaté
|
|
520
|
+
// Lors de la première saisie (oldValue vide), ne pas envoyer la position du curseur
|
|
521
|
+
// car cela peut causer des problèmes avec le formatage initial
|
|
522
|
+
const result = !oldValue
|
|
523
|
+
? handleRangeInput('', newValue)
|
|
524
|
+
: handleRangeInput(oldValue, newValue, cursorPos)
|
|
525
|
+
|
|
526
|
+
// Mettre à jour la valeur affichée
|
|
527
|
+
inputValue.value = result.formattedValue
|
|
528
|
+
|
|
529
|
+
// Mettre à jour les dates sélectionnées
|
|
530
|
+
if (result.dates[0]) {
|
|
531
|
+
// Si nous avons au moins une date
|
|
532
|
+
selectedDates.value = result.dates
|
|
533
|
+
|
|
534
|
+
// Valider les dates après la mise à jour
|
|
535
|
+
try {
|
|
536
|
+
isUpdatingFromInternal.value = true
|
|
537
|
+
validateDates()
|
|
538
|
+
}
|
|
539
|
+
finally {
|
|
540
|
+
setTimeout(() => {
|
|
541
|
+
isUpdatingFromInternal.value = false
|
|
542
|
+
}, 0)
|
|
543
|
+
}
|
|
544
|
+
|
|
545
|
+
// Si la plage est complète (deux dates)
|
|
546
|
+
if (result.isComplete && result.dates[1]) {
|
|
547
|
+
const [startDate, endDate] = result.dates
|
|
548
|
+
|
|
549
|
+
// Vérifier si la plage est valide
|
|
550
|
+
if (isValidRange(startDate, endDate)) {
|
|
551
|
+
// Formater les dates pour le modèle
|
|
552
|
+
const returnFormat = props.dateFormatReturn || props.format
|
|
553
|
+
const modelValue: [string, string] = [
|
|
554
|
+
formatDate(startDate, returnFormat),
|
|
555
|
+
formatDate(endDate, returnFormat),
|
|
556
|
+
]
|
|
557
|
+
|
|
558
|
+
// Émettre les événements
|
|
559
|
+
emit('update:model-value', modelValue)
|
|
560
|
+
emit('date-selected', modelValue)
|
|
561
|
+
}
|
|
562
|
+
else {
|
|
563
|
+
errors.value.push(DATE_PICKER_MESSAGES.ERROR_END_BEFORE_START)
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
// Si nous venons juste de compléter la première date
|
|
567
|
+
else if (result.justCompletedFirstDate) {
|
|
568
|
+
// Émettre un événement pour la première date
|
|
569
|
+
const returnFormat = props.dateFormatReturn || props.format
|
|
570
|
+
const formattedDate = formatDate(result.dates[0], returnFormat)
|
|
571
|
+
|
|
572
|
+
// Émettre l'événement date-selected pour la première date
|
|
573
|
+
emit('date-selected', formattedDate)
|
|
574
|
+
|
|
575
|
+
// Note: Nous n'émettons pas update:model-value avec un tableau contenant null
|
|
576
|
+
// car le type DateValue n'accepte que [string, string] pour les plages
|
|
577
|
+
}
|
|
578
|
+
}
|
|
579
|
+
else {
|
|
580
|
+
// Aucune date sélectionnée
|
|
581
|
+
selectedDates.value = null
|
|
582
|
+
|
|
583
|
+
// Réinitialiser le modèle si nécessaire
|
|
584
|
+
if (props.modelValue !== null) {
|
|
585
|
+
emit('update:model-value', null)
|
|
586
|
+
}
|
|
587
|
+
}
|
|
588
|
+
|
|
589
|
+
// Émettre l'événement input
|
|
590
|
+
emit('input', result.formattedValue)
|
|
591
|
+
|
|
592
|
+
// Mettre à jour la position du curseur si nécessaire
|
|
593
|
+
if (result.cursorPosition !== undefined) {
|
|
594
|
+
setTimeout(() => {
|
|
595
|
+
if (input) {
|
|
596
|
+
input.setSelectionRange(result.cursorPosition, result.cursorPosition)
|
|
597
|
+
}
|
|
598
|
+
}, 0)
|
|
599
|
+
}
|
|
600
|
+
}
|
|
601
|
+
else {
|
|
602
|
+
// Mode date unique (comportement existant)
|
|
603
|
+
const { formatted, cursorPos: newPos } = formatDateInput(newValue, cursorPos)
|
|
604
|
+
|
|
605
|
+
if (formatted !== newValue) {
|
|
606
|
+
inputValue.value = formatted
|
|
607
|
+
await nextTick()
|
|
608
|
+
input?.setSelectionRange(newPos, newPos)
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
const isDateComplete = !formatted.includes('_')
|
|
612
|
+
|
|
613
|
+
if (isDateComplete) {
|
|
614
|
+
const validation = validateDateFormat(formatted)
|
|
615
|
+
if (validation.isValid) {
|
|
616
|
+
const date = dayjs(formatted, props.format, true).isValid()
|
|
617
|
+
? dayjs(formatted, props.format).toDate()
|
|
618
|
+
: null
|
|
619
|
+
|
|
620
|
+
if (date) {
|
|
621
|
+
const formattedDate = props.dateFormatReturn
|
|
622
|
+
? dayjs(date).format(props.dateFormatReturn)
|
|
623
|
+
: formatted
|
|
624
|
+
await nextTick()
|
|
625
|
+
emit('update:model-value', formattedDate)
|
|
626
|
+
emit('date-selected', formattedDate)
|
|
627
|
+
}
|
|
628
|
+
}
|
|
629
|
+
validateRules(formatted)
|
|
630
|
+
}
|
|
631
|
+
else {
|
|
632
|
+
clearValidation()
|
|
633
|
+
}
|
|
634
|
+
}
|
|
635
|
+
}
|
|
636
|
+
finally {
|
|
637
|
+
await nextTick()
|
|
638
|
+
isFormatting.value = false
|
|
639
|
+
}
|
|
640
|
+
})
|
|
641
|
+
|
|
642
|
+
watch(() => props.modelValue, (newValue: DateValue) => {
|
|
643
|
+
if (isFormatting.value) return
|
|
644
|
+
|
|
645
|
+
if (!newValue) {
|
|
646
|
+
inputValue.value = ''
|
|
647
|
+
return
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
// Gérer les plages de dates
|
|
651
|
+
if (props.displayRange && Array.isArray(newValue)) {
|
|
652
|
+
// Conversion explicite du type pour aider TypeScript
|
|
653
|
+
const dateArray = newValue as string[]
|
|
654
|
+
|
|
655
|
+
// Si nous avons une plage de dates complète
|
|
656
|
+
if (dateArray.length === 2) {
|
|
657
|
+
const [startDateStr, endDateStr] = newValue
|
|
658
|
+
const startDate = parseDate(startDateStr, props.dateFormatReturn || props.format)
|
|
659
|
+
const endDate = parseDate(endDateStr, props.dateFormatReturn || props.format)
|
|
660
|
+
|
|
661
|
+
if (startDate && endDate) {
|
|
662
|
+
// Initialiser les dates sélectionnées avec le composable
|
|
663
|
+
initializeWithDates(startDate, endDate)
|
|
664
|
+
selectedDates.value = [startDate, endDate]
|
|
665
|
+
|
|
666
|
+
// Valider les dates après la mise à jour
|
|
667
|
+
try {
|
|
668
|
+
isUpdatingFromInternal.value = true
|
|
669
|
+
validateDates()
|
|
670
|
+
}
|
|
671
|
+
finally {
|
|
672
|
+
setTimeout(() => {
|
|
673
|
+
isUpdatingFromInternal.value = false
|
|
674
|
+
}, 0)
|
|
675
|
+
}
|
|
676
|
+
|
|
677
|
+
// Utiliser le composable pour formater la plage
|
|
678
|
+
inputValue.value = formatRangeForDisplay(startDate, endDate)
|
|
679
|
+
validateRules(inputValue.value)
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
else if (dateArray.length === 1 && dateArray[0]) {
|
|
683
|
+
// Si nous avons seulement la première date
|
|
684
|
+
const startDate = parseDate(dateArray[0], props.dateFormatReturn || props.format)
|
|
685
|
+
if (startDate) {
|
|
686
|
+
// Initialiser avec seulement la date de début
|
|
687
|
+
initializeWithDates(startDate, null)
|
|
688
|
+
selectedDates.value = [startDate]
|
|
689
|
+
|
|
690
|
+
// Formater pour l'affichage
|
|
691
|
+
inputValue.value = formatRangeForDisplay(startDate, null)
|
|
692
|
+
}
|
|
693
|
+
}
|
|
694
|
+
}
|
|
695
|
+
// Gérer une date unique (comportement existant)
|
|
696
|
+
else {
|
|
697
|
+
const modelValueStr = typeof newValue === 'string' ? newValue : ''
|
|
698
|
+
const date = dayjs(modelValueStr, props.format, true).isValid()
|
|
699
|
+
? dayjs(modelValueStr, props.format).toDate()
|
|
700
|
+
: null
|
|
701
|
+
|
|
702
|
+
if (date) {
|
|
703
|
+
if (props.dateFormatReturn && props.dateFormatReturn !== props.format) {
|
|
704
|
+
const formattedForReturn = dayjs(date).format(props.dateFormatReturn)
|
|
705
|
+
emit('update:model-value', formattedForReturn)
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
inputValue.value = dayjs(date).format(props.format)
|
|
709
|
+
validateRules(inputValue.value)
|
|
710
|
+
}
|
|
711
|
+
else {
|
|
712
|
+
inputValue.value = modelValueStr
|
|
713
|
+
validateRules(modelValueStr)
|
|
714
|
+
}
|
|
715
|
+
}
|
|
716
|
+
})
|
|
717
|
+
|
|
718
|
+
const handleFocus = () => {
|
|
719
|
+
isFocused.value = true
|
|
720
|
+
emit('focus')
|
|
721
|
+
}
|
|
722
|
+
|
|
723
|
+
const handleBlur = () => {
|
|
724
|
+
isFocused.value = false
|
|
725
|
+
hasInteracted.value = true
|
|
726
|
+
|
|
727
|
+
// Vérifier si la valeur est vide
|
|
728
|
+
if (inputValue.value) {
|
|
729
|
+
const validation = validateDateFormat(inputValue.value)
|
|
730
|
+
if (validation.isValid) {
|
|
731
|
+
// Si le format est valide, la date est également valide grâce à notre correction dans useDateFormatValidation
|
|
732
|
+
const formattedDate = props.dateFormatReturn
|
|
733
|
+
? dayjs(inputValue.value, props.format).format(props.dateFormatReturn)
|
|
734
|
+
: inputValue.value
|
|
735
|
+
emit('update:model-value', formattedDate)
|
|
736
|
+
}
|
|
737
|
+
else {
|
|
738
|
+
// Si le format n'est pas valide ou si la date est invalide, ajouter le message d'erreur
|
|
739
|
+
clearValidation()
|
|
740
|
+
errors.value.push(validation.message)
|
|
741
|
+
emit('update:model-value', props.modelValue)
|
|
742
|
+
}
|
|
743
|
+
}
|
|
744
|
+
|
|
745
|
+
// Appliquer l'auto-clamping au moment du blur si activé
|
|
746
|
+
if (props.autoClamp) {
|
|
747
|
+
// Pour les plages de dates, traiter chaque partie séparément
|
|
748
|
+
if (props.displayRange && inputValue.value.includes(' - ')) {
|
|
749
|
+
const parts = inputValue.value.split(' - ')
|
|
750
|
+
const startDateStr = parts[0]?.trim() || ''
|
|
751
|
+
const endDateStr = parts[1]?.trim() || ''
|
|
752
|
+
|
|
753
|
+
// Appliquer l'auto-clamping à chaque partie si nécessaire
|
|
754
|
+
let adjusted = false
|
|
755
|
+
let clampedStart = startDateStr
|
|
756
|
+
let clampedEnd = endDateStr
|
|
757
|
+
|
|
758
|
+
if (startDateStr) {
|
|
759
|
+
const startResult = autoClampDate(startDateStr, props.format)
|
|
760
|
+
if (startResult.adjusted) {
|
|
761
|
+
clampedStart = startResult.clampedDate
|
|
762
|
+
adjusted = true
|
|
763
|
+
}
|
|
764
|
+
}
|
|
765
|
+
|
|
766
|
+
if (endDateStr) {
|
|
767
|
+
const endResult = autoClampDate(endDateStr, props.format)
|
|
768
|
+
if (endResult.adjusted) {
|
|
769
|
+
clampedEnd = endResult.clampedDate
|
|
770
|
+
adjusted = true
|
|
771
|
+
}
|
|
772
|
+
}
|
|
773
|
+
|
|
774
|
+
// Si un ajustement a été fait, mettre à jour la valeur
|
|
775
|
+
if (adjusted) {
|
|
776
|
+
const clampedValue = clampedEnd
|
|
777
|
+
? `${clampedStart} - ${clampedEnd}`
|
|
778
|
+
: clampedStart
|
|
779
|
+
inputValue.value = clampedValue
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
else {
|
|
783
|
+
// Pour une date unique
|
|
784
|
+
const result = autoClampDate(inputValue.value, props.format)
|
|
785
|
+
if (result.adjusted) {
|
|
786
|
+
inputValue.value = result.clampedDate
|
|
787
|
+
}
|
|
788
|
+
}
|
|
789
|
+
|
|
790
|
+
// Après avoir appliqué l'autoClamp, mettre à jour le modèle
|
|
791
|
+
if (props.displayRange) {
|
|
792
|
+
// Utiliser directement parseRangeInput pour analyser la plage de dates
|
|
793
|
+
// sans passer par handleRangeInput qui peut causer des erreurs
|
|
794
|
+
const [startDate, endDate] = parseRangeInput(inputValue.value)
|
|
795
|
+
|
|
796
|
+
// Mettre à jour le modèle avec les dates analysées si la plage est complète
|
|
797
|
+
if (startDate) {
|
|
798
|
+
const returnFormat = props.dateFormatReturn || props.format
|
|
799
|
+
if (endDate) {
|
|
800
|
+
// Plage complète avec deux dates
|
|
801
|
+
const modelValue: [string, string] = [
|
|
802
|
+
formatDate(startDate, returnFormat),
|
|
803
|
+
formatDate(endDate, returnFormat),
|
|
804
|
+
]
|
|
805
|
+
emit('update:model-value', modelValue)
|
|
806
|
+
}
|
|
807
|
+
// Sinon, on ne met pas à jour le modèle car on n'a qu'une date partielle
|
|
808
|
+
}
|
|
809
|
+
}
|
|
810
|
+
else {
|
|
811
|
+
// Traiter une date unique
|
|
812
|
+
const date = parseDate(inputValue.value, props.format)
|
|
813
|
+
if (date) {
|
|
814
|
+
const formattedDate = props.dateFormatReturn && props.dateFormatReturn !== props.format
|
|
815
|
+
? formatDate(date, props.dateFormatReturn)
|
|
816
|
+
: formatDate(date, props.format)
|
|
817
|
+
emit('update:model-value', formattedDate)
|
|
818
|
+
}
|
|
819
|
+
}
|
|
820
|
+
|
|
821
|
+
// Valider les règles avec la valeur ajustée
|
|
822
|
+
validateRules(inputValue.value)
|
|
823
|
+
}
|
|
824
|
+
|
|
825
|
+
// Traitement spécifique pour les plages de dates
|
|
826
|
+
if (props.displayRange && inputValue.value) {
|
|
827
|
+
// Utiliser le composable pour analyser la plage de dates
|
|
828
|
+
const [startDate, endDate] = parseRangeInput(inputValue.value)
|
|
829
|
+
|
|
830
|
+
// Si nous avons une plage complète (deux dates)
|
|
831
|
+
if (startDate && endDate) {
|
|
832
|
+
// Vérifier si la plage est valide (date de fin >= date de début)
|
|
833
|
+
if (!isValidRange(startDate, endDate)) {
|
|
834
|
+
// Plage invalide, conserver l'erreur et ne pas mettre à jour le modèle
|
|
835
|
+
clearValidation()
|
|
836
|
+
errors.value.push(DATE_PICKER_MESSAGES.ERROR_END_BEFORE_START)
|
|
837
|
+
emit('update:model-value', props.modelValue)
|
|
838
|
+
return
|
|
839
|
+
}
|
|
840
|
+
|
|
841
|
+
// Mettre à jour les dates sélectionnées
|
|
842
|
+
selectedDates.value = [startDate, endDate]
|
|
843
|
+
|
|
844
|
+
// Formater correctement l'affichage
|
|
845
|
+
inputValue.value = formatRangeForDisplay(startDate, endDate)
|
|
846
|
+
|
|
847
|
+
// Plage valide, mettre à jour le modèle
|
|
848
|
+
const returnFormat = props.dateFormatReturn || props.format
|
|
849
|
+
const modelValue: [string, string] = [
|
|
850
|
+
formatDate(startDate, returnFormat),
|
|
851
|
+
formatDate(endDate, returnFormat),
|
|
852
|
+
]
|
|
853
|
+
emit('update:model-value', modelValue)
|
|
854
|
+
validateRules(inputValue.value)
|
|
855
|
+
return
|
|
856
|
+
}
|
|
857
|
+
// Si nous avons seulement la première date
|
|
858
|
+
else if (startDate) {
|
|
859
|
+
// Mettre à jour les dates sélectionnées
|
|
860
|
+
selectedDates.value = [startDate]
|
|
861
|
+
|
|
862
|
+
// Valider les dates après la mise à jour
|
|
863
|
+
try {
|
|
864
|
+
isUpdatingFromInternal.value = true
|
|
865
|
+
validateDates()
|
|
866
|
+
}
|
|
867
|
+
finally {
|
|
868
|
+
setTimeout(() => {
|
|
869
|
+
isUpdatingFromInternal.value = false
|
|
870
|
+
}, 0)
|
|
871
|
+
}
|
|
872
|
+
|
|
873
|
+
// Formater correctement l'affichage
|
|
874
|
+
inputValue.value = formatRangeForDisplay(startDate, null)
|
|
875
|
+
|
|
876
|
+
// Mettre à jour l'affichage avec seulement la première date
|
|
877
|
+
const returnFormat = props.dateFormatReturn || props.format
|
|
878
|
+
const formattedDate = formatDate(startDate, returnFormat)
|
|
879
|
+
|
|
880
|
+
// Émettre l'événement date-selected pour la première date
|
|
881
|
+
emit('date-selected', formattedDate)
|
|
882
|
+
|
|
883
|
+
// Note: Nous n'émettons pas update:model-value avec un tableau contenant null
|
|
884
|
+
// car le type DateValue n'accepte que [string, string] pour les plages
|
|
885
|
+
validateRules(inputValue.value)
|
|
886
|
+
return
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
|
|
890
|
+
// Traitement standard pour les dates uniques ou les cas non couverts ci-dessus
|
|
891
|
+
if (inputValue.value) {
|
|
892
|
+
const validation = validateDateFormat(inputValue.value)
|
|
893
|
+
if (validation.isValid) {
|
|
894
|
+
const date = dayjs(inputValue.value, props.format, true).isValid()
|
|
895
|
+
? dayjs(inputValue.value, props.format).toDate()
|
|
896
|
+
: null
|
|
897
|
+
|
|
898
|
+
if (date) {
|
|
899
|
+
const formattedDate = props.dateFormatReturn
|
|
900
|
+
? dayjs(date).format(props.dateFormatReturn)
|
|
901
|
+
: inputValue.value
|
|
902
|
+
emit('update:model-value', formattedDate)
|
|
903
|
+
}
|
|
904
|
+
}
|
|
905
|
+
else {
|
|
906
|
+
emit('update:model-value', props.modelValue)
|
|
907
|
+
}
|
|
908
|
+
}
|
|
909
|
+
else if (props.required) {
|
|
910
|
+
emit('update:model-value', props.modelValue)
|
|
911
|
+
}
|
|
912
|
+
else {
|
|
913
|
+
emit('update:model-value', null)
|
|
914
|
+
}
|
|
915
|
+
|
|
916
|
+
// Appliquer la validation standard si elle n'a pas déjà été appliquée
|
|
917
|
+
if (errors.value.length === 0) {
|
|
918
|
+
validateRules(inputValue.value || '')
|
|
919
|
+
}
|
|
920
|
+
emit('blur')
|
|
921
|
+
}
|
|
922
|
+
|
|
923
|
+
const isValidating = ref(false)
|
|
924
|
+
|
|
925
|
+
const validateOnSubmit = async (): Promise<boolean> => {
|
|
926
|
+
isValidating.value = true
|
|
927
|
+
hasInteracted.value = true
|
|
928
|
+
|
|
929
|
+
try {
|
|
930
|
+
// Valider le format de la date
|
|
931
|
+
const isFormatValid = validateRules(inputValue.value)
|
|
932
|
+
|
|
933
|
+
if (!isFormatValid) {
|
|
934
|
+
return false
|
|
935
|
+
}
|
|
936
|
+
|
|
937
|
+
// Vérifier si nous avons des erreurs après la validation du format
|
|
938
|
+
if (hasError.value) {
|
|
939
|
+
return false
|
|
940
|
+
}
|
|
941
|
+
|
|
942
|
+
// Ajouter des messages de succès si nécessaire
|
|
943
|
+
if (props.showSuccessMessages && inputValue.value && !hasError.value && !hasWarning.value) {
|
|
944
|
+
successMessages.value.push(DATE_PICKER_MESSAGES.SUCCESS_VALID_DATE)
|
|
945
|
+
}
|
|
946
|
+
|
|
947
|
+
return !hasError.value
|
|
948
|
+
}
|
|
949
|
+
finally {
|
|
950
|
+
isValidating.value = false
|
|
951
|
+
}
|
|
952
|
+
}
|
|
953
|
+
|
|
954
|
+
defineExpose({
|
|
955
|
+
validateOnSubmit,
|
|
956
|
+
focus() {
|
|
957
|
+
// Utiliser un sélecteur plus spécifique pour cibler l'input principal
|
|
958
|
+
// SyTextField peut contenir plusieurs inputs, donc on cible le premier qui n'est pas caché
|
|
959
|
+
const input = inputRef.value?.$el.querySelector('input:not([type="hidden"])')
|
|
960
|
+
if (input) {
|
|
961
|
+
input.focus()
|
|
962
|
+
}
|
|
963
|
+
},
|
|
964
|
+
blur() {
|
|
965
|
+
// Utiliser un sélecteur plus spécifique pour cibler l'input principal
|
|
966
|
+
const input = inputRef.value?.$el.querySelector('input:not([type="hidden"])')
|
|
967
|
+
if (input) {
|
|
968
|
+
input.blur()
|
|
969
|
+
}
|
|
970
|
+
},
|
|
971
|
+
})
|
|
972
|
+
|
|
973
|
+
onMounted(() => {
|
|
974
|
+
if (!props.modelValue) {
|
|
975
|
+
return
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
// Gérer les plages de dates
|
|
979
|
+
if (props.displayRange && Array.isArray(props.modelValue)) {
|
|
980
|
+
// Si nous avons une plage de dates complète
|
|
981
|
+
if (props.modelValue.length === 2) {
|
|
982
|
+
const [startDateStr, endDateStr] = props.modelValue
|
|
983
|
+
const startDate = parseDate(startDateStr, props.dateFormatReturn || props.format)
|
|
984
|
+
const endDate = parseDate(endDateStr, props.dateFormatReturn || props.format)
|
|
985
|
+
|
|
986
|
+
if (startDate && endDate) {
|
|
987
|
+
// Initialiser les dates sélectionnées
|
|
988
|
+
selectedDates.value = [startDate, endDate]
|
|
989
|
+
|
|
990
|
+
// Formater la plage pour l'affichage
|
|
991
|
+
const formattedStart = formatDate(startDate, props.format)
|
|
992
|
+
const formattedEnd = formatDate(endDate, props.format)
|
|
993
|
+
inputValue.value = `${formattedStart} - ${formattedEnd}`
|
|
994
|
+
}
|
|
995
|
+
}
|
|
996
|
+
}
|
|
997
|
+
// Gérer une date unique (comportement existant)
|
|
998
|
+
else {
|
|
999
|
+
const modelValueStr = typeof props.modelValue === 'string' ? props.modelValue : ''
|
|
1000
|
+
const date = dayjs(modelValueStr, props.format, true).isValid()
|
|
1001
|
+
? dayjs(modelValueStr, props.format).toDate()
|
|
1002
|
+
: null
|
|
1003
|
+
|
|
1004
|
+
if (date) {
|
|
1005
|
+
inputValue.value = dayjs(date).format(props.format)
|
|
1006
|
+
}
|
|
1007
|
+
else {
|
|
1008
|
+
inputValue.value = modelValueStr
|
|
1009
|
+
}
|
|
1010
|
+
}
|
|
1011
|
+
})
|
|
1012
|
+
</script>
|
|
1013
|
+
|
|
1014
|
+
<template>
|
|
1015
|
+
<SyTextField
|
|
1016
|
+
ref="inputRef"
|
|
1017
|
+
v-model="inputValue"
|
|
1018
|
+
:append-icon="displayIcon && displayAppendIcon ? 'calendar' : undefined"
|
|
1019
|
+
:append-inner-icon="getIcon"
|
|
1020
|
+
:class="{
|
|
1021
|
+
'error-field': isOnError,
|
|
1022
|
+
'warning-field': isOnWarning,
|
|
1023
|
+
'success-field': isOnSuccess
|
|
1024
|
+
}"
|
|
1025
|
+
:disabled="props.disabled"
|
|
1026
|
+
:error-messages="errorMessages"
|
|
1027
|
+
:label="props.label || ''"
|
|
1028
|
+
:placeholder="props.placeholder"
|
|
1029
|
+
:no-icon="props.noIcon"
|
|
1030
|
+
:prepend-icon="displayIcon && displayPrependIcon && !displayAppendIcon ? 'calendar' : undefined"
|
|
1031
|
+
:readonly="props.readonly"
|
|
1032
|
+
:variant-style="props.isOutlined ? 'outlined' : 'underlined'"
|
|
1033
|
+
:warning-messages="warningMessages"
|
|
1034
|
+
:success-messages="props.showSuccessMessages ? successMessages : []"
|
|
1035
|
+
:bg-color="props.bgColor"
|
|
1036
|
+
color="primary"
|
|
1037
|
+
is-clearable
|
|
1038
|
+
:display-persistent-placeholder="true"
|
|
1039
|
+
:aria-label="ariaLabel || props.placeholder"
|
|
1040
|
+
title="Date text input"
|
|
1041
|
+
@focus="handleFocus"
|
|
1042
|
+
@blur="handleBlur"
|
|
1043
|
+
@keydown="handleKeydown"
|
|
1044
|
+
@paste="handlePaste"
|
|
1045
|
+
/>
|
|
1046
|
+
</template>
|
|
1047
|
+
|
|
1048
|
+
<style lang="scss" scoped>
|
|
1049
|
+
@use '@/assets/tokens';
|
|
1050
|
+
|
|
1051
|
+
:deep(.v-icon__svg) { cursor: default; }
|
|
1052
|
+
|
|
1053
|
+
.warning-field {
|
|
1054
|
+
:deep(.v-input__details > .v-icon),
|
|
1055
|
+
:deep(.v-input__prepend > .v-icon),
|
|
1056
|
+
:deep(.v-input__append > .v-icon) {
|
|
1057
|
+
opacity: 1 !important;
|
|
1058
|
+
}
|
|
1059
|
+
|
|
1060
|
+
:deep(.v-field) {
|
|
1061
|
+
color: tokens.$colors-border-warning !important;
|
|
1062
|
+
|
|
1063
|
+
.v-field__outline {
|
|
1064
|
+
color: tokens.$colors-border-warning !important;
|
|
1065
|
+
}
|
|
1066
|
+
}
|
|
1067
|
+
|
|
1068
|
+
:deep(.v-messages) {
|
|
1069
|
+
opacity: 1 !important;
|
|
1070
|
+
|
|
1071
|
+
.v-messages__message {
|
|
1072
|
+
color: tokens.$colors-border-warning !important;
|
|
1073
|
+
}
|
|
1074
|
+
}
|
|
1075
|
+
}
|
|
1076
|
+
|
|
1077
|
+
.error-field {
|
|
1078
|
+
:deep(.v-input__control),
|
|
1079
|
+
:deep(.v-messages__message) {
|
|
1080
|
+
color: tokens.$colors-text-error !important;
|
|
1081
|
+
}
|
|
1082
|
+
|
|
1083
|
+
.v-field--active & {
|
|
1084
|
+
color: tokens.$colors-border-error !important;
|
|
1085
|
+
}
|
|
1086
|
+
}
|
|
1087
|
+
|
|
1088
|
+
.success-field {
|
|
1089
|
+
:deep(.v-input__details > .v-icon),
|
|
1090
|
+
:deep(.v-input__prepend > .v-icon),
|
|
1091
|
+
:deep(.v-input__append > .v-icon) {
|
|
1092
|
+
opacity: 1 !important;
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
:deep(.v-field) {
|
|
1096
|
+
color: tokens.$colors-border-success !important;
|
|
1097
|
+
|
|
1098
|
+
.v-field__outline {
|
|
1099
|
+
color: tokens.$colors-border-success !important;
|
|
1100
|
+
}
|
|
1101
|
+
}
|
|
1102
|
+
|
|
1103
|
+
:deep(.v-messages) {
|
|
1104
|
+
opacity: 1 !important;
|
|
1105
|
+
|
|
1106
|
+
.v-messages__message {
|
|
1107
|
+
color: tokens.$colors-border-success !important;
|
|
1108
|
+
}
|
|
1109
|
+
}
|
|
1110
|
+
}
|
|
1111
|
+
</style>
|