@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
|
@@ -5,6 +5,12 @@ import SelectFilter from '../SelectFilter.vue'
|
|
|
5
5
|
import SySelect from '@/components/Customs/Selects/SySelect/SySelect.vue'
|
|
6
6
|
import type { FilterType } from '../../types'
|
|
7
7
|
|
|
8
|
+
const sySelectStub = {
|
|
9
|
+
template: '<div class="sy-select-stub" data-testid="sy-select" :label="label" :items="items" :clearable="clearable" :density="density" :hideDetails="hideDetails" :multiple="multiple"></div>',
|
|
10
|
+
props: ['modelValue', 'label', 'items', 'clearable', 'density', 'hideDetails', 'hideMessages', 'disableErrorHandling', 'variant', 'multiple', 'chips'],
|
|
11
|
+
emits: ['update:modelValue', 'click:clear'],
|
|
12
|
+
}
|
|
13
|
+
|
|
8
14
|
describe('SelectFilter.vue', () => {
|
|
9
15
|
let wrapper: ReturnType<typeof mount<typeof SelectFilter>>
|
|
10
16
|
const header = {
|
|
@@ -21,10 +27,7 @@ describe('SelectFilter.vue', () => {
|
|
|
21
27
|
wrapper = mount(SelectFilter, {
|
|
22
28
|
global: {
|
|
23
29
|
stubs: {
|
|
24
|
-
SySelect:
|
|
25
|
-
template: '<div class="sy-select-stub" data-testid="sy-select" :label="label" :items="items" :clearable="clearable" :density="density" :hideDetails="hideDetails"></div>',
|
|
26
|
-
props: ['modelValue', 'label', 'items', 'clearable', 'density', 'hideDetails', 'hideMessages', 'disableErrorHandling', 'variant'],
|
|
27
|
-
},
|
|
30
|
+
SySelect: sySelectStub,
|
|
28
31
|
},
|
|
29
32
|
},
|
|
30
33
|
props: {
|
|
@@ -139,12 +142,7 @@ describe('SelectFilter.vue', () => {
|
|
|
139
142
|
}
|
|
140
143
|
const newWrapper = mount(SelectFilter, {
|
|
141
144
|
global: {
|
|
142
|
-
stubs: {
|
|
143
|
-
SySelect: {
|
|
144
|
-
template: '<div class="sy-select-stub" data-testid="sy-select"></div>',
|
|
145
|
-
props: ['modelValue', 'label', 'items', 'clearable', 'density', 'hideDetails'],
|
|
146
|
-
},
|
|
147
|
-
},
|
|
145
|
+
stubs: { SySelect: sySelectStub },
|
|
148
146
|
},
|
|
149
147
|
props: {
|
|
150
148
|
header: headerWithoutKey,
|
|
@@ -181,12 +179,7 @@ describe('SelectFilter.vue', () => {
|
|
|
181
179
|
}
|
|
182
180
|
const newWrapper = mount(SelectFilter, {
|
|
183
181
|
global: {
|
|
184
|
-
stubs: {
|
|
185
|
-
SySelect: {
|
|
186
|
-
template: '<div class="sy-select-stub" data-testid="sy-select"></div>',
|
|
187
|
-
props: ['modelValue', 'label', 'items', 'clearable', 'density', 'hideDetails'],
|
|
188
|
-
},
|
|
189
|
-
},
|
|
182
|
+
stubs: { SySelect: sySelectStub },
|
|
190
183
|
},
|
|
191
184
|
props: {
|
|
192
185
|
header: emptyHeader,
|
|
@@ -209,4 +202,147 @@ describe('SelectFilter.vue', () => {
|
|
|
209
202
|
// Restaurer Date.now
|
|
210
203
|
global.Date.now = originalDateNow
|
|
211
204
|
})
|
|
205
|
+
|
|
206
|
+
describe('filterOptions – removed default option', () => {
|
|
207
|
+
it('returns empty array when header has no filterOptions', () => {
|
|
208
|
+
const newWrapper = mount(SelectFilter, {
|
|
209
|
+
global: { stubs: { SySelect: sySelectStub } },
|
|
210
|
+
props: {
|
|
211
|
+
header: { title: 'Test', key: 'test' },
|
|
212
|
+
filters: [],
|
|
213
|
+
filterValue: undefined,
|
|
214
|
+
},
|
|
215
|
+
})
|
|
216
|
+
|
|
217
|
+
// SySelect receives items=[] — no "- choisir -" option injected
|
|
218
|
+
const sySelect = newWrapper.findComponent(SySelect)
|
|
219
|
+
expect(sySelect.props('items')).toEqual([])
|
|
220
|
+
})
|
|
221
|
+
|
|
222
|
+
it('does not prepend a default "- choisir -" option to filterOptions', () => {
|
|
223
|
+
const sySelect = wrapper.findComponent(SySelect)
|
|
224
|
+
const items = sySelect.props('items') as Array<{ text: string, value: unknown }>
|
|
225
|
+
const hasDefaultOption = items.some(i => i.text === '- choisir -')
|
|
226
|
+
expect(hasDefaultOption).toBe(false)
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
it('replaces empty-string option text with "(vide)"', () => {
|
|
230
|
+
const newWrapper = mount(SelectFilter, {
|
|
231
|
+
global: { stubs: { SySelect: sySelectStub } },
|
|
232
|
+
props: {
|
|
233
|
+
header: {
|
|
234
|
+
title: 'Test',
|
|
235
|
+
key: 'test',
|
|
236
|
+
filterOptions: [{ text: '', value: '' }],
|
|
237
|
+
},
|
|
238
|
+
filters: [],
|
|
239
|
+
filterValue: undefined,
|
|
240
|
+
},
|
|
241
|
+
})
|
|
242
|
+
|
|
243
|
+
const sySelect = newWrapper.findComponent(SySelect)
|
|
244
|
+
const items = sySelect.props('items') as Array<{ text: string, value: unknown }>
|
|
245
|
+
expect(items[0]?.text).toBe('(vide)')
|
|
246
|
+
})
|
|
247
|
+
})
|
|
248
|
+
|
|
249
|
+
describe('modelValue – null-based empty state (no defaultOption)', () => {
|
|
250
|
+
it('passes null to SySelect when filterValue is null', () => {
|
|
251
|
+
const newWrapper = mount(SelectFilter, {
|
|
252
|
+
global: { stubs: { SySelect: sySelectStub } },
|
|
253
|
+
props: { header, filters: [], filterValue: null },
|
|
254
|
+
})
|
|
255
|
+
|
|
256
|
+
const sySelect = newWrapper.findComponent(SySelect)
|
|
257
|
+
expect(sySelect.props('modelValue')).toBeNull()
|
|
258
|
+
})
|
|
259
|
+
|
|
260
|
+
it('passes null to SySelect when filterValue is undefined', () => {
|
|
261
|
+
const sySelect = wrapper.findComponent(SySelect)
|
|
262
|
+
expect(sySelect.props('modelValue')).toBeNull()
|
|
263
|
+
})
|
|
264
|
+
|
|
265
|
+
it('passes empty array to SySelect when filterValue is null and multiple=true', () => {
|
|
266
|
+
const newWrapper = mount(SelectFilter, {
|
|
267
|
+
global: { stubs: { SySelect: sySelectStub } },
|
|
268
|
+
props: {
|
|
269
|
+
header: { ...header, multiple: true },
|
|
270
|
+
filters: [],
|
|
271
|
+
filterValue: null,
|
|
272
|
+
},
|
|
273
|
+
})
|
|
274
|
+
|
|
275
|
+
const sySelect = newWrapper.findComponent(SySelect)
|
|
276
|
+
expect(sySelect.props('modelValue')).toEqual([])
|
|
277
|
+
})
|
|
278
|
+
})
|
|
279
|
+
|
|
280
|
+
describe('multiple prop – strict equality', () => {
|
|
281
|
+
it('does not enable multiple when header.multiple is undefined', () => {
|
|
282
|
+
const sySelect = wrapper.findComponent(SySelect)
|
|
283
|
+
expect(sySelect.props('multiple')).toBe(false)
|
|
284
|
+
})
|
|
285
|
+
|
|
286
|
+
it('does not enable multiple when header.multiple is a truthy non-boolean (e.g. string)', () => {
|
|
287
|
+
const newWrapper = mount(SelectFilter, {
|
|
288
|
+
global: { stubs: { SySelect: sySelectStub } },
|
|
289
|
+
props: {
|
|
290
|
+
header: { ...header, multiple: 'true' as unknown as boolean },
|
|
291
|
+
filters: [],
|
|
292
|
+
filterValue: undefined,
|
|
293
|
+
},
|
|
294
|
+
})
|
|
295
|
+
|
|
296
|
+
const sySelect = newWrapper.findComponent(SySelect)
|
|
297
|
+
expect(sySelect.props('multiple')).toBe(false)
|
|
298
|
+
})
|
|
299
|
+
|
|
300
|
+
it('enables multiple when header.multiple === true', () => {
|
|
301
|
+
const newWrapper = mount(SelectFilter, {
|
|
302
|
+
global: { stubs: { SySelect: sySelectStub } },
|
|
303
|
+
props: {
|
|
304
|
+
header: { ...header, multiple: true },
|
|
305
|
+
filters: [],
|
|
306
|
+
filterValue: undefined,
|
|
307
|
+
},
|
|
308
|
+
})
|
|
309
|
+
|
|
310
|
+
const sySelect = newWrapper.findComponent(SySelect)
|
|
311
|
+
expect(sySelect.props('multiple')).toBe(true)
|
|
312
|
+
})
|
|
313
|
+
|
|
314
|
+
it('emits array value when multiple=true and items are selected', async () => {
|
|
315
|
+
const newWrapper = mount(SelectFilter, {
|
|
316
|
+
global: { stubs: { SySelect: sySelectStub } },
|
|
317
|
+
props: {
|
|
318
|
+
header: { ...header, multiple: true },
|
|
319
|
+
filters: [],
|
|
320
|
+
filterValue: undefined,
|
|
321
|
+
},
|
|
322
|
+
})
|
|
323
|
+
|
|
324
|
+
const sySelect = newWrapper.findComponent(SySelect)
|
|
325
|
+
sySelect.vm.$emit('update:modelValue', ['option1', 'option2'])
|
|
326
|
+
|
|
327
|
+
expect(newWrapper.emitted('update:filters')![0]?.[0]).toEqual([
|
|
328
|
+
{ key: 'test', value: ['option1', 'option2'], type: 'select' as FilterType },
|
|
329
|
+
])
|
|
330
|
+
})
|
|
331
|
+
|
|
332
|
+
it('removes filter when multiple=true selection is cleared to empty array', async () => {
|
|
333
|
+
const newWrapper = mount(SelectFilter, {
|
|
334
|
+
global: { stubs: { SySelect: sySelectStub } },
|
|
335
|
+
props: {
|
|
336
|
+
header: { ...header, multiple: true },
|
|
337
|
+
filters: [{ key: 'test', value: ['option1'], type: 'select' as FilterType }],
|
|
338
|
+
filterValue: ['option1'],
|
|
339
|
+
},
|
|
340
|
+
})
|
|
341
|
+
|
|
342
|
+
const sySelect = newWrapper.findComponent(SySelect)
|
|
343
|
+
sySelect.vm.$emit('update:modelValue', [])
|
|
344
|
+
|
|
345
|
+
expect(newWrapper.emitted('update:filters')![0]?.[0]).toEqual([])
|
|
346
|
+
})
|
|
347
|
+
})
|
|
212
348
|
})
|
|
@@ -32,6 +32,9 @@ function applyFilter<T extends Items[0]>(item: T, filter: FilterOption): boolean
|
|
|
32
32
|
case 'select': {
|
|
33
33
|
return filterBySelect(itemValue, filterValue)
|
|
34
34
|
}
|
|
35
|
+
case 'autocomplete': {
|
|
36
|
+
return filterBySelect(itemValue, filterValue)
|
|
37
|
+
}
|
|
35
38
|
case 'custom': {
|
|
36
39
|
// Traiter les filtres personnalisés comme des filtres de sélection
|
|
37
40
|
return filterBySelect(itemValue, filterValue)
|
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
@use 'sass:color';
|
|
1
2
|
@use '@/assets/tokens';
|
|
2
3
|
|
|
3
4
|
@mixin tablestyles {
|
|
4
5
|
.v-table {
|
|
5
6
|
border: 1px solid tokens.$grey-lighten-80;
|
|
7
|
+
|
|
8
|
+
--sy-table-header-bg-pinned: #{color.mix(tokens.$blue-lighten-80, #fff, 20%)};
|
|
9
|
+
|
|
10
|
+
// Standardisation des z-index pour les tableaux
|
|
11
|
+
--sy-table-z-base: 1;
|
|
12
|
+
--sy-table-z-pinned-cell: calc(var(--sy-table-z-base) + 2);
|
|
13
|
+
--sy-table-z-pinned-header: calc(var(--sy-table-z-base) + 4);
|
|
14
|
+
--sy-table-z-progress: calc(var(--sy-table-z-base) + 5);
|
|
6
15
|
}
|
|
7
16
|
|
|
8
17
|
table thead tr {
|
|
@@ -20,10 +29,6 @@
|
|
|
20
29
|
background-color: rgba(tokens.$blue-lighten-80, 0.2);
|
|
21
30
|
}
|
|
22
31
|
|
|
23
|
-
&.row-clickable table tbody tr {
|
|
24
|
-
cursor: pointer;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
32
|
&.fixed-min-height {
|
|
28
33
|
.v-data-table__wrapper {
|
|
29
34
|
min-height: 540px;
|
|
@@ -81,4 +86,43 @@
|
|
|
81
86
|
.v-data-table-rows-no-data {
|
|
82
87
|
color: tokens.$grey-base;
|
|
83
88
|
}
|
|
89
|
+
|
|
90
|
+
// Ensure loading progress bar appears above sticky/pinned header cells
|
|
91
|
+
.v-data-table-progress th {
|
|
92
|
+
position: sticky;
|
|
93
|
+
top: 0;
|
|
94
|
+
z-index: var(--sy-table-z-progress);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
@mixin clickable-row-styles {
|
|
99
|
+
.v-table tbody > tr.sy-table__clickable-row,
|
|
100
|
+
.v-data-table__tbody > tr.sy-table__clickable-row {
|
|
101
|
+
cursor: pointer !important;
|
|
102
|
+
outline-offset: -2px;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
.v-table tbody > tr.sy-table__clickable-row:focus-visible,
|
|
106
|
+
.v-data-table__tbody > tr.sy-table__clickable-row:focus-visible {
|
|
107
|
+
outline: 2px solid tokens.$primary-base;
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
.v-table tbody > tr.sy-table__clickable-row > td,
|
|
111
|
+
.v-table tbody > tr.sy-table__clickable-row > .v-data-table__td,
|
|
112
|
+
.v-data-table__tbody > tr.sy-table__clickable-row > td,
|
|
113
|
+
.v-data-table__tbody > tr.sy-table__clickable-row > .v-data-table__td {
|
|
114
|
+
cursor: pointer !important;
|
|
115
|
+
transition: background-color 0.15s ease;
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
.v-table tbody > tr.sy-table__clickable-row:hover > td,
|
|
119
|
+
.v-table tbody > tr.sy-table__clickable-row:hover > .v-data-table__td,
|
|
120
|
+
.v-table tbody > tr.sy-table__clickable-row:focus-visible > td,
|
|
121
|
+
.v-table tbody > tr.sy-table__clickable-row:focus-visible > .v-data-table__td,
|
|
122
|
+
.v-data-table__tbody > tr.sy-table__clickable-row:hover > td,
|
|
123
|
+
.v-data-table__tbody > tr.sy-table__clickable-row:hover > .v-data-table__td,
|
|
124
|
+
.v-data-table__tbody > tr.sy-table__clickable-row:focus-visible > td,
|
|
125
|
+
.v-data-table__tbody > tr.sy-table__clickable-row:focus-visible > .v-data-table__td {
|
|
126
|
+
background-color: rgba(tokens.$primary-base, 0.08) !important;
|
|
127
|
+
}
|
|
84
128
|
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { mount } from '@vue/test-utils'
|
|
1
|
+
import { flushPromises, mount } from '@vue/test-utils'
|
|
2
2
|
import { afterAll, describe, expect, it, vi } from 'vitest'
|
|
3
3
|
import SyTable from '../../SyTable/SyTable.vue'
|
|
4
4
|
import DateFilter from '../filters/DateFilter.vue'
|
|
@@ -189,6 +189,7 @@ describe('SyTable - filterByRange', () => {
|
|
|
189
189
|
})
|
|
190
190
|
|
|
191
191
|
await endDate.setValue('01/01/1995')
|
|
192
|
+
await flushPromises()
|
|
192
193
|
|
|
193
194
|
filteredNames = ['Alice']
|
|
194
195
|
filteredNames.forEach((element) => {
|
|
@@ -3,12 +3,12 @@ export type SortOptions = {
|
|
|
3
3
|
order: 'desc' | 'asc'
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
export type FilterType = 'text' | 'number' | 'date' | 'period' | 'select' | 'custom'
|
|
6
|
+
export type FilterType = 'text' | 'number' | 'date' | 'period' | 'select' | 'autocomplete' | 'custom'
|
|
7
7
|
type FilterValue =
|
|
8
8
|
| string
|
|
9
9
|
| number
|
|
10
10
|
| Date
|
|
11
|
-
| Array<string | number | Date
|
|
11
|
+
| Array<string | number | Date | Record<string, unknown>>
|
|
12
12
|
| { from: string | null, to: string | null }
|
|
13
13
|
| Record<string, unknown>
|
|
14
14
|
| null
|
|
@@ -53,6 +53,7 @@ export type DataTableHeaders = {
|
|
|
53
53
|
maxWidth?: string | number
|
|
54
54
|
minWidth?: string | number
|
|
55
55
|
headerProps?: Record<string, unknown>
|
|
56
|
+
cellProps?: Record<string, unknown>
|
|
56
57
|
}
|
|
57
58
|
|
|
58
59
|
// Type to handle both Vuetify internal headers and our custom headers
|
|
@@ -74,7 +75,8 @@ export type TableColumnHeader = {
|
|
|
74
75
|
children?: unknown[]
|
|
75
76
|
maxWidth?: string | number
|
|
76
77
|
minWidth?: string | number
|
|
77
|
-
headerProps?:
|
|
78
|
+
headerProps?: unknown
|
|
79
|
+
cellProps?: unknown
|
|
78
80
|
[key: string]: unknown // Allow for any additional properties from Vuetify
|
|
79
81
|
}
|
|
80
82
|
|
|
@@ -93,12 +95,16 @@ export type SyTableProps = {
|
|
|
93
95
|
headers?: DataTableHeaders[]
|
|
94
96
|
showSelect?: boolean
|
|
95
97
|
showSelectSingle?: boolean
|
|
98
|
+
stickySelect?: boolean
|
|
96
99
|
showExpand?: boolean
|
|
97
100
|
selectionKey?: string
|
|
98
101
|
multiSort?: boolean
|
|
99
102
|
mustSort?: boolean
|
|
100
103
|
itemsPerPageOptions?: number[]
|
|
101
104
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
|
|
105
|
+
pinnedColumns?: Array<string | { key: string, side?: 'left' | 'right' }>
|
|
106
|
+
pinnedColumnKey?: string
|
|
107
|
+
clickableRow?: boolean
|
|
102
108
|
}
|
|
103
109
|
|
|
104
110
|
export type SyServerTableProps = {
|
|
@@ -116,11 +122,14 @@ export type SyServerTableProps = {
|
|
|
116
122
|
headers?: DataTableHeaders[]
|
|
117
123
|
showSelect?: boolean
|
|
118
124
|
showSelectSingle?: boolean
|
|
125
|
+
stickySelect?: boolean
|
|
119
126
|
showExpand?: boolean
|
|
120
127
|
selectionKey?: string
|
|
121
128
|
multiSort?: boolean
|
|
122
129
|
mustSort?: boolean
|
|
123
130
|
itemsPerPageOptions?: number[]
|
|
124
131
|
headingLevel?: 1 | 2 | 3 | 4 | 5 | 6
|
|
125
|
-
|
|
132
|
+
pinnedColumns?: Array<string | { key: string, side?: 'left' | 'right' }>
|
|
133
|
+
pinnedColumnKey?: string
|
|
134
|
+
clickableRow?: boolean
|
|
126
135
|
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { computed, type ComputedRef, type Ref } from 'vue'
|
|
2
|
+
|
|
3
|
+
type ClickableTableItem = Record<string, unknown>
|
|
4
|
+
|
|
5
|
+
type TableRowData = {
|
|
6
|
+
index: number
|
|
7
|
+
item: ClickableTableItem
|
|
8
|
+
internalItem: unknown
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
type TableRowEventHandler<TEvent extends Event> = ((event: TEvent) => void) | Array<(event: TEvent) => void>
|
|
12
|
+
type TableRowProps = Record<string, unknown>
|
|
13
|
+
export type ClickableTableRowPropsInput = TableRowProps | ((data: TableRowData) => TableRowProps) | undefined
|
|
14
|
+
|
|
15
|
+
function callEventHandler<TEvent extends Event>(handler: TableRowEventHandler<TEvent> | unknown, event: TEvent): void {
|
|
16
|
+
if (Array.isArray(handler)) {
|
|
17
|
+
handler.forEach((currentHandler) => {
|
|
18
|
+
currentHandler(event)
|
|
19
|
+
})
|
|
20
|
+
return
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
if (typeof handler === 'function') {
|
|
24
|
+
handler(event)
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function resolveRowProps(rowProps: ClickableTableRowPropsInput, data: TableRowData): TableRowProps {
|
|
29
|
+
if (typeof rowProps === 'function') {
|
|
30
|
+
return rowProps(data)
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
return rowProps ?? {}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function isElementInteractive(element: HTMLElement | null): boolean {
|
|
37
|
+
if (!element) {
|
|
38
|
+
return false
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
return Boolean(element.closest('a, button, input, select, textarea, summary, [role="button"], [role="link"], [role="checkbox"], [role="menuitem"], [contenteditable="true"], [data-sy-row-click-ignore]'))
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
function isFromNestedInteractiveElement(event: Event): boolean {
|
|
45
|
+
const target = event.target as HTMLElement | null
|
|
46
|
+
const currentTarget = event.currentTarget as HTMLElement | null
|
|
47
|
+
|
|
48
|
+
if (!target || !currentTarget || target === currentTarget) {
|
|
49
|
+
return false
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
return isElementInteractive(target)
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
export function useClickableTableRow({
|
|
56
|
+
clickableRow,
|
|
57
|
+
rowProps,
|
|
58
|
+
onRowClick,
|
|
59
|
+
}: {
|
|
60
|
+
clickableRow: Ref<boolean>
|
|
61
|
+
rowProps: ComputedRef<ClickableTableRowPropsInput>
|
|
62
|
+
onRowClick: (item: ClickableTableItem) => void
|
|
63
|
+
}) {
|
|
64
|
+
const clickableRowProps = computed<ClickableTableRowPropsInput>(() => {
|
|
65
|
+
if (!clickableRow.value) {
|
|
66
|
+
return rowProps.value
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
return (data: TableRowData) => {
|
|
70
|
+
const baseRowProps = resolveRowProps(rowProps.value, data)
|
|
71
|
+
|
|
72
|
+
return {
|
|
73
|
+
...baseRowProps,
|
|
74
|
+
'class': ['sy-table__clickable-row', baseRowProps.class].filter(Boolean),
|
|
75
|
+
'data-clickable-row': true,
|
|
76
|
+
'tabindex': baseRowProps.tabindex ?? 0,
|
|
77
|
+
'onClick': (event: MouseEvent) => {
|
|
78
|
+
callEventHandler(baseRowProps.onClick as TableRowEventHandler<MouseEvent> | unknown, event)
|
|
79
|
+
|
|
80
|
+
if (!event.defaultPrevented && !isFromNestedInteractiveElement(event)) {
|
|
81
|
+
onRowClick(data.item)
|
|
82
|
+
}
|
|
83
|
+
},
|
|
84
|
+
'onKeydown': (event: KeyboardEvent) => {
|
|
85
|
+
callEventHandler(baseRowProps.onKeydown as TableRowEventHandler<KeyboardEvent> | unknown, event)
|
|
86
|
+
|
|
87
|
+
if (event.defaultPrevented || isFromNestedInteractiveElement(event)) {
|
|
88
|
+
return
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
if (event.key === 'Enter' || event.key === ' ') {
|
|
92
|
+
event.preventDefault()
|
|
93
|
+
onRowClick(data.item)
|
|
94
|
+
}
|
|
95
|
+
},
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
})
|
|
99
|
+
|
|
100
|
+
return {
|
|
101
|
+
clickableRowProps,
|
|
102
|
+
}
|
|
103
|
+
}
|
|
@@ -11,9 +11,11 @@ import type { DataOptions } from './types'
|
|
|
11
11
|
export function usePagination({
|
|
12
12
|
options,
|
|
13
13
|
itemsLength,
|
|
14
|
+
updateOptions,
|
|
14
15
|
}: {
|
|
15
16
|
options: Ref<Partial<DataOptions>>
|
|
16
17
|
itemsLength: Ref<number>
|
|
18
|
+
updateOptions: (opts: Partial<DataOptions>) => void
|
|
17
19
|
}) {
|
|
18
20
|
// Flag to indicate an ongoing items-per-page update cycle
|
|
19
21
|
const isUpdatingItemsPerPage = ref(false)
|
|
@@ -58,11 +60,22 @@ export function usePagination({
|
|
|
58
60
|
isUpdatingItemsPerPage.value = false
|
|
59
61
|
}
|
|
60
62
|
|
|
63
|
+
function onUpdateOptions(newOptions: Partial<DataOptions>) {
|
|
64
|
+
if (isUpdatingItemsPerPage.value && typeof newOptions.itemsPerPage !== 'undefined') {
|
|
65
|
+
const rest = { ...newOptions }
|
|
66
|
+
delete (rest as Record<string, unknown>).itemsPerPage
|
|
67
|
+
updateOptions(rest)
|
|
68
|
+
return
|
|
69
|
+
}
|
|
70
|
+
updateOptions(newOptions)
|
|
71
|
+
}
|
|
72
|
+
|
|
61
73
|
return {
|
|
62
74
|
page,
|
|
63
75
|
pageCount,
|
|
64
76
|
itemsPerPageValue,
|
|
65
77
|
updateItemsPerPage,
|
|
66
78
|
isUpdatingItemsPerPage,
|
|
79
|
+
onUpdateOptions,
|
|
67
80
|
}
|
|
68
81
|
}
|