@cnamts/synapse 1.0.23 → 1.0.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/AutocompleteFilter-BWLR3U7W.js +114 -0
- package/dist/AutocompleteFilter-D9jzRzAL.cjs +1 -0
- package/dist/{DateFilter-Dc-gSGwk.js → DateFilter-BpwFexzi.js} +1 -1
- package/dist/DateFilter-DTUl8hb1.cjs +1 -0
- package/dist/{NumberFilter-vP38Wp6j.js → NumberFilter-Bz_NTdX9.js} +3 -3
- package/dist/NumberFilter-MAEojdk0.cjs +1 -0
- package/dist/PeriodFilter-CC4WgIhl.cjs +1 -0
- package/dist/{PeriodFilter-Ba1uYUnT.js → PeriodFilter-DX_wy9g-.js} +1 -1
- package/dist/SelectFilter-BR3fvl-a.cjs +1 -0
- package/dist/SelectFilter-xqiPtPgX.js +135 -0
- package/dist/{TextFilter-B84dpnoq.js → TextFilter-BBl3JFqK.js} +7 -7
- package/dist/TextFilter-CCfYFl5F.cjs +1 -0
- package/dist/apLightTheme-CFSRrjv2.cjs +1 -0
- package/dist/apLightTheme-D1P4jcD0.js +1231 -0
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +7022 -9616
- package/dist/components/Amelipro/AmeliproCarousel/AmeliproCarousel.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/AmeliproPostalAddressCityRow.d.ts +40 -40
- package/dist/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressField.d.ts +60 -60
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +7168 -9762
- package/dist/components/Amelipro/AmeliproStepper/AmeliproStepper.d.ts +2 -2
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +7501 -10095
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +21 -21
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +41 -41
- package/dist/components/Amelipro/StructureMenu/StructureTabs/StructureTabs.d.ts +2 -2
- package/dist/components/CookiesSelection/CookiesInformation/CookiesInformation.d.ts +20 -498
- package/dist/components/Customs/Selects/SyAutocomplete/SyAutocomplete.d.ts +108 -146
- package/dist/components/Customs/Selects/SyInputSelect/SyInputSelect.d.ts +5 -5
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +12 -16
- package/dist/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.d.ts +8 -8
- package/dist/components/Customs/SyCheckbox/SyCheckbox.d.ts +28 -506
- package/dist/components/Customs/SyRadioGroup/SyRadioGroup.d.ts +28 -506
- package/dist/components/Customs/SyTextField/SyTextField.d.ts +65 -85
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +627 -771
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +315 -402
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +112 -155
- package/dist/components/DatePicker/composables/index.d.ts +1 -0
- package/dist/components/DatePicker/composables/useDatePickerFocusTrap.d.ts +11 -0
- package/dist/components/DatePicker/composables/useDateTextField.d.ts +4 -4
- package/dist/components/DatePicker/composables/useDateValidation.d.ts +3 -3
- package/dist/components/DatePicker/composables/useInputBlurHandler.d.ts +2 -2
- package/dist/components/DatePicker/composables/useManualDateValidation.d.ts +2 -2
- package/dist/components/HeaderNavigationBar/HeaderNavigationBar.d.ts +4 -4
- package/dist/components/HeaderToolbar/HeaderToolbar.d.ts +20 -28
- package/dist/components/LunarCalendar/useLunarCalendarValidation.d.ts +3 -3
- package/dist/components/MonthPicker/MonthPicker.d.ts +86 -122
- package/dist/components/MonthPicker/MonthPickerText/MonthPickerInput.d.ts +85 -121
- package/dist/components/NirField/NirField.d.ts +206 -270
- package/dist/components/NirField/locales.d.ts +10 -10
- package/dist/components/NirField/useNirValidation.d.ts +64 -0
- package/dist/components/PasswordField/PasswordField.d.ts +8 -9
- package/dist/components/PeriodField/PeriodField.d.ts +1352 -1640
- package/dist/components/PhoneField/PhoneField.d.ts +88 -124
- package/dist/components/RangeField/RangeSlider/RangeSlider.d.ts +12 -12
- package/dist/components/SyTextArea/SyTextArea.d.ts +34 -14
- package/dist/components/SyTextArea/useDefaultValidationRules.d.ts +11 -0
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +9 -6
- package/dist/components/Tables/SyTable/SyTable.d.ts +9 -6
- package/dist/components/Tables/common/SyTableFilter.d.ts +2 -3
- package/dist/components/Tables/common/SyTablePagination.d.ts +17 -19
- package/dist/components/Tables/common/filters/AutocompleteFilter.d.ts +120 -0
- package/dist/components/Tables/common/filters/locales.d.ts +0 -1
- package/dist/components/Tables/common/types.d.ts +19 -3
- package/dist/components/Tables/common/useClickableTableRow.d.ts +17 -0
- package/dist/components/Tables/common/usePagination.d.ts +3 -1
- package/dist/components/Tables/common/usePinnedColumns.d.ts +31 -0
- package/dist/components/Tables/common/useTableHeaders.d.ts +2 -0
- package/dist/components/Tables/common/useTableRowCheckboxAccessibility.d.ts +5 -0
- package/dist/components/UploadWorkflow/UploadWorkflow.d.ts +6 -6
- package/dist/composables/date/useDatePickerAccessibility.d.ts +1 -1
- package/dist/composables/rules/useFieldValidation.d.ts +4 -4
- package/dist/composables/unifyValidation/useCustomValidation.d.ts +8 -0
- package/dist/composables/unifyValidation/useValidation.d.ts +102 -0
- package/dist/composables/unifyValidation/useVuetifyValidation.d.ts +18 -0
- package/dist/composables/useFormFieldErrorHandling.d.ts +2 -2
- package/dist/composables/validation/useFormValidation.d.ts +11 -2
- package/dist/composables/validation/useValidation.d.ts +15 -9
- package/dist/design-system-v3.d.ts +2 -0
- package/dist/design-system-v3.js +186 -187
- package/dist/design-system-v3.umd.cjs +1 -1066
- package/dist/{main-aLKwdMi1.js → main-BtTqyn4z.js} +16434 -15672
- package/dist/main-C1e3eoxd.cjs +1067 -0
- package/dist/main.d.ts +0 -1
- package/dist/synapse.css +1 -0
- package/dist/tooth-11-D3sLWv2n.cjs +1 -0
- package/dist/tooth-12-CXrLuH03.cjs +1 -0
- package/dist/tooth-13-BSfo5fpT.cjs +1 -0
- package/dist/tooth-14-DMzulx0h.cjs +1 -0
- package/dist/tooth-15-BKRFVi-9.cjs +1 -0
- package/dist/tooth-16-CpuxAbuM.cjs +1 -0
- package/dist/tooth-17-BPoahUdg.cjs +1 -0
- package/dist/tooth-18-DhHJz8sy.cjs +1 -0
- package/dist/tooth-21-Dgd5hn_X.cjs +1 -0
- package/dist/tooth-22-C2Tn19sB.cjs +1 -0
- package/dist/tooth-23-C9uaaSGb.cjs +1 -0
- package/dist/tooth-24-BrK9UGpf.cjs +1 -0
- package/dist/tooth-25-CE_EfGNp.cjs +1 -0
- package/dist/tooth-26-Ctv4i9Fy.cjs +1 -0
- package/dist/tooth-27-C5J7JkWM.cjs +1 -0
- package/dist/tooth-28-Z9oWqjo0.cjs +1 -0
- package/dist/tooth-31-BrYqmkTi.cjs +1 -0
- package/dist/tooth-32-BNNR0oCZ.cjs +1 -0
- package/dist/tooth-33-DuxvqO2J.cjs +1 -0
- package/dist/tooth-34-BCSCXMB6.cjs +1 -0
- package/dist/tooth-35-BLUXkX88.cjs +1 -0
- package/dist/tooth-36-IrKHYqlA.cjs +1 -0
- package/dist/tooth-37-BYqpdMwo.cjs +1 -0
- package/dist/tooth-38-B_eNXXdu.cjs +1 -0
- package/dist/tooth-41-Ddva4Ot8.cjs +1 -0
- package/dist/tooth-42-szcDqlM0.cjs +1 -0
- package/dist/tooth-43-B3ka6rQm.cjs +1 -0
- package/dist/tooth-44-CazyQucj.cjs +1 -0
- package/dist/tooth-45-B4HQtc8n.cjs +1 -0
- package/dist/tooth-46-BPM40gbG.cjs +1 -0
- package/dist/tooth-47-Dvr20dlh.cjs +1 -0
- package/dist/tooth-48-Bd8ljGsF.cjs +1 -0
- package/dist/tooth-51-OBpwCOF3.cjs +1 -0
- package/dist/tooth-52-aKxyHcmq.cjs +1 -0
- package/dist/tooth-53-vCwJjTOc.cjs +1 -0
- package/dist/tooth-54-DsWu2iFy.cjs +1 -0
- package/dist/tooth-55-BxC1X2Dn.cjs +1 -0
- package/dist/tooth-61-BbLvxMQi.cjs +1 -0
- package/dist/tooth-62-CmTkWczP.cjs +1 -0
- package/dist/tooth-63-DI7l_2qI.cjs +1 -0
- package/dist/tooth-64-B21sOsJh.cjs +1 -0
- package/dist/tooth-65-D2ZC2VEr.cjs +1 -0
- package/dist/tooth-71-D473PPO5.cjs +1 -0
- package/dist/tooth-72-Drh1wnNu.cjs +1 -0
- package/dist/tooth-73-DzlwYI23.cjs +1 -0
- package/dist/tooth-74-8aGvcZPg.cjs +1 -0
- package/dist/tooth-75-BFK7At_r.cjs +1 -0
- package/dist/tooth-81-BZmR-I0M.cjs +1 -0
- package/dist/tooth-82-euVfUUZV.cjs +1 -0
- package/dist/tooth-83-KV010j64.cjs +1 -0
- package/dist/tooth-84-BBg1RjhZ.cjs +1 -0
- package/dist/tooth-85-Cr-kc1wM.cjs +1 -0
- package/dist/vuetifyConfig.js +561 -0
- package/dist/vuetifyConfig.umd.cjs +1 -0
- package/package.json +10 -4
- package/src/assets/overrides/_btns.scss +0 -6
- package/src/assets/overrides/_icons.scss +9 -1
- package/src/assets/overrides/_typography.scss +0 -10
- package/src/components/Amelipro/AmeliproAutoCompleteField/__tests__/__snapshots__/AmeliproAutoCompleteField.spec.ts.snap +2 -2
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproHeaderBrandSection/__tests__/__snapshots__/AmeliproHeaderBrandSection.spec.ts.snap +1 -1
- package/src/components/Amelipro/AmeliproTextArea/__tests__/__snapshots__/AmeliproTextArea.spec.ts.snap +2 -2
- package/src/components/Captcha/accessibilite/Accessibility.mdx +86 -8
- package/src/components/Captcha/tests/__snapshots__/Captcha.spec.ts.snap +12 -12
- package/src/components/ChipList/ChipList.stories.ts +0 -15
- package/src/components/ChipList/ChipList.vue +5 -1
- package/src/components/ChipList/accessibilite/Accessibility.mdx +83 -10
- package/src/components/ChipList/tests/ChipList.a11y.spec.ts +41 -0
- package/src/components/Customs/Selects/SelectBtnField/accessibilite/Accessibility.mdx +0 -9
- package/src/components/Customs/Selects/SyAutocomplete/SyAutocomplete.vue +22 -5
- package/src/components/Customs/Selects/SyAutocomplete/tests/SyAutocomplete.spec.ts +143 -0
- package/src/components/Customs/Selects/SyAutocomplete/utils/ariaManager.ts +14 -10
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.stories.ts +4 -4
- package/src/components/Customs/Selects/SyInputSelect/SyInputSelect.vue +8 -9
- package/src/components/Customs/Selects/SyInputSelect/tests/SyInputSelect.spec.ts +10 -10
- package/src/components/Customs/Selects/SySelect/SySelect.vue +14 -11
- package/src/components/Customs/Selects/SySelect/tests/SySelect.spec.ts +54 -0
- package/src/components/Customs/SyCheckBoxGroup/SyCheckBoxGroup.vue +6 -9
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +10 -16
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +16 -11
- package/src/components/Customs/SyCheckbox/accessibilite/Accessibility.mdx +35 -0
- package/src/components/Customs/SyCheckbox/tests/SyCheckbox.a11y.spec.ts +134 -2
- package/src/components/Customs/SyForm/SyForm.stories.ts +31 -5
- package/src/components/Customs/SyRadioGroup/SyRadioGroup.vue +4 -7
- package/src/components/Customs/SyTextField/SyTextField.mdx +1 -1
- package/src/components/Customs/SyTextField/SyTextField.stories.ts +29 -27
- package/src/components/Customs/SyTextField/SyTextField.vue +154 -157
- package/src/components/Customs/SyTextField/tests/SyTextField.a11y.spec.ts +32 -0
- package/src/components/Customs/SyTextField/tests/SyTextField.spec.ts +120 -11
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +62 -58
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +330 -223
- package/src/components/DatePicker/CalendarMode/accessibilite/Accessibility.mdx +82 -0
- package/src/components/DatePicker/CalendarMode/tests/DatePicker.a11y.spec.ts +141 -0
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +2 -56
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +195 -159
- package/src/components/DatePicker/ComplexDatePicker/accessibilite/Accessibility.mdx +76 -0
- package/src/components/DatePicker/ComplexDatePicker/tests/ComplexDatePicker.spec.ts +10 -10
- package/src/components/DatePicker/DatePickerValidationExample/CalendarMode.stories.ts +8 -8
- package/src/components/DatePicker/DatePickerValidationExample/ComplexDatePicker.stories.ts +106 -8
- package/src/components/DatePicker/DatePickerValidationExample/DateTextInput.stories.ts +12 -11
- package/src/components/DatePicker/DatePickerValidationExample/MultiMode.stories.ts +12 -12
- package/src/components/DatePicker/DateTextInput/DateRange.stories.ts +0 -12
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +63 -57
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +3 -0
- package/src/components/DatePicker/DateTextInput/accessibilite/Accessibility.mdx +66 -0
- package/src/components/DatePicker/DateTextInput/tests/DateTextInput.spec.ts +52 -1
- package/src/components/DatePicker/composables/index.ts +1 -0
- package/src/components/DatePicker/composables/tests/useCalendarKeyboardNavigation.spec.ts +109 -65
- package/src/components/DatePicker/composables/tests/useDatePickerFocusTrap.spec.ts +138 -0
- package/src/components/DatePicker/composables/tests/useDateValidation.spec.ts +74 -18
- package/src/components/DatePicker/composables/tests/useInputBlurHandler.spec.ts +39 -0
- package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +91 -0
- package/src/components/DatePicker/composables/useCalendarKeyboardNavigation.ts +442 -36
- package/src/components/DatePicker/composables/useDatePickerFocusTrap.ts +92 -0
- package/src/components/DatePicker/composables/useDateTextField.ts +7 -6
- package/src/components/DatePicker/composables/useDateValidation.ts +36 -35
- package/src/components/DatePicker/composables/useInputBlurHandler.ts +3 -3
- package/src/components/DatePicker/composables/useManualDateValidation.ts +6 -2
- package/src/components/DiacriticPicker/accessibilite/Accessibility.mdx +76 -8
- package/src/components/HeaderBar/HeaderBar.stories.ts +14 -2
- package/src/components/Logo/accessibilite/Accessibility.mdx +73 -11
- package/src/components/LogoBrandSection/accessibilite/Accessibility.mdx +85 -9
- package/src/components/LunarCalendar/tests/LunarCalendar.spec.ts +3 -1
- package/src/components/LunarCalendar/useLunarCalendarValidation.ts +4 -5
- package/src/components/MonthPicker/tests/MonthPicker.spec.ts +2 -1
- package/src/components/MonthPicker/tests/__snapshots__/MonthPicker.spec.ts.snap +7 -7
- package/src/components/NirField/NirField.stories.ts +4 -0
- package/src/components/NirField/NirField.vue +64 -260
- package/src/components/NirField/accessibilite/Accessibility.mdx +2 -2
- package/src/components/NirField/locales.ts +1 -1
- package/src/components/NirField/tests/NirField.spec.ts +6 -0
- package/src/components/NirField/useNirValidation.ts +271 -0
- package/src/components/PasswordField/PasswordField.stories.ts +4 -4
- package/src/components/PasswordField/PasswordField.vue +18 -24
- package/src/components/PasswordField/tests/PasswordField.spec.ts +6 -3
- package/src/components/PeriodField/PeriodField.stories.ts +4 -4
- package/src/components/PeriodField/PeriodField.vue +57 -57
- package/src/components/PeriodField/__tests__/PeriodField.async.spec.ts +32 -0
- package/src/components/PeriodField/accessibilite/Accessibility.mdx +68 -8
- package/src/components/PeriodField/tests/PeriodField.spec.ts +28 -2
- package/src/components/PhoneField/PhoneField.vue +5 -6
- package/src/components/PhoneField/tests/PhoneField.spec.ts +1 -0
- package/src/components/RangeField/RangeField.vue +6 -0
- package/src/components/SyTextArea/SyTextArea.stories.ts +138 -2
- package/src/components/SyTextArea/SyTextArea.vue +53 -23
- package/src/components/SyTextArea/tests/SyTextArea.spec.ts +126 -3
- package/src/components/SyTextArea/useDefaultValidationRules.ts +74 -0
- package/src/components/Tables/SyServerTable/SyServerTable.mdx +25 -0
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +673 -1
- package/src/components/Tables/SyServerTable/SyServerTable.vue +148 -91
- package/src/components/Tables/SyServerTable/tests/SyServerTable.a11y.spec.ts +58 -0
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +122 -0
- package/src/components/Tables/SyTable/SyTable.mdx +25 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +452 -1
- package/src/components/Tables/SyTable/SyTable.vue +130 -56
- package/src/components/Tables/SyTable/tests/SyTable.a11y.spec.ts +57 -0
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +108 -0
- package/src/components/Tables/common/SyTableFilter.vue +22 -2
- package/src/components/Tables/common/TableHeader.vue +5 -1
- package/src/components/Tables/common/filters/AutocompleteFilter.vue +160 -0
- package/src/components/Tables/common/filters/NumberFilter.vue +1 -1
- package/src/components/Tables/common/filters/SelectFilter.vue +10 -11
- package/src/components/Tables/common/filters/TextFilter.vue +1 -1
- package/src/components/Tables/common/filters/getFilterComponent.ts +8 -1
- package/src/components/Tables/common/filters/locales.ts +0 -1
- package/src/components/Tables/common/filters/tests/AutocompleteFilter.a11y.spec.ts +110 -0
- package/src/components/Tables/common/filters/tests/AutocompleteFilter.spec.ts +203 -0
- package/src/components/Tables/common/filters/tests/SelectFilter.a11y.spec.ts +104 -0
- package/src/components/Tables/common/filters/tests/SelectFilter.spec.ts +152 -16
- package/src/components/Tables/common/tableFilterUtils.ts +3 -0
- package/src/components/Tables/common/tableStyles.scss +48 -4
- package/src/components/Tables/common/tests/filterByRange.spec.ts +2 -1
- package/src/components/Tables/common/types.ts +13 -4
- package/src/components/Tables/common/useClickableTableRow.ts +103 -0
- package/src/components/Tables/common/usePagination.ts +13 -0
- package/src/components/Tables/common/usePinnedColumns.ts +237 -0
- package/src/components/Tables/common/useTableHeaders.ts +3 -3
- package/src/components/Tables/common/useTableRowCheckboxAccessibility.ts +41 -0
- package/src/composables/date/tests/useDatePickerAccessibility.spec.ts +2 -6
- package/src/composables/date/useDatePickerAccessibility.ts +42 -207
- package/src/composables/rules/tests/useFieldValidation.spec.ts +120 -120
- package/src/composables/rules/useFieldValidation.ts +34 -17
- package/src/composables/unifyValidation/tests/useCustomValidation.spec.ts +601 -0
- package/src/composables/unifyValidation/tests/useValidation.spec.ts +2048 -0
- package/src/composables/unifyValidation/tests/useVuetifyValidation.spec.ts +184 -0
- package/src/composables/unifyValidation/useCustomValidation.ts +95 -0
- package/src/composables/unifyValidation/useValidation.ts +190 -0
- package/src/composables/unifyValidation/useVuetifyValidation.ts +54 -0
- package/src/composables/useFormFieldErrorHandling.ts +4 -7
- package/src/composables/validation/tests/useFormValidation.spec.ts +14 -0
- package/src/composables/validation/tests/useValidation.spec.ts +116 -21
- package/src/composables/validation/useFormValidation.ts +20 -13
- package/src/composables/validation/useValidatable.ts +8 -1
- package/src/composables/validation/useValidation.ts +135 -99
- package/src/composantsVuetify/Introduction.mdx +48 -0
- package/src/composantsVuetify/VBtn/VBtn.mdx +72 -0
- package/src/composantsVuetify/VBtn/v-btn.stories.ts +121 -0
- package/src/composantsVuetify/VTooltip/VTooltip.mdx +32 -0
- package/src/composantsVuetify/VTooltip/v-tooltip.stories.ts +95 -0
- package/src/designTokens/tokens/cnam/cnamSemantic.ts +2 -2
- package/src/main.ts +0 -2
- package/src/stories/Components/Components.stories.ts +74 -9
- package/src/stories/Demarrer/Accueil.stories.ts +3 -3
- package/src/stories/GuideDuDev/Amelipro.mdx +15 -0
- package/src/stories/GuideDuDev/Amelipro.stories.ts +209 -0
- package/src/stories/GuideDuDev/vuetifyOptions.mdx +3 -3
- package/dist/SelectFilter-BioGT6Nn.js +0 -136
- package/dist/style.css +0 -1
- package/src/components/DatePicker/Accessibilite.mdx +0 -14
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<script setup lang="ts">
|
|
2
|
-
import { computed,
|
|
2
|
+
import { computed, onMounted, provide, ref, toRef, useAttrs, watch } from 'vue'
|
|
3
3
|
import type { VDataTable } from 'vuetify/components'
|
|
4
4
|
import SyCheckbox from '@/components/Customs/SyCheckbox/SyCheckbox.vue'
|
|
5
5
|
import SyTableFilter from '../common/SyTableFilter.vue'
|
|
@@ -18,6 +18,10 @@
|
|
|
18
18
|
import { useTableAria } from '../common/useTableAria'
|
|
19
19
|
import { useTableAccessibility } from '../common/tableAccessibilityUtils'
|
|
20
20
|
import useStoredOptions from '../common/useStoredOptions'
|
|
21
|
+
import { usePinnedColumns } from '../common/usePinnedColumns'
|
|
22
|
+
import { useClickableTableRow } from '../common/useClickableTableRow'
|
|
23
|
+
import { useTableRowCheckboxAccessibility } from '../common/useTableRowCheckboxAccessibility'
|
|
24
|
+
import type { ClickableTableRowPropsInput } from '../common/useClickableTableRow'
|
|
21
25
|
|
|
22
26
|
const props = withDefaults(defineProps<SyTableProps>(), {
|
|
23
27
|
caption: '',
|
|
@@ -30,12 +34,18 @@
|
|
|
30
34
|
striped: false,
|
|
31
35
|
showSelect: false,
|
|
32
36
|
showSelectSingle: false,
|
|
37
|
+
stickySelect: false,
|
|
33
38
|
multiSort: false,
|
|
34
39
|
mustSort: false,
|
|
35
40
|
itemsPerPageOptions: undefined,
|
|
36
41
|
headingLevel: 2,
|
|
42
|
+
clickableRow: false,
|
|
37
43
|
})
|
|
38
44
|
|
|
45
|
+
const emit = defineEmits<{
|
|
46
|
+
'row-click': [item: Record<string, unknown>]
|
|
47
|
+
}>()
|
|
48
|
+
|
|
39
49
|
const options = defineModel<Partial<DataOptions>>('options', {
|
|
40
50
|
required: false,
|
|
41
51
|
default: () => ({}),
|
|
@@ -59,7 +69,7 @@
|
|
|
59
69
|
const componentAttributes = useAttrs()
|
|
60
70
|
|
|
61
71
|
// Generate a unique ID for this table instance
|
|
62
|
-
const uniqueTableId = ref(`sy-table-${Math.random().toString(36).
|
|
72
|
+
const uniqueTableId = ref(`sy-table-${Math.random().toString(36).substring(2, 11)}`)
|
|
63
73
|
|
|
64
74
|
const { storedOptions, storeOptions } = useStoredOptions({
|
|
65
75
|
key: computed(() => props.suffix ? `table-${props.suffix}` : 'table'),
|
|
@@ -75,6 +85,16 @@
|
|
|
75
85
|
storedOptions: storedOptions.options,
|
|
76
86
|
})
|
|
77
87
|
|
|
88
|
+
const forwardedRowProps = computed<ClickableTableRowPropsInput>(() => {
|
|
89
|
+
return (propsFacade.value.rowProps ?? propsFacade.value['row-props']) as ClickableTableRowPropsInput
|
|
90
|
+
})
|
|
91
|
+
|
|
92
|
+
const { clickableRowProps } = useClickableTableRow({
|
|
93
|
+
clickableRow: toRef(props, 'clickableRow'),
|
|
94
|
+
rowProps: forwardedRowProps,
|
|
95
|
+
onRowClick: item => emit('row-click', item),
|
|
96
|
+
})
|
|
97
|
+
|
|
78
98
|
const { setupAccessibility } = useTableAccessibility({
|
|
79
99
|
tableId: uniqueTableId.value,
|
|
80
100
|
})
|
|
@@ -96,25 +116,12 @@
|
|
|
96
116
|
|
|
97
117
|
// Use the pagination composable
|
|
98
118
|
const itemsLength = computed(() => filteredItems.value.length)
|
|
99
|
-
const { page, pageCount, itemsPerPageValue, updateItemsPerPage,
|
|
119
|
+
const { page, pageCount, itemsPerPageValue, updateItemsPerPage, onUpdateOptions } = usePagination({
|
|
100
120
|
options,
|
|
101
121
|
itemsLength,
|
|
122
|
+
updateOptions,
|
|
102
123
|
})
|
|
103
124
|
|
|
104
|
-
// Defines a function to handle updating the data table options
|
|
105
|
-
function onUpdateOptions(newOptions: Partial<DataOptions>) {
|
|
106
|
-
if (isUpdatingItemsPerPage.value && typeof newOptions.itemsPerPage !== 'undefined') {
|
|
107
|
-
// Creates a copy of the received options
|
|
108
|
-
const rest = { ...newOptions }
|
|
109
|
-
delete (rest as Record<string, unknown>).itemsPerPage
|
|
110
|
-
// Updates the other options without modifying itemsPerPage
|
|
111
|
-
updateOptions(rest)
|
|
112
|
-
return
|
|
113
|
-
}
|
|
114
|
-
// In all other cases, simply updates the options with the new values
|
|
115
|
-
updateOptions(newOptions)
|
|
116
|
-
}
|
|
117
|
-
|
|
118
125
|
// Use the table checkbox composable
|
|
119
126
|
const { toggleAllRows, getItemValue } = useTableCheckbox({
|
|
120
127
|
items: filteredItems,
|
|
@@ -147,55 +154,41 @@
|
|
|
147
154
|
// Initialize generic accessibility adjustments (tabbable elements, etc.)
|
|
148
155
|
setupAccessibility()
|
|
149
156
|
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
// Function to add accessibility attributes to row checkboxes
|
|
154
|
-
const accessibilityRowCheckboxes = () => {
|
|
155
|
-
nextTick(() => {
|
|
156
|
-
const timeoutId = setTimeout(() => {
|
|
157
|
-
// Check if document is available (for test environment)
|
|
158
|
-
if (typeof document === 'undefined') return
|
|
159
|
-
|
|
160
|
-
const tableElement = document.getElementById(uniqueTableId.value)
|
|
161
|
-
if (!tableElement) return
|
|
162
|
-
|
|
163
|
-
// Find all row checkboxes
|
|
164
|
-
const rowCheckboxes = tableElement.querySelectorAll('td .v-selection-control input[type="checkbox"]')
|
|
165
|
-
rowCheckboxes.forEach((checkbox, index) => {
|
|
166
|
-
const rowLabel = `${locales.selectRow} ${index + 1}`
|
|
167
|
-
checkbox.setAttribute('aria-label', rowLabel)
|
|
168
|
-
checkbox.setAttribute('title', rowLabel)
|
|
169
|
-
})
|
|
170
|
-
}, 100) // Small delay to ensure DOM is updated
|
|
171
|
-
|
|
172
|
-
// Track timeout for cleanup
|
|
173
|
-
timeouts.value.push(timeoutId)
|
|
174
|
-
})
|
|
175
|
-
}
|
|
157
|
+
const { accessibilityRowCheckboxes } = useTableRowCheckboxAccessibility({
|
|
158
|
+
uniqueTableId: uniqueTableId.value,
|
|
159
|
+
})
|
|
176
160
|
|
|
177
161
|
// Watch for changes that might affect the table and update accessibility
|
|
178
162
|
watch(() => props.items, accessibilityRowCheckboxes, { deep: true })
|
|
179
163
|
watch(() => filteredItems.value, accessibilityRowCheckboxes)
|
|
180
164
|
watch(() => page.value, accessibilityRowCheckboxes)
|
|
165
|
+
watch(() => itemsPerPageValue.value, accessibilityRowCheckboxes)
|
|
181
166
|
|
|
182
|
-
// Apply accessibility attributes when component is mounted
|
|
183
167
|
onMounted(() => {
|
|
184
|
-
accessibilityRowCheckboxes()
|
|
185
168
|
setupAria()
|
|
186
169
|
})
|
|
187
170
|
|
|
188
|
-
// Clean up timeouts on unmount to prevent unhandled errors
|
|
189
|
-
onUnmounted(() => {
|
|
190
|
-
timeouts.value.forEach((timeoutId) => {
|
|
191
|
-
clearTimeout(timeoutId)
|
|
192
|
-
})
|
|
193
|
-
timeouts.value = []
|
|
194
|
-
})
|
|
195
|
-
|
|
196
171
|
// Create a reactive reference to column widths that will be provided to children
|
|
197
172
|
const reactiveColumnWidths = ref(storedOptions.columnWidths || {})
|
|
198
173
|
|
|
174
|
+
const {
|
|
175
|
+
showPinnedLeftShadow,
|
|
176
|
+
showPinnedRightShadow,
|
|
177
|
+
hasPinnedSelectLeft,
|
|
178
|
+
pinnedMeta,
|
|
179
|
+
pinnedEdgeVars,
|
|
180
|
+
displayHeadersWithPinned,
|
|
181
|
+
} = usePinnedColumns({
|
|
182
|
+
displayHeaders,
|
|
183
|
+
reactiveColumnWidths,
|
|
184
|
+
pinnedColumns: toRef(props, 'pinnedColumns'),
|
|
185
|
+
pinnedColumnKey: toRef(props, 'pinnedColumnKey'),
|
|
186
|
+
stickySelect: toRef(props, 'stickySelect'),
|
|
187
|
+
showSelect: toRef(props, 'showSelect'),
|
|
188
|
+
showSelectSingle: toRef(props, 'showSelectSingle'),
|
|
189
|
+
tableRef: table,
|
|
190
|
+
})
|
|
191
|
+
|
|
199
192
|
// Provide column widths and update function to child components
|
|
200
193
|
provide('columnWidths', reactiveColumnWidths)
|
|
201
194
|
provide('updateColumnWidth', (key: string, width: number | string) => {
|
|
@@ -224,7 +217,17 @@
|
|
|
224
217
|
<template>
|
|
225
218
|
<div
|
|
226
219
|
:id="uniqueTableId"
|
|
227
|
-
:class="[
|
|
220
|
+
:class="[
|
|
221
|
+
'sy-table',
|
|
222
|
+
{
|
|
223
|
+
'sy-table--striped': props.striped,
|
|
224
|
+
'sy-table--pinned-left-shadow': showPinnedLeftShadow,
|
|
225
|
+
'sy-table--pinned-right-shadow': showPinnedRightShadow,
|
|
226
|
+
'sy-table--pinned-select-left': hasPinnedSelectLeft,
|
|
227
|
+
'sy-table--select-single': props.showSelectSingle,
|
|
228
|
+
},
|
|
229
|
+
]"
|
|
230
|
+
:style="pinnedEdgeVars"
|
|
228
231
|
>
|
|
229
232
|
<!-- ARIA status region for row count announcements -->
|
|
230
233
|
<div
|
|
@@ -239,8 +242,9 @@
|
|
|
239
242
|
ref="table"
|
|
240
243
|
v-model="model"
|
|
241
244
|
color="primary"
|
|
242
|
-
:headers="
|
|
245
|
+
:headers="displayHeadersWithPinned"
|
|
243
246
|
v-bind="propsFacade"
|
|
247
|
+
:row-props="clickableRowProps"
|
|
244
248
|
:items="filteredItems"
|
|
245
249
|
:density="props.density"
|
|
246
250
|
:show-select="props.showSelect || props.showSelectSingle"
|
|
@@ -269,11 +273,25 @@
|
|
|
269
273
|
:key="column.key!"
|
|
270
274
|
>
|
|
271
275
|
<th
|
|
272
|
-
:class="
|
|
276
|
+
:class="[
|
|
277
|
+
{ 'checkbox-column': column.key === 'data-table-select' },
|
|
278
|
+
{
|
|
279
|
+
'sy-table__pinned': pinnedMeta.left[column.key!] !== undefined || pinnedMeta.right[column.key!] !== undefined,
|
|
280
|
+
'sy-table__pinned--left': pinnedMeta.left[column.key!] !== undefined,
|
|
281
|
+
'sy-table__pinned--right': pinnedMeta.right[column.key!] !== undefined,
|
|
282
|
+
'v-data-table-column--fixed': pinnedMeta.left[column.key!] !== undefined || pinnedMeta.right[column.key!] !== undefined,
|
|
283
|
+
},
|
|
284
|
+
]"
|
|
273
285
|
:style="{
|
|
274
286
|
...(getHeaderForColumn(column)?.maxWidth ? { maxWidth: getHeaderForColumn(column)?.maxWidth as any } : {}),
|
|
275
287
|
...(getHeaderForColumn(column)?.minWidth ? { minWidth: getHeaderForColumn(column)?.minWidth as any } : {}),
|
|
276
288
|
...(getHeaderForColumn(column)?.width ? { width: getHeaderForColumn(column)?.width as any } : {}),
|
|
289
|
+
...(pinnedMeta.left[column.key!] !== undefined
|
|
290
|
+
? { position: 'sticky', left: `${pinnedMeta.left[column.key!] }px`, zIndex: 'var(--sy-table-z-pinned-header)', background: 'var(--sy-table-header-bg-pinned)' }
|
|
291
|
+
: {}),
|
|
292
|
+
...(pinnedMeta.right[column.key!] !== undefined
|
|
293
|
+
? { position: 'sticky', right: `${pinnedMeta.right[column.key!] }px`, zIndex: 'var(--sy-table-z-pinned-header)', background: 'var(--sy-table-header-bg-pinned)' }
|
|
294
|
+
: {}),
|
|
277
295
|
}"
|
|
278
296
|
>
|
|
279
297
|
<template v-if="column.key === 'data-table-select' && props.showSelect && !props.showSelectSingle">
|
|
@@ -459,6 +477,7 @@
|
|
|
459
477
|
|
|
460
478
|
.sy-table :deep() {
|
|
461
479
|
@include tablestyles;
|
|
480
|
+
@include clickable-row-styles;
|
|
462
481
|
}
|
|
463
482
|
|
|
464
483
|
@mixin striped-rows {
|
|
@@ -475,4 +494,59 @@
|
|
|
475
494
|
max-width: fit-content;
|
|
476
495
|
}
|
|
477
496
|
|
|
497
|
+
.sy-table :deep(.sy-table__pinned) {
|
|
498
|
+
box-shadow: none;
|
|
499
|
+
opacity: 1 !important;
|
|
500
|
+
}
|
|
501
|
+
|
|
502
|
+
.sy-table--pinned-left-shadow :deep(.sy-table__pinned--left) {
|
|
503
|
+
box-shadow: 2px 0 6px -4px rgba(tokens.$grey-base, 0.6);
|
|
504
|
+
}
|
|
505
|
+
|
|
506
|
+
.sy-table--pinned-right-shadow :deep(.sy-table__pinned--right) {
|
|
507
|
+
box-shadow: -2px 0 6px -4px rgba(tokens.$grey-base, 0.6);
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
.sy-table--pinned-select-left :deep(.v-data-table__th--select),
|
|
511
|
+
.sy-table--pinned-select-left :deep(.v-data-table__td--select-row) {
|
|
512
|
+
opacity: 1 !important;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
.sy-table--pinned-select-left :deep(.v-data-table__th--select) {
|
|
516
|
+
position: sticky;
|
|
517
|
+
left: 0;
|
|
518
|
+
z-index: 5;
|
|
519
|
+
background: var(--sy-table-header-bg-pinned);
|
|
520
|
+
}
|
|
521
|
+
|
|
522
|
+
.sy-table--select-single.sy-table--pinned-select-left :deep(.v-data-table__th--select) {
|
|
523
|
+
box-shadow: none !important;
|
|
524
|
+
background: transparent !important;
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
/* stylelint-disable @stylistic/max-line-length */
|
|
528
|
+
.sy-table--select-single.sy-table--pinned-left-shadow.sy-table--pinned-select-left :deep(.v-table__wrapper > table > thead > tr > th:first-child) {
|
|
529
|
+
box-shadow: none !important;
|
|
530
|
+
background: transparent !important;
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
.sy-table--pinned-select-left :deep(.v-table__wrapper > table > tbody > tr:not(.v-data-table-rows-loading) > td:first-child),
|
|
534
|
+
.sy-table--pinned-select-left :deep(.v-table__wrapper > table > tbody > tr:not(.v-data-table-rows-loading) > .v-data-table__td:first-child),
|
|
535
|
+
.sy-table--pinned-select-left :deep(.v-data-table__tbody .v-data-table__tr:not(.v-data-table-rows-loading) > .v-data-table__td:first-child),
|
|
536
|
+
.sy-table--pinned-select-left :deep(.v-data-table__tbody tr:not(.v-data-table-rows-loading) > td:first-child) {
|
|
537
|
+
position: sticky !important;
|
|
538
|
+
left: 0 !important;
|
|
539
|
+
z-index: 3;
|
|
540
|
+
background: rgb(var(--v-theme-surface)) !important;
|
|
541
|
+
}
|
|
542
|
+
|
|
543
|
+
.sy-table--pinned-left-shadow.sy-table--pinned-select-left:not(.sy-table--select-single) :deep(.v-data-table__th--select),
|
|
544
|
+
.sy-table--pinned-left-shadow.sy-table--pinned-select-left :deep(.v-table__wrapper > table > tbody > tr:not(.v-data-table-rows-loading) > td:first-child),
|
|
545
|
+
.sy-table--pinned-left-shadow.sy-table--pinned-select-left :deep(.v-table__wrapper > table > tbody > tr:not(.v-data-table-rows-loading) > .v-data-table__td:first-child),
|
|
546
|
+
.sy-table--pinned-left-shadow.sy-table--pinned-select-left :deep(.v-data-table__tbody .v-data-table__tr:not(.v-data-table-rows-loading) > .v-data-table__td:first-child),
|
|
547
|
+
.sy-table--pinned-left-shadow.sy-table--pinned-select-left :deep(.v-data-table__tbody tr:not(.v-data-table-rows-loading) > td:first-child) {
|
|
548
|
+
box-shadow: 2px 0 6px -4px rgba(tokens.$grey-base, 0.6);
|
|
549
|
+
}
|
|
550
|
+
/* stylelint-enable @stylistic/max-line-length */
|
|
551
|
+
|
|
478
552
|
</style>
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// @vitest-environment jsdom
|
|
2
|
+
|
|
3
|
+
import { beforeAll, describe, it } from 'vitest'
|
|
4
|
+
import { mount } from '@vue/test-utils'
|
|
5
|
+
import { axe } from 'vitest-axe'
|
|
6
|
+
import { assertNoA11yViolations } from '@tests/unit/accessibility/axeUtils'
|
|
7
|
+
import type { DataOptions } from '@/components/Tables/common/types'
|
|
8
|
+
import SyTable from '../SyTable.vue'
|
|
9
|
+
|
|
10
|
+
const items = [
|
|
11
|
+
{ id: 1, name: 'John Doe', age: 25 },
|
|
12
|
+
{ id: 2, name: 'Jane Doe', age: 30 },
|
|
13
|
+
]
|
|
14
|
+
|
|
15
|
+
const headers = [
|
|
16
|
+
{ title: 'ID', key: 'id' },
|
|
17
|
+
{ title: 'Name', key: 'name' },
|
|
18
|
+
{ title: 'Age', key: 'age' },
|
|
19
|
+
]
|
|
20
|
+
|
|
21
|
+
describe('SyTable - accessibility (axe)', () => {
|
|
22
|
+
beforeAll(() => {
|
|
23
|
+
global.visualViewport = {
|
|
24
|
+
width: 1024,
|
|
25
|
+
height: 768,
|
|
26
|
+
scale: 1,
|
|
27
|
+
offsetLeft: 0,
|
|
28
|
+
offsetTop: 0,
|
|
29
|
+
pageLeft: 0,
|
|
30
|
+
pageTop: 0,
|
|
31
|
+
onresize: null,
|
|
32
|
+
onscroll: null,
|
|
33
|
+
addEventListener: () => {},
|
|
34
|
+
removeEventListener: () => {},
|
|
35
|
+
dispatchEvent: () => true,
|
|
36
|
+
}
|
|
37
|
+
})
|
|
38
|
+
|
|
39
|
+
it('has no obvious axe violations when rows are clickable and contain nested actions', async () => {
|
|
40
|
+
const wrapper = mount(SyTable, {
|
|
41
|
+
props: {
|
|
42
|
+
options: {} as DataOptions,
|
|
43
|
+
suffix: 'a11y-clickable-row-test',
|
|
44
|
+
clickableRow: true,
|
|
45
|
+
showSelect: true,
|
|
46
|
+
headers,
|
|
47
|
+
items,
|
|
48
|
+
},
|
|
49
|
+
attachTo: document.body,
|
|
50
|
+
})
|
|
51
|
+
|
|
52
|
+
const results = await axe(wrapper.element as HTMLElement)
|
|
53
|
+
assertNoA11yViolations(results, 'SyTable - clickableRow', {
|
|
54
|
+
ignoreRules: ['region', 'aria-allowed-attr', 'aria-prohibited-attr', 'label'],
|
|
55
|
+
})
|
|
56
|
+
})
|
|
57
|
+
})
|
|
@@ -191,6 +191,57 @@ describe('SyTable', () => {
|
|
|
191
191
|
expect(dataTable.props('itemsPerPage')).toBe(5)
|
|
192
192
|
})
|
|
193
193
|
|
|
194
|
+
it('makes rows clickable and emits row-click events', async () => {
|
|
195
|
+
const wrapper = mount(SyTable, {
|
|
196
|
+
props: {
|
|
197
|
+
options: {} as DataOptions,
|
|
198
|
+
suffix: 'clickable-row-test',
|
|
199
|
+
clickableRow: true,
|
|
200
|
+
headers,
|
|
201
|
+
items: fakeItems,
|
|
202
|
+
},
|
|
203
|
+
attachTo: document.body,
|
|
204
|
+
})
|
|
205
|
+
|
|
206
|
+
await wrapper.vm.$nextTick()
|
|
207
|
+
|
|
208
|
+
const firstRow = wrapper.find('tbody tr')
|
|
209
|
+
|
|
210
|
+
expect(firstRow.classes()).toContain('v-data-table__tr--clickable')
|
|
211
|
+
expect(firstRow.classes()).toContain('sy-table__clickable-row')
|
|
212
|
+
expect(firstRow.attributes('data-clickable-row')).toBe('true')
|
|
213
|
+
expect(firstRow.attributes('tabindex')).toBe('0')
|
|
214
|
+
expect(firstRow.attributes('role')).toBeUndefined()
|
|
215
|
+
|
|
216
|
+
await firstRow.trigger('click')
|
|
217
|
+
|
|
218
|
+
expect(wrapper.emitted('row-click')).toEqual([[fakeItems[0]]])
|
|
219
|
+
})
|
|
220
|
+
|
|
221
|
+
it('does not emit row-click when an interactive element inside the row is clicked', async () => {
|
|
222
|
+
const wrapper = mount(SyTable, {
|
|
223
|
+
props: {
|
|
224
|
+
options: {} as DataOptions,
|
|
225
|
+
suffix: 'clickable-row-nested-interactive-test',
|
|
226
|
+
clickableRow: true,
|
|
227
|
+
showSelect: true,
|
|
228
|
+
headers,
|
|
229
|
+
items: fakeItems,
|
|
230
|
+
},
|
|
231
|
+
attachTo: document.body,
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
await wrapper.vm.$nextTick()
|
|
235
|
+
|
|
236
|
+
const nestedCheckbox = wrapper.find('tbody .v-selection-control input')
|
|
237
|
+
|
|
238
|
+
expect(nestedCheckbox.exists()).toBe(true)
|
|
239
|
+
|
|
240
|
+
await nestedCheckbox.trigger('click')
|
|
241
|
+
|
|
242
|
+
expect(wrapper.emitted('row-click')).toBeUndefined()
|
|
243
|
+
})
|
|
244
|
+
|
|
194
245
|
it('should show filters when showFilters prop is true', async () => {
|
|
195
246
|
const wrapper = mount(SyTable, {
|
|
196
247
|
props: {
|
|
@@ -348,6 +399,41 @@ describe('SyTable', () => {
|
|
|
348
399
|
expect(wrapper.text()).toContain('No data available')
|
|
349
400
|
})
|
|
350
401
|
|
|
402
|
+
it('applies sticky styles for pinnedColumns (left/right) including data-table-select', async () => {
|
|
403
|
+
const wrapper = mount(SyTable, {
|
|
404
|
+
props: {
|
|
405
|
+
options: { itemsPerPage: 5 } as DataOptions,
|
|
406
|
+
suffix: 'pinned-columns-test',
|
|
407
|
+
showSelect: true,
|
|
408
|
+
pinnedColumns: [
|
|
409
|
+
'data-table-select',
|
|
410
|
+
{ key: 'name', side: 'left' },
|
|
411
|
+
{ key: 'age', side: 'right' },
|
|
412
|
+
],
|
|
413
|
+
},
|
|
414
|
+
attrs: {
|
|
415
|
+
items: fakeItems,
|
|
416
|
+
headers: headers,
|
|
417
|
+
},
|
|
418
|
+
attachTo: document.body,
|
|
419
|
+
})
|
|
420
|
+
|
|
421
|
+
await wrapper.vm.$nextTick()
|
|
422
|
+
await vi.dynamicImportSettled()
|
|
423
|
+
|
|
424
|
+
const pinnedTh = wrapper.findAll('th[style*="position: sticky"]')
|
|
425
|
+
expect(pinnedTh.length).toBeGreaterThan(0)
|
|
426
|
+
expect(pinnedTh.some(th => (th.attributes('style') || '').includes('left:'))).toBe(true)
|
|
427
|
+
expect(pinnedTh.some(th => (th.attributes('style') || '').includes('right:'))).toBe(true)
|
|
428
|
+
expect(pinnedTh.every(th => (th.attributes('style') || '').includes('background: var(--sy-table-header-bg-pinned)'))).toBe(true)
|
|
429
|
+
|
|
430
|
+
const pinnedTd = wrapper.findAll('tbody td[style*="position: sticky"]')
|
|
431
|
+
expect(pinnedTd.length).toBeGreaterThan(0)
|
|
432
|
+
expect(pinnedTd.some(td => (td.attributes('style') || '').includes('left:'))).toBe(true)
|
|
433
|
+
expect(pinnedTd.some(td => (td.attributes('style') || '').includes('right:'))).toBe(true)
|
|
434
|
+
expect(pinnedTd.every(td => (td.attributes('style') || '').includes('background: rgb(var(--v-theme-surface))'))).toBe(true)
|
|
435
|
+
})
|
|
436
|
+
|
|
351
437
|
it('enables selection when showSelect is true', async () => {
|
|
352
438
|
const wrapper = mount(SyTable, {
|
|
353
439
|
props: {
|
|
@@ -378,6 +464,28 @@ describe('SyTable', () => {
|
|
|
378
464
|
expect(dataTable.props('showSelect')).toBe(false)
|
|
379
465
|
})
|
|
380
466
|
|
|
467
|
+
it('makes selection column sticky when stickySelect is true', async () => {
|
|
468
|
+
const wrapper = mount(SyTable, {
|
|
469
|
+
props: {
|
|
470
|
+
options: { itemsPerPage: 5 } as DataOptions,
|
|
471
|
+
suffix: 'sticky-select-test',
|
|
472
|
+
showSelect: true,
|
|
473
|
+
stickySelect: true,
|
|
474
|
+
pinnedColumns: [{ key: 'age', side: 'right' }],
|
|
475
|
+
},
|
|
476
|
+
attrs: {
|
|
477
|
+
items: fakeItems,
|
|
478
|
+
headers: headers,
|
|
479
|
+
},
|
|
480
|
+
attachTo: document.body,
|
|
481
|
+
})
|
|
482
|
+
|
|
483
|
+
await wrapper.vm.$nextTick()
|
|
484
|
+
await vi.dynamicImportSettled()
|
|
485
|
+
|
|
486
|
+
expect(wrapper.classes()).toContain('sy-table--pinned-select-left')
|
|
487
|
+
})
|
|
488
|
+
|
|
381
489
|
it('passes the correct item-value function to the data table', async () => {
|
|
382
490
|
const wrapper = mount(SyTable, {
|
|
383
491
|
props: {
|
|
@@ -62,12 +62,14 @@
|
|
|
62
62
|
date: Record<string, DateValue>
|
|
63
63
|
period: Record<string, { from: string | null, to: string | null }>
|
|
64
64
|
select: Record<string, string | number | Record<string, unknown> | undefined>
|
|
65
|
+
autocomplete: Record<string, string | number | Record<string, unknown> | Array<string | number | Record<string, unknown>> | undefined>
|
|
65
66
|
}>({
|
|
66
67
|
text: {},
|
|
67
68
|
number: {},
|
|
68
69
|
date: {},
|
|
69
70
|
period: {},
|
|
70
71
|
select: {},
|
|
72
|
+
autocomplete: {},
|
|
71
73
|
})
|
|
72
74
|
|
|
73
75
|
// Computed properties pour accéder aux différents types de filtres
|
|
@@ -76,6 +78,7 @@
|
|
|
76
78
|
const dateFilters = computed(() => filtersMap.value.date)
|
|
77
79
|
const periodFilters = computed(() => filtersMap.value.period)
|
|
78
80
|
const selectFilters = computed(() => filtersMap.value.select)
|
|
81
|
+
const autocompleteFilters = computed(() => filtersMap.value.autocomplete)
|
|
79
82
|
|
|
80
83
|
// Fonction pour traiter un filtre individuel
|
|
81
84
|
function processFilter(filter: FilterOption) {
|
|
@@ -110,6 +113,9 @@
|
|
|
110
113
|
case 'select':
|
|
111
114
|
filtersMap.value.select[key] = value !== null ? value as string | number | Record<string, unknown> : undefined
|
|
112
115
|
break
|
|
116
|
+
case 'autocomplete':
|
|
117
|
+
filtersMap.value.autocomplete[key] = value !== null ? value as string | number | Record<string, unknown> | Array<string | number | Record<string, unknown>> : undefined
|
|
118
|
+
break
|
|
113
119
|
}
|
|
114
120
|
}
|
|
115
121
|
|
|
@@ -123,6 +129,7 @@
|
|
|
123
129
|
date: {},
|
|
124
130
|
period: {},
|
|
125
131
|
select: {},
|
|
132
|
+
autocomplete: {},
|
|
126
133
|
}
|
|
127
134
|
return
|
|
128
135
|
}
|
|
@@ -146,7 +153,10 @@
|
|
|
146
153
|
function getFilterValue(header: TableColumnHeader) {
|
|
147
154
|
const key = String(header.key || header.value || '')
|
|
148
155
|
|
|
149
|
-
if (header.filterType === '
|
|
156
|
+
if (header.filterType === 'autocomplete') {
|
|
157
|
+
return autocompleteFilters.value[key]
|
|
158
|
+
}
|
|
159
|
+
else if (header.filterType === 'select' || header.filterOptions) {
|
|
150
160
|
return selectFilters.value[key]
|
|
151
161
|
}
|
|
152
162
|
else if (header.filterType === 'date') {
|
|
@@ -167,7 +177,10 @@
|
|
|
167
177
|
function updateFilter(header: TableColumnHeader, value: unknown) {
|
|
168
178
|
const key = String(header.key || header.value || '')
|
|
169
179
|
|
|
170
|
-
if (header.filterType === '
|
|
180
|
+
if (header.filterType === 'autocomplete') {
|
|
181
|
+
filtersMap.value.autocomplete[key] = value as string | number | Record<string, unknown> | Array<string | number | Record<string, unknown>> | undefined
|
|
182
|
+
}
|
|
183
|
+
else if (header.filterType === 'select' || header.filterOptions) {
|
|
171
184
|
filtersMap.value.select[key] = value as string | number | Record<string, unknown> | undefined
|
|
172
185
|
}
|
|
173
186
|
else if (header.filterType === 'date') {
|
|
@@ -229,6 +242,13 @@
|
|
|
229
242
|
}
|
|
230
243
|
})
|
|
231
244
|
|
|
245
|
+
// Ajouter les filtres autocomplete
|
|
246
|
+
Object.entries(filtersMap.value.autocomplete).forEach(([filterKey, filterValue]) => {
|
|
247
|
+
if (filterValue !== undefined && filterValue !== null && !(Array.isArray(filterValue) && filterValue.length === 0)) {
|
|
248
|
+
newFilters.push({ key: filterKey, value: filterValue, type: 'autocomplete' })
|
|
249
|
+
}
|
|
250
|
+
})
|
|
251
|
+
|
|
232
252
|
updateFilters(newFilters)
|
|
233
253
|
}
|
|
234
254
|
</script>
|
|
@@ -217,7 +217,7 @@
|
|
|
217
217
|
<div
|
|
218
218
|
class="col-title"
|
|
219
219
|
:class="[textAlignClass, headerClassRaw]"
|
|
220
|
-
:style="
|
|
220
|
+
:style="headerStyle"
|
|
221
221
|
>
|
|
222
222
|
{{ column.title }}
|
|
223
223
|
</div>
|
|
@@ -266,6 +266,10 @@
|
|
|
266
266
|
</template>
|
|
267
267
|
|
|
268
268
|
<style lang="scss" scoped>
|
|
269
|
+
.v-data-table-header__content {
|
|
270
|
+
column-gap: 4px;
|
|
271
|
+
}
|
|
272
|
+
|
|
269
273
|
.sort-order-indicator {
|
|
270
274
|
font-size: 0.75rem;
|
|
271
275
|
font-weight: bold;
|