@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
|
@@ -61,6 +61,10 @@
|
|
|
61
61
|
type: Boolean,
|
|
62
62
|
default: false,
|
|
63
63
|
},
|
|
64
|
+
density: {
|
|
65
|
+
type: String as PropType<'default' | 'comfortable' | 'compact' | undefined>,
|
|
66
|
+
default: 'default',
|
|
67
|
+
},
|
|
64
68
|
bgColor: {
|
|
65
69
|
type: String,
|
|
66
70
|
default: undefined,
|
|
@@ -73,6 +77,14 @@
|
|
|
73
77
|
type: Boolean,
|
|
74
78
|
default: false,
|
|
75
79
|
},
|
|
80
|
+
hideMessages: {
|
|
81
|
+
type: Boolean,
|
|
82
|
+
default: false,
|
|
83
|
+
},
|
|
84
|
+
width: {
|
|
85
|
+
type: String,
|
|
86
|
+
default: 'undefined',
|
|
87
|
+
},
|
|
76
88
|
})
|
|
77
89
|
|
|
78
90
|
const emit = defineEmits(['update:modelValue'])
|
|
@@ -100,9 +112,8 @@
|
|
|
100
112
|
const rect = input.value.$el.getBoundingClientRect()
|
|
101
113
|
listStyles.value = {
|
|
102
114
|
position: 'fixed',
|
|
103
|
-
top: `${rect.bottom}px`,
|
|
115
|
+
top: props.density === 'compact' ? `${rect.bottom + 22}px` : `${rect.bottom}px`,
|
|
104
116
|
left: `${rect.left}px`,
|
|
105
|
-
width: `${rect.width}px`,
|
|
106
117
|
zIndex: '999',
|
|
107
118
|
}
|
|
108
119
|
}
|
|
@@ -159,21 +170,27 @@
|
|
|
159
170
|
})
|
|
160
171
|
|
|
161
172
|
const isRequired = computed(() => {
|
|
162
|
-
|
|
163
|
-
if (props.
|
|
173
|
+
if (props.disableErrorHandling || props.hideMessages) return false
|
|
174
|
+
if (props.readonly) return
|
|
164
175
|
return (props.required || props.errorMessages.length > 0) && !selectedItem.value
|
|
165
176
|
})
|
|
166
177
|
|
|
167
178
|
const input = ref<InstanceType<typeof VTextField> | null>(null)
|
|
168
179
|
|
|
180
|
+
const calculatedWidth = computed(() => {
|
|
181
|
+
const baseWidth = props.width ? Number(props.width) : 0
|
|
182
|
+
const selectedText = typeof selectedItemText.value === 'string' ? selectedItemText.value : ''
|
|
183
|
+
const clearableAdjustment = props.clearable ? 4 : 0
|
|
184
|
+
return `${baseWidth + selectedText.length * (4 + clearableAdjustment)}px`
|
|
185
|
+
})
|
|
186
|
+
|
|
169
187
|
watch(() => props.modelValue, (newValue) => {
|
|
170
188
|
selectedItem.value = newValue
|
|
171
189
|
})
|
|
172
190
|
|
|
173
191
|
watch([isOpen, hasError], ([newIsOpen, newHasError]) => {
|
|
174
192
|
if (!newIsOpen) {
|
|
175
|
-
|
|
176
|
-
if (props.disableErrorHandling) {
|
|
193
|
+
if (props.disableErrorHandling || props.readonly) {
|
|
177
194
|
hasError.value = false
|
|
178
195
|
}
|
|
179
196
|
else {
|
|
@@ -186,7 +203,6 @@
|
|
|
186
203
|
})
|
|
187
204
|
|
|
188
205
|
watch(() => props.errorMessages, (newValue) => {
|
|
189
|
-
// Si la gestion des erreurs est désactivée, on ne met jamais hasError à true
|
|
190
206
|
if (!props.disableErrorHandling) {
|
|
191
207
|
hasError.value = newValue.length > 0
|
|
192
208
|
}
|
|
@@ -202,6 +218,13 @@
|
|
|
202
218
|
}
|
|
203
219
|
window.addEventListener('scroll', updateListPosition, true)
|
|
204
220
|
window.addEventListener('resize', updateListPosition)
|
|
221
|
+
|
|
222
|
+
if (props.hideMessages) {
|
|
223
|
+
const message = document.querySelector('.v-input__details')
|
|
224
|
+
if (message) {
|
|
225
|
+
message.classList.add('d-sr-only')
|
|
226
|
+
}
|
|
227
|
+
}
|
|
205
228
|
})
|
|
206
229
|
|
|
207
230
|
onUnmounted(() => {
|
|
@@ -230,11 +253,13 @@
|
|
|
230
253
|
:aria-label="labelWithAsterisk"
|
|
231
254
|
:error-messages="props.disableErrorHandling ? [] : errorMessages"
|
|
232
255
|
:variant="outlined ? 'outlined' : 'underlined'"
|
|
233
|
-
:rules="isRequired && !props.disableErrorHandling ? ['Le champ est requis.'] : []"
|
|
256
|
+
:rules="isRequired && !props.disableErrorHandling && !props.hideMessages ? ['Le champ est requis.'] : []"
|
|
234
257
|
:display-asterisk="displayAsterisk"
|
|
235
258
|
:bg-color="props.bgColor"
|
|
259
|
+
:density="props.density"
|
|
236
260
|
readonly
|
|
237
261
|
class="sy-select"
|
|
262
|
+
:width="calculatedWidth"
|
|
238
263
|
:style="hasError ? { minWidth: `${labelWidth + 18}px`} : {minWidth: `${labelWidth}px`}"
|
|
239
264
|
@click="toggleMenu"
|
|
240
265
|
@keydown.enter.prevent="toggleMenu"
|
|
@@ -192,14 +192,303 @@ describe('SySelect.vue', () => {
|
|
|
192
192
|
expect(wrapper.emitted()['update:modelValue'][0]).toEqual(['1'])
|
|
193
193
|
})
|
|
194
194
|
|
|
195
|
-
it('
|
|
195
|
+
it('ferme le menu avec la méthode closeList', async () => {
|
|
196
196
|
const wrapper = mount(SySelect, {
|
|
197
|
+
props: {
|
|
198
|
+
items: [{ text: 'Option 1', value: '1' }],
|
|
199
|
+
},
|
|
200
|
+
global: {
|
|
201
|
+
plugins: [vuetify],
|
|
202
|
+
},
|
|
203
|
+
})
|
|
204
|
+
|
|
205
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
206
|
+
await wrapper.vm.$nextTick()
|
|
207
|
+
|
|
208
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
209
|
+
const instance = wrapper.vm as any
|
|
210
|
+
expect(instance.isOpen).toBe(true)
|
|
211
|
+
|
|
212
|
+
instance.closeList()
|
|
213
|
+
await wrapper.vm.$nextTick()
|
|
214
|
+
|
|
215
|
+
expect(instance.isOpen).toBe(false)
|
|
216
|
+
})
|
|
217
|
+
|
|
218
|
+
describe('Affichage de l\'astérisque', () => {
|
|
219
|
+
it('affiche l\'astérisque quand displayAsterisk et required sont true', () => {
|
|
220
|
+
const wrapper = mount(SySelect, {
|
|
221
|
+
props: {
|
|
222
|
+
displayAsterisk: true,
|
|
223
|
+
required: true,
|
|
224
|
+
label: 'Test Label',
|
|
225
|
+
},
|
|
226
|
+
global: {
|
|
227
|
+
plugins: [vuetify],
|
|
228
|
+
},
|
|
229
|
+
})
|
|
230
|
+
|
|
231
|
+
const html = wrapper.html()
|
|
232
|
+
expect(html).toContain('Test Label *')
|
|
233
|
+
})
|
|
234
|
+
|
|
235
|
+
it('n\'affiche pas l\'astérisque quand displayAsterisk est false', () => {
|
|
236
|
+
const wrapper = mount(SySelect, {
|
|
237
|
+
props: {
|
|
238
|
+
displayAsterisk: false,
|
|
239
|
+
required: true,
|
|
240
|
+
label: 'Test Label',
|
|
241
|
+
},
|
|
242
|
+
global: {
|
|
243
|
+
plugins: [vuetify],
|
|
244
|
+
},
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
const html = wrapper.html()
|
|
248
|
+
expect(html).not.toContain('Test Label *')
|
|
249
|
+
expect(html).toContain('Test Label')
|
|
250
|
+
})
|
|
251
|
+
|
|
252
|
+
it('n\'affiche pas l\'astérisque quand required est false', () => {
|
|
253
|
+
const wrapper = mount(SySelect, {
|
|
254
|
+
props: {
|
|
255
|
+
displayAsterisk: true,
|
|
256
|
+
required: false,
|
|
257
|
+
label: 'Test Label',
|
|
258
|
+
},
|
|
259
|
+
global: {
|
|
260
|
+
plugins: [vuetify],
|
|
261
|
+
},
|
|
262
|
+
})
|
|
263
|
+
|
|
264
|
+
const html = wrapper.html()
|
|
265
|
+
expect(html).not.toContain('Test Label *')
|
|
266
|
+
expect(html).toContain('Test Label')
|
|
267
|
+
})
|
|
268
|
+
})
|
|
269
|
+
|
|
270
|
+
describe('Mode readonly', () => {
|
|
271
|
+
it('empêche l\'ouverture du menu en mode readonly', async () => {
|
|
272
|
+
const wrapper = mount(SySelect, {
|
|
273
|
+
props: {
|
|
274
|
+
readonly: true,
|
|
275
|
+
items: [{ text: 'Option 1', value: '1' }],
|
|
276
|
+
},
|
|
277
|
+
global: {
|
|
278
|
+
plugins: [vuetify],
|
|
279
|
+
},
|
|
280
|
+
})
|
|
281
|
+
|
|
282
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
283
|
+
await wrapper.vm.$nextTick()
|
|
284
|
+
|
|
285
|
+
expect(wrapper.find('.v-list').exists()).toBe(false)
|
|
286
|
+
|
|
287
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
288
|
+
const instance = wrapper.vm as any
|
|
289
|
+
expect(instance.isOpen).toBe(false)
|
|
290
|
+
})
|
|
291
|
+
|
|
292
|
+
it('affiche correctement le champ en mode readonly', () => {
|
|
293
|
+
const wrapper = mount(SySelect, {
|
|
294
|
+
props: {
|
|
295
|
+
readonly: true,
|
|
296
|
+
modelValue: { text: 'Option 1', value: '1' },
|
|
297
|
+
textKey: 'text',
|
|
298
|
+
returnObject: true,
|
|
299
|
+
},
|
|
300
|
+
global: {
|
|
301
|
+
plugins: [vuetify],
|
|
302
|
+
},
|
|
303
|
+
})
|
|
304
|
+
|
|
305
|
+
expect(wrapper.find('.v-input--readonly').exists()).toBe(true)
|
|
306
|
+
|
|
307
|
+
expect(wrapper.html()).toContain('Option 1')
|
|
308
|
+
})
|
|
309
|
+
})
|
|
310
|
+
|
|
311
|
+
describe('Option clearable', () => {
|
|
312
|
+
it('affiche l\'icône de suppression quand clearable est true et qu\'une valeur est sélectionnée', async () => {
|
|
313
|
+
const wrapper = mount(SySelect, {
|
|
314
|
+
props: {
|
|
315
|
+
clearable: true,
|
|
316
|
+
modelValue: { text: 'Option 1', value: '1' },
|
|
317
|
+
returnObject: true,
|
|
318
|
+
},
|
|
319
|
+
global: {
|
|
320
|
+
plugins: [vuetify],
|
|
321
|
+
},
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
expect(wrapper.find('.sy-select__clear-icon').exists()).toBe(true)
|
|
325
|
+
})
|
|
326
|
+
|
|
327
|
+
it('n\'affiche pas l\'icône de suppression quand clearable est false', () => {
|
|
328
|
+
const wrapper = mount(SySelect, {
|
|
329
|
+
props: {
|
|
330
|
+
clearable: false,
|
|
331
|
+
modelValue: { text: 'Option 1', value: '1' },
|
|
332
|
+
returnObject: true,
|
|
333
|
+
},
|
|
334
|
+
global: {
|
|
335
|
+
plugins: [vuetify],
|
|
336
|
+
},
|
|
337
|
+
})
|
|
338
|
+
|
|
339
|
+
expect(wrapper.find('.v-icon.mdi-close-circle').exists()).toBe(false)
|
|
340
|
+
})
|
|
341
|
+
|
|
342
|
+
it('efface la valeur sélectionnée avec la méthode selectItem', async () => {
|
|
343
|
+
const wrapper = mount(SySelect, {
|
|
344
|
+
props: {
|
|
345
|
+
clearable: true,
|
|
346
|
+
modelValue: { text: 'Option 1', value: '1' },
|
|
347
|
+
returnObject: true,
|
|
348
|
+
},
|
|
349
|
+
global: {
|
|
350
|
+
plugins: [vuetify],
|
|
351
|
+
},
|
|
352
|
+
})
|
|
353
|
+
|
|
354
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
355
|
+
const instance = wrapper.vm as any
|
|
356
|
+
instance.selectItem(null)
|
|
357
|
+
await wrapper.vm.$nextTick()
|
|
358
|
+
|
|
359
|
+
expect(wrapper.emitted()['update:modelValue'][0]).toEqual([null])
|
|
360
|
+
})
|
|
361
|
+
})
|
|
362
|
+
|
|
363
|
+
describe('Validation', () => {
|
|
364
|
+
it('affiche une erreur pour un champ requis sans valeur', async () => {
|
|
365
|
+
const wrapper = mount(SySelect, {
|
|
366
|
+
props: {
|
|
367
|
+
required: true,
|
|
368
|
+
label: 'Test Label',
|
|
369
|
+
modelValue: undefined,
|
|
370
|
+
},
|
|
371
|
+
global: {
|
|
372
|
+
plugins: [vuetify],
|
|
373
|
+
},
|
|
374
|
+
})
|
|
375
|
+
|
|
376
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
377
|
+
await wrapper.vm.$nextTick()
|
|
378
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
379
|
+
await wrapper.vm.$nextTick()
|
|
380
|
+
|
|
381
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
382
|
+
const instance = wrapper.vm as any
|
|
383
|
+
expect(instance.hasError).toBe(true)
|
|
384
|
+
})
|
|
385
|
+
|
|
386
|
+
it('n\'affiche pas d\'erreur pour un champ requis avec une valeur', async () => {
|
|
387
|
+
const wrapper = mount(SySelect, {
|
|
388
|
+
props: {
|
|
389
|
+
required: true,
|
|
390
|
+
label: 'Test Label',
|
|
391
|
+
modelValue: { text: 'Option 1', value: '1' },
|
|
392
|
+
returnObject: true,
|
|
393
|
+
},
|
|
394
|
+
global: {
|
|
395
|
+
plugins: [vuetify],
|
|
396
|
+
},
|
|
397
|
+
})
|
|
398
|
+
|
|
399
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
400
|
+
await wrapper.vm.$nextTick()
|
|
401
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
402
|
+
await wrapper.vm.$nextTick()
|
|
403
|
+
|
|
404
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
405
|
+
const instance = wrapper.vm as any
|
|
406
|
+
expect(instance.hasError).toBe(false)
|
|
407
|
+
})
|
|
408
|
+
|
|
409
|
+
it('n\'affiche pas d\'erreur quand disableErrorHandling est true', async () => {
|
|
410
|
+
const wrapper = mount(SySelect, {
|
|
411
|
+
props: {
|
|
412
|
+
required: true,
|
|
413
|
+
label: 'Test Label',
|
|
414
|
+
modelValue: undefined,
|
|
415
|
+
disableErrorHandling: true,
|
|
416
|
+
},
|
|
417
|
+
global: {
|
|
418
|
+
plugins: [vuetify],
|
|
419
|
+
},
|
|
420
|
+
})
|
|
421
|
+
|
|
422
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
423
|
+
await wrapper.vm.$nextTick()
|
|
424
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
425
|
+
await wrapper.vm.$nextTick()
|
|
426
|
+
|
|
427
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
428
|
+
const instance = wrapper.vm as any
|
|
429
|
+
expect(instance.hasError).toBe(false)
|
|
430
|
+
})
|
|
431
|
+
})
|
|
432
|
+
|
|
433
|
+
describe('Comportement du menu', () => {
|
|
434
|
+
it('ouvre et ferme le menu au clic', async () => {
|
|
435
|
+
const wrapper = mount(SySelect, {
|
|
436
|
+
props: {
|
|
437
|
+
items: [{ text: 'Option 1', value: '1' }],
|
|
438
|
+
},
|
|
439
|
+
global: {
|
|
440
|
+
plugins: [vuetify],
|
|
441
|
+
},
|
|
442
|
+
})
|
|
443
|
+
|
|
444
|
+
expect(wrapper.find('.v-list').exists()).toBe(false)
|
|
445
|
+
|
|
446
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
447
|
+
await wrapper.vm.$nextTick()
|
|
448
|
+
|
|
449
|
+
expect(wrapper.find('.v-list').exists()).toBe(true)
|
|
450
|
+
|
|
451
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
452
|
+
await wrapper.vm.$nextTick()
|
|
453
|
+
|
|
454
|
+
expect(wrapper.find('.v-list').exists()).toBe(false)
|
|
455
|
+
})
|
|
456
|
+
|
|
457
|
+
it('met à jour isOpen quand on ouvre le menu', async () => {
|
|
458
|
+
const wrapper = mount(SySelect, {
|
|
459
|
+
props: {
|
|
460
|
+
items: [{ text: 'Option 1', value: '1' }],
|
|
461
|
+
},
|
|
462
|
+
global: {
|
|
463
|
+
plugins: [vuetify],
|
|
464
|
+
},
|
|
465
|
+
})
|
|
466
|
+
|
|
467
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any -- This is a generic type
|
|
468
|
+
const instance = wrapper.vm as any
|
|
469
|
+
expect(instance.isOpen).toBe(false)
|
|
470
|
+
|
|
471
|
+
await wrapper.find('.sy-select').trigger('click')
|
|
472
|
+
await wrapper.vm.$nextTick()
|
|
473
|
+
|
|
474
|
+
expect(instance.isOpen).toBe(true)
|
|
475
|
+
})
|
|
476
|
+
})
|
|
477
|
+
|
|
478
|
+
it('ferme le menu après un clic sur le sélecteur', async () => {
|
|
479
|
+
const wrapper = mount(SySelect, {
|
|
480
|
+
props: {
|
|
481
|
+
items: [{ text: 'Option 1', value: '1' }],
|
|
482
|
+
},
|
|
197
483
|
global: {
|
|
198
484
|
plugins: [vuetify],
|
|
199
485
|
},
|
|
200
486
|
})
|
|
487
|
+
|
|
201
488
|
await wrapper.find('.sy-select').trigger('click')
|
|
489
|
+
await wrapper.vm.$nextTick()
|
|
202
490
|
expect(wrapper.find('.v-list').exists()).toBe(true)
|
|
491
|
+
|
|
203
492
|
await wrapper.find('.sy-select').trigger('mouseleave')
|
|
204
493
|
await wrapper.find('.sy-select').trigger('click')
|
|
205
494
|
await wrapper.vm.$nextTick()
|
|
@@ -217,6 +217,13 @@ export const Legende: StoryObj = {
|
|
|
217
217
|
</div>
|
|
218
218
|
</div>
|
|
219
219
|
</div>
|
|
220
|
+
<div class="mt-4">
|
|
221
|
+
<p>Rapport d’audit manuel : <a href="/audits/SyTextField.xlsx" style="color:#0C41BD;">Voir le
|
|
222
|
+
rapport</a></p>
|
|
223
|
+
<p style="color: grey; font-size: 14px">Correctifs associés (<a
|
|
224
|
+
href="https://github.com/assurance-maladie-digital/design-system/issues/4028" target="_blank"
|
|
225
|
+
style="color:#0C41BD;">issue #4028</a>)</p>
|
|
226
|
+
</div>
|
|
220
227
|
`,
|
|
221
228
|
}
|
|
222
229
|
},
|
|
@@ -28,6 +28,10 @@ const meta = {
|
|
|
28
28
|
description: 'Texte affiché comme label du champ',
|
|
29
29
|
control: 'text',
|
|
30
30
|
},
|
|
31
|
+
'autocomplete': {
|
|
32
|
+
description: 'Valeur de l\'attribut autocomplete',
|
|
33
|
+
control: 'text',
|
|
34
|
+
},
|
|
31
35
|
'prependIcon': {
|
|
32
36
|
control: 'select',
|
|
33
37
|
options: ['info', 'success', 'warning', 'error', 'close'],
|
|
@@ -118,6 +122,11 @@ const meta = {
|
|
|
118
122
|
control: 'boolean',
|
|
119
123
|
default: false,
|
|
120
124
|
},
|
|
125
|
+
'disableClickButton': {
|
|
126
|
+
description: 'Désactive le click sur les icônes append et prepend',
|
|
127
|
+
control: 'boolean',
|
|
128
|
+
default: true,
|
|
129
|
+
},
|
|
121
130
|
'readonly': {
|
|
122
131
|
description: 'Rend le champ en lecture seule',
|
|
123
132
|
control: 'boolean',
|
|
@@ -948,6 +957,7 @@ Cette story montre un cas d'usage courant : la validation d'une adresse email. L
|
|
|
948
957
|
name: 'Template',
|
|
949
958
|
code: `<SyTextField
|
|
950
959
|
v-model="value"
|
|
960
|
+
autocomplete="email"
|
|
951
961
|
label="Email"
|
|
952
962
|
required
|
|
953
963
|
:customRules="[
|
|
@@ -975,6 +985,7 @@ Cette story montre un cas d'usage courant : la validation d'une adresse email. L
|
|
|
975
985
|
v-model="value"
|
|
976
986
|
v-bind="args"
|
|
977
987
|
label="Email"
|
|
988
|
+
autocomplete="email"
|
|
978
989
|
required
|
|
979
990
|
:customRules="[
|
|
980
991
|
{
|
|
@@ -1011,6 +1022,7 @@ Cette story montre l'utilisation de la règle \`matchPattern\` pour valider un f
|
|
|
1011
1022
|
code: `<SyTextField
|
|
1012
1023
|
v-model="value"
|
|
1013
1024
|
label="Code postal"
|
|
1025
|
+
autocomplete="postal-code"
|
|
1014
1026
|
required
|
|
1015
1027
|
:customRules="[
|
|
1016
1028
|
{
|
|
@@ -1038,6 +1050,7 @@ Cette story montre l'utilisation de la règle \`matchPattern\` pour valider un f
|
|
|
1038
1050
|
v-model="value"
|
|
1039
1051
|
v-bind="args"
|
|
1040
1052
|
label="Code postal"
|
|
1053
|
+
autocomplete="postal-code"
|
|
1041
1054
|
required
|
|
1042
1055
|
:customRules="[
|
|
1043
1056
|
{
|