@cnamts/synapse 1.0.23 → 1.0.24
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/AutocompleteFilter-BWLR3U7W.js +114 -0
- package/dist/AutocompleteFilter-D9jzRzAL.cjs +1 -0
- package/dist/{DateFilter-Dc-gSGwk.js → DateFilter-BpwFexzi.js} +1 -1
- package/dist/DateFilter-DTUl8hb1.cjs +1 -0
- package/dist/{NumberFilter-vP38Wp6j.js → NumberFilter-Bz_NTdX9.js} +3 -3
- package/dist/NumberFilter-MAEojdk0.cjs +1 -0
- package/dist/PeriodFilter-CC4WgIhl.cjs +1 -0
- package/dist/{PeriodFilter-Ba1uYUnT.js → PeriodFilter-DX_wy9g-.js} +1 -1
- package/dist/SelectFilter-BR3fvl-a.cjs +1 -0
- package/dist/SelectFilter-xqiPtPgX.js +135 -0
- package/dist/{TextFilter-B84dpnoq.js → TextFilter-BBl3JFqK.js} +7 -7
- package/dist/TextFilter-CCfYFl5F.cjs +1 -0
- package/dist/apLightTheme-CFSRrjv2.cjs +1 -0
- package/dist/apLightTheme-D1P4jcD0.js +1231 -0
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +7022 -9616
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarousel.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/AmeliproPostalAddressCityRow.d.ts +40 -40
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressField.d.ts +60 -60
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +7168 -9762
- package/dist/components/Amelipro/AmeliproStepper/AmeliproStepper.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +7501 -10095
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +21 -21
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +41 -41
- package/dist/components/Amelipro/StructureMenu/StructureTabs/StructureTabs.d.ts +2 -2
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +20 -498
- package/dist/components/Customs/Selects/SyAutocomplete/SyAutocomplete.d.ts +108 -146
- package/dist/components/Customs/Selects/SyInputSelect/SyInputSelect.d.ts +5 -5
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +12 -16
- package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +8 -8
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +28 -506
- package/dist/components/Customs/SyRadioGroup/SyRadioGroup.d.ts +28 -506
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +65 -85
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +627 -771
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +315 -402
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +112 -155
- package/dist/components/DatePicker/composables/index.d.ts +1 -0
- package/dist/components/DatePicker/composables/useDatePickerFocusTrap.d.ts +11 -0
- package/dist/components/DatePicker/composables/useDateTextField.d.ts +4 -4
- package/dist/components/DatePicker/composables/useDateValidation.d.ts +3 -3
- package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +2 -2
- package/dist/components/DatePicker/composables/useManualDateValidation.d.ts +2 -2
- package/dist/components/HeaderNavigationBar/HeaderNavigationBar.d.ts +4 -4
- package/dist/components/HeaderToolbar/HeaderToolbar.d.ts +20 -28
- package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +3 -3
- package/dist/components/MonthPicker/MonthPicker.d.ts +86 -122
- package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +85 -121
- package/dist/components/NirField/NirField.d.ts +206 -270
- package/dist/components/NirField/locales.d.ts +10 -10
- package/dist/components/NirField/useNirValidation.d.ts +64 -0
- package/dist/components/PasswordField/PasswordField.d.ts +8 -9
- package/dist/components/PeriodField/PeriodField.d.ts +1352 -1640
- package/dist/components/PhoneField/PhoneField.d.ts +88 -124
- package/dist/components/RangeField/RangeSlider/RangeSlider.d.ts +12 -12
- package/dist/components/SyTextArea/SyTextArea.d.ts +34 -14
- package/dist/components/SyTextArea/useDefaultValidationRules.d.ts +11 -0
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +9 -6
- package/dist/components/Tables/SyTable/SyTable.d.ts +9 -6
- package/dist/components/Tables/common/SyTableFilter.d.ts +2 -3
- package/dist/components/Tables/common/SyTablePagination.d.ts +17 -19
- package/dist/components/Tables/common/filters/AutocompleteFilter.d.ts +120 -0
- package/dist/components/Tables/common/filters/locales.d.ts +0 -1
- package/dist/components/Tables/common/types.d.ts +19 -3
- package/dist/components/Tables/common/useClickableTableRow.d.ts +17 -0
- package/dist/components/Tables/common/usePagination.d.ts +3 -1
- package/dist/components/Tables/common/usePinnedColumns.d.ts +31 -0
- package/dist/components/Tables/common/useTableHeaders.d.ts +2 -0
- package/dist/components/Tables/common/useTableRowCheckboxAccessibility.d.ts +5 -0
- package/dist/components/UploadWorkflow/UploadWorkflow.d.ts +6 -6
- package/dist/composables/date/useDatePickerAccessibility.d.ts +1 -1
- package/dist/composables/rules/useFieldValidation.d.ts +4 -4
- package/dist/composables/unifyValidation/useCustomValidation.d.ts +8 -0
- package/dist/composables/unifyValidation/useValidation.d.ts +102 -0
- package/dist/composables/unifyValidation/useVuetifyValidation.d.ts +18 -0
- package/dist/composables/useFormFieldErrorHandling.d.ts +2 -2
- package/dist/composables/validation/useFormValidation.d.ts +11 -2
- package/dist/composables/validation/useValidation.d.ts +15 -9
- package/dist/design-system-v3.d.ts +2 -0
- package/dist/design-system-v3.js +186 -187
- package/dist/design-system-v3.umd.cjs +1 -1066
- package/dist/{main-aLKwdMi1.js → main-BtTqyn4z.js} +16434 -15672
- package/dist/main-C1e3eoxd.cjs +1067 -0
- package/dist/main.d.ts +0 -1
- package/dist/synapse.css +1 -0
- package/dist/tooth-11-D3sLWv2n.cjs +1 -0
- package/dist/tooth-12-CXrLuH03.cjs +1 -0
- package/dist/tooth-13-BSfo5fpT.cjs +1 -0
- package/dist/tooth-14-DMzulx0h.cjs +1 -0
- package/dist/tooth-15-BKRFVi-9.cjs +1 -0
- package/dist/tooth-16-CpuxAbuM.cjs +1 -0
- package/dist/tooth-17-BPoahUdg.cjs +1 -0
- package/dist/tooth-18-DhHJz8sy.cjs +1 -0
- package/dist/tooth-21-Dgd5hn_X.cjs +1 -0
- package/dist/tooth-22-C2Tn19sB.cjs +1 -0
- package/dist/tooth-23-C9uaaSGb.cjs +1 -0
- package/dist/tooth-24-BrK9UGpf.cjs +1 -0
- package/dist/tooth-25-CE_EfGNp.cjs +1 -0
- package/dist/tooth-26-Ctv4i9Fy.cjs +1 -0
- package/dist/tooth-27-C5J7JkWM.cjs +1 -0
- package/dist/tooth-28-Z9oWqjo0.cjs +1 -0
- package/dist/tooth-31-BrYqmkTi.cjs +1 -0
- package/dist/tooth-32-BNNR0oCZ.cjs +1 -0
- package/dist/tooth-33-DuxvqO2J.cjs +1 -0
- package/dist/tooth-34-BCSCXMB6.cjs +1 -0
- package/dist/tooth-35-BLUXkX88.cjs +1 -0
- package/dist/tooth-36-IrKHYqlA.cjs +1 -0
- package/dist/tooth-37-BYqpdMwo.cjs +1 -0
- package/dist/tooth-38-B_eNXXdu.cjs +1 -0
- package/dist/tooth-41-Ddva4Ot8.cjs +1 -0
- package/dist/tooth-42-szcDqlM0.cjs +1 -0
- package/dist/tooth-43-B3ka6rQm.cjs +1 -0
- package/dist/tooth-44-CazyQucj.cjs +1 -0
- package/dist/tooth-45-B4HQtc8n.cjs +1 -0
- package/dist/tooth-46-BPM40gbG.cjs +1 -0
- package/dist/tooth-47-Dvr20dlh.cjs +1 -0
- package/dist/tooth-48-Bd8ljGsF.cjs +1 -0
- package/dist/tooth-51-OBpwCOF3.cjs +1 -0
- package/dist/tooth-52-aKxyHcmq.cjs +1 -0
- package/dist/tooth-53-vCwJjTOc.cjs +1 -0
- package/dist/tooth-54-DsWu2iFy.cjs +1 -0
- package/dist/tooth-55-BxC1X2Dn.cjs +1 -0
- package/dist/tooth-61-BbLvxMQi.cjs +1 -0
- package/dist/tooth-62-CmTkWczP.cjs +1 -0
- package/dist/tooth-63-DI7l_2qI.cjs +1 -0
- package/dist/tooth-64-B21sOsJh.cjs +1 -0
- package/dist/tooth-65-D2ZC2VEr.cjs +1 -0
- package/dist/tooth-71-D473PPO5.cjs +1 -0
- package/dist/tooth-72-Drh1wnNu.cjs +1 -0
- package/dist/tooth-73-DzlwYI23.cjs +1 -0
- package/dist/tooth-74-8aGvcZPg.cjs +1 -0
- package/dist/tooth-75-BFK7At_r.cjs +1 -0
- package/dist/tooth-81-BZmR-I0M.cjs +1 -0
- package/dist/tooth-82-euVfUUZV.cjs +1 -0
- package/dist/tooth-83-KV010j64.cjs +1 -0
- package/dist/tooth-84-BBg1RjhZ.cjs +1 -0
- package/dist/tooth-85-Cr-kc1wM.cjs +1 -0
- package/dist/vuetifyConfig.js +561 -0
- package/dist/vuetifyConfig.umd.cjs +1 -0
- package/package.json +10 -4
- package/src/assets/overrides/_btns.scss +0 -6
- package/src/assets/overrides/_icons.scss +9 -1
- package/src/assets/overrides/_typography.scss +0 -10
- package/src/components/Amelipro/AmeliproAutoCompleteField/__tests__/__snapshots__/AmeliproAutoCompleteField.spec.ts.snap +2 -2
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/__tests__/__snapshots__/AmeliproHeaderBrandSection.spec.ts.snap +1 -1
- package/src/components/Amelipro/AmeliproTextArea/__tests__/__snapshots__/AmeliproTextArea.spec.ts.snap +2 -2
- package/src/components/Captcha/accessibilite/Accessibility.mdx +86 -8
- package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +12 -12
- package/src/components/ChipList/ChipList.stories.ts +0 -15
- package/src/components/ChipList/ChipList.vue +5 -1
- package/src/components/ChipList/accessibilite/Accessibility.mdx +83 -10
- package/src/components/ChipList/tests/ChipList.a11y.spec.ts +41 -0
- package/src/components/Customs/Selects/SelectBtnField/accessibilite/Accessibility.mdx +0 -9
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.vue +22 -5
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.spec.ts +143 -0
- package/src/components/Customs/Selects/SyAutocomplete/utils/ariaManager.ts +14 -10
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.stories.ts +4 -4
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.vue +8 -9
- package/src/components/Customs/Selects/SyInputSelect/tests/SyInputSelect.spec.ts +10 -10
- package/src/components/Customs/Selects/SySelect/SySelect.vue +14 -11
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +54 -0
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +6 -9
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +10 -16
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +16 -11
- package/src/components/Customs/SyCheckbox/accessibilite/Accessibility.mdx +35 -0
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.a11y.spec.ts +134 -2
- package/src/components/Customs/SyForm/SyForm.stories.ts +31 -5
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.vue +4 -7
- package/src/components/Customs/SyTextField/SyTextField.mdx +1 -1
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +29 -27
- package/src/components/Customs/SyTextField/SyTextField.vue +154 -157
- package/src/components/Customs/SyTextField/tests/SyTextField.a11y.spec.ts +32 -0
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +120 -11
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +62 -58
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +330 -223
- package/src/components/DatePicker/CalendarMode/accessibilite/Accessibility.mdx +82 -0
- package/src/components/DatePicker/CalendarMode/tests/DatePicker.a11y.spec.ts +141 -0
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +2 -56
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +195 -159
- package/src/components/DatePicker/ComplexDatePicker/accessibilite/Accessibility.mdx +76 -0
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +10 -10
- package/src/components/DatePicker/DatePickerValidationExample/CalendarMode.stories.ts +8 -8
- package/src/components/DatePicker/DatePickerValidationExample/ComplexDatePicker.stories.ts +106 -8
- package/src/components/DatePicker/DatePickerValidationExample/DateTextInput.stories.ts +12 -11
- package/src/components/DatePicker/DatePickerValidationExample/MultiMode.stories.ts +12 -12
- package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +0 -12
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +63 -57
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +3 -0
- package/src/components/DatePicker/DateTextInput/accessibilite/Accessibility.mdx +66 -0
- package/src/components/DatePicker/DateTextInput/tests/DateTextInput.spec.ts +52 -1
- package/src/components/DatePicker/composables/index.ts +1 -0
- package/src/components/DatePicker/composables/tests/useCalendarKeyboardNavigation.spec.ts +109 -65
- package/src/components/DatePicker/composables/tests/useDatePickerFocusTrap.spec.ts +138 -0
- package/src/components/DatePicker/composables/tests/useDateValidation.spec.ts +74 -18
- package/src/components/DatePicker/composables/tests/useInputBlurHandler.spec.ts +39 -0
- package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +91 -0
- package/src/components/DatePicker/composables/useCalendarKeyboardNavigation.ts +442 -36
- package/src/components/DatePicker/composables/useDatePickerFocusTrap.ts +92 -0
- package/src/components/DatePicker/composables/useDateTextField.ts +7 -6
- package/src/components/DatePicker/composables/useDateValidation.ts +36 -35
- package/src/components/DatePicker/composables/useInputBlurHandler.ts +3 -3
- package/src/components/DatePicker/composables/useManualDateValidation.ts +6 -2
- package/src/components/DiacriticPicker/accessibilite/Accessibility.mdx +76 -8
- package/src/components/HeaderBar/HeaderBar.stories.ts +14 -2
- package/src/components/Logo/accessibilite/Accessibility.mdx +73 -11
- package/src/components/LogoBrandSection/accessibilite/Accessibility.mdx +85 -9
- package/src/components/LunarCalendar/tests/LunarCalendar.spec.ts +3 -1
- package/src/components/LunarCalendar/useLunarCalendarValidation.ts +4 -5
- package/src/components/MonthPicker/tests/MonthPicker.spec.ts +2 -1
- package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +7 -7
- package/src/components/NirField/NirField.stories.ts +4 -0
- package/src/components/NirField/NirField.vue +64 -260
- package/src/components/NirField/accessibilite/Accessibility.mdx +2 -2
- package/src/components/NirField/locales.ts +1 -1
- package/src/components/NirField/tests/NirField.spec.ts +6 -0
- package/src/components/NirField/useNirValidation.ts +271 -0
- package/src/components/PasswordField/PasswordField.stories.ts +4 -4
- package/src/components/PasswordField/PasswordField.vue +18 -24
- package/src/components/PasswordField/tests/PasswordField.spec.ts +6 -3
- package/src/components/PeriodField/PeriodField.stories.ts +4 -4
- package/src/components/PeriodField/PeriodField.vue +57 -57
- package/src/components/PeriodField/__tests__/PeriodField.async.spec.ts +32 -0
- package/src/components/PeriodField/accessibilite/Accessibility.mdx +68 -8
- package/src/components/PeriodField/tests/PeriodField.spec.ts +28 -2
- package/src/components/PhoneField/PhoneField.vue +5 -6
- package/src/components/PhoneField/tests/PhoneField.spec.ts +1 -0
- package/src/components/RangeField/RangeField.vue +6 -0
- package/src/components/SyTextArea/SyTextArea.stories.ts +138 -2
- package/src/components/SyTextArea/SyTextArea.vue +53 -23
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +126 -3
- package/src/components/SyTextArea/useDefaultValidationRules.ts +74 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +25 -0
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +673 -1
- package/src/components/Tables/SyServerTable/SyServerTable.vue +148 -91
- package/src/components/Tables/SyServerTable/tests/SyServerTable.a11y.spec.ts +58 -0
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +122 -0
- package/src/components/Tables/SyTable/SyTable.mdx +25 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +452 -1
- package/src/components/Tables/SyTable/SyTable.vue +130 -56
- package/src/components/Tables/SyTable/tests/SyTable.a11y.spec.ts +57 -0
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +108 -0
- package/src/components/Tables/common/SyTableFilter.vue +22 -2
- package/src/components/Tables/common/TableHeader.vue +5 -1
- package/src/components/Tables/common/filters/AutocompleteFilter.vue +160 -0
- package/src/components/Tables/common/filters/NumberFilter.vue +1 -1
- package/src/components/Tables/common/filters/SelectFilter.vue +10 -11
- package/src/components/Tables/common/filters/TextFilter.vue +1 -1
- package/src/components/Tables/common/filters/getFilterComponent.ts +8 -1
- package/src/components/Tables/common/filters/locales.ts +0 -1
- package/src/components/Tables/common/filters/tests/AutocompleteFilter.a11y.spec.ts +110 -0
- package/src/components/Tables/common/filters/tests/AutocompleteFilter.spec.ts +203 -0
- package/src/components/Tables/common/filters/tests/SelectFilter.a11y.spec.ts +104 -0
- package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +152 -16
- package/src/components/Tables/common/tableFilterUtils.ts +3 -0
- package/src/components/Tables/common/tableStyles.scss +48 -4
- package/src/components/Tables/common/tests/filterByRange.spec.ts +2 -1
- package/src/components/Tables/common/types.ts +13 -4
- package/src/components/Tables/common/useClickableTableRow.ts +103 -0
- package/src/components/Tables/common/usePagination.ts +13 -0
- package/src/components/Tables/common/usePinnedColumns.ts +237 -0
- package/src/components/Tables/common/useTableHeaders.ts +3 -3
- package/src/components/Tables/common/useTableRowCheckboxAccessibility.ts +41 -0
- package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +2 -6
- package/src/composables/date/useDatePickerAccessibility.ts +42 -207
- package/src/composables/rules/tests/useFieldValidation.spec.ts +120 -120
- package/src/composables/rules/useFieldValidation.ts +34 -17
- package/src/composables/unifyValidation/tests/useCustomValidation.spec.ts +601 -0
- package/src/composables/unifyValidation/tests/useValidation.spec.ts +2048 -0
- package/src/composables/unifyValidation/tests/useVuetifyValidation.spec.ts +184 -0
- package/src/composables/unifyValidation/useCustomValidation.ts +95 -0
- package/src/composables/unifyValidation/useValidation.ts +190 -0
- package/src/composables/unifyValidation/useVuetifyValidation.ts +54 -0
- package/src/composables/useFormFieldErrorHandling.ts +4 -7
- package/src/composables/validation/tests/useFormValidation.spec.ts +14 -0
- package/src/composables/validation/tests/useValidation.spec.ts +116 -21
- package/src/composables/validation/useFormValidation.ts +20 -13
- package/src/composables/validation/useValidatable.ts +8 -1
- package/src/composables/validation/useValidation.ts +135 -99
- package/src/composantsVuetify/Introduction.mdx +48 -0
- package/src/composantsVuetify/VBtn/VBtn.mdx +72 -0
- package/src/composantsVuetify/VBtn/v-btn.stories.ts +121 -0
- package/src/composantsVuetify/VTooltip/VTooltip.mdx +32 -0
- package/src/composantsVuetify/VTooltip/v-tooltip.stories.ts +95 -0
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +2 -2
- package/src/main.ts +0 -2
- package/src/stories/Components/Components.stories.ts +74 -9
- package/src/stories/Demarrer/Accueil.stories.ts +3 -3
- package/src/stories/GuideDuDev/Amelipro.mdx +15 -0
- package/src/stories/GuideDuDev/Amelipro.stories.ts +209 -0
- package/src/stories/GuideDuDev/vuetifyOptions.mdx +3 -3
- package/dist/SelectFilter-BioGT6Nn.js +0 -136
- package/dist/style.css +0 -1
- package/src/components/DatePicker/Accessibilite.mdx +0 -14
|
@@ -4,12 +4,12 @@
|
|
|
4
4
|
import DateTextInput from '../DateTextInput/DateTextInput.vue'
|
|
5
5
|
import ComplexDatePicker from '../ComplexDatePicker/ComplexDatePicker.vue'
|
|
6
6
|
import { VDatePicker } from 'vuetify/components'
|
|
7
|
-
import { useValidation, type ValidationResult } from '@/composables/validation/useValidation'
|
|
7
|
+
import { useValidation, type ValidationResult, type ValidationRule } from '@/composables/validation/useValidation'
|
|
8
8
|
import { useValidatable } from '@/composables/validation/useValidatable'
|
|
9
9
|
import { useDateFormat } from '@/composables/date/useDateFormatDayjs'
|
|
10
10
|
import { useDateInitialization, type DateValue, type DateInput } from '@/composables/date/useDateInitializationDayjs'
|
|
11
11
|
import { useDatePickerAccessibility } from '@/composables/date/useDatePickerAccessibility'
|
|
12
|
-
import { useWeekendDays, useTodayButton, useDatePickerViewMode, useDateSelection, useMonthButtonCustomization, useDisplayedDateString, useAsteriskDisplay, useDateValidation, useDatePickerState, useHolidayHighlighting, useCalendarKeyboardNavigation } from '../composables'
|
|
12
|
+
import { useWeekendDays, useTodayButton, useDatePickerViewMode, useDateSelection, useMonthButtonCustomization, useDisplayedDateString, useAsteriskDisplay, useDateValidation, useDatePickerState, useHolidayHighlighting, useCalendarKeyboardNavigation, useDatePickerFocusTrap } from '../composables'
|
|
13
13
|
import { DATE_PICKER_MESSAGES } from '../constants/messages'
|
|
14
14
|
import dayjs from 'dayjs'
|
|
15
15
|
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
|
@@ -30,96 +30,99 @@
|
|
|
30
30
|
const currentYear = ref<string | null>(null)
|
|
31
31
|
const currentMonthName = ref<string | null>(null)
|
|
32
32
|
const currentYearName = ref<string | null>(null)
|
|
33
|
+
const monthYearLiveText = computed(() => {
|
|
34
|
+
if (currentMonthName.value && currentYearName.value) return `${currentMonthName.value} ${currentYearName.value}`
|
|
35
|
+
if (currentMonthName.value) return currentMonthName.value
|
|
36
|
+
if (currentYearName.value) return currentYearName.value
|
|
37
|
+
return ''
|
|
38
|
+
})
|
|
33
39
|
|
|
34
40
|
const props = withDefaults(defineProps<{
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
placeholder?: string
|
|
38
|
-
format?: string
|
|
39
|
-
dateFormatReturn?: string
|
|
40
|
-
isBirthDate?: boolean
|
|
41
|
+
autoClamp?: boolean
|
|
42
|
+
bgColor?: string
|
|
41
43
|
birthDate?: boolean // Alias pour isBirthDate pour compatibilité avec l'attribut kebab-case birth-date
|
|
42
|
-
showWeekNumber?: boolean
|
|
43
|
-
required?: boolean
|
|
44
|
-
displayRange?: boolean
|
|
45
|
-
displayIcon?: boolean
|
|
46
|
-
displayAppendIcon?: boolean
|
|
47
|
-
displayPrependIcon?: boolean
|
|
48
44
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
49
45
|
customRules?: { type: string, options: any }[]
|
|
50
46
|
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
51
47
|
customWarningRules?: { type: string, options: any }[]
|
|
52
|
-
|
|
53
|
-
noIcon?: boolean
|
|
54
|
-
noCalendar?: boolean
|
|
55
|
-
isOutlined?: boolean
|
|
56
|
-
readonly?: boolean
|
|
57
|
-
width?: string
|
|
58
|
-
disableErrorHandling?: boolean
|
|
59
|
-
showSuccessMessages?: boolean
|
|
60
|
-
bgColor?: string
|
|
48
|
+
dateFormatReturn?: string
|
|
61
49
|
density?: 'default' | 'comfortable' | 'compact'
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
displayHolidayDays?: boolean
|
|
66
|
-
useCombinedMode?: boolean
|
|
67
|
-
textFieldActivator?: boolean
|
|
68
|
-
title?: string | false
|
|
50
|
+
disableErrorHandling?: boolean
|
|
51
|
+
disabled?: boolean
|
|
52
|
+
displayAppendIcon?: boolean
|
|
69
53
|
displayAsterisk?: boolean
|
|
54
|
+
displayHolidayDays?: boolean
|
|
55
|
+
displayIcon?: boolean
|
|
56
|
+
displayPrependIcon?: boolean
|
|
57
|
+
displayRange?: boolean
|
|
58
|
+
displayTodayButton?: boolean
|
|
59
|
+
displayWeekendDays?: boolean
|
|
60
|
+
format?: string
|
|
61
|
+
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
|
|
62
|
+
hideDetails?: boolean | 'auto'
|
|
63
|
+
hint?: string
|
|
64
|
+
isBirthDate?: boolean
|
|
65
|
+
isOutlined?: boolean
|
|
66
|
+
isValidateOnBlur?: boolean
|
|
67
|
+
label: string
|
|
68
|
+
modelValue?: DateInput
|
|
69
|
+
noCalendar?: boolean
|
|
70
|
+
noIcon?: boolean
|
|
70
71
|
period?: {
|
|
71
|
-
min?: string
|
|
72
72
|
max?: string
|
|
73
|
+
min?: string
|
|
73
74
|
}
|
|
74
|
-
autoClamp?: boolean
|
|
75
|
-
isValidateOnBlur?: boolean
|
|
76
|
-
hint?: string
|
|
77
75
|
persistentHint?: boolean
|
|
78
|
-
|
|
79
|
-
|
|
76
|
+
placeholder?: string
|
|
77
|
+
readonly?: boolean
|
|
78
|
+
required?: boolean
|
|
79
|
+
showSuccessMessages?: boolean
|
|
80
|
+
showWeekNumber?: boolean
|
|
81
|
+
textFieldActivator?: boolean
|
|
82
|
+
title?: string | false
|
|
83
|
+
useCombinedMode?: boolean
|
|
84
|
+
width?: string
|
|
80
85
|
}>(), {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
format: DATE_PICKER_MESSAGES.FORMAT_DEFAULT,
|
|
84
|
-
dateFormatReturn: '',
|
|
85
|
-
isBirthDate: false,
|
|
86
|
+
autoClamp: false,
|
|
87
|
+
bgColor: 'white',
|
|
86
88
|
birthDate: false,
|
|
87
|
-
showWeekNumber: false,
|
|
88
|
-
required: false,
|
|
89
|
-
displayRange: false,
|
|
90
|
-
displayIcon: true,
|
|
91
|
-
displayAppendIcon: false,
|
|
92
|
-
displayPrependIcon: true,
|
|
93
89
|
customRules: () => [],
|
|
94
90
|
customWarningRules: () => [],
|
|
91
|
+
dateFormatReturn: '',
|
|
92
|
+
density: 'default',
|
|
93
|
+
disableErrorHandling: false,
|
|
95
94
|
disabled: false,
|
|
96
|
-
|
|
97
|
-
|
|
95
|
+
displayAppendIcon: false,
|
|
96
|
+
displayAsterisk: false,
|
|
97
|
+
displayHolidayDays: true,
|
|
98
|
+
displayIcon: true,
|
|
99
|
+
displayPrependIcon: true,
|
|
100
|
+
displayRange: false,
|
|
101
|
+
displayTodayButton: true,
|
|
102
|
+
displayWeekendDays: true,
|
|
103
|
+
format: DATE_PICKER_MESSAGES.FORMAT_DEFAULT,
|
|
104
|
+
headingLevel: 3,
|
|
105
|
+
hideDetails: false,
|
|
106
|
+
hint: undefined,
|
|
107
|
+
isBirthDate: false,
|
|
98
108
|
isOutlined: true,
|
|
109
|
+
isValidateOnBlur: true,
|
|
110
|
+
modelValue: undefined,
|
|
111
|
+
noCalendar: false,
|
|
112
|
+
noIcon: false,
|
|
113
|
+
period: () => ({ min: '', max: '' }),
|
|
114
|
+
persistentHint: false,
|
|
115
|
+
placeholder: undefined,
|
|
99
116
|
readonly: false,
|
|
100
|
-
|
|
101
|
-
disableErrorHandling: false,
|
|
117
|
+
required: false,
|
|
102
118
|
showSuccessMessages: true,
|
|
103
|
-
|
|
104
|
-
density: 'default',
|
|
105
|
-
hideDetails: false,
|
|
106
|
-
displayWeekendDays: true,
|
|
107
|
-
displayTodayButton: true,
|
|
108
|
-
displayHolidayDays: true,
|
|
109
|
-
useCombinedMode: false,
|
|
119
|
+
showWeekNumber: false,
|
|
110
120
|
textFieldActivator: false,
|
|
111
121
|
title: false,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
autoClamp: false,
|
|
115
|
-
isValidateOnBlur: true,
|
|
116
|
-
hint: undefined,
|
|
117
|
-
persistentHint: false,
|
|
118
|
-
headingLevel: 3,
|
|
122
|
+
useCombinedMode: false,
|
|
123
|
+
width: '100%',
|
|
119
124
|
})
|
|
120
125
|
|
|
121
|
-
// La compatibilité entre isBirthDate et birthDate est gérée directement dans l'appel au composable
|
|
122
|
-
|
|
123
126
|
// Utilisation des composables pour les fonctionnalités du CalendarMode
|
|
124
127
|
const { displayWeekendDays } = useWeekendDays(props)
|
|
125
128
|
const { todayInString, headerDate } = useTodayButton(props)
|
|
@@ -142,8 +145,70 @@
|
|
|
142
145
|
|
|
143
146
|
const dateTextInputRef = ref<null | ComponentPublicInstance<typeof DateTextInput>>()
|
|
144
147
|
const dateCalendarTextInputRef = ref<null | ComponentPublicInstance<typeof SyTextField>>()
|
|
145
|
-
const datePickerRef = ref<
|
|
148
|
+
const datePickerRef = ref<ComponentPublicInstance | null>(null)
|
|
146
149
|
const complexDatePickerRef = ref<null | ComponentPublicInstance<typeof ComplexDatePicker>>()
|
|
150
|
+
const datePickerContentId = `date-picker-${Math.random().toString(36).slice(2)}`
|
|
151
|
+
|
|
152
|
+
const isDatePickerVisible = ref(false)
|
|
153
|
+
const { handleMenuKeydown } = useDatePickerFocusTrap({
|
|
154
|
+
isDatePickerVisible,
|
|
155
|
+
datePickerRef,
|
|
156
|
+
onClose: () => emit('closed'),
|
|
157
|
+
restoreFocus: () => queueMicrotask(() => dateCalendarTextInputRef.value?.$el?.querySelector?.('input')?.focus({ preventScroll: true })),
|
|
158
|
+
})
|
|
159
|
+
|
|
160
|
+
// Utiliser le calendarKeyboardNavigation normalement
|
|
161
|
+
useCalendarKeyboardNavigation({
|
|
162
|
+
isDatePickerVisible,
|
|
163
|
+
datePickerRef,
|
|
164
|
+
getCurrentDate: () => {
|
|
165
|
+
const value = selectedDates.value
|
|
166
|
+
if (value) {
|
|
167
|
+
const date = Array.isArray(value) ? value[0] ?? null : value
|
|
168
|
+
// Vérifier si la date sélectionnée est dans le mois actuellement affiché
|
|
169
|
+
if (date && currentMonth.value !== null && currentYear.value !== null) {
|
|
170
|
+
const sameMonth = date.getMonth() === Number(currentMonth.value)
|
|
171
|
+
const sameYear = date.getFullYear() === Number(currentYear.value)
|
|
172
|
+
if (sameMonth && sameYear) {
|
|
173
|
+
return date
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
// Fallback: retourner le 1er du mois actuellement affiché
|
|
179
|
+
if (currentMonth.value !== null && currentYear.value !== null) {
|
|
180
|
+
return new Date(Number(currentYear.value), Number(currentMonth.value), 1)
|
|
181
|
+
}
|
|
182
|
+
|
|
183
|
+
return null
|
|
184
|
+
},
|
|
185
|
+
setCurrentDate: (date: Date) => {
|
|
186
|
+
preventCloseOnKeyboardNavigation.value = true
|
|
187
|
+
updateSelectedDates([date])
|
|
188
|
+
syncDisplayedMonthYearFromDate(date)
|
|
189
|
+
|
|
190
|
+
// S'assurer que le VDatePicker affiche le bon mois après navigation clavier
|
|
191
|
+
nextTick(() => {
|
|
192
|
+
// Forcer la mise à jour du mois affiché dans le VDatePicker
|
|
193
|
+
if (datePickerRef.value) {
|
|
194
|
+
// Le VDatePicker devrait automatiquement suivre la date sélectionnée
|
|
195
|
+
// mais on s'assure que le mois/année est bien synchronisé
|
|
196
|
+
const month = date.getMonth().toString()
|
|
197
|
+
const year = date.getFullYear().toString()
|
|
198
|
+
if (currentMonth.value !== month || currentYear.value !== year) {
|
|
199
|
+
currentMonth.value = month
|
|
200
|
+
currentYear.value = year
|
|
201
|
+
currentMonthName.value = dayjs(date).format('MMMM')
|
|
202
|
+
currentYearName.value = year
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
})
|
|
206
|
+
|
|
207
|
+
queueMicrotask(() => {
|
|
208
|
+
preventCloseOnKeyboardNavigation.value = false
|
|
209
|
+
})
|
|
210
|
+
},
|
|
211
|
+
})
|
|
147
212
|
|
|
148
213
|
// Fonction pour sélectionner la date du jour
|
|
149
214
|
const handleSelectToday = () => {
|
|
@@ -184,12 +249,9 @@
|
|
|
184
249
|
(e: 'date-selected', value: DateValue): void
|
|
185
250
|
}>()
|
|
186
251
|
|
|
187
|
-
const isDatePickerVisible = ref(false)
|
|
188
252
|
const validation = useValidation({
|
|
189
253
|
showSuccessMessages: props.showSuccessMessages,
|
|
190
254
|
fieldIdentifier: 'Date',
|
|
191
|
-
customRules: props.customRules,
|
|
192
|
-
warningRules: props.customWarningRules,
|
|
193
255
|
disableErrorHandling: props.disableErrorHandling,
|
|
194
256
|
})
|
|
195
257
|
const { errors, warnings, successes, validateField: baseValidateField, clearValidation: baseClearValidation } = validation
|
|
@@ -204,15 +266,11 @@
|
|
|
204
266
|
})
|
|
205
267
|
|
|
206
268
|
const validateField = (
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
warningRules: any[] = [],
|
|
213
|
-
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- compat signature with useDateValidation
|
|
214
|
-
successRules: any[] = [],
|
|
215
|
-
): ValidationResult => {
|
|
269
|
+
value: unknown,
|
|
270
|
+
rules: ValidationRule[] = [],
|
|
271
|
+
warningRules: ValidationRule[] = [],
|
|
272
|
+
successRules: ValidationRule[] = [],
|
|
273
|
+
): Promise<ValidationResult> | ValidationResult => {
|
|
216
274
|
if (props.readonly) {
|
|
217
275
|
return {
|
|
218
276
|
hasError: false,
|
|
@@ -222,7 +280,7 @@
|
|
|
222
280
|
}
|
|
223
281
|
}
|
|
224
282
|
|
|
225
|
-
return baseValidateField(value, rules, warningRules, successRules)
|
|
283
|
+
return baseValidateField(value, rules, warningRules, successRules)
|
|
226
284
|
}
|
|
227
285
|
|
|
228
286
|
const validateFieldForDateValidation = (
|
|
@@ -280,7 +338,7 @@
|
|
|
280
338
|
})
|
|
281
339
|
|
|
282
340
|
// Fonction pour valider les dates
|
|
283
|
-
const validateDates = (forceValidation = false) => {
|
|
341
|
+
const validateDates = async (forceValidation = false) => {
|
|
284
342
|
if (props.noCalendar) {
|
|
285
343
|
// En mode no-calendar, on délègue la validation au DateTextInput
|
|
286
344
|
return
|
|
@@ -314,7 +372,7 @@
|
|
|
314
372
|
|
|
315
373
|
if (shouldDisplayErrors && (!isInitialValidation.value || forceValidation)) {
|
|
316
374
|
// Comportement historique : exécuter directement les règles personnalisées même si la valeur est vide
|
|
317
|
-
validateField(
|
|
375
|
+
await validateField(
|
|
318
376
|
selectedDates.value,
|
|
319
377
|
props.customRules,
|
|
320
378
|
props.customWarningRules,
|
|
@@ -329,12 +387,12 @@
|
|
|
329
387
|
|
|
330
388
|
// Ne pas afficher d'erreurs de custom rules si on est dans le contexte du mounted initial
|
|
331
389
|
if (shouldDisplayErrors && (!isInitialValidation.value || forceValidation)) {
|
|
332
|
-
coreValidateDates(forceValidation)
|
|
390
|
+
await coreValidateDates(forceValidation)
|
|
333
391
|
}
|
|
334
392
|
}
|
|
335
393
|
|
|
336
394
|
// Fonction centralisée pour mettre à jour le modèle
|
|
337
|
-
const updateModel = (value: DateValue) => {
|
|
395
|
+
const updateModel = async (value: DateValue) => {
|
|
338
396
|
// Éviter les mises à jour inutiles
|
|
339
397
|
if (JSON.stringify(value) === JSON.stringify(props.modelValue)) return
|
|
340
398
|
|
|
@@ -345,7 +403,7 @@
|
|
|
345
403
|
isDatePickerVisible.value = false
|
|
346
404
|
emit('closed')
|
|
347
405
|
}
|
|
348
|
-
validateDates()
|
|
406
|
+
await validateDates()
|
|
349
407
|
}
|
|
350
408
|
finally {
|
|
351
409
|
// S'assurer que le flag est toujours réinitialisé
|
|
@@ -356,9 +414,9 @@
|
|
|
356
414
|
}
|
|
357
415
|
|
|
358
416
|
// Watcher pour mettre à jour le modèle lorsque les dates sélectionnées changent
|
|
359
|
-
watch(selectedDates, (newValue) => {
|
|
417
|
+
watch(selectedDates, async (newValue) => {
|
|
360
418
|
// Valider les dates
|
|
361
|
-
validateDates()
|
|
419
|
+
await validateDates()
|
|
362
420
|
// Marquer les jours fériés après la mise à jour des dates
|
|
363
421
|
markHolidayDays()
|
|
364
422
|
|
|
@@ -367,7 +425,7 @@
|
|
|
367
425
|
// En mode range, ne mettez à jour le modèle et ne fermez que si la plage est complète.
|
|
368
426
|
const isRangeComplete = props.displayRange && Array.isArray(newValue) && newValue.length >= 2
|
|
369
427
|
if (!props.displayRange || isRangeComplete) {
|
|
370
|
-
updateModel(formattedDate.value)
|
|
428
|
+
await updateModel(formattedDate.value)
|
|
371
429
|
}
|
|
372
430
|
|
|
373
431
|
// Mettre à jour textInputValue pour le DateTextInput
|
|
@@ -435,14 +493,14 @@
|
|
|
435
493
|
})
|
|
436
494
|
|
|
437
495
|
// Gestionnaire pour les mises à jour du DateTextInput en mode no-calendar
|
|
438
|
-
const handleDateTextInputUpdate = (value: DateValue) => {
|
|
496
|
+
const handleDateTextInputUpdate = async (value: DateValue) => {
|
|
439
497
|
if (isUpdatingFromInternal.value) return
|
|
440
498
|
|
|
441
499
|
try {
|
|
442
500
|
isUpdatingFromInternal.value = true
|
|
443
501
|
|
|
444
502
|
// Mettre à jour le modèle avec la valeur reçue du DateTextInput
|
|
445
|
-
updateModel(value)
|
|
503
|
+
await updateModel(value)
|
|
446
504
|
|
|
447
505
|
// Mettre à jour selectedDates en fonction de la valeur reçue
|
|
448
506
|
if (!value) {
|
|
@@ -477,14 +535,14 @@
|
|
|
477
535
|
}
|
|
478
536
|
|
|
479
537
|
// Gestionnaire pour les événements date-selected du DateTextInput
|
|
480
|
-
const handleDateTextInputSelection = (value: DateValue) => {
|
|
538
|
+
const handleDateTextInputSelection = async (value: DateValue) => {
|
|
481
539
|
if (isUpdatingFromInternal.value) return
|
|
482
540
|
|
|
483
541
|
// Mettre à jour le modèle avec la valeur sélectionnée
|
|
484
|
-
updateModel(value)
|
|
542
|
+
await updateModel(value)
|
|
485
543
|
}
|
|
486
544
|
|
|
487
|
-
watch(textInputValue, (newValue) => {
|
|
545
|
+
watch(textInputValue, async (newValue) => {
|
|
488
546
|
// Éviter les mises à jour récursives
|
|
489
547
|
if (isUpdatingFromInternal.value || props.noCalendar) return
|
|
490
548
|
|
|
@@ -595,6 +653,33 @@
|
|
|
595
653
|
currentYearName,
|
|
596
654
|
)
|
|
597
655
|
|
|
656
|
+
const syncDisplayedMonthYearFromDate = (date: Date) => {
|
|
657
|
+
const month = date.getMonth().toString()
|
|
658
|
+
const year = date.getFullYear().toString()
|
|
659
|
+
const hasMonthChanged = currentMonth.value !== month
|
|
660
|
+
const hasYearChanged = currentYear.value !== year
|
|
661
|
+
|
|
662
|
+
if (hasMonthChanged) {
|
|
663
|
+
currentMonth.value = month
|
|
664
|
+
currentMonthName.value = dayjs(date).format('MMMM')
|
|
665
|
+
handleMonthUpdate()
|
|
666
|
+
}
|
|
667
|
+
|
|
668
|
+
if (hasYearChanged) {
|
|
669
|
+
currentYear.value = year
|
|
670
|
+
currentYearName.value = year
|
|
671
|
+
}
|
|
672
|
+
|
|
673
|
+
if (hasMonthChanged || hasYearChanged) {
|
|
674
|
+
nextTick(() => {
|
|
675
|
+
if (isDatePickerVisible.value) {
|
|
676
|
+
customizeMonthButton()
|
|
677
|
+
markHolidayDays()
|
|
678
|
+
}
|
|
679
|
+
})
|
|
680
|
+
}
|
|
681
|
+
}
|
|
682
|
+
|
|
598
683
|
onMounted(() => {
|
|
599
684
|
document.addEventListener('click', handleClickOutside)
|
|
600
685
|
|
|
@@ -624,39 +709,17 @@
|
|
|
624
709
|
document.removeEventListener('click', handleClickOutside)
|
|
625
710
|
})
|
|
626
711
|
|
|
627
|
-
|
|
628
|
-
isDatePickerVisible,
|
|
629
|
-
datePickerRef: datePickerRef as unknown as Ref<ComponentPublicInstance | null>,
|
|
630
|
-
getCurrentDate: () => {
|
|
631
|
-
const value = selectedDates.value
|
|
632
|
-
if (!value) return null
|
|
633
|
-
|
|
634
|
-
if (Array.isArray(value)) {
|
|
635
|
-
return value[0] ?? null
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
return value
|
|
639
|
-
},
|
|
640
|
-
setCurrentDate: (date: Date) => {
|
|
641
|
-
preventCloseOnKeyboardNavigation.value = true
|
|
642
|
-
updateSelectedDates([date])
|
|
643
|
-
queueMicrotask(() => {
|
|
644
|
-
preventCloseOnKeyboardNavigation.value = false
|
|
645
|
-
})
|
|
646
|
-
},
|
|
647
|
-
})
|
|
648
|
-
|
|
649
|
-
const validateOnSubmit = () => {
|
|
712
|
+
const validateOnSubmit = async () => {
|
|
650
713
|
// Si le mode noCalendar est activé, on délègue la validation au DateTextInput
|
|
651
714
|
if (props.noCalendar) {
|
|
652
|
-
return dateTextInputRef.value?.validateOnSubmit()
|
|
715
|
+
return await dateTextInputRef.value?.validateOnSubmit()
|
|
653
716
|
}
|
|
654
717
|
// Si le mode combiné est activé, on délègue la validation au ComplexDatePicker
|
|
655
718
|
else if (props.useCombinedMode) {
|
|
656
|
-
return complexDatePickerRef.value?.validateOnSubmit()
|
|
719
|
+
return await complexDatePickerRef.value?.validateOnSubmit()
|
|
657
720
|
}
|
|
658
721
|
// Forcer la validation pour ignorer les conditions de validation interactive
|
|
659
|
-
validateDates(true)
|
|
722
|
+
await validateDates(true)
|
|
660
723
|
// Retourner directement un booléen pour maintenir la compatibilité avec les tests existants
|
|
661
724
|
return errors.value.length === 0
|
|
662
725
|
}
|
|
@@ -664,10 +727,10 @@
|
|
|
664
727
|
// Intégration avec le système de validation du formulaire
|
|
665
728
|
useValidatable(validateOnSubmit, clearValidation)
|
|
666
729
|
|
|
667
|
-
const openDatePicker = () => {
|
|
730
|
+
const openDatePicker = async () => {
|
|
668
731
|
if (props.disabled || props.readonly) return
|
|
669
732
|
if (!isDatePickerVisible.value) {
|
|
670
|
-
toggleDatePicker()
|
|
733
|
+
await toggleDatePicker()
|
|
671
734
|
}
|
|
672
735
|
}
|
|
673
736
|
|
|
@@ -717,11 +780,11 @@
|
|
|
717
780
|
() => selectedDates.value,
|
|
718
781
|
)
|
|
719
782
|
|
|
720
|
-
const handleInputBlur = () => {
|
|
783
|
+
const handleInputBlur = async () => {
|
|
721
784
|
emit('blur')
|
|
722
785
|
onblur.value = true
|
|
723
786
|
if (props.isValidateOnBlur) {
|
|
724
|
-
validateDates(true)
|
|
787
|
+
await validateDates(true)
|
|
725
788
|
}
|
|
726
789
|
}
|
|
727
790
|
|
|
@@ -817,7 +880,7 @@
|
|
|
817
880
|
}
|
|
818
881
|
})
|
|
819
882
|
|
|
820
|
-
const toggleDatePicker = () => {
|
|
883
|
+
const toggleDatePicker = async () => {
|
|
821
884
|
if (props.disabled || props.readonly) return
|
|
822
885
|
|
|
823
886
|
isDatePickerVisible.value = !isDatePickerVisible.value
|
|
@@ -829,7 +892,7 @@
|
|
|
829
892
|
}
|
|
830
893
|
else {
|
|
831
894
|
emit('closed')
|
|
832
|
-
validateDates()
|
|
895
|
+
await validateDates()
|
|
833
896
|
}
|
|
834
897
|
}
|
|
835
898
|
|
|
@@ -845,26 +908,26 @@
|
|
|
845
908
|
emit('focus')
|
|
846
909
|
}
|
|
847
910
|
|
|
848
|
-
const openDatePickerOnIconClick = () => {
|
|
911
|
+
const openDatePickerOnIconClick = async () => {
|
|
849
912
|
if (props.disabled || props.readonly) return
|
|
850
|
-
toggleDatePicker()
|
|
913
|
+
await toggleDatePicker()
|
|
851
914
|
}
|
|
852
915
|
|
|
853
916
|
// Gestionnaire d'événement clavier pour l'input
|
|
854
|
-
const handleInputKeydown = (event: KeyboardEvent) => {
|
|
917
|
+
const handleInputKeydown = async (event: KeyboardEvent) => {
|
|
855
918
|
// Ne rien faire si le composant est en readonly
|
|
856
919
|
if (props.readonly) return
|
|
857
920
|
|
|
858
921
|
// Ouvrir le calendrier uniquement lorsque la touche Entrée est pressée
|
|
859
922
|
if (event.key === 'Enter') {
|
|
860
|
-
openDatePicker()
|
|
923
|
+
await openDatePicker()
|
|
861
924
|
event.preventDefault() // Empêcher la soumission du formulaire
|
|
862
925
|
}
|
|
863
926
|
// Fermer le calendrier lorsque la touche Escape est pressée
|
|
864
927
|
else if ((event.key === 'Escape' || event.key === 'Esc') && isDatePickerVisible.value) {
|
|
865
928
|
isDatePickerVisible.value = false
|
|
866
929
|
emit('closed')
|
|
867
|
-
validateDates() // Valider les dates à la fermeture
|
|
930
|
+
await validateDates() // Valider les dates à la fermeture
|
|
868
931
|
event.preventDefault()
|
|
869
932
|
}
|
|
870
933
|
}
|
|
@@ -972,7 +1035,6 @@
|
|
|
972
1035
|
<VMenu
|
|
973
1036
|
v-if="!props.noCalendar"
|
|
974
1037
|
v-model="isDatePickerVisible"
|
|
975
|
-
activator="parent"
|
|
976
1038
|
:min-width="0"
|
|
977
1039
|
location="bottom"
|
|
978
1040
|
:close-on-content-click="false"
|
|
@@ -981,103 +1043,127 @@
|
|
|
981
1043
|
transition="fade-transition"
|
|
982
1044
|
attach="body"
|
|
983
1045
|
:offset="[-20, 5]"
|
|
1046
|
+
content-class="date-picker-overlay-content"
|
|
1047
|
+
role="presentation"
|
|
1048
|
+
:title="props.placeholder || DATE_PICKER_MESSAGES.LABEL_DEFAULT"
|
|
984
1049
|
>
|
|
985
1050
|
<template #activator="{ props: menuProps }">
|
|
986
|
-
<
|
|
987
|
-
v-bind="menuProps"
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1051
|
+
<div
|
|
1052
|
+
v-bind="{ ...menuProps, 'aria-expanded': undefined, 'aria-haspopup': undefined, 'aria-owns': undefined, 'aria-controls': isDatePickerVisible ? datePickerContentId : undefined }"
|
|
1053
|
+
>
|
|
1054
|
+
<SyTextField
|
|
1055
|
+
:id="`${datePickerContentId}-input`"
|
|
1056
|
+
ref="dateCalendarTextInputRef"
|
|
1057
|
+
v-model="displayFormattedDate"
|
|
1058
|
+
:aria-label="labelWithAsterisk || props.placeholder || DATE_PICKER_MESSAGES.LABEL_DEFAULT"
|
|
1059
|
+
:aria-labelledby="undefined"
|
|
1060
|
+
:append-icon="displayIcon && displayAppendIcon ? 'calendar' : undefined"
|
|
1061
|
+
:class="[getMessageClasses(), 'label-hidden-on-focus']"
|
|
1062
|
+
:error-messages="errorMessages"
|
|
1063
|
+
:warning-messages="warningMessages"
|
|
1064
|
+
:success-messages="props.showSuccessMessages ? successMessages : []"
|
|
1065
|
+
:disabled="props.disabled"
|
|
1066
|
+
:disable-click-button="false"
|
|
1067
|
+
:readonly="true"
|
|
1068
|
+
:label="labelWithAsterisk"
|
|
1069
|
+
:placeholder="props.placeholder"
|
|
1070
|
+
:no-icon="props.noIcon"
|
|
1071
|
+
:prepend-icon="displayIcon && !displayAppendIcon ? 'calendar' : undefined"
|
|
1072
|
+
:variant-style="props.isOutlined ? 'outlined' : 'underlined'"
|
|
1073
|
+
color="primary"
|
|
1074
|
+
:show-success-messages="props.showSuccessMessages"
|
|
1075
|
+
:bg-color="props.bgColor"
|
|
1076
|
+
:density="props.density"
|
|
1077
|
+
:hide-details="props.hideDetails"
|
|
1078
|
+
:display-asterisk="props.displayAsterisk"
|
|
1079
|
+
:is-clearable="!props.readonly"
|
|
1080
|
+
:auto-clamp="props.autoClamp"
|
|
1081
|
+
:title="props.title || props.placeholder"
|
|
1082
|
+
:hint="props.hint"
|
|
1083
|
+
:persistent-hint="props.persistentHint"
|
|
1084
|
+
@click="openDatePickerOnClick"
|
|
1085
|
+
@focus="openDatePickerOnFocus"
|
|
1086
|
+
@blur="handleInputBlur"
|
|
1087
|
+
@keydown="handleInputKeydown"
|
|
1088
|
+
@update:model-value="updateSelectedDates"
|
|
1089
|
+
@prepend-icon-click="openDatePickerOnIconClick"
|
|
1090
|
+
@append-icon-click="openDatePickerOnIconClick"
|
|
1091
|
+
/>
|
|
1092
|
+
</div>
|
|
1022
1093
|
</template>
|
|
1023
|
-
<
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
color="primary"
|
|
1028
|
-
control-variant="modal"
|
|
1029
|
-
:first-day-of-week="1"
|
|
1030
|
-
:multiple="props.displayRange ? 'range' : false"
|
|
1031
|
-
:show-adjacent-months="true"
|
|
1032
|
-
:show-week="props.showWeekNumber"
|
|
1033
|
-
:view-mode="currentViewMode"
|
|
1034
|
-
:class="displayWeekendDays ? 'weekend' : ''"
|
|
1035
|
-
:max="maxDate"
|
|
1036
|
-
:min="minDate"
|
|
1037
|
-
:display-holiday-days="props.displayHolidayDays"
|
|
1038
|
-
@update:view-mode="handleViewModeUpdate"
|
|
1039
|
-
@update:month="onUpdateMonth"
|
|
1040
|
-
@update:year="onUpdateYear"
|
|
1041
|
-
@click:date="updateSelectedDates"
|
|
1042
|
-
@update:model-value="updateDisplayFormattedDate"
|
|
1043
|
-
@focus="markHolidayDays"
|
|
1044
|
-
@update:month-year="markHolidayDays"
|
|
1094
|
+
<div
|
|
1095
|
+
tabindex="-1"
|
|
1096
|
+
role="presentation"
|
|
1097
|
+
@keydown.capture="handleMenuKeydown"
|
|
1045
1098
|
>
|
|
1046
|
-
<
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1099
|
+
<div
|
|
1100
|
+
class="sr-only"
|
|
1101
|
+
aria-live="polite"
|
|
1102
|
+
aria-atomic="true"
|
|
1103
|
+
>
|
|
1104
|
+
{{ monthYearLiveText }}
|
|
1105
|
+
</div>
|
|
1106
|
+
<VDatePicker
|
|
1107
|
+
v-if="isDatePickerVisible && !props.noCalendar"
|
|
1108
|
+
:id="datePickerContentId"
|
|
1109
|
+
ref="datePickerRef"
|
|
1110
|
+
v-model="selectedDates"
|
|
1111
|
+
color="primary"
|
|
1112
|
+
control-variant="modal"
|
|
1113
|
+
:first-day-of-week="1"
|
|
1114
|
+
:multiple="props.displayRange ? 'range' : false"
|
|
1115
|
+
:show-adjacent-months="true"
|
|
1116
|
+
:show-week="props.showWeekNumber"
|
|
1117
|
+
:view-mode="currentViewMode"
|
|
1118
|
+
:class="displayWeekendDays ? 'weekend' : ''"
|
|
1119
|
+
:max="maxDate"
|
|
1120
|
+
:min="minDate"
|
|
1121
|
+
:display-holiday-days="props.displayHolidayDays"
|
|
1122
|
+
@update:view-mode="handleViewModeUpdate"
|
|
1123
|
+
@update:month="onUpdateMonth"
|
|
1124
|
+
@update:year="onUpdateYear"
|
|
1125
|
+
@click:date="updateSelectedDates"
|
|
1126
|
+
@update:model-value="updateDisplayFormattedDate"
|
|
1127
|
+
@focus="markHolidayDays"
|
|
1128
|
+
@update:month-year="markHolidayDays"
|
|
1060
1129
|
>
|
|
1061
|
-
<
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1130
|
+
<template #title>
|
|
1131
|
+
Sélectionnez une date
|
|
1132
|
+
</template>
|
|
1133
|
+
<template #header>
|
|
1134
|
+
<SyHeading
|
|
1135
|
+
class="mx-auto my-auto ml-5 mb-4"
|
|
1136
|
+
aria-live="polite"
|
|
1137
|
+
aria-atomic="true"
|
|
1138
|
+
:level="headingLevel"
|
|
1070
1139
|
>
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1140
|
+
{{ selectedDates ? displayedDateString : headerDate }}
|
|
1141
|
+
</SyHeading>
|
|
1142
|
+
</template>
|
|
1143
|
+
<template
|
|
1144
|
+
v-if="props.displayTodayButton"
|
|
1145
|
+
#actions
|
|
1146
|
+
>
|
|
1147
|
+
<div class="d-flex justify-center align-center w-100">
|
|
1148
|
+
<v-btn
|
|
1149
|
+
size="x-small"
|
|
1150
|
+
color="primary"
|
|
1151
|
+
:title="DATE_PICKER_MESSAGES.BUTTON_TODAY"
|
|
1152
|
+
class="date-picker__today-button my-2 pa-2 mt-2"
|
|
1153
|
+
:ripple="false"
|
|
1154
|
+
@click="handleSelectToday"
|
|
1155
|
+
>
|
|
1156
|
+
<SyIcon
|
|
1157
|
+
size="16px"
|
|
1158
|
+
decorative
|
|
1159
|
+
:icon="mdiCalendarMonthOutline"
|
|
1160
|
+
/>
|
|
1161
|
+
{{ DATE_PICKER_MESSAGES.BUTTON_TODAY }}
|
|
1162
|
+
</v-btn>
|
|
1163
|
+
</div>
|
|
1164
|
+
</template>
|
|
1165
|
+
</VDatePicker>
|
|
1166
|
+
</div>
|
|
1081
1167
|
</VMenu>
|
|
1082
1168
|
</template>
|
|
1083
1169
|
</div>
|
|
@@ -1140,6 +1226,18 @@
|
|
|
1140
1226
|
}
|
|
1141
1227
|
}
|
|
1142
1228
|
|
|
1229
|
+
.sr-only {
|
|
1230
|
+
position: absolute;
|
|
1231
|
+
width: 1px;
|
|
1232
|
+
height: 1px;
|
|
1233
|
+
padding: 0;
|
|
1234
|
+
margin: -1px;
|
|
1235
|
+
overflow: hidden;
|
|
1236
|
+
clip: rect(0, 0, 0, 0);
|
|
1237
|
+
white-space: nowrap;
|
|
1238
|
+
border: 0;
|
|
1239
|
+
}
|
|
1240
|
+
|
|
1143
1241
|
.v-messages__message--error {
|
|
1144
1242
|
:deep(.v-input__control) {
|
|
1145
1243
|
color: tokens.$colors-text-error !important;
|
|
@@ -1316,3 +1414,12 @@
|
|
|
1316
1414
|
}
|
|
1317
1415
|
|
|
1318
1416
|
</style>
|
|
1417
|
+
|
|
1418
|
+
<style lang="scss">
|
|
1419
|
+
.date-picker-overlay-content .v-date-picker {
|
|
1420
|
+
box-shadow:
|
|
1421
|
+
0 5px 5px -3px rgb(0 0 0 / 20%),
|
|
1422
|
+
0 8px 10px 1px rgb(0 0 0 / 14%),
|
|
1423
|
+
0 3px 14px 2px rgb(0 0 0 / 12%) !important;
|
|
1424
|
+
}
|
|
1425
|
+
</style>
|