@povio/ui 5.0.0-rc.1 → 5.0.0-rc.3
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/.rulesync/rules/ui-buttons-and-content.md +56 -0
- package/.rulesync/rules/ui-inputs-and-forms.md +62 -0
- package/.rulesync/rules/ui-overlays-navigation-and-styling.md +49 -0
- package/.rulesync/rules/ui-overview.md +33 -0
- package/README.md +49 -16
- package/dist/{Accordion-CzFKi8Bp.js → Accordion-BzwO4_ml.js} +20 -136
- package/dist/{Alert-T25LY8ZL.js → Alert-CnvEb1D_.js} +16 -12
- package/dist/{Alert-f1dG-4Uy.d.ts → Alert-DfiJbKH0.d.ts} +2 -1
- package/dist/{AlertDialog-B6R2MbNg.d.ts → AlertDialog-OWTbR4km.d.ts} +3 -3
- package/dist/{Autocomplete-CQ63Cynd.d.ts → Autocomplete-BwNHp8fy.d.ts} +1 -1
- package/dist/{Badge-YKlKz-Jy.d.ts → Badge-CBNpj823.d.ts} +8 -5
- package/dist/BadgeButton-Ccgt3oGO.d.ts +15 -0
- package/dist/{BottomSheet-DvqBvth_.js → BottomSheet-BXLE3161.js} +7 -6
- package/dist/{BottomSheet-xaymO7aQ.d.ts → BottomSheet-DbQuzfAB.d.ts} +1 -1
- package/dist/{BottomSheet.lazy-CGBRPve_.d.ts → BottomSheet.lazy-D9LCEo7s.d.ts} +1 -1
- package/dist/{Breadcrumbs-DyriI-Bi.d.ts → Breadcrumbs-CUV6CU8Q.d.ts} +1 -1
- package/dist/{Breadcrumbs-DiIYJAWf.js → Breadcrumbs-CbKzAq1v.js} +24 -38
- package/dist/Button-C5rv4Cr2.js +506 -0
- package/dist/{Button-BZ3is6IU.d.ts → Button-D-4qb0IR.d.ts} +3 -3
- package/dist/{ButtonContent-B2_dZ6vA.js → ButtonContent-c7lJayVQ.js} +10 -8
- package/dist/{Calendar-DzQApBCy.js → Calendar-CVSQH-rC.js} +22 -15
- package/dist/{CheckContent-DZ7Gk8GS.js → CheckContent-D7sZPmzx.js} +2 -2
- package/dist/{Checkbox-BepzfVfK.js → Checkbox-BU0d702K.js} +6 -6
- package/dist/{Checkbox-CHpgW3fI.d.ts → Checkbox-DVTWaMKa.d.ts} +1 -1
- package/dist/{CheckboxCheckmark-B3lnOjsU.js → CheckboxCheckmark-usHsolNj.js} +10 -10
- package/dist/{CheckboxGroup-CXrR3A-c.d.ts → CheckboxGroup-DGF12cmB.d.ts} +3 -3
- package/dist/ComponentGallery-DIFeJqGx.js +2528 -0
- package/dist/{DatePicker-B3l9TEjW.d.ts → DatePicker-8xSs_jNd.d.ts} +3 -3
- package/dist/{DatePicker-CI87jC4_.js → DatePicker-D95gDPhg.js} +12 -11
- package/dist/{DatePickerInput-UBZcTmdv.js → DatePickerInput-CX6NYim4.js} +12 -23
- package/dist/{DatePickerInput-CZTEsrS0.d.ts → DatePickerInput-D81ZJ3fT.d.ts} +3 -3
- package/dist/{DateRangePicker-DKkc2B3n.d.ts → DateRangePicker-Bfq-yDm7.d.ts} +3 -3
- package/dist/{DateRangePicker-BX2O5zA8.js → DateRangePicker-_uTQk_ae.js} +16 -15
- package/dist/{DateTimePicker-CVfkp45w.js → DateTimePicker-BB058Z34.js} +11 -10
- package/dist/{DateTimePicker-IHr-wPq8.d.ts → DateTimePicker-D4lHyf6P.d.ts} +3 -3
- package/dist/{Dialog-DdRP4YFC.js → Dialog-9manOgMA.js} +4 -4
- package/dist/{Dialog-CXoVeIkU.js → Dialog-CKLkS00H.js} +10 -2
- package/dist/{Dialog-DEbI_9S-.d.ts → Dialog-CW93T9X1.d.ts} +3 -2
- package/dist/{DropdownMenu-zrodtd44.js → DropdownMenu-5jmtgLXd.js} +8 -6
- package/dist/{DropdownMenu-CWDhk3XA.d.ts → DropdownMenu-JNpYT4-3.d.ts} +3 -2
- package/dist/{DropdownMenuDesktop-CGYxsavQ.js → DropdownMenuDesktop-Cl9gZVq0.js} +9 -38
- package/dist/{FileInput-Dz1eESr_.js → FileInput-C0-6bw4w.js} +8 -8
- package/dist/{FileInput-BQbn77bE.d.ts → FileInput-C4CE5kuP.d.ts} +5 -4
- package/dist/{FileUpload-qySCMcLn.d.ts → FileUpload-CR7bZxV1.d.ts} +1 -1
- package/dist/{FileUpload-D3Io7Is5.js → FileUpload-DDpYMn8f.js} +51 -139
- package/dist/{FileUploadContainer-qOyGvb5J.d.ts → FileUploadContainer-042ztsaL.d.ts} +1 -1
- package/dist/{Form-u_N_6mwo.d.ts → Form-BJ12MjE-.d.ts} +1 -1
- package/dist/{FormField-B0miX3gu.d.ts → FormField-Byiehm9y.d.ts} +1 -1
- package/dist/{FormField-CHD4OJOt.js → FormField-U_-d4V_g.js} +9 -9
- package/dist/{FormFieldError-QRAFHUTt.js → FormFieldError-DeOHHLo2.js} +1 -1
- package/dist/FormFieldHeaderTooltip-DXbuu88v.js +17 -0
- package/dist/{IconButton-KXecZgYX.d.ts → IconButton-D4thBurp.d.ts} +2 -2
- package/dist/IconSlot-DSK7qNxc.js +79 -0
- package/dist/{InlineIconButton-CbKZ2U_a.d.ts → InlineIconButton-BeJCjl-q.d.ts} +2 -2
- package/dist/{InlineTooltipWrapper-g5yoeH1B.js → InlineTooltipWrapper-Bpmd--e7.js} +3 -3
- package/dist/{Input-efmPwk8f.d.ts → Input-DOanwj3l.d.ts} +3 -3
- package/dist/{InputContent-DuBa9FuI.d.ts → InputContent-CXuP1ghQ.d.ts} +3 -3
- package/dist/{InputItem-2zf6QI5L.js → InputItem-D-KuiNSc.js} +11 -11
- package/dist/{Inputs-C-w03Q_F.d.ts → Inputs-DA73LmLc.d.ts} +1 -1
- package/dist/{Inputs-BceDTmdT.js → Inputs-j3JmcLWR.js} +1 -1
- package/dist/{Link-QYpprkN1.d.ts → Link-Ow9H7kNv.d.ts} +3 -2
- package/dist/{ListBox-B7DW1S7n.js → ListBox-CL8Ar4Q_.js} +5 -4
- package/dist/{MenuItem--Mjd_yK8.d.ts → MenuItem-DHyqOqln.d.ts} +1 -1
- package/dist/{Modal-CoFt5PGP.js → Modal-w60dVQcb.js} +1 -1
- package/dist/{NumberField-z2JatYK0.d.ts → NumberField-Cb9Gf6QJ.d.ts} +3 -3
- package/dist/{NumberRangeInput-Chai3iEi.d.ts → NumberRangeInput-BfbJQqzn.d.ts} +2 -2
- package/dist/{NumberRangeInput-BxVrHq8R.js → NumberRangeInput-C-8U05wF.js} +6 -6
- package/dist/{Pagination-CXtIDclf.d.ts → Pagination-CwQu5Py8.d.ts} +1 -1
- package/dist/{PaginationList-CXG4jWFD.d.ts → PaginationList-DMRUGtf8.d.ts} +1 -1
- package/dist/{PaginationList-0bAmvXC0.js → PaginationList-DtvuP63b.js} +2 -2
- package/dist/{PasswordInput-ub2TQxef.d.ts → PasswordInput-CLwFUgl0.d.ts} +1 -1
- package/dist/{Popover-DUKH0q9u.d.ts → Popover-BTHPteIh.d.ts} +2 -2
- package/dist/{Progress-DQWiFP0L.js → Progress-B3mY9rIP.js} +2 -2
- package/dist/{Progress-Dho39FDs.d.ts → Progress-CjWOR38H.d.ts} +2 -1
- package/dist/{QuerySelect-Bo1K6gi_.d.ts → QuerySelect-BGxb6Y0K.d.ts} +2 -2
- package/dist/{RadioGroup-SSZYch-J.js → RadioGroup-B7_pNwn9.js} +13 -13
- package/dist/{RadioGroup-B_zJdn4y.d.ts → RadioGroup-CZg2kIMk.d.ts} +3 -3
- package/dist/{RichTextEditor-D6RewmRj.js → RichTextEditor-D9-B1Cze.js} +52 -133
- package/dist/{RichTextEditor-B_JX3nor.d.ts → RichTextEditor-YxuRUlI7.d.ts} +1 -1
- package/dist/{Select-CuZDkeQs.js → Select-CkujlTjm.js} +5 -4
- package/dist/{Select-DeapZMYx.d.ts → Select-pHbyJdZJ.d.ts} +1 -1
- package/dist/{SelectBase-7SE9Za2r.d.ts → SelectBase-Omiq2D3M.d.ts} +3 -3
- package/dist/{Slider-DJ9K_a-x.js → Slider-BHPl0OPy.js} +11 -11
- package/dist/{Slider-BFViQmM3.d.ts → Slider-EYlGCLWe.d.ts} +1 -1
- package/dist/{Spinner-BEYBu85B.js → Spinner-BeVTUzzx.js} +1 -1
- package/dist/{Spinner-BbcI6IOb.d.ts → Spinner-DbXeDOa2.d.ts} +2 -1
- package/dist/{SplitButton-lL87EcBL.d.ts → SplitButton-D9ngY1rJ.d.ts} +3 -3
- package/dist/{Stepper-C1YPgTBG.js → Stepper-Cp5vbL5g.js} +4 -117
- package/dist/{Stepper-hlhViuaK.d.ts → Stepper-TATlHZhQ.d.ts} +9 -8
- package/dist/{Switch-JxRmH1dX.js → Switch-CqnGEdeD.js} +11 -11
- package/dist/{Switch-DPftmB1b.d.ts → Switch-s_EPn0Jz.d.ts} +1 -1
- package/dist/Table-BDNSuEWc.js +689 -0
- package/dist/Tag-AHfV_XSf.d.ts +44 -0
- package/dist/{Tag-HiDH438e.js → Tag-DPg5sL1Z.js} +22 -21
- package/dist/{TextArea-gikUKKDl.js → TextArea-DqHDiRGJ.js} +6 -6
- package/dist/{TextArea-BhrCBGbq.d.ts → TextArea-l_keyLK7.d.ts} +2 -2
- package/dist/{TextButton-DnXRykhF.d.ts → TextButton-XUhV_1s0.d.ts} +4 -4
- package/dist/{TimePicker-CmT89X7v.d.ts → TimePicker-B1POvGWs.d.ts} +2 -2
- package/dist/{TimePicker-DtNTOOGr.js → TimePicker-DQ6JCkGB.js} +10 -10
- package/dist/Toast-DtG3pA61.js +53 -0
- package/dist/{Toast-B4cXs2rj.d.ts → Toast-ruXqONDA.d.ts} +1 -1
- package/dist/{ToastContainer-BbsMIwtC.js → ToastContainer-qgpzMFD4.js} +4 -3
- package/dist/{ToggleButton-BGuzPJDO.d.ts → ToggleButton-7aP8Jb11.d.ts} +2 -2
- package/dist/{ToggleGroup-D9CFdM5-.d.ts → ToggleGroup-CRFDIPGZ.d.ts} +1 -1
- package/dist/{ToggleGroup-Cl0NS3fe.js → ToggleGroup-DX0VYXwP.js} +25 -58
- package/dist/{Tooltip-aE1Vswxz.js → Tooltip-B9DKcYvr.js} +6 -47
- package/dist/{Tooltip-D7dNwGy9.d.ts → Tooltip-DHv6vAqW.d.ts} +6 -5
- package/dist/{TooltipWrapper-CRf-JFeo.js → TooltipWrapper-DznDgVJB.js} +4 -4
- package/dist/{Typography-B0Gp1lpc.js → Typography-LU4z2pR1.js} +2 -2
- package/dist/{Typography-BiuidzDC.d.ts → Typography-XljT9s02.d.ts} +1 -1
- package/dist/accordion.cva-CL1bVscW.js +129 -0
- package/dist/{autocomplete-BJ7rqWa4.d.ts → autocomplete-DeERHN8W.d.ts} +2 -2
- package/dist/badgeButton.cva-B2bgCQP6.d.ts +41 -0
- package/dist/badgeButton.cva-CvN4CTx5.js +300 -0
- package/dist/breadcrumbs.cva-7zzdDhVR.js +27 -0
- package/dist/{button.cva-BvRI-3Gn.d.ts → button.cva-C7kEhgoA.d.ts} +7 -6
- package/dist/{buttonContent.cva-BDT_CReI.d.ts → buttonContent.cva-DPIlROA9.d.ts} +2 -2
- package/dist/{checkbox-BfcE8J5P.d.ts → checkbox-DxIPDTK5.d.ts} +1 -1
- package/dist/{checkbox-group-CHs2wFHS.d.ts → checkbox-group-B3BOVshI.d.ts} +1 -1
- package/dist/{checkbox.cva-gv87kr1W.d.ts → checkbox.cva-t1Ox50hy.d.ts} +4 -3
- package/dist/components/accordion.js +1 -1
- package/dist/components/alert-dialog.d.ts +1 -1
- package/dist/components/alert-dialog.js +4 -4
- package/dist/components/alert.d.ts +1 -1
- package/dist/components/alert.js +1 -1
- package/dist/components/autocomplete.d.ts +1 -1
- package/dist/components/autocomplete.js +5 -4
- package/dist/components/badge-button.d.ts +2 -0
- package/dist/components/{pill-button.js → badge-button.js} +13 -12
- package/dist/components/badge.d.ts +1 -1
- package/dist/components/badge.js +56 -37
- package/dist/components/bottom-sheet.d.ts +2 -2
- package/dist/components/bottom-sheet.js +2 -2
- package/dist/components/breadcrumbs.d.ts +1 -1
- package/dist/components/breadcrumbs.js +1 -1
- package/dist/components/button.d.ts +2 -2
- package/dist/components/button.js +1 -1
- package/dist/components/checkbox-group.d.ts +1 -1
- package/dist/components/checkbox-group.js +6 -6
- package/dist/components/checkbox.d.ts +1 -1
- package/dist/components/checkbox.js +1 -1
- package/dist/components/date-picker.d.ts +1 -1
- package/dist/components/date-picker.js +1 -1
- package/dist/components/date-range-picker.d.ts +1 -1
- package/dist/components/date-range-picker.js +1 -1
- package/dist/components/date-time-picker.d.ts +1 -1
- package/dist/components/date-time-picker.js +1 -1
- package/dist/components/dialog.d.ts +1 -1
- package/dist/components/dialog.js +1 -1
- package/dist/components/drawer.js +3 -3
- package/dist/components/dropdown-menu.d.ts +2 -2
- package/dist/components/dropdown-menu.js +2 -2
- package/dist/components/file-input.d.ts +1 -1
- package/dist/components/file-input.js +1 -1
- package/dist/components/file-upload-container.d.ts +2 -2
- package/dist/components/file-upload-container.js +1 -1
- package/dist/components/file-upload.d.ts +2 -2
- package/dist/components/file-upload.js +1 -1
- package/dist/components/form-field.d.ts +1 -1
- package/dist/components/form-field.js +1 -1
- package/dist/components/icon-button.d.ts +1 -1
- package/dist/components/icon-button.js +2 -2
- package/dist/components/icon-slot.d.ts +2 -0
- package/dist/components/icon-slot.js +2 -0
- package/dist/components/inline-icon-button.d.ts +1 -1
- package/dist/components/inline-icon-button.js +1 -1
- package/dist/components/input.d.ts +1 -1
- package/dist/components/input.js +7 -7
- package/dist/components/link.d.ts +1 -1
- package/dist/components/link.js +32 -1
- package/dist/components/number-field.d.ts +1 -1
- package/dist/components/number-field.js +7 -7
- package/dist/components/number-range-input.d.ts +1 -1
- package/dist/components/number-range-input.js +1 -1
- package/dist/components/pagination-list.d.ts +1 -1
- package/dist/components/pagination-list.js +1 -1
- package/dist/components/pagination.d.ts +1 -1
- package/dist/components/pagination.js +2 -2
- package/dist/components/password-input.d.ts +1 -1
- package/dist/components/popover.d.ts +1 -1
- package/dist/components/popover.js +6 -5
- package/dist/components/progress.d.ts +1 -1
- package/dist/components/progress.js +1 -1
- package/dist/components/query-autocomplete.d.ts +2 -2
- package/dist/components/query-autocomplete.js +2 -2
- package/dist/components/query-select.d.ts +1 -1
- package/dist/components/query-select.js +3 -3
- package/dist/components/radio-group.d.ts +1 -1
- package/dist/components/radio-group.js +1 -1
- package/dist/components/select.d.ts +2 -2
- package/dist/components/select.js +1 -1
- package/dist/components/slider.d.ts +1 -1
- package/dist/components/slider.js +1 -1
- package/dist/components/spinner.d.ts +1 -1
- package/dist/components/spinner.js +1 -1
- package/dist/components/split-button.d.ts +1 -1
- package/dist/components/split-button.js +3 -3
- package/dist/components/stepper.d.ts +1 -1
- package/dist/components/stepper.js +1 -1
- package/dist/components/switch.d.ts +1 -1
- package/dist/components/switch.js +1 -1
- package/dist/components/tag.d.ts +1 -1
- package/dist/components/tag.js +1 -1
- package/dist/components/text-area.d.ts +1 -1
- package/dist/components/text-area.js +1 -1
- package/dist/components/text-button.d.ts +1 -1
- package/dist/components/text-button.js +1 -1
- package/dist/components/time-picker.d.ts +1 -1
- package/dist/components/time-picker.js +1 -1
- package/dist/components/toast.d.ts +2 -2
- package/dist/components/toast.js +2 -2
- package/dist/components/toggle-button.d.ts +1 -1
- package/dist/components/toggle-button.js +1 -1
- package/dist/components/toggle-group.d.ts +2 -2
- package/dist/components/toggle-group.js +1 -1
- package/dist/components/tooltip-ellipsis.js +1 -1
- package/dist/components/tooltip.d.ts +1 -1
- package/dist/components/tooltip.js +1 -1
- package/dist/components/typography.d.ts +2 -2
- package/dist/components/typography.js +1 -1
- package/dist/components/use-toast.d.ts +1 -1
- package/dist/components/use-toast.js +2 -2
- package/dist/config/confirmation.d.ts +1 -1
- package/dist/config/link-context.d.ts +2 -2
- package/dist/config/ui-config.d.ts +2 -2
- package/dist/config/ui-config.js +1 -1
- package/dist/config/ui-configurator-theme.d.ts +2 -0
- package/dist/config/ui-configurator-theme.js +2 -0
- package/dist/config/ui-configurator-vite.d.ts +10 -0
- package/dist/config/ui-configurator-vite.js +174 -0
- package/dist/config/ui-configurator.d.ts +934 -0
- package/dist/config/ui-configurator.js +3731 -0
- package/dist/config/ui-overrides.d.ts +1 -1
- package/dist/config/ui-overrides.js +1 -1
- package/dist/{confirmation.context-DPAKsLYl.d.ts → confirmation.context-BOeEVczb.d.ts} +1 -1
- package/dist/{date-picker-BYFWSbN8.d.ts → date-picker-DnxDmlOW.d.ts} +1 -1
- package/dist/{date-range-picker-BaaXOObm.d.ts → date-range-picker-DHDOSvHN.d.ts} +1 -1
- package/dist/{date-time-picker-D42cTCgx.d.ts → date-time-picker-UkTa0OJ8.d.ts} +1 -1
- package/dist/datePickerInput.cva-Cd7UUN61.js +14 -0
- package/dist/{datePickerValue.utils-CFCY-fRJ.js → datePickerValue.utils-CUzkWie8.js} +5 -5
- package/dist/{dialog.cva---xiOXMQ.js → dialog.cva-COhDZaVl.js} +4 -4
- package/dist/{dist-B8h0VT0E.js → dist-CAdwxJbe.js} +1 -208
- package/dist/{dom.utils-DjuRTR6U.js → dom.utils-D1AopHx9.js} +1 -1
- package/dist/dropdownMenu.cva-DvEmX0bs.js +34 -0
- package/dist/{dynamicInputs-wEEikYeg.d.ts → dynamicInputs-iP39lVKf.d.ts} +102 -100
- package/dist/{fieldAdapter-C0lCFmf0.js → fieldAdapter-DjYls12j.js} +1 -1
- package/dist/{file-input-C56GXRwz.d.ts → file-input-DkbkdI7l.d.ts} +1 -1
- package/dist/{file-upload-Bx0X534g.d.ts → file-upload-CTsPhxJk.d.ts} +2 -2
- package/dist/fileUpload.cva-ujmStxB1.js +42 -0
- package/dist/{fileUpload.types-DWuQKA2l.d.ts → fileUpload.types-n5FxK_F-.d.ts} +2 -2
- package/dist/iconSlot.cva-CnpFzAOR.d.ts +21 -0
- package/dist/icons.d.ts +2 -1
- package/dist/icons.js +2 -1
- package/dist/index.d.ts +87 -86
- package/dist/index.js +55 -44
- package/dist/info-iUmX3uDk.js +32 -0
- package/dist/{input-D2kGX0hW.d.ts → input-CdQNCPgH.d.ts} +1 -1
- package/dist/{input.cva-BhDJxc7r.d.ts → input.cva-BsHgYa-L.d.ts} +3 -2
- package/dist/{input.cva-BcXyC1vZ.js → input.cva-DJA8ovm_.js} +9 -9
- package/dist/{link.context-CDZn6oL2.d.ts → link.context-D5qyz9Rf.d.ts} +1 -1
- package/dist/link.cva-DMTHZiJG.js +12 -0
- package/dist/{number-field-Bw2GKr0s.d.ts → number-field-CUDbenNV.d.ts} +1 -1
- package/dist/{number-range-input-Dqe6x2dR.d.ts → number-range-input-DZGrcvjL.d.ts} +1 -1
- package/dist/{password-input-DepKyhh3.d.ts → password-input-fYN20cQO.d.ts} +1 -1
- package/dist/{popover.cva-BJSkLndY.js → popover.cva-Bhud1wnp.js} +1 -1
- package/dist/popoverAnimation-DEZSvKP8.js +4 -0
- package/dist/{query-autocomplete-BSpHin_R.d.ts → query-autocomplete-CfuQeiYG.d.ts} +2 -2
- package/dist/{query-select-m1DCp4UF.d.ts → query-select-CuT_sE6a.d.ts} +2 -2
- package/dist/{queryAutocomplete.types-CrbVUmvl.d.ts → queryAutocomplete.types-tl3r6iaY.d.ts} +2 -2
- package/dist/{radio-group-Civ3Fb70.d.ts → radio-group-B3ccPf0p.d.ts} +1 -1
- package/dist/{radio.cva-BlOrmxzf.d.ts → radio.cva-DN9VQ3Kb.d.ts} +4 -3
- package/dist/rhf/autocomplete.d.ts +2 -2
- package/dist/rhf/autocomplete.js +1 -1
- package/dist/rhf/checkbox-group.d.ts +2 -2
- package/dist/rhf/checkbox-group.js +1 -1
- package/dist/rhf/checkbox.d.ts +2 -2
- package/dist/rhf/checkbox.js +2 -2
- package/dist/rhf/date-picker.d.ts +2 -2
- package/dist/rhf/date-picker.js +2 -2
- package/dist/rhf/date-range-picker.d.ts +2 -2
- package/dist/rhf/date-range-picker.js +2 -2
- package/dist/rhf/date-time-picker.d.ts +2 -2
- package/dist/rhf/date-time-picker.js +2 -2
- package/dist/rhf/file-input.d.ts +2 -2
- package/dist/rhf/file-input.js +2 -2
- package/dist/rhf/file-upload.d.ts +2 -2
- package/dist/rhf/file-upload.js +2 -2
- package/dist/rhf/input.d.ts +2 -2
- package/dist/rhf/input.js +1 -1
- package/dist/rhf/inputs.d.ts +2 -2
- package/dist/rhf/number-field.d.ts +2 -2
- package/dist/rhf/number-field.js +1 -1
- package/dist/rhf/number-range-input.d.ts +2 -2
- package/dist/rhf/number-range-input.js +2 -2
- package/dist/rhf/password-input.d.ts +2 -2
- package/dist/rhf/password-input.js +1 -1
- package/dist/rhf/query-autocomplete.d.ts +1 -1
- package/dist/rhf/query-autocomplete.js +1 -1
- package/dist/rhf/query-select.d.ts +1 -1
- package/dist/rhf/query-select.js +1 -1
- package/dist/rhf/radio-group.d.ts +2 -2
- package/dist/rhf/radio-group.js +2 -2
- package/dist/rhf/rich-text-editor.d.ts +2 -2
- package/dist/rhf/rich-text-editor.js +2 -2
- package/dist/rhf/select.d.ts +2 -2
- package/dist/rhf/select.js +2 -2
- package/dist/rhf/slider.d.ts +2 -2
- package/dist/rhf/slider.js +2 -2
- package/dist/rhf/switch.d.ts +2 -2
- package/dist/rhf/switch.js +2 -2
- package/dist/rhf/text-area.d.ts +2 -2
- package/dist/rhf/text-area.js +2 -2
- package/dist/rhf/time-picker.d.ts +2 -2
- package/dist/rhf/time-picker.js +2 -2
- package/dist/rhf/toggle-group.d.ts +2 -2
- package/dist/rhf/toggle-group.js +2 -2
- package/dist/{rhf-D8B7mLO1.js → rhf-t348TCCL.js} +1 -1
- package/dist/rhf.d.ts +87 -86
- package/dist/rhf.js +55 -44
- package/dist/{rich-text-editor-DvNEOIux.d.ts → rich-text-editor-B-Onl7T8.d.ts} +1 -1
- package/dist/rich-text-editor.d.ts +1 -1
- package/dist/rich-text-editor.js +1 -1
- package/dist/{select-DY5QtwqI.d.ts → select-B4a52eWW.d.ts} +2 -2
- package/dist/selectDesktop.cva-CHAMxhfO.js +69 -0
- package/dist/{slider-CrB-Gkcv.d.ts → slider-dNj9jruO.d.ts} +1 -1
- package/dist/{staticDateTimeSegments-DR8bJw-F.js → staticDateTimeSegments-CsCE9Buo.js} +26 -27
- package/dist/{staticSelect.utils-Cm7MoDVG.js → staticSelect.utils-BemUyaaA.js} +31 -90
- package/dist/stepper.cva-CZ0Kj-s7.js +116 -0
- package/dist/style-merge.util-zLimKwt6.d.ts +40 -0
- package/dist/styles/color-utilities.css +13 -25
- package/dist/styles/configurator.css +1852 -0
- package/dist/styles/input.d.ts +1 -1
- package/dist/{switch-8WzXfTS8.d.ts → switch-C--iWnY8.d.ts} +1 -1
- package/dist/switch.cva-CWNzmdRc.d.ts +16 -0
- package/dist/table.cva-BikE8qJH.js +49 -0
- package/dist/tanstack/autocomplete.d.ts +1 -1
- package/dist/tanstack/checkbox-group.d.ts +1 -1
- package/dist/tanstack/checkbox.d.ts +1 -1
- package/dist/tanstack/checkbox.js +1 -1
- package/dist/tanstack/date-picker.d.ts +1 -1
- package/dist/tanstack/date-picker.js +1 -1
- package/dist/tanstack/date-range-picker.d.ts +1 -1
- package/dist/tanstack/date-range-picker.js +1 -1
- package/dist/tanstack/date-time-picker.d.ts +1 -1
- package/dist/tanstack/date-time-picker.js +1 -1
- package/dist/tanstack/file-input.d.ts +1 -1
- package/dist/tanstack/file-input.js +1 -1
- package/dist/tanstack/file-upload.d.ts +2 -2
- package/dist/tanstack/file-upload.js +1 -1
- package/dist/tanstack/form.d.ts +1 -1
- package/dist/tanstack/form.js +1 -1
- package/dist/tanstack/input.d.ts +1 -1
- package/dist/tanstack/inputs.d.ts +3 -3
- package/dist/tanstack/inputs.js +1 -1
- package/dist/tanstack/number-field.d.ts +1 -1
- package/dist/tanstack/number-range-input.d.ts +1 -1
- package/dist/tanstack/number-range-input.js +1 -1
- package/dist/tanstack/password-input.d.ts +1 -1
- package/dist/tanstack/query-select.d.ts +1 -1
- package/dist/tanstack/radio-group.d.ts +1 -1
- package/dist/tanstack/radio-group.js +1 -1
- package/dist/tanstack/rich-text-editor.d.ts +1 -1
- package/dist/tanstack/rich-text-editor.js +1 -1
- package/dist/tanstack/select.d.ts +1 -1
- package/dist/tanstack/select.js +1 -1
- package/dist/tanstack/slider.d.ts +1 -1
- package/dist/tanstack/slider.js +1 -1
- package/dist/tanstack/switch.d.ts +1 -1
- package/dist/tanstack/switch.js +1 -1
- package/dist/tanstack/table.d.ts +1 -1
- package/dist/tanstack/table.js +2 -1
- package/dist/tanstack/text-area.d.ts +1 -1
- package/dist/tanstack/text-area.js +1 -1
- package/dist/tanstack/time-picker.d.ts +1 -1
- package/dist/tanstack/time-picker.js +1 -1
- package/dist/tanstack/toggle-group.d.ts +2 -2
- package/dist/tanstack/toggle-group.js +1 -1
- package/dist/tanstack.d.ts +71 -70
- package/dist/tanstack.js +66 -53
- package/dist/{text-area-CqnKRWKq.d.ts → text-area-DQAtpOQp.d.ts} +1 -1
- package/dist/theme-model-C-QMCksE.js +136 -0
- package/dist/theme-model-T1zIdBg8.d.ts +12 -0
- package/dist/{time-picker-Cz1GIzpF.d.ts → time-picker-DoGfbil6.d.ts} +1 -1
- package/dist/{toast.cva-Cj6o2Rmu.d.ts → toast.cva-By5lvAfr.d.ts} +3 -2
- package/dist/toast.cva-C_L_RffH.js +163 -0
- package/dist/{toast.runtime-CIKvmkjo.js → toast.runtime-cxex9e4E.js} +2 -1
- package/dist/{toggle-group-CPkKHm1t.d.ts → toggle-group-C1nMDOwz.d.ts} +1 -1
- package/dist/toggleGroup.cva-MbpaEBg1.js +35 -0
- package/dist/{toggleGroup.types-DD6uRI5G.d.ts → toggleGroup.types-Bp43zbSQ.d.ts} +2 -1
- package/dist/tooltip.cva-BIzlOXHH.js +48 -0
- package/dist/{tooltipWrapper.cva-CUu8pI-a.js → tooltipWrapper.cva-BBQ4ic3D.js} +1 -1
- package/dist/{typography.cva-jtp6WWUH.d.ts → typography.cva-D1JOEYl-.d.ts} +2 -1
- package/dist/{typography.cva-CJZZSGXW.js → typography.cva-iD15k56p.js} +1 -1
- package/dist/{uiConfig.context-D2eUIPHn.js → uiConfig.context-BS3r_kTS.js} +1 -1
- package/dist/{uiConfig.context-aoarCLYX.d.ts → uiConfig.context-DeBX2beU.d.ts} +8 -8
- package/dist/{uiOverrides.context-Bfm2n-n8.js → uiOverrides.context-BTCH9y5a.js} +2 -2
- package/dist/{uiOverrides.context-C3xb4Ttq.d.ts → uiOverrides.context-DEp139He.d.ts} +11 -44
- package/dist/underline-66hmELxa.js +81 -0
- package/dist/{useBreakpoint-BOA-MyoT.js → useBreakpoint-DQoMN-BG.js} +1 -1
- package/dist/{useFieldAccessibility-D2_Qm26-.js → useFieldAccessibility-B4MVL6fz.js} +15 -8
- package/dist/{useFormAutosave-BYFn3LH8.js → useFormAutosave-Mg-tdwMh.js} +2 -2
- package/dist/{useStaticInputHandoff-DB9PgioW.js → useStaticInputHandoff-CvSBPUB3.js} +13 -10
- package/dist/useTableColumnConfig-gfVame8v.js +892 -0
- package/dist/{useTableNav-D9mICzNW.d.ts → useTableNav-Ckj5PBRk.d.ts} +3 -2
- package/dist/{useToast-DMSm59Y6.d.ts → useToast-yreVCUer.d.ts} +1 -1
- package/package.json +38 -6
- package/rulesync.jsonc +11 -0
- package/scripts/generate-rules.mjs +34 -0
- package/src/configurator/README.md +71 -0
- package/dist/Button-sn52l1Yv.js +0 -506
- package/dist/FormFieldHeaderTooltip-Dl24v4_j.js +0 -45
- package/dist/Link-Btxj2gzg.js +0 -42
- package/dist/PillButton-DASBXLFB.d.ts +0 -15
- package/dist/Tag-Cch_68QO.d.ts +0 -43
- package/dist/components/pill-button.d.ts +0 -2
- package/dist/pillButton.cva-BEWuu0qm.d.ts +0 -34
- package/dist/pillButton.cva-DlP5tOT5.js +0 -197
- package/dist/switch.cva-8T0fw31t.d.ts +0 -15
- package/dist/useTableColumnConfig-CcJxu14U.js +0 -1625
|
@@ -1,1625 +0,0 @@
|
|
|
1
|
-
import { t as logger } from "./logger-CqZjM-sn.js";
|
|
2
|
-
import { t as createLucideIcon } from "./createLucideIcon-LcezOE4z.js";
|
|
3
|
-
import { t as UIConfig } from "./uiConfig.context-D2eUIPHn.js";
|
|
4
|
-
import { t as ChevronDown } from "./chevron-down-B4Pr8bD3.js";
|
|
5
|
-
import { t as ChevronUp } from "./chevron-up-D_Gqpb5M.js";
|
|
6
|
-
import { t as clsx } from "./clsx-CnD0nOiA.js";
|
|
7
|
-
import { t as Checkbox } from "./Checkbox-BepzfVfK.js";
|
|
8
|
-
import { t as UIOverrides } from "./uiOverrides.context-Bfm2n-n8.js";
|
|
9
|
-
import { t as Typography } from "./Typography-B0Gp1lpc.js";
|
|
10
|
-
import { t as Spinner } from "./Spinner-BEYBu85B.js";
|
|
11
|
-
import { InlineIconButton } from "./components/inline-icon-button.js";
|
|
12
|
-
import "./i18n-CX2EjhJI.js";
|
|
13
|
-
import { t as useIntersectionObserver } from "./useIntersectionObserver-DYfHnGGU.js";
|
|
14
|
-
import { t as IntlUtils } from "./intl.utils-zwAFoZ0U.js";
|
|
15
|
-
import { t as DateUtils } from "./date.utils-B8_QF9y6.js";
|
|
16
|
-
import { t as StringUtils } from "./string.utils-BPgv6QwA.js";
|
|
17
|
-
import { t as ZodUtils } from "./zod.utils-DrrPDT9v.js";
|
|
18
|
-
import { t as Dialog } from "./Dialog-DdRP4YFC.js";
|
|
19
|
-
import { Pagination } from "./components/pagination.js";
|
|
20
|
-
import { t as useTranslationMemo } from "./useTranslationMemo-CrZbeyBv.js";
|
|
21
|
-
import { t as UIRouter } from "./router.context-B0jTMtE0.js";
|
|
22
|
-
import { t as RoutingUtils } from "./routing.utils-UTQonIhB.js";
|
|
23
|
-
import { Suspense, lazy, useCallback, useEffect, useMemo, useRef, useState } from "react";
|
|
24
|
-
import { c } from "react/compiler-runtime";
|
|
25
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
|
26
|
-
import { useTranslation } from "react-i18next";
|
|
27
|
-
import { z } from "zod";
|
|
28
|
-
import { createPaginatedRowModel, createSortedRowModel, flexRender, stockFeatures, tableFeatures, useTable } from "@tanstack/react-table";
|
|
29
|
-
import i18next from "i18next";
|
|
30
|
-
//#region ../../node_modules/.bun/lucide-react@1.43.0+83d5fd7b249dbeef/node_modules/lucide-react/dist/esm/icons/grip-vertical.mjs
|
|
31
|
-
/**
|
|
32
|
-
* @license lucide-react v1.43.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
35
|
-
* See the LICENSE file in the root directory of this source tree.
|
|
36
|
-
*/
|
|
37
|
-
const __iconData = {
|
|
38
|
-
name: "grip-vertical",
|
|
39
|
-
size: 24,
|
|
40
|
-
node: [
|
|
41
|
-
["circle", {
|
|
42
|
-
cx: "9",
|
|
43
|
-
cy: "12",
|
|
44
|
-
r: "1",
|
|
45
|
-
key: "1vctgf"
|
|
46
|
-
}],
|
|
47
|
-
["circle", {
|
|
48
|
-
cx: "9",
|
|
49
|
-
cy: "5",
|
|
50
|
-
r: "1",
|
|
51
|
-
key: "hp0tcf"
|
|
52
|
-
}],
|
|
53
|
-
["circle", {
|
|
54
|
-
cx: "9",
|
|
55
|
-
cy: "19",
|
|
56
|
-
r: "1",
|
|
57
|
-
key: "fkjjf6"
|
|
58
|
-
}],
|
|
59
|
-
["circle", {
|
|
60
|
-
cx: "15",
|
|
61
|
-
cy: "12",
|
|
62
|
-
r: "1",
|
|
63
|
-
key: "1tmaij"
|
|
64
|
-
}],
|
|
65
|
-
["circle", {
|
|
66
|
-
cx: "15",
|
|
67
|
-
cy: "5",
|
|
68
|
-
r: "1",
|
|
69
|
-
key: "19l28e"
|
|
70
|
-
}],
|
|
71
|
-
["circle", {
|
|
72
|
-
cx: "15",
|
|
73
|
-
cy: "19",
|
|
74
|
-
r: "1",
|
|
75
|
-
key: "f4zoj3"
|
|
76
|
-
}]
|
|
77
|
-
]
|
|
78
|
-
};
|
|
79
|
-
__iconData.node;
|
|
80
|
-
const GripVertical = createLucideIcon(__iconData);
|
|
81
|
-
//#endregion
|
|
82
|
-
//#region src/components/table/table.cva.ts
|
|
83
|
-
const tableRowDefinition = UIOverrides.defineConfig({
|
|
84
|
-
base: [
|
|
85
|
-
"h-9 max-h-12",
|
|
86
|
-
"not-selected:not-disabled:hover:bg-surface-default-background",
|
|
87
|
-
"disabled:opacity-50",
|
|
88
|
-
"selected:bg-interactive-subtle-secondary-background",
|
|
89
|
-
"selected:not-disabled:hover:bg-tint-interactive-subtle-secondary-background/80",
|
|
90
|
-
"data-clickable:cursor-pointer",
|
|
91
|
-
"not-disabled:focus-within:bg-tint-interactive-subtle-secondary-background/60"
|
|
92
|
-
],
|
|
93
|
-
config: { variants: { alternatingBackground: {
|
|
94
|
-
even: "even:bg-surface-inverted-alt/5",
|
|
95
|
-
odd: "odd:bg-surface-inverted-alt/5"
|
|
96
|
-
} } }
|
|
97
|
-
});
|
|
98
|
-
const theadDefinition = UIOverrides.defineConfig({ base: ["group/table-head sticky top-0 z-sticky data-is-sticky:shadow-2"] });
|
|
99
|
-
const tableHeadRowDefinition = UIOverrides.defineConfig({ base: ["h-8 w-full"] });
|
|
100
|
-
const tableHeadDataDefinition = UIOverrides.defineConfig({
|
|
101
|
-
base: ["border-b border-b-border-default-subtle border-solid px-table-header-cell-container-side-default py-table-header-cell-container-height-default text-left", "group-data-[is-sticky=true]/table-head:bg-surface-default-card"],
|
|
102
|
-
config: {
|
|
103
|
-
variants: { hasRightBorder: {
|
|
104
|
-
true: "border-l border-l-border-default-subtle border-solid",
|
|
105
|
-
false: ""
|
|
106
|
-
} },
|
|
107
|
-
defaultVariants: { hasRightBorder: true }
|
|
108
|
-
}
|
|
109
|
-
});
|
|
110
|
-
const tableDataDefinition = UIOverrides.defineConfig({
|
|
111
|
-
base: [
|
|
112
|
-
"relative h-0.5 overflow-hidden text-ellipsis whitespace-nowrap border-t border-t-transparent px-2",
|
|
113
|
-
"border-b border-b-border-default-subtle",
|
|
114
|
-
"has-[*>[data-hovered]:not([data-disabled])]:hover:border-b-tint-border-default-input/80",
|
|
115
|
-
"has-[*>[data-invalid]]:border-b-border-destructive-base!",
|
|
116
|
-
"has-[*>[data-focused]]:border-b-interactive-ring"
|
|
117
|
-
],
|
|
118
|
-
config: {
|
|
119
|
-
variants: { hasRightBorder: {
|
|
120
|
-
true: "border-l border-l-border-default-subtle",
|
|
121
|
-
false: ""
|
|
122
|
-
} },
|
|
123
|
-
defaultVariants: { hasRightBorder: true }
|
|
124
|
-
}
|
|
125
|
-
});
|
|
126
|
-
const tableHeaderTextDefinition = UIOverrides.defineConfig({ base: ["overflow-hidden text-ellipsis px-table-cell-content-side-m py-table-cell-content-height-m text-surface-default-card-foreground"] });
|
|
127
|
-
const tableCellTextDefinition = UIOverrides.defineConfig({ base: ["block overflow-hidden text-ellipsis text-surface-default-foreground"] });
|
|
128
|
-
//#endregion
|
|
129
|
-
//#region src/components/table/CellText.tsx
|
|
130
|
-
const CellText = (props) => {
|
|
131
|
-
const uiConfig = UIConfig.useConfig();
|
|
132
|
-
const { size = uiConfig.tableCellText.size, children, style, className } = props;
|
|
133
|
-
const cellTextCva = UIOverrides.useCva("table.cellTextCva", tableCellTextDefinition);
|
|
134
|
-
return /* @__PURE__ */ jsx(Typography, {
|
|
135
|
-
className: cellTextCva({ className }),
|
|
136
|
-
as: "span",
|
|
137
|
-
size,
|
|
138
|
-
style,
|
|
139
|
-
"data-rac": true,
|
|
140
|
-
children
|
|
141
|
-
});
|
|
142
|
-
};
|
|
143
|
-
//#endregion
|
|
144
|
-
//#region src/components/table/HeaderText.tsx
|
|
145
|
-
const HeaderText = (props) => {
|
|
146
|
-
const uiConfig = UIConfig.useConfig();
|
|
147
|
-
const { size = uiConfig.tableHeaderText.size, children, style, className } = props;
|
|
148
|
-
const headerTextCva = UIOverrides.useCva("table.headerTextCva", tableHeaderTextDefinition);
|
|
149
|
-
return /* @__PURE__ */ jsx(Typography, {
|
|
150
|
-
className: headerTextCva({ className }),
|
|
151
|
-
as: "span",
|
|
152
|
-
size,
|
|
153
|
-
style,
|
|
154
|
-
children
|
|
155
|
-
});
|
|
156
|
-
};
|
|
157
|
-
//#endregion
|
|
158
|
-
//#region src/hooks/useTableNav.ts
|
|
159
|
-
const Selectors = {
|
|
160
|
-
Cell: "[role=\"cell\"],[role=\"gridcell\"],[role=\"columnheader\"],[role=\"rowheader\"],td,th",
|
|
161
|
-
Row: "[role=\"row\"],tr",
|
|
162
|
-
RowGroup: "[role=\"rowgroup\"],thead,tbody,tfoot",
|
|
163
|
-
/** Selector from here: https://github.com/Shopify/polaris/blob/main/polaris-react/src/utilities/focus.ts#L10 */
|
|
164
|
-
Focusable: "a,frame,iframe,input:not([type=hidden]):not(:disabled),select:not(:disabled),textarea:not(:disabled),button:not([aria-disabled=\"true\"]):not([tabindex=\"-1\"]):not(:disabled),*[tabindex]"
|
|
165
|
-
};
|
|
166
|
-
var DataGridNav = class {
|
|
167
|
-
constructor(config = {}) {
|
|
168
|
-
this.keys = [];
|
|
169
|
-
this.activeCell = null;
|
|
170
|
-
this.debugLog = (functionName, message) => {
|
|
171
|
-
if (this.debug) logger.info(`[${functionName}]: ${message}`);
|
|
172
|
-
};
|
|
173
|
-
const { selectors = {}, pageUpDown, debug = false } = config;
|
|
174
|
-
this.selectors = {
|
|
175
|
-
...Selectors,
|
|
176
|
-
...selectors
|
|
177
|
-
};
|
|
178
|
-
this.pageUpDown = pageUpDown;
|
|
179
|
-
this.keys = [];
|
|
180
|
-
this.debug = debug;
|
|
181
|
-
this.disabled = false;
|
|
182
|
-
}
|
|
183
|
-
/**
|
|
184
|
-
* Disables the keyboard listener in cases
|
|
185
|
-
* that elements inside the grid need to use
|
|
186
|
-
* arrows keys etc., like select dropdowns
|
|
187
|
-
*/
|
|
188
|
-
disable() {
|
|
189
|
-
this.disabled = true;
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* Enables the keyboard listeners
|
|
193
|
-
*/
|
|
194
|
-
enable() {
|
|
195
|
-
this.disabled = false;
|
|
196
|
-
}
|
|
197
|
-
isFocusable(el) {
|
|
198
|
-
return el instanceof HTMLElement || el instanceof SVGElement;
|
|
199
|
-
}
|
|
200
|
-
getActiveCell() {
|
|
201
|
-
return this.activeCell;
|
|
202
|
-
}
|
|
203
|
-
/** Used as a keyboard listener for key up */
|
|
204
|
-
tableKeyUp() {
|
|
205
|
-
this.keys = [];
|
|
206
|
-
}
|
|
207
|
-
/** Used as a keyboard listener for key down */
|
|
208
|
-
tableKeyDown(e) {
|
|
209
|
-
if (this.disabled) return;
|
|
210
|
-
/**
|
|
211
|
-
* Avoid page scrolling etc.
|
|
212
|
-
* Enable default behavior for:
|
|
213
|
-
* Tab, Shift + Tab
|
|
214
|
-
* TODO: Actually it will be better to just prevent
|
|
215
|
-
* in ArrowKeys and PageKeys maybe?
|
|
216
|
-
* Or should the consumer stop propagation?!
|
|
217
|
-
* Cannot work with preventDefault as it will
|
|
218
|
-
* first capture the event from an input in cell for example
|
|
219
|
-
*/
|
|
220
|
-
if ("ArrowDown" === e.key || "ArrowUp" === e.key || "ArrowLeft" === e.key || "ArrowRight" === e.key) e.preventDefault();
|
|
221
|
-
/**
|
|
222
|
-
* Add key to the stack if it's
|
|
223
|
-
* not the same with the last (long press)
|
|
224
|
-
*/
|
|
225
|
-
if (this.keys.length === 0 || this.keys[this.keys.length - 1] !== e.key) this.keys.push(e.key);
|
|
226
|
-
/**
|
|
227
|
-
* Need to check if we are inside a grid cell
|
|
228
|
-
* or not to enable/disable Grid Navigation
|
|
229
|
-
*/
|
|
230
|
-
if (!(e.target instanceof Element)) return;
|
|
231
|
-
const cell = e.target.parentElement?.closest(`${this.selectors.Cell},${this.selectors.Row}`);
|
|
232
|
-
if (!cell) return;
|
|
233
|
-
if (cell.matches(this.selectors.Cell)) this.cellNavigation(e);
|
|
234
|
-
else this.gridNavigation(e);
|
|
235
|
-
}
|
|
236
|
-
/**
|
|
237
|
-
* Handles the navigation inside a cell
|
|
238
|
-
*/
|
|
239
|
-
cellNavigation(e) {
|
|
240
|
-
if (!(e.target instanceof Element)) return;
|
|
241
|
-
/**
|
|
242
|
-
* Keys: Escape
|
|
243
|
-
* Restore grid navigation
|
|
244
|
-
*/
|
|
245
|
-
if (e.key === "Escape") {
|
|
246
|
-
const cell = e.target.closest(this.selectors.Cell);
|
|
247
|
-
if (cell && this.isFocusable(cell)) {
|
|
248
|
-
cell.focus();
|
|
249
|
-
return;
|
|
250
|
-
}
|
|
251
|
-
}
|
|
252
|
-
/**
|
|
253
|
-
* Keys: ArrowRight, ArrowDown
|
|
254
|
-
* Move to the next focusable cell, or the first one
|
|
255
|
-
*
|
|
256
|
-
* Arrow Down disabled:
|
|
257
|
-
* https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
|
|
258
|
-
*/
|
|
259
|
-
if (e.key === "ArrowRight" || e.key === "ArrowDown") {
|
|
260
|
-
const cell = e.target.closest(this.selectors.Cell);
|
|
261
|
-
if (!cell) return;
|
|
262
|
-
const focusableWidgets = [...cell.querySelectorAll(this.selectors.Focusable)];
|
|
263
|
-
const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);
|
|
264
|
-
const widgetToFocus = focusableWidgets[widgetIdx === focusableWidgets.length - 1 ? 0 : widgetIdx + 1];
|
|
265
|
-
if (this.isFocusable(widgetToFocus)) widgetToFocus.focus();
|
|
266
|
-
return;
|
|
267
|
-
}
|
|
268
|
-
/**
|
|
269
|
-
* Keys: ArrowLeft, ArrowUp
|
|
270
|
-
* Move to the previous focusable cell, or the last one
|
|
271
|
-
*
|
|
272
|
-
* Arrow Up disabled:
|
|
273
|
-
* https://github.com/w3c/aria-practices/issues/2739#issuecomment-1613538972
|
|
274
|
-
*/
|
|
275
|
-
if (e.key === "ArrowLeft" || e.key === "ArrowUp") {
|
|
276
|
-
const cell = e.target.closest(this.selectors.Cell);
|
|
277
|
-
if (!cell) return;
|
|
278
|
-
const focusableWidgets = [...cell.querySelectorAll(this.selectors.Focusable)];
|
|
279
|
-
const widgetIdx = focusableWidgets.findIndex((el) => el === e.target);
|
|
280
|
-
const widgetToFocus = focusableWidgets[widgetIdx === 0 ? focusableWidgets.length - 1 : widgetIdx - 1];
|
|
281
|
-
if (this.isFocusable(widgetToFocus)) widgetToFocus.focus();
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
/**
|
|
285
|
-
* Handles the navigation outside a cell
|
|
286
|
-
* on the grid level
|
|
287
|
-
*/
|
|
288
|
-
gridNavigation(e) {
|
|
289
|
-
const { target } = e;
|
|
290
|
-
if (!(e.target instanceof Element)) return;
|
|
291
|
-
if (!(target instanceof Element)) return;
|
|
292
|
-
if (this.keys.length === 1) {
|
|
293
|
-
/**
|
|
294
|
-
* Keys: Enter
|
|
295
|
-
* Should move focus inside the cell to the first focusable element:
|
|
296
|
-
* https://www.w3.org/WAI/ARIA/apg/patterns/grid/#gridNav_inside
|
|
297
|
-
*/
|
|
298
|
-
if (/^[a-zA-Z0-9]$/.test(e.key)) {
|
|
299
|
-
const cell = e.target.querySelector(this.selectors.Focusable);
|
|
300
|
-
if (cell && this.isFocusable(cell) && cell instanceof HTMLInputElement) {
|
|
301
|
-
cell.focus();
|
|
302
|
-
cell.value = `${cell.value}${e.key}`;
|
|
303
|
-
e.preventDefault();
|
|
304
|
-
}
|
|
305
|
-
return;
|
|
306
|
-
}
|
|
307
|
-
if (e.key === "Backspace") {
|
|
308
|
-
const cell = e.target.querySelector(this.selectors.Focusable);
|
|
309
|
-
if (cell && this.isFocusable(cell) && cell instanceof HTMLInputElement) {
|
|
310
|
-
const nativeInputValueSetter = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, "value")?.set;
|
|
311
|
-
if (nativeInputValueSetter) {
|
|
312
|
-
nativeInputValueSetter.call(cell, "");
|
|
313
|
-
const ev = new Event("input", { bubbles: true });
|
|
314
|
-
cell.dispatchEvent(ev);
|
|
315
|
-
}
|
|
316
|
-
}
|
|
317
|
-
return;
|
|
318
|
-
}
|
|
319
|
-
if (e.key === "Enter") {
|
|
320
|
-
const cell = e.target.querySelector(this.selectors.Focusable);
|
|
321
|
-
if (cell && this.isFocusable(cell)) {
|
|
322
|
-
if (cell.getAttribute("data-type") === "select-trigger") {
|
|
323
|
-
cell.click();
|
|
324
|
-
return;
|
|
325
|
-
}
|
|
326
|
-
cell.focus();
|
|
327
|
-
e.preventDefault();
|
|
328
|
-
}
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
/**
|
|
332
|
-
* Keys: ArrowLeft, ArrowRight
|
|
333
|
-
* Should move focus to the next/previous cell
|
|
334
|
-
*/
|
|
335
|
-
if (e.key === "ArrowLeft" || e.key === "ArrowRight") {
|
|
336
|
-
const direction = e.key === "ArrowLeft" ? "prev" : "next";
|
|
337
|
-
const cell = e.target.closest(this.selectors.Cell);
|
|
338
|
-
let nextCell = null;
|
|
339
|
-
if (direction === "next" && cell?.nextElementSibling instanceof HTMLElement) nextCell = cell.nextElementSibling;
|
|
340
|
-
if (direction === "prev" && cell?.previousElementSibling instanceof HTMLElement) nextCell = cell.previousElementSibling;
|
|
341
|
-
if (nextCell && this.isFocusable(nextCell)) {
|
|
342
|
-
nextCell.focus();
|
|
343
|
-
e.preventDefault();
|
|
344
|
-
}
|
|
345
|
-
}
|
|
346
|
-
/**
|
|
347
|
-
* Keys: Up,Down
|
|
348
|
-
* Should move focus to the same column of the next/previous row
|
|
349
|
-
*/
|
|
350
|
-
if (e.key === "ArrowDown" || e.key === "ArrowUp") {
|
|
351
|
-
this.verticalCellNavigation(e);
|
|
352
|
-
return;
|
|
353
|
-
}
|
|
354
|
-
/**
|
|
355
|
-
* Keys: PageUp, PageDown
|
|
356
|
-
* Should move focus to the first/last row
|
|
357
|
-
* or a predefined number of rows if user provides a value
|
|
358
|
-
*/
|
|
359
|
-
if (e.key === "PageUp" || e.key === "PageDown") {
|
|
360
|
-
this.pageCellNavigation(e);
|
|
361
|
-
return;
|
|
362
|
-
}
|
|
363
|
-
/**
|
|
364
|
-
* Keys: Home, End
|
|
365
|
-
* Should move focus to the first/last cell of the current row
|
|
366
|
-
*/
|
|
367
|
-
if (e.key === "Home" || e.key === "End") {
|
|
368
|
-
const rowChildren = [...e.target.closest(this.selectors.Row)?.children || []];
|
|
369
|
-
if (e.key === "End") rowChildren.reverse();
|
|
370
|
-
this.focusOnFirstCell(rowChildren);
|
|
371
|
-
}
|
|
372
|
-
} else {
|
|
373
|
-
/**
|
|
374
|
-
* Keys: Control + Home, Control + End
|
|
375
|
-
* Should move focus to the first/last cell of the first/last row
|
|
376
|
-
*/
|
|
377
|
-
const [firstKey, secondKey] = this.keys;
|
|
378
|
-
if (firstKey === "Control" && (secondKey === "Home" || secondKey === "End")) {
|
|
379
|
-
const siblings = e.target.closest(this.selectors.Row).parentElement?.children;
|
|
380
|
-
if (!siblings) return;
|
|
381
|
-
const rowChildren = [...(secondKey === "Home" ? siblings[0] : siblings[siblings.length - 1])?.children || []];
|
|
382
|
-
if (secondKey === "End") rowChildren.reverse();
|
|
383
|
-
this.focusOnFirstCell(rowChildren);
|
|
384
|
-
}
|
|
385
|
-
}
|
|
386
|
-
}
|
|
387
|
-
pageCellNavigation(e) {
|
|
388
|
-
if (!(e.target instanceof Element)) return;
|
|
389
|
-
const row = e.target.closest(this.selectors.Row);
|
|
390
|
-
const cell = e.target.closest(this.selectors.Cell);
|
|
391
|
-
if (row && cell) {
|
|
392
|
-
const position = this.getColumnIndex(cell);
|
|
393
|
-
if (position === void 0) return;
|
|
394
|
-
const direction = e.key === "PageUp" ? "prev" : "next";
|
|
395
|
-
const siblings = row.parentElement?.children;
|
|
396
|
-
if (!siblings) return;
|
|
397
|
-
let destinationRow;
|
|
398
|
-
if (this.pageUpDown) {
|
|
399
|
-
const methodClbk = direction === "prev" ? "previousSibling" : "nextSibling";
|
|
400
|
-
let sibling = row[methodClbk];
|
|
401
|
-
if (sibling === null) return;
|
|
402
|
-
let lastVisitedSibling = sibling;
|
|
403
|
-
for (let i = 0; i < this.pageUpDown - 1 && sibling; i++) {
|
|
404
|
-
sibling = sibling[methodClbk];
|
|
405
|
-
if (sibling) lastVisitedSibling = sibling;
|
|
406
|
-
}
|
|
407
|
-
destinationRow = sibling || lastVisitedSibling;
|
|
408
|
-
} else destinationRow = direction === "prev" ? siblings[0] : siblings[siblings.length - 1];
|
|
409
|
-
if (!destinationRow || !(destinationRow instanceof Element)) return;
|
|
410
|
-
const child = destinationRow.children[position];
|
|
411
|
-
if (child && this.isFocusable(child)) child.focus();
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
verticalCellNavigation(e) {
|
|
415
|
-
if (!(e.target instanceof Element)) return;
|
|
416
|
-
const row = e.target.closest(this.selectors.Row);
|
|
417
|
-
const cell = e.target.closest(this.selectors.Cell);
|
|
418
|
-
if (row && cell) {
|
|
419
|
-
const cellPosition = this.getColumnIndex(cell);
|
|
420
|
-
const rowPosition = this.getRowIndex(row);
|
|
421
|
-
if (cellPosition === void 0 || rowPosition === void 0) return;
|
|
422
|
-
const direction = e.key === "ArrowUp" ? "prev" : "next";
|
|
423
|
-
/** Find previous rowgroup and focus on the proper cell */
|
|
424
|
-
if (rowPosition === 0 && direction === "prev") {
|
|
425
|
-
const currentRowGroup = row.parentElement?.closest(this.selectors.RowGroup);
|
|
426
|
-
const siblingRowGroups = [...currentRowGroup?.parentElement?.children || []];
|
|
427
|
-
const currentRowGroupIdx = siblingRowGroups.findIndex((el) => el === currentRowGroup);
|
|
428
|
-
if (currentRowGroupIdx !== 0) {
|
|
429
|
-
const rows = [...siblingRowGroups[currentRowGroupIdx - 1].querySelectorAll(this.selectors.Row)];
|
|
430
|
-
const child = rows[rows.length - 1].children[cellPosition];
|
|
431
|
-
if (child && this.isFocusable(child)) child.focus();
|
|
432
|
-
return;
|
|
433
|
-
}
|
|
434
|
-
}
|
|
435
|
-
/** Find next rowgroup and focus on the proper cell */
|
|
436
|
-
if (rowPosition === [...row.parentElement?.querySelectorAll(this.selectors.Row) || []].length - 1 && direction === "next") {
|
|
437
|
-
const currentRowGroup = row.parentElement?.closest(this.selectors.RowGroup);
|
|
438
|
-
const siblingRowGroups = [...currentRowGroup?.parentElement?.children || []];
|
|
439
|
-
const currentRowGroupIdx = siblingRowGroups.findIndex((el) => el === currentRowGroup);
|
|
440
|
-
if (currentRowGroupIdx !== siblingRowGroups.length - 1) {
|
|
441
|
-
const child = [...siblingRowGroups[currentRowGroupIdx + 1].querySelectorAll(this.selectors.Row)][0].children[cellPosition];
|
|
442
|
-
if (child && this.isFocusable(child)) child.focus();
|
|
443
|
-
return;
|
|
444
|
-
}
|
|
445
|
-
return;
|
|
446
|
-
}
|
|
447
|
-
/** Navigation in the same rowgroup */
|
|
448
|
-
const destinationRow = this.findUntil(direction, row, this.selectors.Row);
|
|
449
|
-
if (!destinationRow) return;
|
|
450
|
-
const child = destinationRow.children[cellPosition];
|
|
451
|
-
if (child && this.isFocusable(child)) child.focus();
|
|
452
|
-
}
|
|
453
|
-
}
|
|
454
|
-
/**
|
|
455
|
-
* Sending a row `Element` and then the first cell will be focused.
|
|
456
|
-
*
|
|
457
|
-
* If you want to focus the last cell then the row children can be passed in
|
|
458
|
-
* reversed order
|
|
459
|
-
*/
|
|
460
|
-
focusOnFirstCell(el) {
|
|
461
|
-
for (let i = 0; i < el.length; i++) {
|
|
462
|
-
const child = el[i];
|
|
463
|
-
if (this.isFocusable(child)) {
|
|
464
|
-
child.focus();
|
|
465
|
-
return;
|
|
466
|
-
}
|
|
467
|
-
}
|
|
468
|
-
}
|
|
469
|
-
/**
|
|
470
|
-
* Get the column index of a `cell` based on the first `row` parent.
|
|
471
|
-
* `cellIndex` could be used, but it's not supported in HTML tables.
|
|
472
|
-
*/
|
|
473
|
-
getColumnIndex(cell) {
|
|
474
|
-
let position = 0;
|
|
475
|
-
const siblings = cell?.parentNode?.children;
|
|
476
|
-
if (!siblings) return;
|
|
477
|
-
while (cell !== siblings[position] && siblings[position] !== void 0) position++;
|
|
478
|
-
if (siblings[position] === void 0) return;
|
|
479
|
-
return position;
|
|
480
|
-
}
|
|
481
|
-
/**
|
|
482
|
-
* Get the row index of a `row` based
|
|
483
|
-
* on its sibling rows
|
|
484
|
-
*/
|
|
485
|
-
getRowIndex(row) {
|
|
486
|
-
let position = 0;
|
|
487
|
-
const siblings = row?.parentNode?.children;
|
|
488
|
-
if (!siblings) return;
|
|
489
|
-
while (row !== siblings[position] && siblings[position] !== void 0) position++;
|
|
490
|
-
if (siblings[position] === void 0) return;
|
|
491
|
-
return position;
|
|
492
|
-
}
|
|
493
|
-
/**
|
|
494
|
-
* Equivalent to prevUntil/nextUntil in jQuery
|
|
495
|
-
* https://api.jquery.com/prevUntil/
|
|
496
|
-
*/
|
|
497
|
-
findUntil(direction, el, matchSelector, exitSelector) {
|
|
498
|
-
let element = el;
|
|
499
|
-
const method = direction === "next" ? "nextSibling" : "previousSibling";
|
|
500
|
-
while (element[method]) {
|
|
501
|
-
const sibling = element[method];
|
|
502
|
-
if (!sibling) return null;
|
|
503
|
-
if (exitSelector && sibling instanceof Element && sibling.matches(exitSelector)) return null;
|
|
504
|
-
if (sibling instanceof Element && sibling.matches(matchSelector)) return sibling;
|
|
505
|
-
element = sibling;
|
|
506
|
-
}
|
|
507
|
-
return null;
|
|
508
|
-
}
|
|
509
|
-
};
|
|
510
|
-
function useTableNav(options) {
|
|
511
|
-
const nav = new DataGridNav(options);
|
|
512
|
-
return {
|
|
513
|
-
listeners: {
|
|
514
|
-
onKeyDown: (e) => nav.tableKeyDown(e),
|
|
515
|
-
onKeyUp: () => nav.tableKeyUp()
|
|
516
|
-
},
|
|
517
|
-
tableNav: nav
|
|
518
|
-
};
|
|
519
|
-
}
|
|
520
|
-
//#endregion
|
|
521
|
-
//#region src/components/table/Table.tsx
|
|
522
|
-
const DndProvider = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DndProvider })));
|
|
523
|
-
const SortableRows = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.SortableRows })));
|
|
524
|
-
const DraggableRow = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DraggableRow })));
|
|
525
|
-
const DragHandle = lazy(() => import("./TableDnd-CuHxANWh.js").then((module) => ({ default: module.DragHandle })));
|
|
526
|
-
const tableFeaturesConfig = tableFeatures({
|
|
527
|
-
...stockFeatures,
|
|
528
|
-
sortedRowModel: createSortedRowModel(),
|
|
529
|
-
paginatedRowModel: createPaginatedRowModel()
|
|
530
|
-
});
|
|
531
|
-
const CustomCellContext = (context) => {
|
|
532
|
-
return {
|
|
533
|
-
...context,
|
|
534
|
-
original: context.row.original,
|
|
535
|
-
data: context.row.original,
|
|
536
|
-
value: context.getValue()
|
|
537
|
-
};
|
|
538
|
-
};
|
|
539
|
-
const renderCell = (Comp, props) => {
|
|
540
|
-
const rendered = flexRender(Comp, props);
|
|
541
|
-
return typeof rendered === "string" ? /* @__PURE__ */ jsx(CellText, { children: rendered }) : rendered;
|
|
542
|
-
};
|
|
543
|
-
const RowDragHandleCell = ({ rowId }) => {
|
|
544
|
-
return /* @__PURE__ */ jsx(DragHandle, {
|
|
545
|
-
id: rowId,
|
|
546
|
-
children: (dragProps) => /* @__PURE__ */ jsx(InlineIconButton, {
|
|
547
|
-
...dragProps,
|
|
548
|
-
className: "cursor-move p-1",
|
|
549
|
-
label: "Drag handle",
|
|
550
|
-
icon: GripVertical
|
|
551
|
-
})
|
|
552
|
-
});
|
|
553
|
-
};
|
|
554
|
-
const AutoDragHandleCell = ({ row }) => /* @__PURE__ */ jsx(RowDragHandleCell, { rowId: row.id });
|
|
555
|
-
const Table = ({ items, showCellBorder, columns, onRowClick, onDoubleClick, className, sorting, setSorting, columnOrder, setColumnOrder, columnVisibility, setColumnVisibility, bulkSelectionActions: ActionHeader, enableDragDrop = false, onDragEnd, onReorder, getRowId, enableRowSelection, enableMultiRowSelection = false, defaultSelectedRows, onRowSelectionChange, ...props }) => {
|
|
556
|
-
const tableRowCva = UIOverrides.useCva("table.rowCva", tableRowDefinition);
|
|
557
|
-
const theadCva = UIOverrides.useCva("table.theadCva", theadDefinition);
|
|
558
|
-
const tableHeadRowCva = UIOverrides.useCva("table.headRowCva", tableHeadRowDefinition);
|
|
559
|
-
const tableHeadDataCva = UIOverrides.useCva("table.headDataCva", tableHeadDataDefinition);
|
|
560
|
-
const tableDataCva = UIOverrides.useCva("table.dataCva", tableDataDefinition);
|
|
561
|
-
const ref = useRef(null);
|
|
562
|
-
const { listeners } = useTableNav();
|
|
563
|
-
const data = useMemo(() => items ?? [], [items]);
|
|
564
|
-
const [internalSelectedRows, setInternalSelectedRows] = useState({});
|
|
565
|
-
const { rowSelection, handleRowSelectionChange } = useMemo(() => {
|
|
566
|
-
const hasExternalRowSelection = defaultSelectedRows !== void 0 && onRowSelectionChange !== void 0;
|
|
567
|
-
return {
|
|
568
|
-
rowSelection: hasExternalRowSelection ? defaultSelectedRows : internalSelectedRows,
|
|
569
|
-
handleRowSelectionChange: hasExternalRowSelection ? onRowSelectionChange : setInternalSelectedRows
|
|
570
|
-
};
|
|
571
|
-
}, [
|
|
572
|
-
defaultSelectedRows,
|
|
573
|
-
onRowSelectionChange,
|
|
574
|
-
internalSelectedRows
|
|
575
|
-
]);
|
|
576
|
-
const baseColumns = useMemo(() => typeof columns === "function" ? columns(i18next.t) : columns, [columns]);
|
|
577
|
-
const tableColumns = useMemo(() => {
|
|
578
|
-
if (enableDragDrop && getRowId) return [{
|
|
579
|
-
id: "drag-handle",
|
|
580
|
-
header: "",
|
|
581
|
-
meta: { width: "w-12" },
|
|
582
|
-
cell: AutoDragHandleCell,
|
|
583
|
-
enableSorting: false
|
|
584
|
-
}, ...baseColumns];
|
|
585
|
-
return baseColumns;
|
|
586
|
-
}, [
|
|
587
|
-
baseColumns,
|
|
588
|
-
enableDragDrop,
|
|
589
|
-
getRowId
|
|
590
|
-
]);
|
|
591
|
-
const [isSticky, setIsSticky] = useState(false);
|
|
592
|
-
const onIntersectionChange = useCallback((entry) => {
|
|
593
|
-
setIsSticky(entry.intersectionRatio < 1);
|
|
594
|
-
}, []);
|
|
595
|
-
const { ref: stickyRef } = useIntersectionObserver({ onIntersectionChange });
|
|
596
|
-
const table = useTable({
|
|
597
|
-
features: tableFeaturesConfig,
|
|
598
|
-
data,
|
|
599
|
-
columns: tableColumns,
|
|
600
|
-
state: {
|
|
601
|
-
sorting,
|
|
602
|
-
columnOrder,
|
|
603
|
-
columnVisibility,
|
|
604
|
-
rowSelection
|
|
605
|
-
},
|
|
606
|
-
rowCount: items.length,
|
|
607
|
-
manualPagination: true,
|
|
608
|
-
onColumnOrderChange: setColumnOrder,
|
|
609
|
-
onColumnVisibilityChange: setColumnVisibility,
|
|
610
|
-
onSortingChange: setSorting,
|
|
611
|
-
onRowSelectionChange: handleRowSelectionChange,
|
|
612
|
-
manualSorting: true,
|
|
613
|
-
autoResetPageIndex: false,
|
|
614
|
-
autoResetExpanded: false,
|
|
615
|
-
defaultColumn: { sortDescFirst: true },
|
|
616
|
-
enableRowSelection,
|
|
617
|
-
enableMultiRowSelection,
|
|
618
|
-
getRowId: getRowId ? (row) => String(getRowId(row)) : void 0
|
|
619
|
-
});
|
|
620
|
-
const dataIds = useMemo(() => {
|
|
621
|
-
if (!enableDragDrop || !getRowId) return [];
|
|
622
|
-
return data.map((item) => getRowId(item));
|
|
623
|
-
}, [
|
|
624
|
-
data,
|
|
625
|
-
enableDragDrop,
|
|
626
|
-
getRowId
|
|
627
|
-
]);
|
|
628
|
-
const handleDragEnd = useCallback((event) => {
|
|
629
|
-
const { active, over } = event;
|
|
630
|
-
if (!active || !over || active.id === over.id) return;
|
|
631
|
-
if (getRowId && (onReorder || onDragEnd)) {
|
|
632
|
-
if (onReorder) {
|
|
633
|
-
const oldIndex = items.findIndex((item_0) => getRowId(item_0) === active.id);
|
|
634
|
-
const newIndex = items.findIndex((item_1) => getRowId(item_1) === over.id);
|
|
635
|
-
if (oldIndex !== -1 && newIndex !== -1) {
|
|
636
|
-
const reorderedItems = [...items];
|
|
637
|
-
const [movedItem] = reorderedItems.splice(oldIndex, 1);
|
|
638
|
-
reorderedItems.splice(newIndex, 0, movedItem);
|
|
639
|
-
onReorder(reorderedItems);
|
|
640
|
-
}
|
|
641
|
-
}
|
|
642
|
-
onDragEnd?.(event);
|
|
643
|
-
}
|
|
644
|
-
}, [
|
|
645
|
-
onDragEnd,
|
|
646
|
-
onReorder,
|
|
647
|
-
items,
|
|
648
|
-
getRowId
|
|
649
|
-
]);
|
|
650
|
-
const selectedRows = table.getSelectedRowModel().rows;
|
|
651
|
-
const columnCount = table.getHeaderGroups()[0].headers.length;
|
|
652
|
-
const isAnyRowSelected = selectedRows.length > 0 && !!ActionHeader;
|
|
653
|
-
const hasOnClick = !!onRowClick || !!onDoubleClick;
|
|
654
|
-
const tableElement = /* @__PURE__ */ jsxs("table", {
|
|
655
|
-
className: clsx("w-full", className),
|
|
656
|
-
...listeners,
|
|
657
|
-
children: [/* @__PURE__ */ jsxs("thead", {
|
|
658
|
-
className: clsx(theadCva({})),
|
|
659
|
-
"data-is-sticky": isSticky || void 0,
|
|
660
|
-
children: [/* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("th", {
|
|
661
|
-
ref: stickyRef,
|
|
662
|
-
className: "-mt-px block"
|
|
663
|
-
}) }), table.getHeaderGroups().map((headerGroup) => /* @__PURE__ */ jsx("tr", {
|
|
664
|
-
className: clsx(tableHeadRowCva({})),
|
|
665
|
-
children: headerGroup.headers.filter((header) => {
|
|
666
|
-
if (isAnyRowSelected && header.index > 0) return false;
|
|
667
|
-
return header.column.getIsVisible();
|
|
668
|
-
}).map((header_0, index) => {
|
|
669
|
-
const columnMeta = header_0.column.columnDef.meta ?? {};
|
|
670
|
-
return /* @__PURE__ */ jsx("th", {
|
|
671
|
-
colSpan: isAnyRowSelected ? columnCount : header_0.colSpan,
|
|
672
|
-
tabIndex: -1,
|
|
673
|
-
className: clsx(tableHeadDataCva({ hasRightBorder: index > 0 && showCellBorder }), columnMeta.headerClass, columnMeta.width),
|
|
674
|
-
children: isAnyRowSelected ? /* @__PURE__ */ jsx(ActionHeader, { table }) : /* @__PURE__ */ jsxs("button", {
|
|
675
|
-
type: "button",
|
|
676
|
-
"aria-label": "Sort column",
|
|
677
|
-
className: clsx("flex select-none items-center gap-1 text-surface-default-card-foreground", header_0.column.getCanSort() ? "h-6 cursor-pointer rounded-xs px-1 hover:bg-surface-default-background" : "cursor-default", columnMeta.sortClass),
|
|
678
|
-
onClick: header_0.column.getToggleSortingHandler(),
|
|
679
|
-
children: [typeof header_0.column.columnDef.header === "function" ? flexRender(header_0.column.columnDef.header, header_0.getContext()) : /* @__PURE__ */ jsx(HeaderText, { children: header_0.column.columnDef.header }), {
|
|
680
|
-
asc: /* @__PURE__ */ jsx(ChevronUp, {
|
|
681
|
-
width: 18,
|
|
682
|
-
height: 18
|
|
683
|
-
}),
|
|
684
|
-
desc: /* @__PURE__ */ jsx(ChevronDown, {
|
|
685
|
-
width: 18,
|
|
686
|
-
height: 18
|
|
687
|
-
})
|
|
688
|
-
}[header_0.column.getIsSorted()] ?? null]
|
|
689
|
-
})
|
|
690
|
-
}, header_0.id);
|
|
691
|
-
})
|
|
692
|
-
}, headerGroup.id))]
|
|
693
|
-
}), /* @__PURE__ */ jsx("tbody", {
|
|
694
|
-
ref,
|
|
695
|
-
className: "relative",
|
|
696
|
-
children: enableDragDrop ? /* @__PURE__ */ jsx(SortableRows, {
|
|
697
|
-
items: dataIds,
|
|
698
|
-
children: table.getRowModel().rows.map((row_0) => /* @__PURE__ */ jsx(DraggableRow, {
|
|
699
|
-
id: row_0.id,
|
|
700
|
-
className: clsx(tableRowCva({ ...props })),
|
|
701
|
-
isClickable: hasOnClick || row_0.getCanSelect(),
|
|
702
|
-
isSelected: row_0.getIsSelected(),
|
|
703
|
-
onClick: () => {
|
|
704
|
-
if (onRowClick) {
|
|
705
|
-
onRowClick(row_0.original);
|
|
706
|
-
return;
|
|
707
|
-
}
|
|
708
|
-
if (row_0.getCanSelect()) row_0.toggleSelected();
|
|
709
|
-
},
|
|
710
|
-
onDoubleClick: () => onDoubleClick?.(row_0.original),
|
|
711
|
-
children: row_0.getVisibleCells().map((cell, cellIndex) => {
|
|
712
|
-
const columnMeta_0 = cell.column.columnDef.meta ?? {};
|
|
713
|
-
return /* @__PURE__ */ jsx("td", {
|
|
714
|
-
tabIndex: -1,
|
|
715
|
-
className: clsx(tableDataCva({ hasRightBorder: cellIndex > 0 && showCellBorder }), columnMeta_0.cellClass, columnMeta_0.width),
|
|
716
|
-
children: renderCell(cell.column.columnDef.cell, CustomCellContext(cell.getContext()))
|
|
717
|
-
}, cell.id);
|
|
718
|
-
})
|
|
719
|
-
}, row_0.id))
|
|
720
|
-
}) : table.getRowModel().rows.map((row_1) => {
|
|
721
|
-
return /* @__PURE__ */ jsx("tr", {
|
|
722
|
-
className: clsx(tableRowCva({ ...props })),
|
|
723
|
-
onClick: () => {
|
|
724
|
-
if (onRowClick) {
|
|
725
|
-
onRowClick(row_1.original);
|
|
726
|
-
return;
|
|
727
|
-
}
|
|
728
|
-
if (row_1.getCanSelect()) row_1.toggleSelected();
|
|
729
|
-
},
|
|
730
|
-
onDoubleClick: () => onDoubleClick?.(row_1.original),
|
|
731
|
-
"data-clickable": hasOnClick || row_1.getCanSelect() || void 0,
|
|
732
|
-
"data-selected": row_1.getIsSelected() || void 0,
|
|
733
|
-
children: row_1.getVisibleCells().map((cell_0, cellIndex_0) => {
|
|
734
|
-
const columnMeta_1 = cell_0.column.columnDef.meta ?? {};
|
|
735
|
-
return /* @__PURE__ */ jsx("td", {
|
|
736
|
-
tabIndex: -1,
|
|
737
|
-
className: clsx(tableDataCva({ hasRightBorder: cellIndex_0 > 0 && showCellBorder }), columnMeta_1.cellClass, columnMeta_1.width),
|
|
738
|
-
children: renderCell(cell_0.column.columnDef.cell, CustomCellContext(cell_0.getContext()))
|
|
739
|
-
}, cell_0.id);
|
|
740
|
-
})
|
|
741
|
-
}, row_1.id);
|
|
742
|
-
})
|
|
743
|
-
})]
|
|
744
|
-
});
|
|
745
|
-
if (enableDragDrop) return /* @__PURE__ */ jsx(Suspense, {
|
|
746
|
-
fallback: null,
|
|
747
|
-
children: /* @__PURE__ */ jsx(DndProvider, {
|
|
748
|
-
onDragEnd: handleDragEnd,
|
|
749
|
-
children: tableElement
|
|
750
|
-
})
|
|
751
|
-
});
|
|
752
|
-
return tableElement;
|
|
753
|
-
};
|
|
754
|
-
//#endregion
|
|
755
|
-
//#region src/components/table/ColumnConfig.tsx
|
|
756
|
-
const VisibilityCell = (t0) => {
|
|
757
|
-
const $ = c(7);
|
|
758
|
-
const { original, onToggle } = t0;
|
|
759
|
-
let t1;
|
|
760
|
-
if ($[0] !== onToggle || $[1] !== original.id) {
|
|
761
|
-
t1 = () => onToggle(original.id);
|
|
762
|
-
$[0] = onToggle;
|
|
763
|
-
$[1] = original.id;
|
|
764
|
-
$[2] = t1;
|
|
765
|
-
} else t1 = $[2];
|
|
766
|
-
const t2 = original.label;
|
|
767
|
-
let t3;
|
|
768
|
-
if ($[3] !== original.visible || $[4] !== t1 || $[5] !== t2) {
|
|
769
|
-
t3 = /* @__PURE__ */ jsx(Checkbox, {
|
|
770
|
-
isSelected: original.visible,
|
|
771
|
-
onChange: t1,
|
|
772
|
-
hideLabel: true,
|
|
773
|
-
children: t2
|
|
774
|
-
});
|
|
775
|
-
$[3] = original.visible;
|
|
776
|
-
$[4] = t1;
|
|
777
|
-
$[5] = t2;
|
|
778
|
-
$[6] = t3;
|
|
779
|
-
} else t3 = $[6];
|
|
780
|
-
return t3;
|
|
781
|
-
};
|
|
782
|
-
const getColumns = (t, handleToggleVisibility) => [{
|
|
783
|
-
id: "name",
|
|
784
|
-
header: t(($) => $.ui.table.column, { ns: "ui" }),
|
|
785
|
-
meta: { width: "flex-1" },
|
|
786
|
-
accessorKey: "label"
|
|
787
|
-
}, {
|
|
788
|
-
id: "visible",
|
|
789
|
-
header: t(($) => $.ui.table.show, { ns: "ui" }),
|
|
790
|
-
meta: { width: "w-20" },
|
|
791
|
-
cell: ({ original }) => /* @__PURE__ */ jsx(VisibilityCell, {
|
|
792
|
-
original,
|
|
793
|
-
onToggle: handleToggleVisibility
|
|
794
|
-
})
|
|
795
|
-
}];
|
|
796
|
-
function ColumnConfigModal(t0) {
|
|
797
|
-
const $ = c(27);
|
|
798
|
-
const { isOpen, onClose, configColumns, visibleColumns, onVisibilityChange, onOrderChange } = t0;
|
|
799
|
-
const { t } = useTranslation("ui");
|
|
800
|
-
let t1;
|
|
801
|
-
if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
|
|
802
|
-
t1 = [];
|
|
803
|
-
$[0] = t1;
|
|
804
|
-
} else t1 = $[0];
|
|
805
|
-
const [data, setData] = useState(t1);
|
|
806
|
-
let t2;
|
|
807
|
-
let t3;
|
|
808
|
-
if ($[1] !== configColumns || $[2] !== visibleColumns) {
|
|
809
|
-
t2 = () => {
|
|
810
|
-
setData(configColumns.map((column) => {
|
|
811
|
-
const columnId = column.id ?? column.accessorKey;
|
|
812
|
-
return {
|
|
813
|
-
id: columnId,
|
|
814
|
-
label: column.header,
|
|
815
|
-
visible: visibleColumns?.[columnId] ?? true
|
|
816
|
-
};
|
|
817
|
-
}));
|
|
818
|
-
};
|
|
819
|
-
t3 = [configColumns, visibleColumns];
|
|
820
|
-
$[1] = configColumns;
|
|
821
|
-
$[2] = visibleColumns;
|
|
822
|
-
$[3] = t2;
|
|
823
|
-
$[4] = t3;
|
|
824
|
-
} else {
|
|
825
|
-
t2 = $[3];
|
|
826
|
-
t3 = $[4];
|
|
827
|
-
}
|
|
828
|
-
useEffect(t2, t3);
|
|
829
|
-
let t4;
|
|
830
|
-
if ($[5] !== onVisibilityChange || $[6] !== visibleColumns) {
|
|
831
|
-
t4 = (columnId_0) => {
|
|
832
|
-
const newVisible = {
|
|
833
|
-
...visibleColumns,
|
|
834
|
-
[columnId_0]: !visibleColumns[columnId_0]
|
|
835
|
-
};
|
|
836
|
-
onVisibilityChange(newVisible);
|
|
837
|
-
};
|
|
838
|
-
$[5] = onVisibilityChange;
|
|
839
|
-
$[6] = visibleColumns;
|
|
840
|
-
$[7] = t4;
|
|
841
|
-
} else t4 = $[7];
|
|
842
|
-
const handleToggleVisibility = t4;
|
|
843
|
-
let t5;
|
|
844
|
-
if ($[8] !== handleToggleVisibility) {
|
|
845
|
-
t5 = (translateFn) => getColumns(translateFn, handleToggleVisibility);
|
|
846
|
-
$[8] = handleToggleVisibility;
|
|
847
|
-
$[9] = t5;
|
|
848
|
-
} else t5 = $[9];
|
|
849
|
-
const columns = useTranslationMemo(t5);
|
|
850
|
-
let t6;
|
|
851
|
-
if ($[10] !== onOrderChange) {
|
|
852
|
-
t6 = (reorderedItems) => {
|
|
853
|
-
setData(reorderedItems);
|
|
854
|
-
onOrderChange(reorderedItems.map(_temp$2));
|
|
855
|
-
};
|
|
856
|
-
$[10] = onOrderChange;
|
|
857
|
-
$[11] = t6;
|
|
858
|
-
} else t6 = $[11];
|
|
859
|
-
const handleReorder = t6;
|
|
860
|
-
if (!isOpen) return null;
|
|
861
|
-
let t7;
|
|
862
|
-
if ($[12] !== t) {
|
|
863
|
-
t7 = t(_temp2$2);
|
|
864
|
-
$[12] = t;
|
|
865
|
-
$[13] = t7;
|
|
866
|
-
} else t7 = $[13];
|
|
867
|
-
let t8;
|
|
868
|
-
if ($[14] !== t7) {
|
|
869
|
-
t8 = /* @__PURE__ */ jsx(Typography, {
|
|
870
|
-
as: "h2",
|
|
871
|
-
className: "font-bold",
|
|
872
|
-
size: "lead",
|
|
873
|
-
children: t7
|
|
874
|
-
});
|
|
875
|
-
$[14] = t7;
|
|
876
|
-
$[15] = t8;
|
|
877
|
-
} else t8 = $[15];
|
|
878
|
-
let t9;
|
|
879
|
-
if ($[16] !== columns || $[17] !== data || $[18] !== handleReorder) {
|
|
880
|
-
t9 = /* @__PURE__ */ jsx("div", {
|
|
881
|
-
className: "max-h-96 overflow-y-auto",
|
|
882
|
-
children: /* @__PURE__ */ jsx(Table, {
|
|
883
|
-
items: data,
|
|
884
|
-
columns,
|
|
885
|
-
showCellBorder: true,
|
|
886
|
-
className: "w-full",
|
|
887
|
-
enableDragDrop: true,
|
|
888
|
-
getRowId: _temp3,
|
|
889
|
-
onReorder: handleReorder
|
|
890
|
-
})
|
|
891
|
-
});
|
|
892
|
-
$[16] = columns;
|
|
893
|
-
$[17] = data;
|
|
894
|
-
$[18] = handleReorder;
|
|
895
|
-
$[19] = t9;
|
|
896
|
-
} else t9 = $[19];
|
|
897
|
-
let t10;
|
|
898
|
-
if ($[20] !== t8 || $[21] !== t9) {
|
|
899
|
-
t10 = /* @__PURE__ */ jsxs("div", {
|
|
900
|
-
className: "flex flex-col gap-2 p-4",
|
|
901
|
-
children: [t8, t9]
|
|
902
|
-
});
|
|
903
|
-
$[20] = t8;
|
|
904
|
-
$[21] = t9;
|
|
905
|
-
$[22] = t10;
|
|
906
|
-
} else t10 = $[22];
|
|
907
|
-
let t11;
|
|
908
|
-
if ($[23] !== isOpen || $[24] !== onClose || $[25] !== t10) {
|
|
909
|
-
t11 = /* @__PURE__ */ jsx(Dialog, {
|
|
910
|
-
isOpen,
|
|
911
|
-
onClose,
|
|
912
|
-
showCloseIcon: true,
|
|
913
|
-
children: t10
|
|
914
|
-
});
|
|
915
|
-
$[23] = isOpen;
|
|
916
|
-
$[24] = onClose;
|
|
917
|
-
$[25] = t10;
|
|
918
|
-
$[26] = t11;
|
|
919
|
-
} else t11 = $[26];
|
|
920
|
-
return t11;
|
|
921
|
-
}
|
|
922
|
-
function _temp3(row) {
|
|
923
|
-
return row.id;
|
|
924
|
-
}
|
|
925
|
-
function _temp2$2($) {
|
|
926
|
-
return $.ui.table.configureColumns;
|
|
927
|
-
}
|
|
928
|
-
function _temp$2(item) {
|
|
929
|
-
return item.id;
|
|
930
|
-
}
|
|
931
|
-
//#endregion
|
|
932
|
-
//#region src/components/table/InfiniteTable.tsx
|
|
933
|
-
const InfiniteTable = (t0) => {
|
|
934
|
-
const $ = c(20);
|
|
935
|
-
let fetchNextPage;
|
|
936
|
-
let hasNextPage;
|
|
937
|
-
let rest;
|
|
938
|
-
let t1;
|
|
939
|
-
if ($[0] !== t0) {
|
|
940
|
-
({hasNextPage, isFetchingNextPage: t1, fetchNextPage, ...rest} = t0);
|
|
941
|
-
$[0] = t0;
|
|
942
|
-
$[1] = fetchNextPage;
|
|
943
|
-
$[2] = hasNextPage;
|
|
944
|
-
$[3] = rest;
|
|
945
|
-
$[4] = t1;
|
|
946
|
-
} else {
|
|
947
|
-
fetchNextPage = $[1];
|
|
948
|
-
hasNextPage = $[2];
|
|
949
|
-
rest = $[3];
|
|
950
|
-
t1 = $[4];
|
|
951
|
-
}
|
|
952
|
-
const isFetchingNextPage = t1 === void 0 ? false : t1;
|
|
953
|
-
let t2;
|
|
954
|
-
if ($[5] !== fetchNextPage || $[6] !== hasNextPage || $[7] !== isFetchingNextPage) {
|
|
955
|
-
t2 = () => {
|
|
956
|
-
if (!isFetchingNextPage && hasNextPage) fetchNextPage();
|
|
957
|
-
};
|
|
958
|
-
$[5] = fetchNextPage;
|
|
959
|
-
$[6] = hasNextPage;
|
|
960
|
-
$[7] = isFetchingNextPage;
|
|
961
|
-
$[8] = t2;
|
|
962
|
-
} else t2 = $[8];
|
|
963
|
-
const handleLoadMore = t2;
|
|
964
|
-
let t3;
|
|
965
|
-
if ($[9] !== handleLoadMore) {
|
|
966
|
-
t3 = {
|
|
967
|
-
onIntersection: handleLoadMore,
|
|
968
|
-
rootMargin: "100px"
|
|
969
|
-
};
|
|
970
|
-
$[9] = handleLoadMore;
|
|
971
|
-
$[10] = t3;
|
|
972
|
-
} else t3 = $[10];
|
|
973
|
-
const { ref } = useIntersectionObserver(t3);
|
|
974
|
-
let t4;
|
|
975
|
-
if ($[11] !== rest) {
|
|
976
|
-
t4 = /* @__PURE__ */ jsx(Table, { ...rest });
|
|
977
|
-
$[11] = rest;
|
|
978
|
-
$[12] = t4;
|
|
979
|
-
} else t4 = $[12];
|
|
980
|
-
let t5;
|
|
981
|
-
if ($[13] !== hasNextPage || $[14] !== isFetchingNextPage || $[15] !== ref) {
|
|
982
|
-
t5 = (hasNextPage || isFetchingNextPage) && /* @__PURE__ */ jsx("div", {
|
|
983
|
-
ref,
|
|
984
|
-
className: "flex justify-center py-4",
|
|
985
|
-
children: /* @__PURE__ */ jsx(Spinner, {})
|
|
986
|
-
});
|
|
987
|
-
$[13] = hasNextPage;
|
|
988
|
-
$[14] = isFetchingNextPage;
|
|
989
|
-
$[15] = ref;
|
|
990
|
-
$[16] = t5;
|
|
991
|
-
} else t5 = $[16];
|
|
992
|
-
let t6;
|
|
993
|
-
if ($[17] !== t4 || $[18] !== t5) {
|
|
994
|
-
t6 = /* @__PURE__ */ jsxs("div", {
|
|
995
|
-
className: "flex flex-col",
|
|
996
|
-
children: [t4, t5]
|
|
997
|
-
});
|
|
998
|
-
$[17] = t4;
|
|
999
|
-
$[18] = t5;
|
|
1000
|
-
$[19] = t6;
|
|
1001
|
-
} else t6 = $[19];
|
|
1002
|
-
return t6;
|
|
1003
|
-
};
|
|
1004
|
-
//#endregion
|
|
1005
|
-
//#region src/components/table/PaginatedTable.tsx
|
|
1006
|
-
const PaginatedTable = (t0) => {
|
|
1007
|
-
const $ = c(24);
|
|
1008
|
-
let items;
|
|
1009
|
-
let pagination;
|
|
1010
|
-
let rest;
|
|
1011
|
-
let setPagination;
|
|
1012
|
-
let totalItems;
|
|
1013
|
-
if ($[0] !== t0) {
|
|
1014
|
-
({pagination, setPagination, items, totalItems, ...rest} = t0);
|
|
1015
|
-
$[0] = t0;
|
|
1016
|
-
$[1] = items;
|
|
1017
|
-
$[2] = pagination;
|
|
1018
|
-
$[3] = rest;
|
|
1019
|
-
$[4] = setPagination;
|
|
1020
|
-
$[5] = totalItems;
|
|
1021
|
-
} else {
|
|
1022
|
-
items = $[1];
|
|
1023
|
-
pagination = $[2];
|
|
1024
|
-
rest = $[3];
|
|
1025
|
-
setPagination = $[4];
|
|
1026
|
-
totalItems = $[5];
|
|
1027
|
-
}
|
|
1028
|
-
let t1;
|
|
1029
|
-
if ($[6] !== items) {
|
|
1030
|
-
t1 = items ?? [];
|
|
1031
|
-
$[6] = items;
|
|
1032
|
-
$[7] = t1;
|
|
1033
|
-
} else t1 = $[7];
|
|
1034
|
-
let t2;
|
|
1035
|
-
if ($[8] !== rest || $[9] !== t1) {
|
|
1036
|
-
t2 = /* @__PURE__ */ jsx(Table, {
|
|
1037
|
-
...rest,
|
|
1038
|
-
items: t1
|
|
1039
|
-
});
|
|
1040
|
-
$[8] = rest;
|
|
1041
|
-
$[9] = t1;
|
|
1042
|
-
$[10] = t2;
|
|
1043
|
-
} else t2 = $[10];
|
|
1044
|
-
const t3 = totalItems ?? 0;
|
|
1045
|
-
let t4;
|
|
1046
|
-
let t5;
|
|
1047
|
-
if ($[11] !== pagination || $[12] !== setPagination) {
|
|
1048
|
-
t4 = (page) => setPagination({
|
|
1049
|
-
...pagination,
|
|
1050
|
-
pageIndex: page
|
|
1051
|
-
});
|
|
1052
|
-
t5 = (pageSize) => setPagination({
|
|
1053
|
-
...pagination,
|
|
1054
|
-
pageSize,
|
|
1055
|
-
pageIndex: 1
|
|
1056
|
-
});
|
|
1057
|
-
$[11] = pagination;
|
|
1058
|
-
$[12] = setPagination;
|
|
1059
|
-
$[13] = t4;
|
|
1060
|
-
$[14] = t5;
|
|
1061
|
-
} else {
|
|
1062
|
-
t4 = $[13];
|
|
1063
|
-
t5 = $[14];
|
|
1064
|
-
}
|
|
1065
|
-
let t6;
|
|
1066
|
-
if ($[15] !== pagination.pageIndex || $[16] !== pagination.pageSize || $[17] !== t3 || $[18] !== t4 || $[19] !== t5) {
|
|
1067
|
-
t6 = /* @__PURE__ */ jsx(Pagination, {
|
|
1068
|
-
page: pagination.pageIndex,
|
|
1069
|
-
pageSize: pagination.pageSize,
|
|
1070
|
-
totalItems: t3,
|
|
1071
|
-
onPageChange: t4,
|
|
1072
|
-
onPageSizeChange: t5
|
|
1073
|
-
});
|
|
1074
|
-
$[15] = pagination.pageIndex;
|
|
1075
|
-
$[16] = pagination.pageSize;
|
|
1076
|
-
$[17] = t3;
|
|
1077
|
-
$[18] = t4;
|
|
1078
|
-
$[19] = t5;
|
|
1079
|
-
$[20] = t6;
|
|
1080
|
-
} else t6 = $[20];
|
|
1081
|
-
let t7;
|
|
1082
|
-
if ($[21] !== t2 || $[22] !== t6) {
|
|
1083
|
-
t7 = /* @__PURE__ */ jsxs("div", {
|
|
1084
|
-
className: "flex flex-col gap-4",
|
|
1085
|
-
children: [t2, t6]
|
|
1086
|
-
});
|
|
1087
|
-
$[21] = t2;
|
|
1088
|
-
$[22] = t6;
|
|
1089
|
-
$[23] = t7;
|
|
1090
|
-
} else t7 = $[23];
|
|
1091
|
-
return t7;
|
|
1092
|
-
};
|
|
1093
|
-
//#endregion
|
|
1094
|
-
//#region src/helpers/dynamicColumns.ts
|
|
1095
|
-
const DEFAULT_NAMESPACE = "dynamicColumns";
|
|
1096
|
-
const FORMAT_MAP = {
|
|
1097
|
-
datetime: (value) => DateUtils.formatDate(new Date(value)),
|
|
1098
|
-
dateRange: (value) => {
|
|
1099
|
-
return `${DateUtils.formatDate(new Date(value.start))} - ${DateUtils.formatDate(new Date(value.end))}`;
|
|
1100
|
-
},
|
|
1101
|
-
enum: (value) => StringUtils.capitalize(value),
|
|
1102
|
-
number: (value) => IntlUtils.getNumberFormatter(i18next.language).format(value),
|
|
1103
|
-
string: (value) => String(value),
|
|
1104
|
-
boolean: (value) => {
|
|
1105
|
-
const key = `${DEFAULT_NAMESPACE}.${value ? "yes" : "no"}`;
|
|
1106
|
-
if (i18next.exists(key)) return String(i18next.t(key));
|
|
1107
|
-
return value ? "Yes" : "No";
|
|
1108
|
-
}
|
|
1109
|
-
};
|
|
1110
|
-
const ZOD_TYPE_FORMAT_MAP = [
|
|
1111
|
-
[z.ZodEnum, FORMAT_MAP.enum],
|
|
1112
|
-
[z.ZodNumber, FORMAT_MAP.number],
|
|
1113
|
-
[z.ZodString, FORMAT_MAP.string],
|
|
1114
|
-
[z.ZodBoolean, FORMAT_MAP.boolean],
|
|
1115
|
-
[z.ZodISODateTime, FORMAT_MAP.datetime]
|
|
1116
|
-
];
|
|
1117
|
-
const configValueToColumnDef = (value) => {
|
|
1118
|
-
if (typeof value === "function" || typeof value === "string") return { cell: value };
|
|
1119
|
-
if (typeof value === "boolean" || value === void 0) return {};
|
|
1120
|
-
return value;
|
|
1121
|
-
};
|
|
1122
|
-
const convertEntriesToColumnDefs = (entries) => {
|
|
1123
|
-
return entries.map(([key, value]) => [key, configValueToColumnDef(value)]);
|
|
1124
|
-
};
|
|
1125
|
-
const customConfigValueToColumnDef = (value) => {
|
|
1126
|
-
if (typeof value === "string") return {
|
|
1127
|
-
accessorKey: value,
|
|
1128
|
-
cell: value
|
|
1129
|
-
};
|
|
1130
|
-
if (typeof value === "function") return { cell: value };
|
|
1131
|
-
return value;
|
|
1132
|
-
};
|
|
1133
|
-
const convertCustomEntriesToColumnDefs = (entries) => {
|
|
1134
|
-
return entries.map(([key, value]) => [key, customConfigValueToColumnDef(value)]);
|
|
1135
|
-
};
|
|
1136
|
-
const excludeEntries = (entries) => {
|
|
1137
|
-
return entries.filter(([, value]) => value !== false && value !== void 0);
|
|
1138
|
-
};
|
|
1139
|
-
const sortColumns = (columns, orderKeys) => {
|
|
1140
|
-
if (!orderKeys) return columns;
|
|
1141
|
-
const wildcardIndex = orderKeys.indexOf("*");
|
|
1142
|
-
if (wildcardIndex === -1) return columns.sort((columnA, columnB) => {
|
|
1143
|
-
const idA = columnA.id;
|
|
1144
|
-
const idB = columnB.id;
|
|
1145
|
-
const orderMap = new Map(orderKeys.map((key, index) => [String(key), index]));
|
|
1146
|
-
const orderA = orderMap.get(String(idA));
|
|
1147
|
-
const orderB = orderMap.get(String(idB));
|
|
1148
|
-
if (orderA !== void 0 && orderB !== void 0) return orderA - orderB;
|
|
1149
|
-
if (orderA !== void 0 && orderB === void 0) return -1;
|
|
1150
|
-
if (orderA === void 0 && orderB !== void 0) return 1;
|
|
1151
|
-
return 0;
|
|
1152
|
-
});
|
|
1153
|
-
const beforeWildcard = orderKeys.slice(0, wildcardIndex);
|
|
1154
|
-
const afterWildcard = orderKeys.slice(wildcardIndex + 1);
|
|
1155
|
-
const beforeMap = new Map(beforeWildcard.map((key, index) => [String(key), index]));
|
|
1156
|
-
const afterMap = new Map(afterWildcard.map((key, index) => [String(key), index]));
|
|
1157
|
-
const before = [];
|
|
1158
|
-
const middle = [];
|
|
1159
|
-
const after = [];
|
|
1160
|
-
columns.forEach((column) => {
|
|
1161
|
-
const id = String(column.id);
|
|
1162
|
-
if (beforeMap.has(id)) before.push(column);
|
|
1163
|
-
else if (afterMap.has(id)) after.push(column);
|
|
1164
|
-
else middle.push(column);
|
|
1165
|
-
});
|
|
1166
|
-
before.sort((a, b) => beforeMap.get(String(a.id)) - beforeMap.get(String(b.id)));
|
|
1167
|
-
after.sort((a, b) => afterMap.get(String(a.id)) - afterMap.get(String(b.id)));
|
|
1168
|
-
return [
|
|
1169
|
-
...before,
|
|
1170
|
-
...middle,
|
|
1171
|
-
...after
|
|
1172
|
-
];
|
|
1173
|
-
};
|
|
1174
|
-
const formatValueByType = (value, schemaType) => {
|
|
1175
|
-
if (value === null || value === void 0) return null;
|
|
1176
|
-
if (ZodUtils.isDateRange(schemaType)) return FORMAT_MAP.dateRange(value);
|
|
1177
|
-
const unwrappedType = ZodUtils.unwrapZodType(schemaType);
|
|
1178
|
-
if (unwrappedType instanceof z.ZodArray) {
|
|
1179
|
-
if (!Array.isArray(value)) return null;
|
|
1180
|
-
const elementType = unwrappedType.element;
|
|
1181
|
-
return value.map((element) => formatValueByType(element, elementType)).join(", ");
|
|
1182
|
-
}
|
|
1183
|
-
const formatFunction = ZOD_TYPE_FORMAT_MAP.find(([zodType]) => unwrappedType instanceof zodType)?.[1];
|
|
1184
|
-
if (formatFunction) return formatFunction(value);
|
|
1185
|
-
return String(value);
|
|
1186
|
-
};
|
|
1187
|
-
const getNestedValue = (obj, path) => {
|
|
1188
|
-
return path.split(".").reduce((current, key) => {
|
|
1189
|
-
return current && typeof current === "object" ? current[key] : void 0;
|
|
1190
|
-
}, obj);
|
|
1191
|
-
};
|
|
1192
|
-
const getKeyType = (schema, key) => {
|
|
1193
|
-
const pathParts = key.split(".");
|
|
1194
|
-
let currentType = schema.shape[pathParts[0]];
|
|
1195
|
-
for (let i = 1; i < pathParts.length; i++) if (currentType instanceof z.ZodObject) currentType = currentType.shape[pathParts[i]];
|
|
1196
|
-
else {
|
|
1197
|
-
currentType = schema.shape[key];
|
|
1198
|
-
break;
|
|
1199
|
-
}
|
|
1200
|
-
return currentType;
|
|
1201
|
-
};
|
|
1202
|
-
const getCellFunction = (schema, schemaKey, columnDef, options) => {
|
|
1203
|
-
const { cell } = columnDef;
|
|
1204
|
-
if (typeof cell === "function") return cell;
|
|
1205
|
-
return ({ data }) => {
|
|
1206
|
-
const key = typeof cell === "string" ? cell : schemaKey;
|
|
1207
|
-
const value = getNestedValue(data, key);
|
|
1208
|
-
const keyType = getKeyType(schema, key);
|
|
1209
|
-
let finalValue = !options.disableFormatting?.includes(key) ? formatValueByType(value, keyType) : value;
|
|
1210
|
-
if (options.emptyValue && !finalValue) finalValue = options.emptyValue;
|
|
1211
|
-
if (options.globalWrapper) return options.globalWrapper(finalValue);
|
|
1212
|
-
return finalValue;
|
|
1213
|
-
};
|
|
1214
|
-
};
|
|
1215
|
-
const normalizeSortable = (sortable) => {
|
|
1216
|
-
if (!sortable) return;
|
|
1217
|
-
if (Array.isArray(sortable)) return sortable;
|
|
1218
|
-
if (sortable instanceof z.ZodEnum) return Object.values(sortable.enum);
|
|
1219
|
-
};
|
|
1220
|
-
const getDefaultColumnHeader = (key, options) => {
|
|
1221
|
-
const localeKey = `${options.namespace ?? DEFAULT_NAMESPACE}.${key}`;
|
|
1222
|
-
if (i18next.exists(localeKey)) return String(i18next.t(localeKey));
|
|
1223
|
-
return StringUtils.capitalize(key);
|
|
1224
|
-
};
|
|
1225
|
-
const overridePresetColumnsHeaders = (presetColumns, options) => {
|
|
1226
|
-
const namespace = options.namespace ?? DEFAULT_NAMESPACE;
|
|
1227
|
-
return presetColumns.map((columnDef) => {
|
|
1228
|
-
const localeKey = `${namespace}.${columnDef.id}`;
|
|
1229
|
-
const header = i18next.exists(localeKey) ? i18next.t(localeKey) : columnDef.header;
|
|
1230
|
-
return {
|
|
1231
|
-
...columnDef,
|
|
1232
|
-
header: typeof header === "string" ? header : columnDef.header
|
|
1233
|
-
};
|
|
1234
|
-
});
|
|
1235
|
-
};
|
|
1236
|
-
const populateColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
1237
|
-
const id = columnDef.id ?? key;
|
|
1238
|
-
const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
|
|
1239
|
-
const header = columnDef.header ?? getDefaultColumnHeader(key, options);
|
|
1240
|
-
const cell = getCellFunction(schema, key, columnDef, options);
|
|
1241
|
-
return {
|
|
1242
|
-
...columnDef,
|
|
1243
|
-
id,
|
|
1244
|
-
accessorKey: key,
|
|
1245
|
-
meta: {
|
|
1246
|
-
width: "flex-1",
|
|
1247
|
-
...options.globalMeta,
|
|
1248
|
-
...columnDef.meta
|
|
1249
|
-
},
|
|
1250
|
-
header,
|
|
1251
|
-
enableSorting,
|
|
1252
|
-
cell
|
|
1253
|
-
};
|
|
1254
|
-
};
|
|
1255
|
-
const populateCustomColumnDef = (schema, key, columnDef, options, sortableKeys) => {
|
|
1256
|
-
const id = columnDef.id ?? key;
|
|
1257
|
-
const accessorKey = columnDef.accessorKey ?? id;
|
|
1258
|
-
const enableSorting = columnDef.enableSorting ?? sortableKeys?.includes(id) ?? false;
|
|
1259
|
-
const header = columnDef.header ?? getDefaultColumnHeader(key, options);
|
|
1260
|
-
const cell = getCellFunction(schema, key, columnDef, options);
|
|
1261
|
-
return {
|
|
1262
|
-
...columnDef,
|
|
1263
|
-
id,
|
|
1264
|
-
accessorKey,
|
|
1265
|
-
meta: {
|
|
1266
|
-
width: "flex-1",
|
|
1267
|
-
...options.globalMeta,
|
|
1268
|
-
...columnDef.meta
|
|
1269
|
-
},
|
|
1270
|
-
header,
|
|
1271
|
-
enableSorting,
|
|
1272
|
-
cell
|
|
1273
|
-
};
|
|
1274
|
-
};
|
|
1275
|
-
const addMissingSchemaFields = (schema, existingColumns, options, sortableKeys) => {
|
|
1276
|
-
const schemaFields = getAllSchemaKeys(schema);
|
|
1277
|
-
const definedFields = new Set(existingColumns.map((col) => col.id));
|
|
1278
|
-
const additionalColumns = schemaFields.filter((field) => !definedFields.has(field)).map((field) => {
|
|
1279
|
-
return populateColumnDef(schema, field, {}, options, sortableKeys);
|
|
1280
|
-
});
|
|
1281
|
-
return [...existingColumns, ...additionalColumns];
|
|
1282
|
-
};
|
|
1283
|
-
const removeOverriddenPresetColumns = (presetColumns, options) => {
|
|
1284
|
-
if (presetColumns.length === 0) return presetColumns;
|
|
1285
|
-
const usedColumnsIds = Object.entries(options.columns ?? {}).map(([key, value]) => {
|
|
1286
|
-
return value.id ?? key;
|
|
1287
|
-
});
|
|
1288
|
-
const usedCustomColumnsIds = Object.entries(options.customColumns ?? {}).map(([key, value]) => {
|
|
1289
|
-
return value.id ?? key;
|
|
1290
|
-
});
|
|
1291
|
-
const usedIds = /* @__PURE__ */ new Set([...usedColumnsIds, ...usedCustomColumnsIds]);
|
|
1292
|
-
return presetColumns.filter((column) => {
|
|
1293
|
-
if (!column.id) return true;
|
|
1294
|
-
return !usedIds.has(column.id);
|
|
1295
|
-
});
|
|
1296
|
-
};
|
|
1297
|
-
const getAllSchemaKeys = (schema) => {
|
|
1298
|
-
const keys = [];
|
|
1299
|
-
const { shape } = schema;
|
|
1300
|
-
const traverse = (obj, prefix = "") => {
|
|
1301
|
-
Object.entries(obj).forEach(([key, value]) => {
|
|
1302
|
-
const currentPath = prefix ? `${prefix}.${key}` : key;
|
|
1303
|
-
keys.push(currentPath);
|
|
1304
|
-
if (value instanceof z.ZodObject) traverse(value.shape, currentPath);
|
|
1305
|
-
});
|
|
1306
|
-
};
|
|
1307
|
-
traverse(shape);
|
|
1308
|
-
return keys;
|
|
1309
|
-
};
|
|
1310
|
-
const validateCustomColumnKeys = (schema, customColumnKeys) => {
|
|
1311
|
-
const schemaKeys = getAllSchemaKeys(schema);
|
|
1312
|
-
const invalidCustomColumnKeys = customColumnKeys.filter((key) => schemaKeys.includes(key));
|
|
1313
|
-
if (invalidCustomColumnKeys.length > 0) throw new Error(`Invalid custom column keys: [${invalidCustomColumnKeys.join(", ")}]. Custom column keys cannot be part of the schema. Define these columns in the "columns" property instead.`);
|
|
1314
|
-
};
|
|
1315
|
-
const validateOptionKeyArray = (usedKeys, optionKeys, optionName) => {
|
|
1316
|
-
if (!optionKeys) return;
|
|
1317
|
-
const extraUnusedKeys = optionKeys.filter((key) => !usedKeys.has(key));
|
|
1318
|
-
if (extraUnusedKeys.length > 0) throw new Error(`Found unnecessary keys in "${optionName}": [${extraUnusedKeys.join(", ")}].\n\nAll available options are: [${Array.from(usedKeys).join(", ")}].`);
|
|
1319
|
-
};
|
|
1320
|
-
const validateParams = (schema, presetColumns, options) => {
|
|
1321
|
-
const { columns, customColumns, sortable, order, disableFormatting, includeAll } = options;
|
|
1322
|
-
const columnKeys = Object.keys(columns ?? {});
|
|
1323
|
-
const customColumnKeys = customColumns ? Object.keys(customColumns) : [];
|
|
1324
|
-
const usedKeys = /* @__PURE__ */ new Set([...columnKeys, ...customColumnKeys]);
|
|
1325
|
-
const presetKeys = presetColumns.map((column) => column.id).filter((id) => id !== void 0);
|
|
1326
|
-
const schemaKeys = includeAll ? getAllSchemaKeys(schema) : [];
|
|
1327
|
-
const allKeys = /* @__PURE__ */ new Set([
|
|
1328
|
-
...presetKeys,
|
|
1329
|
-
...usedKeys,
|
|
1330
|
-
...schemaKeys,
|
|
1331
|
-
"*"
|
|
1332
|
-
]);
|
|
1333
|
-
if (customColumns) validateCustomColumnKeys(schema, customColumnKeys);
|
|
1334
|
-
if (Array.isArray(sortable)) validateOptionKeyArray(usedKeys, sortable, "sortable");
|
|
1335
|
-
validateOptionKeyArray(allKeys, order, "order");
|
|
1336
|
-
validateOptionKeyArray(usedKeys, disableFormatting, "disableFormatting");
|
|
1337
|
-
};
|
|
1338
|
-
const dynamicColumns = ({ schema, preset = [], options }) => {
|
|
1339
|
-
validateParams(schema, preset, options);
|
|
1340
|
-
const sortableKeys = normalizeSortable(options.sortable);
|
|
1341
|
-
let entries = Object.entries(options.columns ?? {});
|
|
1342
|
-
entries = excludeEntries(entries);
|
|
1343
|
-
entries = convertEntriesToColumnDefs(entries);
|
|
1344
|
-
const columns = entries.map(([key, value]) => {
|
|
1345
|
-
return populateColumnDef(schema, key, value, options, sortableKeys);
|
|
1346
|
-
});
|
|
1347
|
-
let customEntries = Object.entries(options.customColumns ?? {});
|
|
1348
|
-
customEntries = convertCustomEntriesToColumnDefs(customEntries);
|
|
1349
|
-
const customColumns = customEntries.map(([key, value]) => {
|
|
1350
|
-
return populateCustomColumnDef(schema, key, value, options, sortableKeys);
|
|
1351
|
-
});
|
|
1352
|
-
let presetColumns = removeOverriddenPresetColumns(preset, options);
|
|
1353
|
-
if (options.overridePresetLocales) presetColumns = overridePresetColumnsHeaders(presetColumns, options);
|
|
1354
|
-
const mergedColumns = [
|
|
1355
|
-
...presetColumns,
|
|
1356
|
-
...columns,
|
|
1357
|
-
...customColumns
|
|
1358
|
-
];
|
|
1359
|
-
const allColumns = options.includeAll ? addMissingSchemaFields(schema, mergedColumns, options, sortableKeys) : mergedColumns;
|
|
1360
|
-
return sortColumns(allColumns, options.order);
|
|
1361
|
-
};
|
|
1362
|
-
//#endregion
|
|
1363
|
-
//#region src/hooks/usePagination.ts
|
|
1364
|
-
const DEFAULT_STATE = {
|
|
1365
|
-
pageIndex: 1,
|
|
1366
|
-
pageSize: 20
|
|
1367
|
-
};
|
|
1368
|
-
function usePagination(defaultPagination) {
|
|
1369
|
-
const $ = c(12);
|
|
1370
|
-
const { replace, searchParams } = UIRouter.useUIRouter();
|
|
1371
|
-
let t0;
|
|
1372
|
-
if ($[0] !== defaultPagination || $[1] !== searchParams) {
|
|
1373
|
-
t0 = defaultPagination ?? {
|
|
1374
|
-
pageIndex: searchParams.has("page") ? Number.parseInt(searchParams.get("page") ?? "", 10) : DEFAULT_STATE.pageIndex,
|
|
1375
|
-
pageSize: searchParams.has("size") ? Number.parseInt(searchParams.get("size") ?? "", 10) : DEFAULT_STATE.pageSize
|
|
1376
|
-
};
|
|
1377
|
-
$[0] = defaultPagination;
|
|
1378
|
-
$[1] = searchParams;
|
|
1379
|
-
$[2] = t0;
|
|
1380
|
-
} else t0 = $[2];
|
|
1381
|
-
const [pagination, setPagination] = useState(t0);
|
|
1382
|
-
let t1;
|
|
1383
|
-
if ($[3] !== pagination.pageIndex || $[4] !== pagination.pageSize || $[5] !== replace || $[6] !== searchParams) {
|
|
1384
|
-
t1 = () => {
|
|
1385
|
-
const params = new URLSearchParams(searchParams);
|
|
1386
|
-
params.delete("size");
|
|
1387
|
-
params.delete("page");
|
|
1388
|
-
if (pagination.pageSize !== DEFAULT_STATE.pageSize) params.set("size", pagination.pageSize.toString());
|
|
1389
|
-
if (pagination.pageIndex !== DEFAULT_STATE.pageIndex) params.set("page", pagination.pageIndex.toString());
|
|
1390
|
-
if (params.toString() === searchParams.toString()) return;
|
|
1391
|
-
replace(".", RoutingUtils.toRouterSearch(params));
|
|
1392
|
-
};
|
|
1393
|
-
$[3] = pagination.pageIndex;
|
|
1394
|
-
$[4] = pagination.pageSize;
|
|
1395
|
-
$[5] = replace;
|
|
1396
|
-
$[6] = searchParams;
|
|
1397
|
-
$[7] = t1;
|
|
1398
|
-
} else t1 = $[7];
|
|
1399
|
-
let t2;
|
|
1400
|
-
if ($[8] !== pagination) {
|
|
1401
|
-
t2 = [pagination];
|
|
1402
|
-
$[8] = pagination;
|
|
1403
|
-
$[9] = t2;
|
|
1404
|
-
} else t2 = $[9];
|
|
1405
|
-
useEffect(t1, t2);
|
|
1406
|
-
let t3;
|
|
1407
|
-
if ($[10] !== pagination) {
|
|
1408
|
-
t3 = {
|
|
1409
|
-
pagination,
|
|
1410
|
-
setPagination,
|
|
1411
|
-
pageIndex: pagination.pageIndex,
|
|
1412
|
-
pageSize: pagination.pageSize
|
|
1413
|
-
};
|
|
1414
|
-
$[10] = pagination;
|
|
1415
|
-
$[11] = t3;
|
|
1416
|
-
} else t3 = $[11];
|
|
1417
|
-
return t3;
|
|
1418
|
-
}
|
|
1419
|
-
//#endregion
|
|
1420
|
-
//#region src/hooks/useSorting.ts
|
|
1421
|
-
function useSorting(defaultSorting, t0) {
|
|
1422
|
-
const $ = c(16);
|
|
1423
|
-
const prefix = t0 === void 0 ? "" : t0;
|
|
1424
|
-
const { replace, searchParams } = UIRouter.useUIRouter();
|
|
1425
|
-
let t1;
|
|
1426
|
-
if ($[0] !== defaultSorting || $[1] !== prefix || $[2] !== searchParams) {
|
|
1427
|
-
t1 = defaultSorting ?? searchParams.get(`order${prefix && `-${prefix}`}`)?.split(",").map(_temp$1) ?? [];
|
|
1428
|
-
$[0] = defaultSorting;
|
|
1429
|
-
$[1] = prefix;
|
|
1430
|
-
$[2] = searchParams;
|
|
1431
|
-
$[3] = t1;
|
|
1432
|
-
} else t1 = $[3];
|
|
1433
|
-
const [sorting, setSorting] = useState(t1);
|
|
1434
|
-
let t2;
|
|
1435
|
-
if ($[4] !== sorting) {
|
|
1436
|
-
t2 = sorting.map(_temp2$1).join(",");
|
|
1437
|
-
$[4] = sorting;
|
|
1438
|
-
$[5] = t2;
|
|
1439
|
-
} else t2 = $[5];
|
|
1440
|
-
const order = t2;
|
|
1441
|
-
let t3;
|
|
1442
|
-
if ($[6] !== order || $[7] !== prefix || $[8] !== replace || $[9] !== searchParams) {
|
|
1443
|
-
t3 = () => {
|
|
1444
|
-
const params = new URLSearchParams(searchParams);
|
|
1445
|
-
const orderKey = prefix ? `order-${prefix}` : "order";
|
|
1446
|
-
params.delete(orderKey);
|
|
1447
|
-
if (order) params.set(orderKey, order);
|
|
1448
|
-
if (params.toString() === searchParams.toString()) return;
|
|
1449
|
-
replace(".", RoutingUtils.toRouterSearch(params));
|
|
1450
|
-
};
|
|
1451
|
-
$[6] = order;
|
|
1452
|
-
$[7] = prefix;
|
|
1453
|
-
$[8] = replace;
|
|
1454
|
-
$[9] = searchParams;
|
|
1455
|
-
$[10] = t3;
|
|
1456
|
-
} else t3 = $[10];
|
|
1457
|
-
let t4;
|
|
1458
|
-
if ($[11] !== order) {
|
|
1459
|
-
t4 = [order];
|
|
1460
|
-
$[11] = order;
|
|
1461
|
-
$[12] = t4;
|
|
1462
|
-
} else t4 = $[12];
|
|
1463
|
-
useEffect(t3, t4);
|
|
1464
|
-
let t5;
|
|
1465
|
-
if ($[13] !== order || $[14] !== sorting) {
|
|
1466
|
-
t5 = {
|
|
1467
|
-
sorting,
|
|
1468
|
-
setSorting,
|
|
1469
|
-
order
|
|
1470
|
-
};
|
|
1471
|
-
$[13] = order;
|
|
1472
|
-
$[14] = sorting;
|
|
1473
|
-
$[15] = t5;
|
|
1474
|
-
} else t5 = $[15];
|
|
1475
|
-
return t5;
|
|
1476
|
-
}
|
|
1477
|
-
function _temp2$1(field) {
|
|
1478
|
-
return `${field.desc ? "-" : "+"}${field.id}`;
|
|
1479
|
-
}
|
|
1480
|
-
function _temp$1(item) {
|
|
1481
|
-
if (item.startsWith("-")) return {
|
|
1482
|
-
id: item.slice(1),
|
|
1483
|
-
desc: true
|
|
1484
|
-
};
|
|
1485
|
-
if (item.startsWith("+")) return {
|
|
1486
|
-
id: item.slice(1),
|
|
1487
|
-
desc: false
|
|
1488
|
-
};
|
|
1489
|
-
return {
|
|
1490
|
-
id: item,
|
|
1491
|
-
desc: false
|
|
1492
|
-
};
|
|
1493
|
-
}
|
|
1494
|
-
//#endregion
|
|
1495
|
-
//#region src/hooks/useTableColumnConfig.ts
|
|
1496
|
-
function sortByKeyOrder(data, orderedKeys = []) {
|
|
1497
|
-
return [...data].sort((a, b) => {
|
|
1498
|
-
return orderedKeys.findIndex((key) => key === (a.id ?? a.accessorKey)) - orderedKeys.findIndex((key) => key === (b.id ?? b.accessorKey));
|
|
1499
|
-
});
|
|
1500
|
-
}
|
|
1501
|
-
function useTableColumnConfig(defaultColumns, t0) {
|
|
1502
|
-
const $ = c(31);
|
|
1503
|
-
let t1;
|
|
1504
|
-
if ($[0] !== t0) {
|
|
1505
|
-
t1 = t0 === void 0 ? {} : t0;
|
|
1506
|
-
$[0] = t0;
|
|
1507
|
-
$[1] = t1;
|
|
1508
|
-
} else t1 = $[1];
|
|
1509
|
-
const options = t1;
|
|
1510
|
-
let t2;
|
|
1511
|
-
if ($[2] !== defaultColumns) {
|
|
1512
|
-
t2 = () => defaultColumns.reduce(_temp, {});
|
|
1513
|
-
$[2] = defaultColumns;
|
|
1514
|
-
$[3] = t2;
|
|
1515
|
-
} else t2 = $[3];
|
|
1516
|
-
const [internalVisibleColumns, setInternalVisibleColumns] = useState(t2);
|
|
1517
|
-
let t3;
|
|
1518
|
-
if ($[4] !== defaultColumns) {
|
|
1519
|
-
t3 = () => defaultColumns.map(_temp2);
|
|
1520
|
-
$[4] = defaultColumns;
|
|
1521
|
-
$[5] = t3;
|
|
1522
|
-
} else t3 = $[5];
|
|
1523
|
-
const [internalColumnOrder, setInternalColumnOrder] = useState(t3);
|
|
1524
|
-
let t4;
|
|
1525
|
-
let t5;
|
|
1526
|
-
if ($[6] !== options.visibleColumns) {
|
|
1527
|
-
t4 = () => {
|
|
1528
|
-
if (options.visibleColumns) setInternalVisibleColumns(options.visibleColumns);
|
|
1529
|
-
};
|
|
1530
|
-
t5 = [options.visibleColumns];
|
|
1531
|
-
$[6] = options.visibleColumns;
|
|
1532
|
-
$[7] = t4;
|
|
1533
|
-
$[8] = t5;
|
|
1534
|
-
} else {
|
|
1535
|
-
t4 = $[7];
|
|
1536
|
-
t5 = $[8];
|
|
1537
|
-
}
|
|
1538
|
-
useEffect(t4, t5);
|
|
1539
|
-
let t6;
|
|
1540
|
-
let t7;
|
|
1541
|
-
if ($[9] !== options.columnOrder) {
|
|
1542
|
-
t6 = () => {
|
|
1543
|
-
if (options.columnOrder) setInternalColumnOrder(options.columnOrder);
|
|
1544
|
-
};
|
|
1545
|
-
t7 = [options.columnOrder];
|
|
1546
|
-
$[9] = options.columnOrder;
|
|
1547
|
-
$[10] = t6;
|
|
1548
|
-
$[11] = t7;
|
|
1549
|
-
} else {
|
|
1550
|
-
t6 = $[10];
|
|
1551
|
-
t7 = $[11];
|
|
1552
|
-
}
|
|
1553
|
-
useEffect(t6, t7);
|
|
1554
|
-
let t8;
|
|
1555
|
-
if ($[12] !== options) {
|
|
1556
|
-
t8 = (value) => {
|
|
1557
|
-
setInternalVisibleColumns(value);
|
|
1558
|
-
options?.onVisibilityChange?.(value);
|
|
1559
|
-
};
|
|
1560
|
-
$[12] = options;
|
|
1561
|
-
$[13] = t8;
|
|
1562
|
-
} else t8 = $[13];
|
|
1563
|
-
const handleVisibilityChange = t8;
|
|
1564
|
-
let t9;
|
|
1565
|
-
if ($[14] !== options) {
|
|
1566
|
-
t9 = (value_0) => {
|
|
1567
|
-
setInternalColumnOrder(value_0);
|
|
1568
|
-
options?.onOrderChange?.(value_0);
|
|
1569
|
-
};
|
|
1570
|
-
$[14] = options;
|
|
1571
|
-
$[15] = t9;
|
|
1572
|
-
} else t9 = $[15];
|
|
1573
|
-
const handleOrderChange = t9;
|
|
1574
|
-
let t10;
|
|
1575
|
-
if ($[16] !== defaultColumns || $[17] !== internalColumnOrder) {
|
|
1576
|
-
t10 = sortByKeyOrder(defaultColumns, internalColumnOrder);
|
|
1577
|
-
$[16] = defaultColumns;
|
|
1578
|
-
$[17] = internalColumnOrder;
|
|
1579
|
-
$[18] = t10;
|
|
1580
|
-
} else t10 = $[18];
|
|
1581
|
-
const configColumns = t10;
|
|
1582
|
-
let t11;
|
|
1583
|
-
if ($[19] !== configColumns || $[20] !== internalVisibleColumns) {
|
|
1584
|
-
let t12;
|
|
1585
|
-
if ($[22] !== internalVisibleColumns) {
|
|
1586
|
-
t12 = (col_1) => internalVisibleColumns?.[col_1.id ?? col_1.accessorKey] ?? true;
|
|
1587
|
-
$[22] = internalVisibleColumns;
|
|
1588
|
-
$[23] = t12;
|
|
1589
|
-
} else t12 = $[23];
|
|
1590
|
-
t11 = configColumns.filter(t12);
|
|
1591
|
-
$[19] = configColumns;
|
|
1592
|
-
$[20] = internalVisibleColumns;
|
|
1593
|
-
$[21] = t11;
|
|
1594
|
-
} else t11 = $[21];
|
|
1595
|
-
const columns = t11;
|
|
1596
|
-
let t12;
|
|
1597
|
-
if ($[24] !== columns || $[25] !== configColumns || $[26] !== handleOrderChange || $[27] !== handleVisibilityChange || $[28] !== internalColumnOrder || $[29] !== internalVisibleColumns) {
|
|
1598
|
-
t12 = {
|
|
1599
|
-
configColumns,
|
|
1600
|
-
columns,
|
|
1601
|
-
visibleColumns: internalVisibleColumns,
|
|
1602
|
-
columnOrder: internalColumnOrder,
|
|
1603
|
-
onVisibilityChange: handleVisibilityChange,
|
|
1604
|
-
onOrderChange: handleOrderChange
|
|
1605
|
-
};
|
|
1606
|
-
$[24] = columns;
|
|
1607
|
-
$[25] = configColumns;
|
|
1608
|
-
$[26] = handleOrderChange;
|
|
1609
|
-
$[27] = handleVisibilityChange;
|
|
1610
|
-
$[28] = internalColumnOrder;
|
|
1611
|
-
$[29] = internalVisibleColumns;
|
|
1612
|
-
$[30] = t12;
|
|
1613
|
-
} else t12 = $[30];
|
|
1614
|
-
return t12;
|
|
1615
|
-
}
|
|
1616
|
-
function _temp2(col_0) {
|
|
1617
|
-
return col_0.id ?? col_0.accessorKey;
|
|
1618
|
-
}
|
|
1619
|
-
function _temp(acc, col) {
|
|
1620
|
-
const key = col.id ?? col.accessorKey;
|
|
1621
|
-
acc[key] = true;
|
|
1622
|
-
return acc;
|
|
1623
|
-
}
|
|
1624
|
-
//#endregion
|
|
1625
|
-
export { tableRowDefinition as _, PaginatedTable as a, Table as c, CellText as d, tableCellTextDefinition as f, tableHeaderTextDefinition as g, tableHeadRowDefinition as h, dynamicColumns as i, useTableNav as l, tableHeadDataDefinition as m, useSorting as n, InfiniteTable as o, tableDataDefinition as p, usePagination as r, ColumnConfigModal as s, useTableColumnConfig as t, HeaderText as u };
|