@expcat/tigercat-react 1.0.4 → 1.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-2EC4F7VG.js +134 -0
- package/dist/{chunk-NZNSUKPT.js → chunk-2HDQRMGU.js} +3 -21
- package/dist/{chunk-LVC43YX2.mjs → chunk-2IUTFPQQ.mjs} +6 -6
- package/dist/{chunk-LPNHBHS2.mjs → chunk-2LER76UK.mjs} +40 -5
- package/dist/{chunk-PXPUPQRO.js → chunk-2N3CQT4X.js} +23 -4
- package/dist/{chunk-BJ2GUKPU.mjs → chunk-2PLPUM5J.mjs} +7 -17
- package/dist/{chunk-C443YA4U.js → chunk-2QV56L36.js} +15 -11
- package/dist/{chunk-M375I56K.js → chunk-36ATCHP4.js} +5 -5
- package/dist/{chunk-AUP3PMDD.mjs → chunk-36WZNVQ5.mjs} +59 -50
- package/dist/{chunk-VHHEP5G7.js → chunk-3E76U2RG.js} +22 -2
- package/dist/chunk-3HPDLIX3.mjs +108 -0
- package/dist/{chunk-QHG7KJH6.js → chunk-3RRYDYVB.js} +23 -27
- package/dist/{chunk-3GW3UAKB.js → chunk-466OSPRM.js} +48 -8
- package/dist/{chunk-RUROWRB5.mjs → chunk-4G74P6YD.mjs} +4 -3
- package/dist/{chunk-AY5Z3NIW.js → chunk-4LIDROT4.js} +11 -7
- package/dist/chunk-4R5YXNU4.mjs +42 -0
- package/dist/{chunk-VVO4V4IK.js → chunk-4TEILQSN.js} +1 -1
- package/dist/{chunk-MQ5ZP5RW.mjs → chunk-4V2HSSQN.mjs} +5 -2
- package/dist/{chunk-D6BHFGTN.js → chunk-4YVXF45R.js} +3 -2
- package/dist/{chunk-HSHVLIEL.mjs → chunk-564WBQ77.mjs} +11 -11
- package/dist/{chunk-QO3GGQAV.mjs → chunk-5HFHHFQS.mjs} +25 -28
- package/dist/{chunk-SDWJSALH.js → chunk-5OLE7XM3.js} +156 -137
- package/dist/chunk-5OMSQ5PV.mjs +401 -0
- package/dist/{chunk-YLZEOXFS.mjs → chunk-6GU5NH5F.mjs} +22 -2
- package/dist/{chunk-XEYP62CR.js → chunk-6LDJSFUQ.js} +71 -14
- package/dist/{chunk-RYW4CV7U.js → chunk-6N6CWBPP.js} +16 -6
- package/dist/{chunk-6P3JIUSI.mjs → chunk-6OOGL43U.mjs} +3 -2
- package/dist/{chunk-3CDAG4HD.mjs → chunk-6QML6T3Y.mjs} +20 -6
- package/dist/{chunk-BALJCZ62.mjs → chunk-6QQBMZQ6.mjs} +34 -43
- package/dist/{chunk-2XOFRGY6.js → chunk-6YBLWFP5.js} +34 -2
- package/dist/{chunk-VILZFNR7.js → chunk-7KNOOFRA.js} +70 -21
- package/dist/{chunk-ET5YJELZ.js → chunk-7P4MIU6I.js} +9 -8
- package/dist/{chunk-5CGXFQND.mjs → chunk-7Y5XUZJ4.mjs} +27 -11
- package/dist/{chunk-HU3VDVH6.js → chunk-A4PPPGJ5.js} +87 -60
- package/dist/{chunk-HCZA4LV6.mjs → chunk-A7DZX5X5.mjs} +2 -2
- package/dist/{chunk-VONFSF4S.mjs → chunk-AAI6EZZA.mjs} +19 -16
- package/dist/{chunk-KNBNE74O.js → chunk-ACQLSECT.js} +32 -4
- package/dist/{chunk-KQJYSG23.js → chunk-AIYOQ5MX.js} +8 -8
- package/dist/{chunk-EIMAQHCQ.mjs → chunk-AZDNGGV7.mjs} +14 -3
- package/dist/{chunk-67FVBKBC.js → chunk-B5TUTAVX.js} +72 -9
- package/dist/{chunk-2UQC3WOI.mjs → chunk-C745DPLU.mjs} +13 -4
- package/dist/chunk-CBWRSICK.mjs +929 -0
- package/dist/{chunk-N66WEQ6M.js → chunk-CBYJXDW4.js} +12 -13
- package/dist/{chunk-2EOXY2LP.mjs → chunk-CCDZLSOL.mjs} +70 -3
- package/dist/{chunk-4GV7UQJJ.js → chunk-CHPJPIW6.js} +26 -35
- package/dist/{chunk-ZD4BVRYG.mjs → chunk-CPQS3IFF.mjs} +1 -1
- package/dist/chunk-CVXDKGNX.mjs +312 -0
- package/dist/{chunk-YJ4W6DMX.mjs → chunk-D45GM4YH.mjs} +51 -29
- package/dist/{chunk-FXX3GD35.mjs → chunk-DAMJCFFS.mjs} +119 -15
- package/dist/{chunk-WK5QJO57.js → chunk-DBGPINKE.js} +74 -52
- package/dist/chunk-DKNVSQSV.mjs +64 -0
- package/dist/{chunk-CDT3P2ZN.js → chunk-DSLKTIPD.js} +20 -17
- package/dist/{chunk-4QJZT6QK.js → chunk-DUZM2SKR.js} +124 -99
- package/dist/chunk-DVL53XDJ.mjs +22 -0
- package/dist/{chunk-H3NLKNR4.mjs → chunk-DVUND2QM.mjs} +69 -46
- package/dist/{chunk-TMQA74FM.js → chunk-EF5ZTNHX.js} +34 -29
- package/dist/{chunk-RWZIWKZR.js → chunk-F7VY6ATM.js} +54 -32
- package/dist/{chunk-UBKOITHT.mjs → chunk-FQW26554.mjs} +30 -11
- package/dist/{chunk-DEQWHJLQ.mjs → chunk-FW3O54GP.mjs} +11 -7
- package/dist/chunk-G3PBQ4B4.mjs +60 -0
- package/dist/{chunk-HWWNBCFB.js → chunk-GAT4ZATZ.js} +17 -1
- package/dist/chunk-GDONQIOK.mjs +470 -0
- package/dist/{chunk-3KMKMAE3.mjs → chunk-GKJNQUTW.mjs} +20 -18
- package/dist/{chunk-TVJZB7ZC.js → chunk-GOGLPCUH.js} +122 -18
- package/dist/chunk-GOQ6ZG7H.mjs +56 -0
- package/dist/{chunk-BCNKTT5C.js → chunk-GRXBGL6Q.js} +18 -16
- package/dist/{chunk-XNMSECO4.mjs → chunk-GUHNLUZ3.mjs} +66 -16
- package/dist/{chunk-B3MNIAM5.mjs → chunk-GYQJJUJP.mjs} +29 -9
- package/dist/{chunk-IWP22YTF.js → chunk-HCKV7ONR.js} +3 -0
- package/dist/{chunk-I4SKKEU3.js → chunk-HR5GBE3P.js} +24 -27
- package/dist/{chunk-HUCBHFSL.mjs → chunk-HTXUF4RH.mjs} +6 -20
- package/dist/{chunk-EOYJLBFD.js → chunk-ITLA7OLQ.js} +6 -20
- package/dist/{chunk-INBSKSZG.mjs → chunk-ITVLIR7T.mjs} +57 -12
- package/dist/{chunk-FNDPGSEW.mjs → chunk-IXQAECFP.mjs} +87 -33
- package/dist/{chunk-34DLDOGP.mjs → chunk-IZTNHCIO.mjs} +5 -2
- package/dist/{chunk-73BP3WQN.mjs → chunk-J4OQ2VRH.mjs} +13 -31
- package/dist/{chunk-AJQPGAYL.js → chunk-JFOSDCCG.js} +5 -5
- package/dist/{chunk-6744DTEB.mjs → chunk-JSUDEK2D.mjs} +159 -140
- package/dist/{chunk-U3JOBIDU.js → chunk-K64M7IMP.js} +69 -2
- package/dist/{chunk-FPURO6QB.mjs → chunk-KGWPSVEQ.mjs} +5 -6
- package/dist/{chunk-OHIZYM65.mjs → chunk-KPACLRQH.mjs} +3 -6
- package/dist/chunk-KPRUZCKN.js +318 -0
- package/dist/{chunk-UE234MW4.mjs → chunk-KR3EVG7G.mjs} +4 -4
- package/dist/chunk-L5HVRTUO.js +935 -0
- package/dist/chunk-L6CL63GI.js +93 -0
- package/dist/{chunk-RNEL4XIO.js → chunk-LA3CJOWA.js} +13 -2
- package/dist/{chunk-EBLAM3YP.mjs → chunk-LE5VFMRR.mjs} +21 -12
- package/dist/{chunk-4QQZ5H4V.mjs → chunk-LQT6ZGME.mjs} +35 -30
- package/dist/{chunk-VAQDUVBP.mjs → chunk-LY2OTQ4E.mjs} +17 -1
- package/dist/{chunk-RRJTIKU6.mjs → chunk-M5GSLKUX.mjs} +13 -14
- package/dist/{chunk-TZNTHABR.js → chunk-M73NMNZX.js} +37 -6
- package/dist/{chunk-TKZO5UBH.js → chunk-MB3QU3US.js} +47 -2
- package/dist/{chunk-6E7FPBRR.mjs → chunk-ME5BLIFX.mjs} +73 -16
- package/dist/{chunk-ZDL3GE3Q.mjs → chunk-MO3V34YL.mjs} +67 -18
- package/dist/chunk-MOSVX52I.js +408 -0
- package/dist/{chunk-2GKTVAAB.js → chunk-MPO7Y76D.js} +9 -3
- package/dist/{chunk-JLM4LBUS.js → chunk-MU6Z5DCI.js} +6 -3
- package/dist/{chunk-5MALB34H.js → chunk-MUUOE2NT.js} +31 -11
- package/dist/chunk-N2JYU4JI.js +62 -0
- package/dist/{chunk-C6WJ4GQW.js → chunk-NHBNPK5J.js} +40 -37
- package/dist/{chunk-JUWFVIDP.mjs → chunk-NQV2H4SC.mjs} +25 -6
- package/dist/{chunk-WAIXKROS.mjs → chunk-NSEO2B74.mjs} +12 -8
- package/dist/{chunk-2WBPUW75.mjs → chunk-O4JI4FC6.mjs} +39 -36
- package/dist/{chunk-SQ7OL2X5.mjs → chunk-OFTLPYYC.mjs} +30 -10
- package/dist/{chunk-JQK354YN.js → chunk-OFWK2B23.js} +234 -10
- package/dist/chunk-ONTRGV5T.js +159 -0
- package/dist/{chunk-IVGKPD2L.mjs → chunk-OPHYFC5W.mjs} +5 -5
- package/dist/{chunk-2LUDQBVY.mjs → chunk-OUARQFZ7.mjs} +4 -4
- package/dist/{chunk-DAR2BMMV.js → chunk-PFYK2V3E.js} +32 -41
- package/dist/{chunk-ZYPEO2KY.js → chunk-PGBKMW4Q.js} +30 -0
- package/dist/{chunk-DXXYPVJJ.js → chunk-PR5ZPB6J.js} +3 -3
- package/dist/{chunk-QVZTZHCJ.mjs → chunk-PSYDHEXN.mjs} +52 -33
- package/dist/{chunk-CMGI5WHZ.js → chunk-PTWCIG3Y.js} +2 -2
- package/dist/{chunk-FHE4D56E.js → chunk-PVNHW3PY.js} +26 -9
- package/dist/{chunk-QLHFXYWA.mjs → chunk-QOEE2PW5.mjs} +73 -10
- package/dist/{chunk-AQ72JVUG.js → chunk-QQKP437L.js} +5 -5
- package/dist/{chunk-IOHPB4CF.js → chunk-QYJBMQ5P.js} +29 -10
- package/dist/{chunk-NZLOLMT2.mjs → chunk-RFB4M3WM.mjs} +50 -10
- package/dist/{chunk-TFPIRBHL.js → chunk-RLQITKTC.js} +26 -10
- package/dist/{chunk-7CAJK2ZK.mjs → chunk-RPSHILHD.mjs} +2 -2
- package/dist/{chunk-GX74TC62.js → chunk-RTHC4KWM.js} +2 -5
- package/dist/{chunk-65VXCN5N.js → chunk-SKMZTW3K.js} +56 -11
- package/dist/{chunk-VHWTMNQN.js → chunk-SO6POTSO.js} +10 -10
- package/dist/chunk-SQGFNVYT.js +222 -0
- package/dist/{chunk-45H3JEI3.js → chunk-SR5OHSI7.js} +50 -31
- package/dist/{chunk-GBTKAKUD.mjs → chunk-SRNBEFJO.mjs} +24 -28
- package/dist/{chunk-SQK2CPSV.mjs → chunk-SXNHXUUF.mjs} +16 -5
- package/dist/{chunk-OE6WTZES.js → chunk-TLJD4GFY.js} +69 -19
- package/dist/{chunk-R5XY4EQL.js → chunk-TQOWIDQT.js} +8 -15
- package/dist/{chunk-IPLK4AIE.mjs → chunk-TR4DGL3U.mjs} +7 -6
- package/dist/{chunk-QAO5KANE.mjs → chunk-TULQETJ5.mjs} +4 -3
- package/dist/{chunk-4APNERYR.js → chunk-U356F7GU.js} +12 -30
- package/dist/{chunk-AGR3FM3V.js → chunk-UB6SHKPR.js} +8 -7
- package/dist/{chunk-Z6F67MJE.mjs → chunk-UBP7HZSU.mjs} +4 -3
- package/dist/{chunk-HZ5Z5Y2J.mjs → chunk-UJ5NMLZN.mjs} +13 -31
- package/dist/chunk-UKLVOR4E.js +67 -0
- package/dist/{chunk-CKFE2B36.js → chunk-ULODU52Q.js} +9 -19
- package/dist/{chunk-QQDKQLHJ.mjs → chunk-UPO4LLNK.mjs} +71 -49
- package/dist/chunk-V4JIZN3E.mjs +156 -0
- package/dist/{chunk-R3QWJ7GT.mjs → chunk-V5557VIB.mjs} +23 -6
- package/dist/chunk-VBBOH5HA.js +25 -0
- package/dist/chunk-VBZE77VM.mjs +65 -0
- package/dist/{chunk-XLVEI7GS.js → chunk-VE3SYUMH.js} +3 -2
- package/dist/{chunk-SWF7GJYT.mjs → chunk-VHW7NWXM.mjs} +85 -58
- package/dist/{chunk-YHFBPSMF.js → chunk-VTOMFVSF.js} +72 -49
- package/dist/{chunk-QPGL4YEO.mjs → chunk-W7UGU2O6.mjs} +12 -24
- package/dist/{chunk-AYDTXJOR.mjs → chunk-WDRYAP7T.mjs} +18 -15
- package/dist/{chunk-AMOH5AMN.mjs → chunk-WFIQIBLC.mjs} +2 -2
- package/dist/{chunk-BR5OSUZT.mjs → chunk-WI4N5DD3.mjs} +38 -7
- package/dist/{chunk-TQEIMVJD.mjs → chunk-WK45IRP7.mjs} +28 -37
- package/dist/{chunk-HLJQZUIY.mjs → chunk-WNX4TH7U.mjs} +32 -4
- package/dist/{chunk-7MASYF4S.mjs → chunk-WT6CULN3.mjs} +12 -13
- package/dist/{chunk-6PBNFLM7.js → chunk-WV5XHYW6.js} +4 -3
- package/dist/{chunk-CQGAZ5JQ.js → chunk-X7WESYRG.js} +15 -4
- package/dist/{chunk-PUYT62KC.js → chunk-XAALCDGD.js} +5 -6
- package/dist/{chunk-YPHOVEVU.mjs → chunk-XATXFVKR.mjs} +8 -2
- package/dist/chunk-XHF3L4ET.mjs +132 -0
- package/dist/{chunk-QPOH6SOO.mjs → chunk-XISZACMA.mjs} +126 -101
- package/dist/{chunk-QYGBT4NL.js → chunk-XN43YK75.js} +16 -28
- package/dist/{chunk-H5MZ54PM.js → chunk-XPA2YCQO.js} +58 -49
- package/dist/{chunk-CHH7DWIO.js → chunk-XRNKHQTL.js} +7 -1
- package/dist/{chunk-WLIFEALE.mjs → chunk-XTSG362L.mjs} +29 -2
- package/dist/{chunk-KQZ4F7FZ.js → chunk-XTV5JLLC.js} +18 -4
- package/dist/{chunk-AHF6JE43.js → chunk-YACOKYDW.js} +21 -18
- package/dist/{chunk-4Q4GADHJ.js → chunk-YI6ORD3U.js} +40 -5
- package/dist/{chunk-ASALMHFI.js → chunk-YMKA4L3Z.js} +1 -6
- package/dist/{chunk-3JGOTJZM.js → chunk-YTLJPWXL.js} +4 -4
- package/dist/{chunk-XR6B2URW.js → chunk-Z52PUIAH.js} +22 -13
- package/dist/{chunk-AVUXDQYO.mjs → chunk-Z5B7VNEG.mjs} +10 -4
- package/dist/{chunk-3USEV7EV.js → chunk-ZDK4LEPB.js} +12 -13
- package/dist/chunk-ZDXIP33Y.js +58 -0
- package/dist/{chunk-XFJ5Q5PF.mjs → chunk-ZJWUBR2X.mjs} +2 -7
- package/dist/components/ActivityFeed.js +5 -4
- package/dist/components/ActivityFeed.mjs +3 -2
- package/dist/components/Affix.js +2 -2
- package/dist/components/Affix.mjs +1 -1
- package/dist/components/Anchor.d.mts +20 -1
- package/dist/components/Anchor.d.ts +20 -1
- package/dist/components/Anchor.js +8 -4
- package/dist/components/Anchor.mjs +1 -1
- package/dist/components/AnchorLink.d.mts +3 -23
- package/dist/components/AnchorLink.d.ts +3 -23
- package/dist/components/AnchorLink.js +3 -4
- package/dist/components/AnchorLink.mjs +1 -2
- package/dist/components/AreaChart.d.mts +2 -0
- package/dist/components/AreaChart.d.ts +2 -0
- package/dist/components/AreaChart.js +7 -7
- package/dist/components/AreaChart.mjs +5 -5
- package/dist/components/AutoComplete.js +2 -2
- package/dist/components/AutoComplete.mjs +1 -1
- package/dist/components/AvatarGroup.js +3 -3
- package/dist/components/AvatarGroup.mjs +1 -1
- package/dist/components/BackTop.js +3 -3
- package/dist/components/BackTop.mjs +1 -1
- package/dist/components/BarChart.js +7 -7
- package/dist/components/BarChart.mjs +5 -5
- package/dist/components/Breadcrumb.d.mts +18 -2
- package/dist/components/Breadcrumb.d.ts +18 -2
- package/dist/components/Breadcrumb.js +7 -3
- package/dist/components/Breadcrumb.mjs +1 -1
- package/dist/components/BreadcrumbItem.d.mts +3 -21
- package/dist/components/BreadcrumbItem.d.ts +3 -21
- package/dist/components/BreadcrumbItem.js +2 -3
- package/dist/components/BreadcrumbItem.mjs +1 -2
- package/dist/components/Button.js +2 -2
- package/dist/components/Button.mjs +1 -1
- package/dist/components/ButtonGroup.js +4 -4
- package/dist/components/ButtonGroup.mjs +1 -1
- package/dist/components/Carousel.js +2 -2
- package/dist/components/Carousel.mjs +1 -1
- package/dist/components/Cascader.js +2 -2
- package/dist/components/Cascader.mjs +1 -1
- package/dist/components/ChartCanvas.js +3 -3
- package/dist/components/ChartCanvas.mjs +1 -1
- package/dist/components/ChartLegend.js +3 -3
- package/dist/components/ChartLegend.mjs +1 -1
- package/dist/components/ChartTooltip.js +3 -3
- package/dist/components/ChartTooltip.mjs +1 -1
- package/dist/components/ChatWindow.js +5 -4
- package/dist/components/ChatWindow.mjs +3 -2
- package/dist/components/Code.js +3 -3
- package/dist/components/Code.mjs +1 -1
- package/dist/components/CodeEditor.d.mts +8 -1
- package/dist/components/CodeEditor.d.ts +8 -1
- package/dist/components/CodeEditor.js +3 -3
- package/dist/components/CodeEditor.mjs +1 -1
- package/dist/components/Col.js +3 -3
- package/dist/components/Col.mjs +2 -2
- package/dist/components/CollapsePanel.js +3 -3
- package/dist/components/CollapsePanel.mjs +1 -1
- package/dist/components/CommentThread.js +4 -4
- package/dist/components/CommentThread.mjs +2 -2
- package/dist/components/ConfigProvider.d.mts +3 -2
- package/dist/components/ConfigProvider.d.ts +3 -2
- package/dist/components/ConfigProvider.js +3 -3
- package/dist/components/ConfigProvider.mjs +1 -1
- package/dist/components/CropUpload.js +6 -6
- package/dist/components/CropUpload.mjs +5 -5
- package/dist/components/DataTableWithToolbar.d.mts +2 -7
- package/dist/components/DataTableWithToolbar.d.ts +2 -7
- package/dist/components/DataTableWithToolbar.js +6 -7
- package/dist/components/DataTableWithToolbar.mjs +4 -5
- package/dist/components/DatePicker.js +2 -2
- package/dist/components/DatePicker.mjs +1 -1
- package/dist/components/DonutChart.js +8 -8
- package/dist/components/DonutChart.mjs +6 -6
- package/dist/components/Drawer.js +3 -3
- package/dist/components/Drawer.mjs +2 -2
- package/dist/components/Dropdown.d.mts +10 -2
- package/dist/components/Dropdown.d.ts +10 -2
- package/dist/components/Dropdown.js +8 -5
- package/dist/components/Dropdown.mjs +2 -3
- package/dist/components/DropdownItem.js +4 -5
- package/dist/components/DropdownItem.mjs +3 -4
- package/dist/components/DropdownMenu.d.mts +3 -13
- package/dist/components/DropdownMenu.d.ts +3 -13
- package/dist/components/DropdownMenu.js +9 -2
- package/dist/components/DropdownMenu.mjs +2 -1
- package/dist/components/FileManager.js +3 -3
- package/dist/components/FileManager.mjs +1 -1
- package/dist/components/Form.d.mts +1 -0
- package/dist/components/Form.d.ts +1 -0
- package/dist/components/Form.js +3 -3
- package/dist/components/Form.mjs +1 -1
- package/dist/components/FormItem.js +3 -3
- package/dist/components/FormItem.mjs +2 -2
- package/dist/components/FormWizard.js +6 -6
- package/dist/components/FormWizard.mjs +4 -4
- package/dist/components/FunnelChart.js +6 -6
- package/dist/components/FunnelChart.mjs +5 -5
- package/dist/components/GaugeChart.js +3 -3
- package/dist/components/GaugeChart.mjs +2 -2
- package/dist/components/HeatmapChart.js +5 -5
- package/dist/components/HeatmapChart.mjs +4 -4
- package/dist/components/Image.js +5 -5
- package/dist/components/Image.mjs +4 -4
- package/dist/components/ImageCropper.js +2 -2
- package/dist/components/ImageCropper.mjs +1 -1
- package/dist/components/ImageGroup.js +5 -5
- package/dist/components/ImageGroup.mjs +3 -3
- package/dist/components/ImagePreview.js +3 -3
- package/dist/components/ImagePreview.mjs +2 -2
- package/dist/components/ImageViewer.js +2 -2
- package/dist/components/ImageViewer.mjs +1 -1
- package/dist/components/InfiniteScroll.js +3 -3
- package/dist/components/InfiniteScroll.mjs +1 -1
- package/dist/components/InputNumber.js +2 -2
- package/dist/components/InputNumber.mjs +1 -1
- package/dist/components/Kanban.d.mts +3 -2
- package/dist/components/Kanban.d.ts +3 -2
- package/dist/components/Kanban.js +5 -4
- package/dist/components/Kanban.mjs +3 -2
- package/dist/components/LineChart.js +7 -7
- package/dist/components/LineChart.mjs +5 -5
- package/dist/components/List.d.mts +22 -1
- package/dist/components/List.d.ts +22 -1
- package/dist/components/List.js +3 -2
- package/dist/components/List.mjs +2 -1
- package/dist/components/Loading.js +3 -2
- package/dist/components/Loading.mjs +2 -1
- package/dist/components/Mentions.js +3 -3
- package/dist/components/Mentions.mjs +1 -1
- package/dist/components/Menu.d.mts +43 -2
- package/dist/components/Menu.d.ts +43 -2
- package/dist/components/Menu.js +15 -3
- package/dist/components/Menu.mjs +1 -1
- package/dist/components/MenuItem.d.mts +3 -20
- package/dist/components/MenuItem.d.ts +3 -20
- package/dist/components/MenuItem.js +8 -3
- package/dist/components/MenuItem.mjs +1 -2
- package/dist/components/MenuItemGroup.d.mts +3 -16
- package/dist/components/MenuItemGroup.d.ts +3 -16
- package/dist/components/MenuItemGroup.js +8 -4
- package/dist/components/MenuItemGroup.mjs +1 -3
- package/dist/components/Modal.js +4 -4
- package/dist/components/Modal.mjs +3 -3
- package/dist/components/Notification.js +4 -4
- package/dist/components/Notification.mjs +1 -1
- package/dist/components/NotificationCenter.js +9 -7
- package/dist/components/NotificationCenter.mjs +7 -5
- package/dist/components/Pagination.d.mts +2 -2
- package/dist/components/Pagination.d.ts +2 -2
- package/dist/components/Pagination.js +3 -3
- package/dist/components/Pagination.mjs +1 -1
- package/dist/components/PieChart.js +7 -7
- package/dist/components/PieChart.mjs +5 -5
- package/dist/components/Popconfirm.js +4 -4
- package/dist/components/Popconfirm.mjs +3 -3
- package/dist/components/Popover.js +4 -4
- package/dist/components/Popover.mjs +3 -3
- package/dist/components/RadarChart.d.mts +3 -0
- package/dist/components/RadarChart.d.ts +3 -0
- package/dist/components/RadarChart.js +7 -7
- package/dist/components/RadarChart.mjs +5 -5
- package/dist/components/Resizable.js +3 -3
- package/dist/components/Resizable.mjs +1 -1
- package/dist/components/RichTextEditor.d.mts +10 -3
- package/dist/components/RichTextEditor.d.ts +10 -3
- package/dist/components/RichTextEditor.js +3 -3
- package/dist/components/RichTextEditor.mjs +1 -1
- package/dist/components/Row.js +3 -3
- package/dist/components/Row.mjs +1 -1
- package/dist/components/ScatterChart.js +7 -7
- package/dist/components/ScatterChart.mjs +5 -5
- package/dist/components/Segmented.js +2 -2
- package/dist/components/Segmented.mjs +1 -1
- package/dist/components/Select.js +2 -2
- package/dist/components/Select.mjs +1 -1
- package/dist/components/Splitter.js +3 -3
- package/dist/components/Splitter.mjs +1 -1
- package/dist/components/Statistic.js +2 -2
- package/dist/components/Statistic.mjs +1 -1
- package/dist/components/Stepper.js +2 -2
- package/dist/components/Stepper.mjs +1 -1
- package/dist/components/Steps.d.mts +32 -1
- package/dist/components/Steps.d.ts +32 -1
- package/dist/components/Steps.js +7 -3
- package/dist/components/Steps.mjs +1 -1
- package/dist/components/StepsItem.d.mts +3 -36
- package/dist/components/StepsItem.d.ts +3 -36
- package/dist/components/StepsItem.js +2 -2
- package/dist/components/StepsItem.mjs +1 -1
- package/dist/components/SubMenu.d.mts +3 -20
- package/dist/components/SubMenu.d.ts +3 -20
- package/dist/components/SubMenu.js +8 -5
- package/dist/components/SubMenu.mjs +1 -4
- package/dist/components/SunburstChart.js +6 -6
- package/dist/components/SunburstChart.mjs +5 -5
- package/dist/components/Switch.js +2 -2
- package/dist/components/Switch.mjs +1 -1
- package/dist/components/TabPane.d.mts +3 -57
- package/dist/components/TabPane.d.ts +3 -57
- package/dist/components/TabPane.js +2 -2
- package/dist/components/TabPane.mjs +1 -1
- package/dist/components/Table.d.mts +4 -59
- package/dist/components/Table.d.ts +4 -59
- package/dist/components/Table.js +2 -2
- package/dist/components/Table.mjs +1 -1
- package/dist/components/Tabs.d.mts +54 -1
- package/dist/components/Tabs.d.ts +54 -1
- package/dist/components/Tabs.js +7 -3
- package/dist/components/Tabs.mjs +1 -1
- package/dist/components/TaskBoard.js +4 -4
- package/dist/components/TaskBoard.mjs +2 -2
- package/dist/components/TimePicker.js +2 -2
- package/dist/components/TimePicker.mjs +1 -1
- package/dist/components/Tooltip.js +4 -4
- package/dist/components/Tooltip.mjs +3 -3
- package/dist/components/Transfer.js +2 -2
- package/dist/components/Transfer.mjs +1 -1
- package/dist/components/Tree.d.mts +19 -0
- package/dist/components/Tree.d.ts +19 -0
- package/dist/components/Tree.js +4 -3
- package/dist/components/Tree.mjs +2 -1
- package/dist/components/TreeMapChart.js +6 -6
- package/dist/components/TreeMapChart.mjs +5 -5
- package/dist/components/TreeSelect.js +2 -2
- package/dist/components/TreeSelect.mjs +1 -1
- package/dist/components/Upload.js +3 -3
- package/dist/components/Upload.mjs +2 -2
- package/dist/components/VirtualList.js +2 -2
- package/dist/components/VirtualList.mjs +1 -1
- package/dist/components/VirtualTable.js +3 -3
- package/dist/components/VirtualTable.mjs +1 -1
- package/dist/components/Watermark.js +2 -2
- package/dist/components/Watermark.mjs +1 -1
- package/dist/index.d.mts +32 -18
- package/dist/index.d.ts +32 -18
- package/dist/index.js +362 -213
- package/dist/index.mjs +243 -95
- package/dist/types-BT4oTXQ_.d.mts +31 -0
- package/dist/types-BT4oTXQ_.d.ts +31 -0
- package/package.json +13 -8
- package/dist/chunk-24RUEJWB.js +0 -293
- package/dist/chunk-3NE6VZRY.js +0 -67
- package/dist/chunk-7YLVAZJQ.mjs +0 -47
- package/dist/chunk-A3PYG3D6.js +0 -107
- package/dist/chunk-B3LRUKXM.mjs +0 -65
- package/dist/chunk-B53R2U2R.mjs +0 -86
- package/dist/chunk-BKYE77F2.js +0 -171
- package/dist/chunk-CRSMECWE.mjs +0 -33
- package/dist/chunk-D5KYIQWB.mjs +0 -105
- package/dist/chunk-DUWAV47E.js +0 -42
- package/dist/chunk-DZGDCRBH.mjs +0 -30
- package/dist/chunk-EHU3J4B2.mjs +0 -536
- package/dist/chunk-EQWQXURG.js +0 -18
- package/dist/chunk-F6KHZNRS.js +0 -32
- package/dist/chunk-GJEWBALW.js +0 -38
- package/dist/chunk-GOUMB34F.mjs +0 -168
- package/dist/chunk-H36CWHUP.mjs +0 -30
- package/dist/chunk-HZHFFVP7.mjs +0 -63
- package/dist/chunk-IBYIPXIO.js +0 -88
- package/dist/chunk-IS467WAO.mjs +0 -39
- package/dist/chunk-MB7CJ32C.mjs +0 -878
- package/dist/chunk-OFBK35TK.mjs +0 -32
- package/dist/chunk-OWUGXP6K.js +0 -37
- package/dist/chunk-QBZODEIG.js +0 -49
- package/dist/chunk-R5P72RIT.js +0 -180
- package/dist/chunk-RARHRSPQ.js +0 -72
- package/dist/chunk-SIVJX7VU.mjs +0 -16
- package/dist/chunk-SMC2RV3V.mjs +0 -250
- package/dist/chunk-T5FAKJ6C.mjs +0 -49
- package/dist/chunk-WGPUGPYE.js +0 -543
- package/dist/chunk-XID6T65A.js +0 -163
- package/dist/chunk-XO6NSGV3.js +0 -884
- package/dist/chunk-Y3NDP56G.mjs +0 -174
- package/dist/chunk-YXWRSEP5.mjs +0 -286
- package/dist/chunk-Z6CRXABX.js +0 -88
- package/dist/chunk-ZIUOENTL.mjs +0 -85
|
@@ -0,0 +1,929 @@
|
|
|
1
|
+
import React, { useRef, useState, useMemo, useEffect } from 'react';
|
|
2
|
+
import { getSpinnerSVG, getTableVirtualRecommendation, createTableResizeObserverController, getTableWrapperClasses, tableExportButtonClasses, classNames, tableBaseClasses, tableLoadingOverlayClasses, getFixedColumnOffsets, filterDataAdvanced, filterData, sortData, paginateData, createTableRowKeyCache, calculatePagination, groupDataByColumn, getSimplePaginationContainerClasses, getSimplePaginationTotalClasses, getSimplePaginationControlsClasses, getSimplePaginationSelectClasses, getSimplePaginationButtonsWrapperClasses, getSimplePaginationButtonClasses, getSimplePaginationPageIndicatorClasses, getExpandIconCellClasses, getTableHeaderClasses, getCheckboxCellClasses, getTableHeaderCellClasses, tableEmptyStateClasses, tableGroupHeaderClasses, getGroupHeaderCellClasses, tableSummaryRowClasses, getTableCellClasses, getLoadingOverlaySpinnerClasses, exportTableToCsv, downloadCsv, icon24ViewBox, lockClosedIcon24PathD, lockOpenIcon24PathD, icon16ViewBox, getSortIconClasses, sortAscIcon16PathD, sortDescIcon16PathD, sortBothIcon16PathD, editableCellInputClasses, getEditableCellClasses, getTableRowClasses, getExpandedRowClasses, getExpandedRowContentClasses, getExpandIconClasses, expandChevronIcon16PathD } from '@expcat/tigercat-core';
|
|
3
|
+
import { jsxs, jsx } from 'react/jsx-runtime';
|
|
4
|
+
|
|
5
|
+
// src/components/Table.tsx
|
|
6
|
+
var spinnerSvg = getSpinnerSVG("spinner");
|
|
7
|
+
var SortIcon = ({ direction }) => {
|
|
8
|
+
const active = direction !== null;
|
|
9
|
+
const pathD = direction === "asc" ? sortAscIcon16PathD : direction === "desc" ? sortDescIcon16PathD : sortBothIcon16PathD;
|
|
10
|
+
return /* @__PURE__ */ jsx(
|
|
11
|
+
"svg",
|
|
12
|
+
{
|
|
13
|
+
className: getSortIconClasses(active),
|
|
14
|
+
width: "16",
|
|
15
|
+
height: "16",
|
|
16
|
+
viewBox: icon16ViewBox,
|
|
17
|
+
fill: "currentColor",
|
|
18
|
+
children: /* @__PURE__ */ jsx("path", { d: pathD })
|
|
19
|
+
}
|
|
20
|
+
);
|
|
21
|
+
};
|
|
22
|
+
var LockIcon = ({ locked }) => {
|
|
23
|
+
return /* @__PURE__ */ jsx("svg", { width: "14", height: "14", viewBox: icon24ViewBox, fill: "currentColor", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: locked ? lockClosedIcon24PathD : lockOpenIcon24PathD }) });
|
|
24
|
+
};
|
|
25
|
+
var ExpandIcon = ({ expanded }) => {
|
|
26
|
+
return /* @__PURE__ */ jsx(
|
|
27
|
+
"svg",
|
|
28
|
+
{
|
|
29
|
+
className: getExpandIconClasses(expanded),
|
|
30
|
+
width: "16",
|
|
31
|
+
height: "16",
|
|
32
|
+
viewBox: icon16ViewBox,
|
|
33
|
+
fill: "currentColor",
|
|
34
|
+
"aria-hidden": "true",
|
|
35
|
+
children: /* @__PURE__ */ jsx("path", { d: expandChevronIcon16PathD })
|
|
36
|
+
}
|
|
37
|
+
);
|
|
38
|
+
};
|
|
39
|
+
var LoadingSpinner = () => /* @__PURE__ */ jsx(
|
|
40
|
+
"svg",
|
|
41
|
+
{
|
|
42
|
+
className: getLoadingOverlaySpinnerClasses(),
|
|
43
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
44
|
+
fill: "none",
|
|
45
|
+
viewBox: spinnerSvg.viewBox,
|
|
46
|
+
children: spinnerSvg.elements.map((el, index) => {
|
|
47
|
+
if (el.type === "circle") return /* @__PURE__ */ jsx("circle", { ...el.attrs }, index);
|
|
48
|
+
if (el.type === "path") return /* @__PURE__ */ jsx("path", { ...el.attrs }, index);
|
|
49
|
+
return null;
|
|
50
|
+
})
|
|
51
|
+
}
|
|
52
|
+
);
|
|
53
|
+
function useTableState(input) {
|
|
54
|
+
const {
|
|
55
|
+
columns,
|
|
56
|
+
dataSource,
|
|
57
|
+
sort,
|
|
58
|
+
defaultSort,
|
|
59
|
+
filters,
|
|
60
|
+
defaultFilters,
|
|
61
|
+
pagination,
|
|
62
|
+
rowSelection,
|
|
63
|
+
expandable,
|
|
64
|
+
rowKey,
|
|
65
|
+
editable,
|
|
66
|
+
editableCells,
|
|
67
|
+
filterMode,
|
|
68
|
+
advancedFilterRules,
|
|
69
|
+
groupBy,
|
|
70
|
+
exportFilename,
|
|
71
|
+
measuredColumnWidths,
|
|
72
|
+
onChange,
|
|
73
|
+
onRowClick,
|
|
74
|
+
onSelectionChange,
|
|
75
|
+
onSortChange,
|
|
76
|
+
onFilterChange,
|
|
77
|
+
onPageChange,
|
|
78
|
+
onExpandChange,
|
|
79
|
+
onCellChange,
|
|
80
|
+
onColumnOrderChange,
|
|
81
|
+
onExport
|
|
82
|
+
} = input;
|
|
83
|
+
const isSortControlled = sort !== void 0;
|
|
84
|
+
const isFiltersControlled = filters !== void 0;
|
|
85
|
+
const paginationConfig = pagination !== false && typeof pagination === "object" ? pagination : null;
|
|
86
|
+
const isCurrentPageControlled = paginationConfig?.current !== void 0;
|
|
87
|
+
const isPageSizeControlled = paginationConfig?.pageSize !== void 0;
|
|
88
|
+
const isSelectionControlled = rowSelection?.selectedRowKeys !== void 0 && Array.isArray(rowSelection.selectedRowKeys);
|
|
89
|
+
const isExpandControlled = expandable?.expandedRowKeys !== void 0 && Array.isArray(expandable.expandedRowKeys);
|
|
90
|
+
const [uncontrolledSortState, setUncontrolledSortState] = useState(
|
|
91
|
+
defaultSort ?? { key: null, direction: null }
|
|
92
|
+
);
|
|
93
|
+
const [uncontrolledFilterState, setUncontrolledFilterState] = useState(
|
|
94
|
+
defaultFilters ?? {}
|
|
95
|
+
);
|
|
96
|
+
const [uncontrolledCurrentPage, setUncontrolledCurrentPage] = useState(
|
|
97
|
+
() => paginationConfig?.defaultCurrent ?? paginationConfig?.current ?? 1
|
|
98
|
+
);
|
|
99
|
+
const [uncontrolledCurrentPageSize, setUncontrolledCurrentPageSize] = useState(
|
|
100
|
+
() => paginationConfig?.defaultPageSize ?? paginationConfig?.pageSize ?? 10
|
|
101
|
+
);
|
|
102
|
+
const [uncontrolledSelectedRowKeys, setUncontrolledSelectedRowKeys] = useState(rowSelection?.defaultSelectedRowKeys ?? rowSelection?.selectedRowKeys ?? []);
|
|
103
|
+
const [uncontrolledExpandedRowKeys, setUncontrolledExpandedRowKeys] = useState(expandable?.defaultExpandedRowKeys ?? expandable?.expandedRowKeys ?? []);
|
|
104
|
+
const sortState = isSortControlled ? sort : uncontrolledSortState;
|
|
105
|
+
const filterState = isFiltersControlled ? filters : uncontrolledFilterState;
|
|
106
|
+
const currentPage = isCurrentPageControlled ? paginationConfig.current : uncontrolledCurrentPage;
|
|
107
|
+
const currentPageSize = isPageSizeControlled ? paginationConfig.pageSize : uncontrolledCurrentPageSize;
|
|
108
|
+
const selectedRowKeys = isSelectionControlled ? rowSelection.selectedRowKeys : uncontrolledSelectedRowKeys;
|
|
109
|
+
const expandedRowKeys = isExpandControlled ? expandable.expandedRowKeys : uncontrolledExpandedRowKeys;
|
|
110
|
+
useEffect(() => {
|
|
111
|
+
if (isSortControlled && sort) {
|
|
112
|
+
setUncontrolledSortState(sort);
|
|
113
|
+
}
|
|
114
|
+
}, [isSortControlled, sort?.key, sort?.direction]);
|
|
115
|
+
useEffect(() => {
|
|
116
|
+
if (isFiltersControlled && filters) {
|
|
117
|
+
setUncontrolledFilterState(filters);
|
|
118
|
+
}
|
|
119
|
+
}, [isFiltersControlled, filters]);
|
|
120
|
+
useEffect(() => {
|
|
121
|
+
if (isCurrentPageControlled) {
|
|
122
|
+
setUncontrolledCurrentPage(paginationConfig.current);
|
|
123
|
+
}
|
|
124
|
+
}, [isCurrentPageControlled, paginationConfig?.current]);
|
|
125
|
+
useEffect(() => {
|
|
126
|
+
if (isPageSizeControlled) {
|
|
127
|
+
setUncontrolledCurrentPageSize(paginationConfig.pageSize);
|
|
128
|
+
}
|
|
129
|
+
}, [isPageSizeControlled, paginationConfig?.pageSize]);
|
|
130
|
+
useEffect(() => {
|
|
131
|
+
if (isSelectionControlled) {
|
|
132
|
+
setUncontrolledSelectedRowKeys(rowSelection?.selectedRowKeys ?? []);
|
|
133
|
+
}
|
|
134
|
+
}, [isSelectionControlled, rowSelection?.selectedRowKeys]);
|
|
135
|
+
useEffect(() => {
|
|
136
|
+
if (isExpandControlled) {
|
|
137
|
+
setUncontrolledExpandedRowKeys(expandable?.expandedRowKeys ?? []);
|
|
138
|
+
}
|
|
139
|
+
}, [isExpandControlled, expandable?.expandedRowKeys]);
|
|
140
|
+
const [fixedOverrides, setFixedOverrides] = useState({});
|
|
141
|
+
const displayColumns = useMemo(() => {
|
|
142
|
+
return columns.map((column) => {
|
|
143
|
+
const hasOverride = Object.prototype.hasOwnProperty.call(fixedOverrides, column.key);
|
|
144
|
+
return {
|
|
145
|
+
...column,
|
|
146
|
+
fixed: hasOverride ? fixedOverrides[column.key] : column.fixed
|
|
147
|
+
};
|
|
148
|
+
});
|
|
149
|
+
}, [columns, fixedOverrides]);
|
|
150
|
+
const totalColumnCount = useMemo(() => {
|
|
151
|
+
let count = displayColumns.length;
|
|
152
|
+
if (rowSelection && rowSelection.showCheckbox !== false) count++;
|
|
153
|
+
if (expandable) count++;
|
|
154
|
+
return count;
|
|
155
|
+
}, [displayColumns.length, rowSelection, expandable]);
|
|
156
|
+
const columnByKey = useMemo(() => {
|
|
157
|
+
const map = {};
|
|
158
|
+
for (const column of displayColumns) {
|
|
159
|
+
map[column.key] = column;
|
|
160
|
+
}
|
|
161
|
+
return map;
|
|
162
|
+
}, [displayColumns]);
|
|
163
|
+
const fixedColumnsInfo = useMemo(
|
|
164
|
+
() => getFixedColumnOffsets(displayColumns, measuredColumnWidths),
|
|
165
|
+
[displayColumns, measuredColumnWidths]
|
|
166
|
+
);
|
|
167
|
+
function toggleColumnLock(columnKey) {
|
|
168
|
+
setFixedOverrides((prev) => {
|
|
169
|
+
const original = columns.find((c) => c.key === columnKey)?.fixed;
|
|
170
|
+
const current = Object.prototype.hasOwnProperty.call(prev, columnKey) ? prev[columnKey] : original;
|
|
171
|
+
const isLocked = current === "left" || current === "right";
|
|
172
|
+
return {
|
|
173
|
+
...prev,
|
|
174
|
+
[columnKey]: isLocked ? false : "left"
|
|
175
|
+
};
|
|
176
|
+
});
|
|
177
|
+
}
|
|
178
|
+
const processedData = useMemo(() => {
|
|
179
|
+
let data = dataSource;
|
|
180
|
+
if (filterMode === "advanced" && advancedFilterRules.length > 0) {
|
|
181
|
+
data = filterDataAdvanced(data, advancedFilterRules);
|
|
182
|
+
} else {
|
|
183
|
+
data = filterData(data, filterState);
|
|
184
|
+
}
|
|
185
|
+
if (sortState.key && sortState.direction) {
|
|
186
|
+
const column = columnByKey[sortState.key];
|
|
187
|
+
data = sortData(data, sortState.key, sortState.direction, column?.sortFn);
|
|
188
|
+
}
|
|
189
|
+
return data;
|
|
190
|
+
}, [dataSource, filterState, sortState, columnByKey, filterMode, advancedFilterRules]);
|
|
191
|
+
const paginatedData = useMemo(() => {
|
|
192
|
+
if (pagination === false) {
|
|
193
|
+
return processedData;
|
|
194
|
+
}
|
|
195
|
+
return paginateData(processedData, currentPage, currentPageSize);
|
|
196
|
+
}, [processedData, currentPage, currentPageSize, pagination]);
|
|
197
|
+
const pageRowKeys = useMemo(
|
|
198
|
+
() => createTableRowKeyCache(rowKey).getMany(paginatedData),
|
|
199
|
+
[paginatedData, rowKey]
|
|
200
|
+
);
|
|
201
|
+
const selectedRowKeySet = useMemo(
|
|
202
|
+
() => new Set(selectedRowKeys),
|
|
203
|
+
[selectedRowKeys]
|
|
204
|
+
);
|
|
205
|
+
const expandedRowKeySet = useMemo(
|
|
206
|
+
() => new Set(expandedRowKeys),
|
|
207
|
+
[expandedRowKeys]
|
|
208
|
+
);
|
|
209
|
+
const paginationInfo = useMemo(() => {
|
|
210
|
+
if (pagination === false) {
|
|
211
|
+
return null;
|
|
212
|
+
}
|
|
213
|
+
const total = paginationConfig?.total !== void 0 && paginationConfig.total > 0 ? paginationConfig.total : processedData.length;
|
|
214
|
+
return calculatePagination(total, currentPage, currentPageSize);
|
|
215
|
+
}, [processedData.length, currentPage, currentPageSize, pagination, paginationConfig?.total]);
|
|
216
|
+
function handleSort(columnKey) {
|
|
217
|
+
const column = columnByKey[columnKey];
|
|
218
|
+
if (!column || !column.sortable) return;
|
|
219
|
+
let newDirection = "asc";
|
|
220
|
+
if (sortState.key === columnKey) {
|
|
221
|
+
if (sortState.direction === "asc") {
|
|
222
|
+
newDirection = "desc";
|
|
223
|
+
} else if (sortState.direction === "desc") {
|
|
224
|
+
newDirection = null;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
const newSortState = {
|
|
228
|
+
key: newDirection ? columnKey : null,
|
|
229
|
+
direction: newDirection
|
|
230
|
+
};
|
|
231
|
+
if (!isSortControlled) {
|
|
232
|
+
setUncontrolledSortState(newSortState);
|
|
233
|
+
}
|
|
234
|
+
onSortChange?.(newSortState);
|
|
235
|
+
onChange?.({
|
|
236
|
+
sort: newSortState,
|
|
237
|
+
filters: filterState,
|
|
238
|
+
pagination: pagination !== false ? { current: currentPage, pageSize: currentPageSize } : null
|
|
239
|
+
});
|
|
240
|
+
}
|
|
241
|
+
function handleFilter(columnKey, value) {
|
|
242
|
+
const newFilterState = { ...filterState, [columnKey]: value };
|
|
243
|
+
if (!isFiltersControlled) {
|
|
244
|
+
setUncontrolledFilterState(newFilterState);
|
|
245
|
+
}
|
|
246
|
+
setUncontrolledCurrentPage(1);
|
|
247
|
+
onFilterChange?.(newFilterState);
|
|
248
|
+
onChange?.({
|
|
249
|
+
sort: sortState,
|
|
250
|
+
filters: newFilterState,
|
|
251
|
+
pagination: pagination !== false ? { current: 1, pageSize: currentPageSize } : null
|
|
252
|
+
});
|
|
253
|
+
}
|
|
254
|
+
function handlePageChange(page) {
|
|
255
|
+
setUncontrolledCurrentPage(page);
|
|
256
|
+
onPageChange?.({ current: page, pageSize: currentPageSize });
|
|
257
|
+
onChange?.({
|
|
258
|
+
sort: sortState,
|
|
259
|
+
filters: filterState,
|
|
260
|
+
pagination: { current: page, pageSize: currentPageSize }
|
|
261
|
+
});
|
|
262
|
+
}
|
|
263
|
+
function handlePageSizeChange(pageSize) {
|
|
264
|
+
setUncontrolledCurrentPageSize(pageSize);
|
|
265
|
+
setUncontrolledCurrentPage(1);
|
|
266
|
+
onPageChange?.({ current: 1, pageSize });
|
|
267
|
+
onChange?.({
|
|
268
|
+
sort: sortState,
|
|
269
|
+
filters: filterState,
|
|
270
|
+
pagination: { current: 1, pageSize }
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
function handleToggleExpand(key, record) {
|
|
274
|
+
const isExpanded = expandedRowKeySet.has(key);
|
|
275
|
+
const newKeys = isExpanded ? expandedRowKeys.filter((k) => k !== key) : [...expandedRowKeys, key];
|
|
276
|
+
if (!isExpandControlled) {
|
|
277
|
+
setUncontrolledExpandedRowKeys(newKeys);
|
|
278
|
+
}
|
|
279
|
+
onExpandChange?.(newKeys, record, !isExpanded);
|
|
280
|
+
}
|
|
281
|
+
function handleRowClick(record, index, key) {
|
|
282
|
+
onRowClick?.(record, index);
|
|
283
|
+
if (expandable?.expandRowByClick) {
|
|
284
|
+
const isExpandableRow = expandable?.rowExpandable ? expandable.rowExpandable(record) : true;
|
|
285
|
+
if (isExpandableRow) {
|
|
286
|
+
handleToggleExpand(key, record);
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
}
|
|
290
|
+
function handleSelectRow(key, checked) {
|
|
291
|
+
let newKeys;
|
|
292
|
+
if (rowSelection?.type === "radio") {
|
|
293
|
+
newKeys = checked ? [key] : [];
|
|
294
|
+
} else {
|
|
295
|
+
if (checked) {
|
|
296
|
+
newKeys = [...selectedRowKeys, key];
|
|
297
|
+
} else {
|
|
298
|
+
newKeys = selectedRowKeys.filter((k) => k !== key);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
if (!isSelectionControlled) {
|
|
302
|
+
setUncontrolledSelectedRowKeys(newKeys);
|
|
303
|
+
}
|
|
304
|
+
onSelectionChange?.(newKeys);
|
|
305
|
+
}
|
|
306
|
+
function handleSelectAll(checked) {
|
|
307
|
+
if (checked) {
|
|
308
|
+
const newKeys = pageRowKeys;
|
|
309
|
+
if (!isSelectionControlled) {
|
|
310
|
+
setUncontrolledSelectedRowKeys(newKeys);
|
|
311
|
+
}
|
|
312
|
+
onSelectionChange?.(newKeys);
|
|
313
|
+
} else {
|
|
314
|
+
if (!isSelectionControlled) {
|
|
315
|
+
setUncontrolledSelectedRowKeys([]);
|
|
316
|
+
}
|
|
317
|
+
onSelectionChange?.([]);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
const allSelected = useMemo(() => {
|
|
321
|
+
if (pageRowKeys.length === 0) return false;
|
|
322
|
+
return pageRowKeys.every((key) => selectedRowKeySet.has(key));
|
|
323
|
+
}, [pageRowKeys, selectedRowKeySet]);
|
|
324
|
+
const someSelected = useMemo(
|
|
325
|
+
() => selectedRowKeys.length > 0 && !allSelected,
|
|
326
|
+
[selectedRowKeys.length, allSelected]
|
|
327
|
+
);
|
|
328
|
+
const [editingCell, setEditingCell] = useState(
|
|
329
|
+
null
|
|
330
|
+
);
|
|
331
|
+
const [editingValue, setEditingValue] = useState("");
|
|
332
|
+
function isCellEditable(columnKey, rowIndex) {
|
|
333
|
+
if (!editable) return false;
|
|
334
|
+
if (!editableCells) return true;
|
|
335
|
+
return !!editableCells.get(columnKey)?.has(rowIndex);
|
|
336
|
+
}
|
|
337
|
+
function startEditing(rowIndex, columnKey, currentValue) {
|
|
338
|
+
setEditingCell({ rowIndex, columnKey });
|
|
339
|
+
setEditingValue(String(currentValue ?? ""));
|
|
340
|
+
}
|
|
341
|
+
function commitEdit() {
|
|
342
|
+
if (editingCell) {
|
|
343
|
+
onCellChange?.(editingCell.rowIndex, editingCell.columnKey, editingValue);
|
|
344
|
+
setEditingCell(null);
|
|
345
|
+
}
|
|
346
|
+
}
|
|
347
|
+
function cancelEdit() {
|
|
348
|
+
setEditingCell(null);
|
|
349
|
+
}
|
|
350
|
+
function handleExport() {
|
|
351
|
+
const csv = exportTableToCsv(displayColumns, processedData);
|
|
352
|
+
downloadCsv(csv, exportFilename);
|
|
353
|
+
onExport?.(csv);
|
|
354
|
+
}
|
|
355
|
+
const [dragColumnKey, setDragColumnKey] = useState(null);
|
|
356
|
+
function handleDragStart(columnKey) {
|
|
357
|
+
setDragColumnKey(columnKey);
|
|
358
|
+
}
|
|
359
|
+
function handleDrop(targetKey) {
|
|
360
|
+
if (!dragColumnKey || dragColumnKey === targetKey) return;
|
|
361
|
+
const cols = [...displayColumns];
|
|
362
|
+
const fromIdx = cols.findIndex((c) => c.key === dragColumnKey);
|
|
363
|
+
const toIdx = cols.findIndex((c) => c.key === targetKey);
|
|
364
|
+
if (fromIdx >= 0 && toIdx >= 0) {
|
|
365
|
+
const [moved] = cols.splice(fromIdx, 1);
|
|
366
|
+
cols.splice(toIdx, 0, moved);
|
|
367
|
+
onColumnOrderChange?.(cols);
|
|
368
|
+
}
|
|
369
|
+
setDragColumnKey(null);
|
|
370
|
+
}
|
|
371
|
+
const groupedData = useMemo(() => {
|
|
372
|
+
if (!groupBy) return null;
|
|
373
|
+
return groupDataByColumn(paginatedData, groupBy);
|
|
374
|
+
}, [groupBy, paginatedData]);
|
|
375
|
+
return {
|
|
376
|
+
paginationConfig,
|
|
377
|
+
displayColumns,
|
|
378
|
+
fixedColumnsInfo,
|
|
379
|
+
processedData,
|
|
380
|
+
paginatedData,
|
|
381
|
+
pageRowKeys,
|
|
382
|
+
selectedRowKeySet,
|
|
383
|
+
expandedRowKeySet,
|
|
384
|
+
totalColumnCount,
|
|
385
|
+
paginationInfo,
|
|
386
|
+
allSelected,
|
|
387
|
+
someSelected,
|
|
388
|
+
groupedData,
|
|
389
|
+
sortState,
|
|
390
|
+
currentPage,
|
|
391
|
+
currentPageSize,
|
|
392
|
+
editingCell,
|
|
393
|
+
editingValue,
|
|
394
|
+
setEditingValue,
|
|
395
|
+
toggleColumnLock,
|
|
396
|
+
handleSort,
|
|
397
|
+
handleFilter,
|
|
398
|
+
handlePageChange,
|
|
399
|
+
handlePageSizeChange,
|
|
400
|
+
handleRowClick,
|
|
401
|
+
handleToggleExpand,
|
|
402
|
+
handleSelectRow,
|
|
403
|
+
handleSelectAll,
|
|
404
|
+
isCellEditable,
|
|
405
|
+
startEditing,
|
|
406
|
+
commitEdit,
|
|
407
|
+
cancelEdit,
|
|
408
|
+
handleExport,
|
|
409
|
+
handleDragStart,
|
|
410
|
+
handleDrop
|
|
411
|
+
};
|
|
412
|
+
}
|
|
413
|
+
function renderTableHeader(ctx, view) {
|
|
414
|
+
const { size, stickyHeader, rowSelection, expandable, columnLockable, columnDraggable } = view;
|
|
415
|
+
const expandHeaderTh = expandable ? /* @__PURE__ */ jsx("th", { className: getExpandIconCellClasses(size), "aria-label": "Expand" }) : null;
|
|
416
|
+
const expandAtStart = expandable?.expandIconPosition !== "end";
|
|
417
|
+
return /* @__PURE__ */ jsx("thead", { className: getTableHeaderClasses(stickyHeader), children: /* @__PURE__ */ jsxs("tr", { children: [
|
|
418
|
+
expandAtStart && expandHeaderTh,
|
|
419
|
+
rowSelection && rowSelection.showCheckbox !== false && rowSelection.type !== "radio" && /* @__PURE__ */ jsx("th", { className: getCheckboxCellClasses(size), children: /* @__PURE__ */ jsx(
|
|
420
|
+
"input",
|
|
421
|
+
{
|
|
422
|
+
type: "checkbox",
|
|
423
|
+
className: "rounded border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]",
|
|
424
|
+
checked: ctx.allSelected,
|
|
425
|
+
ref: (el) => {
|
|
426
|
+
if (el) el.indeterminate = ctx.someSelected;
|
|
427
|
+
},
|
|
428
|
+
onChange: (e) => ctx.handleSelectAll(e.target.checked)
|
|
429
|
+
}
|
|
430
|
+
) }),
|
|
431
|
+
ctx.displayColumns.map((column) => {
|
|
432
|
+
const isSorted = ctx.sortState.key === column.key;
|
|
433
|
+
const sortDirection = isSorted ? ctx.sortState.direction : null;
|
|
434
|
+
const ariaSort = column.sortable ? sortDirection === "asc" ? "ascending" : sortDirection === "desc" ? "descending" : "none" : void 0;
|
|
435
|
+
const isFixedLeft = column.fixed === "left";
|
|
436
|
+
const isFixedRight = column.fixed === "right";
|
|
437
|
+
const fixedStyle = isFixedLeft ? {
|
|
438
|
+
position: "sticky",
|
|
439
|
+
left: `${ctx.fixedColumnsInfo.leftOffsets[column.key] || 0}px`,
|
|
440
|
+
zIndex: 15
|
|
441
|
+
} : isFixedRight ? {
|
|
442
|
+
position: "sticky",
|
|
443
|
+
right: `${ctx.fixedColumnsInfo.rightOffsets[column.key] || 0}px`,
|
|
444
|
+
zIndex: 15
|
|
445
|
+
} : void 0;
|
|
446
|
+
const widthStyle = column.width ? {
|
|
447
|
+
width: typeof column.width === "number" ? `${column.width}px` : column.width
|
|
448
|
+
} : void 0;
|
|
449
|
+
const style = fixedStyle ? { ...widthStyle, ...fixedStyle } : widthStyle;
|
|
450
|
+
return /* @__PURE__ */ jsxs(
|
|
451
|
+
"th",
|
|
452
|
+
{
|
|
453
|
+
"data-tiger-table-column-key": column.key,
|
|
454
|
+
"aria-sort": ariaSort,
|
|
455
|
+
className: classNames(
|
|
456
|
+
getTableHeaderCellClasses(
|
|
457
|
+
size,
|
|
458
|
+
column.align || "left",
|
|
459
|
+
!!column.sortable,
|
|
460
|
+
column.headerClassName
|
|
461
|
+
),
|
|
462
|
+
(isFixedLeft || isFixedRight) && "bg-[var(--tiger-surface-muted,#f9fafb)]"
|
|
463
|
+
),
|
|
464
|
+
style,
|
|
465
|
+
draggable: columnDraggable ? true : void 0,
|
|
466
|
+
onDragStart: columnDraggable ? () => ctx.handleDragStart(column.key) : void 0,
|
|
467
|
+
onDragOver: columnDraggable ? (e) => e.preventDefault() : void 0,
|
|
468
|
+
onDrop: columnDraggable ? () => ctx.handleDrop(column.key) : void 0,
|
|
469
|
+
onClick: column.sortable ? () => ctx.handleSort(column.key) : void 0,
|
|
470
|
+
children: [
|
|
471
|
+
/* @__PURE__ */ jsxs("div", { className: "flex items-center gap-2", children: [
|
|
472
|
+
column.renderHeader ? column.renderHeader() : column.title,
|
|
473
|
+
columnLockable && /* @__PURE__ */ jsx(
|
|
474
|
+
"button",
|
|
475
|
+
{
|
|
476
|
+
type: "button",
|
|
477
|
+
"aria-label": column.fixed === "left" || column.fixed === "right" ? `Unlock column ${column.title}` : `Lock column ${column.title}`,
|
|
478
|
+
className: classNames(
|
|
479
|
+
"inline-flex items-center",
|
|
480
|
+
column.fixed === "left" || column.fixed === "right" ? "text-[var(--tiger-primary,#2563eb)]" : "text-gray-400 hover:text-gray-700"
|
|
481
|
+
),
|
|
482
|
+
onClick: (e) => {
|
|
483
|
+
e.stopPropagation();
|
|
484
|
+
ctx.toggleColumnLock(column.key);
|
|
485
|
+
},
|
|
486
|
+
children: /* @__PURE__ */ jsx(LockIcon, { locked: column.fixed === "left" || column.fixed === "right" })
|
|
487
|
+
}
|
|
488
|
+
),
|
|
489
|
+
column.sortable && /* @__PURE__ */ jsx(SortIcon, { direction: sortDirection })
|
|
490
|
+
] }),
|
|
491
|
+
column.filter && /* @__PURE__ */ jsx("div", { className: "mt-2", children: column.filter.type === "select" && column.filter.options ? /* @__PURE__ */ jsxs(
|
|
492
|
+
"select",
|
|
493
|
+
{
|
|
494
|
+
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded",
|
|
495
|
+
onChange: (e) => ctx.handleFilter(column.key, e.target.value),
|
|
496
|
+
onClick: (e) => e.stopPropagation(),
|
|
497
|
+
children: [
|
|
498
|
+
/* @__PURE__ */ jsx("option", { value: "", children: "All" }),
|
|
499
|
+
column.filter.options.map((opt) => /* @__PURE__ */ jsx("option", { value: opt.value, children: opt.label }, opt.value))
|
|
500
|
+
]
|
|
501
|
+
}
|
|
502
|
+
) : /* @__PURE__ */ jsx(
|
|
503
|
+
"input",
|
|
504
|
+
{
|
|
505
|
+
type: "text",
|
|
506
|
+
className: "w-full px-2 py-1 text-sm border border-gray-300 rounded",
|
|
507
|
+
placeholder: column.filter.placeholder || "Filter...",
|
|
508
|
+
onInput: (e) => ctx.handleFilter(column.key, e.target.value),
|
|
509
|
+
onClick: (e) => e.stopPropagation()
|
|
510
|
+
}
|
|
511
|
+
) })
|
|
512
|
+
]
|
|
513
|
+
},
|
|
514
|
+
column.key
|
|
515
|
+
);
|
|
516
|
+
}),
|
|
517
|
+
!expandAtStart && expandHeaderTh
|
|
518
|
+
] }) });
|
|
519
|
+
}
|
|
520
|
+
function renderTableBody(ctx, view) {
|
|
521
|
+
const { size, hoverable, striped, loading, emptyText, rowSelection, expandable, rowClassName } = view;
|
|
522
|
+
if (loading) {
|
|
523
|
+
return null;
|
|
524
|
+
}
|
|
525
|
+
if (ctx.paginatedData.length === 0) {
|
|
526
|
+
return /* @__PURE__ */ jsx("tbody", { children: /* @__PURE__ */ jsx("tr", { children: /* @__PURE__ */ jsx("td", { colSpan: ctx.totalColumnCount, className: tableEmptyStateClasses, children: /* @__PURE__ */ jsx("div", { role: "status", "aria-live": "polite", children: emptyText }) }) }) });
|
|
527
|
+
}
|
|
528
|
+
function renderDataRow(record, index) {
|
|
529
|
+
const key = ctx.pageRowKeys[index];
|
|
530
|
+
const isSelected = ctx.selectedRowKeySet.has(key);
|
|
531
|
+
const isExpanded = ctx.expandedRowKeySet.has(key);
|
|
532
|
+
const isRowExpandable = expandable ? expandable.rowExpandable ? expandable.rowExpandable(record) : true : false;
|
|
533
|
+
const rowClass = typeof rowClassName === "function" ? rowClassName(record, index) : rowClassName;
|
|
534
|
+
const expandToggleCell = expandable ? /* @__PURE__ */ jsx("td", { className: getExpandIconCellClasses(size), children: isRowExpandable && /* @__PURE__ */ jsx(
|
|
535
|
+
"button",
|
|
536
|
+
{
|
|
537
|
+
type: "button",
|
|
538
|
+
className: "inline-flex items-center justify-center",
|
|
539
|
+
"aria-label": isExpanded ? "Collapse row" : "Expand row",
|
|
540
|
+
"aria-expanded": isExpanded,
|
|
541
|
+
onClick: (e) => {
|
|
542
|
+
e.stopPropagation();
|
|
543
|
+
ctx.handleToggleExpand(key, record);
|
|
544
|
+
},
|
|
545
|
+
children: /* @__PURE__ */ jsx(ExpandIcon, { expanded: isExpanded })
|
|
546
|
+
}
|
|
547
|
+
) }) : null;
|
|
548
|
+
const expandAtStart = expandable?.expandIconPosition !== "end";
|
|
549
|
+
const rowNode = /* @__PURE__ */ jsxs(
|
|
550
|
+
"tr",
|
|
551
|
+
{
|
|
552
|
+
"data-tiger-table-row-index": index,
|
|
553
|
+
className: classNames(
|
|
554
|
+
getTableRowClasses(hoverable, striped, index % 2 === 0, rowClass),
|
|
555
|
+
ctx.fixedColumnsInfo.hasFixedColumns && "group"
|
|
556
|
+
),
|
|
557
|
+
onClick: () => ctx.handleRowClick(record, index, key),
|
|
558
|
+
children: [
|
|
559
|
+
expandAtStart && expandToggleCell,
|
|
560
|
+
rowSelection && rowSelection.showCheckbox !== false && /* @__PURE__ */ jsx("td", { className: getCheckboxCellClasses(size), children: /* @__PURE__ */ jsx(
|
|
561
|
+
"input",
|
|
562
|
+
{
|
|
563
|
+
type: rowSelection?.type === "radio" ? "radio" : "checkbox",
|
|
564
|
+
className: rowSelection?.type === "radio" ? "border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]" : "rounded border-gray-300 text-[var(--tiger-primary,#2563eb)] focus:ring-[var(--tiger-primary,#2563eb)]",
|
|
565
|
+
checked: isSelected,
|
|
566
|
+
disabled: rowSelection?.getCheckboxProps?.(record)?.disabled,
|
|
567
|
+
onChange: (e) => ctx.handleSelectRow(key, e.target.checked),
|
|
568
|
+
onClick: (e) => e.stopPropagation()
|
|
569
|
+
}
|
|
570
|
+
) }),
|
|
571
|
+
ctx.displayColumns.map((column) => {
|
|
572
|
+
const dataKey = column.dataKey || column.key;
|
|
573
|
+
const cellValue = record[dataKey];
|
|
574
|
+
const isFixedLeft = column.fixed === "left";
|
|
575
|
+
const isFixedRight = column.fixed === "right";
|
|
576
|
+
const fixedStyle = isFixedLeft ? {
|
|
577
|
+
position: "sticky",
|
|
578
|
+
left: `${ctx.fixedColumnsInfo.leftOffsets[column.key] || 0}px`,
|
|
579
|
+
zIndex: 10
|
|
580
|
+
} : isFixedRight ? {
|
|
581
|
+
position: "sticky",
|
|
582
|
+
right: `${ctx.fixedColumnsInfo.rightOffsets[column.key] || 0}px`,
|
|
583
|
+
zIndex: 10
|
|
584
|
+
} : void 0;
|
|
585
|
+
const widthStyle = column.width ? {
|
|
586
|
+
width: typeof column.width === "number" ? `${column.width}px` : column.width
|
|
587
|
+
} : void 0;
|
|
588
|
+
const style = fixedStyle ? { ...widthStyle, ...fixedStyle } : widthStyle;
|
|
589
|
+
const stickyBgClass = striped && index % 2 === 0 ? "bg-[var(--tiger-surface-muted,#f9fafb)]/50" : "bg-[var(--tiger-surface,#ffffff)]";
|
|
590
|
+
const stickyCellClass = isFixedLeft || isFixedRight ? classNames(
|
|
591
|
+
stickyBgClass,
|
|
592
|
+
hoverable && "group-hover:bg-[var(--tiger-surface-muted,#f9fafb)]"
|
|
593
|
+
) : void 0;
|
|
594
|
+
const isEditing = ctx.editingCell?.rowIndex === index && ctx.editingCell?.columnKey === column.key;
|
|
595
|
+
const cellEditable = ctx.isCellEditable(column.key, index);
|
|
596
|
+
return /* @__PURE__ */ jsx(
|
|
597
|
+
"td",
|
|
598
|
+
{
|
|
599
|
+
className: classNames(
|
|
600
|
+
getTableCellClasses(size, column.align || "left", column.className),
|
|
601
|
+
stickyCellClass,
|
|
602
|
+
cellEditable && getEditableCellClasses(!!isEditing)
|
|
603
|
+
),
|
|
604
|
+
style,
|
|
605
|
+
onDoubleClick: cellEditable ? () => ctx.startEditing(index, column.key, cellValue) : void 0,
|
|
606
|
+
children: isEditing ? /* @__PURE__ */ jsx(
|
|
607
|
+
"input",
|
|
608
|
+
{
|
|
609
|
+
className: editableCellInputClasses,
|
|
610
|
+
value: ctx.editingValue,
|
|
611
|
+
onChange: (e) => ctx.setEditingValue(e.target.value),
|
|
612
|
+
onBlur: ctx.commitEdit,
|
|
613
|
+
onKeyDown: (e) => {
|
|
614
|
+
if (e.key === "Enter") ctx.commitEdit();
|
|
615
|
+
if (e.key === "Escape") ctx.cancelEdit();
|
|
616
|
+
},
|
|
617
|
+
autoFocus: true
|
|
618
|
+
}
|
|
619
|
+
) : column.render ? column.render(record, index) : cellValue
|
|
620
|
+
},
|
|
621
|
+
column.key
|
|
622
|
+
);
|
|
623
|
+
}),
|
|
624
|
+
!expandAtStart && expandToggleCell
|
|
625
|
+
]
|
|
626
|
+
},
|
|
627
|
+
key
|
|
628
|
+
);
|
|
629
|
+
if (expandable && isExpanded && isRowExpandable) {
|
|
630
|
+
const expandedContent = expandable.expandedRowRender ? expandable.expandedRowRender(record, index) : null;
|
|
631
|
+
return /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
632
|
+
rowNode,
|
|
633
|
+
/* @__PURE__ */ jsx("tr", { className: getExpandedRowClasses(), children: /* @__PURE__ */ jsx("td", { colSpan: ctx.totalColumnCount, className: getExpandedRowContentClasses(size), children: expandedContent }) }, `${key}-expanded`)
|
|
634
|
+
] }, key);
|
|
635
|
+
}
|
|
636
|
+
return rowNode;
|
|
637
|
+
}
|
|
638
|
+
if (ctx.groupedData) {
|
|
639
|
+
return /* @__PURE__ */ jsx("tbody", { children: Array.from(ctx.groupedData.entries()).map(([groupKey, groupItems]) => /* @__PURE__ */ jsxs(React.Fragment, { children: [
|
|
640
|
+
/* @__PURE__ */ jsx("tr", { className: tableGroupHeaderClasses, children: /* @__PURE__ */ jsxs("td", { colSpan: ctx.totalColumnCount, className: getGroupHeaderCellClasses(size), children: [
|
|
641
|
+
groupKey,
|
|
642
|
+
" (",
|
|
643
|
+
groupItems.length,
|
|
644
|
+
")"
|
|
645
|
+
] }) }),
|
|
646
|
+
groupItems.map((record, idx) => {
|
|
647
|
+
const globalIndex = ctx.paginatedData.indexOf(record);
|
|
648
|
+
return renderDataRow(record, globalIndex >= 0 ? globalIndex : idx);
|
|
649
|
+
})
|
|
650
|
+
] }, `group-${groupKey}`)) });
|
|
651
|
+
}
|
|
652
|
+
return /* @__PURE__ */ jsx("tbody", { children: ctx.paginatedData.map((record, index) => renderDataRow(record, index)) });
|
|
653
|
+
}
|
|
654
|
+
function renderSummaryRow(ctx, view) {
|
|
655
|
+
const { size, rowSelection, expandable, summaryRow } = view;
|
|
656
|
+
if (!summaryRow?.show) return null;
|
|
657
|
+
return /* @__PURE__ */ jsx("tfoot", { children: /* @__PURE__ */ jsxs("tr", { className: tableSummaryRowClasses, children: [
|
|
658
|
+
rowSelection && rowSelection.showCheckbox !== false && /* @__PURE__ */ jsx("td", { className: getTableCellClasses(size, "left") }),
|
|
659
|
+
expandable && /* @__PURE__ */ jsx("td", { className: getTableCellClasses(size, "left") }),
|
|
660
|
+
ctx.displayColumns.map((column) => /* @__PURE__ */ jsx("td", { className: getTableCellClasses(size, column.align || "left"), children: summaryRow.data[column.dataKey || column.key] ?? "" }, column.key))
|
|
661
|
+
] }) });
|
|
662
|
+
}
|
|
663
|
+
function renderPagination(ctx, view) {
|
|
664
|
+
const { pagination } = view;
|
|
665
|
+
if (pagination === false || !ctx.paginationInfo) {
|
|
666
|
+
return null;
|
|
667
|
+
}
|
|
668
|
+
const { totalPages, startIndex, endIndex, hasNext, hasPrev } = ctx.paginationInfo;
|
|
669
|
+
const paginationConfig = pagination;
|
|
670
|
+
const total = paginationConfig.total !== void 0 && paginationConfig.total > 0 ? paginationConfig.total : ctx.processedData.length;
|
|
671
|
+
return /* @__PURE__ */ jsxs("div", { className: getSimplePaginationContainerClasses(), children: [
|
|
672
|
+
paginationConfig.showTotal !== false && /* @__PURE__ */ jsx("div", { className: getSimplePaginationTotalClasses(), children: paginationConfig.totalText ? paginationConfig.totalText(total, [startIndex, endIndex]) : `Showing ${startIndex} to ${endIndex} of ${total} results` }),
|
|
673
|
+
/* @__PURE__ */ jsxs("div", { className: getSimplePaginationControlsClasses(), children: [
|
|
674
|
+
paginationConfig.showSizeChanger !== false && /* @__PURE__ */ jsx(
|
|
675
|
+
"select",
|
|
676
|
+
{
|
|
677
|
+
className: getSimplePaginationSelectClasses(),
|
|
678
|
+
value: ctx.currentPageSize,
|
|
679
|
+
onChange: (e) => ctx.handlePageSizeChange(Number(e.target.value)),
|
|
680
|
+
children: (paginationConfig.pageSizeOptions || [10, 20, 50, 100]).map((size) => /* @__PURE__ */ jsxs("option", { value: size, children: [
|
|
681
|
+
size,
|
|
682
|
+
" / page"
|
|
683
|
+
] }, size))
|
|
684
|
+
}
|
|
685
|
+
),
|
|
686
|
+
/* @__PURE__ */ jsxs("div", { className: getSimplePaginationButtonsWrapperClasses(), children: [
|
|
687
|
+
/* @__PURE__ */ jsx(
|
|
688
|
+
"button",
|
|
689
|
+
{
|
|
690
|
+
className: getSimplePaginationButtonClasses(!hasPrev),
|
|
691
|
+
disabled: !hasPrev,
|
|
692
|
+
onClick: () => ctx.handlePageChange(ctx.currentPage - 1),
|
|
693
|
+
children: "Previous"
|
|
694
|
+
}
|
|
695
|
+
),
|
|
696
|
+
/* @__PURE__ */ jsxs("span", { className: getSimplePaginationPageIndicatorClasses(), children: [
|
|
697
|
+
"Page ",
|
|
698
|
+
ctx.currentPage,
|
|
699
|
+
" of ",
|
|
700
|
+
totalPages
|
|
701
|
+
] }),
|
|
702
|
+
/* @__PURE__ */ jsx(
|
|
703
|
+
"button",
|
|
704
|
+
{
|
|
705
|
+
className: getSimplePaginationButtonClasses(!hasNext),
|
|
706
|
+
disabled: !hasNext,
|
|
707
|
+
onClick: () => ctx.handlePageChange(ctx.currentPage + 1),
|
|
708
|
+
children: "Next"
|
|
709
|
+
}
|
|
710
|
+
)
|
|
711
|
+
] })
|
|
712
|
+
] })
|
|
713
|
+
] });
|
|
714
|
+
}
|
|
715
|
+
function Table({
|
|
716
|
+
columns,
|
|
717
|
+
columnLockable = false,
|
|
718
|
+
dataSource = [],
|
|
719
|
+
sort,
|
|
720
|
+
defaultSort,
|
|
721
|
+
filters,
|
|
722
|
+
defaultFilters,
|
|
723
|
+
size = "md",
|
|
724
|
+
bordered = false,
|
|
725
|
+
striped = false,
|
|
726
|
+
hoverable = true,
|
|
727
|
+
loading = false,
|
|
728
|
+
emptyText = "No data",
|
|
729
|
+
pagination = {
|
|
730
|
+
current: 1,
|
|
731
|
+
pageSize: 10,
|
|
732
|
+
total: 0,
|
|
733
|
+
pageSizeOptions: [10, 20, 50, 100],
|
|
734
|
+
showSizeChanger: true,
|
|
735
|
+
showTotal: true
|
|
736
|
+
},
|
|
737
|
+
rowSelection,
|
|
738
|
+
expandable,
|
|
739
|
+
rowKey = "id",
|
|
740
|
+
rowClassName,
|
|
741
|
+
stickyHeader = false,
|
|
742
|
+
maxHeight,
|
|
743
|
+
tableLayout = "auto",
|
|
744
|
+
// v0.6.0 props
|
|
745
|
+
virtual = false,
|
|
746
|
+
virtualHeight = 400,
|
|
747
|
+
virtualItemHeight: _virtualItemHeight = 40,
|
|
748
|
+
virtualThreshold = 1e3,
|
|
749
|
+
editable = false,
|
|
750
|
+
editableCells,
|
|
751
|
+
filterMode = "basic",
|
|
752
|
+
advancedFilterRules = [],
|
|
753
|
+
columnDraggable = false,
|
|
754
|
+
summaryRow,
|
|
755
|
+
groupBy,
|
|
756
|
+
exportable = false,
|
|
757
|
+
exportFilename = "export",
|
|
758
|
+
onChange,
|
|
759
|
+
onRowClick,
|
|
760
|
+
onSelectionChange,
|
|
761
|
+
onSortChange,
|
|
762
|
+
onFilterChange,
|
|
763
|
+
onPageChange,
|
|
764
|
+
onExpandChange,
|
|
765
|
+
onCellChange,
|
|
766
|
+
onColumnOrderChange,
|
|
767
|
+
onExport,
|
|
768
|
+
className,
|
|
769
|
+
...props
|
|
770
|
+
}) {
|
|
771
|
+
const wrapperRef = useRef(null);
|
|
772
|
+
const tableRef = useRef(null);
|
|
773
|
+
const [measuredColumnWidths, setMeasuredColumnWidths] = useState({});
|
|
774
|
+
const [measuredRowHeights, setMeasuredRowHeights] = useState([]);
|
|
775
|
+
const internalRowSelection = rowSelection;
|
|
776
|
+
const internalExpandable = expandable;
|
|
777
|
+
const internalRowClassName = rowClassName;
|
|
778
|
+
const ctx = useTableState({
|
|
779
|
+
columns,
|
|
780
|
+
dataSource,
|
|
781
|
+
sort,
|
|
782
|
+
defaultSort,
|
|
783
|
+
filters,
|
|
784
|
+
defaultFilters,
|
|
785
|
+
pagination,
|
|
786
|
+
rowSelection: internalRowSelection,
|
|
787
|
+
expandable: internalExpandable,
|
|
788
|
+
rowKey,
|
|
789
|
+
editable,
|
|
790
|
+
editableCells,
|
|
791
|
+
filterMode,
|
|
792
|
+
advancedFilterRules,
|
|
793
|
+
groupBy,
|
|
794
|
+
exportFilename,
|
|
795
|
+
measuredColumnWidths,
|
|
796
|
+
onChange,
|
|
797
|
+
onRowClick,
|
|
798
|
+
onSelectionChange,
|
|
799
|
+
onSortChange,
|
|
800
|
+
onFilterChange,
|
|
801
|
+
onPageChange,
|
|
802
|
+
onExpandChange,
|
|
803
|
+
onCellChange,
|
|
804
|
+
onColumnOrderChange,
|
|
805
|
+
onExport
|
|
806
|
+
});
|
|
807
|
+
const wrapperStyle = useMemo(() => {
|
|
808
|
+
if (virtual) {
|
|
809
|
+
return {
|
|
810
|
+
height: typeof virtualHeight === "number" ? `${virtualHeight}px` : virtualHeight,
|
|
811
|
+
overflow: "auto"
|
|
812
|
+
};
|
|
813
|
+
}
|
|
814
|
+
return maxHeight ? {
|
|
815
|
+
maxHeight: typeof maxHeight === "number" ? `${maxHeight}px` : maxHeight
|
|
816
|
+
} : void 0;
|
|
817
|
+
}, [maxHeight, virtual, virtualHeight]);
|
|
818
|
+
const virtualRecommendation = useMemo(
|
|
819
|
+
() => getTableVirtualRecommendation({
|
|
820
|
+
virtual,
|
|
821
|
+
dataLength: dataSource.length,
|
|
822
|
+
threshold: virtualThreshold
|
|
823
|
+
}),
|
|
824
|
+
[dataSource.length, virtual, virtualThreshold]
|
|
825
|
+
);
|
|
826
|
+
useEffect(() => {
|
|
827
|
+
const wrapper = wrapperRef.current;
|
|
828
|
+
if (!wrapper) {
|
|
829
|
+
return void 0;
|
|
830
|
+
}
|
|
831
|
+
const controller = createTableResizeObserverController({
|
|
832
|
+
onResize: (snapshot) => {
|
|
833
|
+
setMeasuredColumnWidths(
|
|
834
|
+
(prev) => areNumberRecordsEqual(prev, snapshot.columnWidths) ? prev : snapshot.columnWidths
|
|
835
|
+
);
|
|
836
|
+
setMeasuredRowHeights(
|
|
837
|
+
(prev) => areNumberArraysEqual(prev, snapshot.rowHeights) ? prev : snapshot.rowHeights
|
|
838
|
+
);
|
|
839
|
+
}
|
|
840
|
+
});
|
|
841
|
+
controller.observe(wrapper, tableRef.current);
|
|
842
|
+
return () => controller.disconnect();
|
|
843
|
+
}, [ctx.displayColumns.length, ctx.paginatedData.length]);
|
|
844
|
+
return /* @__PURE__ */ jsxs(
|
|
845
|
+
"div",
|
|
846
|
+
{
|
|
847
|
+
ref: wrapperRef,
|
|
848
|
+
className: getTableWrapperClasses(
|
|
849
|
+
bordered,
|
|
850
|
+
maxHeight || (virtual ? virtualHeight : void 0)
|
|
851
|
+
),
|
|
852
|
+
style: wrapperStyle,
|
|
853
|
+
"data-tiger-virtual": virtualRecommendation.enabled ? "enabled" : void 0,
|
|
854
|
+
"data-tiger-virtual-recommended": virtualRecommendation.recommended ? "true" : void 0,
|
|
855
|
+
"data-tiger-virtual-threshold": virtualRecommendation.recommended ? virtualRecommendation.threshold : void 0,
|
|
856
|
+
"data-tiger-measured-row-height": measuredRowHeights[0] || void 0,
|
|
857
|
+
"aria-busy": loading,
|
|
858
|
+
children: [
|
|
859
|
+
exportable && /* @__PURE__ */ jsx("div", { className: "mb-2 flex justify-end", children: /* @__PURE__ */ jsx("button", { type: "button", className: tableExportButtonClasses, onClick: ctx.handleExport, children: "Export CSV" }) }),
|
|
860
|
+
/* @__PURE__ */ jsxs(
|
|
861
|
+
"table",
|
|
862
|
+
{
|
|
863
|
+
ref: tableRef,
|
|
864
|
+
className: classNames(
|
|
865
|
+
tableBaseClasses,
|
|
866
|
+
tableLayout === "fixed" ? "table-fixed" : "table-auto",
|
|
867
|
+
className
|
|
868
|
+
),
|
|
869
|
+
...props,
|
|
870
|
+
style: ctx.fixedColumnsInfo.hasFixedColumns && ctx.fixedColumnsInfo.minTableWidth ? {
|
|
871
|
+
...props.style,
|
|
872
|
+
minWidth: `${ctx.fixedColumnsInfo.minTableWidth}px`
|
|
873
|
+
} : props.style,
|
|
874
|
+
children: [
|
|
875
|
+
renderTableHeader(ctx, {
|
|
876
|
+
size,
|
|
877
|
+
stickyHeader,
|
|
878
|
+
rowSelection: internalRowSelection,
|
|
879
|
+
expandable: internalExpandable,
|
|
880
|
+
columnLockable,
|
|
881
|
+
columnDraggable
|
|
882
|
+
}),
|
|
883
|
+
renderTableBody(ctx, {
|
|
884
|
+
size,
|
|
885
|
+
hoverable,
|
|
886
|
+
striped,
|
|
887
|
+
loading,
|
|
888
|
+
emptyText,
|
|
889
|
+
rowSelection: internalRowSelection,
|
|
890
|
+
expandable: internalExpandable,
|
|
891
|
+
rowClassName: internalRowClassName
|
|
892
|
+
}),
|
|
893
|
+
renderSummaryRow(ctx, {
|
|
894
|
+
size,
|
|
895
|
+
rowSelection: internalRowSelection,
|
|
896
|
+
expandable: internalExpandable,
|
|
897
|
+
summaryRow
|
|
898
|
+
})
|
|
899
|
+
]
|
|
900
|
+
}
|
|
901
|
+
),
|
|
902
|
+
loading && /* @__PURE__ */ jsxs(
|
|
903
|
+
"div",
|
|
904
|
+
{
|
|
905
|
+
className: tableLoadingOverlayClasses,
|
|
906
|
+
role: "status",
|
|
907
|
+
"aria-live": "polite",
|
|
908
|
+
"aria-label": "Loading",
|
|
909
|
+
children: [
|
|
910
|
+
/* @__PURE__ */ jsx(LoadingSpinner, {}),
|
|
911
|
+
/* @__PURE__ */ jsx("span", { className: "sr-only", children: "Loading" })
|
|
912
|
+
]
|
|
913
|
+
}
|
|
914
|
+
),
|
|
915
|
+
renderPagination(ctx, { pagination })
|
|
916
|
+
]
|
|
917
|
+
}
|
|
918
|
+
);
|
|
919
|
+
}
|
|
920
|
+
function areNumberRecordsEqual(current, next) {
|
|
921
|
+
const currentKeys = Object.keys(current);
|
|
922
|
+
const nextKeys = Object.keys(next);
|
|
923
|
+
return currentKeys.length === nextKeys.length && nextKeys.every((key) => current[key] === next[key]);
|
|
924
|
+
}
|
|
925
|
+
function areNumberArraysEqual(current, next) {
|
|
926
|
+
return current.length === next.length && next.every((value, index) => current[index] === value);
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
export { Table };
|