@cnamts/synapse 0.0.15-alpha → 1.0.0
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/components/Accordion/Accordion.d.ts +39 -0
- package/dist/components/Accordion/config.d.ts +9 -0
- package/dist/components/ChipList/ChipList.d.ts +1 -1
- package/dist/components/CookiesSelection/CookiesSelection.d.ts +26 -26
- package/dist/components/CopyBtn/CopyBtn.d.ts +2 -0
- package/dist/components/Customs/SyInputSelect/SyInputSelect.d.ts +12 -0
- package/dist/components/Customs/SySelect/SySelect.d.ts +43 -16
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +1391 -1
- package/dist/components/DatePicker/DatePicker.d.ts +2810 -16
- package/dist/components/DatePicker/DateTextInput.d.ts +1401 -4
- package/dist/components/DiacriticPicker/DiacriticPicker.d.ts +27 -0
- package/dist/components/DiacriticPicker/config.d.ts +14 -0
- package/dist/components/DiacriticPicker/locales.d.ts +6 -0
- package/dist/components/DownloadBtn/DownloadBtn.d.ts +1 -1
- package/dist/components/FooterBar/FooterBar.d.ts +1 -1
- package/dist/components/LangBtn/LangBtn.d.ts +4 -4
- package/dist/components/NirField/NirField.d.ts +2796 -4
- package/dist/components/NotificationBar/NotificationBar.d.ts +1 -1
- package/dist/components/PasswordField/PasswordField.d.ts +1 -1
- package/dist/components/PeriodField/PeriodField.d.ts +5636 -48
- package/dist/components/PhoneField/PhoneField.d.ts +1 -0
- package/dist/components/PhoneField/tests/types.d.ts +18 -0
- package/dist/components/SyAlert/SyAlert.d.ts +72 -1
- package/dist/components/SyTextArea/SyTextArea.d.ts +900 -0
- package/dist/components/SyTextArea/locales.d.ts +3 -0
- package/dist/components/SyTextArea/trimStartOnUpdate.d.ts +1 -0
- package/dist/components/SyTextArea/useTextActions.d.ts +13 -0
- package/dist/components/SyTextArea/wrapText.d.ts +1 -0
- package/dist/components/TableToolbar/TableToolbar.d.ts +10 -4
- package/dist/components/TableToolbar/config.d.ts +3 -2
- package/dist/components/UploadWorkflow/UploadWorkflow.d.ts +26 -26
- package/dist/components/index.d.ts +4 -0
- package/dist/composables/date/useDateFormat.d.ts +2 -2
- package/dist/composables/date/useDateFormatDayjs.d.ts +23 -0
- package/dist/composables/date/useDateInitializationDayjs.d.ts +18 -0
- package/dist/composables/date/useHolidayDay.d.ts +36 -0
- package/dist/design-system-v3.js +5106 -4208
- package/dist/design-system-v3.umd.cjs +4 -1
- package/dist/designTokens/tokens/pa/paLightTheme.d.ts +1 -32
- package/dist/style.css +1 -1
- package/dist/utils/rules/index.d.ts +1 -0
- package/dist/utils/rules/isHolidayDay/index.d.ts +11 -0
- package/dist/utils/rules/isHolidayDay/locales.d.ts +2 -0
- package/package.json +3 -2
- package/src/assets/settings.scss +12 -0
- package/src/components/Accordion/Accordion.mdx +69 -0
- package/src/components/Accordion/Accordion.stories.ts +262 -0
- package/src/components/Accordion/Accordion.vue +319 -0
- package/src/components/Accordion/config.ts +9 -0
- package/src/components/Accordion/tests/__snapshots__/accordion.spec.ts.snap +155 -0
- package/src/components/Accordion/tests/accordion.spec.ts +492 -0
- package/src/components/CopyBtn/CopyBtn.stories.ts +189 -0
- package/src/components/CopyBtn/CopyBtn.vue +29 -1
- package/src/components/CopyBtn/tests/CopyBtn.spec.ts +102 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +155 -1
- package/src/components/Customs/SyInputSelect/SyInputSelect.vue +97 -14
- package/src/components/Customs/SyInputSelect/tests/SyInputSelect.spec.ts +386 -106
- package/src/components/Customs/SySelect/SySelect.stories.ts +121 -2
- package/src/components/Customs/SySelect/SySelect.vue +33 -8
- package/src/components/Customs/SySelect/tests/SySelect.spec.ts +290 -1
- package/src/components/Customs/SyTextField/Accessibilite.stories.ts +7 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +13 -0
- package/src/components/Customs/SyTextField/SyTextField.vue +87 -20
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +795 -0
- package/src/components/DatePicker/DatePicker.stories.ts +432 -1
- package/src/components/DatePicker/DatePicker.vue +82 -27
- package/src/components/DatePicker/DatePickerValidation.stories.ts +9 -1
- package/src/components/DatePicker/DateTextInput.vue +101 -138
- package/src/components/DatePicker/docExamples/DatePickerBidirectionalValidation.vue +282 -0
- package/src/components/DatePicker/examples/DatePickerHolidayRule.vue +130 -0
- package/src/components/DatePicker/tests/DatePicker.spec.ts +33 -32
- package/src/components/DatePicker/tests/DateTextInput.spec.ts +81 -33
- package/src/components/DiacriticPicker/DiacriticPicker.mdx +104 -0
- package/src/components/DiacriticPicker/DiacriticPicker.stories.ts +447 -0
- package/src/components/DiacriticPicker/DiacriticPicker.vue +262 -0
- package/src/components/DiacriticPicker/config.ts +15 -0
- package/src/components/DiacriticPicker/locales.ts +6 -0
- package/src/components/DiacriticPicker/tests/DiatriticPicker.spec.ts +132 -0
- package/src/components/DialogBox/DialogBox.vue +1 -3
- package/src/components/NirField/NirField.stories.ts +172 -0
- package/src/components/NirField/NirField.vue +15 -7
- package/src/components/NotificationBar/Accessibilite.stories.ts +1 -1
- package/src/components/NotificationBar/NotificationBar.stories.ts +14 -0
- package/src/components/NotificationBar/NotificationBar.vue +26 -3
- package/src/components/NotificationBar/{options.ts → config.ts} +0 -1
- package/src/components/PaginatedTable/PaginatedTable.vue +0 -11
- package/src/components/PasswordField/PasswordField.stories.ts +4 -3
- package/src/components/PasswordField/PasswordField.vue +26 -18
- package/src/components/PasswordField/tests/PasswordField.spec.ts +1 -10
- package/src/components/PhoneField/PhoneField.stories.ts +143 -0
- package/src/components/PhoneField/PhoneField.vue +88 -30
- package/src/components/PhoneField/tests/PhoneField.additional.spec.ts +266 -0
- package/src/components/PhoneField/tests/PhoneField.spec.ts +248 -28
- package/src/components/PhoneField/tests/types.d.ts +19 -0
- package/src/components/SyAlert/Accessibilite.stories.ts +4 -0
- package/src/components/SyAlert/SyAlert.mdx +3 -7
- package/src/components/SyAlert/SyAlert.stories.ts +19 -12
- package/src/components/SyAlert/SyAlert.vue +88 -51
- package/src/components/SyAlert/tests/SyAlert.spec.ts +20 -2
- package/src/components/SyAlert/tests/__snapshots__/SyAlert.spec.ts.snap +83 -75
- package/src/components/SyTextArea/SyTextArea.mdx +17 -0
- package/src/components/SyTextArea/SyTextArea.stories.ts +322 -0
- package/src/components/SyTextArea/SyTextArea.vue +113 -0
- package/src/components/SyTextArea/locales.ts +3 -0
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +194 -0
- package/src/components/SyTextArea/trimStartOnUpdate.ts +12 -0
- package/src/components/SyTextArea/useTextActions.ts +52 -0
- package/src/components/SyTextArea/wrapText.ts +42 -0
- package/src/components/TableToolbar/TableToolbar.mdx +86 -1
- package/src/components/TableToolbar/TableToolbar.stories.ts +422 -74
- package/src/components/TableToolbar/TableToolbar.vue +25 -8
- package/src/components/TableToolbar/config.ts +3 -2
- package/src/components/TableToolbar/tests/__snapshots__/TableToolbar.spec.ts.snap +35 -12
- package/src/components/index.ts +4 -0
- package/src/composables/date/useDateFormat.ts +17 -1
- package/src/composables/date/useDateFormatDayjs.ts +84 -0
- package/src/composables/date/useDateInitializationDayjs.ts +133 -0
- package/src/composables/date/useHolidayDay.ts +98 -0
- package/src/composables/rules/useFieldValidation.ts +16 -3
- package/src/composables/validation/useValidation.ts +2 -1
- package/src/designTokens/tokens/pa/paLightTheme.ts +10 -41
- package/src/stories/Accessibilite/Avancement/Avancement.mdx +12 -0
- package/src/stories/Accessibilite/Avancement/Avancement.stories.ts +134 -0
- package/src/stories/Accessibilite/Introduction.mdx +5 -2
- package/src/stories/DesignTokens/colors.stories.ts +100 -41
- package/src/utils/rules/index.ts +1 -0
- package/src/utils/rules/isHolidayDay/IsHolidayDay.mdx +52 -0
- package/src/utils/rules/isHolidayDay/IsHolidayDay.stories.ts +129 -0
- package/src/utils/rules/isHolidayDay/index.ts +36 -0
- package/src/utils/rules/isHolidayDay/locales.ts +5 -0
- package/src/utils/rules/isHolidayDay/tests/isHolidayDay.spec.ts +35 -0
- /package/dist/components/NotificationBar/{options.d.ts → config.d.ts} +0 -0
- /package/src/components/DatePicker/{DatePickerValidationExamples.vue → docExamples/DatePickerValidationExamples.vue} +0 -0
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
import { locales as defaultLocales } from './locales'
|
|
8
8
|
|
|
9
9
|
const props = withDefaults(defineProps<{
|
|
10
|
-
nbTotal
|
|
10
|
+
nbTotal?: number
|
|
11
11
|
nbFiltered?: number
|
|
12
12
|
search?: string
|
|
13
13
|
searchLabel?: string
|
|
@@ -16,6 +16,7 @@
|
|
|
16
16
|
loading?: boolean
|
|
17
17
|
locales?: typeof defaultLocales
|
|
18
18
|
} & CustomizableOptions>(), {
|
|
19
|
+
nbTotal: 0,
|
|
19
20
|
nbFiltered: undefined,
|
|
20
21
|
search: undefined,
|
|
21
22
|
searchLabel: defaultLocales.search,
|
|
@@ -30,6 +31,12 @@
|
|
|
30
31
|
(e: 'add'): void
|
|
31
32
|
}>()
|
|
32
33
|
|
|
34
|
+
defineSlots<{
|
|
35
|
+
searchLeft?: () => undefined
|
|
36
|
+
searchRight?: () => undefined
|
|
37
|
+
filters?: () => undefined
|
|
38
|
+
}>()
|
|
39
|
+
|
|
33
40
|
const options = useCustomizableOptions(config, props)
|
|
34
41
|
const display = useDisplay()
|
|
35
42
|
const theme = useTheme()
|
|
@@ -38,7 +45,6 @@
|
|
|
38
45
|
'sy-form-input--s': display.xs.value,
|
|
39
46
|
'flex-grow-0': display.xs.value,
|
|
40
47
|
'flex-grow-1': !display.xs.value,
|
|
41
|
-
'mr-6': props.showAddButton,
|
|
42
48
|
'loading': props.loading,
|
|
43
49
|
}))
|
|
44
50
|
|
|
@@ -59,12 +65,14 @@
|
|
|
59
65
|
>
|
|
60
66
|
<p
|
|
61
67
|
v-if="nbTotal > 0"
|
|
62
|
-
class="mb-0 font-weight-bold mr-4 my-3"
|
|
68
|
+
class="mb-0 font-weight-bold mr-4 mr-sm-0 my-3"
|
|
63
69
|
data-test-id="nb-rows"
|
|
64
70
|
>
|
|
65
71
|
{{ displayNbRows }}
|
|
66
72
|
</p>
|
|
67
73
|
|
|
74
|
+
<slot name="filters" />
|
|
75
|
+
|
|
68
76
|
<div class="sy-table-toolbar__search">
|
|
69
77
|
<slot name="search-left" />
|
|
70
78
|
<VTextField
|
|
@@ -109,6 +117,16 @@
|
|
|
109
117
|
|
|
110
118
|
.sy-table-toolbar {
|
|
111
119
|
min-height: 56px;
|
|
120
|
+
|
|
121
|
+
:deep(.v-toolbar__content) {
|
|
122
|
+
width: 100%;
|
|
123
|
+
flex-wrap: wrap;
|
|
124
|
+
flex-direction: row !important;
|
|
125
|
+
|
|
126
|
+
@media (width <= 600px) {
|
|
127
|
+
flex-direction: column !important;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
112
130
|
}
|
|
113
131
|
|
|
114
132
|
.loading :deep(.v-field__append-inner) {
|
|
@@ -125,6 +143,10 @@
|
|
|
125
143
|
grid-auto-flow: column;
|
|
126
144
|
margin-left: auto;
|
|
127
145
|
align-items: end;
|
|
146
|
+
|
|
147
|
+
@media (width <= 600px) {
|
|
148
|
+
margin-left: 0;
|
|
149
|
+
}
|
|
128
150
|
}
|
|
129
151
|
|
|
130
152
|
.sy-form-input {
|
|
@@ -134,11 +156,6 @@
|
|
|
134
156
|
.sy-form-input--s {
|
|
135
157
|
z-index: 1; // Display content above the table on mobile
|
|
136
158
|
contain: none; // Allow fixed elements to be displayed properly
|
|
137
|
-
|
|
138
|
-
:deep(.v-toolbar__content) {
|
|
139
|
-
width: 100%;
|
|
140
|
-
flex-wrap: wrap;
|
|
141
|
-
}
|
|
142
159
|
}
|
|
143
160
|
|
|
144
161
|
.sy-table-toolbar.v-theme--dark :deep() {
|
|
@@ -8,14 +8,15 @@ export const config = {
|
|
|
8
8
|
addBtn: {
|
|
9
9
|
variant: 'outlined',
|
|
10
10
|
color: 'primary',
|
|
11
|
-
class: '
|
|
11
|
+
class: 'px-2 px-md-4',
|
|
12
12
|
minWidth: '44px',
|
|
13
|
+
height: '40px',
|
|
13
14
|
},
|
|
14
15
|
addIconLabel: {
|
|
15
16
|
class: 'mr-1',
|
|
16
17
|
},
|
|
17
18
|
textField: {
|
|
18
|
-
variant: '
|
|
19
|
+
variant: 'outlined',
|
|
19
20
|
clearable: true,
|
|
20
21
|
singleLine: true,
|
|
21
22
|
hideDetails: true,
|
|
@@ -27,6 +27,7 @@ exports[`TableToolbar > renders correctly when all the item are displayed 1`] =
|
|
|
27
27
|
font-weight-bold
|
|
28
28
|
mb-0
|
|
29
29
|
mr-4
|
|
30
|
+
mr-sm-0
|
|
30
31
|
my-3
|
|
31
32
|
">
|
|
32
33
|
5/5 lignes
|
|
@@ -36,9 +37,9 @@ exports[`TableToolbar > renders correctly when all the item are displayed 1`] =
|
|
|
36
37
|
flex-grow-1
|
|
37
38
|
sy-form-input
|
|
38
39
|
v-input
|
|
40
|
+
v-input--center-affix
|
|
39
41
|
v-input--density-compact
|
|
40
42
|
v-input--horizontal
|
|
41
|
-
v-input--plain-underlined
|
|
42
43
|
v-locale--is-ltr
|
|
43
44
|
v-text-field
|
|
44
45
|
v-theme--light
|
|
@@ -48,8 +49,9 @@ exports[`TableToolbar > renders correctly when all the item are displayed 1`] =
|
|
|
48
49
|
<div class="
|
|
49
50
|
v-field
|
|
50
51
|
v-field--appended
|
|
52
|
+
v-field--center-affix
|
|
51
53
|
v-field--single-line
|
|
52
|
-
v-field--variant-
|
|
54
|
+
v-field--variant-outlined
|
|
53
55
|
v-locale--is-ltr
|
|
54
56
|
v-theme--light
|
|
55
57
|
">
|
|
@@ -193,7 +195,9 @@ exports[`TableToolbar > renders correctly when all the item are displayed 1`] =
|
|
|
193
195
|
></i>
|
|
194
196
|
</div>
|
|
195
197
|
<div class="v-field__outline">
|
|
198
|
+
<div class="v-field__outline__start"></div>
|
|
196
199
|
<!---->
|
|
200
|
+
<div class="v-field__outline__end"></div>
|
|
197
201
|
<!---->
|
|
198
202
|
</div>
|
|
199
203
|
</div>
|
|
@@ -243,6 +247,7 @@ exports[`TableToolbar > renders correctly when loading 1`] = `
|
|
|
243
247
|
font-weight-bold
|
|
244
248
|
mb-0
|
|
245
249
|
mr-4
|
|
250
|
+
mr-sm-0
|
|
246
251
|
my-3
|
|
247
252
|
">
|
|
248
253
|
1 ligne
|
|
@@ -253,10 +258,10 @@ exports[`TableToolbar > renders correctly when loading 1`] = `
|
|
|
253
258
|
loading
|
|
254
259
|
sy-form-input
|
|
255
260
|
v-input
|
|
261
|
+
v-input--center-affix
|
|
256
262
|
v-input--density-compact
|
|
257
263
|
v-input--disabled
|
|
258
264
|
v-input--horizontal
|
|
259
|
-
v-input--plain-underlined
|
|
260
265
|
v-locale--is-ltr
|
|
261
266
|
v-text-field
|
|
262
267
|
v-theme--light
|
|
@@ -266,9 +271,10 @@ exports[`TableToolbar > renders correctly when loading 1`] = `
|
|
|
266
271
|
<div class="
|
|
267
272
|
v-field
|
|
268
273
|
v-field--appended
|
|
274
|
+
v-field--center-affix
|
|
269
275
|
v-field--disabled
|
|
270
276
|
v-field--single-line
|
|
271
|
-
v-field--variant-
|
|
277
|
+
v-field--variant-outlined
|
|
272
278
|
v-locale--is-ltr
|
|
273
279
|
v-theme--light
|
|
274
280
|
">
|
|
@@ -387,7 +393,9 @@ exports[`TableToolbar > renders correctly when loading 1`] = `
|
|
|
387
393
|
></i>
|
|
388
394
|
</div>
|
|
389
395
|
<div class="v-field__outline">
|
|
396
|
+
<div class="v-field__outline__start"></div>
|
|
390
397
|
<!---->
|
|
398
|
+
<div class="v-field__outline__end"></div>
|
|
391
399
|
<!---->
|
|
392
400
|
</div>
|
|
393
401
|
</div>
|
|
@@ -437,6 +445,7 @@ exports[`TableToolbar > renders correctly when the screen width <= 600px 1`] = `
|
|
|
437
445
|
font-weight-bold
|
|
438
446
|
mb-0
|
|
439
447
|
mr-4
|
|
448
|
+
mr-sm-0
|
|
440
449
|
my-3
|
|
441
450
|
">
|
|
442
451
|
1 ligne
|
|
@@ -446,9 +455,9 @@ exports[`TableToolbar > renders correctly when the screen width <= 600px 1`] = `
|
|
|
446
455
|
flex-grow-1
|
|
447
456
|
sy-form-input
|
|
448
457
|
v-input
|
|
458
|
+
v-input--center-affix
|
|
449
459
|
v-input--density-compact
|
|
450
460
|
v-input--horizontal
|
|
451
|
-
v-input--plain-underlined
|
|
452
461
|
v-locale--is-ltr
|
|
453
462
|
v-text-field
|
|
454
463
|
v-theme--light
|
|
@@ -458,8 +467,9 @@ exports[`TableToolbar > renders correctly when the screen width <= 600px 1`] = `
|
|
|
458
467
|
<div class="
|
|
459
468
|
v-field
|
|
460
469
|
v-field--appended
|
|
470
|
+
v-field--center-affix
|
|
461
471
|
v-field--single-line
|
|
462
|
-
v-field--variant-
|
|
472
|
+
v-field--variant-outlined
|
|
463
473
|
v-locale--is-ltr
|
|
464
474
|
v-theme--light
|
|
465
475
|
">
|
|
@@ -603,7 +613,9 @@ exports[`TableToolbar > renders correctly when the screen width <= 600px 1`] = `
|
|
|
603
613
|
></i>
|
|
604
614
|
</div>
|
|
605
615
|
<div class="v-field__outline">
|
|
616
|
+
<div class="v-field__outline__start"></div>
|
|
606
617
|
<!---->
|
|
618
|
+
<div class="v-field__outline__end"></div>
|
|
607
619
|
<!---->
|
|
608
620
|
</div>
|
|
609
621
|
</div>
|
|
@@ -653,6 +665,7 @@ exports[`TableToolbar > renders correctly with content slot 1`] = `
|
|
|
653
665
|
font-weight-bold
|
|
654
666
|
mb-0
|
|
655
667
|
mr-4
|
|
668
|
+
mr-sm-0
|
|
656
669
|
my-3
|
|
657
670
|
">
|
|
658
671
|
1 ligne
|
|
@@ -662,9 +675,9 @@ exports[`TableToolbar > renders correctly with content slot 1`] = `
|
|
|
662
675
|
flex-grow-1
|
|
663
676
|
sy-form-input
|
|
664
677
|
v-input
|
|
678
|
+
v-input--center-affix
|
|
665
679
|
v-input--density-compact
|
|
666
680
|
v-input--horizontal
|
|
667
|
-
v-input--plain-underlined
|
|
668
681
|
v-locale--is-ltr
|
|
669
682
|
v-text-field
|
|
670
683
|
v-theme--light
|
|
@@ -674,8 +687,9 @@ exports[`TableToolbar > renders correctly with content slot 1`] = `
|
|
|
674
687
|
<div class="
|
|
675
688
|
v-field
|
|
676
689
|
v-field--appended
|
|
690
|
+
v-field--center-affix
|
|
677
691
|
v-field--single-line
|
|
678
|
-
v-field--variant-
|
|
692
|
+
v-field--variant-outlined
|
|
679
693
|
v-locale--is-ltr
|
|
680
694
|
v-theme--light
|
|
681
695
|
">
|
|
@@ -819,7 +833,9 @@ exports[`TableToolbar > renders correctly with content slot 1`] = `
|
|
|
819
833
|
></i>
|
|
820
834
|
</div>
|
|
821
835
|
<div class="v-field__outline">
|
|
836
|
+
<div class="v-field__outline__start"></div>
|
|
822
837
|
<!---->
|
|
838
|
+
<div class="v-field__outline__end"></div>
|
|
823
839
|
<!---->
|
|
824
840
|
</div>
|
|
825
841
|
</div>
|
|
@@ -871,9 +887,9 @@ exports[`TableToolbar > renders correctly with no items 1`] = `
|
|
|
871
887
|
flex-grow-1
|
|
872
888
|
sy-form-input
|
|
873
889
|
v-input
|
|
890
|
+
v-input--center-affix
|
|
874
891
|
v-input--density-compact
|
|
875
892
|
v-input--horizontal
|
|
876
|
-
v-input--plain-underlined
|
|
877
893
|
v-locale--is-ltr
|
|
878
894
|
v-text-field
|
|
879
895
|
v-theme--light
|
|
@@ -883,8 +899,9 @@ exports[`TableToolbar > renders correctly with no items 1`] = `
|
|
|
883
899
|
<div class="
|
|
884
900
|
v-field
|
|
885
901
|
v-field--appended
|
|
902
|
+
v-field--center-affix
|
|
886
903
|
v-field--single-line
|
|
887
|
-
v-field--variant-
|
|
904
|
+
v-field--variant-outlined
|
|
888
905
|
v-locale--is-ltr
|
|
889
906
|
v-theme--light
|
|
890
907
|
">
|
|
@@ -1028,7 +1045,9 @@ exports[`TableToolbar > renders correctly with no items 1`] = `
|
|
|
1028
1045
|
></i>
|
|
1029
1046
|
</div>
|
|
1030
1047
|
<div class="v-field__outline">
|
|
1048
|
+
<div class="v-field__outline__start"></div>
|
|
1031
1049
|
<!---->
|
|
1050
|
+
<div class="v-field__outline__end"></div>
|
|
1032
1051
|
<!---->
|
|
1033
1052
|
</div>
|
|
1034
1053
|
</div>
|
|
@@ -1079,6 +1098,7 @@ exports[`TableToolbar > should render 1`] = `
|
|
|
1079
1098
|
font-weight-bold
|
|
1080
1099
|
mb-0
|
|
1081
1100
|
mr-4
|
|
1101
|
+
mr-sm-0
|
|
1082
1102
|
my-3
|
|
1083
1103
|
">
|
|
1084
1104
|
1/2 lignes
|
|
@@ -1088,9 +1108,9 @@ exports[`TableToolbar > should render 1`] = `
|
|
|
1088
1108
|
flex-grow-1
|
|
1089
1109
|
sy-form-input
|
|
1090
1110
|
v-input
|
|
1111
|
+
v-input--center-affix
|
|
1091
1112
|
v-input--density-compact
|
|
1092
1113
|
v-input--horizontal
|
|
1093
|
-
v-input--plain-underlined
|
|
1094
1114
|
v-locale--is-ltr
|
|
1095
1115
|
v-text-field
|
|
1096
1116
|
v-theme--light
|
|
@@ -1100,8 +1120,9 @@ exports[`TableToolbar > should render 1`] = `
|
|
|
1100
1120
|
<div class="
|
|
1101
1121
|
v-field
|
|
1102
1122
|
v-field--appended
|
|
1123
|
+
v-field--center-affix
|
|
1103
1124
|
v-field--single-line
|
|
1104
|
-
v-field--variant-
|
|
1125
|
+
v-field--variant-outlined
|
|
1105
1126
|
v-locale--is-ltr
|
|
1106
1127
|
v-theme--light
|
|
1107
1128
|
">
|
|
@@ -1245,7 +1266,9 @@ exports[`TableToolbar > should render 1`] = `
|
|
|
1245
1266
|
></i>
|
|
1246
1267
|
</div>
|
|
1247
1268
|
<div class="v-field__outline">
|
|
1269
|
+
<div class="v-field__outline__start"></div>
|
|
1248
1270
|
<!---->
|
|
1271
|
+
<div class="v-field__outline__end"></div>
|
|
1249
1272
|
<!---->
|
|
1250
1273
|
</div>
|
|
1251
1274
|
</div>
|
package/src/components/index.ts
CHANGED
|
@@ -3,6 +3,8 @@ export { useFieldValidation } from '../composables/rules/useFieldValidation'
|
|
|
3
3
|
export type { RuleOptions } from '../composables/rules/useFieldValidation'
|
|
4
4
|
export { useNotificationService } from '../services/NotificationService'
|
|
5
5
|
export { useValidation } from '../composables/validation/useValidation'
|
|
6
|
+
export { useDateFormat } from '../composables/date/useDateFormatDayjs'
|
|
7
|
+
export { default as Accordion } from './Accordion/Accordion.vue'
|
|
6
8
|
export { default as BackBtn } from './BackBtn/BackBtn.vue'
|
|
7
9
|
export { default as BackToTopBtn } from './BackToTopBtn/BackToTopBtn.vue'
|
|
8
10
|
export { default as ChipList } from './ChipList/ChipList.vue'
|
|
@@ -22,6 +24,7 @@ export { default as DataList } from './DataList/DataList.vue'
|
|
|
22
24
|
export { default as DataListGroup } from './DataListGroup/DataListGroup.vue'
|
|
23
25
|
export { default as DataListItem } from './DataListItem/DataListItem.vue'
|
|
24
26
|
export { default as DialogBox } from './DialogBox/DialogBox.vue'
|
|
27
|
+
export { default as DiacriticPicker } from './DiacriticPicker/DiacriticPicker.vue'
|
|
25
28
|
export { default as DownloadBtn } from './DownloadBtn/DownloadBtn.vue'
|
|
26
29
|
export { default as ErrorPage } from './ErrorPage/ErrorPage.vue'
|
|
27
30
|
export { default as ExternalLinks } from './ExternalLinks/ExternalLinks.vue'
|
|
@@ -65,6 +68,7 @@ export { default as SkipLink } from './SkipLink/SkipLink.vue'
|
|
|
65
68
|
export { default as SocialMediaLinks } from './SocialMediaLinks/SocialMediaLinks.vue'
|
|
66
69
|
export { default as SubHeader } from './SubHeader/SubHeader.vue'
|
|
67
70
|
export { default as SyAlert } from './SyAlert/SyAlert.vue'
|
|
71
|
+
export { default as SyTextArea } from './SyTextArea/SyTextArea.vue'
|
|
68
72
|
export { default as TableToolbar } from './TableToolbar/TableToolbar.vue'
|
|
69
73
|
export { default as UploadWorkflow } from './UploadWorkflow/UploadWorkflow.vue'
|
|
70
74
|
export { default as UserMenuBtn } from './UserMenuBtn/UserMenuBtn.vue'
|
|
@@ -8,9 +8,25 @@
|
|
|
8
8
|
* @param format - Le format de la date (ex: 'DD/MM/YYYY')
|
|
9
9
|
* @returns Un objet Date ou null si la chaîne n'est pas valide
|
|
10
10
|
*/
|
|
11
|
-
export const parseDate = (dateString: string, format: string): Date | null => {
|
|
11
|
+
export const parseDate = (dateString: string | Date | null, format: string): Date | null => {
|
|
12
|
+
// Si dateString est null ou undefined, retourner null
|
|
12
13
|
if (!dateString) return null
|
|
13
14
|
|
|
15
|
+
// Si dateString est déjà un objet Date, le retourner directement
|
|
16
|
+
if (dateString instanceof Date) {
|
|
17
|
+
return dateString
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
// Si dateString n'est pas une chaîne de caractères, convertir en chaîne ou retourner null
|
|
21
|
+
if (typeof dateString !== 'string') {
|
|
22
|
+
try {
|
|
23
|
+
dateString = String(dateString)
|
|
24
|
+
}
|
|
25
|
+
catch {
|
|
26
|
+
return null
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
14
30
|
// Créer un mapping des positions des éléments de date selon le format
|
|
15
31
|
const separator = format.includes('/') ? '/' : format.includes('-') ? '-' : '.'
|
|
16
32
|
const parts = format.split(separator)
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable pour le formatage et le parsing des dates avec dayjs
|
|
3
|
+
*/
|
|
4
|
+
import dayjs from 'dayjs'
|
|
5
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
|
6
|
+
import localizedFormat from 'dayjs/plugin/localizedFormat'
|
|
7
|
+
import utc from 'dayjs/plugin/utc'
|
|
8
|
+
import timezone from 'dayjs/plugin/timezone'
|
|
9
|
+
import 'dayjs/locale/fr'
|
|
10
|
+
|
|
11
|
+
// Initialiser les plugins dayjs
|
|
12
|
+
dayjs.extend(customParseFormat)
|
|
13
|
+
dayjs.extend(localizedFormat)
|
|
14
|
+
dayjs.extend(utc)
|
|
15
|
+
dayjs.extend(timezone)
|
|
16
|
+
dayjs.locale('fr')
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* Parse une chaîne de caractères en objet Date selon un format spécifié
|
|
20
|
+
* @param dateString - La chaîne de caractères à parser
|
|
21
|
+
* @param format - Le format de la date (ex: 'DD/MM/YYYY')
|
|
22
|
+
* @returns Un objet Date ou null si la chaîne n'est pas valide
|
|
23
|
+
*/
|
|
24
|
+
export const parseDate = (dateString: string | Date | null, format: string): Date | null => {
|
|
25
|
+
// Si dateString est null ou undefined, retourner null
|
|
26
|
+
if (!dateString) return null
|
|
27
|
+
|
|
28
|
+
// Si dateString est déjà un objet Date, le retourner directement
|
|
29
|
+
if (dateString instanceof Date) {
|
|
30
|
+
return dateString
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
// Si dateString n'est pas une chaîne de caractères, convertir en chaîne ou retourner null
|
|
34
|
+
if (typeof dateString !== 'string') {
|
|
35
|
+
try {
|
|
36
|
+
dateString = String(dateString)
|
|
37
|
+
}
|
|
38
|
+
catch {
|
|
39
|
+
return null
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// Utiliser dayjs pour parser la date
|
|
44
|
+
const parsedDate = dayjs(dateString, format, true)
|
|
45
|
+
|
|
46
|
+
if (!parsedDate.isValid()) return null
|
|
47
|
+
|
|
48
|
+
// Extraire les composants de la date pour créer une date UTC
|
|
49
|
+
// Cela évite les problèmes de décalage de fuseau horaire
|
|
50
|
+
return dayjs.utc()
|
|
51
|
+
.year(parsedDate.year())
|
|
52
|
+
.month(parsedDate.month())
|
|
53
|
+
.date(parsedDate.date())
|
|
54
|
+
.hour(0)
|
|
55
|
+
.minute(0)
|
|
56
|
+
.second(0)
|
|
57
|
+
.millisecond(0)
|
|
58
|
+
.toDate()
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
/**
|
|
62
|
+
* Formate une date selon un format spécifié
|
|
63
|
+
* @param date - La date à formater
|
|
64
|
+
* @param format - Le format de sortie (ex: 'DD/MM/YYYY')
|
|
65
|
+
* @returns La date formatée en chaîne de caractères
|
|
66
|
+
*/
|
|
67
|
+
export const formatDate = (date: Date | null, format: string): string => {
|
|
68
|
+
if (!date) return ''
|
|
69
|
+
|
|
70
|
+
return dayjs(date).format(format)
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* Hook composable pour le formatage et le parsing des dates
|
|
75
|
+
* @returns Fonctions de formatage et parsing de dates
|
|
76
|
+
*/
|
|
77
|
+
export function useDateFormat() {
|
|
78
|
+
return {
|
|
79
|
+
parseDate,
|
|
80
|
+
formatDate,
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
export default useDateFormat
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Composable pour l'initialisation des dates dans le DatePicker avec dayjs
|
|
3
|
+
*/
|
|
4
|
+
import dayjs from 'dayjs'
|
|
5
|
+
import customParseFormat from 'dayjs/plugin/customParseFormat'
|
|
6
|
+
import utc from 'dayjs/plugin/utc'
|
|
7
|
+
import timezone from 'dayjs/plugin/timezone'
|
|
8
|
+
import 'dayjs/locale/fr'
|
|
9
|
+
|
|
10
|
+
// Initialiser les plugins dayjs
|
|
11
|
+
dayjs.extend(customParseFormat)
|
|
12
|
+
dayjs.extend(utc)
|
|
13
|
+
dayjs.extend(timezone)
|
|
14
|
+
dayjs.locale('fr')
|
|
15
|
+
|
|
16
|
+
// Types
|
|
17
|
+
export type DateValue = string | [string, string] | null
|
|
18
|
+
export type DateInput = string | string[] | null | object
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* Parse une date en utilisant dayjs et retourne une Date UTC
|
|
22
|
+
* @param dateStr - La chaîne de date à analyser
|
|
23
|
+
* @param format - Le format de la date
|
|
24
|
+
* @returns Une Date ou null si la date est invalide
|
|
25
|
+
*/
|
|
26
|
+
const parseToUTCDate = (dateStr: string, format: string): Date | null => {
|
|
27
|
+
if (!dayjs(dateStr, format).isValid()) return null
|
|
28
|
+
|
|
29
|
+
// Extraire les composants de la date à partir de la chaîne
|
|
30
|
+
const dateParts = dayjs(dateStr, format)
|
|
31
|
+
|
|
32
|
+
// Créer une date UTC avec les composants exacts pour éviter les décalages de fuseau horaire
|
|
33
|
+
// Utiliser set pour définir explicitement l'année, le mois et le jour
|
|
34
|
+
return dayjs.utc()
|
|
35
|
+
.year(dateParts.year())
|
|
36
|
+
.month(dateParts.month())
|
|
37
|
+
.date(dateParts.date())
|
|
38
|
+
.hour(0)
|
|
39
|
+
.minute(0)
|
|
40
|
+
.second(0)
|
|
41
|
+
.millisecond(0)
|
|
42
|
+
.toDate()
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/**
|
|
46
|
+
* Initialise les dates sélectionnées à partir d'une valeur d'entrée
|
|
47
|
+
* @param modelValue - La valeur d'entrée (peut être une chaîne, un tableau, null ou un objet)
|
|
48
|
+
* @param displayFormat - Le format d'affichage des dates
|
|
49
|
+
* @param returnFormat - Le format de retour des dates (optionnel)
|
|
50
|
+
* @returns Une date, un tableau de dates ou null
|
|
51
|
+
*/
|
|
52
|
+
export const initializeSelectedDates = (
|
|
53
|
+
modelValue: DateInput | null,
|
|
54
|
+
displayFormat: string,
|
|
55
|
+
returnFormat: string = '',
|
|
56
|
+
): Date | Date[] | null => {
|
|
57
|
+
if (!modelValue) return null
|
|
58
|
+
|
|
59
|
+
// Déterminer le format à utiliser pour l'analyse
|
|
60
|
+
const parseFormat = returnFormat || displayFormat
|
|
61
|
+
|
|
62
|
+
if (Array.isArray(modelValue)) {
|
|
63
|
+
if (modelValue.length >= 2) {
|
|
64
|
+
// Essayer d'abord avec le format de retour, puis avec le format d'affichage
|
|
65
|
+
let dates = [
|
|
66
|
+
parseToUTCDate(modelValue[0], parseFormat),
|
|
67
|
+
parseToUTCDate(modelValue[1], parseFormat),
|
|
68
|
+
]
|
|
69
|
+
|
|
70
|
+
// Si l'une des dates est invalide avec le format de retour, essayer avec le format d'affichage
|
|
71
|
+
if (dates.some(date => date === null) && returnFormat) {
|
|
72
|
+
dates = [
|
|
73
|
+
parseToUTCDate(modelValue[0], displayFormat),
|
|
74
|
+
parseToUTCDate(modelValue[1], displayFormat),
|
|
75
|
+
]
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// Vérifie si l'une des dates est toujours invalide
|
|
79
|
+
if (dates.some(date => date === null)) {
|
|
80
|
+
return []
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
// Vérifie si la première date est après la seconde
|
|
84
|
+
if (dates[0] && dates[1] && dayjs(dates[0]).isAfter(dayjs(dates[1]))) {
|
|
85
|
+
return []
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// Filtrer les dates nulles et convertir en tableau de Date
|
|
89
|
+
return dates.filter((date): date is Date => date !== null)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
if (modelValue.length === 1) {
|
|
93
|
+
// Essayer d'abord avec le format de retour, puis avec le format d'affichage
|
|
94
|
+
let date = parseToUTCDate(modelValue[0], parseFormat)
|
|
95
|
+
|
|
96
|
+
// Si la date est invalide avec le format de retour, essayer avec le format d'affichage
|
|
97
|
+
if (date === null && returnFormat) {
|
|
98
|
+
date = parseToUTCDate(modelValue[0], displayFormat)
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
return date === null ? [] : [date]
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
return []
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
// Si modelValue est un objet, on le convertit en chaîne
|
|
108
|
+
if (typeof modelValue === 'object') {
|
|
109
|
+
return null
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Essayer d'abord avec le format de retour, puis avec le format d'affichage
|
|
113
|
+
let date = parseToUTCDate(modelValue, parseFormat)
|
|
114
|
+
|
|
115
|
+
// Si la date est invalide avec le format de retour, essayer avec le format d'affichage
|
|
116
|
+
if (date === null && returnFormat) {
|
|
117
|
+
date = parseToUTCDate(modelValue, displayFormat)
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
return date
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
/**
|
|
124
|
+
* Hook composable pour l'initialisation des dates
|
|
125
|
+
* @returns Fonction d'initialisation des dates
|
|
126
|
+
*/
|
|
127
|
+
export function useDateInitialization() {
|
|
128
|
+
return {
|
|
129
|
+
initializeSelectedDates,
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export default useDateInitialization
|