@cnamts/synapse 1.1.0 → 1.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{AutocompleteFilter-DXd4szWO.js → AutocompleteFilter-CGF33skz.js} +1 -1
- package/dist/{DateFilter-BD59Kgwf.js → DateFilter-D7-MsKtx.js} +1 -1
- package/dist/{NumberFilter-BSMZE7uw.js → NumberFilter-bjQPPfsj.js} +1 -1
- package/dist/{PeriodFilter-keUdSSk0.js → PeriodFilter-B3wJpK8-.js} +1 -1
- package/dist/{SelectFilter-Dhvvwazl.js → SelectFilter-BN6DbKAV.js} +1 -1
- package/dist/{TextFilter-CU8FpXz0.js → TextFilter-BffP0J2f.js} +1 -1
- package/dist/{apLightTheme2026-DbS7BPUf.js → apLightTheme2026-C4ygwMHC.js} +11 -11
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +6 -6
- package/dist/components/Captcha/Captcha.d.ts +27 -16
- package/dist/components/Captcha/CaptchaForm.d.ts +29 -3
- package/dist/components/Captcha/types.d.ts +14 -0
- package/dist/components/Captcha/useCaptchaValidation.d.ts +37 -0
- package/dist/components/Customs/Selects/SelectBtnField/SelectBtnField.d.ts +33 -13
- package/dist/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.d.ts +23 -0
- package/dist/components/Customs/Selects/SyAutocomplete/composables/useSyAutocompleteValidation.d.ts +2 -2
- package/dist/components/Customs/Selects/SySelect/composables/useSySelectValidation.d.ts +2 -2
- package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +17 -48
- package/dist/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.d.ts +29 -0
- package/dist/components/Customs/SyCheckBoxGroup/types.d.ts +46 -0
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +16 -51
- package/dist/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.d.ts +27 -0
- package/dist/components/Customs/SyCheckbox/types.d.ts +49 -0
- package/dist/components/Customs/SyTextField/FieldState.d.ts +5 -0
- package/dist/components/Customs/SyTextField/useSyTextFieldValidation.d.ts +3 -3
- package/dist/components/DialogBox/DialogBox.d.ts +2 -0
- package/dist/components/DialogBox/locales.d.ts +1 -0
- package/dist/components/FilterSideBar/FilterSideBar.d.ts +4 -0
- package/dist/components/LunarCalendar/LunarCalendar.d.ts +43 -14
- package/dist/components/LunarCalendar/types.d.ts +35 -0
- package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +11 -12
- package/dist/components/MonthPicker/MonthPicker.d.ts +72 -1747
- package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +21 -1733
- package/dist/components/MonthPicker/MonthPickerText/useTextField.d.ts +5 -0
- package/dist/components/MonthPicker/locales.d.ts +1 -0
- package/dist/components/MonthPicker/types.d.ts +11 -0
- package/dist/components/MonthPicker/useMonthPickerValidation.d.ts +37 -24
- package/dist/components/NirField/NirField.d.ts +6 -4
- package/dist/components/NirField/useNirValidation.d.ts +7 -5
- package/dist/components/PageContainer/PageContainer.d.ts +8 -0
- package/dist/components/PasswordField/PasswordField.d.ts +2 -2
- package/dist/components/PasswordField/usePasswordFieldValidation.d.ts +2 -2
- package/dist/components/PhoneField/PhoneField.d.ts +960 -1938
- package/dist/components/PhoneField/indicatifs.d.ts +715 -8
- package/dist/components/PhoneField/locales.d.ts +7 -0
- package/dist/components/PhoneField/types.d.ts +29 -0
- package/dist/components/PhoneField/usePhoneFieldValidation.d.ts +45 -0
- package/dist/components/PhoneField/usePhoneIndicatifs.d.ts +947 -0
- package/dist/components/SyTextArea/composables/useSyTextAreaValidation.d.ts +2 -2
- package/dist/composables/unifyValidation/documentationValidationProps.d.ts +1 -1
- package/dist/composables/unifyValidation/useValidation.d.ts +4 -5
- package/dist/design-system-v3.js +2 -2
- package/dist/designTokens/tokens/amelipro/apLightTheme.d.ts +10 -10
- package/dist/designTokens/tokens/baseTokens.d.ts +18 -18
- package/dist/designTokens/tokens/cnam/cnamLightTheme.d.ts +10 -10
- package/dist/designTokens/tokens/pa/paLightTheme.d.ts +10 -10
- package/dist/designTokens/tokens/semanticTokens.d.ts +14 -14
- package/dist/{main-D8ryUoS5.js → main-C4wAktOs.js} +13718 -12991
- package/dist/synapse.css +1 -1
- package/dist/vuetifyConfig.js +1 -1
- package/package.json +7 -7
- package/src/assets/compat/_legacy-tokens.scss +91 -0
- package/src/assets/overrides/_utilities.scss +23 -0
- package/src/components/Accordion/Accordion.stories.ts +121 -1
- package/src/components/BackBtn/BackBtn.mdx +1 -1
- package/src/components/BackToTopBtn/BackToTopBtn.mdx +0 -1
- package/src/components/Captcha/Captcha.stories.ts +134 -31
- package/src/components/Captcha/Captcha.vue +95 -28
- package/src/components/Captcha/CaptchaForm.vue +51 -22
- package/src/components/Captcha/tests/Captcha.focus.spec.ts +214 -0
- package/src/components/Captcha/tests/Captcha.spec.ts +233 -24
- package/src/components/Captcha/tests/CaptchaForm.spec.ts +82 -0
- package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +16 -42
- package/src/components/Captcha/types.ts +15 -0
- package/src/components/Captcha/useCaptchaValidation.ts +87 -0
- package/src/components/Captcha/validation/validation.stories.ts +1194 -0
- package/src/components/ChipList/ChipList.mdx +0 -1
- package/src/components/CollapsibleList/CollapsibleList.mdx +0 -1
- package/src/components/CookieBanner/CookieBanner.mdx +0 -1
- package/src/components/CopyBtn/CopyBtn.mdx +0 -1
- package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.stories.ts +123 -439
- package/src/components/Customs/Selects/SelectBtnField/SelectBtnField.vue +147 -41
- package/src/components/Customs/Selects/SelectBtnField/Validation/Validation.stories.ts +600 -0
- package/src/components/Customs/Selects/SelectBtnField/composables/useSelectBtnFieldValidation.ts +87 -0
- package/src/components/Customs/Selects/SelectBtnField/tests/SelectBtnField.spec.ts +402 -33
- package/src/components/Customs/Selects/SelectBtnField/tests/__snapshots__/SelectBtnField.spec.ts.snap +52 -38
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.stories.ts +342 -162
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +77 -129
- package/src/components/Customs/SyCheckBoxGroup/Validation/Validation.stories.ts +1008 -0
- package/src/components/Customs/SyCheckBoxGroup/composables/useSyCheckBoxGroupValidation.ts +107 -0
- package/src/components/Customs/SyCheckBoxGroup/tests/SyCheckBoxGroup.spec.ts +180 -7
- package/src/components/Customs/SyCheckBoxGroup/types.ts +49 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +41 -161
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +71 -148
- package/src/components/Customs/SyCheckbox/Validation/Validation.stories.ts +654 -0
- package/src/components/Customs/SyCheckbox/composables/useSyCheckboxValidation.ts +105 -0
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +106 -0
- package/src/components/Customs/SyCheckbox/tests/useSyCheckboxValidation.spec.ts +98 -0
- package/src/components/Customs/SyCheckbox/types.ts +51 -0
- package/src/components/Customs/SyTextField/FieldState.vue +50 -0
- package/src/components/Customs/SyTextField/SyTextField.vue +12 -9
- package/src/components/Customs/SyTextField/useSyTextFieldValidation.ts +2 -11
- package/src/components/DataList/DataList.mdx +0 -1
- package/src/components/DataListGroup/DataListGroup.mdx +0 -1
- package/src/components/DiacriticPicker/DiacriticPicker.mdx +0 -1
- package/src/components/DialogBox/DialogBox.mdx +0 -1
- package/src/components/DialogBox/DialogBox.stories.ts +399 -4
- package/src/components/DialogBox/DialogBox.vue +20 -0
- package/src/components/DialogBox/locales.ts +1 -0
- package/src/components/DialogBox/tests/DialogBox.spec.ts +73 -0
- package/src/components/DialogBox/tests/DialogBox.visual.cy.ts +24 -0
- package/src/components/ErrorPage/ErrorPage.mdx +1 -1
- package/src/components/ExternalLinks/ExternalLinks.mdx +0 -1
- package/src/components/FileList/FileList.mdx +0 -1
- package/src/components/FilterInline/FilterInline.mdx +0 -1
- package/src/components/FilterSideBar/FilterSideBar.mdx +8 -1
- package/src/components/FilterSideBar/FilterSideBar.stories.ts +133 -1
- package/src/components/FilterSideBar/FilterSideBar.vue +19 -2
- package/src/components/FilterSideBar/tests/FilterSideBar.spec.ts +55 -0
- package/src/components/FooterBar/FooterBar.mdx +0 -1
- package/src/components/FranceConnectBtn/FranceConnectBtn.mdx +0 -1
- package/src/components/HeaderBar/HeaderBar.mdx +0 -1
- package/src/components/HeaderLoading/HeaderLoading.mdx +0 -1
- package/src/components/LangBtn/LangBtn.mdx +0 -1
- package/src/components/Logo/Logo.mdx +1 -1
- package/src/components/LunarCalendar/LunarCalendar.mdx +6 -9
- package/src/components/LunarCalendar/LunarCalendar.stories.ts +243 -46
- package/src/components/LunarCalendar/LunarCalendar.vue +61 -26
- package/src/components/LunarCalendar/Validation/Validation.stories.ts +717 -0
- package/src/components/LunarCalendar/tests/LunarCalendar.a11y.spec.ts +1 -1
- package/src/components/LunarCalendar/tests/LunarCalendar.spec.ts +197 -6
- package/src/components/LunarCalendar/tests/useLunarCalendarValidation.spec.ts +287 -0
- package/src/components/LunarCalendar/types.ts +39 -0
- package/src/components/LunarCalendar/useLunarCalendarValidation.ts +115 -39
- package/src/components/MonthPicker/MonthPicker.stories.ts +38 -281
- package/src/components/MonthPicker/MonthPicker.vue +66 -17
- package/src/components/MonthPicker/MonthPickerText/MonthPickerInput.vue +44 -20
- package/src/components/MonthPicker/MonthPickerText/useTextField.ts +5 -0
- package/src/components/MonthPicker/Validation/Validation.stories.ts +1117 -0
- package/src/components/MonthPicker/locales.ts +1 -0
- package/src/components/MonthPicker/tests/MonthPicker.spec.ts +353 -2
- package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +12 -8
- package/src/components/MonthPicker/types.ts +16 -0
- package/src/components/MonthPicker/useMonthPickerValidation.ts +64 -27
- package/src/components/NirField/NirField.mdx +120 -66
- package/src/components/NirField/NirField.stories.ts +216 -0
- package/src/components/NirField/useNirValidation.ts +16 -17
- package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +263 -245
- package/src/components/NotificationBar/NotificationBar.mdx +0 -1
- package/src/components/PageContainer/PageContainer.mdx +0 -1
- package/src/components/PageContainer/PageContainer.stories.ts +170 -2
- package/src/components/PageContainer/PageContainer.vue +63 -8
- package/src/components/PageContainer/tests/__snapshots__/PageContainer.spec.ts.snap +19 -11
- package/src/components/PaginatedTable/PaginatedTable.mdx +0 -1
- package/src/components/PeriodField/PeriodField.mdx +0 -1
- package/src/components/PhoneField/PhoneField.mdx +2 -3
- package/src/components/PhoneField/PhoneField.stories.ts +227 -410
- package/src/components/PhoneField/PhoneField.vue +204 -438
- package/src/components/PhoneField/indicatifs.ts +1 -1
- package/src/components/PhoneField/locales.ts +7 -0
- package/src/components/PhoneField/tests/PhoneField.a11y.spec.ts +0 -1
- package/src/components/PhoneField/tests/PhoneField.spec.ts +517 -220
- package/src/components/PhoneField/types.ts +30 -0
- package/src/components/PhoneField/usePhoneFieldValidation.ts +119 -0
- package/src/components/PhoneField/usePhoneIndicatifs.ts +89 -0
- package/src/components/PhoneField/validation/validation.stories.ts +717 -0
- package/src/components/RangeField/RangeField.mdx +0 -1
- package/src/components/RatingPicker/RatingPicker.mdx +0 -1
- package/src/components/SocialMediaLinks/SocialMediaLinks.mdx +0 -1
- package/src/components/StatusPage/StatusPage.vue +1 -0
- package/src/components/StatusPage/tests/__snapshots__/StatusPage.spec.ts.snap +248 -230
- package/src/components/SubHeader/SubHeader.mdx +5 -6
- package/src/components/Tables/common/tests/SyTableFilter.spec.ts +11 -12
- package/src/components/UploadWorkflow/UploadWorkflow.mdx +0 -1
- package/src/components/UserMenuBtn/UserMenuBtn.mdx +0 -1
- package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +177 -0
- package/src/composables/unifyValidation/documentationValidationProps.ts +1 -1
- package/src/composables/unifyValidation/tests/useValidation.spec.ts +13 -1
- package/src/composables/unifyValidation/useValidation.ts +37 -33
- package/src/composantsVuetify/VCard/VCard.mdx +4 -0
- package/src/composantsVuetify/VCard/v-card.stories.ts +93 -1
- package/src/composantsVuetify/VCarousel/VCarousel.mdx +74 -0
- package/src/composantsVuetify/VCarousel/v-carousel.stories.ts +531 -0
- package/src/composantsVuetify/VNavigationDrawer/VNavgationDrawer.mdx +53 -0
- package/src/composantsVuetify/VNavigationDrawer/v-navigation-drawer.stories.ts +310 -0
- package/src/composantsVuetify/VSlideGroup/VSlideGroup.mdx +105 -0
- package/src/composantsVuetify/VSlideGroup/v-slide-group.stories.ts +463 -0
- package/src/designTokens/tokens/baseColors.ts +1 -1
- package/src/designTokens/tokens/baseTokens.ts +18 -18
- package/src/stories/Components/Components.stories.ts +34 -1
- package/src/stories/Demarrer/Releases.stories.ts +16 -2
- package/src/stories/DesignTokens/Arrondis.mdx +1 -1
- package/src/stories/DesignTokens/Correspondances.mdx +219 -0
- package/src/stories/DesignTokens/UtiliserLesTokens.mdx +235 -0
- package/src/stories/DesignTokens/colors.stories.ts +569 -569
- package/src/stories/GuideDuDev/Amelipro.stories.ts +335 -267
- package/dist/components/LunarCalendar/useLunarCalendarRules.d.ts +0 -5
- package/dist/components/PhoneField/tests/types.d.ts +0 -18
- package/src/components/LunarCalendar/tests/useLunarCalendarRules.spec.ts +0 -184
- package/src/components/LunarCalendar/useLunarCalendarRules.ts +0 -96
- package/src/components/PhoneField/tests/types.d.ts +0 -19
|
@@ -1,71 +1,38 @@
|
|
|
1
1
|
<script lang="ts" setup>
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, ref } from 'vue'
|
|
3
3
|
import { VMessages } from 'vuetify/components'
|
|
4
|
-
import {
|
|
4
|
+
import { validationPropsDefaults } from '@/composables/unifyValidation/useValidation'
|
|
5
5
|
import { useValidatable } from '@/composables/validation/useValidatable'
|
|
6
|
+
import { useSyCheckBoxGroupValidation } from './composables/useSyCheckBoxGroupValidation'
|
|
6
7
|
import SyCheckbox from '@/components/Customs/SyCheckbox/SyCheckbox.vue'
|
|
7
8
|
import { locales } from './locales'
|
|
8
|
-
import type {
|
|
9
|
+
import type { SyCheckBoxGroupProps } from './types'
|
|
9
10
|
|
|
10
11
|
const props = withDefaults(
|
|
11
|
-
defineProps<
|
|
12
|
-
ariaLabel?: string
|
|
13
|
-
ariaLabelledby?: string
|
|
14
|
-
color?: string
|
|
15
|
-
customRules?: ValidationRule[]
|
|
16
|
-
customSuccessRules?: ValidationRule[]
|
|
17
|
-
customWarningRules?: ValidationRule[]
|
|
18
|
-
density?: 'default' | 'comfortable' | 'compact'
|
|
19
|
-
disabled?: boolean
|
|
20
|
-
disableErrorHandling?: boolean
|
|
21
|
-
displayAsterisk?: boolean
|
|
22
|
-
errorMessages?: string[] | null
|
|
23
|
-
hideDetails?: boolean | 'auto'
|
|
24
|
-
id?: string
|
|
25
|
-
isValidateOnBlur?: boolean
|
|
26
|
-
label?: string
|
|
27
|
-
modelValue?: (string | number) | (string | number)[] | null
|
|
28
|
-
multiple?: boolean
|
|
29
|
-
name?: string
|
|
30
|
-
options?: Option[]
|
|
31
|
-
readonly?: boolean
|
|
32
|
-
required?: boolean
|
|
33
|
-
showSuccessMessages?: boolean
|
|
34
|
-
successMessages?: string[] | null
|
|
35
|
-
title?: string
|
|
36
|
-
warningMessages?: string[] | null
|
|
37
|
-
}>(),
|
|
12
|
+
defineProps<SyCheckBoxGroupProps>(),
|
|
38
13
|
{
|
|
39
14
|
ariaLabel: undefined,
|
|
40
15
|
ariaLabelledby: undefined,
|
|
41
16
|
color: 'primary',
|
|
42
|
-
customRules: () => [],
|
|
43
|
-
customSuccessRules: () => [],
|
|
44
|
-
customWarningRules: () => [],
|
|
45
17
|
density: 'default',
|
|
46
|
-
disabled: false,
|
|
47
|
-
disableErrorHandling: false,
|
|
48
18
|
displayAsterisk: false,
|
|
49
|
-
|
|
19
|
+
helpText: '',
|
|
50
20
|
hideDetails: 'auto',
|
|
51
21
|
id: undefined,
|
|
52
|
-
isValidateOnBlur: false,
|
|
53
22
|
label: undefined,
|
|
54
23
|
modelValue: null,
|
|
55
24
|
multiple: false,
|
|
56
25
|
name: undefined,
|
|
57
26
|
options: () => [],
|
|
58
|
-
readonly: false,
|
|
59
|
-
required: false,
|
|
60
|
-
showSuccessMessages: false,
|
|
61
|
-
successMessages: null,
|
|
62
27
|
title: undefined,
|
|
63
|
-
|
|
28
|
+
...validationPropsDefaults,
|
|
29
|
+
isValidateOnBlur: false,
|
|
64
30
|
},
|
|
65
31
|
)
|
|
66
32
|
|
|
67
33
|
const emit = defineEmits(['update:modelValue', 'change'])
|
|
68
34
|
|
|
35
|
+
const focused = ref(false)
|
|
69
36
|
const isMultiple = computed(() => props.multiple)
|
|
70
37
|
|
|
71
38
|
const model = computed({
|
|
@@ -78,31 +45,26 @@
|
|
|
78
45
|
},
|
|
79
46
|
})
|
|
80
47
|
|
|
81
|
-
const generatedLabel = computed(() => (props.label || '') + (props.displayAsterisk ? '*' : ''))
|
|
82
|
-
|
|
83
|
-
const isSubmitted = ref(false)
|
|
48
|
+
const generatedLabel = computed(() => (props.label || '') + (props.displayAsterisk ? ' *' : ''))
|
|
84
49
|
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
}]
|
|
104
|
-
: [],
|
|
105
|
-
)
|
|
50
|
+
// Utilisation du composable de validation unifié
|
|
51
|
+
const {
|
|
52
|
+
validate,
|
|
53
|
+
validateOnSubmit,
|
|
54
|
+
clearValidation,
|
|
55
|
+
errors,
|
|
56
|
+
warnings,
|
|
57
|
+
successes,
|
|
58
|
+
hasError,
|
|
59
|
+
hasWarning,
|
|
60
|
+
hasSuccess,
|
|
61
|
+
defaultRules,
|
|
62
|
+
} = useSyCheckBoxGroupValidation(props, model, focused)
|
|
63
|
+
|
|
64
|
+
const reset = () => {
|
|
65
|
+
clearValidation()
|
|
66
|
+
model.value = props.multiple ? [] : null
|
|
67
|
+
}
|
|
106
68
|
|
|
107
69
|
function isOptionChecked(value: string | number): boolean {
|
|
108
70
|
if (isMultiple.value) {
|
|
@@ -125,58 +87,8 @@
|
|
|
125
87
|
model.value = model.value === value ? null : value
|
|
126
88
|
}
|
|
127
89
|
|
|
128
|
-
function getValidationValue(): (string | number) | (string | number)[] | null {
|
|
129
|
-
if (isMultiple.value) {
|
|
130
|
-
return Array.isArray(model.value) ? model.value : []
|
|
131
|
-
}
|
|
132
|
-
return model.value as (string | number) | null
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
const validateField = async (value: (string | number) | (string | number)[] | null) => {
|
|
136
|
-
if (props.readonly) {
|
|
137
|
-
validation.clearValidation()
|
|
138
|
-
return true
|
|
139
|
-
}
|
|
140
|
-
|
|
141
|
-
if (!props.required && (value === null || (Array.isArray(value) && value.length === 0))) {
|
|
142
|
-
validation.clearValidation()
|
|
143
|
-
return true
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
const result = await validation.validateField(
|
|
147
|
-
value,
|
|
148
|
-
[...defaultRules.value, ...props.customRules],
|
|
149
|
-
props.customWarningRules,
|
|
150
|
-
props.customSuccessRules,
|
|
151
|
-
)
|
|
152
|
-
return !result.hasError
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
const validateOnSubmit = async () => {
|
|
156
|
-
isSubmitted.value = true
|
|
157
|
-
return await validateField(getValidationValue())
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
const checkErrorOnBlur = () => {
|
|
161
|
-
validateField(getValidationValue())
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
watch(model, async (newValue) => {
|
|
165
|
-
if (!props.isValidateOnBlur || isSubmitted.value) {
|
|
166
|
-
await validateField(newValue as (string | number) | (string | number)[] | null)
|
|
167
|
-
}
|
|
168
|
-
})
|
|
169
|
-
|
|
170
|
-
const hasError = computed(() => validation.hasError.value)
|
|
171
|
-
const hasWarning = computed(() => validation.hasWarning.value)
|
|
172
|
-
const hasSuccess = computed(() => validation.hasSuccess.value)
|
|
173
|
-
|
|
174
90
|
const checkboxColor = computed(() => (hasError.value ? 'error' : props.color))
|
|
175
91
|
|
|
176
|
-
const errors = computed(() => validation.errors.value)
|
|
177
|
-
const warnings = computed(() => validation.warnings.value)
|
|
178
|
-
const displaySuccesses = computed(() => validation.displaySuccesses.value)
|
|
179
|
-
|
|
180
92
|
const labelId = computed(() => (props.id ? `${props.id}-label` : undefined))
|
|
181
93
|
const computedAriaLabelledby = computed(() => {
|
|
182
94
|
if (props.label && labelId.value) {
|
|
@@ -185,6 +97,13 @@
|
|
|
185
97
|
return props.ariaLabelledby
|
|
186
98
|
})
|
|
187
99
|
|
|
100
|
+
const hasMessages = computed(() =>
|
|
101
|
+
errors.value.length > 0 || warnings.value.length > 0 || successes.value.length > 0,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
const showHelpTextAsMessage = computed(() => !!props.helpText && !hasMessages.value)
|
|
105
|
+
const showHelpTextBelow = computed(() => !!props.helpText && hasMessages.value && props.hideDetails !== true)
|
|
106
|
+
|
|
188
107
|
const messagesRef = ref<InstanceType<typeof VMessages> | null>(null)
|
|
189
108
|
const vMessagesId = computed(() => messagesRef.value?.$el.id)
|
|
190
109
|
|
|
@@ -204,18 +123,21 @@
|
|
|
204
123
|
return ids.length > 0 ? ids.join(' ') : undefined
|
|
205
124
|
})
|
|
206
125
|
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
validateField(getValidationValue())
|
|
210
|
-
}
|
|
211
|
-
})
|
|
212
|
-
|
|
213
|
-
useValidatable(validateOnSubmit)
|
|
126
|
+
// Intégration avec le système de validation du formulaire
|
|
127
|
+
useValidatable(validateOnSubmit, clearValidation, reset)
|
|
214
128
|
|
|
215
129
|
defineExpose({
|
|
216
|
-
validation,
|
|
217
130
|
validateOnSubmit,
|
|
218
|
-
|
|
131
|
+
clearValidation,
|
|
132
|
+
reset,
|
|
133
|
+
defaultRules,
|
|
134
|
+
checkErrorOnBlur: () => {
|
|
135
|
+
focused.value = false
|
|
136
|
+
if (props.isValidateOnBlur) {
|
|
137
|
+
return validate()
|
|
138
|
+
}
|
|
139
|
+
return Promise.resolve(true)
|
|
140
|
+
},
|
|
219
141
|
})
|
|
220
142
|
</script>
|
|
221
143
|
|
|
@@ -257,19 +179,35 @@
|
|
|
257
179
|
:hide-details="props.hideDetails"
|
|
258
180
|
:density="props.density"
|
|
259
181
|
@update:model-value="() => toggleOption(opt.value)"
|
|
260
|
-
@
|
|
182
|
+
@focus="focused = true"
|
|
183
|
+
@blur="focused = false"
|
|
261
184
|
/>
|
|
262
185
|
</div>
|
|
263
186
|
|
|
264
187
|
<div
|
|
265
|
-
v-if="props.hideDetails !== true && (hasError || hasWarning || (hasSuccess && props.showSuccessMessages))"
|
|
188
|
+
v-if="props.hideDetails !== true && (hasError || hasWarning || (hasSuccess && props.showSuccessMessages) || showHelpTextAsMessage)"
|
|
266
189
|
class="v-input__details sy-checkbox-group__messages"
|
|
267
190
|
>
|
|
268
191
|
<VMessages
|
|
192
|
+
v-if="hasError || hasWarning || (hasSuccess && props.showSuccessMessages)"
|
|
269
193
|
ref="messagesRef"
|
|
270
|
-
:active="hasError || hasWarning || (hasSuccess &&
|
|
271
|
-
:messages="hasError ? errors : (hasWarning ? warnings : (hasSuccess ?
|
|
194
|
+
:active="hasError || hasWarning || (hasSuccess && successes.length > 0)"
|
|
195
|
+
:messages="hasError ? errors : (hasWarning ? warnings : (hasSuccess && props.showSuccessMessages ? successes : []))"
|
|
272
196
|
/>
|
|
197
|
+
<div
|
|
198
|
+
v-if="showHelpTextAsMessage"
|
|
199
|
+
class="help-text-below"
|
|
200
|
+
:class="{ 'text-disabled': props.disabled }"
|
|
201
|
+
>
|
|
202
|
+
{{ props.helpText }}
|
|
203
|
+
</div>
|
|
204
|
+
</div>
|
|
205
|
+
<div
|
|
206
|
+
v-if="showHelpTextBelow"
|
|
207
|
+
class="help-text-below px-1 mt-1"
|
|
208
|
+
:class="{ 'text-disabled': props.disabled }"
|
|
209
|
+
>
|
|
210
|
+
{{ props.helpText }}
|
|
273
211
|
</div>
|
|
274
212
|
|
|
275
213
|
<span
|
|
@@ -293,6 +231,16 @@
|
|
|
293
231
|
font-weight: 500;
|
|
294
232
|
}
|
|
295
233
|
|
|
234
|
+
.help-text-below {
|
|
235
|
+
color: rgba(var(--v-theme-on-surface), var(--v-medium-emphasis-opacity));
|
|
236
|
+
font-size: var(--v-fontSize-liensEtLibelles);
|
|
237
|
+
line-height: 1.2;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
.help-text-below.text-disabled {
|
|
241
|
+
color: rgba(var(--v-theme-on-surface), var(--v-disabled-opacity));
|
|
242
|
+
}
|
|
243
|
+
|
|
296
244
|
:deep(.v-messages) {
|
|
297
245
|
opacity: 1;
|
|
298
246
|
}
|