@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,5 +1,5 @@
|
|
|
1
1
|
import { computed, ref, type Ref } from 'vue'
|
|
2
|
-
import type { DataOptions } from './types'
|
|
2
|
+
import type { DataOptions, DataTableHeaders } from './types'
|
|
3
3
|
import { LocalStorageUtility } from '@/utils/localStorageUtility'
|
|
4
4
|
|
|
5
5
|
/**
|
|
@@ -35,9 +35,17 @@ export function useTableStorage({
|
|
|
35
35
|
return `${storageKey.value}-column-widths`
|
|
36
36
|
})
|
|
37
37
|
|
|
38
|
+
// Separate key for headers
|
|
39
|
+
const heardersKey = computed(() => {
|
|
40
|
+
return `${storageKey.value}-headers`
|
|
41
|
+
})
|
|
42
|
+
|
|
38
43
|
// Column widths storage
|
|
39
44
|
const columnWidths = ref<ColumnWidthsStorage>({})
|
|
40
45
|
|
|
46
|
+
// Headers storage
|
|
47
|
+
const headers = ref<DataTableHeaders[] | undefined>(undefined)
|
|
48
|
+
|
|
41
49
|
// Configuration of local storage synchronization
|
|
42
50
|
function setupLocalStorage() {
|
|
43
51
|
// Watch for option changes and update local storage
|
|
@@ -64,6 +72,12 @@ export function useTableStorage({
|
|
|
64
72
|
if (storedColumnWidths) {
|
|
65
73
|
columnWidths.value = storedColumnWidths
|
|
66
74
|
}
|
|
75
|
+
|
|
76
|
+
// Load headers from storage
|
|
77
|
+
const storedHeaders = localStorageUtility.getItem<DataTableHeaders[]>(heardersKey.value)
|
|
78
|
+
if (storedHeaders) {
|
|
79
|
+
headers.value = storedHeaders
|
|
80
|
+
}
|
|
67
81
|
}
|
|
68
82
|
|
|
69
83
|
// Save column widths to localStorage
|
|
@@ -81,12 +95,23 @@ export function useTableStorage({
|
|
|
81
95
|
saveColumnWidths(updatedWidths)
|
|
82
96
|
}
|
|
83
97
|
|
|
84
|
-
|
|
98
|
+
// Save headers to localStorage
|
|
99
|
+
const saveHeaders = (headers: DataTableHeaders[] | undefined) => {
|
|
100
|
+
if (!headers) {
|
|
101
|
+
localStorageUtility.removeItem(heardersKey.value)
|
|
102
|
+
return
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
localStorageUtility.setItem(heardersKey.value, headers)
|
|
106
|
+
}
|
|
107
|
+
|
|
108
|
+
return { watchOptions, initFromStorage, saveColumnWidths, updateColumnWidth, saveHeaders }
|
|
85
109
|
}
|
|
86
110
|
|
|
87
111
|
return {
|
|
88
112
|
localOptions,
|
|
89
113
|
columnWidths,
|
|
114
|
+
headers,
|
|
90
115
|
storageKey,
|
|
91
116
|
columnWidthsKey,
|
|
92
117
|
setupLocalStorage,
|
|
@@ -51,4 +51,30 @@
|
|
|
51
51
|
color: tokens.$primary-base;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
+
|
|
55
|
+
// Override Vuetify's checkbox styles to use primary color
|
|
56
|
+
.v-table .v-selection-control {
|
|
57
|
+
color: rgb(var(--v-theme-primary)) !important;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
.v-table .v-selection-control--dirty .v-selection-control__input::before {
|
|
61
|
+
background-color: rgb(var(--v-theme-primary)) !important;
|
|
62
|
+
border-color: rgb(var(--v-theme-primary)) !important;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
// Target the header checkbox specifically
|
|
66
|
+
.v-data-table-header__checkbox .v-selection-control {
|
|
67
|
+
color: rgb(var(--v-theme-primary)) !important;
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
// Target the row checkboxes specifically
|
|
71
|
+
.v-data-table-row__checkbox .v-selection-control {
|
|
72
|
+
color: rgb(var(--v-theme-primary)) !important;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
// Add a global style for all checkboxes in the table
|
|
76
|
+
.v-checkbox .v-selection-control__input::before,
|
|
77
|
+
.v-checkbox-btn .v-selection-control__input::before {
|
|
78
|
+
border-color: rgb(var(--v-theme-primary)) !important;
|
|
79
|
+
}
|
|
54
80
|
}
|
|
@@ -10,7 +10,6 @@ export function useTableUtils({
|
|
|
10
10
|
tableId,
|
|
11
11
|
prefix,
|
|
12
12
|
suffix,
|
|
13
|
-
itemsPerPage,
|
|
14
13
|
serverItemsLength,
|
|
15
14
|
componentAttributes,
|
|
16
15
|
options,
|
|
@@ -18,7 +17,6 @@ export function useTableUtils({
|
|
|
18
17
|
tableId: string
|
|
19
18
|
prefix: string
|
|
20
19
|
suffix?: string
|
|
21
|
-
itemsPerPage?: number
|
|
22
20
|
caption?: string
|
|
23
21
|
serverItemsLength?: number
|
|
24
22
|
componentAttributes: Record<string, unknown>
|
|
@@ -26,7 +24,7 @@ export function useTableUtils({
|
|
|
26
24
|
density?: TableDensityType
|
|
27
25
|
}) {
|
|
28
26
|
// Use the separated storage utility
|
|
29
|
-
const { localOptions, columnWidths, storageKey, setupLocalStorage, updateColumnWidth } = useTableStorage({
|
|
27
|
+
const { localOptions, columnWidths, headers, storageKey, setupLocalStorage, updateColumnWidth } = useTableStorage({
|
|
30
28
|
prefix,
|
|
31
29
|
suffix,
|
|
32
30
|
serverItemsLength,
|
|
@@ -38,20 +36,10 @@ export function useTableUtils({
|
|
|
38
36
|
tableId,
|
|
39
37
|
})
|
|
40
38
|
|
|
41
|
-
const headers = computed(() => {
|
|
42
|
-
if (!Array.isArray(componentAttributes['headers'])) {
|
|
43
|
-
return undefined
|
|
44
|
-
}
|
|
45
|
-
return componentAttributes['headers'].map(header => ({
|
|
46
|
-
...header,
|
|
47
|
-
title: header.title ?? header.text,
|
|
48
|
-
}))
|
|
49
|
-
})
|
|
50
|
-
|
|
51
39
|
const optionsFacade = computed(() => {
|
|
52
40
|
return {
|
|
53
41
|
page: options.value.page || componentAttributes['page'],
|
|
54
|
-
itemsPerPage: options.value.itemsPerPage ||
|
|
42
|
+
itemsPerPage: options.value.itemsPerPage || 10,
|
|
55
43
|
sortBy: options.value.sortBy,
|
|
56
44
|
groupBy: options.value.groupBy,
|
|
57
45
|
multiSort: options.value.multiSort,
|
|
@@ -65,7 +53,6 @@ export function useTableUtils({
|
|
|
65
53
|
|
|
66
54
|
const props = {
|
|
67
55
|
...attrs,
|
|
68
|
-
headers: headers.value,
|
|
69
56
|
...localOptions.value,
|
|
70
57
|
...(serverItemsLength !== undefined ? { itemsLength: serverItemsLength } : {}),
|
|
71
58
|
}
|
|
@@ -104,12 +91,12 @@ export function useTableUtils({
|
|
|
104
91
|
localOptions,
|
|
105
92
|
columnWidths,
|
|
106
93
|
storageKey,
|
|
107
|
-
headers,
|
|
108
94
|
optionsFacade,
|
|
109
95
|
propsFacade,
|
|
110
96
|
updateOptions,
|
|
111
97
|
setupAccessibility,
|
|
112
98
|
setupLocalStorage,
|
|
113
99
|
updateColumnWidth,
|
|
100
|
+
headers,
|
|
114
101
|
}
|
|
115
102
|
}
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { mount } from '@vue/test-utils'
|
|
2
|
+
import { expect, describe, it } from 'vitest'
|
|
3
|
+
import SyTablePagination from '../SyTablePagination.vue'
|
|
4
|
+
import { vuetify } from '@tests/unit/setup'
|
|
5
|
+
|
|
6
|
+
describe('SyTablePagination.vue', () => {
|
|
7
|
+
it('renders the component with default props', () => {
|
|
8
|
+
const wrapper = mount(SyTablePagination, {
|
|
9
|
+
props: {
|
|
10
|
+
page: 1,
|
|
11
|
+
itemsPerPage: 10,
|
|
12
|
+
itemsLength: 100,
|
|
13
|
+
pageCount: 10,
|
|
14
|
+
},
|
|
15
|
+
global: {
|
|
16
|
+
plugins: [vuetify],
|
|
17
|
+
},
|
|
18
|
+
})
|
|
19
|
+
expect(wrapper.exists()).toBe(true)
|
|
20
|
+
expect(wrapper.find('.sy-table-pagination').exists()).toBe(true)
|
|
21
|
+
})
|
|
22
|
+
|
|
23
|
+
it('displays pagination when there are multiple pages', () => {
|
|
24
|
+
const wrapper = mount(SyTablePagination, {
|
|
25
|
+
props: {
|
|
26
|
+
page: 1,
|
|
27
|
+
itemsPerPage: 10,
|
|
28
|
+
itemsLength: 100,
|
|
29
|
+
pageCount: 10,
|
|
30
|
+
},
|
|
31
|
+
global: {
|
|
32
|
+
plugins: [vuetify],
|
|
33
|
+
},
|
|
34
|
+
})
|
|
35
|
+
expect(wrapper.find('.pagination').exists()).toBe(true)
|
|
36
|
+
})
|
|
37
|
+
|
|
38
|
+
it('does not display pagination navigation when there is only one page', () => {
|
|
39
|
+
const wrapper = mount(SyTablePagination, {
|
|
40
|
+
props: {
|
|
41
|
+
page: 1,
|
|
42
|
+
itemsPerPage: 10,
|
|
43
|
+
itemsLength: 5,
|
|
44
|
+
pageCount: 1,
|
|
45
|
+
},
|
|
46
|
+
global: {
|
|
47
|
+
plugins: [vuetify],
|
|
48
|
+
},
|
|
49
|
+
})
|
|
50
|
+
expect(wrapper.find('.sy-table-pagination').exists()).toBe(true)
|
|
51
|
+
expect(wrapper.find('.pagination').exists()).toBe(false)
|
|
52
|
+
})
|
|
53
|
+
|
|
54
|
+
it('always shows items per page selector even with only one page', () => {
|
|
55
|
+
const wrapper = mount(SyTablePagination, {
|
|
56
|
+
props: {
|
|
57
|
+
page: 1,
|
|
58
|
+
itemsPerPage: 10,
|
|
59
|
+
itemsLength: 5,
|
|
60
|
+
pageCount: 1,
|
|
61
|
+
},
|
|
62
|
+
global: {
|
|
63
|
+
plugins: [vuetify],
|
|
64
|
+
},
|
|
65
|
+
})
|
|
66
|
+
expect(wrapper.find('.sy-table-pagination').exists()).toBe(true)
|
|
67
|
+
expect(wrapper.find('.info').exists()).toBe(true)
|
|
68
|
+
expect(wrapper.findComponent({ name: 'SySelect' }).exists()).toBe(true)
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('includes standard options and current itemsPerPage value', async () => {
|
|
72
|
+
// Test with standard value
|
|
73
|
+
const wrapper1 = mount(SyTablePagination, {
|
|
74
|
+
props: {
|
|
75
|
+
page: 1,
|
|
76
|
+
itemsPerPage: 10, // Standard value
|
|
77
|
+
itemsLength: 42,
|
|
78
|
+
pageCount: 5,
|
|
79
|
+
},
|
|
80
|
+
global: {
|
|
81
|
+
plugins: [vuetify],
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const vm1 = wrapper1.vm as unknown as { itemsPerPageOptions: Array<{ text: string, value: number }> }
|
|
86
|
+
expect(vm1.itemsPerPageOptions).toBeDefined()
|
|
87
|
+
|
|
88
|
+
const options1 = vm1.itemsPerPageOptions
|
|
89
|
+
// Should have standard options 5, 10, 25, 50, 100) plus the 'All' option (-1)
|
|
90
|
+
expect(options1.map(o => o.value).sort((a, b) => a - b)).toEqual([-1, 5, 10, 25, 50, 100])
|
|
91
|
+
|
|
92
|
+
// Test with custom value
|
|
93
|
+
const wrapper2 = mount(SyTablePagination, {
|
|
94
|
+
props: {
|
|
95
|
+
page: 1,
|
|
96
|
+
itemsPerPage: 42, // Custom value
|
|
97
|
+
itemsLength: 100,
|
|
98
|
+
pageCount: 5,
|
|
99
|
+
},
|
|
100
|
+
global: {
|
|
101
|
+
plugins: [vuetify],
|
|
102
|
+
},
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
const vm2 = wrapper2.vm as unknown as { itemsPerPageOptions: Array<{ text: string, value: number }> }
|
|
106
|
+
const options2 = vm2.itemsPerPageOptions
|
|
107
|
+
|
|
108
|
+
// Should include the custom value (42)
|
|
109
|
+
const hasCustomValue = options2.some(option => option.value === 42)
|
|
110
|
+
expect(hasCustomValue).toBe(true)
|
|
111
|
+
|
|
112
|
+
// Should have standard options + custom value + 'All' option
|
|
113
|
+
expect(options2.map(o => o.value).sort((a, b) => a - b)).toEqual([-1, 5, 10, 25, 42, 50, 100])
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('shows correct range when "All" is selected', async () => {
|
|
117
|
+
const wrapper = mount(SyTablePagination, {
|
|
118
|
+
props: {
|
|
119
|
+
page: 1,
|
|
120
|
+
itemsPerPage: -1, // "All" option
|
|
121
|
+
itemsLength: 42,
|
|
122
|
+
pageCount: 1,
|
|
123
|
+
},
|
|
124
|
+
global: {
|
|
125
|
+
plugins: [vuetify],
|
|
126
|
+
},
|
|
127
|
+
})
|
|
128
|
+
|
|
129
|
+
const infoText = wrapper.find('.info').text()
|
|
130
|
+
expect(infoText).toContain('1-42')
|
|
131
|
+
})
|
|
132
|
+
|
|
133
|
+
it('emits update:page event when nextPage method is called', async () => {
|
|
134
|
+
const wrapper = mount(SyTablePagination, {
|
|
135
|
+
props: {
|
|
136
|
+
page: 1,
|
|
137
|
+
itemsPerPage: 10,
|
|
138
|
+
itemsLength: 100,
|
|
139
|
+
pageCount: 10,
|
|
140
|
+
},
|
|
141
|
+
global: {
|
|
142
|
+
plugins: [vuetify],
|
|
143
|
+
},
|
|
144
|
+
})
|
|
145
|
+
|
|
146
|
+
await (wrapper.vm as unknown as { nextPage: () => Promise<void> }).nextPage()
|
|
147
|
+
|
|
148
|
+
expect(wrapper.emitted('update:page')).toBeTruthy()
|
|
149
|
+
expect(wrapper.emitted('update:page')![0]).toEqual([2])
|
|
150
|
+
})
|
|
151
|
+
|
|
152
|
+
it('has the correct structure for items per page selection', () => {
|
|
153
|
+
const wrapper = mount(SyTablePagination, {
|
|
154
|
+
props: {
|
|
155
|
+
page: 1,
|
|
156
|
+
itemsPerPage: 10,
|
|
157
|
+
itemsLength: 100,
|
|
158
|
+
pageCount: 10,
|
|
159
|
+
},
|
|
160
|
+
global: {
|
|
161
|
+
plugins: [vuetify],
|
|
162
|
+
},
|
|
163
|
+
})
|
|
164
|
+
|
|
165
|
+
expect(wrapper.find('.rows-per-page-label').exists()).toBe(true)
|
|
166
|
+
|
|
167
|
+
const labelText = wrapper.find('.rows-per-page-label').text()
|
|
168
|
+
expect(labelText).toContain('Lignes par page')
|
|
169
|
+
})
|
|
170
|
+
})
|
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
import { vuetify } from '@tests/unit/setup'
|
|
2
|
+
import { mount } from '@vue/test-utils'
|
|
3
|
+
import { afterAll, describe, expect, it, vi } from 'vitest'
|
|
4
|
+
import SyTable from '../../SyTable/SyTable.vue'
|
|
5
|
+
import DateFilter from '../filters/DateFilter.vue'
|
|
6
|
+
import NumberFilter from '../filters/NumberFilter.vue'
|
|
7
|
+
import PeriodFilter from '../filters/PeriodFilter.vue'
|
|
8
|
+
import SelectFilter from '../filters/SelectFilter.vue'
|
|
9
|
+
import TextFilter from '../filters/TextFilter.vue'
|
|
10
|
+
|
|
11
|
+
const headers = [
|
|
12
|
+
{
|
|
13
|
+
title: 'Nom',
|
|
14
|
+
key: 'name',
|
|
15
|
+
filterable: true,
|
|
16
|
+
filterType: 'text' as const,
|
|
17
|
+
},
|
|
18
|
+
{
|
|
19
|
+
title: 'Date de naissance',
|
|
20
|
+
key: 'birthdate',
|
|
21
|
+
filterable: true,
|
|
22
|
+
filterType: 'period' as const,
|
|
23
|
+
},
|
|
24
|
+
]
|
|
25
|
+
|
|
26
|
+
const items = [
|
|
27
|
+
{
|
|
28
|
+
name: 'Alice',
|
|
29
|
+
birthdate: '1990-01-01',
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
name: 'Bob',
|
|
33
|
+
birthdate: '1985-05-15',
|
|
34
|
+
},
|
|
35
|
+
{
|
|
36
|
+
name: 'Charlie',
|
|
37
|
+
birthdate: '2000-12-31',
|
|
38
|
+
},
|
|
39
|
+
{
|
|
40
|
+
name: 'David',
|
|
41
|
+
birthdate: '1995-07-20',
|
|
42
|
+
},
|
|
43
|
+
]
|
|
44
|
+
|
|
45
|
+
describe('SyTable - filterByRange', () => {
|
|
46
|
+
vi.mock('../../common/filters/getFilterComponent', () => {
|
|
47
|
+
return {
|
|
48
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
49
|
+
default: (filterType?: string, filterOptions?: unknown) => {
|
|
50
|
+
if (filterType === 'select') {
|
|
51
|
+
return SelectFilter
|
|
52
|
+
}
|
|
53
|
+
else if (filterType === 'date') {
|
|
54
|
+
return DateFilter
|
|
55
|
+
}
|
|
56
|
+
else if (filterType === 'period') {
|
|
57
|
+
return PeriodFilter
|
|
58
|
+
}
|
|
59
|
+
else if (filterType === 'number') {
|
|
60
|
+
return NumberFilter
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return TextFilter
|
|
64
|
+
}
|
|
65
|
+
},
|
|
66
|
+
}
|
|
67
|
+
})
|
|
68
|
+
afterAll(() => {
|
|
69
|
+
vi.resetModules()
|
|
70
|
+
})
|
|
71
|
+
|
|
72
|
+
it('filter by max date', async () => {
|
|
73
|
+
const wrapper = mount(SyTable, {
|
|
74
|
+
global: {
|
|
75
|
+
plugins: [vuetify],
|
|
76
|
+
},
|
|
77
|
+
props: {
|
|
78
|
+
headers,
|
|
79
|
+
items,
|
|
80
|
+
showFilters: true,
|
|
81
|
+
suffix: 'test',
|
|
82
|
+
},
|
|
83
|
+
})
|
|
84
|
+
|
|
85
|
+
const expectedNames = ['Alice', 'Bob', 'Charlie', 'David']
|
|
86
|
+
expectedNames.forEach((element) => {
|
|
87
|
+
expect(wrapper.text()).toContain(element)
|
|
88
|
+
})
|
|
89
|
+
|
|
90
|
+
const endDate = wrapper.find('input[aria-label="Fin"]')
|
|
91
|
+
await endDate.setValue('01/01/2000')
|
|
92
|
+
|
|
93
|
+
const textContent = wrapper.text()
|
|
94
|
+
|
|
95
|
+
const filteredNames = ['Alice', 'Bob', 'David']
|
|
96
|
+
filteredNames.forEach((element) => {
|
|
97
|
+
expect(textContent).toContain(element)
|
|
98
|
+
})
|
|
99
|
+
const notFilteredNames = ['Charlie']
|
|
100
|
+
notFilteredNames.forEach((element) => {
|
|
101
|
+
expect(textContent).not.toContain(element)
|
|
102
|
+
})
|
|
103
|
+
})
|
|
104
|
+
|
|
105
|
+
it('filter by min date', async () => {
|
|
106
|
+
const wrapper = mount(SyTable, {
|
|
107
|
+
global: {
|
|
108
|
+
plugins: [vuetify],
|
|
109
|
+
},
|
|
110
|
+
props: {
|
|
111
|
+
headers,
|
|
112
|
+
items,
|
|
113
|
+
showFilters: true,
|
|
114
|
+
suffix: 'test',
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
const expectedNames = ['Alice', 'Bob', 'Charlie', 'David']
|
|
119
|
+
expectedNames.forEach((element) => {
|
|
120
|
+
expect(wrapper.text()).toContain(element)
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
const startDate = wrapper.find('input[aria-label="Début"]')
|
|
124
|
+
await startDate.setValue('01/01/1995')
|
|
125
|
+
|
|
126
|
+
const textContent = wrapper.text()
|
|
127
|
+
|
|
128
|
+
const filteredNames = ['Charlie', 'David']
|
|
129
|
+
filteredNames.forEach((element) => {
|
|
130
|
+
expect(textContent).toContain(element)
|
|
131
|
+
})
|
|
132
|
+
const notFilteredNames = ['Alice', 'Bob']
|
|
133
|
+
notFilteredNames.forEach((element) => {
|
|
134
|
+
expect(textContent).not.toContain(element)
|
|
135
|
+
})
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it('filter by min and max date', async () => {
|
|
139
|
+
const wrapper = mount(SyTable, {
|
|
140
|
+
global: {
|
|
141
|
+
plugins: [vuetify],
|
|
142
|
+
},
|
|
143
|
+
props: {
|
|
144
|
+
headers,
|
|
145
|
+
items,
|
|
146
|
+
showFilters: true,
|
|
147
|
+
suffix: 'test',
|
|
148
|
+
},
|
|
149
|
+
})
|
|
150
|
+
|
|
151
|
+
const expectedNames = ['Alice', 'Bob', 'Charlie', 'David']
|
|
152
|
+
expectedNames.forEach((element) => {
|
|
153
|
+
expect(wrapper.text()).toContain(element)
|
|
154
|
+
})
|
|
155
|
+
|
|
156
|
+
const startDate = wrapper.find('input[aria-label="Début"]')
|
|
157
|
+
await startDate.setValue('01/01/1989')
|
|
158
|
+
|
|
159
|
+
const endDate = wrapper.find('input[aria-label="Fin"]')
|
|
160
|
+
await endDate.setValue('01/01/2000')
|
|
161
|
+
|
|
162
|
+
const textContent = wrapper.text()
|
|
163
|
+
|
|
164
|
+
const filteredNames = ['Alice', 'David']
|
|
165
|
+
filteredNames.forEach((element) => {
|
|
166
|
+
expect(textContent).toContain(element)
|
|
167
|
+
})
|
|
168
|
+
const notFilteredNames = ['Charlie', 'Bob']
|
|
169
|
+
notFilteredNames.forEach((element) => {
|
|
170
|
+
expect(textContent).not.toContain(element)
|
|
171
|
+
})
|
|
172
|
+
})
|
|
173
|
+
|
|
174
|
+
it('updates the items when date changes', async () => {
|
|
175
|
+
const wrapper = mount(SyTable, {
|
|
176
|
+
global: {
|
|
177
|
+
plugins: [vuetify],
|
|
178
|
+
},
|
|
179
|
+
props: {
|
|
180
|
+
headers,
|
|
181
|
+
items,
|
|
182
|
+
showFilters: true,
|
|
183
|
+
suffix: 'test',
|
|
184
|
+
},
|
|
185
|
+
})
|
|
186
|
+
|
|
187
|
+
const startDate = wrapper.find('input[aria-label="Début"]')
|
|
188
|
+
await startDate.setValue('01/01/1990')
|
|
189
|
+
|
|
190
|
+
const endDate = wrapper.find('input[aria-label="Fin"]')
|
|
191
|
+
await endDate.setValue('01/01/2000')
|
|
192
|
+
|
|
193
|
+
const textContent = wrapper.text()
|
|
194
|
+
|
|
195
|
+
let filteredNames = ['Alice', 'David']
|
|
196
|
+
filteredNames.forEach((element) => {
|
|
197
|
+
expect(textContent).toContain(element)
|
|
198
|
+
})
|
|
199
|
+
let notFilteredNames = ['Bob', 'Charlie']
|
|
200
|
+
notFilteredNames.forEach((element) => {
|
|
201
|
+
expect(textContent).not.toContain(element)
|
|
202
|
+
})
|
|
203
|
+
|
|
204
|
+
await endDate.setValue('01/01/1995')
|
|
205
|
+
|
|
206
|
+
filteredNames = ['Alice']
|
|
207
|
+
filteredNames.forEach((element) => {
|
|
208
|
+
expect(wrapper.text()).toContain(element)
|
|
209
|
+
})
|
|
210
|
+
notFilteredNames = ['Bob', 'Charlie', 'David']
|
|
211
|
+
notFilteredNames.forEach((element) => {
|
|
212
|
+
expect(wrapper.text()).not.toContain(element)
|
|
213
|
+
})
|
|
214
|
+
})
|
|
215
|
+
})
|
|
@@ -59,20 +59,6 @@ describe('tableFilterUtils', () => {
|
|
|
59
59
|
expect(result[0].id).toBe(2)
|
|
60
60
|
})
|
|
61
61
|
|
|
62
|
-
it('should filter by period correctly', () => {
|
|
63
|
-
const filters: FilterOption[] = [
|
|
64
|
-
{
|
|
65
|
-
key: 'vacationPeriod',
|
|
66
|
-
value: { from: '01/07/2023', to: '31/07/2023' },
|
|
67
|
-
type: 'period',
|
|
68
|
-
},
|
|
69
|
-
]
|
|
70
|
-
const result = filterItems(testItems, filters)
|
|
71
|
-
expect(result).toHaveLength(2)
|
|
72
|
-
expect(result.map(item => item.id)).toContain(1)
|
|
73
|
-
expect(result.map(item => item.id)).toContain(3)
|
|
74
|
-
})
|
|
75
|
-
|
|
76
62
|
it('should apply multiple filters correctly', () => {
|
|
77
63
|
const filters: FilterOption[] = [
|
|
78
64
|
{ key: 'department', value: 'IT', type: 'select' },
|
|
@@ -48,49 +48,6 @@ describe('tableUtils', () => {
|
|
|
48
48
|
expect(storageKey.value).toBe('table')
|
|
49
49
|
})
|
|
50
50
|
|
|
51
|
-
it('should transform headers correctly', () => {
|
|
52
|
-
const options = ref<Partial<DataOptions>>({})
|
|
53
|
-
const componentAttributes = {
|
|
54
|
-
headers: [
|
|
55
|
-
{
|
|
56
|
-
text: 'ID',
|
|
57
|
-
key: 'id',
|
|
58
|
-
},
|
|
59
|
-
{
|
|
60
|
-
title: 'Name',
|
|
61
|
-
key: 'name',
|
|
62
|
-
},
|
|
63
|
-
{
|
|
64
|
-
key: 'age',
|
|
65
|
-
},
|
|
66
|
-
],
|
|
67
|
-
}
|
|
68
|
-
|
|
69
|
-
const { headers } = useTableUtils({
|
|
70
|
-
tableId: 'test-table',
|
|
71
|
-
prefix: 'table',
|
|
72
|
-
caption: 'Test Table',
|
|
73
|
-
componentAttributes,
|
|
74
|
-
options,
|
|
75
|
-
})
|
|
76
|
-
|
|
77
|
-
expect(headers.value).toEqual([
|
|
78
|
-
{
|
|
79
|
-
text: 'ID',
|
|
80
|
-
key: 'id',
|
|
81
|
-
title: 'ID',
|
|
82
|
-
},
|
|
83
|
-
{
|
|
84
|
-
title: 'Name',
|
|
85
|
-
key: 'name',
|
|
86
|
-
},
|
|
87
|
-
{
|
|
88
|
-
key: 'age',
|
|
89
|
-
title: undefined,
|
|
90
|
-
},
|
|
91
|
-
])
|
|
92
|
-
})
|
|
93
|
-
|
|
94
51
|
it('should handle undefined headers', () => {
|
|
95
52
|
const options = ref<Partial<DataOptions>>({})
|
|
96
53
|
const componentAttributes = {}
|
|
@@ -118,7 +75,6 @@ describe('tableUtils', () => {
|
|
|
118
75
|
const { optionsFacade } = useTableUtils({
|
|
119
76
|
tableId: 'test-table',
|
|
120
77
|
prefix: 'table',
|
|
121
|
-
itemsPerPage: 10,
|
|
122
78
|
caption: 'Test Table',
|
|
123
79
|
componentAttributes,
|
|
124
80
|
options,
|
|
@@ -126,8 +82,8 @@ describe('tableUtils', () => {
|
|
|
126
82
|
|
|
127
83
|
expect(optionsFacade.value).toEqual({
|
|
128
84
|
page: 2,
|
|
129
|
-
itemsPerPage: 10,
|
|
130
85
|
sortBy: [{ key: 'name', order: 'asc' }],
|
|
86
|
+
itemsPerPage: 10,
|
|
131
87
|
groupBy: undefined,
|
|
132
88
|
multiSort: undefined,
|
|
133
89
|
mustSort: undefined,
|
|
@@ -137,7 +93,6 @@ describe('tableUtils', () => {
|
|
|
137
93
|
it('should create propsFacade correctly for client table', () => {
|
|
138
94
|
const options = ref<Partial<DataOptions>>({})
|
|
139
95
|
const componentAttributes = {
|
|
140
|
-
'headers': [{ title: 'ID', key: 'id' }],
|
|
141
96
|
'items': [{ id: 1 }],
|
|
142
97
|
'onUpdate:options': vi.fn(),
|
|
143
98
|
}
|
|
@@ -151,7 +106,6 @@ describe('tableUtils', () => {
|
|
|
151
106
|
})
|
|
152
107
|
|
|
153
108
|
expect(propsFacade.value).toMatchObject({
|
|
154
|
-
headers: [{ title: 'ID', key: 'id' }],
|
|
155
109
|
items: [{ id: 1 }],
|
|
156
110
|
})
|
|
157
111
|
expect(propsFacade.value['onUpdate:options']).toBeUndefined()
|
|
@@ -160,7 +114,6 @@ describe('tableUtils', () => {
|
|
|
160
114
|
it('should create propsFacade correctly for server table', () => {
|
|
161
115
|
const options = ref<Partial<DataOptions>>({})
|
|
162
116
|
const componentAttributes = {
|
|
163
|
-
headers: [{ title: 'ID', key: 'id' }],
|
|
164
117
|
items: [{ id: 1 }],
|
|
165
118
|
}
|
|
166
119
|
|
|
@@ -174,7 +127,6 @@ describe('tableUtils', () => {
|
|
|
174
127
|
})
|
|
175
128
|
|
|
176
129
|
expect(propsFacade.value).toMatchObject({
|
|
177
|
-
headers: [{ title: 'ID', key: 'id' }],
|
|
178
130
|
items: [{ id: 1 }],
|
|
179
131
|
itemsLength: 100,
|
|
180
132
|
})
|
|
@@ -208,7 +160,9 @@ describe('tableUtils', () => {
|
|
|
208
160
|
it('should setup local storage correctly', () => {
|
|
209
161
|
mockLocalStorageUtility.getItem.mockReturnValue({
|
|
210
162
|
page: 2,
|
|
211
|
-
|
|
163
|
+
options: {
|
|
164
|
+
itemsPerPage: 20,
|
|
165
|
+
},
|
|
212
166
|
})
|
|
213
167
|
|
|
214
168
|
const options = ref<Partial<DataOptions>>({})
|
|
@@ -228,7 +182,9 @@ describe('tableUtils', () => {
|
|
|
228
182
|
expect(mockLocalStorageUtility.getItem).toHaveBeenCalledWith('table-test')
|
|
229
183
|
expect(localOptions.value).toEqual({
|
|
230
184
|
page: 2,
|
|
231
|
-
|
|
185
|
+
options: {
|
|
186
|
+
itemsPerPage: 20,
|
|
187
|
+
},
|
|
232
188
|
})
|
|
233
189
|
|
|
234
190
|
// Test watchOptions
|