@cnamts/synapse 1.0.1 → 1.0.2
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/README.md +1 -1
- package/dist/{DateFilter-BmRuzQ9Z.js → DateFilter-YWOTbfeL.js} +1 -1
- package/dist/{NumberFilter-CnIPDHqx.js → NumberFilter-DMmMgALM.js} +1 -1
- package/dist/{PeriodFilter-CZwZ8CnQ.js → PeriodFilter-Bok5BHcn.js} +1 -1
- package/dist/SelectFilter-BKud2WhN.js +136 -0
- package/dist/{TextFilter-DTxZHJwX.js → TextFilter-DvMf2thH.js} +1 -1
- package/dist/components/Accordion/Accordion.d.ts +2 -1
- package/dist/components/Accordion/composables/useAccordionGroupCommunication.d.ts +5 -0
- package/dist/components/Accordion/composables/useAccordionKeyboardNavigation.d.ts +12 -0
- package/dist/components/Accordion/composables/useAccordionState.d.ts +13 -0
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +85 -0
- package/dist/components/Customs/SyInputSelect/SyInputSelect.d.ts +2 -0
- package/dist/components/Customs/SySelect/SySelect.d.ts +33 -13
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +2 -2
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +1585 -1452
- package/dist/components/DatePicker/DatePicker/DatePicker.d.ts +16 -2
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +3 -1
- package/dist/components/DatePicker/composables/index.d.ts +2 -0
- package/dist/components/DatePicker/composables/useAsteriskDisplay.d.ts +14 -0
- package/dist/components/DatePicker/composables/useDateAutoClamp.d.ts +16 -0
- package/dist/components/DatePicker/composables/useDateRangeInput.d.ts +1 -1
- package/dist/components/DatePicker/composables/useDisplayedDateString.d.ts +3 -0
- package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +1 -0
- package/dist/components/DatePicker/composables/useMonthButtonCustomization.d.ts +5 -2
- package/dist/components/NirField/NirField.d.ts +7 -3
- package/dist/components/NirField/nirValidation.d.ts +1 -1
- package/dist/components/PasswordField/PasswordField.d.ts +2 -0
- package/dist/components/PeriodField/PeriodField.d.ts +52 -8
- package/dist/components/PhoneField/PhoneField.d.ts +2 -2
- package/dist/components/RangeField/RangeField.d.ts +2 -0
- package/dist/components/SearchListField/SearchListField.d.ts +9 -0
- package/dist/components/SyTextArea/SyTextArea.d.ts +2 -0
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +14 -9
- package/dist/components/Tables/SyTable/SyTable.d.ts +12 -7
- package/dist/components/Tables/common/SyTablePagination.d.ts +1636 -0
- package/dist/components/Tables/common/TableHeader.d.ts +2 -20
- package/dist/components/Tables/common/filters/SelectFilter.d.ts +5 -5
- package/dist/components/Tables/common/filters/getFilterComponent.d.ts +1 -0
- package/dist/components/Tables/common/filters/locales.d.ts +4 -0
- package/dist/components/Tables/common/filters/logics/date.d.ts +1 -0
- package/dist/components/Tables/common/filters/logics/number.d.ts +1 -0
- package/dist/components/Tables/common/filters/logics/period.d.ts +1 -0
- package/dist/components/Tables/common/filters/logics/select.d.ts +1 -0
- package/dist/components/Tables/common/filters/logics/text.d.ts +1 -0
- package/dist/components/Tables/common/locales.d.ts +21 -0
- package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +267 -0
- package/dist/components/Tables/common/organizeColumns/sortHeaders.d.ts +2 -0
- package/dist/components/Tables/common/tableFilterUtils.d.ts +1 -0
- package/dist/components/Tables/common/tableStorageUtils.d.ts +41 -1
- package/dist/components/Tables/common/tableUtils.d.ts +42 -5
- package/dist/components/Tables/common/types.d.ts +19 -8
- package/dist/components/Tables/common/usePagination.d.ts +22 -0
- package/dist/components/Tables/common/useTableCheckbox.d.ts +20 -0
- package/dist/components/Tables/common/useTableHeaders.d.ts +76 -0
- package/dist/components/Tables/common/useTableItems.d.ts +24 -0
- package/dist/components/Tables/common/useTableOptions.d.ts +18 -0
- package/dist/components/ToolbarContainer/ToolbarContainer.d.ts +11 -0
- package/dist/components/UserMenuBtn/UserMenuBtn.d.ts +9 -2
- package/dist/components/index.d.ts +8 -6
- package/dist/design-system-v3.js +58 -56
- package/dist/design-system-v3.umd.cjs +22 -22
- package/dist/main-Cx8qG7YR.js +16344 -0
- package/dist/stories/Accessibilite/Vuetify/VuetifyItems.d.ts +14 -2
- package/dist/stories/DesignTokens/StylesTypographiques.stories.new.d.ts +8 -0
- package/dist/stories/DesignTokens/TypographyDisplay.d.ts +28 -0
- package/dist/stories/DesignTokens/vue-shims.d.ts +6 -0
- package/dist/style.css +1 -1
- package/package.json +1 -1
- package/src/common/imgs/accessibility-svgrepo-com.svg +4 -0
- package/src/components/Accordion/Accessibilite/AccessibilityGuide.mdx +249 -0
- package/src/components/Accordion/Accordion.vue +48 -76
- package/src/components/Accordion/composables/__tests__/useAccordionGroupCommunication.spec.ts +146 -0
- package/src/components/Accordion/composables/__tests__/useAccordionKeyboardNavigation.spec.ts +209 -0
- package/src/components/Accordion/composables/__tests__/useAccordionState.spec.ts +144 -0
- package/src/components/Accordion/composables/useAccordionGroupCommunication.ts +52 -0
- package/src/components/Accordion/composables/useAccordionKeyboardNavigation.ts +111 -0
- package/src/components/Accordion/composables/useAccordionState.ts +59 -0
- package/src/components/Accordion/tests/__snapshots__/accordion.spec.ts.snap +3 -0
- package/src/components/Customs/SyCheckbox/Accessibilite.mdx +303 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.mdx +50 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +630 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +326 -0
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.spec.ts +201 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.stories.ts +1 -0
- package/src/components/Customs/SyInputSelect/SyInputSelect.vue +8 -1
- package/src/components/Customs/SySelect/SySelect.stories.ts +160 -0
- package/src/components/Customs/SySelect/SySelect.vue +291 -32
- package/src/components/Customs/SySelect/tests/SySelect.spec.ts +230 -0
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +3 -2
- package/src/components/Customs/SyTextField/SyTextField.vue +19 -8
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +241 -31
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +305 -57
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.events.spec.ts +161 -0
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +4 -2
- package/src/components/DatePicker/DatePicker/DatePicker.stories.ts +259 -137
- package/src/components/DatePicker/DatePicker/DatePicker.vue +153 -25
- package/src/components/DatePicker/DatePicker/tests/DatePicker.events.spec.ts +189 -0
- package/src/components/DatePicker/DatePicker/{DatePicker.spec.ts → tests/DatePicker.spec.ts} +1 -15
- package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +24 -14
- package/src/components/DatePicker/DateTextInput/DateTextInput.events.spec.ts +148 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.spec.ts +3 -1
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +200 -5
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +241 -31
- package/src/components/DatePicker/composables/index.ts +2 -0
- package/src/components/DatePicker/composables/tests/useDateAutoClamp.spec.ts +190 -0
- package/src/components/DatePicker/composables/tests/useInputBlurHandler.spec.ts +182 -4
- package/src/components/DatePicker/composables/tests/useMonthButtonCustomization.spec.ts +105 -80
- package/src/components/DatePicker/composables/useAsteriskDisplay.ts +31 -0
- package/src/components/DatePicker/composables/useDateAutoClamp.ts +136 -0
- package/src/components/DatePicker/composables/useDateRangeInput.ts +21 -18
- package/src/components/DatePicker/composables/useDisplayedDateString.ts +13 -1
- package/src/components/DatePicker/composables/useInputBlurHandler.ts +84 -20
- package/src/components/DatePicker/composables/useMonthButtonCustomization.ts +149 -51
- package/src/components/DiacriticPicker/DiacriticPicker.stories.ts +10 -0
- package/src/components/ErrorPage/Accessibilite.stories.ts +8 -0
- package/src/components/ErrorPage/ErrorPage.vue +12 -6
- package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +4 -4
- package/src/components/NirField/NirField.mdx +22 -9
- package/src/components/NirField/NirField.stories.ts +26 -2
- package/src/components/NirField/NirField.vue +209 -22
- package/src/components/NirField/nirValidation.ts +17 -3
- package/src/components/NirField/tests/NirField.spec.ts +2 -2
- package/src/components/NotFoundPage/Accessibilite.stories.ts +8 -0
- package/src/components/NotFoundPage/NotFoundPage.vue +2 -1
- package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +8 -6
- package/src/components/PaginatedTable/PaginatedTable.mdx +2 -0
- package/src/components/PasswordField/PasswordField.stories.ts +4 -0
- package/src/components/PasswordField/PasswordField.vue +3 -0
- package/src/components/PeriodField/PeriodField.vue +2 -0
- package/src/components/PhoneField/PhoneField.stories.ts +15 -15
- package/src/components/PhoneField/PhoneField.vue +1 -1
- package/src/components/RangeField/RangeField.stories.ts +9 -0
- package/src/components/RangeField/RangeField.vue +4 -0
- package/src/components/RangeField/tests/__snapshots__/RangeField.spec.ts.snap +12 -0
- package/src/components/SearchListField/SearchListField.vue +5 -0
- package/src/components/SyTextArea/SyTextArea.vue +3 -0
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +0 -1
- package/src/components/Tables/SyServerTable/FilterRules.stories.ts +632 -15
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +15 -5
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +2844 -1377
- package/src/components/Tables/SyServerTable/SyServerTable.vue +155 -66
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +256 -4
- package/src/components/Tables/SyTable/FilterRules.stories.ts +183 -0
- package/src/components/Tables/SyTable/SyTable.mdx +14 -4
- package/src/components/Tables/SyTable/SyTable.stories.ts +1265 -477
- package/src/components/Tables/SyTable/SyTable.vue +152 -72
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +366 -4
- package/src/components/Tables/common/SyTableFilter.vue +3 -56
- package/src/components/Tables/common/SyTablePagination.vue +375 -0
- package/src/components/Tables/common/TableHeader.vue +10 -26
- package/src/components/Tables/common/filters/SelectFilter.vue +131 -22
- package/src/components/Tables/common/filters/getFilterComponent.ts +54 -0
- package/src/components/Tables/common/filters/locales.ts +4 -0
- package/src/components/Tables/common/filters/logics/date.ts +12 -0
- package/src/components/Tables/common/filters/logics/number.ts +48 -0
- package/src/components/Tables/common/filters/logics/period.ts +25 -0
- package/src/components/Tables/common/filters/logics/select.ts +27 -0
- package/src/components/Tables/common/filters/logics/tests/TextFilterLogic.spec.ts +177 -0
- package/src/components/Tables/common/filters/logics/text.ts +62 -0
- package/src/components/Tables/common/filters/tests/TextFilter.spec.ts +11 -11
- package/src/components/Tables/common/locales.ts +24 -0
- package/src/components/Tables/common/organizeColumns/OrganizeColumns.vue +269 -0
- package/src/components/Tables/common/organizeColumns/sortHeaders.ts +9 -0
- package/src/components/Tables/common/tableFilterUtils.ts +43 -295
- package/src/components/Tables/common/tableStorageUtils.ts +27 -2
- package/src/components/Tables/common/tableStyles.scss +26 -0
- package/src/components/Tables/common/tableUtils.ts +3 -16
- package/src/components/Tables/common/tests/SyTablePagination.spec.ts +170 -0
- package/src/components/Tables/common/tests/filterByRange.spec.ts +215 -0
- package/src/components/Tables/common/tests/tableFilterUtils.spec.ts +0 -14
- package/src/components/Tables/common/tests/tableUtils.spec.ts +7 -51
- package/src/components/Tables/common/types.ts +17 -6
- package/src/components/Tables/common/usePagination.ts +83 -0
- package/src/components/Tables/common/useTableCheckbox.ts +58 -0
- package/src/components/Tables/common/useTableHeaders.ts +88 -0
- package/src/components/Tables/common/useTableItems.ts +87 -0
- package/src/components/Tables/common/useTableOptions.ts +93 -0
- package/src/components/ToolbarContainer/ToolbarContainer.mdx +16 -0
- package/src/components/ToolbarContainer/ToolbarContainer.stories.ts +675 -0
- package/src/components/ToolbarContainer/ToolbarContainer.vue +128 -0
- package/src/components/ToolbarContainer/tests/ToolbarContainer.spec.ts +156 -0
- package/src/components/UserMenuBtn/UserMenuBtn.stories.ts +74 -0
- package/src/components/UserMenuBtn/UserMenuBtn.vue +19 -17
- package/src/components/index.ts +8 -6
- package/src/stories/Accessibilite/Aculturation/AuditDesignSystem.mdx +293 -20
- package/src/stories/Accessibilite/Aculturation/SensibilisationAccessibilite.mdx +448 -54
- package/src/stories/Accessibilite/Audit/RGAA.mdx +231 -23
- package/src/stories/Accessibilite/Avancement/Avancement.mdx +591 -7
- package/src/stories/Accessibilite/Avancement/Avancement.stories.ts +139 -38
- package/src/stories/Accessibilite/Introduction.mdx +258 -18
- package/src/stories/Accessibilite/KitDePreAudit/Echantillonnage.mdx +221 -31
- package/src/stories/Accessibilite/KitDePreAudit/Introduction.mdx +204 -22
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Introduction.mdx +537 -24
- package/src/stories/Accessibilite/KitDePreAudit/Outils/LecteursDEcran.mdx +577 -70
- package/src/stories/Accessibilite/KitDePreAudit/Outils/Tanaguru.mdx +382 -31
- package/src/stories/Accessibilite/KitDePreAudit/Preaudit.mdx +419 -81
- package/src/stories/Accessibilite/Vuetify/Vuetify.mdx +132 -6
- package/src/stories/Accessibilite/Vuetify/Vuetify.stories.ts +370 -146
- package/src/stories/Accessibilite/Vuetify/VuetifyItems.ts +35 -57
- package/src/stories/Demarrer/Accueil.stories.ts +20 -5
- package/src/stories/DesignTokens/StylesTypographiques.mdx +10 -9
- package/src/stories/DesignTokens/StylesTypographiques.stories.new.ts +397 -0
- package/src/stories/DesignTokens/StylesTypographiques.stories.ts +397 -0
- package/src/stories/DesignTokens/TypographyDisplay.vue +155 -0
- package/src/stories/DesignTokens/vue-shims.d.ts +6 -0
- package/src/stories/GuideDuDev/LesBreackingChanges.mdx +0 -2
- package/src/stories/GuideDuDev/MigrationDepuisBridge.mdx +1 -1
- package/src/stories/GuideDuDev/MigrationDepuisVue2.mdx +1 -1
- package/src/stories/GuideDuDev/PortailAgent.mdx +10 -0
- package/src/stories/GuideDuDev/PortailAgent.stories.ts +506 -0
- package/src/stories/GuideDuDev/Theme.mdx +41 -0
- package/dist/SelectFilter-Cj-GW2Cc.js +0 -97
- package/dist/main-WDqeoGM-.js +0 -14788
- package/src/components/PaginatedTable/tests/__snapshots__/PaginatedTable.spec.ts.snap +0 -886
- package/src/components/Tables/SyServerTable/tests/__snapshots__/SyServerTable.spec.ts.snap +0 -521
- package/src/components/Tables/SyTable/tests/__snapshots__/SyTable.spec.ts.snap +0 -521
- package/src/stories/DesignTokens/ThemePA.mdx +0 -35
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { Meta, StoryObj } from '@storybook/vue3'
|
|
2
|
+
import { fn } from '@storybook/test'
|
|
3
|
+
import { ref } from 'vue'
|
|
2
4
|
import SyTable from './SyTable.vue'
|
|
3
5
|
import type { DataOptions, FilterType } from '../common/types'
|
|
4
|
-
import { ref } from 'vue'
|
|
5
6
|
import type { VDataTable } from 'vuetify/components'
|
|
6
7
|
import dayjs from 'dayjs'
|
|
7
8
|
|
|
@@ -18,7 +19,7 @@ const meta = {
|
|
|
18
19
|
},
|
|
19
20
|
argTypes: {
|
|
20
21
|
headers: {
|
|
21
|
-
description: 'Liste des colonnes du tableau',
|
|
22
|
+
description: 'Liste des colonnes du tableau (voir : https://vuetifyjs.com/en/api/v-data-table/#props-headers)',
|
|
22
23
|
control: { type: 'object' },
|
|
23
24
|
table: {
|
|
24
25
|
category: 'props',
|
|
@@ -29,6 +30,9 @@ const meta = {
|
|
|
29
30
|
control: { type: 'object' },
|
|
30
31
|
table: {
|
|
31
32
|
category: 'props',
|
|
33
|
+
defaultValue: {
|
|
34
|
+
summary: '[]',
|
|
35
|
+
},
|
|
32
36
|
},
|
|
33
37
|
},
|
|
34
38
|
density: {
|
|
@@ -66,10 +70,6 @@ const meta = {
|
|
|
66
70
|
},
|
|
67
71
|
required: true,
|
|
68
72
|
},
|
|
69
|
-
itemsPerPage: {
|
|
70
|
-
description: 'Nombre d\'éléments par page',
|
|
71
|
-
control: { type: 'number' },
|
|
72
|
-
},
|
|
73
73
|
resizableColumns: {
|
|
74
74
|
description: 'Permet de redimensionner les colonnes du tableau',
|
|
75
75
|
},
|
|
@@ -81,6 +81,25 @@ const meta = {
|
|
|
81
81
|
description: 'Affiche les filtres au-dessus du tableau',
|
|
82
82
|
control: { type: 'boolean' },
|
|
83
83
|
},
|
|
84
|
+
enableColumnControls: {
|
|
85
|
+
description: 'Allow the users to re-organize the columns',
|
|
86
|
+
table: {
|
|
87
|
+
defaultValue: {
|
|
88
|
+
summary: 'false',
|
|
89
|
+
},
|
|
90
|
+
type: { summary: 'boolean' },
|
|
91
|
+
category: 'props',
|
|
92
|
+
},
|
|
93
|
+
control: { type: 'boolean' },
|
|
94
|
+
},
|
|
95
|
+
showSelect: {
|
|
96
|
+
description: 'Affiche des cases à cocher pour sélectionner des lignes',
|
|
97
|
+
control: { type: 'boolean' },
|
|
98
|
+
table: {
|
|
99
|
+
category: 'props',
|
|
100
|
+
type: { summary: 'boolean' },
|
|
101
|
+
},
|
|
102
|
+
},
|
|
84
103
|
},
|
|
85
104
|
} satisfies Meta<typeof SyTable & typeof VDataTable>
|
|
86
105
|
|
|
@@ -168,7 +187,7 @@ export const Default: Story = {
|
|
|
168
187
|
],
|
|
169
188
|
},
|
|
170
189
|
args: {
|
|
171
|
-
headers: [
|
|
190
|
+
'headers': [
|
|
172
191
|
{
|
|
173
192
|
title: 'Nom',
|
|
174
193
|
key: 'lastname',
|
|
@@ -182,7 +201,7 @@ export const Default: Story = {
|
|
|
182
201
|
value: 'email',
|
|
183
202
|
},
|
|
184
203
|
],
|
|
185
|
-
items: [
|
|
204
|
+
'items': [
|
|
186
205
|
{
|
|
187
206
|
firstname: 'Virginie',
|
|
188
207
|
lastname: 'Beauchesne',
|
|
@@ -214,15 +233,16 @@ export const Default: Story = {
|
|
|
214
233
|
email: 'agate.roy@exemple.com',
|
|
215
234
|
},
|
|
216
235
|
],
|
|
217
|
-
options: {
|
|
236
|
+
'options': {
|
|
218
237
|
itemsPerPage: 4,
|
|
219
238
|
},
|
|
220
|
-
caption: '',
|
|
221
|
-
suffix: 'default-table',
|
|
222
|
-
density: 'default',
|
|
223
|
-
striped: false,
|
|
239
|
+
'caption': '',
|
|
240
|
+
'suffix': 'default-table',
|
|
241
|
+
'density': 'default',
|
|
242
|
+
'striped': false,
|
|
243
|
+
'onUpdate:options': fn(),
|
|
224
244
|
},
|
|
225
|
-
render(args) {
|
|
245
|
+
render: (args) => {
|
|
226
246
|
return {
|
|
227
247
|
components: { SyTable },
|
|
228
248
|
setup() {
|
|
@@ -231,13 +251,7 @@ export const Default: Story = {
|
|
|
231
251
|
template: `
|
|
232
252
|
<SyTable
|
|
233
253
|
v-model:options="args.options"
|
|
234
|
-
|
|
235
|
-
:items="args.items"
|
|
236
|
-
:caption="args.caption"
|
|
237
|
-
:suffix="args.suffix"
|
|
238
|
-
:density="args.density"
|
|
239
|
-
:striped="args.striped"
|
|
240
|
-
:resizable-columns="args.resizableColumns"
|
|
254
|
+
v-bind="args"
|
|
241
255
|
/>
|
|
242
256
|
`,
|
|
243
257
|
}
|
|
@@ -331,7 +345,7 @@ export const SortBy: Story = {
|
|
|
331
345
|
],
|
|
332
346
|
},
|
|
333
347
|
args: {
|
|
334
|
-
headers: [
|
|
348
|
+
'headers': [
|
|
335
349
|
{
|
|
336
350
|
title: 'Nom',
|
|
337
351
|
key: 'lastname',
|
|
@@ -345,7 +359,7 @@ export const SortBy: Story = {
|
|
|
345
359
|
value: 'email',
|
|
346
360
|
},
|
|
347
361
|
],
|
|
348
|
-
items: [
|
|
362
|
+
'items': [
|
|
349
363
|
{
|
|
350
364
|
firstname: 'Virginie',
|
|
351
365
|
lastname: 'Beauchesne',
|
|
@@ -377,8 +391,8 @@ export const SortBy: Story = {
|
|
|
377
391
|
email: 'agate.roy@exemple.com',
|
|
378
392
|
},
|
|
379
393
|
],
|
|
380
|
-
caption: '',
|
|
381
|
-
options: {
|
|
394
|
+
'caption': '',
|
|
395
|
+
'options': {
|
|
382
396
|
itemsPerPage: 4,
|
|
383
397
|
sortBy: [
|
|
384
398
|
{
|
|
@@ -387,11 +401,12 @@ export const SortBy: Story = {
|
|
|
387
401
|
},
|
|
388
402
|
],
|
|
389
403
|
},
|
|
390
|
-
suffix: 'sort-table',
|
|
391
|
-
density: 'default',
|
|
392
|
-
striped: false,
|
|
404
|
+
'suffix': 'sort-table',
|
|
405
|
+
'density': 'default',
|
|
406
|
+
'striped': false,
|
|
407
|
+
'onUpdate:options': fn(),
|
|
393
408
|
},
|
|
394
|
-
render(args) {
|
|
409
|
+
render: (args) => {
|
|
395
410
|
return {
|
|
396
411
|
components: { SyTable },
|
|
397
412
|
setup() {
|
|
@@ -400,13 +415,7 @@ export const SortBy: Story = {
|
|
|
400
415
|
template: `
|
|
401
416
|
<SyTable
|
|
402
417
|
v-model:options="args.options"
|
|
403
|
-
|
|
404
|
-
:items="args.items"
|
|
405
|
-
:caption="args.caption"
|
|
406
|
-
:suffix="args.suffix"
|
|
407
|
-
:density="args.density"
|
|
408
|
-
:striped="args.striped"
|
|
409
|
-
:resizable-columns="args.resizableColumns"
|
|
418
|
+
v-bind="args"
|
|
410
419
|
/>
|
|
411
420
|
`,
|
|
412
421
|
}
|
|
@@ -501,7 +510,7 @@ export const FilterByText: Story = {
|
|
|
501
510
|
],
|
|
502
511
|
},
|
|
503
512
|
args: {
|
|
504
|
-
headers: [
|
|
513
|
+
'headers': [
|
|
505
514
|
{
|
|
506
515
|
title: 'Nom',
|
|
507
516
|
key: 'lastname',
|
|
@@ -521,7 +530,7 @@ export const FilterByText: Story = {
|
|
|
521
530
|
filterType: 'text',
|
|
522
531
|
},
|
|
523
532
|
],
|
|
524
|
-
items: [
|
|
533
|
+
'items': [
|
|
525
534
|
{
|
|
526
535
|
firstname: 'Virginie',
|
|
527
536
|
lastname: 'Beauchesne',
|
|
@@ -553,17 +562,18 @@ export const FilterByText: Story = {
|
|
|
553
562
|
email: 'agate.roy@exemple.com',
|
|
554
563
|
},
|
|
555
564
|
],
|
|
556
|
-
caption: '',
|
|
557
|
-
options: {
|
|
565
|
+
'caption': '',
|
|
566
|
+
'options': {
|
|
558
567
|
itemsPerPage: 4,
|
|
559
568
|
filters: [],
|
|
560
569
|
},
|
|
561
|
-
showFilters: true,
|
|
562
|
-
suffix: 'filter-text-table',
|
|
563
|
-
density: 'default',
|
|
564
|
-
striped: false,
|
|
570
|
+
'showFilters': true,
|
|
571
|
+
'suffix': 'filter-text-table',
|
|
572
|
+
'density': 'default',
|
|
573
|
+
'striped': false,
|
|
574
|
+
'onUpdate:options': fn(),
|
|
565
575
|
},
|
|
566
|
-
render(args) {
|
|
576
|
+
render: (args) => {
|
|
567
577
|
return {
|
|
568
578
|
components: { SyTable },
|
|
569
579
|
setup() {
|
|
@@ -579,15 +589,9 @@ export const FilterByText: Story = {
|
|
|
579
589
|
},
|
|
580
590
|
template: `
|
|
581
591
|
<SyTable
|
|
582
|
-
v-model:options="options"
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
:caption="args.caption"
|
|
586
|
-
:show-filters="args.showFilters"
|
|
587
|
-
:suffix="args.suffix"
|
|
588
|
-
:density="args.density"
|
|
589
|
-
:striped="args.striped"
|
|
590
|
-
:resizable-columns="args.resizableColumns"
|
|
592
|
+
v-model:options="args.options"
|
|
593
|
+
v-bind="args"
|
|
594
|
+
suffix="filter-text-table"
|
|
591
595
|
/>
|
|
592
596
|
`,
|
|
593
597
|
}
|
|
@@ -677,7 +681,7 @@ export const FilterByNumber: Story = {
|
|
|
677
681
|
],
|
|
678
682
|
},
|
|
679
683
|
args: {
|
|
680
|
-
headers: [
|
|
684
|
+
'headers': [
|
|
681
685
|
{
|
|
682
686
|
title: 'Nom',
|
|
683
687
|
key: 'name',
|
|
@@ -697,7 +701,7 @@ export const FilterByNumber: Story = {
|
|
|
697
701
|
filterType: 'number',
|
|
698
702
|
},
|
|
699
703
|
],
|
|
700
|
-
items: [
|
|
704
|
+
'items': [
|
|
701
705
|
{
|
|
702
706
|
name: 'Jean Dupont',
|
|
703
707
|
age: 32,
|
|
@@ -724,17 +728,18 @@ export const FilterByNumber: Story = {
|
|
|
724
728
|
salary: 58000,
|
|
725
729
|
},
|
|
726
730
|
],
|
|
727
|
-
caption: '',
|
|
728
|
-
options: {
|
|
731
|
+
'caption': '',
|
|
732
|
+
'options': {
|
|
729
733
|
itemsPerPage: 5,
|
|
730
734
|
filters: [],
|
|
731
735
|
},
|
|
732
|
-
showFilters: true,
|
|
733
|
-
suffix: 'filter-number-table',
|
|
734
|
-
density: 'default',
|
|
735
|
-
striped: false,
|
|
736
|
+
'showFilters': true,
|
|
737
|
+
'suffix': 'filter-number-table',
|
|
738
|
+
'density': 'default',
|
|
739
|
+
'striped': false,
|
|
740
|
+
'onUpdate:options': fn(),
|
|
736
741
|
},
|
|
737
|
-
render(args) {
|
|
742
|
+
render: (args) => {
|
|
738
743
|
return {
|
|
739
744
|
components: { SyTable },
|
|
740
745
|
setup() {
|
|
@@ -750,15 +755,9 @@ export const FilterByNumber: Story = {
|
|
|
750
755
|
},
|
|
751
756
|
template: `
|
|
752
757
|
<SyTable
|
|
753
|
-
v-model:options="options"
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
:caption="args.caption"
|
|
757
|
-
:show-filters="args.showFilters"
|
|
758
|
-
:suffix="args.suffix"
|
|
759
|
-
:density="args.density"
|
|
760
|
-
:striped="args.striped"
|
|
761
|
-
:resizable-columns="args.resizableColumns"
|
|
758
|
+
v-model:options="args.options"
|
|
759
|
+
v-bind="args"
|
|
760
|
+
suffix="filter-number-table"
|
|
762
761
|
/>
|
|
763
762
|
`,
|
|
764
763
|
}
|
|
@@ -861,7 +860,7 @@ export const FilterBySelect: Story = {
|
|
|
861
860
|
],
|
|
862
861
|
},
|
|
863
862
|
args: {
|
|
864
|
-
headers: [
|
|
863
|
+
'headers': [
|
|
865
864
|
{
|
|
866
865
|
title: 'Nom',
|
|
867
866
|
key: 'name',
|
|
@@ -894,7 +893,7 @@ export const FilterBySelect: Story = {
|
|
|
894
893
|
],
|
|
895
894
|
},
|
|
896
895
|
],
|
|
897
|
-
items: [
|
|
896
|
+
'items': [
|
|
898
897
|
{
|
|
899
898
|
name: 'Jean Dupont',
|
|
900
899
|
department: 'RH',
|
|
@@ -921,17 +920,18 @@ export const FilterBySelect: Story = {
|
|
|
921
920
|
status: 'Inactif',
|
|
922
921
|
},
|
|
923
922
|
],
|
|
924
|
-
caption: '',
|
|
925
|
-
options: {
|
|
923
|
+
'caption': '',
|
|
924
|
+
'options': {
|
|
926
925
|
itemsPerPage: 5,
|
|
927
926
|
filters: [],
|
|
928
927
|
},
|
|
929
|
-
showFilters: true,
|
|
930
|
-
suffix: 'filter-select-table',
|
|
931
|
-
density: 'default',
|
|
932
|
-
striped: false,
|
|
928
|
+
'showFilters': true,
|
|
929
|
+
'suffix': 'filter-select-table',
|
|
930
|
+
'density': 'default',
|
|
931
|
+
'striped': false,
|
|
932
|
+
'onUpdate:options': fn(),
|
|
933
933
|
},
|
|
934
|
-
render(args) {
|
|
934
|
+
render: (args) => {
|
|
935
935
|
return {
|
|
936
936
|
components: { SyTable },
|
|
937
937
|
setup() {
|
|
@@ -947,22 +947,16 @@ export const FilterBySelect: Story = {
|
|
|
947
947
|
},
|
|
948
948
|
template: `
|
|
949
949
|
<SyTable
|
|
950
|
-
v-model:options="options"
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
:caption="args.caption"
|
|
954
|
-
:show-filters="args.showFilters"
|
|
955
|
-
:suffix="args.suffix"
|
|
956
|
-
:density="args.density"
|
|
957
|
-
:striped="args.striped"
|
|
958
|
-
:resizable-columns="args.resizableColumns"
|
|
950
|
+
v-model:options="args.options"
|
|
951
|
+
v-bind="args"
|
|
952
|
+
suffix="filter-select-table"
|
|
959
953
|
/>
|
|
960
954
|
`,
|
|
961
955
|
}
|
|
962
956
|
},
|
|
963
957
|
}
|
|
964
958
|
|
|
965
|
-
export const
|
|
959
|
+
export const FilterBySelectMultiple: Story = {
|
|
966
960
|
parameters: {
|
|
967
961
|
sourceCode: [
|
|
968
962
|
{
|
|
@@ -973,8 +967,8 @@ export const FilterByDate: Story = {
|
|
|
973
967
|
v-model:options="options"
|
|
974
968
|
:headers="headers"
|
|
975
969
|
:items="items"
|
|
976
|
-
|
|
977
|
-
suffix="filter-
|
|
970
|
+
show-filters
|
|
971
|
+
suffix="filter-select-table"
|
|
978
972
|
/>
|
|
979
973
|
</template>
|
|
980
974
|
`,
|
|
@@ -985,11 +979,10 @@ export const FilterByDate: Story = {
|
|
|
985
979
|
<script setup lang="ts">
|
|
986
980
|
import { ref } from 'vue'
|
|
987
981
|
import { SyTable } from '@cnamts/synapse'
|
|
988
|
-
import dayjs from 'dayjs';
|
|
989
982
|
|
|
990
983
|
const options = ref({
|
|
991
984
|
itemsPerPage: 5,
|
|
992
|
-
filters: []
|
|
985
|
+
filters: []
|
|
993
986
|
})
|
|
994
987
|
|
|
995
988
|
const headers = ref([
|
|
@@ -997,64 +990,64 @@ export const FilterByDate: Story = {
|
|
|
997
990
|
title: 'Nom',
|
|
998
991
|
key: 'name',
|
|
999
992
|
filterable: true,
|
|
1000
|
-
filterType: 'text'
|
|
993
|
+
filterType: 'text'
|
|
1001
994
|
},
|
|
1002
995
|
{
|
|
1003
|
-
title: '
|
|
1004
|
-
key: '
|
|
996
|
+
title: 'Département',
|
|
997
|
+
key: 'department',
|
|
1005
998
|
filterable: true,
|
|
1006
|
-
filterType: '
|
|
1007
|
-
|
|
999
|
+
filterType: 'select',
|
|
1000
|
+
multiple: true,
|
|
1001
|
+
chips: true,
|
|
1002
|
+
hideMessages: true,
|
|
1003
|
+
filterOptions: [
|
|
1004
|
+
{ text: 'RH', value: 'RH' },
|
|
1005
|
+
{ text: 'IT', value: 'IT' },
|
|
1006
|
+
{ text: 'Finance', value: 'Finance' },
|
|
1007
|
+
{ text: 'Marketing', value: 'Marketing' },
|
|
1008
|
+
]
|
|
1008
1009
|
},
|
|
1009
1010
|
{
|
|
1010
|
-
title: '
|
|
1011
|
-
key: '
|
|
1011
|
+
title: 'Statut',
|
|
1012
|
+
key: 'status',
|
|
1012
1013
|
filterable: true,
|
|
1013
|
-
|
|
1014
|
-
|
|
1014
|
+
multiple: true,
|
|
1015
|
+
chips: true,
|
|
1016
|
+
filterType: 'select',
|
|
1017
|
+
hideMessages: true,
|
|
1018
|
+
filterOptions: [
|
|
1019
|
+
{ text: 'Actif', value: 'Actif' },
|
|
1020
|
+
{ text: 'En congé', value: 'En congé' },
|
|
1021
|
+
{ text: 'Inactif', value: 'Inactif' },
|
|
1022
|
+
]
|
|
1015
1023
|
},
|
|
1016
1024
|
])
|
|
1017
|
-
|
|
1025
|
+
|
|
1018
1026
|
const items = ref([
|
|
1019
1027
|
{
|
|
1020
1028
|
name: 'Jean Dupont',
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
from: dayjs('2023-07-01').format('DD/MM/YYYY'),
|
|
1024
|
-
to: dayjs('2023-07-15').format('DD/MM/YYYY')
|
|
1025
|
-
},
|
|
1029
|
+
department: 'RH',
|
|
1030
|
+
status: 'Actif',
|
|
1026
1031
|
},
|
|
1027
1032
|
{
|
|
1028
1033
|
name: 'Marie Martin',
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
from: dayjs('2023-08-01').format('DD/MM/YYYY'),
|
|
1032
|
-
to: dayjs('2023-08-20').format('DD/MM/YYYY'),
|
|
1033
|
-
},
|
|
1034
|
+
department: 'IT',
|
|
1035
|
+
status: 'En congé',
|
|
1034
1036
|
},
|
|
1035
1037
|
{
|
|
1036
|
-
name: 'Pierre
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
from: dayjs('2025-06-15').format('DD/MM/YYYY'),
|
|
1040
|
-
to: dayjs('2025-07-05').format('DD/MM/YYYY'),
|
|
1041
|
-
},
|
|
1038
|
+
name: 'Pierre Durand',
|
|
1039
|
+
department: 'Finance',
|
|
1040
|
+
status: 'Actif',
|
|
1042
1041
|
},
|
|
1043
1042
|
{
|
|
1044
|
-
name: 'Sophie
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
from: dayjs('2025-12-20').format('DD/MM/YYYY'),
|
|
1048
|
-
to: dayjs('2025-01-05').format('DD/MM/YYYY'),
|
|
1049
|
-
},
|
|
1043
|
+
name: 'Sophie Petit',
|
|
1044
|
+
department: 'Marketing',
|
|
1045
|
+
status: 'Actif',
|
|
1050
1046
|
},
|
|
1051
1047
|
{
|
|
1052
1048
|
name: 'Thomas Leroy',
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
from: dayjs('2025-09-10').format('DD/MM/YYYY'),
|
|
1056
|
-
to: dayjs('2025-09-25').format('DD/MM/YYYY'),
|
|
1057
|
-
},
|
|
1049
|
+
department: 'IT',
|
|
1050
|
+
status: 'Inactif',
|
|
1058
1051
|
},
|
|
1059
1052
|
])
|
|
1060
1053
|
</script>
|
|
@@ -1063,7 +1056,7 @@ export const FilterByDate: Story = {
|
|
|
1063
1056
|
],
|
|
1064
1057
|
},
|
|
1065
1058
|
args: {
|
|
1066
|
-
headers: [
|
|
1059
|
+
'headers': [
|
|
1067
1060
|
{
|
|
1068
1061
|
title: 'Nom',
|
|
1069
1062
|
key: 'name',
|
|
@@ -1071,73 +1064,74 @@ export const FilterByDate: Story = {
|
|
|
1071
1064
|
filterType: 'text',
|
|
1072
1065
|
},
|
|
1073
1066
|
{
|
|
1074
|
-
title: '
|
|
1075
|
-
key: '
|
|
1067
|
+
title: 'Département',
|
|
1068
|
+
key: 'department',
|
|
1076
1069
|
filterable: true,
|
|
1077
|
-
filterType: '
|
|
1078
|
-
|
|
1070
|
+
filterType: 'select',
|
|
1071
|
+
multiple: true,
|
|
1072
|
+
chips: true,
|
|
1073
|
+
hideMessages: true,
|
|
1074
|
+
filterOptions: [
|
|
1075
|
+
{ text: 'RH', value: 'RH' },
|
|
1076
|
+
{ text: 'IT', value: 'IT' },
|
|
1077
|
+
{ text: 'Finance', value: 'Finance' },
|
|
1078
|
+
{ text: 'Marketing', value: 'Marketing' },
|
|
1079
|
+
],
|
|
1079
1080
|
},
|
|
1080
1081
|
{
|
|
1081
|
-
title: '
|
|
1082
|
-
key: '
|
|
1082
|
+
title: 'Statut',
|
|
1083
|
+
key: 'status',
|
|
1083
1084
|
filterable: true,
|
|
1084
|
-
filterType: '
|
|
1085
|
-
|
|
1085
|
+
filterType: 'select',
|
|
1086
|
+
multiple: true,
|
|
1087
|
+
chips: true,
|
|
1088
|
+
hideMessages: true,
|
|
1089
|
+
filterOptions: [
|
|
1090
|
+
{ text: 'Actif', value: 'Actif' },
|
|
1091
|
+
{ text: 'En congé', value: 'En congé' },
|
|
1092
|
+
{ text: 'Inactif', value: 'Inactif' },
|
|
1093
|
+
],
|
|
1086
1094
|
},
|
|
1087
1095
|
],
|
|
1088
|
-
items: [
|
|
1096
|
+
'items': [
|
|
1089
1097
|
{
|
|
1090
1098
|
name: 'Jean Dupont',
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
from: dayjs('2025-07-01').format('DD/MM/YYYY'),
|
|
1094
|
-
to: dayjs('2025-07-15').format('DD/MM/YYYY'),
|
|
1095
|
-
},
|
|
1099
|
+
department: 'RH',
|
|
1100
|
+
status: 'Actif',
|
|
1096
1101
|
},
|
|
1097
1102
|
{
|
|
1098
1103
|
name: 'Marie Martin',
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
from: dayjs('2025-08-01').format('DD/MM/YYYY'),
|
|
1102
|
-
to: dayjs('2025-08-20').format('DD/MM/YYYY'),
|
|
1103
|
-
},
|
|
1104
|
+
department: 'IT',
|
|
1105
|
+
status: 'En congé',
|
|
1104
1106
|
},
|
|
1105
1107
|
{
|
|
1106
1108
|
name: 'Pierre Durand',
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
from: dayjs('2025-06-15').format('DD/MM/YYYY'),
|
|
1110
|
-
to: dayjs('2025-07-05').format('DD/MM/YYYY'),
|
|
1111
|
-
},
|
|
1109
|
+
department: 'Finance',
|
|
1110
|
+
status: 'Actif',
|
|
1112
1111
|
},
|
|
1113
1112
|
{
|
|
1114
1113
|
name: 'Sophie Petit',
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
from: dayjs('2025-12-20').format('DD/MM/YYYY'),
|
|
1118
|
-
to: dayjs('2025-01-05').format('DD/MM/YYYY'),
|
|
1119
|
-
},
|
|
1114
|
+
department: 'Marketing',
|
|
1115
|
+
status: 'Actif',
|
|
1120
1116
|
},
|
|
1121
1117
|
{
|
|
1122
1118
|
name: 'Thomas Leroy',
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
from: dayjs('2025-09-10').format('DD/MM/YYYY'),
|
|
1126
|
-
to: dayjs('2025-09-25').format('DD/MM/YYYY'),
|
|
1127
|
-
},
|
|
1119
|
+
department: 'IT',
|
|
1120
|
+
status: 'Inactif',
|
|
1128
1121
|
},
|
|
1129
1122
|
],
|
|
1130
|
-
caption: '',
|
|
1131
|
-
options: {
|
|
1123
|
+
'caption': '',
|
|
1124
|
+
'options': {
|
|
1132
1125
|
itemsPerPage: 5,
|
|
1133
1126
|
filters: [],
|
|
1134
1127
|
},
|
|
1135
|
-
showFilters: true,
|
|
1136
|
-
suffix: 'filter-
|
|
1137
|
-
density: 'default',
|
|
1138
|
-
striped: false,
|
|
1128
|
+
'showFilters': true,
|
|
1129
|
+
'suffix': 'filter-select-table',
|
|
1130
|
+
'density': 'default',
|
|
1131
|
+
'striped': false,
|
|
1132
|
+
'onUpdate:options': fn(),
|
|
1139
1133
|
},
|
|
1140
|
-
render(args) {
|
|
1134
|
+
render: (args) => {
|
|
1141
1135
|
return {
|
|
1142
1136
|
components: { SyTable },
|
|
1143
1137
|
setup() {
|
|
@@ -1153,22 +1147,16 @@ export const FilterByDate: Story = {
|
|
|
1153
1147
|
},
|
|
1154
1148
|
template: `
|
|
1155
1149
|
<SyTable
|
|
1156
|
-
v-model:options="options"
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
:caption="args.caption"
|
|
1160
|
-
:show-filters="args.showFilters"
|
|
1161
|
-
:suffix="args.suffix"
|
|
1162
|
-
:density="args.density"
|
|
1163
|
-
:striped="args.striped"
|
|
1164
|
-
:resizable-columns="args.resizableColumns"
|
|
1150
|
+
v-model:options="args.options"
|
|
1151
|
+
v-bind="args"
|
|
1152
|
+
suffix="filter-select-table"
|
|
1165
1153
|
/>
|
|
1166
1154
|
`,
|
|
1167
1155
|
}
|
|
1168
1156
|
},
|
|
1169
1157
|
}
|
|
1170
1158
|
|
|
1171
|
-
export const
|
|
1159
|
+
export const FilterByExactDate: Story = {
|
|
1172
1160
|
parameters: {
|
|
1173
1161
|
sourceCode: [
|
|
1174
1162
|
{
|
|
@@ -1179,38 +1167,9 @@ export const CustomFilterSlot: Story = {
|
|
|
1179
1167
|
v-model:options="options"
|
|
1180
1168
|
:headers="headers"
|
|
1181
1169
|
:items="items"
|
|
1182
|
-
show-filters
|
|
1183
|
-
suffix="
|
|
1184
|
-
|
|
1185
|
-
<template #filter.custom="{ header, value, updateFilter }">
|
|
1186
|
-
<div class="custom-filter-container">
|
|
1187
|
-
<div class="custom-filter-info mb-2">
|
|
1188
|
-
Filtre personnalisé :
|
|
1189
|
-
</div>
|
|
1190
|
-
<v-select
|
|
1191
|
-
v-model="customFilterValue"
|
|
1192
|
-
:items="statusOptions"
|
|
1193
|
-
label="Statut"
|
|
1194
|
-
variant="outlined"
|
|
1195
|
-
density="compact"
|
|
1196
|
-
color="primary"
|
|
1197
|
-
bg-color="white"
|
|
1198
|
-
@update:model-value="(val) => {
|
|
1199
|
-
// Créer manuellement un filtre de sélection
|
|
1200
|
-
const currentFilters = [...options.filters || []]
|
|
1201
|
-
// Supprimer le filtre existant pour cette clé si nécessaire
|
|
1202
|
-
const filteredFilters = currentFilters.filter(f => f.key !== 'status')
|
|
1203
|
-
// Ajouter un nouveau filtre si la valeur n'est pas vide
|
|
1204
|
-
if (val) {
|
|
1205
|
-
filteredFilters.push({ key: 'status', value: val, type: 'select' })
|
|
1206
|
-
}
|
|
1207
|
-
// Mettre à jour les options avec les nouveaux filtres
|
|
1208
|
-
options.filters = filteredFilters
|
|
1209
|
-
}"
|
|
1210
|
-
/>
|
|
1211
|
-
</div>
|
|
1212
|
-
</template>
|
|
1213
|
-
</SyTable>
|
|
1170
|
+
:show-filters="true"
|
|
1171
|
+
suffix="filter-date-table"
|
|
1172
|
+
/>
|
|
1214
1173
|
</template>
|
|
1215
1174
|
`,
|
|
1216
1175
|
},
|
|
@@ -1220,219 +1179,1099 @@ export const CustomFilterSlot: Story = {
|
|
|
1220
1179
|
<script setup lang="ts">
|
|
1221
1180
|
import { ref } from 'vue'
|
|
1222
1181
|
import { SyTable } from '@cnamts/synapse'
|
|
1182
|
+
import dayjs from 'dayjs';
|
|
1223
1183
|
|
|
1224
1184
|
const options = ref({
|
|
1225
|
-
itemsPerPage:
|
|
1226
|
-
filters: []
|
|
1185
|
+
itemsPerPage: 5,
|
|
1186
|
+
filters: [],
|
|
1227
1187
|
})
|
|
1228
1188
|
|
|
1229
|
-
const customFilterValue = ref('')
|
|
1230
|
-
const statusOptions = ['Actif', 'Inactif', 'En attente']
|
|
1231
|
-
|
|
1232
1189
|
const headers = ref([
|
|
1233
1190
|
{
|
|
1234
1191
|
title: 'Nom',
|
|
1235
|
-
key: '
|
|
1236
|
-
filterable: true,
|
|
1237
|
-
filterType: 'text'
|
|
1238
|
-
},
|
|
1239
|
-
{
|
|
1240
|
-
title: 'Prénom',
|
|
1241
|
-
key: 'firstname',
|
|
1192
|
+
key: 'name',
|
|
1242
1193
|
filterable: true,
|
|
1243
|
-
filterType: 'text'
|
|
1194
|
+
filterType: 'text',
|
|
1244
1195
|
},
|
|
1245
1196
|
{
|
|
1246
|
-
title: '
|
|
1247
|
-
key: '
|
|
1197
|
+
title: 'Date d'embauche',
|
|
1198
|
+
key: 'hireDate',
|
|
1248
1199
|
filterable: true,
|
|
1249
|
-
filterType: '
|
|
1200
|
+
filterType: 'date',
|
|
1201
|
+
dateFormat: 'DD/MM/YYYY',
|
|
1250
1202
|
},
|
|
1251
1203
|
])
|
|
1252
|
-
|
|
1204
|
+
|
|
1253
1205
|
const items = ref([
|
|
1254
1206
|
{
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
status: 'Actif',
|
|
1207
|
+
name: 'Jean Dupont',
|
|
1208
|
+
hireDate: dayjs('2020-05-15').format('DD/MM/YYYY'),
|
|
1258
1209
|
},
|
|
1259
1210
|
{
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
status: 'Inactif',
|
|
1211
|
+
name: 'Marie Martin',
|
|
1212
|
+
hireDate: dayjs('2019-03-10').format('DD/MM/YYYY'),
|
|
1263
1213
|
},
|
|
1264
1214
|
{
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
status: 'En attente',
|
|
1215
|
+
name: 'Pierre Dupont',
|
|
1216
|
+
hireDate: dayjs('2025-11-22').format('DD/MM/YYYY'),
|
|
1268
1217
|
},
|
|
1269
1218
|
{
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
|
|
1219
|
+
name: 'Sophie Garnier',
|
|
1220
|
+
hireDate: dayjs('2025-01-08').format('DD/MM/YYYY'),
|
|
1221
|
+
},
|
|
1222
|
+
{
|
|
1223
|
+
name: 'Thomas Leroy',
|
|
1224
|
+
hireDate: dayjs('2025-07-30').format('DD/MM/YYYY'),
|
|
1225
|
+
},
|
|
1226
|
+
])
|
|
1227
|
+
</script>
|
|
1228
|
+
`,
|
|
1229
|
+
},
|
|
1230
|
+
],
|
|
1231
|
+
},
|
|
1232
|
+
args: {
|
|
1233
|
+
'headers': [
|
|
1234
|
+
{
|
|
1235
|
+
title: 'Nom',
|
|
1236
|
+
key: 'name',
|
|
1237
|
+
filterable: true,
|
|
1238
|
+
filterType: 'text',
|
|
1239
|
+
},
|
|
1240
|
+
{
|
|
1241
|
+
title: 'Date d\'embauche',
|
|
1242
|
+
key: 'hireDate',
|
|
1243
|
+
filterable: true,
|
|
1244
|
+
filterType: 'date',
|
|
1245
|
+
dateFormat: 'DD/MM/YYYY',
|
|
1246
|
+
},
|
|
1247
|
+
],
|
|
1248
|
+
'items': [
|
|
1249
|
+
{
|
|
1250
|
+
name: 'Jean Dupont',
|
|
1251
|
+
hireDate: dayjs('2025-05-15').format('DD/MM/YYYY'),
|
|
1252
|
+
},
|
|
1253
|
+
{
|
|
1254
|
+
name: 'Marie Martin',
|
|
1255
|
+
hireDate: dayjs('2025-03-10').format('DD/MM/YYYY'),
|
|
1256
|
+
},
|
|
1257
|
+
{
|
|
1258
|
+
name: 'Pierre Durand',
|
|
1259
|
+
hireDate: dayjs('2025-11-22').format('DD/MM/YYYY'),
|
|
1260
|
+
},
|
|
1261
|
+
{
|
|
1262
|
+
name: 'Sophie Petit',
|
|
1263
|
+
hireDate: dayjs('2025-01-08').format('DD/MM/YYYY'),
|
|
1264
|
+
},
|
|
1265
|
+
{
|
|
1266
|
+
name: 'Thomas Leroy',
|
|
1267
|
+
hireDate: dayjs('2025-07-30').format('DD/MM/YYYY'),
|
|
1268
|
+
},
|
|
1269
|
+
],
|
|
1270
|
+
'caption': '',
|
|
1271
|
+
'options': {
|
|
1272
|
+
itemsPerPage: 5,
|
|
1273
|
+
filters: [],
|
|
1274
|
+
},
|
|
1275
|
+
'showFilters': true,
|
|
1276
|
+
'suffix': 'filter-date-table',
|
|
1277
|
+
'density': 'default',
|
|
1278
|
+
'striped': false,
|
|
1279
|
+
'onUpdate:options': fn(),
|
|
1280
|
+
},
|
|
1281
|
+
render: (args) => {
|
|
1282
|
+
return {
|
|
1283
|
+
components: { SyTable },
|
|
1284
|
+
setup() {
|
|
1285
|
+
// Create reactive references
|
|
1286
|
+
const options = ref(args.options)
|
|
1287
|
+
const items = ref(args.items)
|
|
1288
|
+
|
|
1289
|
+
return {
|
|
1290
|
+
args,
|
|
1291
|
+
options,
|
|
1292
|
+
items,
|
|
1293
|
+
}
|
|
1294
|
+
},
|
|
1295
|
+
template: `
|
|
1296
|
+
<SyTable
|
|
1297
|
+
v-model:options="args.options"
|
|
1298
|
+
v-bind="args"
|
|
1299
|
+
suffix="filter-date-table"
|
|
1300
|
+
/>
|
|
1301
|
+
`,
|
|
1302
|
+
}
|
|
1303
|
+
},
|
|
1304
|
+
}
|
|
1305
|
+
|
|
1306
|
+
export const FilterByPeriod: Story = {
|
|
1307
|
+
parameters: {
|
|
1308
|
+
sourceCode: [
|
|
1309
|
+
{
|
|
1310
|
+
name: 'Template',
|
|
1311
|
+
code: `
|
|
1312
|
+
<template>
|
|
1313
|
+
<SyTable
|
|
1314
|
+
v-model:options="options"
|
|
1315
|
+
:headers="headers"
|
|
1316
|
+
:items="items"
|
|
1317
|
+
:show-filters="true"
|
|
1318
|
+
suffix="filter-date-table"
|
|
1319
|
+
/>
|
|
1320
|
+
</template>
|
|
1321
|
+
`,
|
|
1322
|
+
},
|
|
1323
|
+
{
|
|
1324
|
+
name: 'Script',
|
|
1325
|
+
code: `
|
|
1326
|
+
<script setup lang="ts">
|
|
1327
|
+
import { ref } from 'vue'
|
|
1328
|
+
import { SyTable } from '@cnamts/synapse'
|
|
1329
|
+
import dayjs from 'dayjs';
|
|
1330
|
+
|
|
1331
|
+
const options = ref({
|
|
1332
|
+
itemsPerPage: 5,
|
|
1333
|
+
filters: [],
|
|
1334
|
+
})
|
|
1335
|
+
|
|
1336
|
+
const headers = ref([
|
|
1337
|
+
{
|
|
1338
|
+
title: 'Nom',
|
|
1339
|
+
key: 'name',
|
|
1340
|
+
filterable: true,
|
|
1341
|
+
filterType: 'text',
|
|
1342
|
+
},
|
|
1343
|
+
{
|
|
1344
|
+
title: 'Date d'embauche',
|
|
1345
|
+
key: 'hireDate',
|
|
1346
|
+
filterable: true,
|
|
1347
|
+
filterType: 'period',
|
|
1348
|
+
dateFormat: 'DD/MM/YYYY',
|
|
1349
|
+
},
|
|
1350
|
+
])
|
|
1351
|
+
|
|
1352
|
+
const items = ref([
|
|
1353
|
+
{
|
|
1354
|
+
name: 'Jean Dupont',
|
|
1355
|
+
hireDate: dayjs('2020-05-15').format('DD/MM/YYYY'),
|
|
1356
|
+
},
|
|
1357
|
+
{
|
|
1358
|
+
name: 'Marie Martin',
|
|
1359
|
+
hireDate: dayjs('2019-03-10').format('DD/MM/YYYY'),
|
|
1360
|
+
},
|
|
1361
|
+
{
|
|
1362
|
+
name: 'Pierre Dupont',
|
|
1363
|
+
hireDate: dayjs('2025-11-22').format('DD/MM/YYYY'),
|
|
1364
|
+
},
|
|
1365
|
+
{
|
|
1366
|
+
name: 'Sophie Garnier',
|
|
1367
|
+
hireDate: dayjs('2025-01-08').format('DD/MM/YYYY'),
|
|
1368
|
+
},
|
|
1369
|
+
{
|
|
1370
|
+
name: 'Thomas Leroy',
|
|
1371
|
+
hireDate: dayjs('2025-07-30').format('DD/MM/YYYY'),
|
|
1372
|
+
},
|
|
1373
|
+
])
|
|
1374
|
+
</script>
|
|
1375
|
+
`,
|
|
1376
|
+
},
|
|
1377
|
+
],
|
|
1378
|
+
},
|
|
1379
|
+
args: {
|
|
1380
|
+
'headers': [
|
|
1381
|
+
{
|
|
1382
|
+
title: 'Nom',
|
|
1383
|
+
key: 'name',
|
|
1384
|
+
filterable: true,
|
|
1385
|
+
filterType: 'text',
|
|
1386
|
+
},
|
|
1387
|
+
{
|
|
1388
|
+
title: 'Date d\'embauche',
|
|
1389
|
+
key: 'hireDate',
|
|
1390
|
+
filterable: true,
|
|
1391
|
+
filterType: 'period',
|
|
1392
|
+
dateFormat: 'DD/MM/YYYY',
|
|
1393
|
+
},
|
|
1394
|
+
],
|
|
1395
|
+
'items': [
|
|
1396
|
+
{
|
|
1397
|
+
name: 'Jean Dupont',
|
|
1398
|
+
hireDate: dayjs('2025-05-15').format('DD/MM/YYYY'),
|
|
1399
|
+
},
|
|
1400
|
+
{
|
|
1401
|
+
name: 'Marie Martin',
|
|
1402
|
+
hireDate: dayjs('2025-03-10').format('DD/MM/YYYY'),
|
|
1403
|
+
},
|
|
1404
|
+
{
|
|
1405
|
+
name: 'Pierre Durand',
|
|
1406
|
+
hireDate: dayjs('2025-11-22').format('DD/MM/YYYY'),
|
|
1407
|
+
},
|
|
1408
|
+
{
|
|
1409
|
+
name: 'Sophie Petit',
|
|
1410
|
+
hireDate: dayjs('2025-01-08').format('DD/MM/YYYY'),
|
|
1411
|
+
},
|
|
1412
|
+
{
|
|
1413
|
+
name: 'Thomas Leroy',
|
|
1414
|
+
hireDate: dayjs('2025-07-30').format('DD/MM/YYYY'),
|
|
1415
|
+
},
|
|
1416
|
+
],
|
|
1417
|
+
'caption': '',
|
|
1418
|
+
'options': {
|
|
1419
|
+
itemsPerPage: 5,
|
|
1420
|
+
filters: [],
|
|
1421
|
+
},
|
|
1422
|
+
'showFilters': true,
|
|
1423
|
+
'suffix': 'filter-date-table',
|
|
1424
|
+
'density': 'default',
|
|
1425
|
+
'striped': false,
|
|
1426
|
+
'onUpdate:options': fn(),
|
|
1427
|
+
},
|
|
1428
|
+
render: (args) => {
|
|
1429
|
+
return {
|
|
1430
|
+
components: { SyTable },
|
|
1431
|
+
setup() {
|
|
1432
|
+
// Create reactive references
|
|
1433
|
+
const options = ref(args.options)
|
|
1434
|
+
const items = ref(args.items)
|
|
1435
|
+
|
|
1436
|
+
return {
|
|
1437
|
+
args,
|
|
1438
|
+
options,
|
|
1439
|
+
items,
|
|
1440
|
+
}
|
|
1441
|
+
},
|
|
1442
|
+
template: `
|
|
1443
|
+
<SyTable
|
|
1444
|
+
v-model:options="args.options"
|
|
1445
|
+
v-bind="args"
|
|
1446
|
+
suffix="filter-date-table"
|
|
1447
|
+
/>
|
|
1448
|
+
`,
|
|
1449
|
+
}
|
|
1450
|
+
},
|
|
1451
|
+
}
|
|
1452
|
+
|
|
1453
|
+
export const CustomFilterSlot: Story = {
|
|
1454
|
+
parameters: {
|
|
1455
|
+
docs: {
|
|
1456
|
+
description: {
|
|
1457
|
+
story: 'Cette story démontre comment utiliser un slot personnalisé pour le filtrage. Le filtre personnalisé utilise un v-select pour filtrer par statut.',
|
|
1458
|
+
},
|
|
1459
|
+
},
|
|
1460
|
+
sourceCode: [
|
|
1461
|
+
{
|
|
1462
|
+
name: 'Template',
|
|
1463
|
+
code: `
|
|
1464
|
+
<template>
|
|
1465
|
+
<SyTable
|
|
1466
|
+
v-model:options="options"
|
|
1467
|
+
:headers="headers"
|
|
1468
|
+
:items="items"
|
|
1469
|
+
show-filters
|
|
1470
|
+
suffix="custom-filter-slot-table"
|
|
1471
|
+
>
|
|
1472
|
+
<template #filter.custom="{ header, updateFilter }">
|
|
1473
|
+
<div class="custom-filter-container">
|
|
1474
|
+
<div class="custom-filter-info mb-2">
|
|
1475
|
+
Filtre personnalisé :
|
|
1476
|
+
</div>
|
|
1477
|
+
<v-select
|
|
1478
|
+
v-model="customFilterValue"
|
|
1479
|
+
:items="statusOptions"
|
|
1480
|
+
label="Statut"
|
|
1481
|
+
variant="outlined"
|
|
1482
|
+
density="compact"
|
|
1483
|
+
color="primary"
|
|
1484
|
+
bg-color="white"
|
|
1485
|
+
@update:model-value="(val) => {
|
|
1486
|
+
// Use updateFilter provided by the slot props
|
|
1487
|
+
updateFilter(val);
|
|
1488
|
+
// Also update our local state
|
|
1489
|
+
handleFilterChange(val);
|
|
1490
|
+
}"
|
|
1491
|
+
/>
|
|
1492
|
+
</div>
|
|
1493
|
+
</template>
|
|
1494
|
+
</SyTable>
|
|
1495
|
+
</template>
|
|
1496
|
+
`,
|
|
1497
|
+
},
|
|
1498
|
+
{
|
|
1499
|
+
name: 'Script',
|
|
1500
|
+
code: `
|
|
1501
|
+
<script setup lang="ts">
|
|
1502
|
+
import { ref } from 'vue'
|
|
1503
|
+
import { SyTable } from '@cnamts/synapse'
|
|
1504
|
+
|
|
1505
|
+
const options = ref({
|
|
1506
|
+
page: 1,
|
|
1507
|
+
itemsPerPage: 4,
|
|
1508
|
+
filters: []
|
|
1509
|
+
})
|
|
1510
|
+
|
|
1511
|
+
const customFilterValue = ref('')
|
|
1512
|
+
const statusOptions = ['Actif', 'Inactif', 'En attente']
|
|
1513
|
+
|
|
1514
|
+
// Function to update the filter when the select value changes
|
|
1515
|
+
function handleFilterChange(val) {
|
|
1516
|
+
// Create a new filters array
|
|
1517
|
+
const newFilters = options.value.filters.filter(f => f.key !== 'status')
|
|
1518
|
+
|
|
1519
|
+
// Add the new filter if a value is selected
|
|
1520
|
+
if (val) {
|
|
1521
|
+
newFilters.push({
|
|
1522
|
+
key: 'status',
|
|
1523
|
+
value: val,
|
|
1524
|
+
type: 'select' // Use 'select' type for compatibility with filtering logic
|
|
1525
|
+
})
|
|
1526
|
+
}
|
|
1527
|
+
|
|
1528
|
+
// Update the options with the new filters
|
|
1529
|
+
options.value = {
|
|
1530
|
+
...options.value,
|
|
1531
|
+
filters: newFilters
|
|
1532
|
+
}
|
|
1533
|
+
}
|
|
1534
|
+
|
|
1535
|
+
const headers = ref([
|
|
1536
|
+
{
|
|
1537
|
+
title: 'Nom',
|
|
1538
|
+
key: 'lastname',
|
|
1539
|
+
filterable: true,
|
|
1540
|
+
filterType: 'text'
|
|
1541
|
+
},
|
|
1542
|
+
{
|
|
1543
|
+
title: 'Prénom',
|
|
1544
|
+
key: 'firstname',
|
|
1545
|
+
filterable: true,
|
|
1546
|
+
filterType: 'text'
|
|
1547
|
+
},
|
|
1548
|
+
{
|
|
1549
|
+
title: 'Statut',
|
|
1550
|
+
key: 'status',
|
|
1551
|
+
filterable: true,
|
|
1552
|
+
filterType: 'custom' // Utilisation du type 'custom' pour activer le slot personnalisé
|
|
1553
|
+
},
|
|
1554
|
+
])
|
|
1555
|
+
|
|
1556
|
+
const items = ref([
|
|
1557
|
+
{
|
|
1558
|
+
firstname: 'Virginie',
|
|
1559
|
+
lastname: 'Beauchesne',
|
|
1560
|
+
status: 'Actif',
|
|
1561
|
+
},
|
|
1562
|
+
{
|
|
1563
|
+
firstname: 'Simone',
|
|
1564
|
+
lastname: 'Bellefeuille',
|
|
1565
|
+
status: 'Inactif',
|
|
1566
|
+
},
|
|
1567
|
+
{
|
|
1568
|
+
firstname: 'Étienne',
|
|
1569
|
+
lastname: 'Salois',
|
|
1570
|
+
status: 'En attente',
|
|
1571
|
+
},
|
|
1572
|
+
{
|
|
1573
|
+
firstname: 'Thierry',
|
|
1574
|
+
lastname: 'Bobu',
|
|
1575
|
+
status: 'Actif',
|
|
1576
|
+
},
|
|
1577
|
+
{
|
|
1578
|
+
firstname: 'Bernadette',
|
|
1579
|
+
lastname: 'Langelier',
|
|
1580
|
+
status: 'Inactif'
|
|
1581
|
+
},
|
|
1582
|
+
{
|
|
1583
|
+
firstname: 'Agate',
|
|
1584
|
+
lastname: 'Roy',
|
|
1585
|
+
status: 'En attente'
|
|
1586
|
+
}
|
|
1587
|
+
])
|
|
1588
|
+
</script>
|
|
1589
|
+
`,
|
|
1590
|
+
},
|
|
1591
|
+
{
|
|
1592
|
+
name: 'Style',
|
|
1593
|
+
code: `
|
|
1594
|
+
<style scoped>
|
|
1595
|
+
.custom-filter-container {
|
|
1596
|
+
display: flex;
|
|
1597
|
+
flex-direction: column;
|
|
1598
|
+
gap: 4px;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
.custom-filter-info {
|
|
1602
|
+
font-size: 12px;
|
|
1603
|
+
color: #666;
|
|
1604
|
+
margin-top: 4px;
|
|
1605
|
+
}
|
|
1606
|
+
</style>
|
|
1607
|
+
`,
|
|
1608
|
+
},
|
|
1609
|
+
],
|
|
1610
|
+
},
|
|
1611
|
+
args: {
|
|
1612
|
+
'headers': [
|
|
1613
|
+
{
|
|
1614
|
+
title: 'Nom',
|
|
1615
|
+
key: 'lastname',
|
|
1616
|
+
filterable: true,
|
|
1617
|
+
filterType: 'text',
|
|
1618
|
+
},
|
|
1619
|
+
{
|
|
1620
|
+
title: 'Prénom',
|
|
1621
|
+
key: 'firstname',
|
|
1622
|
+
filterable: true,
|
|
1623
|
+
filterType: 'text',
|
|
1624
|
+
},
|
|
1625
|
+
{
|
|
1626
|
+
title: 'Statut',
|
|
1627
|
+
key: 'status',
|
|
1628
|
+
filterable: true,
|
|
1629
|
+
filterType: 'custom',
|
|
1630
|
+
},
|
|
1631
|
+
],
|
|
1632
|
+
'items': [
|
|
1633
|
+
{
|
|
1634
|
+
firstname: 'Virginie',
|
|
1635
|
+
lastname: 'Beauchesne',
|
|
1636
|
+
status: 'Actif',
|
|
1637
|
+
},
|
|
1638
|
+
{
|
|
1639
|
+
firstname: 'Simone',
|
|
1640
|
+
lastname: 'Bellefeuille',
|
|
1641
|
+
status: 'Inactif',
|
|
1642
|
+
},
|
|
1643
|
+
{
|
|
1644
|
+
firstname: 'Étienne',
|
|
1645
|
+
lastname: 'Salois',
|
|
1646
|
+
status: 'En attente',
|
|
1647
|
+
},
|
|
1648
|
+
{
|
|
1649
|
+
firstname: 'Thierry',
|
|
1650
|
+
lastname: 'Bobu',
|
|
1651
|
+
status: 'Actif',
|
|
1652
|
+
},
|
|
1653
|
+
{
|
|
1654
|
+
firstname: 'Bernadette',
|
|
1655
|
+
lastname: 'Langelier',
|
|
1656
|
+
status: 'Inactif',
|
|
1657
|
+
},
|
|
1658
|
+
{
|
|
1659
|
+
firstname: 'Agate',
|
|
1660
|
+
lastname: 'Roy',
|
|
1661
|
+
status: 'En attente',
|
|
1662
|
+
},
|
|
1663
|
+
],
|
|
1664
|
+
'caption': '',
|
|
1665
|
+
'options': {
|
|
1666
|
+
itemsPerPage: 4,
|
|
1667
|
+
filters: [],
|
|
1668
|
+
},
|
|
1669
|
+
'showFilters': true,
|
|
1670
|
+
'suffix': 'custom-filter-slot-table',
|
|
1671
|
+
'density': 'default',
|
|
1672
|
+
'striped': false,
|
|
1673
|
+
'onUpdate:options': fn(),
|
|
1674
|
+
},
|
|
1675
|
+
render: (args) => {
|
|
1676
|
+
return {
|
|
1677
|
+
components: { SyTable },
|
|
1678
|
+
setup() {
|
|
1679
|
+
// Create a fresh copy of the options to avoid reactivity issues
|
|
1680
|
+
const options = ref<DataOptions>({
|
|
1681
|
+
page: 1,
|
|
1682
|
+
itemsPerPage: 4,
|
|
1683
|
+
filters: [] as import('../common/types').FilterOption[],
|
|
1684
|
+
sortBy: [],
|
|
1685
|
+
})
|
|
1686
|
+
|
|
1687
|
+
// Create a reactive reference for the custom filter value
|
|
1688
|
+
const customFilterValue = ref('')
|
|
1689
|
+
const statusOptions = ['Actif', 'Inactif', 'En attente']
|
|
1690
|
+
|
|
1691
|
+
// Function to update the filter when the select value changes
|
|
1692
|
+
function handleFilterChange(val) {
|
|
1693
|
+
// Ensure options.value.filters is initialized
|
|
1694
|
+
if (!options.value.filters) {
|
|
1695
|
+
options.value.filters = []
|
|
1696
|
+
}
|
|
1697
|
+
|
|
1698
|
+
// Create a new filters array with proper typing
|
|
1699
|
+
const currentFilters = options.value.filters as import('../common/types').FilterOption[]
|
|
1700
|
+
const newFilters = [...currentFilters].filter(f => f.key !== 'status')
|
|
1701
|
+
|
|
1702
|
+
// Add the new filter if a value is selected
|
|
1703
|
+
if (val) {
|
|
1704
|
+
newFilters.push({
|
|
1705
|
+
key: 'status',
|
|
1706
|
+
value: val,
|
|
1707
|
+
type: 'select' as FilterType, // Use 'select' type for compatibility with filtering logic
|
|
1708
|
+
})
|
|
1709
|
+
}
|
|
1710
|
+
|
|
1711
|
+
// Update the options with the new filters
|
|
1712
|
+
options.value = {
|
|
1713
|
+
...options.value,
|
|
1714
|
+
filters: newFilters,
|
|
1715
|
+
}
|
|
1716
|
+
}
|
|
1717
|
+
|
|
1718
|
+
return {
|
|
1719
|
+
args,
|
|
1720
|
+
options,
|
|
1721
|
+
customFilterValue,
|
|
1722
|
+
statusOptions,
|
|
1723
|
+
handleFilterChange,
|
|
1724
|
+
}
|
|
1725
|
+
},
|
|
1726
|
+
template: `
|
|
1727
|
+
<SyTable
|
|
1728
|
+
v-model:options="options"
|
|
1729
|
+
:headers="args.headers"
|
|
1730
|
+
:items="args.items"
|
|
1731
|
+
show-filters
|
|
1732
|
+
suffix="custom-filter-slot-table"
|
|
1733
|
+
>
|
|
1734
|
+
<template #filter.custom="{ header, updateFilter }">
|
|
1735
|
+
<div class="custom-filter-container">
|
|
1736
|
+
<div class="custom-filter-info mb-2">
|
|
1737
|
+
Filtre personnalisé :
|
|
1738
|
+
</div>
|
|
1739
|
+
<v-select
|
|
1740
|
+
v-model="customFilterValue"
|
|
1741
|
+
:items="statusOptions"
|
|
1742
|
+
label="Statut"
|
|
1743
|
+
variant="outlined"
|
|
1744
|
+
density="compact"
|
|
1745
|
+
color="primary"
|
|
1746
|
+
bg-color="white"
|
|
1747
|
+
@update:model-value="(val) => {
|
|
1748
|
+
// Use updateFilter provided by the slot props
|
|
1749
|
+
updateFilter(val);
|
|
1750
|
+
// Also update our local state
|
|
1751
|
+
handleFilterChange(val);
|
|
1752
|
+
}"
|
|
1753
|
+
/>
|
|
1754
|
+
</div>
|
|
1755
|
+
</template>
|
|
1756
|
+
</SyTable>
|
|
1757
|
+
`,
|
|
1758
|
+
}
|
|
1759
|
+
},
|
|
1760
|
+
}
|
|
1761
|
+
|
|
1762
|
+
export const CustomFilterInputs: Story = {
|
|
1763
|
+
parameters: {
|
|
1764
|
+
sourceCode: [
|
|
1765
|
+
{
|
|
1766
|
+
name: 'Template',
|
|
1767
|
+
code: `
|
|
1768
|
+
<template>
|
|
1769
|
+
<SyTable
|
|
1770
|
+
v-model:options="options"
|
|
1771
|
+
:headers="headers"
|
|
1772
|
+
:items="items"
|
|
1773
|
+
:filter-input-config="filterInputConfig"
|
|
1774
|
+
show-filters
|
|
1775
|
+
suffix="filter-text-table"
|
|
1776
|
+
/>
|
|
1777
|
+
</template>
|
|
1778
|
+
`,
|
|
1779
|
+
},
|
|
1780
|
+
{
|
|
1781
|
+
name: 'Script',
|
|
1782
|
+
code: `
|
|
1783
|
+
<script setup lang="ts">
|
|
1784
|
+
import { ref } from 'vue'
|
|
1785
|
+
import { SyTable } from '@cnamts/synapse'
|
|
1786
|
+
|
|
1787
|
+
const options = ref({
|
|
1788
|
+
itemsPerPage: 4,
|
|
1789
|
+
filters: []
|
|
1790
|
+
})
|
|
1791
|
+
|
|
1792
|
+
const headers = ref([
|
|
1793
|
+
{
|
|
1794
|
+
title: 'Nom',
|
|
1795
|
+
key: 'lastname',
|
|
1796
|
+
filterable: true,
|
|
1797
|
+
filterType: 'text'
|
|
1798
|
+
},
|
|
1799
|
+
{
|
|
1800
|
+
title: 'Prénom',
|
|
1801
|
+
key: 'firstname',
|
|
1802
|
+
filterable: true,
|
|
1803
|
+
filterType: 'text'
|
|
1804
|
+
},
|
|
1805
|
+
{
|
|
1806
|
+
title: 'Email',
|
|
1807
|
+
value: 'email',
|
|
1808
|
+
filterable: true,
|
|
1809
|
+
filterType: 'text'
|
|
1810
|
+
},
|
|
1811
|
+
])
|
|
1812
|
+
|
|
1813
|
+
const items = ref([
|
|
1814
|
+
{
|
|
1815
|
+
firstname: 'Virginie',
|
|
1816
|
+
lastname: 'Beauchesne',
|
|
1817
|
+
email: 'virginie.beauchesne@example.com',
|
|
1818
|
+
},
|
|
1819
|
+
{
|
|
1820
|
+
firstname: 'Simone',
|
|
1821
|
+
lastname: 'Bellefeuille',
|
|
1822
|
+
email: 'simone.bellefeuille@example.com',
|
|
1823
|
+
},
|
|
1824
|
+
{
|
|
1825
|
+
firstname: 'Étienne',
|
|
1826
|
+
lastname: 'Salois',
|
|
1827
|
+
email: 'etienne.salois@example.com',
|
|
1828
|
+
},
|
|
1829
|
+
{
|
|
1830
|
+
firstname: 'Thierry',
|
|
1831
|
+
lastname: 'Bobu',
|
|
1832
|
+
email: 'thierry.bobu@example.com',
|
|
1833
|
+
},
|
|
1834
|
+
{
|
|
1835
|
+
firstname: 'Bernadette',
|
|
1836
|
+
lastname: 'Langelier',
|
|
1837
|
+
email: 'bernadette.langelier@exemple.com'
|
|
1838
|
+
},
|
|
1839
|
+
{
|
|
1840
|
+
firstname: 'Agate',
|
|
1841
|
+
lastname: 'Roy',
|
|
1842
|
+
email: 'agate.roy@exemple.com'
|
|
1843
|
+
}
|
|
1844
|
+
])
|
|
1845
|
+
|
|
1846
|
+
const filterInputConfig = ref({
|
|
1847
|
+
variant: 'outlined',
|
|
1848
|
+
density: 'comfortable',
|
|
1849
|
+
hideDetails: true,
|
|
1850
|
+
clearable: false,
|
|
1851
|
+
disableErrorHandling: true,
|
|
1852
|
+
})
|
|
1853
|
+
</script>
|
|
1854
|
+
`,
|
|
1855
|
+
},
|
|
1856
|
+
],
|
|
1857
|
+
},
|
|
1858
|
+
args: {
|
|
1859
|
+
'headers': [
|
|
1860
|
+
{
|
|
1861
|
+
title: 'Nom',
|
|
1862
|
+
key: 'lastname',
|
|
1863
|
+
filterable: true,
|
|
1864
|
+
filterType: 'text',
|
|
1865
|
+
},
|
|
1866
|
+
{
|
|
1867
|
+
title: 'Prénom',
|
|
1868
|
+
key: 'firstname',
|
|
1869
|
+
filterable: true,
|
|
1870
|
+
filterType: 'text',
|
|
1871
|
+
},
|
|
1872
|
+
{
|
|
1873
|
+
title: 'Email',
|
|
1874
|
+
value: 'email',
|
|
1875
|
+
filterable: true,
|
|
1876
|
+
filterType: 'text',
|
|
1877
|
+
},
|
|
1878
|
+
],
|
|
1879
|
+
'items': [
|
|
1880
|
+
{
|
|
1881
|
+
firstname: 'Virginie',
|
|
1882
|
+
lastname: 'Beauchesne',
|
|
1883
|
+
email: 'virginie.beauchesne@example.com',
|
|
1884
|
+
},
|
|
1885
|
+
{
|
|
1886
|
+
firstname: 'Simone',
|
|
1887
|
+
lastname: 'Bellefeuille',
|
|
1888
|
+
email: 'simone.bellefeuille@example.com',
|
|
1889
|
+
},
|
|
1890
|
+
{
|
|
1891
|
+
firstname: 'Étienne',
|
|
1892
|
+
lastname: 'Salois',
|
|
1893
|
+
email: 'etienne.salois@example.com',
|
|
1894
|
+
},
|
|
1895
|
+
{
|
|
1896
|
+
firstname: 'Thierry',
|
|
1897
|
+
lastname: 'Bobu',
|
|
1898
|
+
email: 'thierry.bobu@example.com',
|
|
1899
|
+
},
|
|
1900
|
+
{
|
|
1901
|
+
firstname: 'Bernadette',
|
|
1902
|
+
lastname: 'Langelier',
|
|
1903
|
+
email: 'bernadette.langelier@exemple.com',
|
|
1904
|
+
},
|
|
1905
|
+
{
|
|
1906
|
+
firstname: 'Agate',
|
|
1907
|
+
lastname: 'Roy',
|
|
1908
|
+
email: 'agate.roy@exemple.com',
|
|
1909
|
+
},
|
|
1910
|
+
],
|
|
1911
|
+
'caption': '',
|
|
1912
|
+
'options': {
|
|
1913
|
+
itemsPerPage: 4,
|
|
1914
|
+
filters: [],
|
|
1915
|
+
},
|
|
1916
|
+
'filterInputConfig': {
|
|
1917
|
+
variant: 'outlined',
|
|
1918
|
+
density: 'comfortable',
|
|
1919
|
+
hideDetails: true,
|
|
1920
|
+
clearable: false,
|
|
1921
|
+
disableErrorHandling: true,
|
|
1922
|
+
},
|
|
1923
|
+
'showFilters': true,
|
|
1924
|
+
'suffix': 'filter-text-table',
|
|
1925
|
+
'density': 'default',
|
|
1926
|
+
'striped': false,
|
|
1927
|
+
'onUpdate:options': fn(),
|
|
1928
|
+
},
|
|
1929
|
+
render: (args) => {
|
|
1930
|
+
return {
|
|
1931
|
+
components: { SyTable },
|
|
1932
|
+
setup() {
|
|
1933
|
+
// Create reactive references
|
|
1934
|
+
const options = ref(args.options)
|
|
1935
|
+
const items = ref(args.items)
|
|
1936
|
+
|
|
1937
|
+
return {
|
|
1938
|
+
args,
|
|
1939
|
+
options,
|
|
1940
|
+
items,
|
|
1941
|
+
}
|
|
1942
|
+
},
|
|
1943
|
+
template: `
|
|
1944
|
+
<SyTable
|
|
1945
|
+
v-model:options="args.options"
|
|
1946
|
+
v-bind="args"
|
|
1947
|
+
suffix="filter-custom-input"
|
|
1948
|
+
/>
|
|
1949
|
+
`,
|
|
1950
|
+
}
|
|
1951
|
+
},
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
export const ManyTables: Story = {
|
|
1955
|
+
parameters: {
|
|
1956
|
+
sourceCode: [
|
|
1957
|
+
{
|
|
1958
|
+
name: 'Template',
|
|
1959
|
+
code: `
|
|
1960
|
+
<template>
|
|
1961
|
+
<div class="d-flex flex-column gap-4">
|
|
1962
|
+
<SyTable
|
|
1963
|
+
v-model:options="options1"
|
|
1964
|
+
:headers="headers"
|
|
1965
|
+
:items="items1"
|
|
1966
|
+
suffix="table-1"
|
|
1967
|
+
/>
|
|
1968
|
+
<SyTable
|
|
1969
|
+
v-model:options="options2"
|
|
1970
|
+
:headers="headers"
|
|
1971
|
+
:items="items2"
|
|
1972
|
+
suffix="table-2"
|
|
1973
|
+
/>
|
|
1974
|
+
</div>
|
|
1975
|
+
</template>
|
|
1976
|
+
`,
|
|
1977
|
+
},
|
|
1978
|
+
{
|
|
1979
|
+
name: 'Script',
|
|
1980
|
+
code: `
|
|
1981
|
+
<script setup lang="ts">
|
|
1982
|
+
import { ref } from 'vue'
|
|
1983
|
+
import { SyTable } from '@cnamts/synapse'
|
|
1984
|
+
|
|
1985
|
+
const options1 = ref({
|
|
1986
|
+
itemsPerPage: 4,
|
|
1987
|
+
})
|
|
1988
|
+
|
|
1989
|
+
const options2 = ref({
|
|
1990
|
+
itemsPerPage: 2,
|
|
1991
|
+
})
|
|
1992
|
+
|
|
1993
|
+
const headers = ref([
|
|
1994
|
+
{
|
|
1995
|
+
title: 'Nom',
|
|
1996
|
+
key: 'lastname',
|
|
1997
|
+
},
|
|
1998
|
+
{
|
|
1999
|
+
title: 'Prénom',
|
|
2000
|
+
key: 'firstname',
|
|
2001
|
+
},
|
|
2002
|
+
{
|
|
2003
|
+
title: 'Email',
|
|
2004
|
+
value: 'email',
|
|
2005
|
+
},
|
|
2006
|
+
])
|
|
2007
|
+
|
|
2008
|
+
const items = ref([
|
|
2009
|
+
{
|
|
2010
|
+
firstname: 'Virginie',
|
|
2011
|
+
lastname: 'Beauchesne',
|
|
2012
|
+
email: 'virginie.beauchesne@example.com',
|
|
2013
|
+
},
|
|
2014
|
+
{
|
|
2015
|
+
firstname: 'Simone',
|
|
2016
|
+
lastname: 'Bellefeuille',
|
|
2017
|
+
email: 'simone.bellefeuille@example.com',
|
|
2018
|
+
},
|
|
2019
|
+
{
|
|
2020
|
+
firstname: 'Étienne',
|
|
2021
|
+
lastname: 'Salois',
|
|
2022
|
+
email: 'etienne.salois@example.com',
|
|
2023
|
+
},
|
|
2024
|
+
{
|
|
2025
|
+
firstname: 'Thierry',
|
|
2026
|
+
lastname: 'Bobu',
|
|
2027
|
+
email: 'thierry.bobu@example.com',
|
|
1273
2028
|
},
|
|
1274
2029
|
{
|
|
1275
2030
|
firstname: 'Bernadette',
|
|
1276
2031
|
lastname: 'Langelier',
|
|
1277
|
-
|
|
2032
|
+
email: 'bernadette.langelier@exemple.com'
|
|
1278
2033
|
},
|
|
1279
2034
|
{
|
|
1280
2035
|
firstname: 'Agate',
|
|
1281
2036
|
lastname: 'Roy',
|
|
1282
|
-
|
|
2037
|
+
email: 'agate.roy@exemple.com'
|
|
1283
2038
|
}
|
|
1284
2039
|
])
|
|
1285
2040
|
</script>
|
|
1286
2041
|
`,
|
|
1287
2042
|
},
|
|
2043
|
+
],
|
|
2044
|
+
},
|
|
2045
|
+
args: {
|
|
2046
|
+
'headers': [
|
|
2047
|
+
{
|
|
2048
|
+
title: 'Nom',
|
|
2049
|
+
key: 'lastname',
|
|
2050
|
+
},
|
|
2051
|
+
{
|
|
2052
|
+
title: 'Prénom',
|
|
2053
|
+
key: 'firstname',
|
|
2054
|
+
},
|
|
2055
|
+
{
|
|
2056
|
+
title: 'Email',
|
|
2057
|
+
value: 'email',
|
|
2058
|
+
},
|
|
2059
|
+
],
|
|
2060
|
+
'items': [
|
|
2061
|
+
{
|
|
2062
|
+
firstname: 'Virginie',
|
|
2063
|
+
lastname: 'Beauchesne',
|
|
2064
|
+
email: 'virginie.beauchesne@example.com',
|
|
2065
|
+
},
|
|
2066
|
+
{
|
|
2067
|
+
firstname: 'Simone',
|
|
2068
|
+
lastname: 'Bellefeuille',
|
|
2069
|
+
email: 'simone.bellefeuille@example.com',
|
|
2070
|
+
},
|
|
2071
|
+
{
|
|
2072
|
+
firstname: 'Étienne',
|
|
2073
|
+
lastname: 'Salois',
|
|
2074
|
+
email: 'etienne.salois@example.com',
|
|
2075
|
+
},
|
|
2076
|
+
{
|
|
2077
|
+
firstname: 'Thierry',
|
|
2078
|
+
lastname: 'Bobu',
|
|
2079
|
+
email: 'thierry.bobu@example.com',
|
|
2080
|
+
},
|
|
2081
|
+
{
|
|
2082
|
+
firstname: 'Bernadette',
|
|
2083
|
+
lastname: 'Langelier',
|
|
2084
|
+
email: 'bernadette.langelier@exemple.com',
|
|
2085
|
+
},
|
|
2086
|
+
{
|
|
2087
|
+
firstname: 'Agate',
|
|
2088
|
+
lastname: 'Roy',
|
|
2089
|
+
email: 'agate.roy@exemple.com',
|
|
2090
|
+
},
|
|
2091
|
+
],
|
|
2092
|
+
'caption': '',
|
|
2093
|
+
'suffix': 'multi-server',
|
|
2094
|
+
'density': 'default',
|
|
2095
|
+
'striped': false,
|
|
2096
|
+
'onUpdate:options': fn(),
|
|
2097
|
+
},
|
|
2098
|
+
render: (args) => {
|
|
2099
|
+
return {
|
|
2100
|
+
components: { SyTable },
|
|
2101
|
+
setup() {
|
|
2102
|
+
const options1 = ref<Partial<DataOptions>>({
|
|
2103
|
+
itemsPerPage: 4,
|
|
2104
|
+
})
|
|
2105
|
+
const options2 = ref<Partial<DataOptions>>({
|
|
2106
|
+
itemsPerPage: 2,
|
|
2107
|
+
})
|
|
2108
|
+
return { args, options1, options2 }
|
|
2109
|
+
},
|
|
2110
|
+
template: `
|
|
2111
|
+
<div>
|
|
2112
|
+
<SyTable
|
|
2113
|
+
v-model:options="options1"
|
|
2114
|
+
v-bind="args"
|
|
2115
|
+
suffix="table1"
|
|
2116
|
+
class="mb-10"
|
|
2117
|
+
/>
|
|
2118
|
+
<SyTable
|
|
2119
|
+
v-model:options="options2"
|
|
2120
|
+
v-bind="args"
|
|
2121
|
+
suffix="table2"
|
|
2122
|
+
/>
|
|
2123
|
+
</div>
|
|
2124
|
+
`,
|
|
2125
|
+
}
|
|
2126
|
+
},
|
|
2127
|
+
}
|
|
2128
|
+
|
|
2129
|
+
export const DataAlignment: Story = {
|
|
2130
|
+
parameters: {
|
|
2131
|
+
sourceCode: [
|
|
2132
|
+
{
|
|
2133
|
+
name: 'Template',
|
|
2134
|
+
code: `
|
|
2135
|
+
<template>
|
|
2136
|
+
<SyTable
|
|
2137
|
+
v-model:options="options"
|
|
2138
|
+
:headers="headers"
|
|
2139
|
+
:items="items"
|
|
2140
|
+
suffix="alignment-table"
|
|
2141
|
+
/>
|
|
2142
|
+
</template>
|
|
2143
|
+
`,
|
|
2144
|
+
},
|
|
1288
2145
|
{
|
|
1289
|
-
name: '
|
|
2146
|
+
name: 'Script',
|
|
1290
2147
|
code: `
|
|
1291
|
-
<
|
|
1292
|
-
|
|
1293
|
-
|
|
1294
|
-
flex-direction: column;
|
|
1295
|
-
gap: 4px;
|
|
1296
|
-
}
|
|
2148
|
+
<script setup lang="ts">
|
|
2149
|
+
import { ref } from 'vue'
|
|
2150
|
+
import { SyTable } from '@cnamts/synapse'
|
|
1297
2151
|
|
|
1298
|
-
|
|
1299
|
-
|
|
1300
|
-
|
|
1301
|
-
|
|
1302
|
-
|
|
1303
|
-
|
|
2152
|
+
const options = ref({
|
|
2153
|
+
itemsPerPage: 4,
|
|
2154
|
+
})
|
|
2155
|
+
|
|
2156
|
+
const headers = ref([
|
|
2157
|
+
{
|
|
2158
|
+
title: 'ID',
|
|
2159
|
+
key: 'id',
|
|
2160
|
+
align: 'center',
|
|
2161
|
+
},
|
|
2162
|
+
{
|
|
2163
|
+
title: 'Nom',
|
|
2164
|
+
key: 'lastname',
|
|
2165
|
+
align: 'start',
|
|
2166
|
+
},
|
|
2167
|
+
{
|
|
2168
|
+
title: 'Date de naissance',
|
|
2169
|
+
key: 'birthdate',
|
|
2170
|
+
align: 'center',
|
|
2171
|
+
},
|
|
2172
|
+
{
|
|
2173
|
+
title: 'NIR',
|
|
2174
|
+
key: 'nir',
|
|
2175
|
+
align: 'end',
|
|
2176
|
+
},
|
|
2177
|
+
])
|
|
2178
|
+
|
|
2179
|
+
const items = ref([
|
|
2180
|
+
{
|
|
2181
|
+
id: '1',
|
|
2182
|
+
lastname: 'Lefebvre',
|
|
2183
|
+
birthdate: '18/02/1989',
|
|
2184
|
+
nir: '1 89 02 75 120 005 79',
|
|
2185
|
+
},
|
|
2186
|
+
{
|
|
2187
|
+
id: '2',
|
|
2188
|
+
lastname: 'Richard',
|
|
2189
|
+
birthdate: '22/05/1991',
|
|
2190
|
+
nir: '2 91 05 75 120 005 76',
|
|
2191
|
+
},
|
|
2192
|
+
{
|
|
2193
|
+
id: '3',
|
|
2194
|
+
lastname: 'Fournier',
|
|
2195
|
+
birthdate: '11/11/2000',
|
|
2196
|
+
nir: '2 00 11 42 120 008 87',
|
|
2197
|
+
},
|
|
2198
|
+
])
|
|
2199
|
+
</script>
|
|
1304
2200
|
`,
|
|
1305
2201
|
},
|
|
1306
2202
|
],
|
|
1307
2203
|
},
|
|
1308
2204
|
args: {
|
|
1309
|
-
headers: [
|
|
2205
|
+
'headers': [
|
|
2206
|
+
{
|
|
2207
|
+
title: 'ID',
|
|
2208
|
+
key: 'id',
|
|
2209
|
+
align: 'center',
|
|
2210
|
+
sortable: false,
|
|
2211
|
+
},
|
|
1310
2212
|
{
|
|
1311
2213
|
title: 'Nom',
|
|
1312
2214
|
key: 'lastname',
|
|
1313
|
-
|
|
1314
|
-
|
|
2215
|
+
align: 'start',
|
|
2216
|
+
sortable: false,
|
|
1315
2217
|
},
|
|
1316
2218
|
{
|
|
1317
|
-
title: '
|
|
1318
|
-
key: '
|
|
1319
|
-
|
|
1320
|
-
|
|
2219
|
+
title: 'Date de naissance',
|
|
2220
|
+
key: 'birthdate',
|
|
2221
|
+
align: 'center',
|
|
2222
|
+
sortable: false,
|
|
1321
2223
|
},
|
|
1322
2224
|
{
|
|
1323
|
-
title: '
|
|
1324
|
-
key: '
|
|
1325
|
-
|
|
1326
|
-
|
|
2225
|
+
title: 'NIR',
|
|
2226
|
+
key: 'nir',
|
|
2227
|
+
align: 'end',
|
|
2228
|
+
sortable: false,
|
|
1327
2229
|
},
|
|
1328
2230
|
],
|
|
1329
|
-
items: [
|
|
1330
|
-
{
|
|
1331
|
-
firstname: 'Virginie',
|
|
1332
|
-
lastname: 'Beauchesne',
|
|
1333
|
-
status: 'Actif',
|
|
1334
|
-
},
|
|
1335
|
-
{
|
|
1336
|
-
firstname: 'Simone',
|
|
1337
|
-
lastname: 'Bellefeuille',
|
|
1338
|
-
status: 'Inactif',
|
|
1339
|
-
},
|
|
1340
|
-
{
|
|
1341
|
-
firstname: 'Étienne',
|
|
1342
|
-
lastname: 'Salois',
|
|
1343
|
-
status: 'En attente',
|
|
1344
|
-
},
|
|
2231
|
+
'items': [
|
|
1345
2232
|
{
|
|
1346
|
-
|
|
1347
|
-
lastname: '
|
|
1348
|
-
|
|
2233
|
+
id: '1',
|
|
2234
|
+
lastname: 'Lefebvre',
|
|
2235
|
+
birthdate: '18/02/1989',
|
|
2236
|
+
nir: '1 89 02 75 120 005 79',
|
|
1349
2237
|
},
|
|
1350
2238
|
{
|
|
1351
|
-
|
|
1352
|
-
lastname: '
|
|
1353
|
-
|
|
2239
|
+
id: '2',
|
|
2240
|
+
lastname: 'Richard',
|
|
2241
|
+
birthdate: '22/05/1991',
|
|
2242
|
+
nir: '2 91 05 75 120 005 76',
|
|
1354
2243
|
},
|
|
1355
2244
|
{
|
|
1356
|
-
|
|
1357
|
-
lastname: '
|
|
1358
|
-
|
|
2245
|
+
id: '3',
|
|
2246
|
+
lastname: 'Fournier',
|
|
2247
|
+
birthdate: '11/11/2000',
|
|
2248
|
+
nir: '2 00 11 42 120 008 87',
|
|
1359
2249
|
},
|
|
1360
2250
|
],
|
|
1361
|
-
|
|
1362
|
-
options: {
|
|
2251
|
+
'options': {
|
|
1363
2252
|
itemsPerPage: 4,
|
|
1364
|
-
filters: [],
|
|
1365
2253
|
},
|
|
1366
|
-
|
|
1367
|
-
|
|
1368
|
-
density: 'default',
|
|
1369
|
-
striped: false,
|
|
2254
|
+
'suffix': 'alignment-table',
|
|
2255
|
+
'onUpdate:options': fn(),
|
|
1370
2256
|
},
|
|
1371
|
-
render(args) {
|
|
2257
|
+
render: (args) => {
|
|
1372
2258
|
return {
|
|
1373
2259
|
components: { SyTable },
|
|
1374
2260
|
setup() {
|
|
1375
|
-
|
|
1376
|
-
const options = ref(args.options)
|
|
1377
|
-
const items = ref(args.items)
|
|
1378
|
-
const customFilterValue = ref('')
|
|
1379
|
-
const statusOptions = ['Actif', 'Inactif', 'En attente']
|
|
1380
|
-
|
|
1381
|
-
return {
|
|
1382
|
-
args,
|
|
1383
|
-
options,
|
|
1384
|
-
items,
|
|
1385
|
-
customFilterValue,
|
|
1386
|
-
statusOptions,
|
|
1387
|
-
}
|
|
2261
|
+
return { args }
|
|
1388
2262
|
},
|
|
1389
2263
|
template: `
|
|
1390
2264
|
<SyTable
|
|
1391
|
-
v-model:options="options"
|
|
1392
|
-
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
:show-filters="args.showFilters"
|
|
1396
|
-
:suffix="args.suffix"
|
|
1397
|
-
:density="args.density"
|
|
1398
|
-
:striped="args.striped"
|
|
1399
|
-
:resizable-columns="args.resizableColumns"
|
|
1400
|
-
>
|
|
1401
|
-
<template #filter.custom="{ header, value, updateFilter }">
|
|
1402
|
-
<div class="custom-filter-container">
|
|
1403
|
-
<div class="custom-filter-info mb-2">
|
|
1404
|
-
Filtre personnalisé :
|
|
1405
|
-
</div>
|
|
1406
|
-
<v-select
|
|
1407
|
-
v-model="customFilterValue"
|
|
1408
|
-
:items="statusOptions"
|
|
1409
|
-
label="Statut"
|
|
1410
|
-
variant="outlined"
|
|
1411
|
-
density="compact"
|
|
1412
|
-
color="primary"
|
|
1413
|
-
bg-color="white"
|
|
1414
|
-
@update:model-value="(val) => {
|
|
1415
|
-
// Manually create a select filter
|
|
1416
|
-
const currentFilters = [...options.filters || []]
|
|
1417
|
-
// Remove existing filter for this key if any
|
|
1418
|
-
const filteredFilters = currentFilters.filter(f => f.key !== 'status')
|
|
1419
|
-
// Add new filter if value is not empty
|
|
1420
|
-
if (val) {
|
|
1421
|
-
filteredFilters.push({ key: 'status', value: val, type: 'select' })
|
|
1422
|
-
}
|
|
1423
|
-
// Update options with new filters
|
|
1424
|
-
options.filters = filteredFilters
|
|
1425
|
-
}"
|
|
1426
|
-
/>
|
|
1427
|
-
</div>
|
|
1428
|
-
</template>
|
|
1429
|
-
</SyTable>
|
|
2265
|
+
v-model:options="args.options"
|
|
2266
|
+
v-bind="args"
|
|
2267
|
+
suffix="alignment-table"
|
|
2268
|
+
/>
|
|
1430
2269
|
`,
|
|
1431
2270
|
}
|
|
1432
2271
|
},
|
|
1433
2272
|
}
|
|
1434
2273
|
|
|
1435
|
-
export const
|
|
2274
|
+
export const ResizableColumns: Story = {
|
|
1436
2275
|
parameters: {
|
|
1437
2276
|
sourceCode: [
|
|
1438
2277
|
{
|
|
@@ -1443,9 +2282,8 @@ export const CustomFilterInputs: Story = {
|
|
|
1443
2282
|
v-model:options="options"
|
|
1444
2283
|
:headers="headers"
|
|
1445
2284
|
:items="items"
|
|
1446
|
-
:
|
|
1447
|
-
|
|
1448
|
-
suffix="filter-text-table"
|
|
2285
|
+
:resizable-columns="true"
|
|
2286
|
+
suffix="resizable-columns"
|
|
1449
2287
|
/>
|
|
1450
2288
|
</template>
|
|
1451
2289
|
`,
|
|
@@ -1459,27 +2297,20 @@ export const CustomFilterInputs: Story = {
|
|
|
1459
2297
|
|
|
1460
2298
|
const options = ref({
|
|
1461
2299
|
itemsPerPage: 4,
|
|
1462
|
-
filters: []
|
|
1463
2300
|
})
|
|
1464
2301
|
|
|
1465
2302
|
const headers = ref([
|
|
1466
2303
|
{
|
|
1467
2304
|
title: 'Nom',
|
|
1468
2305
|
key: 'lastname',
|
|
1469
|
-
filterable: true,
|
|
1470
|
-
filterType: 'text'
|
|
1471
2306
|
},
|
|
1472
2307
|
{
|
|
1473
2308
|
title: 'Prénom',
|
|
1474
2309
|
key: 'firstname',
|
|
1475
|
-
filterable: true,
|
|
1476
|
-
filterType: 'text'
|
|
1477
2310
|
},
|
|
1478
2311
|
{
|
|
1479
2312
|
title: 'Email',
|
|
1480
2313
|
value: 'email',
|
|
1481
|
-
filterable: true,
|
|
1482
|
-
filterType: 'text'
|
|
1483
2314
|
},
|
|
1484
2315
|
])
|
|
1485
2316
|
|
|
@@ -1515,41 +2346,28 @@ export const CustomFilterInputs: Story = {
|
|
|
1515
2346
|
email: 'agate.roy@exemple.com'
|
|
1516
2347
|
}
|
|
1517
2348
|
])
|
|
1518
|
-
|
|
1519
|
-
const filterInputConfig = ref({
|
|
1520
|
-
variant: 'outlined',
|
|
1521
|
-
density: 'comfortable',
|
|
1522
|
-
hideDetails: true,
|
|
1523
|
-
clearable: false,
|
|
1524
|
-
disableErrorHandling: true,
|
|
1525
|
-
})
|
|
1526
2349
|
</script>
|
|
1527
2350
|
`,
|
|
1528
2351
|
},
|
|
1529
2352
|
],
|
|
1530
2353
|
},
|
|
1531
2354
|
args: {
|
|
1532
|
-
|
|
2355
|
+
'resizableColumns': true,
|
|
2356
|
+
'headers': [
|
|
1533
2357
|
{
|
|
1534
2358
|
title: 'Nom',
|
|
1535
2359
|
key: 'lastname',
|
|
1536
|
-
filterable: true,
|
|
1537
|
-
filterType: 'text',
|
|
1538
2360
|
},
|
|
1539
2361
|
{
|
|
1540
2362
|
title: 'Prénom',
|
|
1541
2363
|
key: 'firstname',
|
|
1542
|
-
filterable: true,
|
|
1543
|
-
filterType: 'text',
|
|
1544
2364
|
},
|
|
1545
2365
|
{
|
|
1546
2366
|
title: 'Email',
|
|
1547
2367
|
value: 'email',
|
|
1548
|
-
filterable: true,
|
|
1549
|
-
filterType: 'text',
|
|
1550
2368
|
},
|
|
1551
2369
|
],
|
|
1552
|
-
items: [
|
|
2370
|
+
'items': [
|
|
1553
2371
|
{
|
|
1554
2372
|
firstname: 'Virginie',
|
|
1555
2373
|
lastname: 'Beauchesne',
|
|
@@ -1581,74 +2399,53 @@ export const CustomFilterInputs: Story = {
|
|
|
1581
2399
|
email: 'agate.roy@exemple.com',
|
|
1582
2400
|
},
|
|
1583
2401
|
],
|
|
1584
|
-
|
|
1585
|
-
options: {
|
|
2402
|
+
'options': {
|
|
1586
2403
|
itemsPerPage: 4,
|
|
1587
|
-
filters: [],
|
|
1588
|
-
},
|
|
1589
|
-
filterInputConfig: {
|
|
1590
|
-
variant: 'outlined',
|
|
1591
|
-
density: 'comfortable',
|
|
1592
|
-
hideDetails: true,
|
|
1593
|
-
clearable: false,
|
|
1594
|
-
disableErrorHandling: true,
|
|
1595
2404
|
},
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
density: 'default',
|
|
1599
|
-
striped: false,
|
|
2405
|
+
'suffix': 'resizable-columns',
|
|
2406
|
+
'onUpdate:options': fn(),
|
|
1600
2407
|
},
|
|
1601
|
-
render(args) {
|
|
2408
|
+
render: (args) => {
|
|
1602
2409
|
return {
|
|
1603
2410
|
components: { SyTable },
|
|
1604
2411
|
setup() {
|
|
1605
|
-
|
|
1606
|
-
const options = ref(args.options)
|
|
1607
|
-
const items = ref(args.items)
|
|
1608
|
-
|
|
1609
|
-
return {
|
|
1610
|
-
args,
|
|
1611
|
-
options,
|
|
1612
|
-
items,
|
|
1613
|
-
}
|
|
2412
|
+
return { args }
|
|
1614
2413
|
},
|
|
1615
2414
|
template: `
|
|
1616
2415
|
<SyTable
|
|
1617
|
-
v-model:options="options"
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
:caption="args.caption"
|
|
1621
|
-
:show-filters="args.showFilters"
|
|
1622
|
-
:filter-input-config="args.filterInputConfig"
|
|
1623
|
-
:resizable-columns="args.resizableColumns"
|
|
1624
|
-
:suffix="args.suffix"
|
|
1625
|
-
:density="args.density"
|
|
2416
|
+
v-model:options="args.options"
|
|
2417
|
+
v-bind="args"
|
|
2418
|
+
suffix="resizable-columns"
|
|
1626
2419
|
/>
|
|
1627
2420
|
`,
|
|
1628
2421
|
}
|
|
1629
2422
|
},
|
|
1630
2423
|
}
|
|
1631
2424
|
|
|
1632
|
-
export const
|
|
2425
|
+
export const RowSelection: Story = {
|
|
2426
|
+
name: 'Row Selection',
|
|
1633
2427
|
parameters: {
|
|
1634
2428
|
sourceCode: [
|
|
1635
2429
|
{
|
|
1636
2430
|
name: 'Template',
|
|
1637
2431
|
code: `
|
|
1638
2432
|
<template>
|
|
1639
|
-
<
|
|
1640
|
-
|
|
1641
|
-
|
|
1642
|
-
|
|
1643
|
-
|
|
1644
|
-
|
|
1645
|
-
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1650
|
-
|
|
1651
|
-
|
|
2433
|
+
<SyTable
|
|
2434
|
+
v-model:options="options"
|
|
2435
|
+
v-model="selection"
|
|
2436
|
+
:headers="headers"
|
|
2437
|
+
:items="items"
|
|
2438
|
+
show-select
|
|
2439
|
+
show-filters
|
|
2440
|
+
suffix="selection-table"
|
|
2441
|
+
/>
|
|
2442
|
+
<div v-if="selection.length" class="mt-4 pa-4 bg-grey-lighten-4">
|
|
2443
|
+
<h3 class="text-h6 mb-3">Item(s) sélectionné(s) ({{ selection.length }})</h3>
|
|
2444
|
+
<div v-for="(item, index) in selection" :key="index" class="mb-2 pa-2 bg-grey-lighten-3">
|
|
2445
|
+
<div><strong>Nom:</strong> {{ typeof item === 'object' ? item.lastname : items.find(i => JSON.stringify(i) === item)?.lastname }}</div>
|
|
2446
|
+
<div><strong>Prénom:</strong> {{ typeof item === 'object' ? item.firstname : items.find(i => JSON.stringify(i) === item)?.firstname }}</div>
|
|
2447
|
+
<div><strong>Email:</strong> {{ typeof item === 'object' ? item.email : items.find(i => JSON.stringify(i) === item)?.email }}</div>
|
|
2448
|
+
</div>
|
|
1652
2449
|
</div>
|
|
1653
2450
|
</template>
|
|
1654
2451
|
`,
|
|
@@ -1660,14 +2457,10 @@ export const ManyTables: Story = {
|
|
|
1660
2457
|
import { ref } from 'vue'
|
|
1661
2458
|
import { SyTable } from '@cnamts/synapse'
|
|
1662
2459
|
|
|
1663
|
-
const
|
|
2460
|
+
const options = ref({
|
|
1664
2461
|
itemsPerPage: 4,
|
|
1665
2462
|
})
|
|
1666
2463
|
|
|
1667
|
-
const options2 = ref({
|
|
1668
|
-
itemsPerPage: 2,
|
|
1669
|
-
})
|
|
1670
|
-
|
|
1671
2464
|
const headers = ref([
|
|
1672
2465
|
{
|
|
1673
2466
|
title: 'Nom',
|
|
@@ -1678,7 +2471,7 @@ export const ManyTables: Story = {
|
|
|
1678
2471
|
key: 'firstname',
|
|
1679
2472
|
},
|
|
1680
2473
|
{
|
|
1681
|
-
|
|
2474
|
+
title: 'Email',
|
|
1682
2475
|
value: 'email',
|
|
1683
2476
|
},
|
|
1684
2477
|
])
|
|
@@ -1767,53 +2560,47 @@ export const ManyTables: Story = {
|
|
|
1767
2560
|
email: 'agate.roy@exemple.com',
|
|
1768
2561
|
},
|
|
1769
2562
|
],
|
|
2563
|
+
options: {
|
|
2564
|
+
itemsPerPage: 4,
|
|
2565
|
+
},
|
|
1770
2566
|
caption: '',
|
|
1771
|
-
suffix: '
|
|
2567
|
+
suffix: 'selection-table',
|
|
1772
2568
|
density: 'default',
|
|
1773
2569
|
striped: false,
|
|
2570
|
+
showSelect: true,
|
|
2571
|
+
showFilters: true,
|
|
1774
2572
|
},
|
|
1775
2573
|
render(args) {
|
|
1776
2574
|
return {
|
|
1777
2575
|
components: { SyTable },
|
|
1778
2576
|
setup() {
|
|
1779
|
-
const
|
|
1780
|
-
|
|
1781
|
-
}
|
|
1782
|
-
const options2 = ref<Partial<DataOptions>>({
|
|
1783
|
-
itemsPerPage: 2,
|
|
1784
|
-
})
|
|
1785
|
-
return { args, options1, options2 }
|
|
2577
|
+
const items = ref(args.items)
|
|
2578
|
+
const selection = ref([])
|
|
2579
|
+
return { args, selection, items }
|
|
1786
2580
|
},
|
|
1787
2581
|
template: `
|
|
1788
2582
|
<div>
|
|
1789
2583
|
<SyTable
|
|
1790
|
-
v-model:options="
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
:caption="args.caption"
|
|
1795
|
-
:density="args.density"
|
|
1796
|
-
:striped="args.striped"
|
|
1797
|
-
suffix="table1"
|
|
1798
|
-
class="mb-10"
|
|
1799
|
-
/>
|
|
1800
|
-
<SyTable
|
|
1801
|
-
v-model:options="options2"
|
|
1802
|
-
:resizable-columns="args.resizableColumns"
|
|
1803
|
-
:headers="args.headers"
|
|
1804
|
-
:items="args.items"
|
|
1805
|
-
:caption="args.caption"
|
|
1806
|
-
:density="args.density"
|
|
1807
|
-
:striped="args.striped"
|
|
1808
|
-
suffix="table2"
|
|
2584
|
+
v-model:options="args.options"
|
|
2585
|
+
v-model="selection"
|
|
2586
|
+
v-bind="args"
|
|
2587
|
+
suffix="selection-table"
|
|
1809
2588
|
/>
|
|
2589
|
+
<div v-if="selection.length" class="mt-4 pa-4 bg-grey-lighten-4">
|
|
2590
|
+
<h3 class="text-h6 mb-3">Item(s) sélectionné(s) ({{ selection.length }})</h3>
|
|
2591
|
+
<div v-for="(item, index) in selection" :key="index" class="mb-2 pa-2 bg-grey-lighten-3">
|
|
2592
|
+
<div><strong>Nom:</strong> {{ typeof item === 'object' ? item.lastname : args.items.find(i => JSON.stringify(i) === item)?.lastname }}</div>
|
|
2593
|
+
<div><strong>Prénom:</strong> {{ typeof item === 'object' ? item.firstname : args.items.find(i => JSON.stringify(i) === item)?.firstname }}</div>
|
|
2594
|
+
<div><strong>Email:</strong> {{ typeof item === 'object' ? item.email : args.items.find(i => JSON.stringify(i) === item)?.email }}</div>
|
|
2595
|
+
</div>
|
|
2596
|
+
</div>
|
|
1810
2597
|
</div>
|
|
1811
2598
|
`,
|
|
1812
2599
|
}
|
|
1813
2600
|
},
|
|
1814
2601
|
}
|
|
1815
2602
|
|
|
1816
|
-
export const
|
|
2603
|
+
export const ColumnControls: Story = {
|
|
1817
2604
|
parameters: {
|
|
1818
2605
|
sourceCode: [
|
|
1819
2606
|
{
|
|
@@ -1824,8 +2611,8 @@ export const ResizableColumns: Story = {
|
|
|
1824
2611
|
v-model:options="options"
|
|
1825
2612
|
:headers="headers"
|
|
1826
2613
|
:items="items"
|
|
1827
|
-
|
|
1828
|
-
|
|
2614
|
+
suffix="column-control-table"
|
|
2615
|
+
enable-column-controls
|
|
1829
2616
|
/>
|
|
1830
2617
|
</template>
|
|
1831
2618
|
`,
|
|
@@ -1851,7 +2638,7 @@ export const ResizableColumns: Story = {
|
|
|
1851
2638
|
key: 'firstname',
|
|
1852
2639
|
},
|
|
1853
2640
|
{
|
|
1854
|
-
|
|
2641
|
+
title: 'Email',
|
|
1855
2642
|
value: 'email',
|
|
1856
2643
|
},
|
|
1857
2644
|
])
|
|
@@ -1894,8 +2681,7 @@ export const ResizableColumns: Story = {
|
|
|
1894
2681
|
],
|
|
1895
2682
|
},
|
|
1896
2683
|
args: {
|
|
1897
|
-
|
|
1898
|
-
headers: [
|
|
2684
|
+
'headers': [
|
|
1899
2685
|
{
|
|
1900
2686
|
title: 'Nom',
|
|
1901
2687
|
key: 'lastname',
|
|
@@ -1909,7 +2695,7 @@ export const ResizableColumns: Story = {
|
|
|
1909
2695
|
value: 'email',
|
|
1910
2696
|
},
|
|
1911
2697
|
],
|
|
1912
|
-
items: [
|
|
2698
|
+
'items': [
|
|
1913
2699
|
{
|
|
1914
2700
|
firstname: 'Virginie',
|
|
1915
2701
|
lastname: 'Beauchesne',
|
|
@@ -1941,12 +2727,17 @@ export const ResizableColumns: Story = {
|
|
|
1941
2727
|
email: 'agate.roy@exemple.com',
|
|
1942
2728
|
},
|
|
1943
2729
|
],
|
|
1944
|
-
options: {
|
|
2730
|
+
'options': {
|
|
1945
2731
|
itemsPerPage: 4,
|
|
1946
2732
|
},
|
|
1947
|
-
|
|
2733
|
+
'caption': '',
|
|
2734
|
+
'suffix': 'column-control-table',
|
|
2735
|
+
'density': 'default',
|
|
2736
|
+
'striped': false,
|
|
2737
|
+
'enableColumnControls': true,
|
|
2738
|
+
'onUpdate:options': fn(),
|
|
1948
2739
|
},
|
|
1949
|
-
render(args) {
|
|
2740
|
+
render: (args) => {
|
|
1950
2741
|
return {
|
|
1951
2742
|
components: { SyTable },
|
|
1952
2743
|
setup() {
|
|
@@ -1955,10 +2746,7 @@ export const ResizableColumns: Story = {
|
|
|
1955
2746
|
template: `
|
|
1956
2747
|
<SyTable
|
|
1957
2748
|
v-model:options="args.options"
|
|
1958
|
-
|
|
1959
|
-
:items="args.items"
|
|
1960
|
-
:resizableColumns="args.resizableColumns"
|
|
1961
|
-
:suffix="args.suffix"
|
|
2749
|
+
v-bind="args"
|
|
1962
2750
|
/>
|
|
1963
2751
|
`,
|
|
1964
2752
|
}
|