@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
|
@@ -28,8 +28,6 @@
|
|
|
28
28
|
const currentNotification = ref<Notification>()
|
|
29
29
|
const isNotificationVisible = ref(false)
|
|
30
30
|
|
|
31
|
-
const isProcessingNotifications = ref(false) // Nouvelle variable pour suivre le traitement
|
|
32
|
-
|
|
33
31
|
const hasActionSlot = computed(() => !!instance?.slots.action)
|
|
34
32
|
const isMobileVersion = computed(() => display.name.value === 'xs')
|
|
35
33
|
const isTabletVersion = computed(() => display.name.value === 'sm')
|
|
@@ -73,91 +71,47 @@
|
|
|
73
71
|
|
|
74
72
|
const smallCloseBtn = computed(() => isMobileVersion.value && !hasLongContent.value && !hasActionSlot.value)
|
|
75
73
|
|
|
76
|
-
|
|
77
|
-
currentNotification.value
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
isProcessingNotifications.value = true
|
|
74
|
+
watch(() => notificationQueue.value.length, async (queueLength) => {
|
|
75
|
+
if (queueLength > 0 && currentNotification.value === undefined) {
|
|
76
|
+
openNotification(notificationQueue.value[0])
|
|
77
|
+
}
|
|
78
|
+
}, { immediate: true })
|
|
82
79
|
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
80
|
+
let timeoutID: ReturnType<typeof setTimeout>
|
|
81
|
+
function openNotification(notification: Notification) {
|
|
82
|
+
currentNotification.value = notification
|
|
83
|
+
isNotificationVisible.value = true
|
|
87
84
|
|
|
88
|
-
|
|
85
|
+
if ((notification.timeout || 0) > 0) {
|
|
86
|
+
timeoutID = setTimeout(() => {
|
|
87
|
+
isNotificationVisible.value = false
|
|
88
|
+
}, notification.timeout)
|
|
89
|
+
}
|
|
90
|
+
}
|
|
89
91
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
resolve()
|
|
97
|
-
}
|
|
98
|
-
})
|
|
99
|
-
})
|
|
92
|
+
watch(isNotificationVisible, async (isVisible) => {
|
|
93
|
+
if (!isVisible) {
|
|
94
|
+
// wait for the snackbar close animation to finish
|
|
95
|
+
await new Promise(resolve => setTimeout(resolve, 100))
|
|
96
|
+
if (currentNotification.value) {
|
|
97
|
+
removeNotification(currentNotification.value.id)
|
|
100
98
|
}
|
|
101
|
-
|
|
102
|
-
// Attend la fin du délai du timeout avant de fermer la notification automatiquement
|
|
103
|
-
await new Promise<void>((resolve) => {
|
|
104
|
-
const timeoutId = setTimeout(() => {
|
|
105
|
-
handleClearNotification()
|
|
106
|
-
resolve()
|
|
107
|
-
}, timeout)
|
|
99
|
+
currentNotification.value = undefined
|
|
108
100
|
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
clearTimeout(timeoutId)
|
|
112
|
-
stopWatch()
|
|
113
|
-
resolve()
|
|
114
|
-
}
|
|
115
|
-
})
|
|
116
|
-
})
|
|
101
|
+
if (notificationQueue.value.length > 0) {
|
|
102
|
+
openNotification(notificationQueue.value[0])
|
|
117
103
|
}
|
|
118
|
-
|
|
119
|
-
// Retire la notification de la file
|
|
120
|
-
removeNotification(nextNotification.id)
|
|
121
104
|
}
|
|
105
|
+
})
|
|
122
106
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
const handleClearNotification = () => {
|
|
107
|
+
function showNextNotification() {
|
|
108
|
+
clearTimeout(timeoutID)
|
|
127
109
|
isNotificationVisible.value = false
|
|
128
|
-
if (currentNotification.value) {
|
|
129
|
-
removeNotification(currentNotification.value.id)
|
|
130
|
-
currentNotification.value = undefined
|
|
131
|
-
}
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const openNotification = (notification: Notification) => {
|
|
135
|
-
setNotification(notification)
|
|
136
|
-
isNotificationVisible.value = true
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
const showNextNotification = () => {
|
|
140
|
-
if (notificationQueue.value.length > 0) {
|
|
141
|
-
const nextNotification = notificationQueue.value[0]
|
|
142
|
-
setNotification(nextNotification)
|
|
143
|
-
isNotificationVisible.value = true
|
|
144
|
-
}
|
|
145
110
|
}
|
|
146
111
|
|
|
147
|
-
watch(
|
|
148
|
-
() => notificationQueue.value.length,
|
|
149
|
-
(newLength) => {
|
|
150
|
-
if (newLength > 0 && !isProcessingNotifications.value) {
|
|
151
|
-
processNotificationQueue()
|
|
152
|
-
}
|
|
153
|
-
},
|
|
154
|
-
)
|
|
155
|
-
|
|
156
112
|
defineExpose({
|
|
157
113
|
openNotification,
|
|
158
|
-
handleClearNotification,
|
|
159
114
|
showNextNotification,
|
|
160
|
-
processNotificationQueue,
|
|
161
115
|
currentNotification,
|
|
162
116
|
isNotificationVisible,
|
|
163
117
|
hasActionSlot,
|
|
@@ -173,11 +127,12 @@
|
|
|
173
127
|
</script>
|
|
174
128
|
|
|
175
129
|
<template>
|
|
176
|
-
<div
|
|
130
|
+
<div>
|
|
177
131
|
<VSnackbar
|
|
178
132
|
v-bind="options.snackbar"
|
|
179
133
|
v-model="isNotificationVisible"
|
|
180
134
|
role="status"
|
|
135
|
+
:eager="true"
|
|
181
136
|
:color="color"
|
|
182
137
|
:location="props.bottom ? 'bottom' : 'top'"
|
|
183
138
|
:vertical="hasLongContent"
|
|
@@ -195,7 +150,10 @@
|
|
|
195
150
|
size="24"
|
|
196
151
|
aria-hidden="true"
|
|
197
152
|
/>
|
|
198
|
-
<p
|
|
153
|
+
<p
|
|
154
|
+
class="sy-notification-content"
|
|
155
|
+
:class="'text-' + contentStyle.contentColor"
|
|
156
|
+
>
|
|
199
157
|
{{ currentNotification?.message }}
|
|
200
158
|
</p>
|
|
201
159
|
</div>
|
|
@@ -212,7 +170,7 @@
|
|
|
212
170
|
:class="{ 'ma-0': smallCloseBtn }"
|
|
213
171
|
aria-label="Fermer la notification"
|
|
214
172
|
v-bind="options.btn"
|
|
215
|
-
@click="
|
|
173
|
+
@click="isNotificationVisible = false"
|
|
216
174
|
>
|
|
217
175
|
<template v-if="!smallCloseBtn">
|
|
218
176
|
{{ closeBtnText }}
|
|
@@ -230,18 +188,12 @@
|
|
|
230
188
|
<style lang="scss" scoped>
|
|
231
189
|
@use '@/assets/tokens';
|
|
232
190
|
|
|
233
|
-
.
|
|
234
|
-
|
|
235
|
-
align-items: center;
|
|
236
|
-
}
|
|
237
|
-
|
|
238
|
-
.vd-notification-bar :deep(.v-snack__wrapper) {
|
|
239
|
-
padding: 16px;
|
|
240
|
-
min-width: 0;
|
|
241
|
-
max-width: none;
|
|
191
|
+
:deep(.v-overlay__content) {
|
|
192
|
+
max-width: 100%;
|
|
242
193
|
}
|
|
243
194
|
|
|
244
195
|
:deep(.v-snackbar__content) {
|
|
196
|
+
width: 100%;
|
|
245
197
|
padding: tokens.$padding-4 !important;
|
|
246
198
|
}
|
|
247
199
|
|
|
@@ -249,35 +201,6 @@
|
|
|
249
201
|
margin-inline-end: 10px;
|
|
250
202
|
}
|
|
251
203
|
|
|
252
|
-
.vd-notification-bar.v-snackbar--vertical :deep() {
|
|
253
|
-
.v-snackbar--vertical .v-snackbar__wrapper .v-snackbar__actions {
|
|
254
|
-
width: 100% !important;
|
|
255
|
-
align-self: auto;
|
|
256
|
-
}
|
|
257
|
-
|
|
258
|
-
.v-snack__wrapper {
|
|
259
|
-
align-items: stretch;
|
|
260
|
-
flex-direction: row;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.v-snack__action {
|
|
264
|
-
align-self: stretch;
|
|
265
|
-
align-items: stretch;
|
|
266
|
-
flex-direction: column;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
.v-snackbar__content {
|
|
270
|
-
margin: 0;
|
|
271
|
-
width: 100%;
|
|
272
|
-
display: flex;
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
.vd-notification-content {
|
|
276
|
-
flex-direction: column;
|
|
277
|
-
display: flex;
|
|
278
|
-
}
|
|
279
|
-
}
|
|
280
|
-
|
|
281
204
|
.long-text :deep(.v-snackbar__actions) {
|
|
282
205
|
width: 98% !important;
|
|
283
206
|
}
|
|
@@ -293,4 +216,9 @@
|
|
|
293
216
|
.action-section-short-text {
|
|
294
217
|
justify-content: end !important;
|
|
295
218
|
}
|
|
219
|
+
|
|
220
|
+
.sy-notification-content {
|
|
221
|
+
min-width: 0;
|
|
222
|
+
word-wrap: break-word;
|
|
223
|
+
}
|
|
296
224
|
</style>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { describe, it, expect, beforeEach } from 'vitest'
|
|
1
|
+
import { describe, it, expect, beforeEach, afterEach } from 'vitest'
|
|
2
2
|
import { vi } from 'vitest'
|
|
3
3
|
import { mount, shallowMount } from '@vue/test-utils'
|
|
4
4
|
import NotificationBar from '../NotificationBar.vue'
|
|
@@ -6,6 +6,7 @@ import { type Notification } from '@/components/NotificationBar/types'
|
|
|
6
6
|
import { useNotificationService } from '@/services/NotificationService'
|
|
7
7
|
import { nextTick, type Ref, ref } from 'vue'
|
|
8
8
|
import { vuetify } from '@tests/unit/setup'
|
|
9
|
+
import { VDefaultsProvider } from 'vuetify/components'
|
|
9
10
|
|
|
10
11
|
vi.mock('@/services/NotificationService')
|
|
11
12
|
describe('NotificationBar.vue', () => {
|
|
@@ -17,6 +18,7 @@ describe('NotificationBar.vue', () => {
|
|
|
17
18
|
|
|
18
19
|
let notificationServiceMock: NotificationServiceMock
|
|
19
20
|
beforeEach(() => {
|
|
21
|
+
vi.useFakeTimers()
|
|
20
22
|
notificationServiceMock = {
|
|
21
23
|
notificationQueue: ref([]),
|
|
22
24
|
addNotification: vi.fn(),
|
|
@@ -26,6 +28,11 @@ describe('NotificationBar.vue', () => {
|
|
|
26
28
|
(useNotificationService as vi.Mock).mockReturnValue(notificationServiceMock)
|
|
27
29
|
})
|
|
28
30
|
|
|
31
|
+
afterEach(() => {
|
|
32
|
+
vi.restoreAllMocks()
|
|
33
|
+
vi.useRealTimers()
|
|
34
|
+
})
|
|
35
|
+
|
|
29
36
|
it('should render notification bar', async () => {
|
|
30
37
|
const notification: Notification = {
|
|
31
38
|
id: '1',
|
|
@@ -67,29 +74,11 @@ describe('NotificationBar.vue', () => {
|
|
|
67
74
|
expect(wrapper.vm.color).toBe('#56C271')
|
|
68
75
|
})
|
|
69
76
|
|
|
70
|
-
it('should
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
message: 'Test message',
|
|
74
|
-
type: 'info',
|
|
75
|
-
timeout: -1,
|
|
76
|
-
icon: null,
|
|
77
|
-
}
|
|
78
|
-
const wrapper = mount(NotificationBar, {
|
|
79
|
-
props: { notification },
|
|
80
|
-
global: {
|
|
81
|
-
plugins: [vuetify],
|
|
82
|
-
},
|
|
77
|
+
it('should show the next notification in the queue', async () => {
|
|
78
|
+
notificationServiceMock.removeNotification = vi.fn(() => {
|
|
79
|
+
notificationServiceMock.notificationQueue.value.shift()
|
|
83
80
|
})
|
|
84
|
-
wrapper.vm.openNotification(notification)
|
|
85
|
-
wrapper.vm.handleClearNotification()
|
|
86
81
|
|
|
87
|
-
await nextTick()
|
|
88
|
-
expect(wrapper.vm.isNotificationVisible).toBe(false)
|
|
89
|
-
expect(notificationServiceMock.removeNotification).toHaveBeenCalledWith(notification.id)
|
|
90
|
-
})
|
|
91
|
-
|
|
92
|
-
it('should show the next notification in the queue', async () => {
|
|
93
82
|
const notification1: Notification = {
|
|
94
83
|
id: '1',
|
|
95
84
|
message: 'Test message 1',
|
|
@@ -97,26 +86,28 @@ describe('NotificationBar.vue', () => {
|
|
|
97
86
|
timeout: -1,
|
|
98
87
|
icon: null,
|
|
99
88
|
}
|
|
100
|
-
const notification2
|
|
89
|
+
const notification2 = {
|
|
101
90
|
id: '2',
|
|
102
91
|
message: 'Test message 2',
|
|
103
92
|
type: 'success',
|
|
104
93
|
timeout: -1,
|
|
105
94
|
icon: null,
|
|
106
|
-
}
|
|
95
|
+
} as const satisfies Notification
|
|
107
96
|
notificationServiceMock.notificationQueue.value = [notification1, notification2]
|
|
108
97
|
|
|
109
98
|
const wrapper = mount(NotificationBar, {
|
|
110
|
-
props: { notification: notification1 },
|
|
111
99
|
global: {
|
|
112
100
|
plugins: [vuetify],
|
|
113
101
|
},
|
|
114
102
|
})
|
|
115
103
|
|
|
116
104
|
wrapper.vm.showNextNotification()
|
|
117
|
-
|
|
118
105
|
await nextTick()
|
|
119
|
-
|
|
106
|
+
vi.runAllTimers()
|
|
107
|
+
await nextTick()
|
|
108
|
+
|
|
109
|
+
expect(notificationServiceMock.removeNotification).toHaveBeenCalledWith(notification1.id)
|
|
110
|
+
expect(wrapper.vm.currentNotification).toEqual(notification2)
|
|
120
111
|
expect(wrapper.vm.isNotificationVisible).toBe(true)
|
|
121
112
|
})
|
|
122
113
|
|
|
@@ -315,8 +306,14 @@ describe('NotificationBar.vue', () => {
|
|
|
315
306
|
expect(removeNotification).toHaveBeenCalledWith(1)
|
|
316
307
|
})
|
|
317
308
|
|
|
318
|
-
it('should
|
|
319
|
-
notificationServiceMock.notificationQueue.value = [
|
|
309
|
+
it('should show the item in queue', async () => {
|
|
310
|
+
notificationServiceMock.notificationQueue.value = [{
|
|
311
|
+
id: '1',
|
|
312
|
+
message: 'Test message',
|
|
313
|
+
type: 'info',
|
|
314
|
+
timeout: -1,
|
|
315
|
+
icon: null,
|
|
316
|
+
}]
|
|
320
317
|
|
|
321
318
|
const wrapper = mount(NotificationBar, {
|
|
322
319
|
global: {
|
|
@@ -324,9 +321,7 @@ describe('NotificationBar.vue', () => {
|
|
|
324
321
|
},
|
|
325
322
|
})
|
|
326
323
|
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
expect(wrapper.vm.isNotificationVisible).toBe(false)
|
|
330
|
-
expect(notificationServiceMock.removeNotification).not.toHaveBeenCalled()
|
|
324
|
+
const provider = wrapper.findComponent(VDefaultsProvider)
|
|
325
|
+
expect(provider.element.parentElement.textContent).toContain('Test message')
|
|
331
326
|
})
|
|
332
327
|
})
|
|
@@ -2,6 +2,6 @@
|
|
|
2
2
|
|
|
3
3
|
exports[`NotificationBar.vue > should render notification bar 1`] = `
|
|
4
4
|
"<div data-v-867cdd3c="" notification="[object Object]">
|
|
5
|
-
<v-snackbar-stub data-v-867cdd3c="" color="info" width="960px" class="" multiline="false" timer="false" timeout="-1" vertical="false" location="top" rounded="4" tile="false" variant="elevated" absolute="false" attach="false" closeonback="true" contained="false" disabled="false" modelvalue="true" zindex="2000" activatorprops="[object Object]" openonhover="false" closeoncontentclick="false" eager="
|
|
5
|
+
<v-snackbar-stub data-v-867cdd3c="" color="info" width="960px" class="" multiline="false" timer="false" timeout="-1" vertical="false" location="top" rounded="4" tile="false" variant="elevated" absolute="false" attach="false" closeonback="true" contained="false" disabled="false" modelvalue="true" zindex="2000" activatorprops="[object Object]" openonhover="false" closeoncontentclick="false" eager="true" locationstrategy="static" origin="auto" transition="v-snackbar-transition" role="status"></v-snackbar-stub>
|
|
6
6
|
</div>"
|
|
7
7
|
`;
|
|
@@ -134,7 +134,10 @@
|
|
|
134
134
|
</script>
|
|
135
135
|
|
|
136
136
|
<template>
|
|
137
|
-
<div
|
|
137
|
+
<div
|
|
138
|
+
id="paginated-table"
|
|
139
|
+
class="sy-paginated-table"
|
|
140
|
+
>
|
|
138
141
|
<VDataTable
|
|
139
142
|
v-if="!serverItemsLength"
|
|
140
143
|
color="primary"
|
|
@@ -170,11 +173,10 @@
|
|
|
170
173
|
</div>
|
|
171
174
|
</template>
|
|
172
175
|
|
|
173
|
-
<style lang="scss">
|
|
176
|
+
<style lang="scss" scoped>
|
|
174
177
|
@use '@/assets/tokens';
|
|
175
178
|
|
|
176
|
-
.
|
|
177
|
-
.v-data-table {
|
|
179
|
+
.sy-paginated-table :deep() {
|
|
178
180
|
table thead tr {
|
|
179
181
|
white-space: nowrap;
|
|
180
182
|
}
|
|
@@ -187,12 +189,6 @@
|
|
|
187
189
|
}
|
|
188
190
|
}
|
|
189
191
|
|
|
190
|
-
table :not(thead) tr {
|
|
191
|
-
&:hover {
|
|
192
|
-
background-color: rgb(12 65 154 / 10%);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
|
|
196
192
|
&.row-clickable table tbody tr {
|
|
197
193
|
cursor: pointer;
|
|
198
194
|
}
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html
|
|
2
2
|
|
|
3
3
|
exports[`PaginatedTable > render correctly in server mode 1`] = `
|
|
4
|
-
"<div id="paginated-table">
|
|
5
|
-
<div class="v-table v-table--has-top v-table--has-bottom v-theme--light v-table--density-default v-data-table" itemslength="0">
|
|
4
|
+
"<div data-v-50a8727d="" id="paginated-table" class="sy-paginated-table">
|
|
5
|
+
<div data-v-50a8727d="" class="v-table v-table--has-top v-table--has-bottom v-theme--light v-table--density-default v-data-table" itemslength="0">
|
|
6
6
|
<!---->
|
|
7
7
|
<div class="v-table__wrapper">
|
|
8
8
|
<table>
|
|
@@ -109,8 +109,8 @@ exports[`PaginatedTable > render correctly in server mode 1`] = `
|
|
|
109
109
|
`;
|
|
110
110
|
|
|
111
111
|
exports[`PaginatedTable > renders correctly in local mode 1`] = `
|
|
112
|
-
"<div id="paginated-table" items="[object Object],[object Object],[object Object]" headers="[object Object],[object Object],[object Object]">
|
|
113
|
-
<div class="v-table v-table--has-top v-table--has-bottom v-theme--light v-table--density-default v-data-table" itemslength="0">
|
|
112
|
+
"<div data-v-50a8727d="" id="paginated-table" class="sy-paginated-table" items="[object Object],[object Object],[object Object]" headers="[object Object],[object Object],[object Object]">
|
|
113
|
+
<div data-v-50a8727d="" class="v-table v-table--has-top v-table--has-bottom v-theme--light v-table--density-default v-data-table" itemslength="0">
|
|
114
114
|
<!---->
|
|
115
115
|
<div class="v-table__wrapper">
|
|
116
116
|
<table>
|
|
@@ -751,7 +751,7 @@ export const WithCustomRules: Story = {
|
|
|
751
751
|
{
|
|
752
752
|
type: 'custom',
|
|
753
753
|
options: {
|
|
754
|
-
validate: (value
|
|
754
|
+
validate: (value) => {
|
|
755
755
|
if (!value || !/[A-Z]/.test(value)) {
|
|
756
756
|
return 'Le mot de passe doit contenir au moins une lettre majuscule'
|
|
757
757
|
}
|
|
@@ -763,7 +763,7 @@ export const WithCustomRules: Story = {
|
|
|
763
763
|
{
|
|
764
764
|
type: 'custom',
|
|
765
765
|
options: {
|
|
766
|
-
validate: (value
|
|
766
|
+
validate: (value) => {
|
|
767
767
|
if (!value || !/[0-9]/.test(value)) {
|
|
768
768
|
return 'Le mot de passe doit contenir au moins un chiffre'
|
|
769
769
|
}
|
|
@@ -893,7 +893,7 @@ export const WithFormValidation: Story = {
|
|
|
893
893
|
{
|
|
894
894
|
type: 'custom',
|
|
895
895
|
options: {
|
|
896
|
-
validate: (value
|
|
896
|
+
validate: (value) => {
|
|
897
897
|
if (!value || value.length < 8) {
|
|
898
898
|
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
899
899
|
}
|
|
@@ -905,7 +905,7 @@ export const WithFormValidation: Story = {
|
|
|
905
905
|
{
|
|
906
906
|
type: 'custom',
|
|
907
907
|
options: {
|
|
908
|
-
validate: (value
|
|
908
|
+
validate: (value) => {
|
|
909
909
|
if (!value || !/[A-Z]/.test(value)) {
|
|
910
910
|
return 'Le mot de passe doit contenir au moins une lettre majuscule'
|
|
911
911
|
}
|
|
@@ -1015,3 +1015,190 @@ export const WithFormValidation: Story = {
|
|
|
1015
1015
|
`,
|
|
1016
1016
|
}),
|
|
1017
1017
|
}
|
|
1018
|
+
|
|
1019
|
+
export const WithoutSuccessMessages: Story = {
|
|
1020
|
+
parameters: {
|
|
1021
|
+
docs: {
|
|
1022
|
+
description: {
|
|
1023
|
+
story: `
|
|
1024
|
+
### Messages de succès
|
|
1025
|
+
|
|
1026
|
+
Cette story illustre l'utilisation de la propriété \`showSuccessMessages\` qui permet de contrôler
|
|
1027
|
+
l'affichage des messages de succès lors de la validation. Par défaut, cette propriété est à \`true\`.
|
|
1028
|
+
|
|
1029
|
+
Cela peut être utile pour réduire la verbosité de l'interface lorsque les messages de succès
|
|
1030
|
+
ne sont pas nécessaires dans certains contextes.
|
|
1031
|
+
`,
|
|
1032
|
+
},
|
|
1033
|
+
},
|
|
1034
|
+
sourceCode: [
|
|
1035
|
+
{
|
|
1036
|
+
name: 'Template',
|
|
1037
|
+
code: `<template>
|
|
1038
|
+
<!-- Champ avec messages de succès (par défaut) -->
|
|
1039
|
+
<PasswordField
|
|
1040
|
+
v-model="value1"
|
|
1041
|
+
label="Mot de passe avec messages de succès"
|
|
1042
|
+
required
|
|
1043
|
+
/>
|
|
1044
|
+
|
|
1045
|
+
<!-- Champ sans messages de succès -->
|
|
1046
|
+
<PasswordField
|
|
1047
|
+
v-model="value2"
|
|
1048
|
+
label="Mot de passe sans messages de succès"
|
|
1049
|
+
required
|
|
1050
|
+
:showSuccessMessages="false"
|
|
1051
|
+
/>
|
|
1052
|
+
</template>`,
|
|
1053
|
+
},
|
|
1054
|
+
],
|
|
1055
|
+
},
|
|
1056
|
+
render: () => ({
|
|
1057
|
+
components: { PasswordField },
|
|
1058
|
+
setup() {
|
|
1059
|
+
const value1 = ref('P@ssw0rd123')
|
|
1060
|
+
const value2 = ref('P@ssw0rd123')
|
|
1061
|
+
|
|
1062
|
+
return { value1, value2 }
|
|
1063
|
+
},
|
|
1064
|
+
template: `
|
|
1065
|
+
<div>
|
|
1066
|
+
<p class="mb-4">Cette démonstration compare un PasswordField avec <code>showSuccessMessages=true</code> (par défaut) et un avec <code>showSuccessMessages=false</code>.</p>
|
|
1067
|
+
|
|
1068
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 16px;">
|
|
1069
|
+
<div>
|
|
1070
|
+
<p class="text-subtitle-2 mb-2">Avec messages de succès</p>
|
|
1071
|
+
<PasswordField
|
|
1072
|
+
v-model="value1"
|
|
1073
|
+
label="Mot de passe avec messages de succès"
|
|
1074
|
+
required
|
|
1075
|
+
showSuccessMessages
|
|
1076
|
+
/>
|
|
1077
|
+
</div>
|
|
1078
|
+
|
|
1079
|
+
<div>
|
|
1080
|
+
<p class="text-subtitle-2 mb-2">Sans messages de succès</p>
|
|
1081
|
+
<PasswordField
|
|
1082
|
+
v-model="value2"
|
|
1083
|
+
label="Mot de passe sans messages de succès"
|
|
1084
|
+
required
|
|
1085
|
+
:showSuccessMessages="false"
|
|
1086
|
+
/>
|
|
1087
|
+
</div>
|
|
1088
|
+
</div>
|
|
1089
|
+
|
|
1090
|
+
<div class="mt-4 text-body-2">
|
|
1091
|
+
<p>Observations :</p>
|
|
1092
|
+
<ul>
|
|
1093
|
+
<li class="ml-4">Les deux champs ont la même valeur valide</li>
|
|
1094
|
+
<li class="ml-4">Le champ de gauche affiche un message de succès et un indicateur visuel vert</li>
|
|
1095
|
+
<li class="ml-4">Le champ de droite n'affiche pas de message de succès, mais conserve l'indicateur visuel</li>
|
|
1096
|
+
<li class="ml-4">Essayez de modifier les valeurs puis de les rendre à nouveau valides</li>
|
|
1097
|
+
</ul>
|
|
1098
|
+
</div>
|
|
1099
|
+
</div>
|
|
1100
|
+
`,
|
|
1101
|
+
}),
|
|
1102
|
+
}
|
|
1103
|
+
|
|
1104
|
+
export const DisableErrorHandling: Story = {
|
|
1105
|
+
parameters: {
|
|
1106
|
+
docs: {
|
|
1107
|
+
description: {
|
|
1108
|
+
story: `
|
|
1109
|
+
### Désactivation de la gestion des erreurs
|
|
1110
|
+
|
|
1111
|
+
Cette story illustre l'utilisation de la propriété \`disableErrorHandling\` qui permet de désactiver complètement
|
|
1112
|
+
la gestion et l'affichage des erreurs dans un champ, même si des règles de validation sont définies.
|
|
1113
|
+
|
|
1114
|
+
Cela peut être utile dans des cas particuliers où vous souhaitez définir des règles de validation
|
|
1115
|
+
mais gérer leur affichage différemment, ou utiliser la validation uniquement au niveau du formulaire parent.
|
|
1116
|
+
`,
|
|
1117
|
+
},
|
|
1118
|
+
},
|
|
1119
|
+
sourceCode: [
|
|
1120
|
+
{
|
|
1121
|
+
name: 'Template',
|
|
1122
|
+
code: `<template>
|
|
1123
|
+
<!-- Champ avec validation normale -->
|
|
1124
|
+
<PasswordField
|
|
1125
|
+
v-model="value1"
|
|
1126
|
+
label="Mot de passe avec validation"
|
|
1127
|
+
required
|
|
1128
|
+
:custom-rules="customRules"
|
|
1129
|
+
/>
|
|
1130
|
+
|
|
1131
|
+
<!-- Champ avec gestion d'erreurs désactivée -->
|
|
1132
|
+
<PasswordField
|
|
1133
|
+
v-model="value2"
|
|
1134
|
+
label="Mot de passe sans gestion d'erreurs"
|
|
1135
|
+
required
|
|
1136
|
+
disableErrorHandling
|
|
1137
|
+
:custom-rules="customRules"
|
|
1138
|
+
/>
|
|
1139
|
+
</template>`,
|
|
1140
|
+
},
|
|
1141
|
+
],
|
|
1142
|
+
},
|
|
1143
|
+
render: () => ({
|
|
1144
|
+
components: { PasswordField },
|
|
1145
|
+
setup() {
|
|
1146
|
+
const value1 = ref('')
|
|
1147
|
+
const value2 = ref('')
|
|
1148
|
+
|
|
1149
|
+
const customRules = [
|
|
1150
|
+
{
|
|
1151
|
+
type: 'custom',
|
|
1152
|
+
options: {
|
|
1153
|
+
validate: (value: string) => {
|
|
1154
|
+
if (!value || value.length < 8) {
|
|
1155
|
+
return 'Le mot de passe doit contenir au moins 8 caractères'
|
|
1156
|
+
}
|
|
1157
|
+
return true
|
|
1158
|
+
},
|
|
1159
|
+
fieldIdentifier: 'password',
|
|
1160
|
+
},
|
|
1161
|
+
},
|
|
1162
|
+
]
|
|
1163
|
+
|
|
1164
|
+
return { value1, value2, customRules }
|
|
1165
|
+
},
|
|
1166
|
+
template: `
|
|
1167
|
+
<div>
|
|
1168
|
+
<p class="mb-4">Cette démonstration compare un PasswordField standard et un avec \`disableErrorHandling=true\`.</p>
|
|
1169
|
+
|
|
1170
|
+
<div style="display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 16px;">
|
|
1171
|
+
<div>
|
|
1172
|
+
<p class="text-subtitle-2 mb-2">Validation normale</p>
|
|
1173
|
+
<PasswordField
|
|
1174
|
+
v-model="value1"
|
|
1175
|
+
label="Mot de passe avec validation"
|
|
1176
|
+
required
|
|
1177
|
+
:custom-rules="customRules"
|
|
1178
|
+
/>
|
|
1179
|
+
</div>
|
|
1180
|
+
|
|
1181
|
+
<div>
|
|
1182
|
+
<p class="text-subtitle-2 mb-2">Sans gestion d'erreurs</p>
|
|
1183
|
+
<PasswordField
|
|
1184
|
+
v-model="value2"
|
|
1185
|
+
label="Mot de passe sans gestion d'erreurs"
|
|
1186
|
+
required
|
|
1187
|
+
disableErrorHandling
|
|
1188
|
+
:custom-rules="customRules"
|
|
1189
|
+
/>
|
|
1190
|
+
</div>
|
|
1191
|
+
</div>
|
|
1192
|
+
|
|
1193
|
+
<div class="mt-4 text-body-2">
|
|
1194
|
+
<p>Instructions :</p>
|
|
1195
|
+
<ol>
|
|
1196
|
+
<li class="ml-4">Cliquez dans un champ puis en dehors pour déclencher la validation</li>
|
|
1197
|
+
<li class="ml-4">Le champ de gauche affichera une erreur requise, mais pas celui de droite</li>
|
|
1198
|
+
<li class="ml-4">Vous pouvez également essayer de soumettre les deux champs pour voir la différence de comportement</li>
|
|
1199
|
+
</ol>
|
|
1200
|
+
</div>
|
|
1201
|
+
</div>
|
|
1202
|
+
`,
|
|
1203
|
+
}),
|
|
1204
|
+
}
|
|
@@ -32,6 +32,7 @@
|
|
|
32
32
|
showSuccessMessages?: boolean
|
|
33
33
|
displayAsterisk?: boolean
|
|
34
34
|
isValidateOnBlur?: boolean
|
|
35
|
+
disableErrorHandling?: boolean
|
|
35
36
|
} & CustomizableOptions>(), {
|
|
36
37
|
modelValue: null,
|
|
37
38
|
variantStyle: 'outlined',
|
|
@@ -50,6 +51,7 @@
|
|
|
50
51
|
showSuccessMessages: true,
|
|
51
52
|
displayAsterisk: false,
|
|
52
53
|
isValidateOnBlur: true,
|
|
54
|
+
disableErrorHandling: false,
|
|
53
55
|
})
|
|
54
56
|
|
|
55
57
|
const options = useCustomizableOptions(config, props)
|
|
@@ -105,6 +107,7 @@
|
|
|
105
107
|
successRules: props.customSuccessRules || [],
|
|
106
108
|
showSuccessMessages: props.showSuccessMessages,
|
|
107
109
|
fieldIdentifier: props.label || 'password',
|
|
110
|
+
disableErrorHandling: props.disableErrorHandling,
|
|
108
111
|
})
|
|
109
112
|
|
|
110
113
|
// Computed pour les états de validation
|