@cnamts/synapse 1.0.11 → 1.0.12
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-QEfKOz0P.js → DateFilter-DoCcOfDW.js} +1 -1
- package/dist/{NumberFilter-C0h7gVzp.js → NumberFilter-9uR8uo6p.js} +1 -1
- package/dist/{PeriodFilter-8dVrKjju.js → PeriodFilter-CxN5ini7.js} +1 -1
- package/dist/{SelectFilter-BI3QGbqb.js → SelectFilter-bfxipgvt.js} +1 -1
- package/dist/{TextFilter-UOp1hcPp.js → TextFilter-yCnWcmW2.js} +1 -1
- package/dist/components/Amelipro/AmeliproAccordion/AmeliproAccordion.d.ts +6 -2
- package/dist/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.d.ts +2 -0
- package/dist/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.d.ts +6 -2
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +6 -6
- package/dist/components/Amelipro/AmeliproTable/AmeliproTable.d.ts +4 -0
- package/dist/components/Amelipro/AmeliproTable/types.d.ts +11 -0
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +6 -6
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +14 -14
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +3 -3
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +1 -1
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +40 -4
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +46 -4
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +5 -10
- package/dist/components/DatePicker/composables/useDatePickerViewMode.d.ts +2 -1
- package/dist/components/DatePicker/tests/setup.d.ts +368 -8
- package/dist/components/HeaderToolbar/HeaderToolbar.d.ts +6 -6
- package/dist/components/NirField/NirField.d.ts +4 -2
- package/dist/components/PeriodField/PeriodField.d.ts +80 -0
- package/dist/components/SearchListField/SearchListField.d.ts +3 -3
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +5 -8
- package/dist/components/Tables/SyTable/SyTable.d.ts +5 -8
- package/dist/components/Tables/common/SyTablePagination.d.ts +3 -3
- package/dist/components/Tables/common/types.d.ts +4 -0
- package/dist/components/Tables/common/usePagination.d.ts +3 -4
- package/dist/components/Tables/common/useTableCheckbox.d.ts +10 -6
- package/dist/design-system-v3.js +1 -1
- package/dist/design-system-v3.umd.cjs +127 -127
- package/dist/{main-DyEOPqqn.js → main-DMXtXK3y.js} +9984 -9855
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/assets/overrides/_forms.scss +2 -0
- package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.stories.ts +7 -4
- package/src/components/Amelipro/AmeliproAccordion/AmeliproAccordion.vue +2 -0
- package/src/components/Amelipro/AmeliproAccordionFrieze/AmeliproAccordionFrieze.vue +1 -0
- package/src/components/Amelipro/AmeliproAccordionFrieze/__tests__/__snapshots__/AmeliproAccordionFrieze.spec.ts.snap +574 -112
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.stories.ts +5 -2
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +2 -1
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.stories.ts +6 -3
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResult.vue +2 -0
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.stories.ts +5 -2
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +2 -1
- package/src/components/Amelipro/AmeliproCheckbox/__tests__/AmeliproCheckbox.spec.ts +175 -0
- package/src/components/Amelipro/AmeliproCheckbox/__tests__/__snapshots__/AmeliproCheckbox.spec.ts.snap +88 -0
- package/src/components/Amelipro/AmeliproCheckboxGroup/__tests__/AmeliproCheckboxGroup.spec.ts +423 -0
- package/src/components/Amelipro/AmeliproCheckboxGroup/{tests → __tests__}/__snapshots__/AmeliproCheckboxGroup.spec.ts.snap +112 -78
- package/src/components/Amelipro/AmeliproChips/__tests__/AmeliproChips.spec.ts +92 -0
- package/src/components/Amelipro/AmeliproChips/__tests__/__snapshots__/AmeliproChips.spec.ts.snap +81 -0
- package/src/components/Amelipro/AmeliproDialog/__tests__/AmeliproDialog.spec.ts +257 -0
- package/src/components/Amelipro/AmeliproDialog/__tests__/__snapshots__/AmeliproDialog.spec.ts.snap +61 -0
- package/src/components/Amelipro/AmeliproDisclosure/__tests__/AmeliproDisclosure.spec.ts +79 -0
- package/src/components/Amelipro/AmeliproDisclosure/__tests__/__snapshots__/AmeliproDisclosure.spec.ts.snap +89 -0
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.stories.ts +81 -9
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +139 -61
- package/src/components/Amelipro/AmeliproTable/__tests__/AmeliproTable.spec.ts +10 -0
- package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +361 -187
- package/src/components/Amelipro/AmeliproTable/types.d.ts +11 -0
- package/src/components/Customs/SyTextField/SyTextField.vue +27 -5
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +31 -8
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +44 -12
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +2 -2
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +7 -1
- package/src/components/DatePicker/composables/tests/useDatePickerViewMode.spec.ts +107 -72
- package/src/components/DatePicker/composables/tests/useMonthButtonCustomization.spec.ts +6 -6
- package/src/components/DatePicker/composables/useDatePickerViewMode.ts +57 -7
- package/src/components/DatePicker/composables/useMonthButtonCustomization.ts +14 -14
- package/src/components/DatePicker/tests/navigation.regression.spec.ts +74 -0
- package/src/components/DatePicker/tests/navigation.simple.spec.ts +137 -0
- package/src/components/NirField/NirField.stories.ts +11 -2
- package/src/components/NirField/NirField.vue +21 -9
- package/src/components/RangeField/tests/RangeField.spec.ts +0 -3
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +15 -0
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +309 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +18 -3
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +67 -0
- package/src/components/Tables/SyTable/SyTable.mdx +15 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +228 -0
- package/src/components/Tables/SyTable/SyTable.vue +18 -3
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +63 -0
- package/src/components/Tables/common/SyTablePagination.vue +10 -8
- package/src/components/Tables/common/types.ts +4 -0
- package/src/components/Tables/common/usePagination.ts +11 -20
- package/src/components/Tables/common/useTableCheckbox.ts +23 -11
- package/src/composables/validation/AvecVosComposants.mdx.old +1 -1
- package/src/composables/validation/FormValidation.stories.ts.old +5 -5
- package/src/stories/Accessibilite/Introduction.mdx +1 -1
- package/src/stories/Demarrer/EnrichirLeDesignSystem.mdx +43 -0
- package/src/stories/Demarrer/EnrichirLeDesignSystem.stories.ts +239 -0
- package/src/stories/Demarrer/SignalerUneAnomalie.mdx +39 -0
- package/src/stories/Demarrer/SignalerUneAnomalie.stories.ts +261 -0
- package/src/components/Amelipro/AmeliproCheckbox/tests/AmeliproCheckbox.spec.ts +0 -19
- package/src/components/Amelipro/AmeliproCheckbox/tests/__snapshots__/AmeliproCheckbox.spec.ts.snap +0 -40
- package/src/components/Amelipro/AmeliproCheckboxGroup/tests/AmeliproCheckboxGroup.spec.ts +0 -46
- package/src/components/Amelipro/AmeliproChips/tests/AmeliproChips.spec.ts +0 -16
- package/src/components/Amelipro/AmeliproChips/tests/__snapshots__/AmeliproChips.spec.ts.snap +0 -97
- package/src/components/Amelipro/AmeliproDialog/tests/AmeliproDialog.spec.ts +0 -24
- package/src/components/Amelipro/AmeliproDialog/tests/__snapshots__/AmeliproDialog.spec.ts.snap +0 -134
- package/src/components/Amelipro/AmeliproDisclosure/tests/AmeliproDisclosure.spec.ts +0 -19
- package/src/components/Amelipro/AmeliproDisclosure/tests/__snapshots__/AmeliproDisclosure.spec.ts.snap +0 -104
- package/src/components/BackBtn/tests/__snapshots__/BackBtn.spec.ts.snap +0 -45
- package/src/components/RangeField/tests/__snapshots__/RangeField.spec.ts.snap +0 -1270
- package/src/stories/Demarrer/CreerUneIssue.mdx +0 -67
- package/src/stories/Demarrer/components.stories.ts +0 -25
|
@@ -15,25 +15,61 @@ export interface ViewModeReturn {
|
|
|
15
15
|
* Utilisé pour contrôler le comportement du CalendarMode, notamment pour les dates de naissance
|
|
16
16
|
*
|
|
17
17
|
* @param isBirthDateGetter - Une fonction qui retourne la valeur actuelle de isBirthDate
|
|
18
|
+
* @param selectedDateGetter - Une fonction qui retourne l'état de la date sélectionnée (null si aucune date)
|
|
18
19
|
*/
|
|
19
|
-
export function useDatePickerViewMode(
|
|
20
|
+
export function useDatePickerViewMode(
|
|
21
|
+
isBirthDateGetter: () => boolean,
|
|
22
|
+
selectedDateGetter: () => Date | (Date | null)[] | null,
|
|
23
|
+
): ViewModeReturn {
|
|
20
24
|
// Variable pour suivre le mode d'affichage actuel du CalendarMode
|
|
21
|
-
const currentViewMode = ref<ViewMode>(
|
|
25
|
+
const currentViewMode = ref<ViewMode>(
|
|
26
|
+
isBirthDateGetter() && !selectedDateGetter() ? 'year' : 'month',
|
|
27
|
+
)
|
|
22
28
|
|
|
23
29
|
// Mettre à jour le mode d'affichage quand isBirthDate change
|
|
24
30
|
watch(isBirthDateGetter, (newValue) => {
|
|
25
|
-
|
|
31
|
+
if (newValue && !selectedDateGetter()) {
|
|
32
|
+
// Mode birthDate et aucune date sélectionnée : commencer par year
|
|
33
|
+
currentViewMode.value = 'year'
|
|
34
|
+
}
|
|
35
|
+
else if (newValue && selectedDateGetter()) {
|
|
36
|
+
// Mode birthDate avec date sélectionnée : commencer par month
|
|
37
|
+
currentViewMode.value = 'month'
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
// Mode normal
|
|
41
|
+
currentViewMode.value = 'month'
|
|
42
|
+
}
|
|
43
|
+
})
|
|
44
|
+
|
|
45
|
+
// Mettre à jour le mode d'affichage quand la date sélectionnée change
|
|
46
|
+
watch(selectedDateGetter, (newValue) => {
|
|
47
|
+
if (isBirthDateGetter()) {
|
|
48
|
+
if (!newValue) {
|
|
49
|
+
// Aucune date sélectionnée en mode birthDate : commencer par year
|
|
50
|
+
currentViewMode.value = 'year'
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
// Date sélectionnée en mode birthDate : commencer par month
|
|
54
|
+
currentViewMode.value = 'month'
|
|
55
|
+
}
|
|
56
|
+
}
|
|
26
57
|
})
|
|
27
58
|
|
|
28
59
|
// Fonction pour gérer le changement de mode d'affichage
|
|
29
60
|
const handleViewModeUpdate = (newMode: ViewMode) => {
|
|
61
|
+
// En mode birthDate, ne pas laisser VDatePicker écraser le mode 'months'
|
|
62
|
+
if (isBirthDateGetter() && currentViewMode.value === 'months' && newMode === 'month') {
|
|
63
|
+
return
|
|
64
|
+
}
|
|
65
|
+
|
|
30
66
|
currentViewMode.value = newMode
|
|
31
67
|
}
|
|
32
68
|
|
|
33
69
|
// Fonction pour gérer la sélection de l'année quand isBirthDate est true
|
|
34
70
|
const handleYearUpdate = () => {
|
|
35
71
|
if (isBirthDateGetter()) {
|
|
36
|
-
// Après la sélection de l'année, passer
|
|
72
|
+
// Après la sélection de l'année, passer au mode months pour la sélection du mois
|
|
37
73
|
currentViewMode.value = 'months'
|
|
38
74
|
}
|
|
39
75
|
}
|
|
@@ -41,14 +77,28 @@ export function useDatePickerViewMode(isBirthDateGetter: () => boolean): ViewMod
|
|
|
41
77
|
// Fonction pour gérer la sélection du mois quand isBirthDate est true
|
|
42
78
|
const handleMonthUpdate = () => {
|
|
43
79
|
if (isBirthDateGetter()) {
|
|
44
|
-
// Après la sélection du mois, passer automatiquement à la
|
|
45
|
-
currentViewMode.value =
|
|
80
|
+
// Après la sélection du mois, passer automatiquement à la vue calendrier mensuel
|
|
81
|
+
currentViewMode.value = 'month'
|
|
46
82
|
}
|
|
47
83
|
}
|
|
48
84
|
|
|
49
85
|
// Fonction pour réinitialiser le mode d'affichage (utile lors de la fermeture du CalendarMode)
|
|
50
86
|
const resetViewMode = () => {
|
|
51
|
-
|
|
87
|
+
if (isBirthDateGetter()) {
|
|
88
|
+
// En mode birthDate, la logique dépend de l'état de la date sélectionnée
|
|
89
|
+
if (!selectedDateGetter()) {
|
|
90
|
+
// Aucune date sélectionnée : commencer par year
|
|
91
|
+
currentViewMode.value = 'year'
|
|
92
|
+
}
|
|
93
|
+
else {
|
|
94
|
+
// Date sélectionnée : commencer par month (calendrier) pour permettre la modification
|
|
95
|
+
currentViewMode.value = 'month'
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
else {
|
|
99
|
+
// Mode normal
|
|
100
|
+
currentViewMode.value = 'month'
|
|
101
|
+
}
|
|
52
102
|
}
|
|
53
103
|
|
|
54
104
|
return {
|
|
@@ -28,43 +28,43 @@ export function useMonthButtonCustomization(
|
|
|
28
28
|
switch (lowerMonth) {
|
|
29
29
|
case 'january':
|
|
30
30
|
case 'janvier':
|
|
31
|
-
return '
|
|
31
|
+
return 'janv.'
|
|
32
32
|
case 'february':
|
|
33
33
|
case 'février':
|
|
34
|
-
return '
|
|
34
|
+
return 'févr.'
|
|
35
35
|
case 'march':
|
|
36
36
|
case 'mars':
|
|
37
|
-
return '
|
|
37
|
+
return 'mars'
|
|
38
38
|
case 'april':
|
|
39
39
|
case 'avril':
|
|
40
|
-
return '
|
|
40
|
+
return 'avr.'
|
|
41
41
|
case 'may':
|
|
42
42
|
case 'mai':
|
|
43
|
-
return '
|
|
43
|
+
return 'mai'
|
|
44
44
|
case 'june':
|
|
45
45
|
case 'juin':
|
|
46
|
-
return '
|
|
46
|
+
return 'juin'
|
|
47
47
|
case 'july':
|
|
48
48
|
case 'juillet':
|
|
49
|
-
return '
|
|
49
|
+
return 'juil.'
|
|
50
50
|
case 'august':
|
|
51
51
|
case 'août':
|
|
52
|
-
return '
|
|
52
|
+
return 'août'
|
|
53
53
|
case 'september':
|
|
54
54
|
case 'septembre':
|
|
55
|
-
return '
|
|
55
|
+
return 'sept.'
|
|
56
56
|
case 'october':
|
|
57
57
|
case 'octobre':
|
|
58
|
-
return '
|
|
58
|
+
return 'oct.'
|
|
59
59
|
case 'november':
|
|
60
60
|
case 'novembre':
|
|
61
|
-
return '
|
|
61
|
+
return 'nov.'
|
|
62
62
|
case 'december':
|
|
63
63
|
case 'décembre':
|
|
64
|
-
return '
|
|
64
|
+
return 'déc.'
|
|
65
65
|
default:
|
|
66
66
|
// Si le mois n'est pas reconnu, retourner le mois avec la première lettre en majuscule
|
|
67
|
-
return monthName
|
|
67
|
+
return monthName
|
|
68
68
|
}
|
|
69
69
|
}
|
|
70
70
|
|
|
@@ -99,7 +99,7 @@ export function useMonthButtonCustomization(
|
|
|
99
99
|
<span class="v-btn__overlay"></span>
|
|
100
100
|
<span class="v-btn__underlay"></span>
|
|
101
101
|
<div class="v-btn__content" data-no-activator="" style="color: var(--v-theme-primary);">
|
|
102
|
-
<span style="color: var(--v-theme-primary);">${monthText
|
|
102
|
+
<span style="color: var(--v-theme-primary);">${monthText}</span>
|
|
103
103
|
<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" width="18" height="18" class="ms-1" style="fill: var(--v-theme-primary);" aria-hidden="true"><path d="M7.41,8.58L12,13.17L16.59,8.58L18,10L12,16L6,10L7.41,8.58Z" /></svg>
|
|
104
104
|
</div>
|
|
105
105
|
</button>
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import { nextTick } from 'vue'
|
|
4
|
+
import { vuetify } from '../../../../tests/unit/setup'
|
|
5
|
+
import CalendarModeDatePicker from '@/components/DatePicker/CalendarMode/DatePicker.vue'
|
|
6
|
+
import ComplexDatePicker from '@/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Tests de régression légers pour la navigation année/mois dans les DatePickers
|
|
10
|
+
*
|
|
11
|
+
* Problème résolu : Handlers d'événements manquants et view mode non réinitialisé
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
describe('DatePicker Navigation Regression Tests', () => {
|
|
15
|
+
const baseConfig = {
|
|
16
|
+
global: {
|
|
17
|
+
plugins: [vuetify],
|
|
18
|
+
},
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
describe('CalendarMode DatePicker', () => {
|
|
22
|
+
it('should have correct event handlers for year and month updates', async () => {
|
|
23
|
+
const wrapper = mount(CalendarModeDatePicker, {
|
|
24
|
+
...baseConfig,
|
|
25
|
+
props: {
|
|
26
|
+
modelValue: null,
|
|
27
|
+
label: 'Date Test',
|
|
28
|
+
isBirthDate: true, // Mode birthDate pour tester la navigation année/mois
|
|
29
|
+
},
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any
|
|
33
|
+
const component = wrapper.vm as any
|
|
34
|
+
component.isDatePickerVisible = true
|
|
35
|
+
await nextTick()
|
|
36
|
+
|
|
37
|
+
// Vérifier que le VDatePicker est visible
|
|
38
|
+
const datePicker = wrapper.findComponent({ name: 'VDatePicker' })
|
|
39
|
+
expect(datePicker.exists()).toBe(true)
|
|
40
|
+
|
|
41
|
+
// Vérifier que les handlers d'événements sont correctement mappés
|
|
42
|
+
const datePickerProps = datePicker.props()
|
|
43
|
+
expect(datePickerProps).toBeDefined()
|
|
44
|
+
|
|
45
|
+
// Vérifier que le view mode est correctement initialisé
|
|
46
|
+
expect(datePickerProps.viewMode).toBe('year') // Mode birthDate commence par year
|
|
47
|
+
|
|
48
|
+
wrapper.unmount()
|
|
49
|
+
})
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
describe('ComplexDatePicker', () => {
|
|
53
|
+
it('should have correct navigation handlers', async () => {
|
|
54
|
+
const wrapper = mount(ComplexDatePicker, {
|
|
55
|
+
...baseConfig,
|
|
56
|
+
props: {
|
|
57
|
+
modelValue: null,
|
|
58
|
+
label: 'Date Test',
|
|
59
|
+
isBirthDate: true,
|
|
60
|
+
},
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any
|
|
64
|
+
const component = wrapper.vm as any
|
|
65
|
+
|
|
66
|
+
// Vérifier que les handlers existent
|
|
67
|
+
expect(typeof component.handleYearUpdate).toBe('function')
|
|
68
|
+
expect(typeof component.handleMonthUpdate).toBe('function')
|
|
69
|
+
expect(typeof component.resetViewMode).toBe('function')
|
|
70
|
+
|
|
71
|
+
wrapper.unmount()
|
|
72
|
+
})
|
|
73
|
+
})
|
|
74
|
+
})
|
|
@@ -0,0 +1,137 @@
|
|
|
1
|
+
import { describe, it, expect } from 'vitest'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import { nextTick } from 'vue'
|
|
4
|
+
import { vuetify } from '../../../../tests/unit/setup'
|
|
5
|
+
import CalendarModeDatePicker from '@/components/DatePicker/CalendarMode/DatePicker.vue'
|
|
6
|
+
import ComplexDatePicker from '@/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue'
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* Tests simples pour vérifier que la correction de navigation année/mois fonctionne
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
describe('DatePicker Navigation Fix - Simple Tests', () => {
|
|
13
|
+
const baseConfig = {
|
|
14
|
+
global: {
|
|
15
|
+
plugins: [vuetify],
|
|
16
|
+
},
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
describe('CalendarMode DatePicker', () => {
|
|
20
|
+
it('should have the correct navigation handlers', async () => {
|
|
21
|
+
const wrapper = mount(CalendarModeDatePicker, {
|
|
22
|
+
...baseConfig,
|
|
23
|
+
props: {
|
|
24
|
+
modelValue: null,
|
|
25
|
+
label: 'Date Test',
|
|
26
|
+
isBirthDate: true,
|
|
27
|
+
},
|
|
28
|
+
})
|
|
29
|
+
|
|
30
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any
|
|
31
|
+
const component = wrapper.vm as any
|
|
32
|
+
|
|
33
|
+
// Vérifier que les handlers existent
|
|
34
|
+
expect(typeof component.handleYearUpdate).toBe('function')
|
|
35
|
+
expect(typeof component.handleMonthUpdate).toBe('function')
|
|
36
|
+
expect(typeof component.resetViewMode).toBe('function')
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('should navigate correctly through year -> months -> month', async () => {
|
|
40
|
+
const wrapper = mount(CalendarModeDatePicker, {
|
|
41
|
+
...baseConfig,
|
|
42
|
+
props: {
|
|
43
|
+
modelValue: null,
|
|
44
|
+
label: 'Date Test',
|
|
45
|
+
isBirthDate: true,
|
|
46
|
+
},
|
|
47
|
+
})
|
|
48
|
+
|
|
49
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any
|
|
50
|
+
const component = wrapper.vm as any
|
|
51
|
+
|
|
52
|
+
// État initial : year
|
|
53
|
+
expect(component.currentViewMode).toBe('year')
|
|
54
|
+
|
|
55
|
+
// Navigation : year -> months
|
|
56
|
+
component.handleYearUpdate()
|
|
57
|
+
await nextTick()
|
|
58
|
+
expect(component.currentViewMode).toBe('months')
|
|
59
|
+
|
|
60
|
+
// Navigation : months -> month
|
|
61
|
+
component.handleMonthUpdate()
|
|
62
|
+
await nextTick()
|
|
63
|
+
expect(component.currentViewMode).toBe('month')
|
|
64
|
+
})
|
|
65
|
+
|
|
66
|
+
it('should reset view mode correctly', async () => {
|
|
67
|
+
const wrapper = mount(CalendarModeDatePicker, {
|
|
68
|
+
...baseConfig,
|
|
69
|
+
props: {
|
|
70
|
+
modelValue: null,
|
|
71
|
+
label: 'Date Test',
|
|
72
|
+
isBirthDate: true,
|
|
73
|
+
},
|
|
74
|
+
})
|
|
75
|
+
|
|
76
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any
|
|
77
|
+
const component = wrapper.vm as any
|
|
78
|
+
|
|
79
|
+
// Changer le mode
|
|
80
|
+
component.currentViewMode = 'months'
|
|
81
|
+
expect(component.currentViewMode).toBe('months')
|
|
82
|
+
|
|
83
|
+
// Réinitialiser
|
|
84
|
+
component.resetViewMode()
|
|
85
|
+
await nextTick()
|
|
86
|
+
expect(component.currentViewMode).toBe('year') // Retour à year pour birthDate
|
|
87
|
+
})
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
describe('ComplexDatePicker', () => {
|
|
91
|
+
it('should have the correct navigation handlers', async () => {
|
|
92
|
+
const wrapper = mount(ComplexDatePicker, {
|
|
93
|
+
...baseConfig,
|
|
94
|
+
props: {
|
|
95
|
+
modelValue: null,
|
|
96
|
+
label: 'Date Test',
|
|
97
|
+
isBirthDate: true,
|
|
98
|
+
},
|
|
99
|
+
})
|
|
100
|
+
|
|
101
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any
|
|
102
|
+
const component = wrapper.vm as any
|
|
103
|
+
|
|
104
|
+
// Vérifier que les handlers existent
|
|
105
|
+
expect(typeof component.handleYearUpdate).toBe('function')
|
|
106
|
+
expect(typeof component.handleMonthUpdate).toBe('function')
|
|
107
|
+
expect(typeof component.resetViewMode).toBe('function')
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
it('should navigate correctly through year -> months -> month', async () => {
|
|
111
|
+
const wrapper = mount(ComplexDatePicker, {
|
|
112
|
+
...baseConfig,
|
|
113
|
+
props: {
|
|
114
|
+
modelValue: null,
|
|
115
|
+
label: 'Date Test',
|
|
116
|
+
isBirthDate: true,
|
|
117
|
+
},
|
|
118
|
+
})
|
|
119
|
+
|
|
120
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- any
|
|
121
|
+
const component = wrapper.vm as any
|
|
122
|
+
|
|
123
|
+
// État initial : year
|
|
124
|
+
expect(component.currentViewMode).toBe('year')
|
|
125
|
+
|
|
126
|
+
// Navigation : year -> months
|
|
127
|
+
component.handleYearUpdate()
|
|
128
|
+
await nextTick()
|
|
129
|
+
expect(component.currentViewMode).toBe('months')
|
|
130
|
+
|
|
131
|
+
// Navigation : months -> month
|
|
132
|
+
component.handleMonthUpdate()
|
|
133
|
+
await nextTick()
|
|
134
|
+
expect(component.currentViewMode).toBe('month')
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
})
|
|
@@ -295,8 +295,17 @@ const meta: Meta<typeof NirField> = {
|
|
|
295
295
|
},
|
|
296
296
|
},
|
|
297
297
|
},
|
|
298
|
-
|
|
299
|
-
description: 'Texte d\'aide affiché sous le champ.',
|
|
298
|
+
numberHint: {
|
|
299
|
+
description: 'Texte d\'aide spécifique affiché sous le champ numéro.',
|
|
300
|
+
control: 'text',
|
|
301
|
+
table: {
|
|
302
|
+
type: {
|
|
303
|
+
summary: 'string',
|
|
304
|
+
},
|
|
305
|
+
},
|
|
306
|
+
},
|
|
307
|
+
keyHint: {
|
|
308
|
+
description: 'Texte d\'aide spécifique affiché sous le champ clé.',
|
|
300
309
|
control: 'text',
|
|
301
310
|
table: {
|
|
302
311
|
type: {
|
|
@@ -36,7 +36,8 @@
|
|
|
36
36
|
variant?: 'filled' | 'outlined' | 'plain' | 'underlined' | 'solo'
|
|
37
37
|
clearable?: boolean
|
|
38
38
|
counter?: boolean | number | string
|
|
39
|
-
|
|
39
|
+
numberHint?: string
|
|
40
|
+
keyHint?: string
|
|
40
41
|
persistentHint?: boolean
|
|
41
42
|
persistentPlaceholder?: boolean
|
|
42
43
|
disableErrorHandling?: boolean
|
|
@@ -71,7 +72,8 @@
|
|
|
71
72
|
variant: 'outlined',
|
|
72
73
|
clearable: false,
|
|
73
74
|
counter: false,
|
|
74
|
-
|
|
75
|
+
numberHint: undefined,
|
|
76
|
+
keyHint: undefined,
|
|
75
77
|
persistentHint: false,
|
|
76
78
|
persistentPlaceholder: false,
|
|
77
79
|
disableErrorHandling: false,
|
|
@@ -121,8 +123,8 @@
|
|
|
121
123
|
}
|
|
122
124
|
|
|
123
125
|
const fieldWidth = computed(() => props.width || '100%')
|
|
124
|
-
const nirFieldWidth = computed(() => props.clearable ? '0 0 calc(
|
|
125
|
-
const keyFieldWidth = computed(() => props.clearable ? '0 0 calc(
|
|
126
|
+
const nirFieldWidth = computed(() => props.clearable ? '0 0 calc(68% - 8px)' : '0 0 calc(68% - 8px)')
|
|
127
|
+
const keyFieldWidth = computed(() => props.clearable ? '0 0 calc(32% - 8px)' : '0 0 calc(32% - 8px)')
|
|
126
128
|
|
|
127
129
|
const fieldId = useId()
|
|
128
130
|
const numberFieldErrorId = `nir-number-error-${fieldId}`
|
|
@@ -560,9 +562,13 @@
|
|
|
560
562
|
:readonly="props.readonly"
|
|
561
563
|
:clearable="props.clearable"
|
|
562
564
|
:counter="props.counter"
|
|
565
|
+
:hint="props.numberHint || locales.numberHint"
|
|
566
|
+
:persistent-hint="props.persistentHint"
|
|
563
567
|
:persistent-placeholder="props.persistentPlaceholder"
|
|
564
|
-
:hint="props.hint || locales.numberHint"
|
|
565
568
|
class="number-field"
|
|
569
|
+
:class="{
|
|
570
|
+
'sy-hide-detail': props.hideDetails,
|
|
571
|
+
}"
|
|
566
572
|
:display-asterisk="false"
|
|
567
573
|
:aria-describedby="numberFieldErrorId + ' ' + numberFieldWarningId + ' ' + numberFieldSuccessId"
|
|
568
574
|
:show-success-messages="false"
|
|
@@ -585,7 +591,6 @@
|
|
|
585
591
|
:prepend-tooltip="keyTooltip && keyTooltipPosition === 'prepend' ? keyTooltip : undefined"
|
|
586
592
|
:append-tooltip="keyTooltip && keyTooltipPosition === 'append' ? keyTooltip : undefined"
|
|
587
593
|
:error="keyValidation.errors.value.length > 0"
|
|
588
|
-
:hint="props.hint || locales.keyHint"
|
|
589
594
|
:disabled="disabled"
|
|
590
595
|
:bg-color="bgColor"
|
|
591
596
|
:density="props.density"
|
|
@@ -595,6 +600,7 @@
|
|
|
595
600
|
:readonly="props.readonly"
|
|
596
601
|
:clearable="props.clearable"
|
|
597
602
|
:counter="props.counter"
|
|
603
|
+
:hint="props.keyHint || locales.keyHint"
|
|
598
604
|
:persistent-hint="props.persistentHint"
|
|
599
605
|
:persistent-placeholder="props.persistentPlaceholder"
|
|
600
606
|
:aria-required="ariaRequired"
|
|
@@ -603,6 +609,9 @@
|
|
|
603
609
|
:has-success="hasKeySuccess"
|
|
604
610
|
:aria-invalid="ariaInvalidKey"
|
|
605
611
|
class="key-field"
|
|
612
|
+
:class="{
|
|
613
|
+
'sy-hide-detail': props.hideDetails,
|
|
614
|
+
}"
|
|
606
615
|
:display-asterisk="false"
|
|
607
616
|
:aria-describedby="keyFieldErrorId + ' ' + keyFieldWarningId + ' ' + keyFieldSuccessId"
|
|
608
617
|
:show-success-messages="false"
|
|
@@ -709,11 +718,11 @@
|
|
|
709
718
|
|
|
710
719
|
/* Styles pour le mode standard (div) */
|
|
711
720
|
.nir-field:not(.nir-field--fieldset) .number-field-container {
|
|
712
|
-
flex: 0 0 calc(
|
|
721
|
+
flex: 0 0 calc(68% - 8px);
|
|
713
722
|
}
|
|
714
723
|
|
|
715
724
|
.nir-field:not(.nir-field--fieldset) .key-field-container {
|
|
716
|
-
flex: 0 0 calc(
|
|
725
|
+
flex: 0 0 calc(32% - 8px);
|
|
717
726
|
}
|
|
718
727
|
|
|
719
728
|
/* Styles pour le mode fieldset */
|
|
@@ -752,6 +761,10 @@
|
|
|
752
761
|
}
|
|
753
762
|
}
|
|
754
763
|
|
|
764
|
+
.sy-hide-detail {
|
|
765
|
+
padding-bottom: 6px;
|
|
766
|
+
}
|
|
767
|
+
|
|
755
768
|
.sy-number-errors,
|
|
756
769
|
.sy-key-errors {
|
|
757
770
|
color: tokens.$colors-text-error;
|
|
@@ -766,5 +779,4 @@
|
|
|
766
779
|
.sy-key-success {
|
|
767
780
|
color: tokens.$colors-text-success;
|
|
768
781
|
}
|
|
769
|
-
|
|
770
782
|
</style>
|
|
@@ -12,7 +12,6 @@ describe('RangeField', () => {
|
|
|
12
12
|
},
|
|
13
13
|
})
|
|
14
14
|
|
|
15
|
-
expect(wrapper.html()).toMatchSnapshot()
|
|
16
15
|
const inputMin = wrapper.find('input')
|
|
17
16
|
const inputMax = wrapper.findAll('input').at(1) as DOMWrapper<HTMLInputElement>
|
|
18
17
|
|
|
@@ -31,7 +30,6 @@ describe('RangeField', () => {
|
|
|
31
30
|
},
|
|
32
31
|
})
|
|
33
32
|
|
|
34
|
-
expect(wrapper.html()).toMatchSnapshot()
|
|
35
33
|
const inputMin = wrapper.find('input')
|
|
36
34
|
const inputMax = wrapper.findAll('input').at(1) as DOMWrapper<HTMLInputElement>
|
|
37
35
|
|
|
@@ -83,7 +81,6 @@ describe('RangeField', () => {
|
|
|
83
81
|
},
|
|
84
82
|
})
|
|
85
83
|
|
|
86
|
-
expect(wrapper.html()).toMatchSnapshot()
|
|
87
84
|
const inputMin = wrapper.find('input')
|
|
88
85
|
const inputMax = wrapper.findAll('input').at(1) as DOMWrapper<HTMLInputElement>
|
|
89
86
|
|
|
@@ -51,6 +51,21 @@ Le composant permet de cacher ou réorganiser l'ordre des colonnes en utilisant
|
|
|
51
51
|
|
|
52
52
|
Le composant permet de sélectionner des lignes individuellement ou en masse. Vous pouvez activer la sélection en utilisant la prop `show-select`.
|
|
53
53
|
|
|
54
|
+
Par défaut, la clé utilisée pour identifier chaque ligne lors de la sélection est `id`. Si vos éléments ne possèdent pas de propriété `id`, la valeur sélectionnée correspondra à l'objet complet de la ligne.
|
|
55
|
+
|
|
56
|
+
Vous pouvez personnaliser cette clé avec la prop `selection-key` pour indiquer quel champ utiliser (ex: `userId`).
|
|
57
|
+
|
|
58
|
+
Exemple d'utilisation :
|
|
59
|
+
<Source dark code={`
|
|
60
|
+
<SyServerTable
|
|
61
|
+
v-model="selected"
|
|
62
|
+
:items="users"
|
|
63
|
+
:headers="headers"
|
|
64
|
+
show-select
|
|
65
|
+
selection-key="userId"
|
|
66
|
+
/>
|
|
67
|
+
`}/>
|
|
68
|
+
|
|
54
69
|
### Slot item
|
|
55
70
|
Le composant permet de personnaliser l'affichage des contenus en utilisant le slot `item`. Vous pouvez définir la structure de chaque contenu en fonction de vos besoins.
|
|
56
71
|
|