@cnamts/synapse 0.0.11-alpha → 0.0.13-alpha
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/design-system-v3.js +5394 -3813
- package/dist/design-system-v3.umd.cjs +1 -1
- package/dist/src/components/Amelipro/types/types.d.ts +38 -0
- package/dist/src/components/CookieBanner/CookieBanner.d.ts +1 -1
- package/dist/src/components/Customs/SyInputSelect/SyInputSelect.d.ts +2 -0
- package/dist/src/components/Customs/SyTextField/SyTextField.d.ts +31 -23
- package/dist/src/components/Customs/SyTextField/types.d.ts +1 -0
- package/dist/src/components/DatePicker/DatePicker.d.ts +105 -102
- package/dist/src/components/DatePicker/DateTextInput.d.ts +82 -74
- package/dist/src/components/ErrorPage/ErrorPage.d.ts +1 -1
- package/dist/src/components/FileList/FileList.d.ts +1 -0
- package/dist/src/components/FileList/UploadItem/UploadItem.d.ts +1 -1
- package/dist/src/components/FilterInline/AccessibiliteItems.d.ts +30 -0
- package/dist/src/components/FilterInline/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/FilterSideBar/AccessibiliteItems.d.ts +29 -0
- package/dist/src/components/FilterSideBar/FilterSideBar.d.ts +31 -0
- package/dist/src/components/FilterSideBar/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/FilterSideBar/locales.d.ts +7 -0
- package/dist/src/components/LangBtn/LangBtn.d.ts +2 -2
- package/dist/src/components/NirField/NirField.d.ts +952 -0
- package/dist/src/components/NotificationBar/NotificationBar.d.ts +6 -6
- package/dist/src/components/PasswordField/PasswordField.d.ts +42 -8
- package/dist/src/components/PeriodField/PeriodField.d.ts +259 -235
- package/dist/src/components/PhoneField/PhoneField.d.ts +33 -3
- package/dist/src/components/RatingPicker/EmotionPicker/EmotionPicker.d.ts +1 -1
- package/dist/src/components/RatingPicker/NumberPicker/NumberPicker.d.ts +1 -1
- package/dist/src/components/RatingPicker/StarsPicker/StarsPicker.d.ts +1 -1
- package/dist/src/components/UploadWorkflow/AccessibiliteItems.d.ts +29 -0
- package/dist/src/components/UploadWorkflow/config.d.ts +29 -0
- package/dist/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/UploadWorkflow/locales.d.ts +7 -0
- package/dist/src/components/UploadWorkflow/types.d.ts +19 -0
- package/dist/src/components/UploadWorkflow/useFileList.d.ts +10 -0
- package/dist/src/components/UploadWorkflow/useFileUploadJourney.d.ts +9 -0
- package/dist/src/components/Usages/Usages.d.ts +10 -0
- package/dist/src/components/index.d.ts +5 -0
- package/dist/src/composables/date/tests/useDateFormat.spec.d.ts +1 -0
- package/dist/src/composables/date/tests/useDateInitialization.spec.d.ts +1 -0
- package/dist/src/composables/date/tests/useDatePickerAccessibility.spec.d.ts +1 -0
- package/dist/src/composables/date/useDateFormat.d.ts +26 -0
- package/dist/src/composables/date/useDateInitialization.d.ts +18 -0
- package/dist/src/composables/date/useDatePickerAccessibility.d.ts +8 -0
- package/dist/src/composables/rules/useFieldValidation.d.ts +1 -0
- package/dist/src/composables/useFilterable/useFilterable.d.ts +1 -1
- package/dist/src/composables/validation/tests/useValidation.spec.d.ts +1 -0
- package/dist/src/composables/validation/useValidation.d.ts +40 -0
- package/dist/src/designTokens/index.d.ts +3 -1
- package/dist/src/main.d.ts +1 -0
- package/dist/src/utils/formatDate/index.d.ts +3 -0
- package/dist/src/utils/formatDate/tests/formatDate.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateAfter/index.d.ts +2 -0
- package/dist/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateBefore/index.d.ts +2 -0
- package/dist/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateInRange/index.d.ts +3 -0
- package/dist/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isDateValid/index.d.ts +9 -0
- package/dist/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isEmailValid/tests/isEmailValid.spec.d.ts +1 -0
- package/dist/src/utils/functions/validation/isWeekend/index.d.ts +3 -0
- package/dist/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.d.ts +1 -0
- package/dist/src/utils/parseDate/index.d.ts +3 -0
- package/dist/src/utils/parseDate/tests/parseDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/doMatchPattern/index.d.ts +3 -0
- package/dist/src/utils/rules/doMatchPattern/tests/matchPattern.spec.d.ts +1 -0
- package/dist/src/utils/rules/index.d.ts +11 -0
- package/dist/src/utils/rules/isDateValid/index.d.ts +4 -0
- package/dist/src/utils/rules/isDateValid/tests/isDateValid.spec.d.ts +1 -0
- package/dist/src/utils/rules/isExactLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isExactLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isExactLength/tests/exactLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isMaxLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isMaxLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isMaxLength/tests/isMaxLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isMinLength/index.d.ts +3 -0
- package/dist/src/utils/rules/isMinLength/locales.d.ts +2 -0
- package/dist/src/utils/rules/isMinLength/tests/isMinLength.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotAfterDate/index.d.ts +3 -0
- package/dist/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotAfterToday/index.d.ts +4 -0
- package/dist/src/utils/rules/isNotAfterToday/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotBeforeDate/index.d.ts +3 -0
- package/dist/src/utils/rules/isNotBeforeDate/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.d.ts +1 -0
- package/dist/src/utils/rules/isNotBeforeToday/index.d.ts +4 -0
- package/dist/src/utils/rules/isNotBeforeToday/locales.d.ts +2 -0
- package/dist/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.d.ts +1 -0
- package/dist/src/utils/rules/isRequired/index.d.ts +4 -0
- package/dist/src/utils/rules/isRequired/locales.d.ts +2 -0
- package/dist/src/utils/rules/isRequired/tests/isRequred.spec.d.ts +1 -0
- package/dist/src/utils/rules/isValidEmail/index.d.ts +4 -0
- package/dist/src/utils/rules/isValidEmail/locales.d.ts +2 -0
- package/dist/src/utils/rules/isValidEmail/tests/isValidEmail.spec.d.ts +1 -0
- package/dist/src/vuetifyConfig.d.ts +81 -0
- package/dist/style.css +1 -1
- package/package.json +3 -1
- package/src/assets/_elevations.scss +89 -0
- package/src/assets/_fonts.scss +6 -0
- package/src/assets/_radius.scss +92 -0
- package/src/assets/_spacers.scss +149 -0
- package/src/assets/settings.scss +15 -3
- package/src/assets/tokens.scss +32 -29
- package/src/components/Amelipro/types/types.ts +40 -0
- package/src/components/ChipList/ChipList.stories.ts +26 -27
- package/src/components/ChipList/ChipList.vue +5 -1
- package/src/components/ChipList/config.ts +1 -0
- package/src/components/CookiesSelection/CookiesInformation/CookiesInformation.vue +2 -2
- package/src/components/Customs/SyBtnSelect/SyBtnSelect.mdx +1 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.mdx +1 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +65 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.vue +13 -3
- package/src/components/Customs/SySelect/SySelect.mdx +1 -1
- package/src/components/Customs/SySelect/SySelect.stories.ts +88 -5
- package/src/components/Customs/SySelect/SySelect.vue +55 -14
- package/src/components/Customs/SySelect/tests/SySelect.spec.ts +135 -2
- package/src/components/Customs/SyTextField/SyTextField.mdx +2 -2
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +809 -79
- package/src/components/Customs/SyTextField/SyTextField.vue +135 -104
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +190 -38
- package/src/components/Customs/SyTextField/types.d.ts +1 -0
- package/src/components/DatePicker/DatePicker.stories.ts +177 -5
- package/src/components/DatePicker/DatePicker.vue +302 -233
- package/src/components/DatePicker/DateTextInput.vue +101 -246
- package/src/components/DatePicker/tests/DatePicker.spec.ts +123 -60
- package/src/components/DatePicker/tests/DateTextInput.spec.ts +202 -6
- package/src/components/FileList/Accessibilite.stories.ts +1 -1
- package/src/components/FileList/AccessibiliteItems.ts +22 -0
- package/src/components/FileList/FileList.vue +2 -1
- package/src/components/FileList/UploadItem/UploadItem.vue +10 -0
- package/src/components/FileUpload/FileUpload.stories.ts +93 -7
- package/src/components/FileUpload/FileUpload.vue +1 -0
- package/src/components/FileUpload/tests/FileUpload.spec.ts +4 -4
- package/src/components/FilterInline/Accessibilite.mdx +14 -0
- package/src/components/FilterInline/Accessibilite.stories.ts +216 -0
- package/src/components/FilterInline/AccessibiliteItems.ts +132 -0
- package/src/components/FilterInline/FilterInline.mdx +180 -34
- package/src/components/FilterInline/FilterInline.stories.ts +363 -6
- package/src/components/FilterInline/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/FilterSideBar/Accessibilite.mdx +14 -0
- package/src/components/FilterSideBar/Accessibilite.stories.ts +216 -0
- package/src/components/FilterSideBar/AccessibiliteItems.ts +153 -0
- package/src/components/FilterSideBar/FilterSideBar.mdx +237 -0
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +798 -0
- package/src/components/FilterSideBar/FilterSideBar.vue +193 -0
- package/src/components/FilterSideBar/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/FilterSideBar/locales.ts +8 -0
- package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +305 -0
- package/src/components/FilterSideBar/tests/__snapshots__/FilterSideBar.spec.ts.snap +39 -0
- package/src/components/HeaderBar/Usages.mdx +1 -1
- package/src/components/NirField/NirField.stories.ts +738 -29
- package/src/components/NirField/NirField.vue +401 -359
- package/src/components/NirField/examples//342/200/257dataset/342/200/257.md +12 -0
- package/src/components/NirField/tests/NirField.spec.ts +88 -52
- package/src/components/NirField/tests/config.spec.ts +65 -0
- package/src/components/NotificationBar/Accessibilite.stories.ts +4 -0
- package/src/components/NotificationBar/NotificationBar.mdx +2 -2
- package/src/components/NotificationBar/NotificationBar.stories.ts +66 -13
- package/src/components/NotificationBar/NotificationBar.vue +42 -114
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +28 -33
- package/src/components/NotificationBar/tests/__snapshots__/NotificationBar.spec.ts.snap +1 -1
- package/src/components/PaginatedTable/PaginatedTable.vue +6 -10
- package/src/components/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +4 -4
- package/src/components/PasswordField/PasswordField.mdx +129 -47
- package/src/components/PasswordField/PasswordField.stories.ts +1111 -120
- package/src/components/PasswordField/PasswordField.vue +212 -99
- package/src/components/PasswordField/tests/PasswordField.spec.ts +138 -9
- package/src/components/PeriodField/PeriodField.stories.ts +214 -118
- package/src/components/PeriodField/PeriodField.vue +238 -190
- package/src/components/PeriodField/tests/PeriodField.spec.ts +146 -0
- package/src/components/PhoneField/PhoneField.stories.ts +170 -0
- package/src/components/PhoneField/PhoneField.vue +76 -17
- package/src/components/PhoneField/indicatifs.ts +1 -1
- package/src/components/PhoneField/tests/PhoneField.spec.ts +40 -0
- package/src/components/RatingPicker/RatingPicker.stories.ts +7 -7
- package/src/components/SearchListField/SearchListField.stories.ts +1 -1
- package/src/components/UploadWorkflow/Accessibilite.mdx +14 -0
- package/src/components/UploadWorkflow/Accessibilite.stories.ts +216 -0
- package/src/components/UploadWorkflow/AccessibiliteItems.ts +192 -0
- package/src/components/UploadWorkflow/UploadWorkflow.mdx +75 -0
- package/src/components/UploadWorkflow/UploadWorkflow.stories.ts +943 -0
- package/src/components/UploadWorkflow/UploadWorkflow.vue +230 -0
- package/src/components/UploadWorkflow/config.ts +29 -0
- package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/UploadWorkflow/locales.ts +8 -0
- package/src/components/UploadWorkflow/tests/UploadWorkflow.spec.ts +257 -0
- package/src/components/UploadWorkflow/tests/__snapshots__/UploadWorkflow.spec.ts.snap +54 -0
- package/src/components/UploadWorkflow/types.ts +21 -0
- package/src/components/UploadWorkflow/useFileList.ts +84 -0
- package/src/components/UploadWorkflow/useFileUploadJourney.ts +18 -0
- package/src/components/Usages/tests/Usages.spec.ts +183 -0
- package/src/components/index.ts +5 -0
- package/src/composables/date/tests/useDateFormat.spec.ts +67 -0
- package/src/composables/date/tests/useDateInitialization.spec.ts +89 -0
- package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +102 -0
- package/src/composables/date/useDateFormat.ts +94 -0
- package/src/composables/date/useDateInitialization.ts +92 -0
- package/src/composables/date/useDatePickerAccessibility.ts +78 -0
- package/src/composables/rules/tests/useFieldValidation.spec.ts +385 -4
- package/src/composables/rules/useFieldValidation.ts +5 -2
- package/src/composables/useFilterable/useFilterable.ts +5 -4
- package/src/composables/validation/tests/useValidation.spec.ts +154 -0
- package/src/composables/validation/useValidation.ts +180 -0
- package/src/designTokens/index.ts +4 -0
- package/src/main.ts +1 -0
- package/src/stories/Accessibilite/Aculturation/AuditDesignSystem.mdx +28 -0
- package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +2 -2
- package/src/stories/Accessibilite/Audit/RGAA.mdx +6 -6
- package/src/stories/Accessibilite/Introduction.mdx +2 -1
- package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +1 -1
- package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +1 -1
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +8 -11
- package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +77 -0
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +9 -3
- package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +2 -2
- package/src/stories/Demarrer/Accueil.mdx +1 -1
- package/src/stories/Demarrer/Introduction.stories.ts +3 -3
- package/src/stories/Demarrer/Releases.mdx +8 -0
- package/src/stories/Demarrer/Releases.stories.ts +66 -0
- package/src/stories/DesignTokens/Conteneurs.stories.ts +3 -3
- package/src/stories/DesignTokens/ThemePA.mdx +4 -30
- package/src/stories/GuideDuDev/LesBreackingChanges.mdx +36 -0
- package/src/stories/GuideDuDev/UtiliserLesRules.mdx +321 -78
- package/src/stories/GuideDuDev/moduleDeNotification.mdx +1 -1
- package/src/utils/formatDate/index.ts +6 -0
- package/src/utils/formatDate/tests/formatDate.spec.ts +18 -0
- package/src/utils/functions/validation/isDateAfter/index.ts +9 -0
- package/src/utils/functions/validation/isDateAfter/tests/isDateAfter.spec.ts +18 -0
- package/src/utils/functions/validation/isDateBefore/index.ts +9 -0
- package/src/utils/functions/validation/isDateBefore/tests/isDateBefore.spec.ts +23 -0
- package/src/utils/functions/validation/isDateInRange/index.ts +22 -0
- package/src/utils/functions/validation/isDateInRange/tests/isDateInRange.spec.ts +28 -0
- package/src/utils/functions/validation/isDateValid/index.ts +67 -0
- package/src/utils/functions/validation/isDateValid/tests/isDateValid.spec.ts +46 -0
- package/src/utils/functions/validation/isEmailValid/index.ts +9 -0
- package/src/utils/functions/validation/isWeekend/index.ts +10 -0
- package/src/utils/functions/validation/isWeekend/tests/isWeekend.spec.ts +16 -0
- package/src/utils/parseDate/index.ts +29 -0
- package/src/utils/parseDate/tests/parseDate.spec.ts +52 -0
- package/src/utils/rules/Rules.mdx +16 -0
- package/src/utils/rules/doMatchPattern/DoMachPattern.mdx +66 -0
- package/src/utils/rules/doMatchPattern/DoMatchPattern.stories.ts +106 -0
- package/src/utils/rules/doMatchPattern/index.ts +28 -0
- package/src/utils/rules/doMatchPattern/locales.ts +5 -0
- package/src/utils/rules/doMatchPattern/tests/matchPattern.spec.ts +38 -0
- package/src/utils/rules/index.ts +11 -0
- package/src/utils/rules/isDateValid/IsDateValid.mdx +87 -0
- package/src/utils/rules/isDateValid/IsDateValid.stories.ts +113 -0
- package/src/utils/rules/isDateValid/index.ts +32 -0
- package/src/utils/rules/isDateValid/locales.ts +10 -0
- package/src/utils/rules/isDateValid/tests/isDateValid.spec.ts +27 -0
- package/src/utils/rules/isExactLength/IsExactLenght.mdx +68 -0
- package/src/utils/rules/isExactLength/IsExactLength.stories.ts +151 -0
- package/src/utils/rules/{exactLength → isExactLength}/index.ts +2 -4
- package/src/utils/rules/isExactLength/tests/exactLength.spec.ts +48 -0
- package/src/utils/rules/isMaxLength/IsMaxLength.mdx +68 -0
- package/src/utils/rules/isMaxLength/IsMaxLength.stories.ts +152 -0
- package/src/utils/rules/isMaxLength/index.ts +30 -0
- package/src/utils/rules/isMaxLength/locales.ts +6 -0
- package/src/utils/rules/isMaxLength/tests/isMaxLength.spec.ts +42 -0
- package/src/utils/rules/isMinLength/IsMinLength.mdx +68 -0
- package/src/utils/rules/isMinLength/IsMinLength.stories.ts +152 -0
- package/src/utils/rules/isMinLength/index.ts +30 -0
- package/src/utils/rules/isMinLength/locales.ts +6 -0
- package/src/utils/rules/isMinLength/tests/isMinLength.spec.ts +42 -0
- package/src/utils/rules/isNotAfterDate/IsNotAfterDate.mdx +68 -0
- package/src/utils/rules/isNotAfterDate/IsNotAfterDate.stories.ts +109 -0
- package/src/utils/rules/isNotAfterDate/index.ts +25 -0
- package/src/utils/rules/isNotAfterDate/locales.ts +6 -0
- package/src/utils/rules/isNotAfterDate/tests/isNotAfterDate.spec.ts +25 -0
- package/src/utils/rules/isNotAfterToday/IsNotAfterToday.mdx +83 -0
- package/src/utils/rules/isNotAfterToday/IsNotAfterToday.stories.ts +110 -0
- package/src/utils/rules/isNotAfterToday/index.ts +28 -0
- package/src/utils/rules/isNotAfterToday/locales.ts +5 -0
- package/src/utils/rules/isNotAfterToday/tests/isNotAfterToday.spec.ts +30 -0
- package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.mdx +68 -0
- package/src/utils/rules/isNotBeforeDate/IsNotBeforeDate.stories.ts +114 -0
- package/src/utils/rules/isNotBeforeDate/index.ts +25 -0
- package/src/utils/rules/isNotBeforeDate/locales.ts +6 -0
- package/src/utils/rules/isNotBeforeDate/tests/IsNotBeforeDate.spec.ts +25 -0
- package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.mdx +83 -0
- package/src/utils/rules/isNotBeforeToday/IsNotBeforeToday.stories.ts +110 -0
- package/src/utils/rules/isNotBeforeToday/index.ts +28 -0
- package/src/utils/rules/isNotBeforeToday/locales.ts +5 -0
- package/src/utils/rules/isNotBeforeToday/tests/notBeforeToday.spec.ts +36 -0
- package/src/utils/rules/isRequired/IsRequired.mdx +81 -0
- package/src/utils/rules/isRequired/IsRequired.stories.ts +101 -0
- package/src/utils/rules/{required → isRequired}/index.ts +3 -3
- package/src/utils/rules/{required/tests/index.spec.ts → isRequired/tests/isRequred.spec.ts} +9 -9
- package/src/utils/rules/isValidEmail/IsValidEmail.mdx +81 -0
- package/src/utils/rules/isValidEmail/IsValidEmail.stories.ts +101 -0
- package/src/utils/rules/{email → isValidEmail}/index.ts +3 -5
- package/src/utils/rules/{email/tests/email.spec.ts → isValidEmail/tests/isValidEmail.spec.ts} +5 -5
- package/src/vuetifyConfig.ts +61 -0
- package/dist/src/utils/rules/email/index.d.ts +0 -4
- package/dist/src/utils/rules/exactLength/index.d.ts +0 -4
- package/dist/src/utils/rules/required/index.d.ts +0 -4
- package/dist/src/utils/rules/required/ruleMessageHelper.d.ts +0 -3
- package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +0 -58
- package/src/composables/useFilterable/__snapshots__/useFilterable.spec.ts.snap +0 -3
- package/src/utils/functions/isEmailValid/index.ts +0 -8
- package/src/utils/rules/required/ruleMessageHelper.ts +0 -14
- package/src/utils/rules/required/tests/rulesMessageHelper.spec.ts +0 -22
- /package/dist/src/{utils/functions/isEmailValid/tests/isEmailValid.spec.d.ts → components/FilterSideBar/tests/FilterSideBar.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/email/tests/email.spec.d.ts → components/NirField/tests/config.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/required/tests/index.spec.d.ts → components/UploadWorkflow/tests/UploadWorkflow.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/required/tests/rulesMessageHelper.spec.d.ts → components/Usages/tests/Usages.spec.d.ts} +0 -0
- /package/dist/src/utils/functions/{isEmailValid → validation/isEmailValid}/index.d.ts +0 -0
- /package/dist/src/utils/rules/{exactLength → doMatchPattern}/locales.d.ts +0 -0
- /package/dist/src/utils/rules/{email → isDateValid}/locales.d.ts +0 -0
- /package/dist/src/utils/rules/{required → isNotAfterDate}/locales.d.ts +0 -0
- /package/src/utils/functions/{isEmailValid → validation/isEmailValid}/tests/isEmailValid.spec.ts +0 -0
- /package/src/utils/rules/{exactLength → isExactLength}/locales.ts +0 -0
- /package/src/utils/rules/{required → isRequired}/locales.ts +0 -0
- /package/src/utils/rules/{email → isValidEmail}/locales.ts +0 -0
|
@@ -3,11 +3,14 @@
|
|
|
3
3
|
import SyTextField from '@/components/Customs/SyTextField/SyTextField.vue'
|
|
4
4
|
import DateTextInput from './DateTextInput.vue'
|
|
5
5
|
import { VDatePicker } from 'vuetify/components'
|
|
6
|
-
import {
|
|
7
|
-
import
|
|
6
|
+
import { useValidation } from '@/composables/validation/useValidation'
|
|
7
|
+
import { useDateFormat } from '@/composables/date/useDateFormat'
|
|
8
|
+
import { useDateInitialization, type DateValue, type DateInput } from '@/composables/date/useDateInitialization'
|
|
9
|
+
import { useDatePickerAccessibility } from '@/composables/date/useDatePickerAccessibility'
|
|
8
10
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
+
const { parseDate, formatDate } = useDateFormat()
|
|
12
|
+
const { initializeSelectedDates } = useDateInitialization()
|
|
13
|
+
const { updateAccessibility } = useDatePickerAccessibility()
|
|
11
14
|
|
|
12
15
|
const props = withDefaults(defineProps<{
|
|
13
16
|
modelValue?: DateInput
|
|
@@ -21,14 +24,18 @@
|
|
|
21
24
|
displayIcon?: boolean
|
|
22
25
|
displayAppendIcon?: boolean
|
|
23
26
|
displayPrependIcon?: boolean
|
|
24
|
-
|
|
25
|
-
|
|
27
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mock Axios headers
|
|
28
|
+
customRules?: { type: string, options: any }[]
|
|
29
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- mock Axios headers
|
|
30
|
+
customWarningRules?: { type: string, options: any }[]
|
|
26
31
|
isDisabled?: boolean
|
|
27
32
|
noIcon?: boolean
|
|
28
33
|
noCalendar?: boolean
|
|
29
34
|
isOutlined?: boolean
|
|
30
35
|
isReadOnly?: boolean
|
|
31
36
|
width?: string
|
|
37
|
+
disableErrorHandling?: boolean
|
|
38
|
+
showSuccessMessages?: boolean
|
|
32
39
|
}>(), {
|
|
33
40
|
modelValue: undefined,
|
|
34
41
|
placeholder: 'Sélectionner une date',
|
|
@@ -49,6 +56,8 @@
|
|
|
49
56
|
isOutlined: true,
|
|
50
57
|
isReadOnly: false,
|
|
51
58
|
width: '100%',
|
|
59
|
+
disableErrorHandling: false,
|
|
60
|
+
showSuccessMessages: true,
|
|
52
61
|
})
|
|
53
62
|
|
|
54
63
|
const emit = defineEmits<{
|
|
@@ -58,94 +67,126 @@
|
|
|
58
67
|
(e: 'blur'): void
|
|
59
68
|
}>()
|
|
60
69
|
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
70
|
+
const selectedDates = ref<Date | Date[] | null>(
|
|
71
|
+
initializeSelectedDates(props.modelValue as DateInput | null, props.format, props.dateFormatReturn),
|
|
72
|
+
)
|
|
64
73
|
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
74
|
+
const isDatePickerVisible = ref(false)
|
|
75
|
+
const validation = useValidation({
|
|
76
|
+
showSuccessMessages: props.showSuccessMessages,
|
|
77
|
+
fieldIdentifier: 'Date',
|
|
78
|
+
customRules: props.customRules,
|
|
79
|
+
warningRules: props.customWarningRules,
|
|
80
|
+
disableErrorHandling: props.disableErrorHandling,
|
|
81
|
+
})
|
|
82
|
+
const { errors, warnings, successes, validateField, clearValidation } = validation
|
|
69
83
|
|
|
70
|
-
|
|
84
|
+
const errorMessages = errors
|
|
85
|
+
const warningMessages = warnings
|
|
86
|
+
const successMessages = successes
|
|
87
|
+
const displayFormattedDate = ref('')
|
|
71
88
|
|
|
72
|
-
|
|
89
|
+
const textInputValue = ref<string>('')
|
|
73
90
|
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
const value = dateParts[index]
|
|
77
|
-
if (part.includes('DD')) day = value
|
|
78
|
-
else if (part.includes('MM')) month = value
|
|
79
|
-
else if (part.includes('YYYY')) year = value
|
|
80
|
-
else if (part.includes('YY')) year = '20' + value // Assumons que nous sommes au 21ème siècle
|
|
81
|
-
})
|
|
91
|
+
// Variable pour éviter les mises à jour récursives
|
|
92
|
+
const isUpdatingFromInternal = ref(false)
|
|
82
93
|
|
|
83
|
-
|
|
84
|
-
|
|
94
|
+
// Déclaration de la fonction validateDates avant son utilisation
|
|
95
|
+
const validateDates = (forceValidation = false) => {
|
|
96
|
+
if (props.noCalendar) {
|
|
97
|
+
// En mode no-calendar, on délègue la validation au DateTextInput
|
|
98
|
+
return
|
|
99
|
+
}
|
|
85
100
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
}
|
|
101
|
+
// Réinitialiser la validation
|
|
102
|
+
clearValidation()
|
|
89
103
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
if (Array.isArray(
|
|
96
|
-
if (
|
|
97
|
-
|
|
98
|
-
// Vérifie si l'une des dates est invalide
|
|
99
|
-
if (dates.some(date => date === null)) {
|
|
100
|
-
return []
|
|
101
|
-
}
|
|
102
|
-
// Vérifie si la première date est après la seconde
|
|
103
|
-
if (dates[0] && dates[1] && dates[0] > dates[1]) {
|
|
104
|
-
return []
|
|
105
|
-
}
|
|
106
|
-
// Filtrer les dates nulles et convertir en tableau de Date
|
|
107
|
-
return dates.filter((date): date is Date => date !== null)
|
|
108
|
-
}
|
|
109
|
-
if (modelValue.length === 1) {
|
|
110
|
-
const date = parseDate(modelValue[0])
|
|
111
|
-
return date === null ? [] : [date]
|
|
104
|
+
// Si la gestion des erreurs est désactivée, on effectue la validation interne
|
|
105
|
+
// mais on n'ajoute pas les messages d'erreur
|
|
106
|
+
const shouldDisplayErrors = !props.disableErrorHandling
|
|
107
|
+
|
|
108
|
+
// Vérifier si le champ est requis et vide
|
|
109
|
+
if ((forceValidation || !isUpdatingFromInternal.value) && props.required && (!selectedDates.value || (Array.isArray(selectedDates.value) && selectedDates.value.length === 0))) {
|
|
110
|
+
if (shouldDisplayErrors) {
|
|
111
|
+
errors.value.push('La date est requise.')
|
|
112
112
|
}
|
|
113
|
-
return
|
|
113
|
+
return
|
|
114
114
|
}
|
|
115
115
|
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
116
|
+
if (!selectedDates.value) return
|
|
117
|
+
|
|
118
|
+
// Préparer les dates à valider
|
|
119
|
+
const datesToValidate = Array.isArray(selectedDates.value)
|
|
120
|
+
? selectedDates.value
|
|
121
|
+
: [selectedDates.value]
|
|
122
|
+
|
|
123
|
+
// Valider chaque date
|
|
124
|
+
if (shouldDisplayErrors) {
|
|
125
|
+
datesToValidate.forEach((date) => {
|
|
126
|
+
validateField(
|
|
127
|
+
date,
|
|
128
|
+
props.customRules,
|
|
129
|
+
props.customWarningRules,
|
|
130
|
+
)
|
|
131
|
+
})
|
|
120
132
|
|
|
121
|
-
|
|
122
|
-
|
|
133
|
+
// Dédoublonner les messages (au cas où plusieurs dates auraient les mêmes messages)
|
|
134
|
+
errors.value = [...new Set(errors.value)]
|
|
135
|
+
warnings.value = [...new Set(warnings.value)]
|
|
136
|
+
successes.value = [...new Set(successes.value)]
|
|
137
|
+
}
|
|
123
138
|
}
|
|
124
139
|
|
|
125
|
-
//
|
|
126
|
-
const
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
const isDatePickerVisible = ref(false)
|
|
131
|
-
const errorMessages = ref<string[]>([])
|
|
132
|
-
const successMessages = ref<string[]>([])
|
|
133
|
-
const warningMessages = ref<string[]>([])
|
|
134
|
-
const displayFormattedDate = ref('')
|
|
140
|
+
// Fonction centralisée pour mettre à jour le modèle
|
|
141
|
+
const updateModel = (value: DateValue) => {
|
|
142
|
+
// Éviter les mises à jour inutiles
|
|
143
|
+
if (JSON.stringify(value) === JSON.stringify(props.modelValue)) return
|
|
135
144
|
|
|
136
|
-
|
|
145
|
+
try {
|
|
146
|
+
isUpdatingFromInternal.value = true
|
|
147
|
+
emit('update:modelValue', value)
|
|
148
|
+
}
|
|
149
|
+
finally {
|
|
150
|
+
// S'assurer que le flag est toujours réinitialisé
|
|
151
|
+
setTimeout(() => {
|
|
152
|
+
isUpdatingFromInternal.value = false
|
|
153
|
+
}, 0)
|
|
154
|
+
}
|
|
155
|
+
}
|
|
137
156
|
|
|
157
|
+
// Watcher pour mettre à jour le modèle lorsque les dates sélectionnées changent
|
|
138
158
|
watch(selectedDates, (newValue) => {
|
|
159
|
+
// Valider les dates
|
|
139
160
|
validateDates()
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
161
|
+
|
|
162
|
+
// Mettre à jour le modèle si nécessaire
|
|
163
|
+
if (newValue !== null) {
|
|
164
|
+
updateModel(formattedDate.value)
|
|
165
|
+
|
|
166
|
+
// Mettre à jour textInputValue pour le DateTextInput
|
|
167
|
+
try {
|
|
168
|
+
isUpdatingFromInternal.value = true
|
|
169
|
+
if (Array.isArray(newValue)) {
|
|
170
|
+
// Pour les plages de dates, utiliser la première date
|
|
171
|
+
if (newValue.length > 0) {
|
|
172
|
+
textInputValue.value = formatDate(newValue[0], props.format)
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
else {
|
|
176
|
+
// Pour une date unique
|
|
177
|
+
textInputValue.value = formatDate(newValue, props.format)
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
finally {
|
|
181
|
+
setTimeout(() => {
|
|
182
|
+
isUpdatingFromInternal.value = false
|
|
183
|
+
}, 0)
|
|
144
184
|
}
|
|
145
185
|
}
|
|
146
186
|
else {
|
|
147
|
-
|
|
148
|
-
|
|
187
|
+
updateModel(null)
|
|
188
|
+
// Réinitialiser textInputValue
|
|
189
|
+
textInputValue.value = ''
|
|
149
190
|
}
|
|
150
191
|
})
|
|
151
192
|
|
|
@@ -160,16 +201,6 @@
|
|
|
160
201
|
'min-width': '100%',
|
|
161
202
|
}))
|
|
162
203
|
|
|
163
|
-
// Formate une date unique au format spécifié
|
|
164
|
-
const formatDate = (date: Date, format: string): string => {
|
|
165
|
-
if (!date) return ''
|
|
166
|
-
const day = date.getDate().toString().padStart(2, '0')
|
|
167
|
-
const month = (date.getMonth() + 1).toString().padStart(2, '0')
|
|
168
|
-
const year = date.getFullYear().toString()
|
|
169
|
-
const shortYear = year.slice(-2)
|
|
170
|
-
return format.replace('YYYY', year).replace('YY', shortYear).replace('MM', month).replace('DD', day)
|
|
171
|
-
}
|
|
172
|
-
|
|
173
204
|
// Date(s) formatée(s) en chaîne de caractères pour la valeur de retour
|
|
174
205
|
const formattedDate = computed<DateValue>(() => {
|
|
175
206
|
if (!selectedDates.value) return ''
|
|
@@ -208,6 +239,9 @@
|
|
|
208
239
|
}, { immediate: true })
|
|
209
240
|
|
|
210
241
|
watch(textInputValue, (newValue) => {
|
|
242
|
+
// Éviter les mises à jour récursives
|
|
243
|
+
if (isUpdatingFromInternal.value) return
|
|
244
|
+
|
|
211
245
|
// Parse la date avec le format d'affichage
|
|
212
246
|
const date = parseDate(newValue, props.format)
|
|
213
247
|
if (date) {
|
|
@@ -215,12 +249,50 @@
|
|
|
215
249
|
const formattedValue = props.dateFormatReturn
|
|
216
250
|
? formatDate(date, props.dateFormatReturn)
|
|
217
251
|
: formatDate(date, props.format)
|
|
218
|
-
|
|
252
|
+
updateModel(formattedValue)
|
|
253
|
+
|
|
254
|
+
// Mettre à jour selectedDates sans déclencher de watchers supplémentaires
|
|
255
|
+
try {
|
|
256
|
+
isUpdatingFromInternal.value = true
|
|
257
|
+
selectedDates.value = date
|
|
258
|
+
// Mettre à jour l'affichage formaté
|
|
259
|
+
displayFormattedDate.value = formatDate(date, props.format)
|
|
260
|
+
}
|
|
261
|
+
finally {
|
|
262
|
+
setTimeout(() => {
|
|
263
|
+
isUpdatingFromInternal.value = false
|
|
264
|
+
}, 0)
|
|
265
|
+
}
|
|
266
|
+
}
|
|
267
|
+
else if (newValue) {
|
|
268
|
+
// Même si la date n'est pas valide, conserver la valeur saisie
|
|
269
|
+
// pour éviter que la date ne disparaisse
|
|
270
|
+
updateModel(newValue)
|
|
271
|
+
// Mettre à jour l'affichage formaté pour qu'il corresponde à ce qui est saisi
|
|
272
|
+
try {
|
|
273
|
+
isUpdatingFromInternal.value = true
|
|
274
|
+
displayFormattedDate.value = newValue
|
|
275
|
+
}
|
|
276
|
+
finally {
|
|
277
|
+
setTimeout(() => {
|
|
278
|
+
isUpdatingFromInternal.value = false
|
|
279
|
+
}, 0)
|
|
280
|
+
}
|
|
219
281
|
}
|
|
220
282
|
else {
|
|
221
|
-
|
|
283
|
+
updateModel(null)
|
|
284
|
+
// Réinitialiser l'affichage formaté
|
|
285
|
+
try {
|
|
286
|
+
isUpdatingFromInternal.value = true
|
|
287
|
+
displayFormattedDate.value = ''
|
|
288
|
+
selectedDates.value = null
|
|
289
|
+
}
|
|
290
|
+
finally {
|
|
291
|
+
setTimeout(() => {
|
|
292
|
+
isUpdatingFromInternal.value = false
|
|
293
|
+
}, 0)
|
|
294
|
+
}
|
|
222
295
|
}
|
|
223
|
-
updateSelectedDates(newValue)
|
|
224
296
|
})
|
|
225
297
|
|
|
226
298
|
// Date(s) formatée(s) en chaîne de caractères pour l'affichage
|
|
@@ -240,16 +312,6 @@
|
|
|
240
312
|
return formatDate(selectedDates.value, props.format)
|
|
241
313
|
})
|
|
242
314
|
|
|
243
|
-
// const validateDateValue = (value: DateValue): DateValue => {
|
|
244
|
-
// if (Array.isArray(value)) {
|
|
245
|
-
// if (value.length >= 2) {
|
|
246
|
-
// return [value[0], value[1]] as [string, string]
|
|
247
|
-
// }
|
|
248
|
-
// return value[0] || ''
|
|
249
|
-
// }
|
|
250
|
-
// return value
|
|
251
|
-
// }
|
|
252
|
-
|
|
253
315
|
watch(displayFormattedDateComputed, (newValue) => {
|
|
254
316
|
if (!props.noCalendar && newValue) {
|
|
255
317
|
displayFormattedDate.value = newValue
|
|
@@ -259,7 +321,7 @@
|
|
|
259
321
|
const updateSelectedDates = (input: DateValue) => {
|
|
260
322
|
if (Array.isArray(input)) {
|
|
261
323
|
const dates = input
|
|
262
|
-
.map(date => (date ? parseDate(date) : null))
|
|
324
|
+
.map(date => (date ? parseDate(date, props.format) : null))
|
|
263
325
|
.filter((date): date is Date => date !== null)
|
|
264
326
|
|
|
265
327
|
if (dates.length === 0) {
|
|
@@ -271,7 +333,7 @@
|
|
|
271
333
|
return
|
|
272
334
|
}
|
|
273
335
|
|
|
274
|
-
const date = input ? parseDate(input) : null
|
|
336
|
+
const date = input ? parseDate(input, props.format) : null
|
|
275
337
|
selectedDates.value = date === null ? null : date
|
|
276
338
|
}
|
|
277
339
|
|
|
@@ -284,8 +346,6 @@
|
|
|
284
346
|
|
|
285
347
|
// Si on clique dans le conteneur du DatePicker, on ne fait rien
|
|
286
348
|
if (container) return
|
|
287
|
-
|
|
288
|
-
isDatePickerVisible.value = false
|
|
289
349
|
emit('closed')
|
|
290
350
|
// Déclencher la validation à la fermeture
|
|
291
351
|
validateDates()
|
|
@@ -301,17 +361,14 @@
|
|
|
301
361
|
|
|
302
362
|
onMounted(() => {
|
|
303
363
|
document.addEventListener('click', handleClickOutside)
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
}
|
|
307
|
-
if (selectedDates.value !== null) {
|
|
308
|
-
validateDates()
|
|
309
|
-
// Force format application on mount
|
|
310
|
-
emit('update:modelValue', formattedDate.value)
|
|
311
|
-
}
|
|
364
|
+
|
|
365
|
+
// Initialiser l'affichage formaté
|
|
312
366
|
if (displayFormattedDateComputed.value) {
|
|
313
367
|
displayFormattedDate.value = displayFormattedDateComputed.value
|
|
314
368
|
}
|
|
369
|
+
|
|
370
|
+
// Valider les dates au montage
|
|
371
|
+
validateDates()
|
|
315
372
|
})
|
|
316
373
|
|
|
317
374
|
onBeforeUnmount(() => {
|
|
@@ -324,117 +381,62 @@
|
|
|
324
381
|
if (props.noCalendar) {
|
|
325
382
|
return dateTextInputRef.value?.validateOnSubmit()
|
|
326
383
|
}
|
|
327
|
-
|
|
328
|
-
|
|
384
|
+
// Forcer la validation pour ignorer les conditions de validation interactive
|
|
385
|
+
validateDates(true)
|
|
386
|
+
// Retourner directement un booléen pour maintenir la compatibilité avec les tests existants
|
|
387
|
+
return errors.value.length === 0
|
|
329
388
|
}
|
|
330
389
|
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
isDatePickerVisible,
|
|
334
|
-
selectedDates,
|
|
335
|
-
errorMessages,
|
|
336
|
-
handleClickOutside,
|
|
337
|
-
initializeSelectedDates,
|
|
338
|
-
})
|
|
390
|
+
const showDatePicker = () => {
|
|
391
|
+
if (props.isDisabled || props.isReadOnly) return
|
|
339
392
|
|
|
340
|
-
// les btns du date picker ne sont pas accessibles, on les rend accessibles
|
|
341
|
-
watch(isDatePickerVisible, async (newValue) => {
|
|
342
|
-
if (newValue) {
|
|
343
|
-
await nextTick()
|
|
344
|
-
const arrowDown = document.querySelector('.v-btn.v-btn--icon.v-theme--light.v-btn--density-comfortable.v-btn--size-default.v-btn--variant-text.v-date-picker-controls__mode-btn')
|
|
345
|
-
const arrowLeftButtons = document.querySelectorAll('.v-btn.v-btn--icon.v-theme--light.v-btn--density-default.v-btn--size-default.v-btn--variant-text')
|
|
346
|
-
|
|
347
|
-
if (arrowDown) {
|
|
348
|
-
arrowDown.setAttribute('aria-label', 'Fleche vers le bas')
|
|
349
|
-
}
|
|
350
|
-
|
|
351
|
-
arrowLeftButtons.forEach((button, index) => {
|
|
352
|
-
if (index === 0) {
|
|
353
|
-
button.setAttribute('aria-label', 'Fleche vers la gauche')
|
|
354
|
-
}
|
|
355
|
-
else if (index === 1) {
|
|
356
|
-
button.setAttribute('aria-label', 'Fleche vers la droite')
|
|
357
|
-
}
|
|
358
|
-
})
|
|
359
|
-
}
|
|
360
|
-
})
|
|
361
|
-
|
|
362
|
-
const handlePrependIconClick = () => {
|
|
363
393
|
isDatePickerVisible.value = true
|
|
364
|
-
}
|
|
365
394
|
|
|
366
|
-
|
|
367
|
-
|
|
395
|
+
// Mettre à jour l'accessibilité après l'ouverture du DatePicker
|
|
396
|
+
nextTick(() => {
|
|
397
|
+
updateAccessibility()
|
|
398
|
+
})
|
|
368
399
|
}
|
|
369
400
|
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
const customWarningRules = ref<Rule[]>(props.customWarningRules || [])
|
|
401
|
+
const openDatePicker = () => {
|
|
402
|
+
showDatePicker()
|
|
403
|
+
}
|
|
374
404
|
|
|
375
|
-
|
|
376
|
-
const validationRules = generateRules(customRules.value)
|
|
377
|
-
const warningValidationRules = generateRules(customWarningRules.value)
|
|
405
|
+
type ViewMode = 'month' | 'year' | 'months' | undefined
|
|
378
406
|
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
successMessages.value = []
|
|
382
|
-
warningMessages.value = []
|
|
407
|
+
// Variable pour suivre le mode d'affichage actuel du DatePicker
|
|
408
|
+
const currentViewMode = ref<ViewMode>(props.isBirthDate ? 'year' : 'month')
|
|
383
409
|
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
410
|
+
// Fonction pour gérer le changement de mode d'affichage
|
|
411
|
+
const handleViewModeUpdate = (newMode: ViewMode) => {
|
|
412
|
+
currentViewMode.value = newMode
|
|
413
|
+
}
|
|
388
414
|
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
errorMessages.value.push(result.error)
|
|
395
|
-
errorMessages.value = [...new Set(errorMessages.value)]
|
|
396
|
-
}
|
|
397
|
-
else if (result?.warning) {
|
|
398
|
-
warningMessages.value.push(result.warning)
|
|
399
|
-
warningMessages.value = [...new Set(warningMessages.value)]
|
|
400
|
-
}
|
|
401
|
-
else if (result?.success) {
|
|
402
|
-
successMessages.value.push(result.success)
|
|
403
|
-
successMessages.value = [...new Set(successMessages.value)]
|
|
404
|
-
}
|
|
405
|
-
})
|
|
406
|
-
})
|
|
415
|
+
// Fonction pour gérer la sélection de l'année quand isBirthDate est true
|
|
416
|
+
const handleYearUpdate = () => {
|
|
417
|
+
if (props.isBirthDate) {
|
|
418
|
+
// Après la sélection de l'année, passer automatiquement à la sélection du mois
|
|
419
|
+
currentViewMode.value = 'months'
|
|
407
420
|
}
|
|
421
|
+
}
|
|
408
422
|
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
const datesToValidate = [firstDate, lastDate]
|
|
415
|
-
|
|
416
|
-
// Validation des règles
|
|
417
|
-
addMessages(datesToValidate, validationRules)
|
|
418
|
-
addMessages(datesToValidate, warningValidationRules)
|
|
419
|
-
}
|
|
420
|
-
else {
|
|
421
|
-
// Pour une date unique, on valide normalement
|
|
422
|
-
const datesToValidate = Array.isArray(dates) ? dates : [dates]
|
|
423
|
-
addMessages(datesToValidate, validationRules)
|
|
424
|
-
addMessages(datesToValidate, warningValidationRules)
|
|
425
|
-
}
|
|
423
|
+
// Fonction pour gérer la sélection du mois quand isBirthDate est true
|
|
424
|
+
const handleMonthUpdate = () => {
|
|
425
|
+
if (props.isBirthDate) {
|
|
426
|
+
// Après la sélection du mois, passer automatiquement à la sélection du jour
|
|
427
|
+
currentViewMode.value = undefined
|
|
426
428
|
}
|
|
429
|
+
}
|
|
427
430
|
|
|
428
|
-
|
|
429
|
-
|
|
431
|
+
watch(isDatePickerVisible, (isVisible) => {
|
|
432
|
+
if (!isVisible && props.isBirthDate) {
|
|
433
|
+
// Réinitialiser le mode d'affichage au type birthdate
|
|
434
|
+
currentViewMode.value = 'year'
|
|
430
435
|
}
|
|
431
|
-
|
|
432
|
-
handleValidation(Array.isArray(selectedDates.value) ? selectedDates.value : [selectedDates.value])
|
|
433
|
-
}
|
|
434
|
-
}
|
|
436
|
+
})
|
|
435
437
|
|
|
436
438
|
const getIcon = () => {
|
|
437
|
-
if (props.noCalendar) {
|
|
439
|
+
if (props.noCalendar || props.disableErrorHandling) {
|
|
438
440
|
return
|
|
439
441
|
}
|
|
440
442
|
switch (true) {
|
|
@@ -449,17 +451,65 @@
|
|
|
449
451
|
}
|
|
450
452
|
}
|
|
451
453
|
|
|
452
|
-
|
|
453
|
-
watch(() => props.modelValue, (newValue) => {
|
|
454
|
+
const syncFromModelValue = (newValue: DateInput | undefined) => {
|
|
454
455
|
if (!newValue || newValue === '') {
|
|
455
456
|
selectedDates.value = null
|
|
456
457
|
textInputValue.value = ''
|
|
457
458
|
displayFormattedDate.value = ''
|
|
459
|
+
validateDates()
|
|
460
|
+
return
|
|
458
461
|
}
|
|
459
|
-
|
|
460
|
-
|
|
462
|
+
|
|
463
|
+
selectedDates.value = initializeSelectedDates(newValue, props.format, props.dateFormatReturn)
|
|
464
|
+
|
|
465
|
+
if (selectedDates.value) {
|
|
466
|
+
const firstDate = Array.isArray(selectedDates.value)
|
|
467
|
+
? selectedDates.value[0]
|
|
468
|
+
: selectedDates.value
|
|
469
|
+
|
|
470
|
+
textInputValue.value = formatDate(firstDate, props.format)
|
|
471
|
+
displayFormattedDate.value = displayFormattedDateComputed.value || ''
|
|
472
|
+
}
|
|
473
|
+
|
|
474
|
+
validateDates()
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
watch(() => props.modelValue, (newValue) => {
|
|
478
|
+
if (isUpdatingFromInternal.value) {
|
|
479
|
+
if (props.displayRange) {
|
|
480
|
+
if (Array.isArray(newValue) && newValue.length >= 2) {
|
|
481
|
+
isDatePickerVisible.value = false
|
|
482
|
+
emit('closed')
|
|
483
|
+
}
|
|
484
|
+
}
|
|
485
|
+
else {
|
|
486
|
+
isDatePickerVisible.value = false
|
|
487
|
+
emit('closed')
|
|
488
|
+
}
|
|
489
|
+
return
|
|
490
|
+
}
|
|
491
|
+
|
|
492
|
+
try {
|
|
493
|
+
isUpdatingFromInternal.value = true
|
|
494
|
+
syncFromModelValue(newValue)
|
|
495
|
+
}
|
|
496
|
+
finally {
|
|
497
|
+
setTimeout(() => {
|
|
498
|
+
isUpdatingFromInternal.value = false
|
|
499
|
+
}, 0)
|
|
461
500
|
}
|
|
462
501
|
}, { immediate: true })
|
|
502
|
+
|
|
503
|
+
defineExpose({
|
|
504
|
+
validateOnSubmit,
|
|
505
|
+
isDatePickerVisible,
|
|
506
|
+
selectedDates,
|
|
507
|
+
errorMessages,
|
|
508
|
+
handleClickOutside,
|
|
509
|
+
initializeSelectedDates,
|
|
510
|
+
updateAccessibility,
|
|
511
|
+
openDatePicker,
|
|
512
|
+
})
|
|
463
513
|
</script>
|
|
464
514
|
|
|
465
515
|
<template>
|
|
@@ -486,6 +536,8 @@
|
|
|
486
536
|
:display-append-icon="props.displayAppendIcon"
|
|
487
537
|
:display-prepend-icon="props.displayPrependIcon"
|
|
488
538
|
:no-icon="props.noIcon"
|
|
539
|
+
:disable-error-handling="props.disableErrorHandling"
|
|
540
|
+
:show-success-messages="props.showSuccessMessages"
|
|
489
541
|
title="Date text input"
|
|
490
542
|
@focus="emit('focus')"
|
|
491
543
|
@blur="emit('blur')"
|
|
@@ -499,7 +551,7 @@
|
|
|
499
551
|
:class="[getMessageClasses(), 'label-hidden-on-focus']"
|
|
500
552
|
:error-messages="errorMessages"
|
|
501
553
|
:warning-messages="warningMessages"
|
|
502
|
-
:success-messages="successMessages"
|
|
554
|
+
:success-messages="props.showSuccessMessages ? successMessages : []"
|
|
503
555
|
:is-disabled="props.isDisabled"
|
|
504
556
|
:is-read-only="true"
|
|
505
557
|
:label="props.placeholder"
|
|
@@ -507,37 +559,54 @@
|
|
|
507
559
|
:prepend-icon="displayIcon && !displayAppendIcon ? 'calendar' : undefined"
|
|
508
560
|
:variant-style="props.isOutlined ? 'outlined' : 'underlined'"
|
|
509
561
|
color="primary"
|
|
562
|
+
:show-success-messages="props.showSuccessMessages"
|
|
510
563
|
is-clearable
|
|
511
564
|
title="Date Picker"
|
|
512
|
-
@focus="
|
|
565
|
+
@focus="openDatePicker"
|
|
513
566
|
@update:model-value="updateSelectedDates"
|
|
514
|
-
@prepend-icon-click="
|
|
515
|
-
@append-icon-click="
|
|
567
|
+
@prepend-icon-click="openDatePicker"
|
|
568
|
+
@append-icon-click="openDatePicker"
|
|
516
569
|
/>
|
|
517
570
|
</template>
|
|
518
|
-
<
|
|
519
|
-
<
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
|
|
524
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
571
|
+
<div>
|
|
572
|
+
<VMenu
|
|
573
|
+
v-if="!props.noCalendar"
|
|
574
|
+
v-model="isDatePickerVisible"
|
|
575
|
+
activator="parent"
|
|
576
|
+
:min-width="0"
|
|
577
|
+
location="bottom"
|
|
578
|
+
:close-on-content-click="false"
|
|
579
|
+
:open-on-click="false"
|
|
580
|
+
transition="fade-transition"
|
|
581
|
+
attach="body"
|
|
582
|
+
:offset="[-20, 5]"
|
|
583
|
+
>
|
|
584
|
+
<transition name="fade">
|
|
585
|
+
<VDatePicker
|
|
586
|
+
v-if="isDatePickerVisible && !props.noCalendar"
|
|
587
|
+
v-model="selectedDates"
|
|
588
|
+
color="primary"
|
|
589
|
+
:first-day-of-week="1"
|
|
590
|
+
:multiple="props.displayRange ? 'range' : false"
|
|
591
|
+
:show-adjacent-months="true"
|
|
592
|
+
:show-week="props.showWeekNumber"
|
|
593
|
+
:view-mode="currentViewMode"
|
|
594
|
+
@update:view-mode="handleViewModeUpdate"
|
|
595
|
+
@update:year="handleYearUpdate"
|
|
596
|
+
@update:month="handleMonthUpdate"
|
|
597
|
+
>
|
|
598
|
+
<template #title>
|
|
599
|
+
Sélectionnez une date
|
|
600
|
+
</template>
|
|
601
|
+
<template #header>
|
|
602
|
+
<h3 class="mx-auto my-auto ml-5 mb-4">
|
|
603
|
+
{{ todayInString }}
|
|
604
|
+
</h3>
|
|
605
|
+
</template>
|
|
606
|
+
</VDatePicker>
|
|
607
|
+
</transition>
|
|
608
|
+
</VMenu>
|
|
609
|
+
</div>
|
|
541
610
|
</div>
|
|
542
611
|
</template>
|
|
543
612
|
|