@cnamts/synapse 0.0.12-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 +4913 -4021
- package/dist/design-system-v3.umd.cjs +1 -1
- package/dist/src/components/Amelipro/types/types.d.ts +30 -57
- package/dist/src/components/Customs/SyTextField/SyTextField.d.ts +2 -0
- package/dist/src/components/DatePicker/DatePicker.d.ts +36 -44
- package/dist/src/components/DatePicker/DateTextInput.d.ts +33 -36
- 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/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/NirField/NirField.d.ts +14 -2
- package/dist/src/components/NotificationBar/NotificationBar.d.ts +5 -5
- package/dist/src/components/PasswordField/PasswordField.d.ts +2 -0
- package/dist/src/components/PeriodField/PeriodField.d.ts +159 -157
- package/dist/src/components/PhoneField/PhoneField.d.ts +22 -1
- package/dist/src/components/UploadWorkflow/AccessibiliteItems.d.ts +29 -0
- package/dist/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.d.ts +4 -0
- package/dist/src/components/Usages/Usages.d.ts +10 -0
- package/dist/src/components/index.d.ts +3 -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/useFilterable/useFilterable.d.ts +1 -1
- package/dist/src/composables/validation/useValidation.d.ts +1 -0
- 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/style.css +1 -1
- package/package.json +3 -1
- package/src/assets/_radius.scss +12 -6
- package/src/assets/settings.scss +8 -0
- 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/SySelect/SySelect.mdx +1 -1
- package/src/components/Customs/SySelect/SySelect.vue +19 -4
- package/src/components/Customs/SyTextField/SyTextField.mdx +2 -2
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +239 -0
- package/src/components/Customs/SyTextField/SyTextField.vue +3 -0
- package/src/components/DatePicker/DatePicker.stories.ts +177 -5
- package/src/components/DatePicker/DatePicker.vue +148 -347
- package/src/components/DatePicker/DateTextInput.vue +91 -251
- package/src/components/DatePicker/tests/DatePicker.spec.ts +118 -48
- 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/FileUpload/FileUpload.stories.ts +9 -7
- 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/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/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/NirField/NirField.stories.ts +165 -0
- package/src/components/NirField/NirField.vue +6 -2
- package/src/components/NirField/tests/config.spec.ts +65 -0
- package/src/components/NotificationBar/NotificationBar.mdx +2 -2
- package/src/components/NotificationBar/NotificationBar.stories.ts +59 -11
- 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.stories.ts +191 -4
- package/src/components/PasswordField/PasswordField.vue +3 -0
- package/src/components/PeriodField/PeriodField.stories.ts +214 -118
- package/src/components/PeriodField/PeriodField.vue +195 -148
- package/src/components/PeriodField/tests/PeriodField.spec.ts +146 -0
- package/src/components/PhoneField/PhoneField.stories.ts +101 -0
- package/src/components/PhoneField/PhoneField.vue +73 -17
- 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.vue +2 -2
- package/src/components/UploadWorkflow/constants/ExpertiseLevelEnum.ts +4 -0
- package/src/components/Usages/tests/Usages.spec.ts +183 -0
- package/src/components/index.ts +3 -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/useFilterable/useFilterable.ts +5 -4
- package/src/composables/validation/useValidation.ts +15 -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/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/GuideDuDev/LesBreackingChanges.mdx +36 -0
- package/src/stories/GuideDuDev/UtiliserLesRules.mdx +2 -2
- 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/dist/src/components/Amelipro/types/languages.d.ts +0 -6
- 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/Amelipro/types/languages.d.ts +0 -6
- package/src/components/Amelipro/types/types.d.ts +0 -65
- package/src/components/Customs/SyTextField/tests/__snapshots__/SyTextField.spec.ts.snap +0 -58
- 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/NirField/tests/config.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/email/tests/email.spec.d.ts → components/Usages/tests/Usages.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/required/tests/index.spec.d.ts → composables/date/tests/useDateFormat.spec.d.ts} +0 -0
- /package/dist/src/{utils/rules/required/tests/rulesMessageHelper.spec.d.ts → composables/date/tests/useDateInitialization.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/components/NirField/{tests → examples}//342/200/257dataset/342/200/257.md" +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
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import dayjs from 'dayjs'
|
|
2
|
+
import { it, describe, expect } from 'vitest'
|
|
3
|
+
import { isNotAfterTodayFn } from '..'
|
|
4
|
+
import { defaultErrorMessages } from '../locales'
|
|
5
|
+
|
|
6
|
+
const DATE_FORMAT = 'DD/MM/YYYY'
|
|
7
|
+
|
|
8
|
+
const pastDate = dayjs().subtract(1, 'year').format(DATE_FORMAT)
|
|
9
|
+
const futureDate = dayjs().add(1, 'year').format(DATE_FORMAT)
|
|
10
|
+
const today = dayjs().format(DATE_FORMAT)
|
|
11
|
+
|
|
12
|
+
describe('notAfterTodayFn', () => {
|
|
13
|
+
const notAfterToday = isNotAfterTodayFn(defaultErrorMessages)
|
|
14
|
+
|
|
15
|
+
it('returns true when value is null', () => {
|
|
16
|
+
expect(notAfterToday(null)).toBe(true)
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
it('returns true when value is a date before today', () => {
|
|
20
|
+
expect(notAfterToday(pastDate)).toBe(true)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('returns error message when value is a date after today', () => {
|
|
24
|
+
expect(notAfterToday(futureDate)).toBe(defaultErrorMessages.default)
|
|
25
|
+
})
|
|
26
|
+
|
|
27
|
+
it('returns true when value is today', () => {
|
|
28
|
+
expect(notAfterToday(today)).toBe(true)
|
|
29
|
+
})
|
|
30
|
+
})
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Meta, Canvas, Source } from '@storybook/blocks';
|
|
2
|
+
import * as IsNotBeforeDateStories from './IsNotBeforeDate.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={IsNotBeforeDateStories} />
|
|
5
|
+
|
|
6
|
+
# Règle de validation `isNotBeforeDate`
|
|
7
|
+
|
|
8
|
+
La règle de validation `isNotBeforeDate` permet de vérifier qu'une date n'est pas antérieure à une date de référence.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Pour utiliser cette règle de validation, vous devez importer la fonction d'ordre supérieur `isNotBeforeDateFn` depuis le package `@cnamts/synapse`.
|
|
13
|
+
|
|
14
|
+
<Source dark code={`
|
|
15
|
+
import { isNotBeforeDateFn } from '@cnamts/synapse';
|
|
16
|
+
`} />
|
|
17
|
+
|
|
18
|
+
Vous devez ensuite faire appel à cette fonction en lui passant en paramètre la date de référence.
|
|
19
|
+
|
|
20
|
+
<Source dark code={`
|
|
21
|
+
const notBeforeToday = isNotBeforeDateFn('01/01/2022');
|
|
22
|
+
`} />
|
|
23
|
+
|
|
24
|
+
Vous pouvez ensuite utiliser la fonction retournée comme règle d'un champs de formulaire.
|
|
25
|
+
|
|
26
|
+
<Source dark code={`
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import { isNotBeforeDateFn } from '@cnamts/synapse';
|
|
29
|
+
import { VTextField } from 'vuetify/components';
|
|
30
|
+
|
|
31
|
+
const notBefore = isNotBeforeDateFn('01/01/2022');
|
|
32
|
+
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<VTextField
|
|
37
|
+
:rules="[notBefore]"
|
|
38
|
+
label="Date"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
41
|
+
`} />
|
|
42
|
+
|
|
43
|
+
## API
|
|
44
|
+
|
|
45
|
+
<Source dark code={`
|
|
46
|
+
|
|
47
|
+
isNotBeforeDateFn(
|
|
48
|
+
date: string,
|
|
49
|
+
errorMessages?: {
|
|
50
|
+
default?: (date: string) => string;
|
|
51
|
+
}
|
|
52
|
+
): (value: string) => true | string;
|
|
53
|
+
|
|
54
|
+
`} />
|
|
55
|
+
|
|
56
|
+
### Arguments
|
|
57
|
+
|
|
58
|
+
- `date` : chaîne de caractères représentant la date de référence. La date doit être au format `JJ/MM/AAAA`.
|
|
59
|
+
- `errorMessages` : objet optionnel permettant de personnaliser les messages d'erreur. Les clés disponibles sont :
|
|
60
|
+
- `default` : message d'erreur par défaut. Vous pouvez utiliser la variable `{{ date }}` pour afficher la date de référence.
|
|
61
|
+
|
|
62
|
+
### Valeurs de retour
|
|
63
|
+
|
|
64
|
+
Retourne une fonction de validation utilisable dans un champs de formulaire Vuetify qui permet de vérifier si la date passée en paramètre n'est pas antérieure à la date de référence.
|
|
65
|
+
|
|
66
|
+
## Exemples
|
|
67
|
+
|
|
68
|
+
<Canvas of={IsNotBeforeDateStories.Default} />
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { VTextField } from 'vuetify/components'
|
|
3
|
+
|
|
4
|
+
import { isNotBeforeDateFn } from './index'
|
|
5
|
+
import { ref } from 'vue'
|
|
6
|
+
|
|
7
|
+
export default {
|
|
8
|
+
title: 'Guide du dev/Règles De Validation/isNotBeforeDate',
|
|
9
|
+
component: isNotBeforeDateFn,
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export const Default: StoryObj<unknown> = {
|
|
13
|
+
render: () => {
|
|
14
|
+
return {
|
|
15
|
+
components: { VTextField },
|
|
16
|
+
setup() {
|
|
17
|
+
const date = isNotBeforeDateFn('01/01/2022')
|
|
18
|
+
const model = ref('12/12/2021')
|
|
19
|
+
|
|
20
|
+
return { date, model }
|
|
21
|
+
},
|
|
22
|
+
template: `
|
|
23
|
+
<VTextField
|
|
24
|
+
v-model="model"
|
|
25
|
+
:rules="[date]"
|
|
26
|
+
label="Date"
|
|
27
|
+
variant="outlined"
|
|
28
|
+
validate-on="eager blur"
|
|
29
|
+
/>
|
|
30
|
+
`,
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
parameters: {
|
|
34
|
+
sourceCode: [
|
|
35
|
+
{
|
|
36
|
+
name: 'Script',
|
|
37
|
+
code: `
|
|
38
|
+
<script setup lang="ts">
|
|
39
|
+
import { VTextField } from 'vuetify/components'
|
|
40
|
+
import { isNotBeforeDateFn } from '@cnamts/synapse'
|
|
41
|
+
|
|
42
|
+
const date = isNotBeforeDateFn('01/01/2022')
|
|
43
|
+
</script>
|
|
44
|
+
`,
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
name: 'Template',
|
|
48
|
+
code: `
|
|
49
|
+
<template>
|
|
50
|
+
<VTextField
|
|
51
|
+
:rules="[date]"
|
|
52
|
+
label="Date"
|
|
53
|
+
variant="outlined"
|
|
54
|
+
/>
|
|
55
|
+
</template>
|
|
56
|
+
`,
|
|
57
|
+
},
|
|
58
|
+
],
|
|
59
|
+
},
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
export const WithCustomMessage: StoryObj<unknown> = {
|
|
63
|
+
render: () => {
|
|
64
|
+
return {
|
|
65
|
+
components: { VTextField },
|
|
66
|
+
setup() {
|
|
67
|
+
const date = isNotBeforeDateFn('01/01/2022', {
|
|
68
|
+
default: (date: string) => `the date must not be before ${date}`,
|
|
69
|
+
})
|
|
70
|
+
const model = ref('12/12/2021')
|
|
71
|
+
|
|
72
|
+
return { date, model }
|
|
73
|
+
},
|
|
74
|
+
template: `
|
|
75
|
+
<VTextField
|
|
76
|
+
v-model="model"
|
|
77
|
+
:rules="[date]"
|
|
78
|
+
label="Date after 2022"
|
|
79
|
+
variant="outlined"
|
|
80
|
+
validate-on="eager blur"
|
|
81
|
+
/>
|
|
82
|
+
`,
|
|
83
|
+
}
|
|
84
|
+
},
|
|
85
|
+
parameters: {
|
|
86
|
+
sourceCode: [
|
|
87
|
+
{
|
|
88
|
+
name: 'Script',
|
|
89
|
+
code: `
|
|
90
|
+
<script setup lang="ts">
|
|
91
|
+
import { VTextField } from 'vuetify/components'
|
|
92
|
+
import { isNotBeforeDateFn } from '@cnamts/synapse'
|
|
93
|
+
|
|
94
|
+
const date = isNotBeforeDateFn('01/01/2022', {
|
|
95
|
+
default: (date: string) => \`the date must not be before \${date}\`,
|
|
96
|
+
})
|
|
97
|
+
</script>
|
|
98
|
+
`,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
name: 'Template',
|
|
102
|
+
code: `
|
|
103
|
+
<template>
|
|
104
|
+
<VTextField
|
|
105
|
+
:rules="[date]"
|
|
106
|
+
label="Date after 2022"
|
|
107
|
+
variant="outlined"
|
|
108
|
+
/>
|
|
109
|
+
</template>
|
|
110
|
+
`,
|
|
111
|
+
},
|
|
112
|
+
],
|
|
113
|
+
},
|
|
114
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { ValidationRule, ValidationResult, Value } from '../types'
|
|
2
|
+
import { defaultErrorMessages } from './locales'
|
|
3
|
+
import { isDateBefore } from '../../functions/validation/isDateBefore'
|
|
4
|
+
import { formatDate } from '@/utils/formatDate'
|
|
5
|
+
import { parseDate } from '@/utils/parseDate'
|
|
6
|
+
import { ruleMessage } from '@/utils/ruleMessage'
|
|
7
|
+
|
|
8
|
+
/** Check that the value is not after the specified date (DD/MM/YYYY format) */
|
|
9
|
+
export function isNotBeforeDateFn(
|
|
10
|
+
date: string,
|
|
11
|
+
errorMessages = defaultErrorMessages,
|
|
12
|
+
): ValidationRule {
|
|
13
|
+
return (value: Value): ValidationResult => {
|
|
14
|
+
if (!value) {
|
|
15
|
+
return true
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const formattedValue = formatDate(parseDate(date))
|
|
19
|
+
|
|
20
|
+
return (
|
|
21
|
+
!isDateBefore(date, value)
|
|
22
|
+
|| ruleMessage(errorMessages, 'default', [formattedValue])
|
|
23
|
+
)
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { isNotBeforeDateFn } from '..'
|
|
2
|
+
import { describe, it, expect } from 'vitest'
|
|
3
|
+
|
|
4
|
+
import dayjs from 'dayjs'
|
|
5
|
+
import { formatDate } from '@/utils/formatDate'
|
|
6
|
+
|
|
7
|
+
describe('isNotBeforeDate', () => {
|
|
8
|
+
const currentDate = formatDate(dayjs())
|
|
9
|
+
const pastDate = formatDate(dayjs().subtract(1, 'year'))
|
|
10
|
+
const futureDate = formatDate(dayjs().add(1, 'year'))
|
|
11
|
+
|
|
12
|
+
const rule = isNotBeforeDateFn(currentDate)
|
|
13
|
+
|
|
14
|
+
it('returns true with a future date', () => {
|
|
15
|
+
expect(rule(futureDate)).toBe(true)
|
|
16
|
+
})
|
|
17
|
+
|
|
18
|
+
it('returns an error with a past date', () => {
|
|
19
|
+
expect(typeof rule(pastDate)).toBe('string')
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
it('returns true if the value is falsy', () => {
|
|
23
|
+
expect(rule('')).toBe(true)
|
|
24
|
+
})
|
|
25
|
+
})
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { Meta, Canvas, Source } from '@storybook/blocks';
|
|
2
|
+
import * as IsNotBeforeTodayStories from './IsNotBeforeToday.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={IsNotBeforeTodayStories} />
|
|
5
|
+
|
|
6
|
+
# Règle de validation `isNotBeforeToday`
|
|
7
|
+
|
|
8
|
+
La règle de validation `isNotBeforeToday` permet de vérifier qu'une date n'est pas antérieur à la date du jour.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Pour utiliser cette règle de validation, vous devez importer la règle depuis le package `@cnamts/synapse`.
|
|
13
|
+
|
|
14
|
+
<Source dark code={`
|
|
15
|
+
import { isNotBeforeToday } from '@cnamts/synapse';
|
|
16
|
+
`} />
|
|
17
|
+
|
|
18
|
+
|
|
19
|
+
Vous pouvez ensuite utiliser la fonction comme règle d'un champs de formulaire.
|
|
20
|
+
|
|
21
|
+
<Source dark code={`
|
|
22
|
+
<script setup lang="ts">
|
|
23
|
+
import { isNotBeforeToday } from '@cnamts/synapse';
|
|
24
|
+
import { VTextField } from 'vuetify/components';
|
|
25
|
+
|
|
26
|
+
</script>
|
|
27
|
+
|
|
28
|
+
<template>
|
|
29
|
+
<VTextField
|
|
30
|
+
:rules="[isNotBeforeToday]"
|
|
31
|
+
label="Date"
|
|
32
|
+
/>
|
|
33
|
+
</template>
|
|
34
|
+
`} />
|
|
35
|
+
|
|
36
|
+
## Customisation des messages d'erreur
|
|
37
|
+
|
|
38
|
+
Vous pouvez personnaliser les messages d'erreur en passant un objet `errorMessages` en paramètre de la fonction `isNotBeforeTodayFn`.
|
|
39
|
+
Puis en utilisant la fonction retournée comme règle d'un champs de formulaire.
|
|
40
|
+
|
|
41
|
+
<Source dark code={`
|
|
42
|
+
<script setup lang="ts">
|
|
43
|
+
import { isNotBeforeTodayFn } from '@cnamts/synapse';
|
|
44
|
+
import { VTextField } from 'vuetify/components';
|
|
45
|
+
|
|
46
|
+
const notBeforeToday = isNotBeforeTodayFn({
|
|
47
|
+
default: \`The date must not be Before today\`,
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
</script>
|
|
51
|
+
|
|
52
|
+
<template>
|
|
53
|
+
<VTextField
|
|
54
|
+
:rules="[notBeforeToday]"
|
|
55
|
+
label="Date"
|
|
56
|
+
/>
|
|
57
|
+
</template>
|
|
58
|
+
`} />
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
<Source dark code={`
|
|
63
|
+
|
|
64
|
+
isNotBeforeTodayFn(
|
|
65
|
+
errorMessages?: {
|
|
66
|
+
default: string;
|
|
67
|
+
}
|
|
68
|
+
): (value: string) => true | string;
|
|
69
|
+
|
|
70
|
+
`} />
|
|
71
|
+
|
|
72
|
+
### Arguments
|
|
73
|
+
|
|
74
|
+
- `errorMessages` : objet optionnel permettant de personnaliser les messages d'erreur. Les clés disponibles sont :
|
|
75
|
+
- `default` : message d'erreur par défaut.
|
|
76
|
+
|
|
77
|
+
### Valeurs de retour
|
|
78
|
+
|
|
79
|
+
Retourne une fonction qui prend en paramètre une chaîne de caractères représentant une date et retourne `true` si la date n'est pas antérieur à la date du jour, sinon retourne un message d'erreur.
|
|
80
|
+
|
|
81
|
+
## Exemples
|
|
82
|
+
|
|
83
|
+
<Canvas of={IsNotBeforeTodayStories.Default} />
|
|
@@ -0,0 +1,110 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { VTextField } from 'vuetify/components'
|
|
3
|
+
import { isNotBeforeToday, isNotBeforeTodayFn } from './index'
|
|
4
|
+
import { ref } from 'vue'
|
|
5
|
+
|
|
6
|
+
export default {
|
|
7
|
+
title: 'Guide du dev/Règles De Validation/isNotBeforeToday',
|
|
8
|
+
component: isNotBeforeTodayFn,
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export const Default: StoryObj<unknown> = {
|
|
12
|
+
render: () => {
|
|
13
|
+
return {
|
|
14
|
+
components: { VTextField },
|
|
15
|
+
setup() {
|
|
16
|
+
const model = ref('12/12/2050')
|
|
17
|
+
|
|
18
|
+
return { model, isNotBeforeToday }
|
|
19
|
+
},
|
|
20
|
+
template: `
|
|
21
|
+
<VTextField
|
|
22
|
+
v-model="model"
|
|
23
|
+
:rules="[isNotBeforeToday]"
|
|
24
|
+
label="Date"
|
|
25
|
+
variant="outlined"
|
|
26
|
+
validate-on="eager blur"
|
|
27
|
+
/>
|
|
28
|
+
`,
|
|
29
|
+
}
|
|
30
|
+
},
|
|
31
|
+
parameters: {
|
|
32
|
+
sourceCode: [
|
|
33
|
+
{
|
|
34
|
+
name: 'Script',
|
|
35
|
+
code: `
|
|
36
|
+
<script setup lang="ts">
|
|
37
|
+
import { VTextField } from 'vuetify/components'
|
|
38
|
+
import { isNotBeforeToday } from '@cnamts/synapse'
|
|
39
|
+
</script>
|
|
40
|
+
`,
|
|
41
|
+
},
|
|
42
|
+
{
|
|
43
|
+
name: 'Template',
|
|
44
|
+
code: `
|
|
45
|
+
<template>
|
|
46
|
+
<VTextField
|
|
47
|
+
:rules="[isNotBeforeToday]"
|
|
48
|
+
label="Date"
|
|
49
|
+
variant="outlined"
|
|
50
|
+
/>
|
|
51
|
+
</template>
|
|
52
|
+
`,
|
|
53
|
+
},
|
|
54
|
+
],
|
|
55
|
+
},
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
export const CustomMessage: StoryObj<unknown> = {
|
|
59
|
+
render: () => {
|
|
60
|
+
return {
|
|
61
|
+
components: { VTextField },
|
|
62
|
+
setup() {
|
|
63
|
+
const messages = {
|
|
64
|
+
default: 'The date must not be Before today.',
|
|
65
|
+
}
|
|
66
|
+
const dateRule = isNotBeforeTodayFn(messages)
|
|
67
|
+
|
|
68
|
+
return { dateRule }
|
|
69
|
+
},
|
|
70
|
+
template: `
|
|
71
|
+
<VTextField
|
|
72
|
+
:rules="[dateRule]"
|
|
73
|
+
label="Date"
|
|
74
|
+
variant="outlined"
|
|
75
|
+
validate-on="eager blur"
|
|
76
|
+
/>
|
|
77
|
+
`,
|
|
78
|
+
}
|
|
79
|
+
},
|
|
80
|
+
parameters: {
|
|
81
|
+
sourceCode: [
|
|
82
|
+
{
|
|
83
|
+
name: 'Script',
|
|
84
|
+
code: `
|
|
85
|
+
<script setup lang="ts">
|
|
86
|
+
import { VTextField } from 'vuetify/components'
|
|
87
|
+
import { isNotBeforeTodayFn } from '@cnamts/synapse'
|
|
88
|
+
|
|
89
|
+
const messages = {
|
|
90
|
+
default: 'The date must not be Before today.',
|
|
91
|
+
}
|
|
92
|
+
const dateRule = isNotBeforeTodayFn(messages)
|
|
93
|
+
</script>
|
|
94
|
+
`,
|
|
95
|
+
},
|
|
96
|
+
{
|
|
97
|
+
name: 'Template',
|
|
98
|
+
code: `
|
|
99
|
+
<template>
|
|
100
|
+
<VTextField
|
|
101
|
+
:rules="[dateRule]"
|
|
102
|
+
label="Date"
|
|
103
|
+
variant="outlined"
|
|
104
|
+
/>
|
|
105
|
+
</template>
|
|
106
|
+
`,
|
|
107
|
+
},
|
|
108
|
+
],
|
|
109
|
+
},
|
|
110
|
+
}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { formatDate } from '@/utils/formatDate'
|
|
2
|
+
import { ruleMessage } from '@/utils/ruleMessage'
|
|
3
|
+
import dayjs from 'dayjs'
|
|
4
|
+
import { isDateBefore } from '../../functions/validation/isDateBefore'
|
|
5
|
+
import type {
|
|
6
|
+
ErrorMessages,
|
|
7
|
+
ValidationResult,
|
|
8
|
+
ValidationRule,
|
|
9
|
+
Value,
|
|
10
|
+
} from '../types'
|
|
11
|
+
import { defaultErrorMessages } from './locales'
|
|
12
|
+
|
|
13
|
+
/** Check that the value is not before today (DD/MM/YYYY format) */
|
|
14
|
+
export function isNotBeforeTodayFn(
|
|
15
|
+
errorMessages: ErrorMessages = defaultErrorMessages,
|
|
16
|
+
): ValidationRule {
|
|
17
|
+
return (value: Value): ValidationResult => {
|
|
18
|
+
if (!value) {
|
|
19
|
+
return true
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
return (
|
|
23
|
+
!isDateBefore(formatDate(dayjs()), value) || ruleMessage(errorMessages, 'default')
|
|
24
|
+
)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export const isNotBeforeToday = isNotBeforeTodayFn()
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import dayjs from 'dayjs'
|
|
2
|
+
|
|
3
|
+
import { isNotBeforeToday, isNotBeforeTodayFn } from '..'
|
|
4
|
+
import { describe, it, expect } from 'vitest'
|
|
5
|
+
|
|
6
|
+
const DATE_FORMAT = 'DD/MM/YYYY'
|
|
7
|
+
|
|
8
|
+
const pastDate = dayjs().subtract(1, 'year').format(DATE_FORMAT)
|
|
9
|
+
const futureDate = dayjs().add(1, 'year').format(DATE_FORMAT)
|
|
10
|
+
const today = dayjs().format(DATE_FORMAT)
|
|
11
|
+
|
|
12
|
+
describe('isNotBeforeToday', () => {
|
|
13
|
+
it('returns an error when the date is past', () => {
|
|
14
|
+
expect(typeof isNotBeforeToday(pastDate)).toBe('string')
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
it('returns true when the date is future', () => {
|
|
18
|
+
expect(isNotBeforeToday(futureDate)).toBe(true)
|
|
19
|
+
})
|
|
20
|
+
|
|
21
|
+
it('returns true if the value is falsy', () => {
|
|
22
|
+
expect(isNotBeforeToday('')).toBe(true)
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
it('works with custom error messages', () => {
|
|
26
|
+
const rule = isNotBeforeTodayFn({
|
|
27
|
+
default: 'test',
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
expect(rule(pastDate)).toBe('test')
|
|
31
|
+
})
|
|
32
|
+
|
|
33
|
+
it('returns true when value is today', () => {
|
|
34
|
+
expect(isNotBeforeToday(today)).toBe(true)
|
|
35
|
+
})
|
|
36
|
+
})
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { Meta, Canvas, Source } from '@storybook/blocks';
|
|
2
|
+
import * as IsRequiredStories from './IsRequired.stories';
|
|
3
|
+
|
|
4
|
+
<Meta of={IsRequiredStories} />
|
|
5
|
+
|
|
6
|
+
# Règle de validation `isRequired`
|
|
7
|
+
|
|
8
|
+
La règle de validation `isRequired` permet de vérifier qu'un champ de formulaire est rempli.
|
|
9
|
+
|
|
10
|
+
## Usage
|
|
11
|
+
|
|
12
|
+
Pour utiliser cette règle de validation, vous devez importer la fonction d'ordre supérieur `isRequiredFn` depuis le package `@cnamts/synapse`.
|
|
13
|
+
|
|
14
|
+
<Source dark code={`
|
|
15
|
+
import { isRequiredFn } from '@cnamts/synapse';
|
|
16
|
+
`} />
|
|
17
|
+
|
|
18
|
+
Vous devez ensuite faire appel à cette fonction pour obtenir la règle de validation.
|
|
19
|
+
|
|
20
|
+
<Source dark code={`
|
|
21
|
+
const isRequired = isRequiredFn(/* options */);
|
|
22
|
+
`} />
|
|
23
|
+
|
|
24
|
+
Vous pouvez ensuite utiliser la fonction retournée comme règle d'un champs de formulaire.
|
|
25
|
+
|
|
26
|
+
<Source dark code={`
|
|
27
|
+
<script setup lang="ts">
|
|
28
|
+
import { isRequiredFn } from '@cnamts/synapse';
|
|
29
|
+
import { VTextField } from 'vuetify/components';
|
|
30
|
+
|
|
31
|
+
const isRequired = isRequiredFn(/* options */);
|
|
32
|
+
|
|
33
|
+
</script>
|
|
34
|
+
|
|
35
|
+
<template>
|
|
36
|
+
<VTextField
|
|
37
|
+
:rules="[isRequired]"
|
|
38
|
+
label="Required field"
|
|
39
|
+
/>
|
|
40
|
+
</template>
|
|
41
|
+
`} />
|
|
42
|
+
|
|
43
|
+
Si vous utilisez cette règle sans options, vous pouvez faire appel à la fonction `isRequired`.
|
|
44
|
+
|
|
45
|
+
<Source dark code={`
|
|
46
|
+
<script setup lang="ts">
|
|
47
|
+
import { isRequired } from '@cnamts/synapse';
|
|
48
|
+
import { VTextField } from 'vuetify/components';
|
|
49
|
+
</script>
|
|
50
|
+
|
|
51
|
+
<template>
|
|
52
|
+
<VTextField
|
|
53
|
+
:rules="[isRequired]"
|
|
54
|
+
label="Required field"
|
|
55
|
+
/>
|
|
56
|
+
</template>
|
|
57
|
+
|
|
58
|
+
`} />
|
|
59
|
+
|
|
60
|
+
## API
|
|
61
|
+
|
|
62
|
+
<Source dark code={`
|
|
63
|
+
isRequiredFn(
|
|
64
|
+
errorMessages?: {
|
|
65
|
+
default?: string;
|
|
66
|
+
}
|
|
67
|
+
): (value: string) => true | string;
|
|
68
|
+
`} />
|
|
69
|
+
|
|
70
|
+
### Arguments
|
|
71
|
+
|
|
72
|
+
- `errorMessages` : objet optionnel permettant de personnaliser les messages d'erreur. Les clés disponibles sont :
|
|
73
|
+
- `default` : message d'erreur par défaut.
|
|
74
|
+
|
|
75
|
+
### Valeurs de retour
|
|
76
|
+
|
|
77
|
+
Retourne une fonction pouvant être utilisée comme règle de validation pour un champs de formulaire Vuetify.
|
|
78
|
+
|
|
79
|
+
## Exemples
|
|
80
|
+
|
|
81
|
+
<Canvas of={IsRequiredStories.Default} />
|