@cnamts/synapse 1.0.13 → 1.0.15
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 +72 -72
- package/dist/{DateFilter-_EFzsvvM.js → DateFilter-isr8mXVb.js} +1 -1
- package/dist/{NumberFilter-CUxEbKJh.js → NumberFilter-BOe7DqWX.js} +1 -1
- package/dist/{PeriodFilter-D5ueqtKy.js → PeriodFilter-WTprpO40.js} +1 -1
- package/dist/{SelectFilter-BciBNydy.js → SelectFilter-CqlG5dmI.js} +1 -1
- package/dist/{TextFilter-DMN_WAQB.js → TextFilter-fVW5bsRw.js} +1 -1
- package/dist/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.d.ts +60 -28
- package/dist/components/Amelipro/AmeliproFilePreview/AmeliproFilePreview.d.ts +3 -3
- package/dist/components/Amelipro/AmeliproSelect/AmeliproSelect.d.ts +60 -28
- package/dist/components/Amelipro/AmeliproTabs/AmeliproTabs.d.ts +61 -29
- package/dist/components/Amelipro/AmeliproTextArea/AmeliproTextArea.d.ts +5 -1
- package/dist/components/Amelipro/AmeliproTextField/AmeliproTextField.d.ts +3 -1
- package/dist/components/Amelipro/StructureMenu/StructureTabs/StructureTabs.d.ts +1 -1
- package/dist/components/Captcha/Captcha.d.ts +2 -0
- package/dist/components/Captcha/CaptchaBase.d.ts +1 -0
- package/dist/components/Customs/Selects/SySelect/SySelect.d.ts +29 -17
- package/dist/components/Customs/SyTabs/SyTabs.d.ts +20 -0
- package/dist/components/DatePicker/CalendarMode/DatePicker.d.ts +100 -10
- package/dist/components/DatePicker/ComplexDatePicker/ComplexDatePicker.d.ts +108 -21
- package/dist/components/DatePicker/DateTextInput/DateTextInput.d.ts +6 -6
- package/dist/components/DatePicker/composables/useDateFormatDisplay.d.ts +3 -0
- package/dist/components/DatePicker/tests/setup.d.ts +768 -48
- package/dist/components/FilterSideBar/FilterSideBar.d.ts +8 -0
- package/dist/components/HeaderToolbar/HeaderToolbar.d.ts +58 -34
- package/dist/components/LangBtn/LangBtn.d.ts +4 -0
- package/dist/components/PeriodField/PeriodField.d.ts +192 -12
- package/dist/components/RatingPicker/RatingPicker.d.ts +9 -0
- package/dist/components/SearchListField/SearchListField.d.ts +42 -413
- package/dist/components/SearchListField/locales.d.ts +1 -2
- package/dist/components/SyAlert/SyAlert.d.ts +1 -1
- package/dist/components/SyTextArea/SyTextArea.d.ts +2 -0
- package/dist/components/Tables/SyServerTable/SyServerTable.d.ts +15 -8
- package/dist/components/Tables/SyTable/SyTable.d.ts +15 -8
- package/dist/components/Tables/common/SyTablePagination.d.ts +29 -17
- package/dist/components/Tables/common/organizeColumns/OrganizeColumns.d.ts +4 -0
- package/dist/components/Tables/common/types.d.ts +2 -0
- package/dist/design-system-v3.js +1 -1
- package/dist/design-system-v3.umd.cjs +32 -16
- package/dist/{main-DISHlqcd.js → main-CbBVJ_le.js} +9911 -9751
- package/dist/style.css +1 -1
- package/package.json +5 -2
- package/src/assets/amelipro/icons.ts +17 -0
- package/src/components/Amelipro/AmeliproAccordionFrieze/AmeliproAccordionFrieze.stories.ts +40 -36
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/AmeliproAccordionGroup.spec.ts +226 -26
- package/src/components/Amelipro/AmeliproAccordionGroup/__tests__/__snapshots__/AmeliproAccordionGroup.spec.ts.snap +55 -506
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.stories.ts +1 -1
- package/src/components/Amelipro/AmeliproAccordionList/AmeliproAccordionList.vue +7 -2
- package/src/components/Amelipro/AmeliproAccordionList/__tests__/__snapshots__/AmeliproAccordionList.spec.ts.snap +2 -1
- package/src/components/Amelipro/AmeliproAccordionResult/AmeliproAccordionResultTemplate/__tests__/__snapshots__/AmeliproAccordionResultTemplate.spec.ts.snap +4 -1
- package/src/components/Amelipro/AmeliproAccordionResult/__tests__/__snapshots__/AmeliproAccordionResult.spec.ts.snap +4 -1
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.stories.ts +1 -1
- package/src/components/Amelipro/AmeliproAccordionResultList/AmeliproAccordionResultList.vue +9 -3
- package/src/components/Amelipro/AmeliproAccordionResultList/__tests__/__snapshots__/AmeliproAccordionResultList.spec.ts.snap +42 -11
- package/src/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.stories.ts +4 -4
- package/src/components/Amelipro/AmeliproAutoCompleteField/AmeliproAutoCompleteField.vue +7 -5
- package/src/components/Amelipro/AmeliproAutoCompleteField/__tests__/__snapshots__/AmeliproAutoCompleteField.spec.ts.snap +4 -2
- package/src/components/Amelipro/AmeliproBtn/AmeliproBtn.stories.ts +1 -40
- package/src/components/Amelipro/AmeliproBtn/AmeliproBtn.vue +4 -0
- package/src/components/Amelipro/AmeliproCallback/AmeliproCallback.stories.ts +4 -2
- package/src/components/Amelipro/AmeliproCaptcha/__tests__/__snapshots__/AmeliproCaptcha.spec.ts.snap +2 -1
- package/src/components/Amelipro/AmeliproClickableTile/AmeliproClickableTile.stories.ts +39 -29
- package/src/components/Amelipro/AmeliproCopyBtn/__tests__/__snapshots__/AmeliproCopyBtn.spec.ts.snap +4 -1
- package/src/components/Amelipro/AmeliproCustomSelector/AmeliproCustomSelector.vue +3 -3
- package/src/components/Amelipro/AmeliproCustomSelector/__tests__/__snapshots__/AmeliproCustomSelector.spec.ts.snap +8 -6
- package/src/components/Amelipro/AmeliproFilePreview/AmeliproFilePreview.mdx +3 -1
- package/src/components/Amelipro/AmeliproFilePreview/AmeliproFilePreview.stories.ts +23 -5
- package/src/components/Amelipro/AmeliproFilePreview/AmeliproFilePreview.vue +5 -6
- package/src/components/Amelipro/AmeliproFilePreview/__tests__/AmeliproFilePreview.spec.ts +2 -2
- package/src/components/Amelipro/AmeliproFilePreview/__tests__/__snapshots__/AmeliproFilePreview.spec.ts.snap +5 -6
- package/src/components/Amelipro/AmeliproFirstLogin/__tests__/__snapshots__/AmeliproFirstLogin.spec.ts.snap +4 -1
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeader.vue +1 -2
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproLogoAm/__tests__/AmeliproLogoAm.spec.ts +78 -0
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproLogoAm/{tests → __tests__}/__snapshots__/AmeliproLogoAm.spec.ts.snap +64 -2
- package/src/components/Amelipro/AmeliproIcon/__tests__/AmeliproIcon.spec.ts +358 -0
- package/src/components/Amelipro/AmeliproIcon/{tests → __tests__}/__snapshots__/AmeliproIcon.spec.ts.snap +30 -3
- package/src/components/Amelipro/AmeliproIcon/iconList.ts +1 -0
- package/src/components/Amelipro/AmeliproIconBtn/AmeliproIconBtn.vue +1 -1
- package/src/components/Amelipro/AmeliproIconBtn/__tests__/AmeliproIconBtn.spec.ts +459 -0
- package/src/components/Amelipro/AmeliproIconBtn/__tests__/__snapshots__/AmeliproIconBtn.spec.ts.snap +58 -0
- package/src/components/Amelipro/AmeliproIllustratedDataTile/AmeliproIllustratedDataTile.stories.ts +38 -26
- package/src/components/Amelipro/AmeliproIllustratedDataTile/__tests__/AmeliproIllustratedDataTile.spec.ts +321 -0
- package/src/components/Amelipro/AmeliproIllustratedDataTile/__tests__/__snapshots__/AmeliproIllustratedDataTile.spec.ts.snap +148 -0
- package/src/components/Amelipro/AmeliproIllustratedRadioGroup/AmeliproIllustratedRadioGroup.stories.ts +14 -5
- package/src/components/Amelipro/AmeliproIllustratedRadioGroup/AmeliproIllustratedRadioGroup.vue +1 -1
- package/src/components/Amelipro/AmeliproIllustratedRadioGroup/__tests__/AmeliproIllustratedRadioGroup.spec.ts +498 -0
- package/src/components/Amelipro/AmeliproIllustratedRadioGroup/__tests__/__snapshots__/AmeliproIllustratedRadioGroup.spec.ts.snap +325 -0
- package/src/components/Amelipro/AmeliproMailTile/__tests__/AmeliproMailTile.spec.ts +210 -0
- package/src/components/Amelipro/AmeliproMailTile/__tests__/__snapshots__/AmeliproMailTile.spec.ts.snap +98 -0
- package/src/components/Amelipro/AmeliproMessage/__tests__/AmeliproMessage.spec.ts +446 -0
- package/src/components/Amelipro/AmeliproMessage/__tests__/__snapshots__/AmeliproMessage.spec.ts.snap +60 -0
- package/src/components/Amelipro/AmeliproMessagingLayout/__tests__/AmeliproMessagingLayout.spec.ts +300 -0
- package/src/components/Amelipro/AmeliproMessagingLayout/__tests__/__snapshots__/AmeliproMessagingLayout.spec.ts.snap +197 -0
- package/src/components/Amelipro/AmeliproNumberedCard/__tests__/AmeliproNumberedCard.spec.ts +117 -0
- package/src/components/Amelipro/AmeliproNumberedCard/{tests → __tests__}/__snapshots__/AmeliproNumberedCard.spec.ts.snap +47 -45
- package/src/components/Amelipro/AmeliproOnboarding/__tests__/AmeliproOnboarding.spec.ts +219 -0
- package/src/components/Amelipro/AmeliproOnboarding/__tests__/__snapshots__/AmeliproOnboarding.spec.ts.snap +41 -0
- package/src/components/Amelipro/AmeliproPageLayout/__tests__/AmeliproPageLayout.spec.ts +129 -0
- package/src/components/Amelipro/AmeliproPageLayout/__tests__/__snapshots__/AmeliproPageLayout.spec.ts.snap +189 -0
- package/src/components/Amelipro/AmeliproPagination/AmeliproPaginationBtn/__tests__/AmeliproPaginationBtn.spec.ts +92 -0
- package/src/components/Amelipro/AmeliproPagination/AmeliproPaginationBtn/__tests__/__snapshots__/AmeliproPaginationBtn.spec.ts.snap +56 -0
- package/src/components/Amelipro/AmeliproPagination/__tests__/AmeliproPagination.spec.ts +165 -0
- package/src/components/Amelipro/AmeliproPagination/__tests__/__snapshots__/AmeliproPagination.spec.ts.snap +83 -0
- package/src/components/Amelipro/AmeliproPatientBanner/__tests__/AmeliproPatientBanner.spec.ts +208 -0
- package/src/components/Amelipro/AmeliproPatientBanner/__tests__/__snapshots__/AmeliproPatientBanner.spec.ts.snap +285 -0
- package/src/components/Amelipro/AmeliproPatientLogged/__tests__/__snapshots__/AmeliproPatientLogged.spec.ts.snap +26 -7
- package/src/components/Amelipro/AmeliproPostalAddressField/AmeliproPostalAddressCityRow/__tests__/__snapshots__/AmeliproPostalAddressCityRow.spec.ts.snap +12 -4
- package/src/components/Amelipro/AmeliproRadioGroup/AmeliproRadioGroup.stories.ts +28 -8
- package/src/components/Amelipro/AmeliproRadioGroup/__tests__/AmeliproRadioGroup.spec.ts +332 -0
- package/src/components/Amelipro/AmeliproRadioGroup/__tests__/__snapshots__/AmeliproRadioGroup.spec.ts.snap +255 -0
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.stories.ts +1 -2
- package/src/components/Amelipro/AmeliproResultList/AmeliproResultList.vue +3 -1
- package/src/components/Amelipro/AmeliproResultList/__tests__/__snapshots__/AmeliproResultList.spec.ts.snap +2 -1
- package/src/components/Amelipro/AmeliproSelect/AmeliproSelect.vue +11 -5
- package/src/components/Amelipro/AmeliproSelect/__tests__/AmeliproSelect.spec.ts +481 -0
- package/src/components/Amelipro/AmeliproSelect/__tests__/__snapshots__/AmeliproSelect.spec.ts.snap +117 -0
- package/src/components/Amelipro/AmeliproStateTile/AmeliproStateTile.vue +5 -2
- package/src/components/Amelipro/AmeliproStateTile/__tests__/AmeliproStateTile.spec.ts +206 -0
- package/src/components/Amelipro/AmeliproStateTile/__tests__/__snapshots__/AmeliproStateTile.spec.ts.snap +158 -0
- package/src/components/Amelipro/AmeliproStatus/__tests__/AmeliproStatus.spec.ts +120 -0
- package/src/components/Amelipro/AmeliproStatus/__tests__/__snapshots__/AmeliproStatus.spec.ts.snap +39 -0
- package/src/components/Amelipro/AmeliproStepper/AmeliproStepBtn/__tests__/AmeliproStepBtn.spec.ts +97 -0
- package/src/components/Amelipro/AmeliproStepper/AmeliproStepBtn/__tests__/__snapshots__/AmeliproStepBtn.spec.ts.snap +61 -0
- package/src/components/Amelipro/AmeliproStepper/__tests__/AmeliproStepper.spec.ts +248 -0
- package/src/components/Amelipro/AmeliproStepper/__tests__/__snapshots__/AmeliproStepper.spec.ts.snap +179 -0
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.stories.ts +14 -13
- package/src/components/Amelipro/AmeliproTable/AmeliproTable.vue +2 -1
- package/src/components/Amelipro/AmeliproTable/__tests__/__snapshots__/AmeliproTable.spec.ts.snap +10 -3
- package/src/components/Amelipro/AmeliproTabs/AmeliproTabBtn/__tests__/AmeliproTabBtn.spec.ts +129 -0
- package/src/components/Amelipro/AmeliproTabs/AmeliproTabBtn/__tests__/__snapshots__/AmeliproTabBtn.spec.ts.snap +81 -0
- package/src/components/Amelipro/AmeliproTabs/AmeliproTabs.vue +2 -2
- package/src/components/Amelipro/AmeliproTabs/__tests__/AmeliproTabs.spec.ts +234 -0
- package/src/components/Amelipro/AmeliproTabs/__tests__/__snapshots__/AmeliproTabs.spec.ts.snap +122 -0
- package/src/components/Amelipro/AmeliproTextArea/AmeliproTextArea.vue +7 -5
- package/src/components/Amelipro/AmeliproTextArea/__tests__/AmeliproTextArea.spec.ts +265 -9
- package/src/components/Amelipro/AmeliproTextArea/__tests__/__snapshots__/AmeliproTextArea.spec.ts.snap +98 -155
- package/src/components/Amelipro/AmeliproTextField/AmeliproTextField.vue +7 -5
- package/src/components/Amelipro/AmeliproTextField/__tests__/AmeliproTextField.spec.ts +375 -0
- package/src/components/Amelipro/AmeliproTextField/__tests__/__snapshots__/AmeliproTextField.spec.ts.snap +143 -0
- package/src/components/Amelipro/AmeliproTileBtn/__tests__/AmeliproTileBtn.spec.ts +241 -0
- package/src/components/Amelipro/AmeliproTileBtn/__tests__/__snapshots__/AmeliproTileBtn.spec.ts.snap +74 -0
- package/src/components/Amelipro/AmeliproTooltips/__tests__/AmeliproTooltips.spec.ts +212 -0
- package/src/components/Amelipro/AmeliproTooltips/__tests__/__snapshots__/AmeliproTooltips.spec.ts.snap +71 -0
- package/src/components/Amelipro/AmeliproTransmission/__tests__/AmeliproTransmission.spec.ts +155 -0
- package/src/components/Amelipro/AmeliproTransmission/__tests__/__snapshots__/AmeliproTransmission.spec.ts.snap +240 -0
- package/src/components/Amelipro/AmeliproUpload/AmeliproUpload.stories.ts +0 -1
- package/src/components/Amelipro/ServiceMenu/tests/__snapshots__/ServiceMenu.spec.ts.snap +4 -1
- package/src/components/Amelipro/StructureMenu/StructureBtn/StructureBtn.vue +4 -0
- package/src/components/Amelipro/StructureMenu/StructureTabs/StructureTabs.vue +4 -5
- package/src/components/Amelipro/StructureMenu/StructureTabs/tests/__snapshots__/StructureTabs.spec.ts.snap +5 -4
- package/src/components/Amelipro/StructureMenu/tests/__snapshots__/StructureMenu.spec.ts.snap +13 -6
- package/src/components/Amelipro/UserMenu/UserMenu.vue +2 -1
- package/src/components/Amelipro/UserMenu/tests/__snapshots__/UserMenu.spec.ts.snap +4 -1
- package/src/components/Captcha/Captcha.mdx +4 -4
- package/src/components/Captcha/Captcha.stories.ts +8 -1
- package/src/components/Captcha/Captcha.vue +3 -0
- package/src/components/Captcha/CaptchaBase.vue +3 -0
- package/src/components/Captcha/captchaApi.ts +0 -1
- package/src/components/Customs/Selects/SySelect/SySelect.vue +2 -2
- package/src/components/Customs/SyCheckbox/SyCheckbox.stories.ts +5 -0
- package/src/components/Customs/SyCheckbox/SyCheckbox.vue +1 -1
- package/src/components/Customs/SyTabs/SyTabs.stories.ts +174 -10
- package/src/components/Customs/SyTabs/SyTabs.vue +62 -0
- package/src/components/Customs/SyTabs/tests/SyTabs.spec.ts +98 -0
- package/src/components/DatePicker/CalendarMode/DatePicker.stories.ts +13 -13
- package/src/components/DatePicker/CalendarMode/DatePicker.vue +13 -0
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.stories.ts +11 -11
- package/src/components/DatePicker/ComplexDatePicker/ComplexDatePicker.vue +5 -0
- package/src/components/DatePicker/DatePickerValidationExample/DatePickerValidation.mdx +7 -0
- package/src/components/DatePicker/DateTextInput/DateTextInput.range.spec.ts +1 -1
- package/src/components/DatePicker/DateTextInput/DateTextInput.spec.ts +3 -3
- package/src/components/DatePicker/DateTextInput/DateTextInput.vue +50 -2
- package/src/components/DatePicker/DateTextInput/NoCalendar.stories.ts +15 -15
- package/src/components/DatePicker/composables/tests/useDateFormatValidation.spec.ts +2 -2
- package/src/components/DatePicker/composables/tests/useManualDateValidation.spec.ts +1 -1
- package/src/components/DatePicker/composables/useDateFormatDisplay.ts +25 -0
- package/src/components/DatePicker/composables/useDateFormatValidation.ts +5 -2
- package/src/components/DatePicker/composables/useManualDateValidation.ts +5 -1
- package/src/components/DatePicker/tests/DatePicker.validation.spec.ts +1 -1
- package/src/components/ErrorPage/ErrorPage.vue +54 -7
- package/src/components/ErrorPage/tests/__snapshots__/ErrorPage.spec.ts.snap +6 -2
- package/src/components/ExternalLinks/ExternalLinks.vue +2 -4
- package/src/components/NotFoundPage/tests/__snapshots__/NotFoundPage.spec.ts.snap +6 -2
- package/src/components/PasswordField/PasswordField.vue +6 -6
- package/src/components/RangeField/RangeSlider/RangeSlider.vue +3 -2
- package/src/components/RatingPicker/EmotionPicker/EmotionPicker.vue +2 -1
- package/src/components/RatingPicker/NumberPicker/NumberPicker.vue +2 -0
- package/src/components/RatingPicker/RatingPicker.stories.ts +10 -0
- package/src/components/RatingPicker/RatingPicker.vue +23 -1
- package/src/components/RatingPicker/StarsPicker/StarsPicker.vue +2 -0
- package/src/components/SearchListField/Accessibilite.stories.ts +4 -0
- package/src/components/SearchListField/SearchListField.stories.ts +16 -0
- package/src/components/SearchListField/SearchListField.vue +121 -109
- package/src/components/SearchListField/locales.ts +11 -2
- package/src/components/SearchListField/tests/SearchListField.spec.ts +91 -25
- package/src/components/SyAlert/SyAlert.vue +8 -0
- package/src/components/SyAlert/tests/SyAlert.spec.ts +1 -22
- package/src/components/Tables/SyServerTable/SyServerTable.stories.ts +304 -0
- package/src/components/Tables/SyServerTable/SyServerTable.vue +12 -4
- package/src/components/Tables/SyServerTable/tests/SyServerTable.spec.ts +67 -0
- package/src/components/Tables/SyTable/SyTable.stories.ts +186 -0
- package/src/components/Tables/SyTable/SyTable.vue +12 -4
- package/src/components/Tables/SyTable/tests/SyTable.spec.ts +65 -1
- package/src/components/Tables/common/types.ts +2 -0
- package/src/composables/rules/useFieldValidation.ts +47 -7
- package/src/components/Amelipro/AmeliproHeader/AmeliproHeaderBar/AmeliproLogoAm/tests/AmeliproLogoAm.spec.ts +0 -15
- package/src/components/Amelipro/AmeliproIcon/tests/AmeliproIcon.spec.ts +0 -19
- package/src/components/Amelipro/AmeliproIconBtn/tests/AmeliproIconBtn.spec.ts +0 -22
- package/src/components/Amelipro/AmeliproIconBtn/tests/__snapshots__/AmeliproIconBtn.spec.ts.snap +0 -87
- package/src/components/Amelipro/AmeliproIllustratedDataTile/tests/AmeliproIllustratedDataTile.spec.ts +0 -20
- package/src/components/Amelipro/AmeliproIllustratedDataTile/tests/__snapshots__/AmeliproIllustratedDataTile.spec.ts.snap +0 -69
- package/src/components/Amelipro/AmeliproIllustratedRadioGroup/tests/AmeliproIllustratedRadioGroup.spec.ts +0 -53
- package/src/components/Amelipro/AmeliproIllustratedRadioGroup/tests/__snapshots__/AmeliproIllustratedRadioGroup.spec.ts.snap +0 -544
- package/src/components/Amelipro/AmeliproMailTile/tests/AmeliproMailTile.spec.ts +0 -25
- package/src/components/Amelipro/AmeliproMailTile/tests/__snapshots__/AmeliproMailTile.spec.ts.snap +0 -164
- package/src/components/Amelipro/AmeliproMessage/tests/AmeliproMessage.spec.ts +0 -18
- package/src/components/Amelipro/AmeliproMessage/tests/__snapshots__/AmeliproMessage.spec.ts.snap +0 -94
- package/src/components/Amelipro/AmeliproMessagingLayout/tests/AmeliproMessagingLayout.spec.ts +0 -30
- package/src/components/Amelipro/AmeliproMessagingLayout/tests/__snapshots__/AmeliproMessagingLayout.spec.ts.snap +0 -439
- package/src/components/Amelipro/AmeliproNumberedCard/tests/AmeliproNumberedCard.spec.ts +0 -23
- package/src/components/Amelipro/AmeliproOnboarding/tests/AmeliproOnboarding.spec.ts +0 -41
- package/src/components/Amelipro/AmeliproOnboarding/tests/__snapshots__/AmeliproOnboarding.spec.ts.snap +0 -3
- package/src/components/Amelipro/AmeliproPageLayout/tests/AmeliproPageLayout.spec.ts +0 -183
- package/src/components/Amelipro/AmeliproPageLayout/tests/__snapshots__/AmeliproPageLayout.spec.ts.snap +0 -1602
- package/src/components/Amelipro/AmeliproPagination/AmeliproPaginationBtn/tests/AmeliproPaginationBtn.spec.ts +0 -15
- package/src/components/Amelipro/AmeliproPagination/AmeliproPaginationBtn/tests/__snapshots__/AmeliproPaginationBtn.spec.ts.snap +0 -46
- package/src/components/Amelipro/AmeliproPagination/tests/AmeliproPagination.spec.ts +0 -15
- package/src/components/Amelipro/AmeliproPagination/tests/__snapshots__/AmeliproPagination.spec.ts.snap +0 -116
- package/src/components/Amelipro/AmeliproPatientBanner/tests/AmeliproPatientBanner.spec.ts +0 -24
- package/src/components/Amelipro/AmeliproPatientBanner/tests/__snapshots__/AmeliproPatientBanner.spec.ts.snap +0 -268
- package/src/components/Amelipro/AmeliproRadioGroup/tests/AmeliproRadioGroup.spec.ts +0 -43
- package/src/components/Amelipro/AmeliproRadioGroup/tests/__snapshots__/AmeliproRadioGroup.spec.ts.snap +0 -262
- package/src/components/Amelipro/AmeliproSelect/tests/AmeliproSelect.spec.ts +0 -38
- package/src/components/Amelipro/AmeliproSelect/tests/__snapshots__/AmeliproSelect.spec.ts.snap +0 -196
- package/src/components/Amelipro/AmeliproStateTile/tests/AmeliproStateTile.spec.ts +0 -20
- package/src/components/Amelipro/AmeliproStateTile/tests/__snapshots__/AmeliproStateTile.spec.ts.snap +0 -90
- package/src/components/Amelipro/AmeliproStatus/tests/AmeliproStatus.spec.ts +0 -16
- package/src/components/Amelipro/AmeliproStatus/tests/__snapshots__/AmeliproStatus.spec.ts.snap +0 -21
- package/src/components/Amelipro/AmeliproStepper/AmeliproStepBtn/tests/AmeliproStepBtn.spec.ts +0 -18
- package/src/components/Amelipro/AmeliproStepper/AmeliproStepBtn/tests/__snapshots__/AmeliproStepBtn.spec.ts.snap +0 -34
- package/src/components/Amelipro/AmeliproStepper/tests/AmeliproStepper.spec.ts +0 -36
- package/src/components/Amelipro/AmeliproStepper/tests/__snapshots__/AmeliproStepper.spec.ts.snap +0 -354
- package/src/components/Amelipro/AmeliproTabs/AmeliproTabBtn/tests/AmeliproTabBtn.spec.ts +0 -20
- package/src/components/Amelipro/AmeliproTabs/AmeliproTabBtn/tests/__snapshots__/AmeliproTabBtn.spec.ts.snap +0 -34
- package/src/components/Amelipro/AmeliproTabs/tests/AmeliproTabs.spec.ts +0 -39
- package/src/components/Amelipro/AmeliproTabs/tests/__snapshots__/AmeliproTabs.spec.ts.snap +0 -217
- package/src/components/Amelipro/AmeliproTextField/tests/AmeliproTextField.spec.ts +0 -16
- package/src/components/Amelipro/AmeliproTextField/tests/__snapshots__/AmeliproTextField.spec.ts.snap +0 -162
- package/src/components/Amelipro/AmeliproTileBtn/tests/AmeliproTileBtn.spec.ts +0 -17
- package/src/components/Amelipro/AmeliproTileBtn/tests/__snapshots__/AmeliproTileBtn.spec.ts.snap +0 -65
- package/src/components/Amelipro/AmeliproTooltips/tests/AmeliproTooltips.spec.ts +0 -16
- package/src/components/Amelipro/AmeliproTooltips/tests/__snapshots__/AmeliproTooltips.spec.ts.snap +0 -105
- package/src/components/Amelipro/AmeliproTransmission/tests/AmeliproTransmission.spec.ts +0 -16
- package/src/components/Amelipro/AmeliproTransmission/tests/__snapshots__/AmeliproTransmission.spec.ts.snap +0 -246
- package/src/components/SyAlert/tests/__snapshots__/SyAlert.spec.ts.snap +0 -99
|
@@ -1,11 +1,22 @@
|
|
|
1
1
|
import { mount } from '@vue/test-utils'
|
|
2
2
|
import SearchListField from '../SearchListField.vue'
|
|
3
|
-
import { describe, it, expect } from 'vitest'
|
|
3
|
+
import { describe, it, expect, beforeEach } from 'vitest'
|
|
4
|
+
import { createVuetify } from 'vuetify'
|
|
4
5
|
|
|
5
6
|
describe('SearchListField.vue', () => {
|
|
7
|
+
let vuetify
|
|
8
|
+
|
|
9
|
+
beforeEach(() => {
|
|
10
|
+
vuetify = createVuetify()
|
|
11
|
+
})
|
|
12
|
+
|
|
6
13
|
it('renders the password field', () => {
|
|
7
14
|
const wrapper = mount(SearchListField, {
|
|
8
|
-
|
|
15
|
+
global: {
|
|
16
|
+
plugins: [vuetify],
|
|
17
|
+
},
|
|
18
|
+
props: {
|
|
19
|
+
label: 'Filtrer la liste des Items',
|
|
9
20
|
items: [
|
|
10
21
|
{
|
|
11
22
|
label: 'Item 1',
|
|
@@ -24,7 +35,11 @@ describe('SearchListField.vue', () => {
|
|
|
24
35
|
|
|
25
36
|
it('initial state', () => {
|
|
26
37
|
const wrapper = mount(SearchListField, {
|
|
27
|
-
|
|
38
|
+
global: {
|
|
39
|
+
plugins: [vuetify],
|
|
40
|
+
},
|
|
41
|
+
props: {
|
|
42
|
+
label: 'Filtrer la liste des Items',
|
|
28
43
|
items: [
|
|
29
44
|
{
|
|
30
45
|
label: 'Item 1',
|
|
@@ -46,7 +61,11 @@ describe('SearchListField.vue', () => {
|
|
|
46
61
|
|
|
47
62
|
it('initial state with empty value prop', () => {
|
|
48
63
|
const wrapper = mount(SearchListField, {
|
|
49
|
-
|
|
64
|
+
global: {
|
|
65
|
+
plugins: [vuetify],
|
|
66
|
+
},
|
|
67
|
+
props: {
|
|
68
|
+
label: 'Filtrer la liste des Items',
|
|
50
69
|
items: [
|
|
51
70
|
{
|
|
52
71
|
label: 'Item 1',
|
|
@@ -68,7 +87,11 @@ describe('SearchListField.vue', () => {
|
|
|
68
87
|
|
|
69
88
|
it('selects an item', async () => {
|
|
70
89
|
const wrapper = mount(SearchListField, {
|
|
71
|
-
|
|
90
|
+
global: {
|
|
91
|
+
plugins: [vuetify],
|
|
92
|
+
},
|
|
93
|
+
props: {
|
|
94
|
+
label: 'Filtrer la liste des Items',
|
|
72
95
|
items: [
|
|
73
96
|
{
|
|
74
97
|
label: 'Item 1',
|
|
@@ -82,17 +105,21 @@ describe('SearchListField.vue', () => {
|
|
|
82
105
|
},
|
|
83
106
|
})
|
|
84
107
|
|
|
85
|
-
const listItem = wrapper.find('
|
|
86
|
-
await listItem.trigger('click')
|
|
108
|
+
const listItem = wrapper.find('[data-test-id="suggestions-list"] li')
|
|
109
|
+
await listItem.find('input[type="checkbox"]').trigger('click')
|
|
87
110
|
await wrapper.vm.$nextTick()
|
|
88
111
|
|
|
89
112
|
expect(wrapper.emitted('update:modelValue')).toEqual([[[1]]])
|
|
90
|
-
expect(listItem.classes()).toContain('
|
|
113
|
+
expect(listItem.classes()).toContain('suggestion-item--selected')
|
|
91
114
|
})
|
|
92
115
|
|
|
93
116
|
it('filters items based on search input', async () => {
|
|
94
117
|
const wrapper = mount(SearchListField, {
|
|
95
|
-
|
|
118
|
+
global: {
|
|
119
|
+
plugins: [vuetify],
|
|
120
|
+
},
|
|
121
|
+
props: {
|
|
122
|
+
label: 'Filtrer la liste des fruits',
|
|
96
123
|
items: [
|
|
97
124
|
{
|
|
98
125
|
label: 'Apple',
|
|
@@ -120,7 +147,11 @@ describe('SearchListField.vue', () => {
|
|
|
120
147
|
|
|
121
148
|
it('clears the search field', async () => {
|
|
122
149
|
const wrapper = mount(SearchListField, {
|
|
123
|
-
|
|
150
|
+
global: {
|
|
151
|
+
plugins: [vuetify],
|
|
152
|
+
},
|
|
153
|
+
props: {
|
|
154
|
+
label: 'Filtrer la liste des Items',
|
|
124
155
|
items: [
|
|
125
156
|
{
|
|
126
157
|
label: 'Item 1',
|
|
@@ -144,7 +175,11 @@ describe('SearchListField.vue', () => {
|
|
|
144
175
|
|
|
145
176
|
it('filteredItems computed property', async () => {
|
|
146
177
|
const wrapper = mount(SearchListField, {
|
|
147
|
-
|
|
178
|
+
global: {
|
|
179
|
+
plugins: [vuetify],
|
|
180
|
+
},
|
|
181
|
+
props: {
|
|
182
|
+
label: 'Filtrer la liste des Items',
|
|
148
183
|
items: [
|
|
149
184
|
{
|
|
150
185
|
label: 'Item 1',
|
|
@@ -167,7 +202,11 @@ describe('SearchListField.vue', () => {
|
|
|
167
202
|
|
|
168
203
|
it('filteredItems computed property with null search', async () => {
|
|
169
204
|
const wrapper = mount(SearchListField, {
|
|
170
|
-
|
|
205
|
+
global: {
|
|
206
|
+
plugins: [vuetify],
|
|
207
|
+
},
|
|
208
|
+
props: {
|
|
209
|
+
label: 'Filtrer la liste des Items',
|
|
171
210
|
items: [
|
|
172
211
|
{
|
|
173
212
|
label: 'Item 1',
|
|
@@ -190,7 +229,11 @@ describe('SearchListField.vue', () => {
|
|
|
190
229
|
|
|
191
230
|
it('filteredItems computed property with multiple matching items', async () => {
|
|
192
231
|
const wrapper = mount(SearchListField, {
|
|
193
|
-
|
|
232
|
+
global: {
|
|
233
|
+
plugins: [vuetify],
|
|
234
|
+
},
|
|
235
|
+
props: {
|
|
236
|
+
label: 'Filtrer la liste des Items',
|
|
194
237
|
items: [
|
|
195
238
|
{
|
|
196
239
|
label: 'Item 1',
|
|
@@ -215,7 +258,11 @@ describe('SearchListField.vue', () => {
|
|
|
215
258
|
|
|
216
259
|
it('emitChangeEvent method', async () => {
|
|
217
260
|
const wrapper = mount(SearchListField, {
|
|
218
|
-
|
|
261
|
+
global: {
|
|
262
|
+
plugins: [vuetify],
|
|
263
|
+
},
|
|
264
|
+
props: {
|
|
265
|
+
label: 'Filtrer la liste des Items',
|
|
219
266
|
items: [
|
|
220
267
|
{
|
|
221
268
|
label: 'Item 1',
|
|
@@ -236,7 +283,11 @@ describe('SearchListField.vue', () => {
|
|
|
236
283
|
|
|
237
284
|
it('emits the update:modelValue event when an item is selected', async () => {
|
|
238
285
|
const wrapper = mount(SearchListField, {
|
|
239
|
-
|
|
286
|
+
global: {
|
|
287
|
+
plugins: [vuetify],
|
|
288
|
+
},
|
|
289
|
+
props: {
|
|
290
|
+
label: 'Filtrer la liste des Items',
|
|
240
291
|
items: [
|
|
241
292
|
{
|
|
242
293
|
label: 'Item 1',
|
|
@@ -250,7 +301,7 @@ describe('SearchListField.vue', () => {
|
|
|
250
301
|
},
|
|
251
302
|
})
|
|
252
303
|
|
|
253
|
-
const listItem = wrapper.find('
|
|
304
|
+
const listItem = wrapper.find('[data-test-id="suggestions-list"] input')
|
|
254
305
|
listItem.trigger('click')
|
|
255
306
|
await wrapper.vm.$nextTick()
|
|
256
307
|
|
|
@@ -260,7 +311,11 @@ describe('SearchListField.vue', () => {
|
|
|
260
311
|
|
|
261
312
|
it('renders the password field without outlined prop', () => {
|
|
262
313
|
const wrapper = mount(SearchListField, {
|
|
263
|
-
|
|
314
|
+
global: {
|
|
315
|
+
plugins: [vuetify],
|
|
316
|
+
},
|
|
317
|
+
props: {
|
|
318
|
+
label: 'Filtrer la liste des Items',
|
|
264
319
|
items: [
|
|
265
320
|
{
|
|
266
321
|
label: 'Item 1',
|
|
@@ -292,14 +347,18 @@ describe('SearchListField.vue', () => {
|
|
|
292
347
|
]
|
|
293
348
|
|
|
294
349
|
const wrapper = mount(SearchListField, {
|
|
295
|
-
|
|
350
|
+
global: {
|
|
351
|
+
plugins: [vuetify],
|
|
352
|
+
},
|
|
353
|
+
props: {
|
|
354
|
+
label: 'Filtrer la liste des Items',
|
|
296
355
|
items,
|
|
297
356
|
modelValue: [],
|
|
298
357
|
returnObject: false,
|
|
299
358
|
},
|
|
300
359
|
})
|
|
301
360
|
|
|
302
|
-
wrapper.
|
|
361
|
+
wrapper.find('input[type="checkbox"]').trigger('click')
|
|
303
362
|
await wrapper.vm.$nextTick()
|
|
304
363
|
|
|
305
364
|
const emittedEvents = wrapper.emitted('update:modelValue')
|
|
@@ -320,14 +379,18 @@ describe('SearchListField.vue', () => {
|
|
|
320
379
|
]
|
|
321
380
|
|
|
322
381
|
const wrapper = mount(SearchListField, {
|
|
323
|
-
|
|
382
|
+
global: {
|
|
383
|
+
plugins: [vuetify],
|
|
384
|
+
},
|
|
385
|
+
props: {
|
|
386
|
+
label: 'Filtrer la liste des Items',
|
|
324
387
|
items,
|
|
325
388
|
modelValue: [],
|
|
326
389
|
returnObject: true,
|
|
327
390
|
},
|
|
328
391
|
})
|
|
329
392
|
|
|
330
|
-
wrapper.
|
|
393
|
+
wrapper.find('input[type="checkbox"]').trigger('click')
|
|
331
394
|
await wrapper.vm.$nextTick()
|
|
332
395
|
|
|
333
396
|
const emittedEvents = wrapper.emitted('update:modelValue')
|
|
@@ -348,15 +411,18 @@ describe('SearchListField.vue', () => {
|
|
|
348
411
|
]
|
|
349
412
|
|
|
350
413
|
const wrapper = mount(SearchListField, {
|
|
351
|
-
|
|
414
|
+
global: {
|
|
415
|
+
plugins: [vuetify],
|
|
416
|
+
},
|
|
417
|
+
props: {
|
|
418
|
+
label: 'Filtrer la liste des Items',
|
|
352
419
|
items,
|
|
353
420
|
modelValue: [],
|
|
354
421
|
returnObject: true,
|
|
355
422
|
},
|
|
356
423
|
})
|
|
357
424
|
|
|
358
|
-
|
|
359
|
-
wrapper.vm.toggleSelection(items[0])
|
|
425
|
+
wrapper.find('input[type="checkbox"]').trigger('click')
|
|
360
426
|
await wrapper.vm.$nextTick()
|
|
361
427
|
|
|
362
428
|
const emittedEvents = wrapper.emitted('update:modelValue')
|
|
@@ -368,7 +434,7 @@ describe('SearchListField.vue', () => {
|
|
|
368
434
|
await wrapper.vm.$nextTick()
|
|
369
435
|
|
|
370
436
|
// Deselect first item
|
|
371
|
-
wrapper.
|
|
437
|
+
wrapper.find('input[type="checkbox"]').trigger('click')
|
|
372
438
|
await wrapper.vm.$nextTick()
|
|
373
439
|
|
|
374
440
|
expect(emittedEvents![1]).toEqual([[]])
|
|
@@ -10,6 +10,9 @@
|
|
|
10
10
|
} from '@mdi/js'
|
|
11
11
|
import type { VIcon } from 'vuetify/components'
|
|
12
12
|
|
|
13
|
+
defineOptions({
|
|
14
|
+
inheritAttrs: false,
|
|
15
|
+
})
|
|
13
16
|
const show = defineModel<boolean>({
|
|
14
17
|
default: true,
|
|
15
18
|
})
|
|
@@ -60,6 +63,7 @@
|
|
|
60
63
|
>
|
|
61
64
|
<VAlert
|
|
62
65
|
v-model="show"
|
|
66
|
+
:role="undefined"
|
|
63
67
|
v-bind="attrs"
|
|
64
68
|
:type="props.type"
|
|
65
69
|
:closable="props.closable"
|
|
@@ -117,6 +121,10 @@
|
|
|
117
121
|
@use '@/assets/tokens';
|
|
118
122
|
@use 'sass:map';
|
|
119
123
|
|
|
124
|
+
.sy-alert {
|
|
125
|
+
display: contents;
|
|
126
|
+
}
|
|
127
|
+
|
|
120
128
|
.alert {
|
|
121
129
|
padding: tokens.$padding-4;
|
|
122
130
|
}
|
|
@@ -16,7 +16,7 @@ describe('Alert', () => {
|
|
|
16
16
|
},
|
|
17
17
|
})
|
|
18
18
|
|
|
19
|
-
expect(wrapper.
|
|
19
|
+
expect(wrapper.classes()).toContain('sy-alert')
|
|
20
20
|
})
|
|
21
21
|
|
|
22
22
|
it('show and hide correctly when modelValue is updated', async () => {
|
|
@@ -38,17 +38,6 @@ describe('Alert', () => {
|
|
|
38
38
|
modelValue: false,
|
|
39
39
|
})
|
|
40
40
|
|
|
41
|
-
expect(wrapper.html()).toMatchInlineSnapshot(`
|
|
42
|
-
<div
|
|
43
|
-
class="sy-alert"
|
|
44
|
-
message="message"
|
|
45
|
-
role="alert"
|
|
46
|
-
title="title"
|
|
47
|
-
>
|
|
48
|
-
<!---->
|
|
49
|
-
</div>
|
|
50
|
-
`)
|
|
51
|
-
|
|
52
41
|
await wrapper.setProps({
|
|
53
42
|
modelValue: true,
|
|
54
43
|
})
|
|
@@ -77,16 +66,6 @@ describe('Alert', () => {
|
|
|
77
66
|
|
|
78
67
|
await closeBtn.element.click()
|
|
79
68
|
|
|
80
|
-
expect(wrapper.html()).toMatchInlineSnapshot(`
|
|
81
|
-
<div
|
|
82
|
-
class="sy-alert"
|
|
83
|
-
message="message"
|
|
84
|
-
role="alert"
|
|
85
|
-
title="title"
|
|
86
|
-
>
|
|
87
|
-
<!---->
|
|
88
|
-
</div>
|
|
89
|
-
`)
|
|
90
69
|
expect(wrapper.emitted('update:modelValue')![0]![0]).toBe(false)
|
|
91
70
|
})
|
|
92
71
|
|
|
@@ -162,6 +162,14 @@ const meta = {
|
|
|
162
162
|
type: { summary: 'boolean' },
|
|
163
163
|
},
|
|
164
164
|
},
|
|
165
|
+
showSelectSingle: {
|
|
166
|
+
description: 'Affiche des cases à cocher pour sélectionner une seule ligne à la fois',
|
|
167
|
+
control: { type: 'boolean' },
|
|
168
|
+
table: {
|
|
169
|
+
category: 'props',
|
|
170
|
+
type: { summary: 'boolean' },
|
|
171
|
+
},
|
|
172
|
+
},
|
|
165
173
|
selectionKey: {
|
|
166
174
|
description: 'Clé utilisée pour identifier chaque ligne lors de la sélection. Par défaut, utilise "id" si présent, sinon l\'objet complet.',
|
|
167
175
|
control: { type: 'text' },
|
|
@@ -4246,6 +4254,7 @@ export const RowSelection: Story = {
|
|
|
4246
4254
|
:items="users"
|
|
4247
4255
|
:server-items-length="totalUsers"
|
|
4248
4256
|
:loading="state === StateEnum.PENDING"
|
|
4257
|
+
show-select
|
|
4249
4258
|
suffix="selection-server-table"
|
|
4250
4259
|
@update:options="fetchData"
|
|
4251
4260
|
/>
|
|
@@ -4526,6 +4535,301 @@ fetchData()
|
|
|
4526
4535
|
},
|
|
4527
4536
|
}
|
|
4528
4537
|
|
|
4538
|
+
export const SingleRowSelection: Story = {
|
|
4539
|
+
name: 'Single Row Selection',
|
|
4540
|
+
parameters: {
|
|
4541
|
+
sourceCode: [
|
|
4542
|
+
{
|
|
4543
|
+
name: 'Template',
|
|
4544
|
+
code: `
|
|
4545
|
+
<template>
|
|
4546
|
+
<SyServerTable
|
|
4547
|
+
v-model:options="options"
|
|
4548
|
+
v-model="selection"
|
|
4549
|
+
:items="users"
|
|
4550
|
+
:server-items-length="totalUsers"
|
|
4551
|
+
:loading="state === StateEnum.PENDING"
|
|
4552
|
+
show-select-single
|
|
4553
|
+
suffix="selection-server-table"
|
|
4554
|
+
@update:options="fetchData"
|
|
4555
|
+
/>
|
|
4556
|
+
<div v-if="selection.length" class="mt-4 pa-4 bg-grey-lighten-4">
|
|
4557
|
+
<h3 class="text-h6 mb-3">Item(s) sélectionné(s) ({{ selection.length }})</h3>
|
|
4558
|
+
<div v-for="(item, index) in selection" :key="index" class="mb-2 pa-2 bg-grey-lighten-3">
|
|
4559
|
+
<div><strong>Nom:</strong> {{ typeof item === 'object' ? item.lastname : allUsers.find(i => JSON.stringify(i) === item)?.lastname }}</div>
|
|
4560
|
+
<div><strong>Prénom:</strong> {{ typeof item === 'object' ? item.firstname : allUsers.find(i => JSON.stringify(i) === item)?.firstname }}</div>
|
|
4561
|
+
<div><strong>Email:</strong> {{ typeof item === 'object' ? item.email : allUsers.find(i => JSON.stringify(i) === item)?.email }}</div>
|
|
4562
|
+
</div>
|
|
4563
|
+
</div>
|
|
4564
|
+
</template>
|
|
4565
|
+
`,
|
|
4566
|
+
},
|
|
4567
|
+
{
|
|
4568
|
+
name: 'Script',
|
|
4569
|
+
code: `
|
|
4570
|
+
<script setup lang="ts">
|
|
4571
|
+
import { ref } from 'vue'
|
|
4572
|
+
import { SyServerTable } from '@cnamts/synapse'
|
|
4573
|
+
import { StateEnum } from '@cnamts/synapse/src/components/Tables/common/constants/StateEnum'
|
|
4574
|
+
import type { DataOptions } from '@cnamts/synapse/src/components/Tables/common/types'
|
|
4575
|
+
|
|
4576
|
+
interface User {
|
|
4577
|
+
firstname: string
|
|
4578
|
+
lastname: string
|
|
4579
|
+
email: string
|
|
4580
|
+
}
|
|
4581
|
+
|
|
4582
|
+
interface DataObj {
|
|
4583
|
+
items: User[]
|
|
4584
|
+
total: number
|
|
4585
|
+
}
|
|
4586
|
+
|
|
4587
|
+
const selection = ref([])
|
|
4588
|
+
const totalUsers = ref(0)
|
|
4589
|
+
const users = ref<User[]>([])
|
|
4590
|
+
const state = ref(StateEnum.IDLE)
|
|
4591
|
+
|
|
4592
|
+
const getUsers = (): User[] => [
|
|
4593
|
+
{ firstname: 'Virginie', lastname: 'Beauchesne', email: 'virginie.beauchesne@example.com' },
|
|
4594
|
+
{ firstname: 'Simone', lastname: 'Bellefeuille', email: 'simone.bellefeuille@example.com' },
|
|
4595
|
+
{ firstname: 'Étienne', lastname: 'Salois', email: 'etienne.salois@example.com' },
|
|
4596
|
+
{ firstname: 'Thierry', lastname: 'Bobu', email: 'thierry.bobu@example.com' },
|
|
4597
|
+
{ firstname: 'Bernadette', lastname: 'Langelier', email: 'bernadette.langelier@exemple.com' },
|
|
4598
|
+
{ firstname: 'Agate', lastname: 'Roy', email: 'agate.roy@exemple.com' },
|
|
4599
|
+
]
|
|
4600
|
+
|
|
4601
|
+
const allUsers = ref<User[]>(getUsers())
|
|
4602
|
+
|
|
4603
|
+
const fetchData = async (): Promise<void> => {
|
|
4604
|
+
const defaultOptions: DataOptions = {
|
|
4605
|
+
page: 1,
|
|
4606
|
+
itemsPerPage: 10,
|
|
4607
|
+
sortBy: [],
|
|
4608
|
+
multiSort: false,
|
|
4609
|
+
}
|
|
4610
|
+
const options = args.options ? { ...defaultOptions, ...args.options } : defaultOptions
|
|
4611
|
+
const { items, total } = await getDataFromApi(options)
|
|
4612
|
+
users.value = items
|
|
4613
|
+
totalUsers.value = total
|
|
4614
|
+
}
|
|
4615
|
+
|
|
4616
|
+
const wait = async (ms: number) => {
|
|
4617
|
+
return new Promise(resolve => setTimeout(resolve, ms))
|
|
4618
|
+
}
|
|
4619
|
+
|
|
4620
|
+
const getDataFromApi = async ({ sortBy, page, itemsPerPage, filters }: DataOptions): Promise<DataObj> => {
|
|
4621
|
+
state.value = StateEnum.PENDING
|
|
4622
|
+
await wait(1000)
|
|
4623
|
+
return new Promise((resolve) => {
|
|
4624
|
+
let items: User[] = getUsers()
|
|
4625
|
+
let total = items.length
|
|
4626
|
+
// Ajout du filtrage si besoin
|
|
4627
|
+
if (filters && filters.length > 0) {
|
|
4628
|
+
filters.forEach((filter) => {
|
|
4629
|
+
// Ajoutez ici la logique de filtrage
|
|
4630
|
+
})
|
|
4631
|
+
total = items.length
|
|
4632
|
+
}
|
|
4633
|
+
if (sortBy && sortBy.length > 0) {
|
|
4634
|
+
items = items.sort((a, b) => {
|
|
4635
|
+
// Ajoutez ici la logique de tri
|
|
4636
|
+
return 0
|
|
4637
|
+
})
|
|
4638
|
+
}
|
|
4639
|
+
if (itemsPerPage > 0) {
|
|
4640
|
+
items = items.slice((page - 1) * itemsPerPage, page * itemsPerPage)
|
|
4641
|
+
}
|
|
4642
|
+
resolve({ items, total })
|
|
4643
|
+
state.value = StateEnum.RESOLVED
|
|
4644
|
+
})
|
|
4645
|
+
}
|
|
4646
|
+
|
|
4647
|
+
// Chargement initial
|
|
4648
|
+
fetchData()
|
|
4649
|
+
</script>
|
|
4650
|
+
`,
|
|
4651
|
+
},
|
|
4652
|
+
],
|
|
4653
|
+
},
|
|
4654
|
+
args: {
|
|
4655
|
+
'headers': [
|
|
4656
|
+
{
|
|
4657
|
+
title: 'Nom',
|
|
4658
|
+
key: 'lastname',
|
|
4659
|
+
},
|
|
4660
|
+
{
|
|
4661
|
+
title: 'Prénom',
|
|
4662
|
+
key: 'firstname',
|
|
4663
|
+
},
|
|
4664
|
+
{
|
|
4665
|
+
title: 'Email',
|
|
4666
|
+
value: 'email',
|
|
4667
|
+
},
|
|
4668
|
+
],
|
|
4669
|
+
'items': [
|
|
4670
|
+
{
|
|
4671
|
+
firstname: 'Virginie',
|
|
4672
|
+
lastname: 'Beauchesne',
|
|
4673
|
+
email: 'virginie.beauchesne@example.com',
|
|
4674
|
+
},
|
|
4675
|
+
{
|
|
4676
|
+
firstname: 'Simone',
|
|
4677
|
+
lastname: 'Bellefeuille',
|
|
4678
|
+
email: 'simone.bellefeuille@example.com',
|
|
4679
|
+
},
|
|
4680
|
+
{
|
|
4681
|
+
firstname: 'Étienne',
|
|
4682
|
+
lastname: 'Salois',
|
|
4683
|
+
email: 'etienne.salois@example.com',
|
|
4684
|
+
},
|
|
4685
|
+
{
|
|
4686
|
+
firstname: 'Thierry',
|
|
4687
|
+
lastname: 'Bobu',
|
|
4688
|
+
email: 'thierry.bobu@example.com',
|
|
4689
|
+
},
|
|
4690
|
+
{
|
|
4691
|
+
firstname: 'Bernadette',
|
|
4692
|
+
lastname: 'Langelier',
|
|
4693
|
+
email: 'bernadette.langelier@exemple.com',
|
|
4694
|
+
},
|
|
4695
|
+
{
|
|
4696
|
+
firstname: 'Agate',
|
|
4697
|
+
lastname: 'Roy',
|
|
4698
|
+
email: 'agate.roy@exemple.com',
|
|
4699
|
+
},
|
|
4700
|
+
],
|
|
4701
|
+
'options': {
|
|
4702
|
+
itemsPerPage: 4,
|
|
4703
|
+
page: 1,
|
|
4704
|
+
filters: [],
|
|
4705
|
+
},
|
|
4706
|
+
'caption': '',
|
|
4707
|
+
'suffix': 'selection-server-table',
|
|
4708
|
+
'density': 'default',
|
|
4709
|
+
'striped': false,
|
|
4710
|
+
'showSelectSingle': true,
|
|
4711
|
+
'showFilters': true,
|
|
4712
|
+
'serverItemsLength': 6,
|
|
4713
|
+
'onUpdate:options': fn(),
|
|
4714
|
+
},
|
|
4715
|
+
render(args) {
|
|
4716
|
+
return {
|
|
4717
|
+
components: { SyServerTable },
|
|
4718
|
+
setup() {
|
|
4719
|
+
const totalUsers = ref(0)
|
|
4720
|
+
const users = ref<User[]>([])
|
|
4721
|
+
const selection = ref([])
|
|
4722
|
+
const state = ref(StateEnum.IDLE)
|
|
4723
|
+
|
|
4724
|
+
const fetchData = async (): Promise<void> => {
|
|
4725
|
+
// Create a complete DataOptions object with all required properties
|
|
4726
|
+
const defaultOptions: DataOptions = {
|
|
4727
|
+
page: 1,
|
|
4728
|
+
itemsPerPage: 10,
|
|
4729
|
+
sortBy: [],
|
|
4730
|
+
multiSort: false,
|
|
4731
|
+
}
|
|
4732
|
+
const options = args.options ? { ...defaultOptions, ...args.options } : defaultOptions
|
|
4733
|
+
const { items, total } = await getDataFromApi(options)
|
|
4734
|
+
users.value = items
|
|
4735
|
+
totalUsers.value = total
|
|
4736
|
+
}
|
|
4737
|
+
|
|
4738
|
+
const wait = async (ms: number) => {
|
|
4739
|
+
return new Promise(resolve => setTimeout(resolve, ms))
|
|
4740
|
+
}
|
|
4741
|
+
|
|
4742
|
+
const getDataFromApi = async ({ sortBy, page, itemsPerPage, filters }: DataOptions): Promise<DataObj> => {
|
|
4743
|
+
state.value = StateEnum.PENDING
|
|
4744
|
+
await wait(1000)
|
|
4745
|
+
|
|
4746
|
+
return new Promise((resolve) => {
|
|
4747
|
+
let items: User[] = getUsers()
|
|
4748
|
+
let total = items.length // Changed from const to let
|
|
4749
|
+
|
|
4750
|
+
// Add filtering logic here
|
|
4751
|
+
if (filters && filters.length > 0) {
|
|
4752
|
+
filters.forEach((filter) => {
|
|
4753
|
+
const { key, value } = filter
|
|
4754
|
+
|
|
4755
|
+
items = items.filter((item) => {
|
|
4756
|
+
const itemValue = item[key]
|
|
4757
|
+
return String(itemValue).toLowerCase().includes(String(value).toLowerCase())
|
|
4758
|
+
})
|
|
4759
|
+
})
|
|
4760
|
+
// Update total after filtering
|
|
4761
|
+
total = items.length
|
|
4762
|
+
}
|
|
4763
|
+
|
|
4764
|
+
if (sortBy && sortBy.length > 0) {
|
|
4765
|
+
items = items.sort((a, b) => {
|
|
4766
|
+
const key = sortBy[0].key
|
|
4767
|
+
const order = sortBy[0].order === 'asc' ? 1 : -1
|
|
4768
|
+
|
|
4769
|
+
return a[key] > b[key] ? order : -order
|
|
4770
|
+
})
|
|
4771
|
+
}
|
|
4772
|
+
|
|
4773
|
+
if (itemsPerPage > 0) {
|
|
4774
|
+
items = items.slice((page - 1) * itemsPerPage, page * itemsPerPage)
|
|
4775
|
+
}
|
|
4776
|
+
|
|
4777
|
+
resolve({ items, total })
|
|
4778
|
+
state.value = StateEnum.RESOLVED
|
|
4779
|
+
})
|
|
4780
|
+
}
|
|
4781
|
+
|
|
4782
|
+
const getUsers = (): User[] => {
|
|
4783
|
+
return [
|
|
4784
|
+
{ firstname: 'Virginie', lastname: 'Beauchesne', email: 'virginie.beauchesne@example.com' },
|
|
4785
|
+
{ firstname: 'Simone', lastname: 'Bellefeuille', email: 'simone.bellefeuille@example.com' },
|
|
4786
|
+
{ firstname: 'Étienne', lastname: 'Salois', email: 'etienne.salois@example.com' },
|
|
4787
|
+
{ firstname: 'Thierry', lastname: 'Bobu', email: 'thierry.bobu@example.com' },
|
|
4788
|
+
{ firstname: 'Bernadette', lastname: 'Langelier', email: 'bernadette.langelier@exemple.com' },
|
|
4789
|
+
{ firstname: 'Agate', lastname: 'Roy', email: 'agate.roy@exemple.com' },
|
|
4790
|
+
{ firstname: 'Louis', lastname: 'Denis', email: 'louis.denis@example.com' },
|
|
4791
|
+
{ firstname: 'Édith', lastname: 'Cartier', email: 'edith.cartier@example.com' },
|
|
4792
|
+
{ firstname: 'Alphonse', lastname: 'Bouvier', email: 'alphonse.bouvier@example.com' },
|
|
4793
|
+
{ firstname: 'Eustache', lastname: 'Dubois', email: 'eustache.dubois@example.com' },
|
|
4794
|
+
{ firstname: 'Rosemarie', lastname: 'Quessy', email: 'rosemarie.quessy@example.com' },
|
|
4795
|
+
{ firstname: 'Serge', lastname: 'Rivard', email: 'serge.rivard@example.com' },
|
|
4796
|
+
]
|
|
4797
|
+
}
|
|
4798
|
+
|
|
4799
|
+
// Keep a full copy of all users for selection display across pages
|
|
4800
|
+
const allUsers = ref<User[]>(getUsers())
|
|
4801
|
+
|
|
4802
|
+
// Call fetchData on mount
|
|
4803
|
+
fetchData()
|
|
4804
|
+
|
|
4805
|
+
return { args, users, allUsers, state, fetchData, totalUsers, selection, StateEnum }
|
|
4806
|
+
},
|
|
4807
|
+
template: `
|
|
4808
|
+
<div>
|
|
4809
|
+
<SyServerTable
|
|
4810
|
+
v-bind="args"
|
|
4811
|
+
v-model:options="args.options"
|
|
4812
|
+
v-model="selection"
|
|
4813
|
+
:items="users"
|
|
4814
|
+
:server-items-length="totalUsers"
|
|
4815
|
+
:loading="state === StateEnum.PENDING"
|
|
4816
|
+
suffix="selection-server-table"
|
|
4817
|
+
@update:options="fetchData"
|
|
4818
|
+
/>
|
|
4819
|
+
<div v-if="selection.length" class="mt-4 pa-4 bg-grey-lighten-4">
|
|
4820
|
+
<h3 class="text-h6 mb-3">Item(s) sélectionné(s) ({{ selection.length }})</h3>
|
|
4821
|
+
<div v-for="(item, index) in selection" :key="index" class="mb-2 pa-2 bg-grey-lighten-3">
|
|
4822
|
+
<div><strong>Nom:</strong> {{ typeof item === 'object' ? item.lastname : allUsers.find(i => JSON.stringify(i) === item)?.lastname }}</div>
|
|
4823
|
+
<div><strong>Prénom:</strong> {{ typeof item === 'object' ? item.firstname : allUsers.find(i => JSON.stringify(i) === item)?.firstname }}</div>
|
|
4824
|
+
<div><strong>Email:</strong> {{ typeof item === 'object' ? item.email : allUsers.find(i => JSON.stringify(i) === item)?.email }}</div>
|
|
4825
|
+
</div>
|
|
4826
|
+
</div>
|
|
4827
|
+
</div>
|
|
4828
|
+
`,
|
|
4829
|
+
}
|
|
4830
|
+
},
|
|
4831
|
+
}
|
|
4832
|
+
|
|
4529
4833
|
export const ColumnControls: StoryObj<typeof SyServerTable> = {
|
|
4530
4834
|
parameters: {
|
|
4531
4835
|
sourceCode: [
|
|
@@ -31,6 +31,7 @@
|
|
|
31
31
|
density: 'default',
|
|
32
32
|
striped: false,
|
|
33
33
|
showSelect: false,
|
|
34
|
+
showSelectSingle: false,
|
|
34
35
|
multiSort: false,
|
|
35
36
|
mustSort: false,
|
|
36
37
|
itemsPerPageOptions: undefined,
|
|
@@ -202,7 +203,13 @@
|
|
|
202
203
|
items: tableItems,
|
|
203
204
|
modelValue: model,
|
|
204
205
|
updateModelValue: (value) => {
|
|
205
|
-
|
|
206
|
+
if (props.showSelectSingle && Array.isArray(value)) {
|
|
207
|
+
// In single-select mode, always keep at most one selected value
|
|
208
|
+
model.value = value.length > 0 ? [value[0]] : []
|
|
209
|
+
}
|
|
210
|
+
else {
|
|
211
|
+
model.value = value
|
|
212
|
+
}
|
|
206
213
|
},
|
|
207
214
|
selectionKey: toRef(props, 'selectionKey'),
|
|
208
215
|
})
|
|
@@ -276,7 +283,8 @@
|
|
|
276
283
|
:items="processItems(displayedItems)"
|
|
277
284
|
:items-length="displayedItemsLength || 0"
|
|
278
285
|
:density="props.density"
|
|
279
|
-
:show-select="props.showSelect"
|
|
286
|
+
:show-select="props.showSelect || props.showSelectSingle"
|
|
287
|
+
:select-strategy="props.showSelectSingle ? 'single' : 'page'"
|
|
280
288
|
:item-selectable="(item) => true"
|
|
281
289
|
:item-value="getItemValue"
|
|
282
290
|
:multi-sort="props.multiSort"
|
|
@@ -308,7 +316,7 @@
|
|
|
308
316
|
...(getHeaderForColumn(column)?.width ? { width: getHeaderForColumn(column)?.width as any } : {}),
|
|
309
317
|
}"
|
|
310
318
|
>
|
|
311
|
-
<template v-if="column.key === 'data-table-select' && props.showSelect">
|
|
319
|
+
<template v-if="column.key === 'data-table-select' && props.showSelect && !props.showSelectSingle">
|
|
312
320
|
<SyCheckbox
|
|
313
321
|
:model-value="slotProps.allSelected"
|
|
314
322
|
:indeterminate="slotProps.someSelected && !slotProps.allSelected"
|
|
@@ -341,7 +349,7 @@
|
|
|
341
349
|
v-if="props.showFilters"
|
|
342
350
|
class="filters"
|
|
343
351
|
>
|
|
344
|
-
<th v-if="props.showSelect" />
|
|
352
|
+
<th v-if="props.showSelect || props.showSelectSingle" />
|
|
345
353
|
<template
|
|
346
354
|
v-for="column in slotProps.columns.filter(c => c.key !== 'data-table-select')"
|
|
347
355
|
:key="column.key"
|