@cnamts/synapse 1.0.6 → 1.0.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{DateFilter-BlOpwEVq.js → DateFilter-DkqG0pmr.js} +1 -1
- package/dist/{NumberFilter-BPUXE4wY.js → NumberFilter-Ck7AwD39.js} +1 -1
- package/dist/{PeriodFilter-B2yx329_.js → PeriodFilter-LRI6YpgU.js} +1 -1
- package/dist/{SelectFilter-CedKn1oV.js → SelectFilter-DPc70Jk7.js} +1 -1
- package/dist/{TextFilter-DkhJjRtR.js → TextFilter-DRQL7uD8.js} +1 -1
- package/dist/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.d.ts +116 -0
- package/dist/components/Amelipro/AmeliproAccordionGroup/types.d.ts +4 -0
- package/dist/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.d.ts +220 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.d.ts +68 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.d.ts +70 -0
- package/dist/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.d.ts +204 -0
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +26 -26
- package/dist/components/Amelipro/AmeliproBadge/AmeliproBadge.d.ts +59 -0
- package/dist/components/Amelipro/AmeliproBtn/AmeliproBtn.d.ts +3 -3
- package/dist/components/Amelipro/AmeliproCaptcha/AmeliproCaptcha.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarousel.d.ts +214 -0
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/AmeliproCarouselItem.d.ts +70 -0
- package/dist/components/Amelipro/AmeliproCarousel/types.d.ts +7 -0
- package/dist/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.d.ts +125 -0
- package/dist/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproIllustratedDataTile/AmeliproIllustratedDataTile.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproResultList/AmeliproResultList.d.ts +164 -0
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +27 -27
- package/dist/components/Amelipro/AmeliproStateTile/AmeliproStateTile.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTable/AmeliproTable.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +32 -32
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +7 -7
- package/dist/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.d.ts +1 -1
- package/dist/components/Amelipro/AmeliproTooltips/AmeliproTooltips.d.ts +2 -2
- package/dist/components/ChipList/ChipList.d.ts +4 -0
- package/dist/components/ChipList/locales.d.ts +4 -2
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +8 -8
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +329 -1296
- package/dist/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.d.ts +0 -1
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +2 -0
- package/dist/components/Customs/SyTabs/SyTabs.d.ts +71 -0
- package/dist/components/Customs/SyTabs/config.d.ts +17 -0
- package/dist/components/Customs/SyTabs/types.d.ts +11 -0
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +9 -9
- package/dist/components/DataList/DataList.d.ts +1 -1
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +4811 -240
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +52 -33
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +23 -10
- package/dist/components/DatePicker/composables/useDateInputEditing.d.ts +1 -0
- package/dist/components/DatePicker/composables/useTodayButton.d.ts +1 -0
- package/dist/components/DialogBox/DialogBox.d.ts +219 -0
- package/dist/components/HeaderLoading/HeaderLoading.d.ts +27 -0
- package/dist/components/HeaderNavigationBar/HeaderNavigationBar.d.ts +110 -3
- package/dist/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.d.ts +19 -1
- package/dist/components/LangBtn/LangBtn.d.ts +2 -2
- package/dist/components/NirField/NirField.d.ts +18 -18
- package/dist/components/PeriodField/PeriodField.d.ts +10766 -1620
- package/dist/components/PhoneField/PhoneField.d.ts +1866 -2
- package/dist/components/PhoneField/indicatifs.d.ts +1 -0
- package/dist/components/PhoneField/locales.d.ts +1 -0
- package/dist/components/RangeField/RangeField.d.ts +1 -1
- package/dist/components/RangeField/RangeSlider/RangeSlider.d.ts +1 -1
- package/dist/components/SubHeader/SubHeader.d.ts +8 -0
- package/dist/components/SubHeader/locales.d.ts +1 -0
- package/dist/components/SyTextArea/SyTextArea.d.ts +6 -6
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +5 -4
- package/dist/components/Tables/SyTable/SyTable.d.ts +5 -4
- package/dist/components/Tables/common/SyTablePagination.d.ts +333 -1296
- package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +2 -2
- package/dist/components/Tables/common/types.d.ts +2 -0
- package/dist/components/index.d.ts +9 -0
- package/dist/design-system-v3.js +173 -164
- package/dist/design-system-v3.umd.cjs +286 -263
- package/dist/{main-BXPFSAB4.js → main-DXMoMtj5.js} +13176 -11457
- package/dist/services/NotificationService.d.ts +1 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/amelipro/icons.ts +38 -11
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.mdx +20 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.stories.ts +135 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/AmeliproAccordionGroup.vue +107 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/AmeliproAccordionGroup.spec.ts +37 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/__snapshots__/AmeliproAccordionGroup.spec.ts.snap +513 -0
- package/src/components/Amelipro/AmeliproAccordionGroup/types.d.ts +4 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.mdx +16 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.stories.ts +300 -0
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +288 -0
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/AmeliproAccordionList.spec.ts +38 -0
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/__snapshots__/AmeliproAccordionList.spec.ts.snap +1712 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.mdx +19 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.stories.ts +68 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.vue +66 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/AmeliproAccordionResultTemplate.vue +145 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/AmeliproAccordionResultTemplate.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/__snapshots__/AmeliproAccordionResultTemplate.spec.ts.snap +127 -0
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/AmeliproAccordionResult.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/__snapshots__/AmeliproAccordionResult.spec.ts.snap +123 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.mdx +20 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.stories.ts +273 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +275 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/AmeliproAccordionResultList.spec.ts +38 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/__snapshots__/AmeliproAccordionResultList.spec.ts.snap +1593 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.mdx +15 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.stories.ts +54 -0
- package/src/components/Amelipro/AmeliproBadge/AmeliproBadge.vue +76 -0
- package/src/components/Amelipro/AmeliproBadge/__tests__/AmeliproBadge.spec.ts +20 -0
- package/src/components/Amelipro/AmeliproBadge/__tests__/__snapshots__/AmeliproBadge.spec.ts.snap +19 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.mdx +15 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.stories.ts +191 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarousel.vue +263 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/AmeliproCarouselItem.vue +93 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/AmeliproCarouselItem.spec.ts +24 -0
- package/src/components/Amelipro/AmeliproCarousel/AmeliproCarouselItem/__tests__/__snapshots__/AmeliproCarouselItem.spec.ts.snap +43 -0
- package/src/components/Amelipro/AmeliproCarousel/__tests__/AmeliproCarousel.spec.ts +40 -0
- package/src/components/Amelipro/AmeliproCarousel/__tests__/__snapshots__/AmeliproCarousel.spec.ts.snap +342 -0
- package/src/components/Amelipro/AmeliproCarousel/types.d.ts +8 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.mdx +18 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.stories.ts +67 -0
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.vue +233 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/AmeliproClickableTile.spec.ts +21 -0
- package/src/components/Amelipro/AmeliproClickableTile/tests/__snapshots__/AmeliproClickableTile.spec.ts.snap +140 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeader.vue +7 -1
- package/src/components/Amelipro/AmeliproHeader/tests/__snapshots__/AmeliproHeader.spec.ts.snap +5 -4
- package/src/components/Amelipro/AmeliproIcon/iconList.ts +6 -0
- package/src/components/Amelipro/AmeliproPageLayout/tests/__snapshots__/AmeliproPageLayout.spec.ts.snap +5 -4
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.mdx +15 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.stories.ts +264 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.vue +231 -0
- package/src/components/Amelipro/AmeliproResultList/__tests__/AmeliproResultList.spec.ts +37 -0
- package/src/components/Amelipro/AmeliproResultList/__tests__/__snapshots__/AmeliproResultList.spec.ts.snap +434 -0
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +6 -5
- package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +23 -26
- package/src/components/Amelipro/AmeliproTileBtn/AmeliproTileBtn.stories.ts +2 -2
- package/src/components/ChipList/Accessibilite.stories.ts +4 -0
- package/src/components/ChipList/ChipList.vue +185 -42
- package/src/components/ChipList/locales.ts +4 -2
- package/src/components/ChipList/tests/chipList.spec.ts +7 -4
- package/src/components/Customs/Selects/SelectOverview.mdx +34 -66
- package/src/components/Customs/Selects/SyBtnSelect/SyBtnSelect.stories.ts +10 -10
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.mdx +3 -0
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.stories.ts +14 -0
- package/src/components/Customs/Selects/SySelect/SySelect.stories.ts +14 -6
- package/src/components/Customs/Selects/SySelect/SySelect.vue +268 -205
- package/src/components/Customs/Selects/SySelect/composables/tests/useSySelectKeyboard.spec.ts +0 -10
- package/src/components/Customs/Selects/SySelect/composables/useSySelectKeyboard.ts +0 -5
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +184 -25
- package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +3 -1
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +165 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +28 -9
- package/src/components/Customs/SyTabs/Accessibilite.mdx +309 -0
- package/src/components/Customs/SyTabs/SyTabs.mdx +117 -0
- package/src/components/Customs/SyTabs/SyTabs.stories.ts +354 -0
- package/src/components/Customs/SyTabs/SyTabs.vue +413 -0
- package/src/components/Customs/SyTabs/config.ts +17 -0
- package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +425 -0
- package/src/components/Customs/SyTabs/types.ts +12 -0
- package/src/components/Customs/SyTextField/SyTextField.mdx +3 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +142 -1
- package/src/components/Customs/SyTextField/SyTextField.vue +19 -16
- package/src/components/DataList/DataList.vue +47 -49
- package/src/components/DataListGroup/DataListGroup.vue +1 -1
- package/src/components/DataListItem/DataListItem.vue +67 -63
- package/src/components/DataListItem/tests/DataListItem.spec.ts +2 -2
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +3 -3
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +49 -13
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +412 -649
- package/src/components/DatePicker/DatePickerValidationExample/CalendarMode.stories.ts +215 -0
- package/src/components/DatePicker/DatePickerValidationExample/ComplexDatePicker.stories.ts +218 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.mdx +2 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts +1 -1
- package/src/components/DatePicker/DatePickerValidationExample/DateTextInput.stories.ts +218 -0
- package/src/components/DatePicker/DatePickerValidationExample/MultiMode.stories.ts +281 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +17 -4
- package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +111 -18
- package/src/components/DatePicker/DateTextInput/DateTextInput.spec.ts +238 -6
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +716 -757
- package/src/components/DatePicker/composables/tests/useDateInputEditing.spec.ts +4 -4
- package/src/components/DatePicker/composables/tests/useDisplayedDateString.spec.ts +17 -10
- package/src/components/DatePicker/composables/useDateInputEditing.ts +52 -22
- package/src/components/DatePicker/composables/useDisplayedDateString.ts +18 -4
- package/src/components/DatePicker/composables/useTodayButton.ts +13 -1
- package/src/components/DatePicker/utils/dateFormattingUtils.ts +79 -14
- package/src/components/DialogBox/DialogBox.stories.ts +12 -0
- package/src/components/DialogBox/DialogBox.vue +16 -11
- package/src/components/DialogBox/tests/DialogBox.spec.ts +22 -0
- package/src/components/HeaderLoading/Accessibilite.mdx +429 -8
- package/src/components/HeaderLoading/Accessibilite.stories.ts +4 -0
- package/src/components/HeaderLoading/HeaderLoading.vue +59 -0
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.mdx +17 -2
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.stories.ts +91 -2
- package/src/components/HeaderNavigationBar/HeaderNavigationBar.vue +37 -1
- package/src/components/HeaderNavigationBar/HorizontalNavbar/HorizontalNavbar.vue +284 -21
- package/src/components/HeaderNavigationBar/tests/HeaderNavigationBar.spec.ts +2 -2
- package/src/components/NirField/NirField.mdx +3 -0
- package/src/components/NirField/NirField.vue +10 -1
- package/src/components/NirField/tests/NirField.spec.ts +81 -0
- package/src/components/NotificationBar/NotificationBar.stories.ts +128 -2
- package/src/components/NotificationBar/NotificationBar.vue +16 -1
- package/src/components/NotificationBar/tests/NotificationBar.spec.ts +65 -0
- package/src/components/PasswordField/PasswordField.mdx +3 -0
- package/src/components/PeriodField/PeriodField.mdx +2 -0
- package/src/components/PeriodField/PeriodField.stories.ts +195 -0
- package/src/components/PhoneField/Accessibilite.stories.ts +4 -0
- package/src/components/PhoneField/PhoneField.mdx +3 -1
- package/src/components/PhoneField/PhoneField.stories.ts +285 -1
- package/src/components/PhoneField/PhoneField.vue +228 -95
- package/src/components/PhoneField/indicatifs.ts +102 -102
- package/src/components/PhoneField/locales.ts +1 -0
- package/src/components/PhoneField/tests/PhoneField.spec.ts +419 -2
- package/src/components/SkipLink/SkipLink.vue +3 -31
- package/src/components/SkipLink/tests/skipLink.spec.ts +0 -21
- package/src/components/SubHeader/Accessibilite.stories.ts +8 -0
- package/src/components/SubHeader/SubHeader.mdx +1 -0
- package/src/components/SubHeader/SubHeader.stories.ts +179 -60
- package/src/components/SubHeader/SubHeader.vue +45 -15
- package/src/components/SubHeader/locales.ts +1 -0
- package/src/components/SyAlert/SyAlert.vue +6 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +3 -10
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +242 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +29 -10
- package/src/components/Tables/SyTable/SyTable.mdx +3 -10
- package/src/components/Tables/SyTable/SyTable.stories.ts +242 -0
- package/src/components/Tables/SyTable/SyTable.vue +2 -0
- package/src/components/Tables/common/SyTablePagination.vue +13 -6
- package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +6 -1
- package/src/components/Tables/common/tests/SyTablePagination.spec.ts +157 -0
- package/src/components/Tables/common/types.ts +2 -0
- package/src/components/index.ts +9 -0
- package/src/composables/useFilterable/useFilterable.ts +10 -0
- package/src/designTokens/tokens/amelipro/apColors.ts +1 -1
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +3 -3
- package/src/services/NotificationService.ts +9 -0
- package/src/stories/Components/Components.stories.ts +1 -1
- package/src/stories/GuideDuDev/FormValidationGuide.mdx +342 -0
- package/src/stories/Templates/Templates.stories.ts +1 -1
- package/src/utils/functions/ameliproColors/ameliproColors.ts +1 -1
- package/dist/components/DataList/locales.d.ts +0 -3
- package/src/components/DataList/locales.ts +0 -3
- package/src/components/PhoneField/tests/PhoneField.additional.spec.ts +0 -266
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import DatePicker from '../../DatePicker/CalendarMode/DatePicker.vue'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Composants/Formulaires/DatePicker/Validation/Submit/CalendarMode',
|
|
7
|
+
component: DatePicker,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'Exemples de validation pour le composant DatePicker avec calendrier.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} as Meta
|
|
16
|
+
|
|
17
|
+
export const Required: StoryObj = {
|
|
18
|
+
parameters: {
|
|
19
|
+
sourceCode: [
|
|
20
|
+
{
|
|
21
|
+
name: 'Template',
|
|
22
|
+
code: `
|
|
23
|
+
<template>
|
|
24
|
+
<v-form @submit.prevent="handleSubmit">
|
|
25
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
26
|
+
<div>
|
|
27
|
+
<h3 class="mb-4">Avec calendrier</h3>
|
|
28
|
+
<DatePicker
|
|
29
|
+
ref="datePicker1"
|
|
30
|
+
v-model="date1"
|
|
31
|
+
required
|
|
32
|
+
format="DD/MM/YYYY"
|
|
33
|
+
placeholder="Date requise"
|
|
34
|
+
/>
|
|
35
|
+
</div>
|
|
36
|
+
</div>
|
|
37
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
38
|
+
Soumettre
|
|
39
|
+
</button>
|
|
40
|
+
</v-form>
|
|
41
|
+
</template>
|
|
42
|
+
`,
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
name: 'Script',
|
|
46
|
+
code: `
|
|
47
|
+
<script setup lang="ts">
|
|
48
|
+
import { ref } from 'vue'
|
|
49
|
+
import { DatePicker } from '@cnamts/synapse'
|
|
50
|
+
|
|
51
|
+
const datePicker1 = ref()
|
|
52
|
+
const date1 = ref('')
|
|
53
|
+
|
|
54
|
+
const handleSubmit = () => {
|
|
55
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
56
|
+
|
|
57
|
+
if (!isValid1) {
|
|
58
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
59
|
+
} else {
|
|
60
|
+
alert('Formulaire soumis avec succès !')
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
</script>
|
|
64
|
+
`,
|
|
65
|
+
},
|
|
66
|
+
],
|
|
67
|
+
},
|
|
68
|
+
render: () => ({
|
|
69
|
+
components: { DatePicker },
|
|
70
|
+
setup() {
|
|
71
|
+
const datePicker1 = ref()
|
|
72
|
+
const date1 = ref('')
|
|
73
|
+
|
|
74
|
+
const handleSubmit = () => {
|
|
75
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
76
|
+
|
|
77
|
+
if (!isValid1) {
|
|
78
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
alert('Formulaire soumis avec succès !')
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
datePicker1,
|
|
87
|
+
date1,
|
|
88
|
+
handleSubmit,
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
template: `
|
|
92
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
93
|
+
<form @submit.prevent="handleSubmit" style="width: 100%;">
|
|
94
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
95
|
+
<div>
|
|
96
|
+
<DatePicker
|
|
97
|
+
ref="datePicker1"
|
|
98
|
+
v-model="date1"
|
|
99
|
+
required
|
|
100
|
+
format="DD/MM/YYYY"
|
|
101
|
+
placeholder="Date requise"
|
|
102
|
+
/>
|
|
103
|
+
</div>
|
|
104
|
+
</div>
|
|
105
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
106
|
+
Soumettre
|
|
107
|
+
</button>
|
|
108
|
+
</form>
|
|
109
|
+
</div>
|
|
110
|
+
`,
|
|
111
|
+
}),
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
export const WithCustomRulesAndRequired: StoryObj = {
|
|
115
|
+
parameters: {
|
|
116
|
+
sourceCode: [
|
|
117
|
+
{
|
|
118
|
+
name: 'Template',
|
|
119
|
+
code: `
|
|
120
|
+
<template>
|
|
121
|
+
<v-form @submit.prevent="handleSubmit">
|
|
122
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
123
|
+
<div>
|
|
124
|
+
<h3 class="mb-4">Avec calendrier</h3>
|
|
125
|
+
<DatePicker
|
|
126
|
+
ref="datePicker1"
|
|
127
|
+
v-model="date1"
|
|
128
|
+
required
|
|
129
|
+
format="DD/MM/YYYY"
|
|
130
|
+
placeholder="Date requise"
|
|
131
|
+
:customRules="[
|
|
132
|
+
{ type: 'notAfterToday', options: { message: 'La date ne peut pas être après aujourd'hui' } },
|
|
133
|
+
]"
|
|
134
|
+
/>
|
|
135
|
+
</div>
|
|
136
|
+
</div>
|
|
137
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
138
|
+
Soumettre
|
|
139
|
+
</button>
|
|
140
|
+
</v-form>
|
|
141
|
+
</template>
|
|
142
|
+
`,
|
|
143
|
+
},
|
|
144
|
+
{
|
|
145
|
+
name: 'Script',
|
|
146
|
+
code: `
|
|
147
|
+
<script setup lang="ts">
|
|
148
|
+
import { ref } from 'vue'
|
|
149
|
+
import { DatePicker } from '@cnamts/synapse'
|
|
150
|
+
|
|
151
|
+
const datePicker1 = ref()
|
|
152
|
+
const date1 = ref('01/01/2100')
|
|
153
|
+
|
|
154
|
+
const handleSubmit = () => {
|
|
155
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
156
|
+
|
|
157
|
+
if (!isValid1) {
|
|
158
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
159
|
+
} else {
|
|
160
|
+
alert('Formulaire soumis avec succès !')
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
</script>
|
|
164
|
+
`,
|
|
165
|
+
},
|
|
166
|
+
],
|
|
167
|
+
},
|
|
168
|
+
render: () => ({
|
|
169
|
+
components: { DatePicker },
|
|
170
|
+
setup() {
|
|
171
|
+
const datePicker1 = ref()
|
|
172
|
+
const date1 = ref('01/01/2100')
|
|
173
|
+
|
|
174
|
+
const handleSubmit = () => {
|
|
175
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
176
|
+
|
|
177
|
+
if (!isValid1) {
|
|
178
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
179
|
+
}
|
|
180
|
+
else {
|
|
181
|
+
alert('Formulaire soumis avec succès !')
|
|
182
|
+
}
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
return {
|
|
186
|
+
datePicker1,
|
|
187
|
+
date1,
|
|
188
|
+
handleSubmit,
|
|
189
|
+
}
|
|
190
|
+
},
|
|
191
|
+
template: `
|
|
192
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
193
|
+
<form @submit.prevent="handleSubmit" style="width: 100%;">
|
|
194
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
195
|
+
<div>
|
|
196
|
+
<DatePicker
|
|
197
|
+
ref="datePicker1"
|
|
198
|
+
v-model="date1"
|
|
199
|
+
required
|
|
200
|
+
format="DD/MM/YYYY"
|
|
201
|
+
placeholder="Date requise"
|
|
202
|
+
:custom-rules="[
|
|
203
|
+
{ type: 'notAfterToday', options: { message: 'La date ne peut pas être après aujourdhui' } },
|
|
204
|
+
]"
|
|
205
|
+
/>
|
|
206
|
+
</div>
|
|
207
|
+
</div>
|
|
208
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
209
|
+
Soumettre
|
|
210
|
+
</button>
|
|
211
|
+
</form>
|
|
212
|
+
</div>
|
|
213
|
+
`,
|
|
214
|
+
}),
|
|
215
|
+
}
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import DatePicker from '../../DatePicker/CalendarMode/DatePicker.vue'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Composants/Formulaires/DatePicker/Validation/Submit/ComnbinedMode',
|
|
7
|
+
component: DatePicker,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'Exemples de validation pour le ComnbinedMode.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} as Meta
|
|
16
|
+
|
|
17
|
+
export const Required: StoryObj = {
|
|
18
|
+
parameters: {
|
|
19
|
+
sourceCode: [
|
|
20
|
+
{
|
|
21
|
+
name: 'Template',
|
|
22
|
+
code: `
|
|
23
|
+
<template>
|
|
24
|
+
<v-form @submit.prevent="handleSubmit">
|
|
25
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
26
|
+
<div>
|
|
27
|
+
<h3 class="mb-4">Avec calendrier</h3>
|
|
28
|
+
<DatePicker
|
|
29
|
+
ref="datePicker1"
|
|
30
|
+
v-model="date1"
|
|
31
|
+
required
|
|
32
|
+
format="DD/MM/YYYY"
|
|
33
|
+
placeholder="Date requise"
|
|
34
|
+
useCombinedMode
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
39
|
+
Soumettre
|
|
40
|
+
</button>
|
|
41
|
+
</v-form>
|
|
42
|
+
</template>
|
|
43
|
+
`,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Script',
|
|
47
|
+
code: `
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { ref } from 'vue'
|
|
50
|
+
import { DatePicker } from '@cnamts/synapse'
|
|
51
|
+
|
|
52
|
+
const datePicker1 = ref()
|
|
53
|
+
const date1 = ref('')
|
|
54
|
+
|
|
55
|
+
const handleSubmit = () => {
|
|
56
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
57
|
+
|
|
58
|
+
if (!isValid1) {
|
|
59
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
60
|
+
} else {
|
|
61
|
+
alert('Formulaire soumis avec succès !')
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
`,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
render: () => ({
|
|
70
|
+
components: { DatePicker },
|
|
71
|
+
setup() {
|
|
72
|
+
const datePicker1 = ref()
|
|
73
|
+
const date1 = ref(null)
|
|
74
|
+
|
|
75
|
+
const handleSubmit = () => {
|
|
76
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
77
|
+
|
|
78
|
+
if (!isValid1) {
|
|
79
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
alert('Formulaire soumis avec succès !')
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
return {
|
|
87
|
+
datePicker1,
|
|
88
|
+
date1,
|
|
89
|
+
handleSubmit,
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
template: `
|
|
93
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
94
|
+
<form @submit.prevent="handleSubmit" style="width: 100%;">
|
|
95
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
96
|
+
<div>
|
|
97
|
+
<DatePicker
|
|
98
|
+
ref="datePicker1"
|
|
99
|
+
v-model="date1"
|
|
100
|
+
required
|
|
101
|
+
format="DD/MM/YYYY"
|
|
102
|
+
placeholder="Date requise"
|
|
103
|
+
useCombinedMode
|
|
104
|
+
:is-validate-on-blur="false"
|
|
105
|
+
/>
|
|
106
|
+
</div>
|
|
107
|
+
</div>
|
|
108
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
109
|
+
Soumettre
|
|
110
|
+
</button>
|
|
111
|
+
</form>
|
|
112
|
+
</div>
|
|
113
|
+
`,
|
|
114
|
+
}),
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export const WithCustomRulesAndRequired: StoryObj = {
|
|
118
|
+
parameters: {
|
|
119
|
+
sourceCode: [
|
|
120
|
+
{
|
|
121
|
+
name: 'Template',
|
|
122
|
+
code: `
|
|
123
|
+
<template>
|
|
124
|
+
<v-form @submit.prevent="handleSubmit">
|
|
125
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
126
|
+
<div>
|
|
127
|
+
<h3 class="mb-4">Avec calendrier</h3>
|
|
128
|
+
<DatePicker
|
|
129
|
+
ref="datePicker1"
|
|
130
|
+
v-model="date1"
|
|
131
|
+
required
|
|
132
|
+
format="DD/MM/YYYY"
|
|
133
|
+
placeholder="Date requise"
|
|
134
|
+
:customRules="[
|
|
135
|
+
{ type: 'notAfterToday', options: { message: 'La date ne peut pas être après aujourd'hui' } },
|
|
136
|
+
]"
|
|
137
|
+
/>
|
|
138
|
+
</div>
|
|
139
|
+
</div>
|
|
140
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
141
|
+
Soumettre
|
|
142
|
+
</button>
|
|
143
|
+
</v-form>
|
|
144
|
+
</template>
|
|
145
|
+
`,
|
|
146
|
+
},
|
|
147
|
+
{
|
|
148
|
+
name: 'Script',
|
|
149
|
+
code: `
|
|
150
|
+
<script setup lang="ts">
|
|
151
|
+
import { ref } from 'vue'
|
|
152
|
+
import { DatePicker } from '@cnamts/synapse'
|
|
153
|
+
|
|
154
|
+
const datePicker1 = ref()
|
|
155
|
+
const date1 = ref('01/01/2100')
|
|
156
|
+
|
|
157
|
+
const handleSubmit = () => {
|
|
158
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
159
|
+
|
|
160
|
+
if (!isValid1) {
|
|
161
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
162
|
+
} else {
|
|
163
|
+
alert('Formulaire soumis avec succès !')
|
|
164
|
+
}
|
|
165
|
+
}
|
|
166
|
+
</script>
|
|
167
|
+
`,
|
|
168
|
+
},
|
|
169
|
+
],
|
|
170
|
+
},
|
|
171
|
+
render: () => ({
|
|
172
|
+
components: { DatePicker },
|
|
173
|
+
setup() {
|
|
174
|
+
const datePicker1 = ref()
|
|
175
|
+
const date1 = ref('01/01/2100')
|
|
176
|
+
|
|
177
|
+
const handleSubmit = () => {
|
|
178
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
179
|
+
|
|
180
|
+
if (!isValid1) {
|
|
181
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
182
|
+
}
|
|
183
|
+
else {
|
|
184
|
+
alert('Formulaire soumis avec succès !')
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
return {
|
|
189
|
+
datePicker1,
|
|
190
|
+
date1,
|
|
191
|
+
handleSubmit,
|
|
192
|
+
}
|
|
193
|
+
},
|
|
194
|
+
template: `
|
|
195
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
196
|
+
<form @submit.prevent="handleSubmit" style="width: 100%;">
|
|
197
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
198
|
+
<div>
|
|
199
|
+
<DatePicker
|
|
200
|
+
ref="datePicker1"
|
|
201
|
+
v-model="date1"
|
|
202
|
+
required
|
|
203
|
+
format="DD/MM/YYYY"
|
|
204
|
+
placeholder="Date requise"
|
|
205
|
+
:custom-rules="[
|
|
206
|
+
{ type: 'notAfterToday', options: { message: 'La date ne peut pas être après aujourdhui' } },
|
|
207
|
+
]"
|
|
208
|
+
/>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
212
|
+
Soumettre
|
|
213
|
+
</button>
|
|
214
|
+
</form>
|
|
215
|
+
</div>
|
|
216
|
+
`,
|
|
217
|
+
}),
|
|
218
|
+
}
|
|
@@ -336,3 +336,5 @@ Dans cet exemple :
|
|
|
336
336
|
- Si aucune date n'est sélectionnée, la validation `required` échoue et le message "La date est requise." s'affiche.
|
|
337
337
|
- Si une date est sélectionnée mais qu'elle est postérieure à aujourd'hui, la règle personnalisée `notAfterToday` échoue et son message d'erreur s'affiche.
|
|
338
338
|
- Si une date est sélectionnée et qu'elle est antérieure ou égale à aujourd'hui, toutes les validations réussissent.
|
|
339
|
+
|
|
340
|
+
<a href="/?path=/docs/guide-du-dev-guide-de-validation-des-formulaires--docs" className="action-link">Pour plus d'informations sur la validation, consultez le guide de validation des formulaires.</a>
|
package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.stories.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { Meta, StoryFn } from '@storybook/vue3'
|
|
2
2
|
import DatePickerValidationExamples from '../docExamples/DatePickerValidationExamples.vue'
|
|
3
3
|
import DatePickerBidirectionalValidation from '../docExamples/DatePickerBidirectionalValidation.vue'
|
|
4
4
|
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { ref } from 'vue'
|
|
3
|
+
import DatePicker from '../../DatePicker/CalendarMode/DatePicker.vue'
|
|
4
|
+
|
|
5
|
+
export default {
|
|
6
|
+
title: 'Composants/Formulaires/DatePicker/Validation/Submit/DateTextInput',
|
|
7
|
+
component: DatePicker,
|
|
8
|
+
parameters: {
|
|
9
|
+
docs: {
|
|
10
|
+
description: {
|
|
11
|
+
component: 'Exemples de validation pour le composant DatePicker avec calendrier.',
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
},
|
|
15
|
+
} as Meta
|
|
16
|
+
|
|
17
|
+
export const Required: StoryObj = {
|
|
18
|
+
parameters: {
|
|
19
|
+
sourceCode: [
|
|
20
|
+
{
|
|
21
|
+
name: 'Template',
|
|
22
|
+
code: `
|
|
23
|
+
<template>
|
|
24
|
+
<v-form @submit.prevent="handleSubmit">
|
|
25
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
26
|
+
<div>
|
|
27
|
+
<h3 class="mb-4">Avec calendrier</h3>
|
|
28
|
+
<DatePicker
|
|
29
|
+
ref="datePicker1"
|
|
30
|
+
v-model="date1"
|
|
31
|
+
required
|
|
32
|
+
format="DD/MM/YYYY"
|
|
33
|
+
placeholder="Date requise"
|
|
34
|
+
noCalendar
|
|
35
|
+
/>
|
|
36
|
+
</div>
|
|
37
|
+
</div>
|
|
38
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
39
|
+
Soumettre
|
|
40
|
+
</button>
|
|
41
|
+
</v-form>
|
|
42
|
+
</template>
|
|
43
|
+
`,
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'Script',
|
|
47
|
+
code: `
|
|
48
|
+
<script setup lang="ts">
|
|
49
|
+
import { ref } from 'vue'
|
|
50
|
+
import { DatePicker } from '@cnamts/synapse'
|
|
51
|
+
|
|
52
|
+
const datePicker1 = ref()
|
|
53
|
+
const date1 = ref('')
|
|
54
|
+
|
|
55
|
+
const handleSubmit = () => {
|
|
56
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
57
|
+
|
|
58
|
+
if (!isValid1) {
|
|
59
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
60
|
+
} else {
|
|
61
|
+
alert('Formulaire soumis avec succès !')
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
</script>
|
|
65
|
+
`,
|
|
66
|
+
},
|
|
67
|
+
],
|
|
68
|
+
},
|
|
69
|
+
render: () => ({
|
|
70
|
+
components: { DatePicker },
|
|
71
|
+
setup() {
|
|
72
|
+
const datePicker1 = ref()
|
|
73
|
+
const date1 = ref('')
|
|
74
|
+
|
|
75
|
+
const handleSubmit = () => {
|
|
76
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
77
|
+
if (!isValid1) {
|
|
78
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
79
|
+
}
|
|
80
|
+
else {
|
|
81
|
+
alert('Formulaire soumis avec succès !')
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
return {
|
|
86
|
+
datePicker1,
|
|
87
|
+
date1,
|
|
88
|
+
handleSubmit,
|
|
89
|
+
}
|
|
90
|
+
},
|
|
91
|
+
template: `
|
|
92
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
93
|
+
<form @submit.prevent="handleSubmit" style="width: 100%;">
|
|
94
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
95
|
+
<div>
|
|
96
|
+
<DatePicker
|
|
97
|
+
ref="datePicker1"
|
|
98
|
+
v-model="date1"
|
|
99
|
+
required
|
|
100
|
+
noCalendar
|
|
101
|
+
format="DD/MM/YYYY"
|
|
102
|
+
placeholder="Date requise"
|
|
103
|
+
/>
|
|
104
|
+
</div>
|
|
105
|
+
</div>
|
|
106
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
107
|
+
Soumettre
|
|
108
|
+
</button>
|
|
109
|
+
</form>
|
|
110
|
+
</div>
|
|
111
|
+
`,
|
|
112
|
+
}),
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
export const WithCustomRulesAndRequired: StoryObj = {
|
|
116
|
+
parameters: {
|
|
117
|
+
sourceCode: [
|
|
118
|
+
{
|
|
119
|
+
name: 'Template',
|
|
120
|
+
code: `
|
|
121
|
+
<template>
|
|
122
|
+
<v-form @submit.prevent="handleSubmit">
|
|
123
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
124
|
+
<div>
|
|
125
|
+
<h3 class="mb-4">Avec calendrier</h3>
|
|
126
|
+
<DatePicker
|
|
127
|
+
ref="datePicker1"
|
|
128
|
+
v-model="date1"
|
|
129
|
+
required
|
|
130
|
+
format="DD/MM/YYYY"
|
|
131
|
+
placeholder="Date requise"
|
|
132
|
+
noCalendar
|
|
133
|
+
:customRules="[
|
|
134
|
+
{ type: 'notAfterToday', options: { message: 'La date ne peut pas être après aujourd'hui' } },
|
|
135
|
+
]"
|
|
136
|
+
/>
|
|
137
|
+
</div>
|
|
138
|
+
</div>
|
|
139
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
140
|
+
Soumettre
|
|
141
|
+
</button>
|
|
142
|
+
</v-form>
|
|
143
|
+
</template>
|
|
144
|
+
`,
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
name: 'Script',
|
|
148
|
+
code: `
|
|
149
|
+
<script setup lang="ts">
|
|
150
|
+
import { ref } from 'vue'
|
|
151
|
+
import { DatePicker } from '@cnamts/synapse'
|
|
152
|
+
|
|
153
|
+
const datePicker1 = ref()
|
|
154
|
+
const date1 = ref('01/01/2100')
|
|
155
|
+
|
|
156
|
+
const handleSubmit = () => {
|
|
157
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
158
|
+
|
|
159
|
+
if (!isValid1) {
|
|
160
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
161
|
+
} else {
|
|
162
|
+
alert('Formulaire soumis avec succès !')
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
</script>
|
|
166
|
+
`,
|
|
167
|
+
},
|
|
168
|
+
],
|
|
169
|
+
},
|
|
170
|
+
render: () => ({
|
|
171
|
+
components: { DatePicker },
|
|
172
|
+
setup() {
|
|
173
|
+
const datePicker1 = ref()
|
|
174
|
+
const date1 = ref('01/01/2100')
|
|
175
|
+
|
|
176
|
+
const handleSubmit = () => {
|
|
177
|
+
const isValid1 = datePicker1.value?.validateOnSubmit()
|
|
178
|
+
|
|
179
|
+
if (!isValid1) {
|
|
180
|
+
alert('Corrigez les erreurs avant de soumettre !')
|
|
181
|
+
}
|
|
182
|
+
else {
|
|
183
|
+
alert('Formulaire soumis avec succès !')
|
|
184
|
+
}
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
return {
|
|
188
|
+
datePicker1,
|
|
189
|
+
date1,
|
|
190
|
+
handleSubmit,
|
|
191
|
+
}
|
|
192
|
+
},
|
|
193
|
+
template: `
|
|
194
|
+
<div class="d-flex flex-wrap align-center pa-4">
|
|
195
|
+
<form @submit.prevent="handleSubmit" style="width: 100%;">
|
|
196
|
+
<div style="display: flex; flex-direction: column; gap: 16px;">
|
|
197
|
+
<div>
|
|
198
|
+
<DatePicker
|
|
199
|
+
ref="datePicker1"
|
|
200
|
+
v-model="date1"
|
|
201
|
+
required
|
|
202
|
+
format="DD/MM/YYYY"
|
|
203
|
+
placeholder="Date requise"
|
|
204
|
+
noCalendar
|
|
205
|
+
:custom-rules="[
|
|
206
|
+
{ type: 'notAfterToday', options: { message: 'La date ne peut pas être après aujourdhui' } },
|
|
207
|
+
]"
|
|
208
|
+
/>
|
|
209
|
+
</div>
|
|
210
|
+
</div>
|
|
211
|
+
<button type="submit" style="margin-top: 16px; padding: 8px 16px; background-color:#0c419a; color: white; border: none; border-radius: 4px; cursor: pointer;">
|
|
212
|
+
Soumettre
|
|
213
|
+
</button>
|
|
214
|
+
</form>
|
|
215
|
+
</div>
|
|
216
|
+
`,
|
|
217
|
+
}),
|
|
218
|
+
}
|