@duskmoon-dev/components 0.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -0
- package/dist/chunk-r9wkv7xd.js +29 -0
- package/dist/classes/affix.d.ts +6 -0
- package/dist/classes/alert.d.ts +9 -0
- package/dist/classes/anchor.d.ts +19 -0
- package/dist/classes/app.d.ts +9 -0
- package/dist/classes/auto-complete.d.ts +34 -0
- package/dist/classes/avatar.d.ts +9 -0
- package/dist/classes/back-top.d.ts +6 -0
- package/dist/classes/badge.d.ts +11 -0
- package/dist/classes/breadcrumb.d.ts +23 -0
- package/dist/classes/button.d.ts +17 -0
- package/dist/classes/calendar.d.ts +25 -0
- package/dist/classes/card.d.ts +9 -0
- package/dist/classes/carousel.d.ts +25 -0
- package/dist/classes/cascader.d.ts +42 -0
- package/dist/classes/checkbox.d.ts +23 -0
- package/dist/classes/col.d.ts +4 -0
- package/dist/classes/collapse.d.ts +23 -0
- package/dist/classes/color-picker.d.ts +21 -0
- package/dist/classes/config-provider.d.ts +7 -0
- package/dist/classes/date-picker.d.ts +27 -0
- package/dist/classes/descriptions.d.ts +18 -0
- package/dist/classes/divider.d.ts +15 -0
- package/dist/classes/dm-auxiliary.d.ts +11 -0
- package/dist/classes/dm-breadcrumb.d.ts +9 -0
- package/dist/classes/dm-date-picker.d.ts +4 -0
- package/dist/classes/dm-drawer.d.ts +9 -0
- package/dist/classes/dm-infinite-scroll.d.ts +9 -0
- package/dist/classes/dm-layout.d.ts +11 -0
- package/dist/classes/dm-menu.d.ts +13 -0
- package/dist/classes/dm-message.d.ts +6 -0
- package/dist/classes/dm-page-header.d.ts +15 -0
- package/dist/classes/dm-pagination.d.ts +17 -0
- package/dist/classes/dm-pro-table-inner.d.ts +1 -0
- package/dist/classes/dm-pro-table.d.ts +8 -0
- package/dist/classes/dm-provider.d.ts +4 -0
- package/dist/classes/dm-query.d.ts +1 -0
- package/dist/classes/dm-search.d.ts +12 -0
- package/dist/classes/dm-splitter.d.ts +11 -0
- package/dist/classes/dm-status.d.ts +10 -0
- package/dist/classes/dm-table.d.ts +13 -0
- package/dist/classes/dm-tabs.d.ts +17 -0
- package/dist/classes/dm-toolbar.d.ts +12 -0
- package/dist/classes/dm-tree.d.ts +27 -0
- package/dist/classes/dm-truncate.d.ts +14 -0
- package/dist/classes/drawer.d.ts +16 -0
- package/dist/classes/dropdown.d.ts +14 -0
- package/dist/classes/empty.d.ts +7 -0
- package/dist/classes/flex.d.ts +8 -0
- package/dist/classes/float-button.d.ts +27 -0
- package/dist/classes/form.d.ts +20 -0
- package/dist/classes/grid.d.ts +9 -0
- package/dist/classes/image.d.ts +16 -0
- package/dist/classes/index.d.ts +93 -0
- package/dist/classes/index.js +3556 -0
- package/dist/classes/input-number.d.ts +14 -0
- package/dist/classes/input.d.ts +51 -0
- package/dist/classes/layout.d.ts +16 -0
- package/dist/classes/list.d.ts +22 -0
- package/dist/classes/mentions.d.ts +27 -0
- package/dist/classes/menu.d.ts +33 -0
- package/dist/classes/message.d.ts +16 -0
- package/dist/classes/modal.d.ts +17 -0
- package/dist/classes/notification.d.ts +22 -0
- package/dist/classes/pagination.d.ts +23 -0
- package/dist/classes/popconfirm.d.ts +19 -0
- package/dist/classes/popover.d.ts +13 -0
- package/dist/classes/progress.d.ts +11 -0
- package/dist/classes/qr-code.d.ts +19 -0
- package/dist/classes/radio.d.ts +23 -0
- package/dist/classes/rate.d.ts +23 -0
- package/dist/classes/result.d.ts +15 -0
- package/dist/classes/row.d.ts +11 -0
- package/dist/classes/segmented.d.ts +19 -0
- package/dist/classes/select.d.ts +39 -0
- package/dist/classes/skeleton.d.ts +16 -0
- package/dist/classes/slider.d.ts +30 -0
- package/dist/classes/space.d.ts +18 -0
- package/dist/classes/spin.d.ts +16 -0
- package/dist/classes/splitter.d.ts +19 -0
- package/dist/classes/statistic.d.ts +9 -0
- package/dist/classes/steps.d.ts +36 -0
- package/dist/classes/switch.d.ts +16 -0
- package/dist/classes/table.d.ts +36 -0
- package/dist/classes/tabs.d.ts +42 -0
- package/dist/classes/tag.d.ts +20 -0
- package/dist/classes/time-picker.d.ts +24 -0
- package/dist/classes/timeline.d.ts +20 -0
- package/dist/classes/tooltip.d.ts +15 -0
- package/dist/classes/tour.d.ts +34 -0
- package/dist/classes/transfer.d.ts +30 -0
- package/dist/classes/tree-select.d.ts +39 -0
- package/dist/classes/tree.d.ts +34 -0
- package/dist/classes/typography.d.ts +48 -0
- package/dist/classes/upload.d.ts +31 -0
- package/dist/classes/watermark.d.ts +5 -0
- package/dist/components/affix/Affix.d.ts +3 -0
- package/dist/components/affix/Affix.types.d.ts +8 -0
- package/dist/components/affix/index.d.ts +2 -0
- package/dist/components/affix/index.js +103 -0
- package/dist/components/alert/Alert.d.ts +3 -0
- package/dist/components/alert/Alert.types.d.ts +7 -0
- package/dist/components/alert/index.d.ts +2 -0
- package/dist/components/alert/index.js +65 -0
- package/dist/components/anchor/Anchor.d.ts +4 -0
- package/dist/components/anchor/Anchor.types.d.ts +34 -0
- package/dist/components/anchor/index.d.ts +2 -0
- package/dist/components/anchor/index.js +240 -0
- package/dist/components/app/App.d.ts +5 -0
- package/dist/components/app/App.types.d.ts +27 -0
- package/dist/components/app/index.d.ts +2 -0
- package/dist/components/app/index.js +890 -0
- package/dist/components/auto-complete/AutoComplete.d.ts +2 -0
- package/dist/components/auto-complete/AutoComplete.types.d.ts +34 -0
- package/dist/components/auto-complete/index.d.ts +2 -0
- package/dist/components/auto-complete/index.js +339 -0
- package/dist/components/avatar/Avatar.d.ts +3 -0
- package/dist/components/avatar/Avatar.types.d.ts +10 -0
- package/dist/components/avatar/index.d.ts +2 -0
- package/dist/components/avatar/index.js +81 -0
- package/dist/components/back-top/BackTop.d.ts +3 -0
- package/dist/components/back-top/BackTop.types.d.ts +6 -0
- package/dist/components/back-top/index.d.ts +2 -0
- package/dist/components/back-top/index.js +108 -0
- package/dist/components/badge/Badge.d.ts +3 -0
- package/dist/components/badge/Badge.types.d.ts +9 -0
- package/dist/components/badge/index.d.ts +2 -0
- package/dist/components/badge/index.js +84 -0
- package/dist/components/breadcrumb/Breadcrumb.d.ts +2 -0
- package/dist/components/breadcrumb/Breadcrumb.types.d.ts +53 -0
- package/dist/components/breadcrumb/index.d.ts +2 -0
- package/dist/components/breadcrumb/index.js +313 -0
- package/dist/components/button/Button.d.ts +3 -0
- package/dist/components/button/Button.types.d.ts +15 -0
- package/dist/components/button/index.d.ts +2 -0
- package/dist/components/button/index.js +125 -0
- package/dist/components/calendar/Calendar.d.ts +2 -0
- package/dist/components/calendar/Calendar.types.d.ts +39 -0
- package/dist/components/calendar/index.d.ts +2 -0
- package/dist/components/calendar/index.js +352 -0
- package/dist/components/card/Card.d.ts +3 -0
- package/dist/components/card/Card.types.d.ts +7 -0
- package/dist/components/card/index.d.ts +2 -0
- package/dist/components/card/index.js +73 -0
- package/dist/components/carousel/Carousel.d.ts +2 -0
- package/dist/components/carousel/Carousel.types.d.ts +26 -0
- package/dist/components/carousel/index.d.ts +2 -0
- package/dist/components/carousel/index.js +193 -0
- package/dist/components/cascader/Cascader.d.ts +2 -0
- package/dist/components/cascader/Cascader.types.d.ts +63 -0
- package/dist/components/cascader/index.d.ts +2 -0
- package/dist/components/cascader/index.js +509 -0
- package/dist/components/checkbox/Checkbox.d.ts +3 -0
- package/dist/components/checkbox/Checkbox.types.d.ts +15 -0
- package/dist/components/checkbox/index.d.ts +2 -0
- package/dist/components/checkbox/index.js +134 -0
- package/dist/components/col/Col.d.ts +3 -0
- package/dist/components/col/Col.types.d.ts +24 -0
- package/dist/components/col/index.d.ts +2 -0
- package/dist/components/col/index.js +100 -0
- package/dist/components/collapse/Collapse.d.ts +3 -0
- package/dist/components/collapse/Collapse.types.d.ts +21 -0
- package/dist/components/collapse/index.d.ts +2 -0
- package/dist/components/collapse/index.js +148 -0
- package/dist/components/color-picker/ColorPicker.d.ts +2 -0
- package/dist/components/color-picker/ColorPicker.types.d.ts +39 -0
- package/dist/components/color-picker/index.d.ts +2 -0
- package/dist/components/color-picker/index.js +282 -0
- package/dist/components/config-provider/ConfigProvider.d.ts +4 -0
- package/dist/components/config-provider/ConfigProvider.types.d.ts +39 -0
- package/dist/components/config-provider/index.d.ts +2 -0
- package/dist/components/config-provider/index.js +127 -0
- package/dist/components/date-picker/DatePicker.d.ts +2 -0
- package/dist/components/date-picker/DatePicker.types.d.ts +46 -0
- package/dist/components/date-picker/index.d.ts +2 -0
- package/dist/components/date-picker/index.js +319 -0
- package/dist/components/descriptions/Descriptions.d.ts +2 -0
- package/dist/components/descriptions/Descriptions.types.d.ts +39 -0
- package/dist/components/descriptions/index.d.ts +2 -0
- package/dist/components/descriptions/index.js +196 -0
- package/dist/components/divider/Divider.d.ts +3 -0
- package/dist/components/divider/Divider.types.d.ts +14 -0
- package/dist/components/divider/index.d.ts +2 -0
- package/dist/components/divider/index.js +108 -0
- package/dist/components/dm-auxiliary/DmAuxiliary.d.ts +4 -0
- package/dist/components/dm-auxiliary/DmAuxiliary.types.d.ts +15 -0
- package/dist/components/dm-auxiliary/index.d.ts +2 -0
- package/dist/components/dm-auxiliary/index.js +127 -0
- package/dist/components/dm-breadcrumb/DmBreadcrumb.d.ts +3 -0
- package/dist/components/dm-breadcrumb/DmBreadcrumb.types.d.ts +25 -0
- package/dist/components/dm-breadcrumb/index.d.ts +2 -0
- package/dist/components/dm-breadcrumb/index.js +460 -0
- package/dist/components/dm-date-picker/DmDatePicker.d.ts +4 -0
- package/dist/components/dm-date-picker/DmDatePicker.types.d.ts +11 -0
- package/dist/components/dm-date-picker/index.d.ts +2 -0
- package/dist/components/dm-date-picker/index.js +460 -0
- package/dist/components/dm-drawer/DmDrawer.d.ts +3 -0
- package/dist/components/dm-drawer/DmDrawer.types.d.ts +16 -0
- package/dist/components/dm-drawer/index.d.ts +2 -0
- package/dist/components/dm-drawer/index.js +309 -0
- package/dist/components/dm-infinite-scroll/DmInfiniteScroll.d.ts +3 -0
- package/dist/components/dm-infinite-scroll/DmInfiniteScroll.types.d.ts +18 -0
- package/dist/components/dm-infinite-scroll/index.d.ts +2 -0
- package/dist/components/dm-infinite-scroll/index.js +153 -0
- package/dist/components/dm-layout/DmLayout.d.ts +4 -0
- package/dist/components/dm-layout/DmLayout.types.d.ts +31 -0
- package/dist/components/dm-layout/index.d.ts +2 -0
- package/dist/components/dm-layout/index.js +1186 -0
- package/dist/components/dm-menu/DmMenu.d.ts +5 -0
- package/dist/components/dm-menu/DmMenu.types.d.ts +44 -0
- package/dist/components/dm-menu/index.d.ts +2 -0
- package/dist/components/dm-menu/index.js +444 -0
- package/dist/components/dm-message/DmMessage.d.ts +16 -0
- package/dist/components/dm-message/DmMessage.types.d.ts +24 -0
- package/dist/components/dm-message/index.d.ts +2 -0
- package/dist/components/dm-message/index.js +280 -0
- package/dist/components/dm-page-header/DmPageHeader.d.ts +6 -0
- package/dist/components/dm-page-header/DmPageHeader.types.d.ts +19 -0
- package/dist/components/dm-page-header/index.d.ts +2 -0
- package/dist/components/dm-page-header/index.js +925 -0
- package/dist/components/dm-pagination/DmPagination.d.ts +3 -0
- package/dist/components/dm-pagination/DmPagination.types.d.ts +22 -0
- package/dist/components/dm-pagination/index.d.ts +2 -0
- package/dist/components/dm-pagination/index.js +469 -0
- package/dist/components/dm-pro-table/DmProTable.d.ts +7 -0
- package/dist/components/dm-pro-table/DmProTable.types.d.ts +15 -0
- package/dist/components/dm-pro-table/index.d.ts +2 -0
- package/dist/components/dm-pro-table/index.js +3076 -0
- package/dist/components/dm-pro-table-inner/DmProTableInner.d.ts +7 -0
- package/dist/components/dm-pro-table-inner/DmProTableInner.types.d.ts +5 -0
- package/dist/components/dm-pro-table-inner/index.d.ts +2 -0
- package/dist/components/dm-pro-table-inner/index.js +2620 -0
- package/dist/components/dm-provider/DmProvider.d.ts +3 -0
- package/dist/components/dm-provider/DmProvider.types.d.ts +11 -0
- package/dist/components/dm-provider/index.d.ts +2 -0
- package/dist/components/dm-provider/index.js +255 -0
- package/dist/components/dm-query/DmQuery.d.ts +3 -0
- package/dist/components/dm-query/DmQuery.types.d.ts +20 -0
- package/dist/components/dm-query/index.d.ts +2 -0
- package/dist/components/dm-query/index.js +1319 -0
- package/dist/components/dm-search/DmSearch.d.ts +3 -0
- package/dist/components/dm-search/DmSearch.types.d.ts +38 -0
- package/dist/components/dm-search/index.d.ts +2 -0
- package/dist/components/dm-search/index.js +1264 -0
- package/dist/components/dm-splitter/DmSplitter.d.ts +3 -0
- package/dist/components/dm-splitter/DmSplitter.types.d.ts +32 -0
- package/dist/components/dm-splitter/index.d.ts +2 -0
- package/dist/components/dm-splitter/index.js +406 -0
- package/dist/components/dm-status/DmStatus.d.ts +4 -0
- package/dist/components/dm-status/DmStatus.types.d.ts +12 -0
- package/dist/components/dm-status/index.d.ts +2 -0
- package/dist/components/dm-status/index.js +369 -0
- package/dist/components/dm-table/DmTable.d.ts +8 -0
- package/dist/components/dm-table/DmTable.types.d.ts +28 -0
- package/dist/components/dm-table/index.d.ts +2 -0
- package/dist/components/dm-table/index.js +2607 -0
- package/dist/components/dm-tabs/DmTabs.d.ts +3 -0
- package/dist/components/dm-tabs/DmTabs.types.d.ts +10 -0
- package/dist/components/dm-tabs/index.d.ts +2 -0
- package/dist/components/dm-tabs/index.js +415 -0
- package/dist/components/dm-toolbar/DmToolbar.d.ts +6 -0
- package/dist/components/dm-toolbar/DmToolbar.types.d.ts +18 -0
- package/dist/components/dm-toolbar/index.d.ts +2 -0
- package/dist/components/dm-toolbar/index.js +520 -0
- package/dist/components/dm-tree/DmTree.d.ts +3 -0
- package/dist/components/dm-tree/DmTree.types.d.ts +70 -0
- package/dist/components/dm-tree/index.d.ts +2 -0
- package/dist/components/dm-tree/index.js +1852 -0
- package/dist/components/dm-truncate/DmTruncate.d.ts +3 -0
- package/dist/components/dm-truncate/DmTruncate.types.d.ts +17 -0
- package/dist/components/dm-truncate/index.d.ts +2 -0
- package/dist/components/dm-truncate/index.js +375 -0
- package/dist/components/drawer/Drawer.d.ts +3 -0
- package/dist/components/drawer/Drawer.types.d.ts +18 -0
- package/dist/components/drawer/index.d.ts +2 -0
- package/dist/components/drawer/index.js +132 -0
- package/dist/components/dropdown/Dropdown.d.ts +2 -0
- package/dist/components/dropdown/Dropdown.types.d.ts +44 -0
- package/dist/components/dropdown/index.d.ts +2 -0
- package/dist/components/dropdown/index.js +411 -0
- package/dist/components/empty/Empty.d.ts +2 -0
- package/dist/components/empty/Empty.types.d.ts +11 -0
- package/dist/components/empty/index.d.ts +2 -0
- package/dist/components/empty/index.js +116 -0
- package/dist/components/flex/Flex.d.ts +3 -0
- package/dist/components/flex/Flex.types.d.ts +13 -0
- package/dist/components/flex/index.d.ts +2 -0
- package/dist/components/flex/index.js +107 -0
- package/dist/components/float-button/FloatButton.d.ts +2 -0
- package/dist/components/float-button/FloatButton.types.d.ts +44 -0
- package/dist/components/float-button/index.d.ts +2 -0
- package/dist/components/float-button/index.js +308 -0
- package/dist/components/form/Form.d.ts +4 -0
- package/dist/components/form/Form.types.d.ts +107 -0
- package/dist/components/form/index.d.ts +2 -0
- package/dist/components/form/index.js +449 -0
- package/dist/components/grid/Grid.d.ts +8 -0
- package/dist/components/grid/Grid.types.d.ts +5 -0
- package/dist/components/grid/index.d.ts +2 -0
- package/dist/components/grid/index.js +104 -0
- package/dist/components/image/Image.d.ts +2 -0
- package/dist/components/image/Image.types.d.ts +25 -0
- package/dist/components/image/index.d.ts +2 -0
- package/dist/components/image/index.js +171 -0
- package/dist/components/input/Input.d.ts +8 -0
- package/dist/components/input/Input.types.d.ts +46 -0
- package/dist/components/input/index.d.ts +2 -0
- package/dist/components/input/index.js +352 -0
- package/dist/components/input-number/InputNumber.d.ts +3 -0
- package/dist/components/input-number/InputNumber.types.d.ts +23 -0
- package/dist/components/input-number/index.d.ts +2 -0
- package/dist/components/input-number/index.js +175 -0
- package/dist/components/layout/Layout.d.ts +2 -0
- package/dist/components/layout/Layout.types.d.ts +23 -0
- package/dist/components/layout/index.d.ts +2 -0
- package/dist/components/layout/index.js +142 -0
- package/dist/components/list/List.d.ts +2 -0
- package/dist/components/list/List.types.d.ts +27 -0
- package/dist/components/list/index.d.ts +2 -0
- package/dist/components/list/index.js +175 -0
- package/dist/components/mentions/Mentions.d.ts +2 -0
- package/dist/components/mentions/Mentions.types.d.ts +30 -0
- package/dist/components/mentions/index.d.ts +2 -0
- package/dist/components/mentions/index.js +321 -0
- package/dist/components/menu/Menu.d.ts +2 -0
- package/dist/components/menu/Menu.types.d.ts +58 -0
- package/dist/components/menu/index.d.ts +2 -0
- package/dist/components/menu/index.js +317 -0
- package/dist/components/message/Message.d.ts +6 -0
- package/dist/components/message/Message.types.d.ts +45 -0
- package/dist/components/message/index.d.ts +2 -0
- package/dist/components/message/index.js +205 -0
- package/dist/components/modal/Modal.d.ts +2 -0
- package/dist/components/modal/Modal.types.d.ts +43 -0
- package/dist/components/modal/index.d.ts +2 -0
- package/dist/components/modal/index.js +214 -0
- package/dist/components/notification/Notification.d.ts +4 -0
- package/dist/components/notification/Notification.types.d.ts +43 -0
- package/dist/components/notification/index.d.ts +2 -0
- package/dist/components/notification/index.js +420 -0
- package/dist/components/pagination/Pagination.d.ts +3 -0
- package/dist/components/pagination/Pagination.types.d.ts +17 -0
- package/dist/components/pagination/index.d.ts +2 -0
- package/dist/components/pagination/index.js +281 -0
- package/dist/components/popconfirm/Popconfirm.d.ts +3 -0
- package/dist/components/popconfirm/Popconfirm.types.d.ts +26 -0
- package/dist/components/popconfirm/index.d.ts +2 -0
- package/dist/components/popconfirm/index.js +364 -0
- package/dist/components/popover/Popover.d.ts +3 -0
- package/dist/components/popover/Popover.types.d.ts +15 -0
- package/dist/components/popover/index.d.ts +2 -0
- package/dist/components/popover/index.js +219 -0
- package/dist/components/progress/Progress.d.ts +3 -0
- package/dist/components/progress/Progress.types.d.ts +11 -0
- package/dist/components/progress/index.d.ts +2 -0
- package/dist/components/progress/index.js +106 -0
- package/dist/components/qr-code/QRCode.d.ts +3 -0
- package/dist/components/qr-code/QRCode.types.d.ts +17 -0
- package/dist/components/qr-code/index.d.ts +2 -0
- package/dist/components/qr-code/index.js +224 -0
- package/dist/components/radio/Radio.d.ts +3 -0
- package/dist/components/radio/Radio.types.d.ts +14 -0
- package/dist/components/radio/index.d.ts +2 -0
- package/dist/components/radio/index.js +118 -0
- package/dist/components/rate/Rate.d.ts +3 -0
- package/dist/components/rate/Rate.types.d.ts +23 -0
- package/dist/components/rate/index.d.ts +2 -0
- package/dist/components/rate/index.js +202 -0
- package/dist/components/result/Result.d.ts +3 -0
- package/dist/components/result/Result.types.d.ts +10 -0
- package/dist/components/result/index.d.ts +2 -0
- package/dist/components/result/index.js +205 -0
- package/dist/components/row/Row.d.ts +3 -0
- package/dist/components/row/Row.types.d.ts +11 -0
- package/dist/components/row/index.d.ts +2 -0
- package/dist/components/row/index.js +109 -0
- package/dist/components/segmented/Segmented.d.ts +3 -0
- package/dist/components/segmented/Segmented.types.d.ts +20 -0
- package/dist/components/segmented/index.d.ts +2 -0
- package/dist/components/segmented/index.js +130 -0
- package/dist/components/select/Select.d.ts +2 -0
- package/dist/components/select/Select.types.d.ts +47 -0
- package/dist/components/select/index.d.ts +2 -0
- package/dist/components/select/index.js +361 -0
- package/dist/components/skeleton/Skeleton.d.ts +15 -0
- package/dist/components/skeleton/Skeleton.types.d.ts +35 -0
- package/dist/components/skeleton/index.d.ts +2 -0
- package/dist/components/skeleton/index.js +238 -0
- package/dist/components/slider/Slider.d.ts +3 -0
- package/dist/components/slider/Slider.types.d.ts +38 -0
- package/dist/components/slider/index.d.ts +2 -0
- package/dist/components/slider/index.js +425 -0
- package/dist/components/space/Space.d.ts +2 -0
- package/dist/components/space/Space.types.d.ts +19 -0
- package/dist/components/space/index.d.ts +2 -0
- package/dist/components/space/index.js +144 -0
- package/dist/components/spin/Spin.d.ts +2 -0
- package/dist/components/spin/Spin.types.d.ts +15 -0
- package/dist/components/spin/index.d.ts +2 -0
- package/dist/components/spin/index.js +138 -0
- package/dist/components/splitter/Splitter.d.ts +2 -0
- package/dist/components/splitter/Splitter.types.d.ts +29 -0
- package/dist/components/splitter/index.d.ts +2 -0
- package/dist/components/splitter/index.js +227 -0
- package/dist/components/statistic/Statistic.d.ts +2 -0
- package/dist/components/statistic/Statistic.types.d.ts +22 -0
- package/dist/components/statistic/index.d.ts +2 -0
- package/dist/components/statistic/index.js +150 -0
- package/dist/components/steps/Steps.d.ts +4 -0
- package/dist/components/steps/Steps.types.d.ts +49 -0
- package/dist/components/steps/index.d.ts +2 -0
- package/dist/components/steps/index.js +311 -0
- package/dist/components/switch/Switch.d.ts +2 -0
- package/dist/components/switch/Switch.types.d.ts +16 -0
- package/dist/components/switch/index.d.ts +2 -0
- package/dist/components/switch/index.js +120 -0
- package/dist/components/table/Table.d.ts +2 -0
- package/dist/components/table/Table.types.d.ts +142 -0
- package/dist/components/table/index.d.ts +2 -0
- package/dist/components/table/index.js +721 -0
- package/dist/components/tabs/Tabs.d.ts +10 -0
- package/dist/components/tabs/Tabs.types.d.ts +48 -0
- package/dist/components/tabs/index.d.ts +2 -0
- package/dist/components/tabs/index.js +359 -0
- package/dist/components/tag/Tag.d.ts +5 -0
- package/dist/components/tag/Tag.types.d.ts +20 -0
- package/dist/components/tag/index.d.ts +2 -0
- package/dist/components/tag/index.js +151 -0
- package/dist/components/time-picker/TimePicker.d.ts +2 -0
- package/dist/components/time-picker/TimePicker.types.d.ts +43 -0
- package/dist/components/time-picker/index.d.ts +2 -0
- package/dist/components/time-picker/index.js +323 -0
- package/dist/components/timeline/Timeline.d.ts +3 -0
- package/dist/components/timeline/Timeline.types.d.ts +20 -0
- package/dist/components/timeline/index.d.ts +2 -0
- package/dist/components/timeline/index.js +130 -0
- package/dist/components/tooltip/Tooltip.d.ts +3 -0
- package/dist/components/tooltip/Tooltip.types.d.ts +12 -0
- package/dist/components/tooltip/index.d.ts +2 -0
- package/dist/components/tooltip/index.js +133 -0
- package/dist/components/tour/Tour.d.ts +3 -0
- package/dist/components/tour/Tour.types.d.ts +50 -0
- package/dist/components/tour/index.d.ts +2 -0
- package/dist/components/tour/index.js +507 -0
- package/dist/components/transfer/Transfer.d.ts +5 -0
- package/dist/components/transfer/Transfer.types.d.ts +88 -0
- package/dist/components/transfer/index.d.ts +2 -0
- package/dist/components/transfer/index.js +456 -0
- package/dist/components/tree/Tree.d.ts +2 -0
- package/dist/components/tree/Tree.types.d.ts +92 -0
- package/dist/components/tree/index.d.ts +2 -0
- package/dist/components/tree/index.js +439 -0
- package/dist/components/tree-select/TreeSelect.d.ts +2 -0
- package/dist/components/tree-select/TreeSelect.types.d.ts +70 -0
- package/dist/components/tree-select/index.d.ts +2 -0
- package/dist/components/tree-select/index.js +488 -0
- package/dist/components/typography/Typography.d.ts +8 -0
- package/dist/components/typography/Typography.types.d.ts +81 -0
- package/dist/components/typography/index.d.ts +2 -0
- package/dist/components/typography/index.js +689 -0
- package/dist/components/upload/Upload.d.ts +2 -0
- package/dist/components/upload/Upload.types.d.ts +55 -0
- package/dist/components/upload/index.d.ts +2 -0
- package/dist/components/upload/index.js +388 -0
- package/dist/components/watermark/Watermark.d.ts +3 -0
- package/dist/components/watermark/Watermark.types.d.ts +20 -0
- package/dist/components/watermark/index.d.ts +2 -0
- package/dist/components/watermark/index.js +109 -0
- package/dist/index.d.ts +100 -0
- package/dist/index.js +18027 -0
- package/dist/infrastructure.d.ts +124 -0
- package/dist/infrastructure.js +141 -0
- package/dist/styles.css +19312 -0
- package/dist/theme/ThemeProvider.d.ts +16 -0
- package/dist/theme/index.d.ts +2 -0
- package/dist/theme/index.js +83 -0
- package/dist/theme/theme-script.d.ts +8 -0
- package/dist/utils/cn.d.ts +13 -0
- package/dist/utils/index.d.ts +1 -0
- package/dist/utils/index.js +8 -0
- package/package.json +444 -0
|
@@ -0,0 +1,2607 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
4
|
+
function r(e) {
|
|
5
|
+
var t, f, n = "";
|
|
6
|
+
if (typeof e == "string" || typeof e == "number")
|
|
7
|
+
n += e;
|
|
8
|
+
else if (typeof e == "object")
|
|
9
|
+
if (Array.isArray(e)) {
|
|
10
|
+
var o = e.length;
|
|
11
|
+
for (t = 0;t < o; t++)
|
|
12
|
+
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
13
|
+
} else
|
|
14
|
+
for (f in e)
|
|
15
|
+
e[f] && (n && (n += " "), n += f);
|
|
16
|
+
return n;
|
|
17
|
+
}
|
|
18
|
+
function clsx() {
|
|
19
|
+
for (var e, t, f = 0, n = "", o = arguments.length;f < o; f++)
|
|
20
|
+
(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
21
|
+
return n;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// src/utils/cn.ts
|
|
25
|
+
function cn(...inputs) {
|
|
26
|
+
return clsx(inputs);
|
|
27
|
+
}
|
|
28
|
+
// src/classes/button.ts
|
|
29
|
+
var buttonBaseClass = "btn";
|
|
30
|
+
var buttonColorClasses = {
|
|
31
|
+
primary: "btn-primary",
|
|
32
|
+
secondary: "btn-secondary",
|
|
33
|
+
tertiary: "btn-tertiary",
|
|
34
|
+
info: "btn-info",
|
|
35
|
+
success: "btn-success",
|
|
36
|
+
warning: "btn-warning",
|
|
37
|
+
error: "btn-error"
|
|
38
|
+
};
|
|
39
|
+
var buttonAppearanceClasses = {
|
|
40
|
+
filled: "",
|
|
41
|
+
outline: "btn-outline",
|
|
42
|
+
tonal: "btn-tonal",
|
|
43
|
+
ghost: "btn-ghost",
|
|
44
|
+
text: "btn-text"
|
|
45
|
+
};
|
|
46
|
+
var buttonShapeClasses = {
|
|
47
|
+
rect: "",
|
|
48
|
+
circle: "btn-circle",
|
|
49
|
+
square: "btn-square"
|
|
50
|
+
};
|
|
51
|
+
var buttonSizeClasses = {
|
|
52
|
+
xs: "btn-xs",
|
|
53
|
+
sm: "btn-sm",
|
|
54
|
+
md: "btn-md",
|
|
55
|
+
lg: "btn-lg"
|
|
56
|
+
};
|
|
57
|
+
var buttonBlockClass = "btn-block";
|
|
58
|
+
var buttonIsLoadingClass = "btn-loading";
|
|
59
|
+
function getButtonClasses({
|
|
60
|
+
color = "primary",
|
|
61
|
+
appearance = "filled",
|
|
62
|
+
shape = "rect",
|
|
63
|
+
size = "md",
|
|
64
|
+
block,
|
|
65
|
+
isLoading,
|
|
66
|
+
className
|
|
67
|
+
}) {
|
|
68
|
+
return cn(buttonBaseClass, buttonColorClasses[color], buttonAppearanceClasses[appearance], buttonShapeClasses[shape], buttonSizeClasses[size], block && buttonBlockClass, isLoading && buttonIsLoadingClass, className);
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// src/components/button/Button.tsx
|
|
72
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
73
|
+
function Button({
|
|
74
|
+
color = "primary",
|
|
75
|
+
appearance = "filled",
|
|
76
|
+
shape = "rect",
|
|
77
|
+
size = "md",
|
|
78
|
+
block,
|
|
79
|
+
isLoading,
|
|
80
|
+
leftIcon,
|
|
81
|
+
rightIcon,
|
|
82
|
+
className,
|
|
83
|
+
children,
|
|
84
|
+
disabled,
|
|
85
|
+
ref,
|
|
86
|
+
...props
|
|
87
|
+
}) {
|
|
88
|
+
const classes = getButtonClasses({
|
|
89
|
+
color,
|
|
90
|
+
appearance,
|
|
91
|
+
shape,
|
|
92
|
+
size,
|
|
93
|
+
block,
|
|
94
|
+
isLoading,
|
|
95
|
+
className
|
|
96
|
+
});
|
|
97
|
+
return /* @__PURE__ */ jsxs("button", {
|
|
98
|
+
ref,
|
|
99
|
+
className: classes,
|
|
100
|
+
disabled: disabled || isLoading,
|
|
101
|
+
"aria-busy": isLoading,
|
|
102
|
+
"aria-disabled": disabled || isLoading,
|
|
103
|
+
...props,
|
|
104
|
+
children: [
|
|
105
|
+
isLoading && /* @__PURE__ */ jsx("span", {
|
|
106
|
+
className: "btn-spinner"
|
|
107
|
+
}),
|
|
108
|
+
!isLoading && leftIcon && /* @__PURE__ */ jsx("span", {
|
|
109
|
+
className: "btn-icon-left",
|
|
110
|
+
children: leftIcon
|
|
111
|
+
}),
|
|
112
|
+
/* @__PURE__ */ jsx("span", {
|
|
113
|
+
className: "btn-content",
|
|
114
|
+
children
|
|
115
|
+
}),
|
|
116
|
+
!isLoading && rightIcon && /* @__PURE__ */ jsx("span", {
|
|
117
|
+
className: "btn-icon-right",
|
|
118
|
+
children: rightIcon
|
|
119
|
+
})
|
|
120
|
+
]
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// src/classes/card.ts
|
|
124
|
+
var cardBaseClass = "card";
|
|
125
|
+
var cardAppearanceClasses = {
|
|
126
|
+
elevated: "card-elevated",
|
|
127
|
+
outline: "card-outline",
|
|
128
|
+
filled: "card-filled"
|
|
129
|
+
};
|
|
130
|
+
var cardPaddingClasses = {
|
|
131
|
+
none: "card-padding-none",
|
|
132
|
+
sm: "card-padding-sm",
|
|
133
|
+
md: "card-padding-md",
|
|
134
|
+
lg: "card-padding-lg"
|
|
135
|
+
};
|
|
136
|
+
function getCardClasses({
|
|
137
|
+
appearance = "elevated",
|
|
138
|
+
padding = "md",
|
|
139
|
+
className
|
|
140
|
+
}) {
|
|
141
|
+
return cn(cardBaseClass, cardAppearanceClasses[appearance], cardPaddingClasses[padding], className);
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// src/components/card/Card.tsx
|
|
145
|
+
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
146
|
+
function Card({
|
|
147
|
+
appearance = "elevated",
|
|
148
|
+
padding = "md",
|
|
149
|
+
className,
|
|
150
|
+
children,
|
|
151
|
+
ref,
|
|
152
|
+
...props
|
|
153
|
+
}) {
|
|
154
|
+
const classes = getCardClasses({
|
|
155
|
+
appearance,
|
|
156
|
+
padding,
|
|
157
|
+
className
|
|
158
|
+
});
|
|
159
|
+
return /* @__PURE__ */ jsx2("div", {
|
|
160
|
+
ref,
|
|
161
|
+
className: classes,
|
|
162
|
+
...props,
|
|
163
|
+
children
|
|
164
|
+
});
|
|
165
|
+
}
|
|
166
|
+
// src/components/date-picker/DatePicker.tsx
|
|
167
|
+
import { forwardRef, useMemo, useState } from "react";
|
|
168
|
+
|
|
169
|
+
// src/classes/date-picker.ts
|
|
170
|
+
var datePickerBaseClass = "datepicker";
|
|
171
|
+
var datePickerInputClass = "datepicker-input";
|
|
172
|
+
var datePickerIconClass = "datepicker-icon";
|
|
173
|
+
var datePickerDropdownClass = "datepicker-dropdown";
|
|
174
|
+
var datePickerDropdownOpenClass = "datepicker-dropdown-open";
|
|
175
|
+
var datePickerFooterClass = "datepicker-footer";
|
|
176
|
+
var datePickerPresetClass = "datepicker-preset";
|
|
177
|
+
var datePickerRangeClass = "datepicker-range";
|
|
178
|
+
var datePickerSeparatorClass = "datepicker-range-separator";
|
|
179
|
+
var datePickerClearClass = "datepicker-clear";
|
|
180
|
+
var datePickerSizeClasses = {
|
|
181
|
+
sm: "datepicker-sm",
|
|
182
|
+
md: "",
|
|
183
|
+
lg: "datepicker-lg"
|
|
184
|
+
};
|
|
185
|
+
var datePickerStatusClasses = {
|
|
186
|
+
error: "datepicker-error",
|
|
187
|
+
success: "datepicker-success"
|
|
188
|
+
};
|
|
189
|
+
var datePickerPickerClasses = {
|
|
190
|
+
date: "",
|
|
191
|
+
week: "datepicker-week",
|
|
192
|
+
month: "datepicker-month-picker",
|
|
193
|
+
quarter: "datepicker-quarter-picker",
|
|
194
|
+
year: "datepicker-year-picker",
|
|
195
|
+
time: "datepicker-time-picker"
|
|
196
|
+
};
|
|
197
|
+
function getDatePickerClasses({
|
|
198
|
+
size = "md",
|
|
199
|
+
status,
|
|
200
|
+
picker = "date",
|
|
201
|
+
open,
|
|
202
|
+
disabled,
|
|
203
|
+
range,
|
|
204
|
+
className
|
|
205
|
+
}) {
|
|
206
|
+
return cn(datePickerBaseClass, datePickerSizeClasses[size], status && datePickerStatusClasses[status], datePickerPickerClasses[picker], open && "datepicker-open", disabled && "datepicker-disabled", range && datePickerRangeClass, className);
|
|
207
|
+
}
|
|
208
|
+
function getDatePickerDropdownClasses({
|
|
209
|
+
open,
|
|
210
|
+
className
|
|
211
|
+
}) {
|
|
212
|
+
return cn(datePickerDropdownClass, open && datePickerDropdownOpenClass, className);
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// src/components/date-picker/DatePicker.tsx
|
|
216
|
+
import { jsx as jsx3, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
217
|
+
function todayValue(picker) {
|
|
218
|
+
const today = new Date;
|
|
219
|
+
const year = today.getFullYear();
|
|
220
|
+
const month = String(today.getMonth() + 1).padStart(2, "0");
|
|
221
|
+
const day = String(today.getDate()).padStart(2, "0");
|
|
222
|
+
if (picker === "month")
|
|
223
|
+
return `${year}-${month}`;
|
|
224
|
+
if (picker === "year")
|
|
225
|
+
return String(year);
|
|
226
|
+
if (picker === "time")
|
|
227
|
+
return "00:00";
|
|
228
|
+
return `${year}-${month}-${day}`;
|
|
229
|
+
}
|
|
230
|
+
function inputTypeForPicker(picker) {
|
|
231
|
+
if (picker === "month")
|
|
232
|
+
return "month";
|
|
233
|
+
if (picker === "week")
|
|
234
|
+
return "week";
|
|
235
|
+
if (picker === "time")
|
|
236
|
+
return "time";
|
|
237
|
+
return picker === "year" || picker === "quarter" ? "text" : "date";
|
|
238
|
+
}
|
|
239
|
+
function placeholderForPicker(picker) {
|
|
240
|
+
if (picker === "month")
|
|
241
|
+
return "Select month";
|
|
242
|
+
if (picker === "week")
|
|
243
|
+
return "Select week";
|
|
244
|
+
if (picker === "quarter")
|
|
245
|
+
return "Select quarter";
|
|
246
|
+
if (picker === "year")
|
|
247
|
+
return "Select year";
|
|
248
|
+
if (picker === "time")
|
|
249
|
+
return "Select time";
|
|
250
|
+
return "Select date";
|
|
251
|
+
}
|
|
252
|
+
function normalizeDateValue(value) {
|
|
253
|
+
return typeof value === "string" && value.length > 0 ? value : undefined;
|
|
254
|
+
}
|
|
255
|
+
var DatePickerRoot = forwardRef(({
|
|
256
|
+
allowClear,
|
|
257
|
+
className,
|
|
258
|
+
defaultOpen,
|
|
259
|
+
defaultValue,
|
|
260
|
+
disabled,
|
|
261
|
+
disabledDate,
|
|
262
|
+
onBlur,
|
|
263
|
+
onChange,
|
|
264
|
+
onFocus,
|
|
265
|
+
onOpenChange,
|
|
266
|
+
open,
|
|
267
|
+
picker = "date",
|
|
268
|
+
placeholder,
|
|
269
|
+
presets,
|
|
270
|
+
showNow,
|
|
271
|
+
size = "md",
|
|
272
|
+
status,
|
|
273
|
+
value,
|
|
274
|
+
...props
|
|
275
|
+
}, ref) => {
|
|
276
|
+
const isValueControlled = value !== undefined;
|
|
277
|
+
const isOpenControlled = open !== undefined;
|
|
278
|
+
const [innerValue, setInnerValue] = useState(() => normalizeDateValue(defaultValue));
|
|
279
|
+
const [innerOpen, setInnerOpen] = useState(Boolean(defaultOpen));
|
|
280
|
+
const currentValue = isValueControlled ? normalizeDateValue(value) : innerValue;
|
|
281
|
+
const visible = isOpenControlled ? Boolean(open) : innerOpen;
|
|
282
|
+
const inputType = inputTypeForPicker(picker);
|
|
283
|
+
function setVisible(nextOpen) {
|
|
284
|
+
if (!isOpenControlled) {
|
|
285
|
+
setInnerOpen(nextOpen);
|
|
286
|
+
}
|
|
287
|
+
onOpenChange?.(nextOpen);
|
|
288
|
+
}
|
|
289
|
+
function emitChange(nextValue) {
|
|
290
|
+
if (nextValue && disabledDate?.(nextValue)) {
|
|
291
|
+
return;
|
|
292
|
+
}
|
|
293
|
+
if (!isValueControlled) {
|
|
294
|
+
setInnerValue(nextValue);
|
|
295
|
+
}
|
|
296
|
+
onChange?.(nextValue, nextValue ?? "");
|
|
297
|
+
}
|
|
298
|
+
const presetItems = useMemo(() => presets ?? [], [presets]);
|
|
299
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
300
|
+
...props,
|
|
301
|
+
ref,
|
|
302
|
+
className: getDatePickerClasses({
|
|
303
|
+
size,
|
|
304
|
+
status,
|
|
305
|
+
picker,
|
|
306
|
+
open: visible,
|
|
307
|
+
disabled,
|
|
308
|
+
className
|
|
309
|
+
}),
|
|
310
|
+
children: [
|
|
311
|
+
/* @__PURE__ */ jsx3("input", {
|
|
312
|
+
className: datePickerInputClass,
|
|
313
|
+
disabled,
|
|
314
|
+
type: inputType,
|
|
315
|
+
value: currentValue ?? "",
|
|
316
|
+
placeholder: placeholder ?? placeholderForPicker(picker),
|
|
317
|
+
onFocus: (event) => {
|
|
318
|
+
onFocus?.(event);
|
|
319
|
+
setVisible(true);
|
|
320
|
+
},
|
|
321
|
+
onBlur: (event) => {
|
|
322
|
+
onBlur?.(event);
|
|
323
|
+
setVisible(false);
|
|
324
|
+
},
|
|
325
|
+
onChange: (event) => emitChange(event.currentTarget.value || undefined)
|
|
326
|
+
}),
|
|
327
|
+
allowClear && currentValue && !disabled ? /* @__PURE__ */ jsx3("button", {
|
|
328
|
+
type: "button",
|
|
329
|
+
className: datePickerClearClass,
|
|
330
|
+
"aria-label": "Clear date",
|
|
331
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
332
|
+
onClick: () => emitChange(undefined),
|
|
333
|
+
children: "x"
|
|
334
|
+
}) : null,
|
|
335
|
+
/* @__PURE__ */ jsx3("span", {
|
|
336
|
+
className: datePickerIconClass,
|
|
337
|
+
"aria-hidden": "true",
|
|
338
|
+
children: "calendar"
|
|
339
|
+
}),
|
|
340
|
+
(presetItems.length > 0 || showNow) && visible ? /* @__PURE__ */ jsxs2("div", {
|
|
341
|
+
className: getDatePickerDropdownClasses({ open: visible }),
|
|
342
|
+
children: [
|
|
343
|
+
presetItems.map((preset, index) => /* @__PURE__ */ jsx3("button", {
|
|
344
|
+
type: "button",
|
|
345
|
+
className: datePickerPresetClass,
|
|
346
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
347
|
+
onClick: () => emitChange(preset.value),
|
|
348
|
+
children: preset.label
|
|
349
|
+
}, index)),
|
|
350
|
+
showNow ? /* @__PURE__ */ jsx3("div", {
|
|
351
|
+
className: datePickerFooterClass,
|
|
352
|
+
children: /* @__PURE__ */ jsx3("button", {
|
|
353
|
+
type: "button",
|
|
354
|
+
onMouseDown: (event) => event.preventDefault(),
|
|
355
|
+
onClick: () => emitChange(todayValue(picker)),
|
|
356
|
+
children: "Now"
|
|
357
|
+
})
|
|
358
|
+
}) : null
|
|
359
|
+
]
|
|
360
|
+
}) : null
|
|
361
|
+
]
|
|
362
|
+
});
|
|
363
|
+
});
|
|
364
|
+
DatePickerRoot.displayName = "DatePicker";
|
|
365
|
+
var RangePicker = forwardRef(({
|
|
366
|
+
allowClear,
|
|
367
|
+
className,
|
|
368
|
+
defaultValue,
|
|
369
|
+
disabled,
|
|
370
|
+
disabledDate,
|
|
371
|
+
onChange,
|
|
372
|
+
picker = "date",
|
|
373
|
+
placeholder,
|
|
374
|
+
separator = "-",
|
|
375
|
+
size = "md",
|
|
376
|
+
status,
|
|
377
|
+
value,
|
|
378
|
+
...props
|
|
379
|
+
}, ref) => {
|
|
380
|
+
const isControlled = value !== undefined;
|
|
381
|
+
const [innerValue, setInnerValue] = useState(defaultValue ?? [undefined, undefined]);
|
|
382
|
+
const currentValue = isControlled ? value : innerValue;
|
|
383
|
+
const inputType = inputTypeForPicker(picker);
|
|
384
|
+
function emitChange(nextValue) {
|
|
385
|
+
if (nextValue.some((item) => item !== undefined && Boolean(disabledDate?.(item)))) {
|
|
386
|
+
return;
|
|
387
|
+
}
|
|
388
|
+
if (!isControlled) {
|
|
389
|
+
setInnerValue(nextValue);
|
|
390
|
+
}
|
|
391
|
+
onChange?.(nextValue, [nextValue[0] ?? "", nextValue[1] ?? ""]);
|
|
392
|
+
}
|
|
393
|
+
function updateIndex(index, nextItem) {
|
|
394
|
+
emitChange(index === 0 ? [nextItem, currentValue?.[1]] : [currentValue?.[0], nextItem]);
|
|
395
|
+
}
|
|
396
|
+
return /* @__PURE__ */ jsxs2("div", {
|
|
397
|
+
...props,
|
|
398
|
+
ref,
|
|
399
|
+
className: getDatePickerClasses({
|
|
400
|
+
size,
|
|
401
|
+
status,
|
|
402
|
+
picker,
|
|
403
|
+
disabled,
|
|
404
|
+
range: true,
|
|
405
|
+
className
|
|
406
|
+
}),
|
|
407
|
+
children: [
|
|
408
|
+
/* @__PURE__ */ jsx3("input", {
|
|
409
|
+
className: datePickerInputClass,
|
|
410
|
+
disabled,
|
|
411
|
+
type: inputType,
|
|
412
|
+
value: currentValue?.[0] ?? "",
|
|
413
|
+
placeholder: Array.isArray(placeholder) ? placeholder[0] : "Start date",
|
|
414
|
+
onChange: (event) => updateIndex(0, event.currentTarget.value || undefined)
|
|
415
|
+
}),
|
|
416
|
+
/* @__PURE__ */ jsx3("span", {
|
|
417
|
+
className: datePickerSeparatorClass,
|
|
418
|
+
children: separator
|
|
419
|
+
}),
|
|
420
|
+
/* @__PURE__ */ jsx3("input", {
|
|
421
|
+
className: datePickerInputClass,
|
|
422
|
+
disabled,
|
|
423
|
+
type: inputType,
|
|
424
|
+
value: currentValue?.[1] ?? "",
|
|
425
|
+
placeholder: Array.isArray(placeholder) ? placeholder[1] : "End date",
|
|
426
|
+
onChange: (event) => updateIndex(1, event.currentTarget.value || undefined)
|
|
427
|
+
}),
|
|
428
|
+
allowClear && (currentValue?.[0] || currentValue?.[1]) && !disabled ? /* @__PURE__ */ jsx3("button", {
|
|
429
|
+
type: "button",
|
|
430
|
+
className: datePickerClearClass,
|
|
431
|
+
"aria-label": "Clear date range",
|
|
432
|
+
onClick: () => emitChange([undefined, undefined]),
|
|
433
|
+
children: "x"
|
|
434
|
+
}) : null
|
|
435
|
+
]
|
|
436
|
+
});
|
|
437
|
+
});
|
|
438
|
+
RangePicker.displayName = "DatePicker.RangePicker";
|
|
439
|
+
function withPicker(picker, displayName) {
|
|
440
|
+
const Picker = forwardRef((props, ref) => /* @__PURE__ */ jsx3(DatePickerRoot, {
|
|
441
|
+
...props,
|
|
442
|
+
ref,
|
|
443
|
+
picker
|
|
444
|
+
}));
|
|
445
|
+
Picker.displayName = displayName;
|
|
446
|
+
return Picker;
|
|
447
|
+
}
|
|
448
|
+
var DatePicker = Object.assign(DatePickerRoot, {
|
|
449
|
+
RangePicker,
|
|
450
|
+
WeekPicker: withPicker("week", "DatePicker.WeekPicker"),
|
|
451
|
+
MonthPicker: withPicker("month", "DatePicker.MonthPicker"),
|
|
452
|
+
QuarterPicker: withPicker("quarter", "DatePicker.QuarterPicker"),
|
|
453
|
+
YearPicker: withPicker("year", "DatePicker.YearPicker")
|
|
454
|
+
});
|
|
455
|
+
// src/components/pagination/Pagination.tsx
|
|
456
|
+
import {
|
|
457
|
+
forwardRef as forwardRef2,
|
|
458
|
+
useMemo as useMemo2,
|
|
459
|
+
useState as useState2
|
|
460
|
+
} from "react";
|
|
461
|
+
|
|
462
|
+
// src/classes/pagination.ts
|
|
463
|
+
var paginationBaseClass = "pagination";
|
|
464
|
+
var paginationItemClass = "pagination-item";
|
|
465
|
+
var paginationItemActiveClass = "pagination-item-active";
|
|
466
|
+
var paginationItemDisabledClass = "pagination-item-disabled";
|
|
467
|
+
var paginationPrevClass = "pagination-prev";
|
|
468
|
+
var paginationNextClass = "pagination-next";
|
|
469
|
+
var paginationEllipsisClass = "pagination-ellipsis";
|
|
470
|
+
var paginationCompactClass = "pagination-compact";
|
|
471
|
+
var paginationInfoClass = "pagination-info";
|
|
472
|
+
var paginationInfoTextClass = "pagination-info-text";
|
|
473
|
+
var paginationInputClass = "pagination-input";
|
|
474
|
+
var paginationResponsiveClass = "pagination-responsive";
|
|
475
|
+
var paginationSizeClasses = {
|
|
476
|
+
sm: "pagination-sm",
|
|
477
|
+
md: "",
|
|
478
|
+
lg: "pagination-lg"
|
|
479
|
+
};
|
|
480
|
+
function getPaginationClasses({
|
|
481
|
+
size = "md",
|
|
482
|
+
compact,
|
|
483
|
+
className
|
|
484
|
+
}) {
|
|
485
|
+
return cn(paginationBaseClass, paginationResponsiveClass, paginationSizeClasses[size], compact && paginationCompactClass, className);
|
|
486
|
+
}
|
|
487
|
+
function getPaginationItemClasses({
|
|
488
|
+
active,
|
|
489
|
+
disabled
|
|
490
|
+
}) {
|
|
491
|
+
return cn(paginationItemClass, active && paginationItemActiveClass, disabled && paginationItemDisabledClass);
|
|
492
|
+
}
|
|
493
|
+
|
|
494
|
+
// src/components/pagination/Pagination.tsx
|
|
495
|
+
import { jsx as jsx4, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
496
|
+
var defaultPageSizeOptions = [10, 20, 50, 100];
|
|
497
|
+
function toPositiveInteger(value, fallback) {
|
|
498
|
+
if (!Number.isFinite(value) || value === undefined) {
|
|
499
|
+
return fallback;
|
|
500
|
+
}
|
|
501
|
+
return Math.max(1, Math.floor(value));
|
|
502
|
+
}
|
|
503
|
+
function clampPage(page, pageCount) {
|
|
504
|
+
return Math.min(pageCount, Math.max(1, Math.floor(page)));
|
|
505
|
+
}
|
|
506
|
+
function getPageCount(total, pageSize) {
|
|
507
|
+
return Math.max(1, Math.ceil(Math.max(0, total) / pageSize));
|
|
508
|
+
}
|
|
509
|
+
function getRange(current, pageSize, total) {
|
|
510
|
+
if (total <= 0) {
|
|
511
|
+
return [0, 0];
|
|
512
|
+
}
|
|
513
|
+
const start = (current - 1) * pageSize + 1;
|
|
514
|
+
const end = Math.min(total, current * pageSize);
|
|
515
|
+
return [start, end];
|
|
516
|
+
}
|
|
517
|
+
function getPageTokens(current, pageCount) {
|
|
518
|
+
if (pageCount <= 7) {
|
|
519
|
+
return Array.from({ length: pageCount }, (_, index) => index + 1);
|
|
520
|
+
}
|
|
521
|
+
const pages = new Set([1, pageCount, current - 1, current, current + 1]);
|
|
522
|
+
if (current <= 4) {
|
|
523
|
+
[2, 3, 4, 5].forEach((page) => pages.add(page));
|
|
524
|
+
}
|
|
525
|
+
if (current >= pageCount - 3) {
|
|
526
|
+
[pageCount - 4, pageCount - 3, pageCount - 2, pageCount - 1].forEach((page) => pages.add(page));
|
|
527
|
+
}
|
|
528
|
+
const sortedPages = Array.from(pages).filter((page) => page >= 1 && page <= pageCount).sort((first, second) => first - second);
|
|
529
|
+
return sortedPages.reduce((tokens, page) => {
|
|
530
|
+
const previous = tokens[tokens.length - 1];
|
|
531
|
+
if (typeof previous === "number") {
|
|
532
|
+
const gap = page - previous;
|
|
533
|
+
if (gap === 2) {
|
|
534
|
+
tokens.push(previous + 1);
|
|
535
|
+
} else if (gap > 2) {
|
|
536
|
+
tokens.push("ellipsis");
|
|
537
|
+
}
|
|
538
|
+
}
|
|
539
|
+
tokens.push(page);
|
|
540
|
+
return tokens;
|
|
541
|
+
}, []);
|
|
542
|
+
}
|
|
543
|
+
function getSizeOptions(pageSize) {
|
|
544
|
+
return Array.from(new Set([...defaultPageSizeOptions, pageSize])).sort((first, second) => first - second);
|
|
545
|
+
}
|
|
546
|
+
var Pagination = forwardRef2(({
|
|
547
|
+
current,
|
|
548
|
+
defaultCurrent = 1,
|
|
549
|
+
pageSize,
|
|
550
|
+
defaultPageSize = 10,
|
|
551
|
+
total = 0,
|
|
552
|
+
onChange,
|
|
553
|
+
disabled,
|
|
554
|
+
simple,
|
|
555
|
+
showSizeChanger,
|
|
556
|
+
showQuickJumper,
|
|
557
|
+
showTotal,
|
|
558
|
+
size = "md",
|
|
559
|
+
className,
|
|
560
|
+
...props
|
|
561
|
+
}, ref) => {
|
|
562
|
+
const isCurrentControlled = current !== undefined;
|
|
563
|
+
const isPageSizeControlled = pageSize !== undefined;
|
|
564
|
+
const [internalCurrent, setInternalCurrent] = useState2(defaultCurrent);
|
|
565
|
+
const [internalPageSize, setInternalPageSize] = useState2(defaultPageSize);
|
|
566
|
+
const [quickJumpValue, setQuickJumpValue] = useState2("");
|
|
567
|
+
const mergedPageSize = toPositiveInteger(pageSize ?? internalPageSize, defaultPageSize);
|
|
568
|
+
const pageCount = getPageCount(total, mergedPageSize);
|
|
569
|
+
const mergedCurrent = clampPage(toPositiveInteger(current ?? internalCurrent, defaultCurrent), pageCount);
|
|
570
|
+
const pageTokens = useMemo2(() => getPageTokens(mergedCurrent, pageCount), [mergedCurrent, pageCount]);
|
|
571
|
+
const range = getRange(mergedCurrent, mergedPageSize, total);
|
|
572
|
+
function changePage(nextPage, nextPageSize = mergedPageSize) {
|
|
573
|
+
const nextPageCount = getPageCount(total, nextPageSize);
|
|
574
|
+
const normalizedPage = clampPage(nextPage, nextPageCount);
|
|
575
|
+
if (!isCurrentControlled) {
|
|
576
|
+
setInternalCurrent(normalizedPage);
|
|
577
|
+
}
|
|
578
|
+
if (!isPageSizeControlled) {
|
|
579
|
+
setInternalPageSize(nextPageSize);
|
|
580
|
+
}
|
|
581
|
+
onChange?.(normalizedPage, nextPageSize);
|
|
582
|
+
}
|
|
583
|
+
function handlePageSizeChange(event) {
|
|
584
|
+
const nextPageSize = toPositiveInteger(Number(event.currentTarget.value), mergedPageSize);
|
|
585
|
+
const nextPage = clampPage(mergedCurrent, getPageCount(total, nextPageSize));
|
|
586
|
+
changePage(nextPage, nextPageSize);
|
|
587
|
+
}
|
|
588
|
+
function jumpToInputPage(value) {
|
|
589
|
+
const nextPage = Number(value);
|
|
590
|
+
if (!Number.isFinite(nextPage)) {
|
|
591
|
+
return;
|
|
592
|
+
}
|
|
593
|
+
changePage(nextPage);
|
|
594
|
+
setQuickJumpValue("");
|
|
595
|
+
}
|
|
596
|
+
function handleQuickJumpKeyDown(event) {
|
|
597
|
+
if (event.key !== "Enter") {
|
|
598
|
+
return;
|
|
599
|
+
}
|
|
600
|
+
jumpToInputPage(event.currentTarget.value);
|
|
601
|
+
}
|
|
602
|
+
const previousDisabled = disabled || mergedCurrent <= 1;
|
|
603
|
+
const nextDisabled = disabled || mergedCurrent >= pageCount;
|
|
604
|
+
return /* @__PURE__ */ jsxs3("nav", {
|
|
605
|
+
...props,
|
|
606
|
+
ref,
|
|
607
|
+
className: getPaginationClasses({ size, compact: simple, className }),
|
|
608
|
+
children: [
|
|
609
|
+
showTotal ? /* @__PURE__ */ jsx4("div", {
|
|
610
|
+
className: paginationInfoClass,
|
|
611
|
+
children: /* @__PURE__ */ jsx4("span", {
|
|
612
|
+
className: paginationInfoTextClass,
|
|
613
|
+
children: showTotal(total, range)
|
|
614
|
+
})
|
|
615
|
+
}) : null,
|
|
616
|
+
/* @__PURE__ */ jsx4("button", {
|
|
617
|
+
type: "button",
|
|
618
|
+
className: paginationPrevClass,
|
|
619
|
+
disabled: previousDisabled,
|
|
620
|
+
"aria-label": "Previous page",
|
|
621
|
+
onClick: () => changePage(mergedCurrent - 1),
|
|
622
|
+
children: "Prev"
|
|
623
|
+
}),
|
|
624
|
+
simple ? /* @__PURE__ */ jsxs3("div", {
|
|
625
|
+
className: paginationInputClass,
|
|
626
|
+
children: [
|
|
627
|
+
/* @__PURE__ */ jsx4("input", {
|
|
628
|
+
"aria-label": "Current page",
|
|
629
|
+
type: "number",
|
|
630
|
+
min: 1,
|
|
631
|
+
max: pageCount,
|
|
632
|
+
value: quickJumpValue || String(mergedCurrent),
|
|
633
|
+
disabled,
|
|
634
|
+
onChange: (event) => setQuickJumpValue(event.currentTarget.value),
|
|
635
|
+
onKeyDown: handleQuickJumpKeyDown,
|
|
636
|
+
onBlur: (event) => {
|
|
637
|
+
if (event.currentTarget.value !== String(mergedCurrent)) {
|
|
638
|
+
jumpToInputPage(event.currentTarget.value);
|
|
639
|
+
}
|
|
640
|
+
}
|
|
641
|
+
}),
|
|
642
|
+
/* @__PURE__ */ jsxs3("span", {
|
|
643
|
+
className: paginationInfoTextClass,
|
|
644
|
+
children: [
|
|
645
|
+
"/ ",
|
|
646
|
+
pageCount
|
|
647
|
+
]
|
|
648
|
+
})
|
|
649
|
+
]
|
|
650
|
+
}) : pageTokens.map((pageToken, index) => pageToken === "ellipsis" ? /* @__PURE__ */ jsx4("span", {
|
|
651
|
+
"aria-hidden": "true",
|
|
652
|
+
className: paginationEllipsisClass
|
|
653
|
+
}, `ellipsis-${index}`) : /* @__PURE__ */ jsx4("button", {
|
|
654
|
+
type: "button",
|
|
655
|
+
className: getPaginationItemClasses({
|
|
656
|
+
active: pageToken === mergedCurrent,
|
|
657
|
+
disabled
|
|
658
|
+
}),
|
|
659
|
+
disabled,
|
|
660
|
+
"aria-current": pageToken === mergedCurrent ? "page" : undefined,
|
|
661
|
+
"aria-label": `Page ${pageToken}`,
|
|
662
|
+
onClick: () => changePage(pageToken),
|
|
663
|
+
children: pageToken
|
|
664
|
+
}, pageToken)),
|
|
665
|
+
/* @__PURE__ */ jsx4("button", {
|
|
666
|
+
type: "button",
|
|
667
|
+
className: paginationNextClass,
|
|
668
|
+
disabled: nextDisabled,
|
|
669
|
+
"aria-label": "Next page",
|
|
670
|
+
onClick: () => changePage(mergedCurrent + 1),
|
|
671
|
+
children: "Next"
|
|
672
|
+
}),
|
|
673
|
+
showSizeChanger ? /* @__PURE__ */ jsx4("div", {
|
|
674
|
+
className: paginationInputClass,
|
|
675
|
+
children: /* @__PURE__ */ jsx4("select", {
|
|
676
|
+
"aria-label": "Page size",
|
|
677
|
+
value: mergedPageSize,
|
|
678
|
+
disabled,
|
|
679
|
+
onChange: handlePageSizeChange,
|
|
680
|
+
children: getSizeOptions(mergedPageSize).map((option) => /* @__PURE__ */ jsxs3("option", {
|
|
681
|
+
value: option,
|
|
682
|
+
children: [
|
|
683
|
+
option,
|
|
684
|
+
" / page"
|
|
685
|
+
]
|
|
686
|
+
}, option))
|
|
687
|
+
})
|
|
688
|
+
}) : null,
|
|
689
|
+
showQuickJumper && !simple ? /* @__PURE__ */ jsx4("div", {
|
|
690
|
+
className: paginationInputClass,
|
|
691
|
+
children: /* @__PURE__ */ jsx4("input", {
|
|
692
|
+
"aria-label": "Jump to page",
|
|
693
|
+
type: "number",
|
|
694
|
+
min: 1,
|
|
695
|
+
max: pageCount,
|
|
696
|
+
value: quickJumpValue,
|
|
697
|
+
disabled,
|
|
698
|
+
onChange: (event) => setQuickJumpValue(event.currentTarget.value),
|
|
699
|
+
onKeyDown: handleQuickJumpKeyDown
|
|
700
|
+
})
|
|
701
|
+
}) : null
|
|
702
|
+
]
|
|
703
|
+
});
|
|
704
|
+
});
|
|
705
|
+
Pagination.displayName = "Pagination";
|
|
706
|
+
// src/components/dm-pagination/DmPagination.tsx
|
|
707
|
+
import {
|
|
708
|
+
forwardRef as forwardRef3,
|
|
709
|
+
useEffect,
|
|
710
|
+
useMemo as useMemo3,
|
|
711
|
+
useRef,
|
|
712
|
+
useState as useState3
|
|
713
|
+
} from "react";
|
|
714
|
+
|
|
715
|
+
// src/classes/dm-pagination.ts
|
|
716
|
+
var dmPaginationBaseClass = "dm-pagination";
|
|
717
|
+
var dmPaginationHiddenClass = "dm-pagination-hidden";
|
|
718
|
+
var dmPaginationPagerClass = "dm-pagination-pager";
|
|
719
|
+
var dmPaginationRefreshClass = "dm-pagination-refresh";
|
|
720
|
+
var dmPaginationRefreshLoadingClass = "dm-pagination-refresh-loading";
|
|
721
|
+
var dmPaginationSelectedClass = "dm-pagination-selected";
|
|
722
|
+
var dmPaginationAlignClasses = {
|
|
723
|
+
left: "dm-pagination-left",
|
|
724
|
+
center: "dm-pagination-center",
|
|
725
|
+
right: "dm-pagination-right"
|
|
726
|
+
};
|
|
727
|
+
function getDmPaginationClasses({
|
|
728
|
+
align = "right",
|
|
729
|
+
hidden,
|
|
730
|
+
className
|
|
731
|
+
}) {
|
|
732
|
+
return cn(dmPaginationBaseClass, dmPaginationAlignClasses[align], hidden && dmPaginationHiddenClass, className);
|
|
733
|
+
}
|
|
734
|
+
function getDmPaginationRefreshClasses({
|
|
735
|
+
loading,
|
|
736
|
+
className
|
|
737
|
+
}) {
|
|
738
|
+
return cn(dmPaginationRefreshClass, loading && dmPaginationRefreshLoadingClass, className);
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
// src/components/dm-pagination/DmPagination.tsx
|
|
742
|
+
import { jsx as jsx5, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
743
|
+
var defaultLocale = {
|
|
744
|
+
refresh: "Refresh",
|
|
745
|
+
showTotal: (total, range) => `${range[0]}-${range[1]} of ${total}`,
|
|
746
|
+
showTotalSimple: (total, range) => `${range[0]}-${range[1]} / ${total}`,
|
|
747
|
+
selected: (selectedTotal) => `, ${selectedTotal} selected`
|
|
748
|
+
};
|
|
749
|
+
function getResponsiveSimple({
|
|
750
|
+
width,
|
|
751
|
+
total,
|
|
752
|
+
showRefresh,
|
|
753
|
+
showSizeChanger
|
|
754
|
+
}) {
|
|
755
|
+
let reservedWidth = 0;
|
|
756
|
+
if (!showRefresh)
|
|
757
|
+
reservedWidth += 100;
|
|
758
|
+
if (!showSizeChanger)
|
|
759
|
+
reservedWidth += 100;
|
|
760
|
+
if (width < 900 - reservedWidth)
|
|
761
|
+
return total >= 100;
|
|
762
|
+
if (width < 1100 - reservedWidth)
|
|
763
|
+
return total >= 1000;
|
|
764
|
+
if (width < 1220 - reservedWidth)
|
|
765
|
+
return total >= 99999;
|
|
766
|
+
if (width < 1300 - reservedWidth)
|
|
767
|
+
return total >= 999999;
|
|
768
|
+
if (width < 1450 - reservedWidth)
|
|
769
|
+
return total >= 9999999;
|
|
770
|
+
return false;
|
|
771
|
+
}
|
|
772
|
+
function useElementWidth() {
|
|
773
|
+
const ref = useRef(null);
|
|
774
|
+
const [width, setWidth] = useState3(1000);
|
|
775
|
+
useEffect(() => {
|
|
776
|
+
const element = ref.current;
|
|
777
|
+
if (!element || typeof ResizeObserver === "undefined")
|
|
778
|
+
return;
|
|
779
|
+
const observer = new ResizeObserver(([entry]) => {
|
|
780
|
+
setWidth(entry?.contentRect.width || element.getBoundingClientRect().width);
|
|
781
|
+
});
|
|
782
|
+
observer.observe(element);
|
|
783
|
+
return () => observer.disconnect();
|
|
784
|
+
}, []);
|
|
785
|
+
return [ref, width];
|
|
786
|
+
}
|
|
787
|
+
function renderSelected(selectedTotal, locale) {
|
|
788
|
+
if (!selectedTotal)
|
|
789
|
+
return null;
|
|
790
|
+
return /* @__PURE__ */ jsx5("span", {
|
|
791
|
+
className: dmPaginationSelectedClass,
|
|
792
|
+
children: locale.selected(selectedTotal)
|
|
793
|
+
});
|
|
794
|
+
}
|
|
795
|
+
var DmPagination = forwardRef3(({
|
|
796
|
+
selectedTotal = 0,
|
|
797
|
+
loading = false,
|
|
798
|
+
total = 0,
|
|
799
|
+
showRefresh = true,
|
|
800
|
+
showPagination = true,
|
|
801
|
+
wrapperStyle,
|
|
802
|
+
className,
|
|
803
|
+
align = "right",
|
|
804
|
+
showTotalFullMessage = false,
|
|
805
|
+
showSizeChanger = true,
|
|
806
|
+
responsiveSimple = true,
|
|
807
|
+
refresh,
|
|
808
|
+
simple,
|
|
809
|
+
showQuickJumper,
|
|
810
|
+
showTotal,
|
|
811
|
+
locale,
|
|
812
|
+
...props
|
|
813
|
+
}, ref) => {
|
|
814
|
+
const [measureRef, width] = useElementWidth();
|
|
815
|
+
const mergedLocale = useMemo3(() => ({ ...defaultLocale, ...locale }), [locale]);
|
|
816
|
+
const isRefreshVisible = showRefresh && Boolean(refresh);
|
|
817
|
+
const shouldRender = showPagination || isRefreshVisible;
|
|
818
|
+
const responsiveSimpleMode = responsiveSimple ? getResponsiveSimple({
|
|
819
|
+
width,
|
|
820
|
+
total,
|
|
821
|
+
showRefresh,
|
|
822
|
+
showSizeChanger
|
|
823
|
+
}) : false;
|
|
824
|
+
const mergedSimple = simple ?? responsiveSimpleMode;
|
|
825
|
+
const mergedShowQuickJumper = showQuickJumper ?? !mergedSimple;
|
|
826
|
+
const totalRenderer = useMemo3(() => {
|
|
827
|
+
if (showTotal)
|
|
828
|
+
return showTotal;
|
|
829
|
+
return (nextTotal, range) => {
|
|
830
|
+
if (Number(nextTotal) === 0)
|
|
831
|
+
return "";
|
|
832
|
+
const selected = renderSelected(selectedTotal, mergedLocale);
|
|
833
|
+
const message = mergedSimple && !showTotalFullMessage ? mergedLocale.showTotalSimple(nextTotal, range, selectedTotal) : mergedLocale.showTotal(nextTotal, range, selectedTotal);
|
|
834
|
+
return /* @__PURE__ */ jsxs4("span", {
|
|
835
|
+
title: `${mergedLocale.showTotal(nextTotal, range, selectedTotal)}${selectedTotal ? mergedLocale.selected(selectedTotal) : ""}`,
|
|
836
|
+
children: [
|
|
837
|
+
message,
|
|
838
|
+
selected
|
|
839
|
+
]
|
|
840
|
+
});
|
|
841
|
+
};
|
|
842
|
+
}, [
|
|
843
|
+
mergedLocale,
|
|
844
|
+
mergedSimple,
|
|
845
|
+
selectedTotal,
|
|
846
|
+
showTotal,
|
|
847
|
+
showTotalFullMessage
|
|
848
|
+
]);
|
|
849
|
+
if (!shouldRender)
|
|
850
|
+
return null;
|
|
851
|
+
return /* @__PURE__ */ jsxs4("div", {
|
|
852
|
+
ref: (element) => {
|
|
853
|
+
measureRef.current = element;
|
|
854
|
+
if (typeof ref === "function") {
|
|
855
|
+
ref(element);
|
|
856
|
+
} else if (ref) {
|
|
857
|
+
ref.current = element;
|
|
858
|
+
}
|
|
859
|
+
},
|
|
860
|
+
className: getDmPaginationClasses({ align, className }),
|
|
861
|
+
style: wrapperStyle,
|
|
862
|
+
children: [
|
|
863
|
+
showPagination ? /* @__PURE__ */ jsx5("div", {
|
|
864
|
+
className: dmPaginationPagerClass,
|
|
865
|
+
children: /* @__PURE__ */ jsx5(Pagination, {
|
|
866
|
+
...props,
|
|
867
|
+
total,
|
|
868
|
+
simple: mergedSimple,
|
|
869
|
+
showQuickJumper: mergedShowQuickJumper,
|
|
870
|
+
showSizeChanger,
|
|
871
|
+
showTotal: totalRenderer
|
|
872
|
+
})
|
|
873
|
+
}) : null,
|
|
874
|
+
isRefreshVisible ? /* @__PURE__ */ jsxs4("button", {
|
|
875
|
+
type: "button",
|
|
876
|
+
className: getDmPaginationRefreshClasses({ loading }),
|
|
877
|
+
disabled: loading || props.disabled,
|
|
878
|
+
"aria-busy": loading || undefined,
|
|
879
|
+
onClick: refresh,
|
|
880
|
+
children: [
|
|
881
|
+
/* @__PURE__ */ jsx5("span", {
|
|
882
|
+
"aria-hidden": "true",
|
|
883
|
+
children: "Reload"
|
|
884
|
+
}),
|
|
885
|
+
/* @__PURE__ */ jsx5("span", {
|
|
886
|
+
children: mergedLocale.refresh
|
|
887
|
+
})
|
|
888
|
+
]
|
|
889
|
+
}) : null
|
|
890
|
+
]
|
|
891
|
+
});
|
|
892
|
+
});
|
|
893
|
+
DmPagination.displayName = "DmPagination";
|
|
894
|
+
// src/components/input/Input.tsx
|
|
895
|
+
import {
|
|
896
|
+
forwardRef as forwardRef4,
|
|
897
|
+
useImperativeHandle,
|
|
898
|
+
useRef as useRef2,
|
|
899
|
+
useState as useState4
|
|
900
|
+
} from "react";
|
|
901
|
+
|
|
902
|
+
// src/classes/input.ts
|
|
903
|
+
var inputBaseClass = "input";
|
|
904
|
+
var inputWrapperClass = "input-wrapper";
|
|
905
|
+
var inputAffixWrapperClass = "input-affix-wrapper";
|
|
906
|
+
var inputPrefixClass = "input-prefix";
|
|
907
|
+
var inputSuffixClass = "input-suffix";
|
|
908
|
+
var inputClearClass = "input-clear";
|
|
909
|
+
var inputSearchClass = "input-search";
|
|
910
|
+
var inputSearchButtonClass = "input-search-button";
|
|
911
|
+
var inputPasswordClass = "input-password";
|
|
912
|
+
var inputPasswordToggleClass = "input-password-toggle";
|
|
913
|
+
var inputGroupClass = "input-group";
|
|
914
|
+
var textAreaBaseClass = "textarea";
|
|
915
|
+
var textAreaWrapperClass = "textarea-wrapper";
|
|
916
|
+
var textAreaCountClass = "textarea-counter";
|
|
917
|
+
var textAreaCountExceededClass = "textarea-counter-exceeded";
|
|
918
|
+
var textAreaAutoSizeClass = "textarea-auto-resize";
|
|
919
|
+
var inputVariantClasses = {
|
|
920
|
+
filled: "input-filled",
|
|
921
|
+
outlined: "input-outlined"
|
|
922
|
+
};
|
|
923
|
+
var inputSizeClasses = {
|
|
924
|
+
sm: "input-sm",
|
|
925
|
+
md: "input-md",
|
|
926
|
+
lg: "input-lg"
|
|
927
|
+
};
|
|
928
|
+
var inputStatusClasses = {
|
|
929
|
+
error: "input-error",
|
|
930
|
+
success: "input-success"
|
|
931
|
+
};
|
|
932
|
+
var textAreaVariantClasses = {
|
|
933
|
+
filled: "textarea-filled",
|
|
934
|
+
outlined: "textarea-outlined"
|
|
935
|
+
};
|
|
936
|
+
var textAreaSizeClasses = {
|
|
937
|
+
sm: "textarea-sm",
|
|
938
|
+
md: "",
|
|
939
|
+
lg: "textarea-lg"
|
|
940
|
+
};
|
|
941
|
+
var textAreaStatusClasses = {
|
|
942
|
+
error: "textarea-error",
|
|
943
|
+
success: "textarea-success"
|
|
944
|
+
};
|
|
945
|
+
var textAreaResizeClasses = {
|
|
946
|
+
none: "textarea-resize-none",
|
|
947
|
+
both: "textarea-resize-both",
|
|
948
|
+
horizontal: "textarea-resize-horizontal",
|
|
949
|
+
vertical: "textarea-resize-vertical"
|
|
950
|
+
};
|
|
951
|
+
function getInputClasses({
|
|
952
|
+
size = "md",
|
|
953
|
+
status,
|
|
954
|
+
variant = "outlined",
|
|
955
|
+
className
|
|
956
|
+
}) {
|
|
957
|
+
return cn(inputBaseClass, inputVariantClasses[variant], inputSizeClasses[size], status && inputStatusClasses[status], className);
|
|
958
|
+
}
|
|
959
|
+
function getInputWrapperClasses({
|
|
960
|
+
affixed,
|
|
961
|
+
className
|
|
962
|
+
}) {
|
|
963
|
+
return cn(inputWrapperClass, affixed && inputAffixWrapperClass, className);
|
|
964
|
+
}
|
|
965
|
+
function getSearchWrapperClasses({ className }) {
|
|
966
|
+
return cn(inputSearchClass, className);
|
|
967
|
+
}
|
|
968
|
+
function getPasswordWrapperClasses({
|
|
969
|
+
className
|
|
970
|
+
}) {
|
|
971
|
+
return cn(inputPasswordClass, className);
|
|
972
|
+
}
|
|
973
|
+
function getTextAreaClasses({
|
|
974
|
+
size = "md",
|
|
975
|
+
status,
|
|
976
|
+
variant = "outlined",
|
|
977
|
+
resize = "vertical",
|
|
978
|
+
autoSize,
|
|
979
|
+
className
|
|
980
|
+
}) {
|
|
981
|
+
return cn(textAreaBaseClass, textAreaVariantClasses[variant], textAreaSizeClasses[size], status && textAreaStatusClasses[status], textAreaResizeClasses[resize], autoSize && textAreaAutoSizeClass, className);
|
|
982
|
+
}
|
|
983
|
+
function getTextAreaCountClasses({ exceeded }) {
|
|
984
|
+
return cn(textAreaCountClass, exceeded && textAreaCountExceededClass);
|
|
985
|
+
}
|
|
986
|
+
|
|
987
|
+
// src/components/input/Input.tsx
|
|
988
|
+
import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
|
|
989
|
+
function toTextValue(value) {
|
|
990
|
+
if (Array.isArray(value)) {
|
|
991
|
+
return value.join(",");
|
|
992
|
+
}
|
|
993
|
+
return value == null ? "" : String(value);
|
|
994
|
+
}
|
|
995
|
+
var InputRoot = forwardRef4(({
|
|
996
|
+
allowClear,
|
|
997
|
+
className,
|
|
998
|
+
defaultValue,
|
|
999
|
+
disabled,
|
|
1000
|
+
onChange,
|
|
1001
|
+
prefix,
|
|
1002
|
+
size = "md",
|
|
1003
|
+
status,
|
|
1004
|
+
suffix,
|
|
1005
|
+
type = "text",
|
|
1006
|
+
value,
|
|
1007
|
+
variant = "outlined",
|
|
1008
|
+
...props
|
|
1009
|
+
}, ref) => {
|
|
1010
|
+
const inputRef = useRef2(null);
|
|
1011
|
+
const [internalValue, setInternalValue] = useState4(() => toTextValue(defaultValue));
|
|
1012
|
+
const isControlled = value !== undefined;
|
|
1013
|
+
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
1014
|
+
const hasAffix = prefix != null || suffix != null || allowClear;
|
|
1015
|
+
useImperativeHandle(ref, () => inputRef.current);
|
|
1016
|
+
function handleChange(event) {
|
|
1017
|
+
if (!isControlled) {
|
|
1018
|
+
setInternalValue(event.currentTarget.value);
|
|
1019
|
+
}
|
|
1020
|
+
onChange?.(event);
|
|
1021
|
+
}
|
|
1022
|
+
function handleClear() {
|
|
1023
|
+
const input = inputRef.current;
|
|
1024
|
+
if (!input || disabled) {
|
|
1025
|
+
return;
|
|
1026
|
+
}
|
|
1027
|
+
input.value = "";
|
|
1028
|
+
if (!isControlled) {
|
|
1029
|
+
setInternalValue("");
|
|
1030
|
+
}
|
|
1031
|
+
onChange?.({
|
|
1032
|
+
currentTarget: input,
|
|
1033
|
+
target: input,
|
|
1034
|
+
type: "change"
|
|
1035
|
+
});
|
|
1036
|
+
input.focus();
|
|
1037
|
+
}
|
|
1038
|
+
const control = /* @__PURE__ */ jsx6("input", {
|
|
1039
|
+
...props,
|
|
1040
|
+
ref: inputRef,
|
|
1041
|
+
type,
|
|
1042
|
+
className: getInputClasses({ size, status, variant, className }),
|
|
1043
|
+
disabled,
|
|
1044
|
+
value: currentValue,
|
|
1045
|
+
onChange: handleChange
|
|
1046
|
+
});
|
|
1047
|
+
if (!hasAffix) {
|
|
1048
|
+
return control;
|
|
1049
|
+
}
|
|
1050
|
+
const showClear = allowClear && !disabled && currentValue.length > 0;
|
|
1051
|
+
return /* @__PURE__ */ jsxs5("span", {
|
|
1052
|
+
className: getInputWrapperClasses({ affixed: hasAffix }),
|
|
1053
|
+
children: [
|
|
1054
|
+
prefix != null ? /* @__PURE__ */ jsx6("span", {
|
|
1055
|
+
className: inputPrefixClass,
|
|
1056
|
+
children: prefix
|
|
1057
|
+
}) : null,
|
|
1058
|
+
control,
|
|
1059
|
+
showClear ? /* @__PURE__ */ jsx6("button", {
|
|
1060
|
+
type: "button",
|
|
1061
|
+
className: inputClearClass,
|
|
1062
|
+
"aria-label": "Clear input",
|
|
1063
|
+
onClick: handleClear,
|
|
1064
|
+
children: "x"
|
|
1065
|
+
}) : null,
|
|
1066
|
+
suffix != null ? /* @__PURE__ */ jsx6("span", {
|
|
1067
|
+
className: inputSuffixClass,
|
|
1068
|
+
children: suffix
|
|
1069
|
+
}) : null
|
|
1070
|
+
]
|
|
1071
|
+
});
|
|
1072
|
+
});
|
|
1073
|
+
InputRoot.displayName = "Input";
|
|
1074
|
+
var Search = forwardRef4(({
|
|
1075
|
+
className,
|
|
1076
|
+
disabled,
|
|
1077
|
+
enterButton,
|
|
1078
|
+
loading,
|
|
1079
|
+
onKeyDown,
|
|
1080
|
+
onSearch,
|
|
1081
|
+
...props
|
|
1082
|
+
}, ref) => {
|
|
1083
|
+
const inputRef = useRef2(null);
|
|
1084
|
+
useImperativeHandle(ref, () => inputRef.current);
|
|
1085
|
+
function emitSearch(event) {
|
|
1086
|
+
onSearch?.(inputRef.current?.value ?? "", event);
|
|
1087
|
+
}
|
|
1088
|
+
function handleKeyDown(event) {
|
|
1089
|
+
onKeyDown?.(event);
|
|
1090
|
+
if (!event.defaultPrevented && event.key === "Enter") {
|
|
1091
|
+
emitSearch(event);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
const buttonContent = enterButton === true ? "Search" : enterButton ?? "Search";
|
|
1095
|
+
return /* @__PURE__ */ jsxs5("span", {
|
|
1096
|
+
className: getSearchWrapperClasses({ className }),
|
|
1097
|
+
children: [
|
|
1098
|
+
/* @__PURE__ */ jsx6(InputRoot, {
|
|
1099
|
+
...props,
|
|
1100
|
+
ref: inputRef,
|
|
1101
|
+
disabled,
|
|
1102
|
+
onKeyDown: handleKeyDown
|
|
1103
|
+
}),
|
|
1104
|
+
enterButton || loading ? /* @__PURE__ */ jsx6("button", {
|
|
1105
|
+
type: "button",
|
|
1106
|
+
className: inputSearchButtonClass,
|
|
1107
|
+
disabled: disabled || loading,
|
|
1108
|
+
"aria-busy": loading || undefined,
|
|
1109
|
+
onClick: emitSearch,
|
|
1110
|
+
children: loading ? "Loading" : buttonContent
|
|
1111
|
+
}) : null
|
|
1112
|
+
]
|
|
1113
|
+
});
|
|
1114
|
+
});
|
|
1115
|
+
Search.displayName = "Input.Search";
|
|
1116
|
+
var Password = forwardRef4(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
|
|
1117
|
+
const [visible, setVisible] = useState4(false);
|
|
1118
|
+
const type = visible ? "text" : "password";
|
|
1119
|
+
const toggle = visibilityToggle ? /* @__PURE__ */ jsx6("button", {
|
|
1120
|
+
type: "button",
|
|
1121
|
+
className: inputPasswordToggleClass,
|
|
1122
|
+
disabled,
|
|
1123
|
+
"aria-label": visible ? "Hide password" : "Show password",
|
|
1124
|
+
onClick: () => {
|
|
1125
|
+
setVisible((current) => !current);
|
|
1126
|
+
},
|
|
1127
|
+
children: visible ? "Hide" : "Show"
|
|
1128
|
+
}) : undefined;
|
|
1129
|
+
return /* @__PURE__ */ jsx6("span", {
|
|
1130
|
+
className: getPasswordWrapperClasses({ className }),
|
|
1131
|
+
children: /* @__PURE__ */ jsx6(InputRoot, {
|
|
1132
|
+
...props,
|
|
1133
|
+
ref,
|
|
1134
|
+
disabled,
|
|
1135
|
+
type,
|
|
1136
|
+
suffix: toggle
|
|
1137
|
+
})
|
|
1138
|
+
});
|
|
1139
|
+
});
|
|
1140
|
+
Password.displayName = "Input.Password";
|
|
1141
|
+
var TextArea = forwardRef4(({
|
|
1142
|
+
autoSize,
|
|
1143
|
+
className,
|
|
1144
|
+
defaultValue,
|
|
1145
|
+
maxLength,
|
|
1146
|
+
onChange,
|
|
1147
|
+
resize = "vertical",
|
|
1148
|
+
showCount,
|
|
1149
|
+
size = "md",
|
|
1150
|
+
status,
|
|
1151
|
+
value,
|
|
1152
|
+
variant = "outlined",
|
|
1153
|
+
...props
|
|
1154
|
+
}, ref) => {
|
|
1155
|
+
const [internalValue, setInternalValue] = useState4(() => toTextValue(defaultValue));
|
|
1156
|
+
const isControlled = value !== undefined;
|
|
1157
|
+
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
1158
|
+
const count = currentValue.length;
|
|
1159
|
+
const exceeded = maxLength !== undefined && count > maxLength;
|
|
1160
|
+
function handleChange(event) {
|
|
1161
|
+
if (!isControlled) {
|
|
1162
|
+
setInternalValue(event.currentTarget.value);
|
|
1163
|
+
}
|
|
1164
|
+
onChange?.(event);
|
|
1165
|
+
}
|
|
1166
|
+
const control = /* @__PURE__ */ jsx6("textarea", {
|
|
1167
|
+
...props,
|
|
1168
|
+
ref,
|
|
1169
|
+
className: getTextAreaClasses({
|
|
1170
|
+
size,
|
|
1171
|
+
status,
|
|
1172
|
+
variant,
|
|
1173
|
+
resize,
|
|
1174
|
+
autoSize: Boolean(autoSize),
|
|
1175
|
+
className
|
|
1176
|
+
}),
|
|
1177
|
+
maxLength,
|
|
1178
|
+
value: currentValue,
|
|
1179
|
+
onChange: handleChange
|
|
1180
|
+
});
|
|
1181
|
+
if (!showCount) {
|
|
1182
|
+
return control;
|
|
1183
|
+
}
|
|
1184
|
+
return /* @__PURE__ */ jsxs5("span", {
|
|
1185
|
+
className: textAreaWrapperClass,
|
|
1186
|
+
children: [
|
|
1187
|
+
control,
|
|
1188
|
+
/* @__PURE__ */ jsxs5("span", {
|
|
1189
|
+
className: getTextAreaCountClasses({ exceeded }),
|
|
1190
|
+
children: [
|
|
1191
|
+
count,
|
|
1192
|
+
maxLength !== undefined ? ` / ${maxLength}` : null
|
|
1193
|
+
]
|
|
1194
|
+
})
|
|
1195
|
+
]
|
|
1196
|
+
});
|
|
1197
|
+
});
|
|
1198
|
+
TextArea.displayName = "Input.TextArea";
|
|
1199
|
+
var Group = forwardRef4(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx6("div", {
|
|
1200
|
+
...props,
|
|
1201
|
+
ref,
|
|
1202
|
+
className: cn(inputGroupClass, className),
|
|
1203
|
+
children
|
|
1204
|
+
}));
|
|
1205
|
+
Group.displayName = "Input.Group";
|
|
1206
|
+
var Input = Object.assign(InputRoot, {
|
|
1207
|
+
Search,
|
|
1208
|
+
Password,
|
|
1209
|
+
TextArea,
|
|
1210
|
+
Group
|
|
1211
|
+
});
|
|
1212
|
+
// src/components/select/Select.tsx
|
|
1213
|
+
import React5, { forwardRef as forwardRef5, useMemo as useMemo4, useState as useState5 } from "react";
|
|
1214
|
+
|
|
1215
|
+
// src/classes/select.ts
|
|
1216
|
+
var selectContainerClass = "select-container";
|
|
1217
|
+
var selectBaseClass = "select";
|
|
1218
|
+
var selectIconClass = "select-icon";
|
|
1219
|
+
var selectOpenClass = "select-open";
|
|
1220
|
+
var selectLoadingClass = "select-loading";
|
|
1221
|
+
var selectFullClass = "select-full";
|
|
1222
|
+
var selectOptionClass = "select-option";
|
|
1223
|
+
var selectOptionSelectedClass = "select-option-selected";
|
|
1224
|
+
var selectOptionDisabledClass = "select-option-disabled";
|
|
1225
|
+
var selectDropdownClass = "select-dropdown";
|
|
1226
|
+
var selectSearchClass = "select-search";
|
|
1227
|
+
var selectSelectionClass = "select-selection";
|
|
1228
|
+
var selectTagClass = "select-tag";
|
|
1229
|
+
var selectClearClass = "select-clear";
|
|
1230
|
+
var selectPlaceholderClass = "select-placeholder";
|
|
1231
|
+
var selectEmptyClass = "select-empty";
|
|
1232
|
+
var selectGroupClass = "select-group";
|
|
1233
|
+
var selectGroupLabelClass = "select-group-label";
|
|
1234
|
+
var selectSizeClasses = {
|
|
1235
|
+
sm: "select-sm",
|
|
1236
|
+
md: "",
|
|
1237
|
+
lg: "select-lg"
|
|
1238
|
+
};
|
|
1239
|
+
var selectStatusClasses = {
|
|
1240
|
+
error: "select-error",
|
|
1241
|
+
success: "select-success"
|
|
1242
|
+
};
|
|
1243
|
+
function getSelectContainerClasses({
|
|
1244
|
+
open,
|
|
1245
|
+
loading,
|
|
1246
|
+
disabled,
|
|
1247
|
+
full,
|
|
1248
|
+
className
|
|
1249
|
+
}) {
|
|
1250
|
+
return cn(selectContainerClass, open && selectOpenClass, loading && selectLoadingClass, disabled && "select-disabled", full && selectFullClass, className);
|
|
1251
|
+
}
|
|
1252
|
+
function getSelectClasses({
|
|
1253
|
+
size = "md",
|
|
1254
|
+
status,
|
|
1255
|
+
disabled,
|
|
1256
|
+
className
|
|
1257
|
+
}) {
|
|
1258
|
+
return cn(selectBaseClass, selectSizeClasses[size], status && selectStatusClasses[status], disabled && "select-disabled", className);
|
|
1259
|
+
}
|
|
1260
|
+
function getSelectOptionClasses({
|
|
1261
|
+
selected,
|
|
1262
|
+
disabled,
|
|
1263
|
+
className
|
|
1264
|
+
}) {
|
|
1265
|
+
return cn(selectOptionClass, selected && selectOptionSelectedClass, disabled && selectOptionDisabledClass, className);
|
|
1266
|
+
}
|
|
1267
|
+
|
|
1268
|
+
// src/components/select/Select.tsx
|
|
1269
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1270
|
+
function isGroup(option) {
|
|
1271
|
+
return "options" in option;
|
|
1272
|
+
}
|
|
1273
|
+
function optionLabel(option) {
|
|
1274
|
+
return option.label ?? option.value;
|
|
1275
|
+
}
|
|
1276
|
+
function valueKey(value) {
|
|
1277
|
+
return String(value);
|
|
1278
|
+
}
|
|
1279
|
+
function normalizeSingleValue(value) {
|
|
1280
|
+
if (Array.isArray(value)) {
|
|
1281
|
+
return value[0];
|
|
1282
|
+
}
|
|
1283
|
+
return typeof value === "string" || typeof value === "number" ? value : undefined;
|
|
1284
|
+
}
|
|
1285
|
+
function normalizeMultiValue(value) {
|
|
1286
|
+
if (Array.isArray(value)) {
|
|
1287
|
+
return value.filter((item) => typeof item === "string" || typeof item === "number");
|
|
1288
|
+
}
|
|
1289
|
+
const single = normalizeSingleValue(value);
|
|
1290
|
+
return single === undefined ? [] : [single];
|
|
1291
|
+
}
|
|
1292
|
+
function optionsFromChildren(children) {
|
|
1293
|
+
const result = [];
|
|
1294
|
+
React5.Children.forEach(children, (child) => {
|
|
1295
|
+
if (!React5.isValidElement(child)) {
|
|
1296
|
+
return;
|
|
1297
|
+
}
|
|
1298
|
+
if (child.type === Option) {
|
|
1299
|
+
const props = child.props;
|
|
1300
|
+
result.push({
|
|
1301
|
+
value: props.value,
|
|
1302
|
+
label: props.children,
|
|
1303
|
+
disabled: props.disabled,
|
|
1304
|
+
className: props.className
|
|
1305
|
+
});
|
|
1306
|
+
return;
|
|
1307
|
+
}
|
|
1308
|
+
if (child.type === OptGroup) {
|
|
1309
|
+
const props = child.props;
|
|
1310
|
+
result.push({
|
|
1311
|
+
label: props.label,
|
|
1312
|
+
className: props.className,
|
|
1313
|
+
options: optionsFromChildren(props.children).filter((option) => !isGroup(option))
|
|
1314
|
+
});
|
|
1315
|
+
}
|
|
1316
|
+
});
|
|
1317
|
+
return result;
|
|
1318
|
+
}
|
|
1319
|
+
function flattenOptions(options) {
|
|
1320
|
+
return options.flatMap((option) => isGroup(option) ? option.options : option);
|
|
1321
|
+
}
|
|
1322
|
+
function matchesOption(option, searchValue, filterOption) {
|
|
1323
|
+
if (!searchValue || filterOption === false) {
|
|
1324
|
+
return true;
|
|
1325
|
+
}
|
|
1326
|
+
if (typeof filterOption === "function") {
|
|
1327
|
+
return filterOption(searchValue, option);
|
|
1328
|
+
}
|
|
1329
|
+
const label = optionLabel(option);
|
|
1330
|
+
const text = typeof label === "string" || typeof label === "number" ? String(label) : String(option.value);
|
|
1331
|
+
return text.toLowerCase().includes(searchValue.toLowerCase());
|
|
1332
|
+
}
|
|
1333
|
+
function filterOptions(options, searchValue, filterOption) {
|
|
1334
|
+
return options.map((option) => {
|
|
1335
|
+
if (!isGroup(option)) {
|
|
1336
|
+
return matchesOption(option, searchValue, filterOption) ? option : null;
|
|
1337
|
+
}
|
|
1338
|
+
const groupOptions = option.options.filter((child) => matchesOption(child, searchValue, filterOption));
|
|
1339
|
+
return groupOptions.length > 0 ? { ...option, options: groupOptions } : null;
|
|
1340
|
+
}).filter((option) => option !== null);
|
|
1341
|
+
}
|
|
1342
|
+
function renderValue(option) {
|
|
1343
|
+
return option ? optionLabel(option) : null;
|
|
1344
|
+
}
|
|
1345
|
+
var Option = forwardRef5(({ children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
1346
|
+
...props,
|
|
1347
|
+
ref,
|
|
1348
|
+
children
|
|
1349
|
+
}));
|
|
1350
|
+
Option.displayName = "Select.Option";
|
|
1351
|
+
var OptGroup = forwardRef5(({ children, ...props }, ref) => /* @__PURE__ */ jsx7("div", {
|
|
1352
|
+
...props,
|
|
1353
|
+
ref,
|
|
1354
|
+
children
|
|
1355
|
+
}));
|
|
1356
|
+
OptGroup.displayName = "Select.OptGroup";
|
|
1357
|
+
var SelectRoot = forwardRef5(({
|
|
1358
|
+
allowClear,
|
|
1359
|
+
children,
|
|
1360
|
+
className,
|
|
1361
|
+
defaultValue,
|
|
1362
|
+
disabled,
|
|
1363
|
+
filterOption,
|
|
1364
|
+
loading,
|
|
1365
|
+
mode,
|
|
1366
|
+
onChange,
|
|
1367
|
+
options,
|
|
1368
|
+
placeholder,
|
|
1369
|
+
showSearch,
|
|
1370
|
+
size = "md",
|
|
1371
|
+
status,
|
|
1372
|
+
value,
|
|
1373
|
+
...props
|
|
1374
|
+
}, ref) => {
|
|
1375
|
+
const multiple = mode === "multiple" || mode === "tags";
|
|
1376
|
+
const sourceOptions = useMemo4(() => options ?? optionsFromChildren(children), [children, options]);
|
|
1377
|
+
const flatOptions = useMemo4(() => flattenOptions(sourceOptions), [sourceOptions]);
|
|
1378
|
+
const [open, setOpen] = useState5(false);
|
|
1379
|
+
const [searchValue, setSearchValue] = useState5("");
|
|
1380
|
+
const [internalValue, setInternalValue] = useState5(multiple ? normalizeMultiValue(defaultValue) : normalizeSingleValue(defaultValue));
|
|
1381
|
+
const controlled = value !== undefined;
|
|
1382
|
+
const currentValue = controlled ? value : internalValue;
|
|
1383
|
+
const selectedValues = multiple ? normalizeMultiValue(currentValue) : normalizeSingleValue(currentValue) === undefined ? [] : [normalizeSingleValue(currentValue)];
|
|
1384
|
+
const selectedKeys = new Set(selectedValues.map(valueKey));
|
|
1385
|
+
const selectedOptions = selectedValues.map((selectedValue) => flatOptions.find((option) => option.value === selectedValue) ?? {
|
|
1386
|
+
value: selectedValue,
|
|
1387
|
+
label: selectedValue
|
|
1388
|
+
});
|
|
1389
|
+
const visibleOptions = filterOptions(sourceOptions, searchValue, filterOption);
|
|
1390
|
+
const hasValue = selectedValues.length > 0;
|
|
1391
|
+
const searchable = showSearch || mode === "tags";
|
|
1392
|
+
function emitChange(nextValue) {
|
|
1393
|
+
if (!controlled) {
|
|
1394
|
+
setInternalValue(nextValue);
|
|
1395
|
+
}
|
|
1396
|
+
const nextValues = Array.isArray(nextValue) ? nextValue : nextValue === undefined ? [] : [nextValue];
|
|
1397
|
+
const nextOptions = nextValues.map((next) => flatOptions.find((option) => option.value === next) ?? {
|
|
1398
|
+
value: next,
|
|
1399
|
+
label: next
|
|
1400
|
+
});
|
|
1401
|
+
onChange?.(nextValue, multiple ? nextOptions : nextOptions[0]);
|
|
1402
|
+
}
|
|
1403
|
+
function selectOption(option) {
|
|
1404
|
+
if (disabled || loading || option.disabled) {
|
|
1405
|
+
return;
|
|
1406
|
+
}
|
|
1407
|
+
if (multiple) {
|
|
1408
|
+
const optionKey = valueKey(option.value);
|
|
1409
|
+
const nextValues = selectedKeys.has(optionKey) ? selectedValues.filter((item) => valueKey(item) !== optionKey) : [...selectedValues, option.value];
|
|
1410
|
+
emitChange(nextValues);
|
|
1411
|
+
} else {
|
|
1412
|
+
emitChange(option.value);
|
|
1413
|
+
setOpen(false);
|
|
1414
|
+
}
|
|
1415
|
+
setSearchValue("");
|
|
1416
|
+
}
|
|
1417
|
+
function clearValue(event) {
|
|
1418
|
+
event.stopPropagation();
|
|
1419
|
+
if (disabled || loading) {
|
|
1420
|
+
return;
|
|
1421
|
+
}
|
|
1422
|
+
emitChange(multiple ? [] : undefined);
|
|
1423
|
+
setSearchValue("");
|
|
1424
|
+
}
|
|
1425
|
+
function addTag() {
|
|
1426
|
+
const tag = searchValue.trim();
|
|
1427
|
+
if (mode !== "tags" || tag.length === 0) {
|
|
1428
|
+
return;
|
|
1429
|
+
}
|
|
1430
|
+
if (!selectedKeys.has(tag)) {
|
|
1431
|
+
emitChange([...selectedValues, tag]);
|
|
1432
|
+
}
|
|
1433
|
+
setSearchValue("");
|
|
1434
|
+
}
|
|
1435
|
+
function renderOption(option) {
|
|
1436
|
+
const selected = selectedKeys.has(valueKey(option.value));
|
|
1437
|
+
return /* @__PURE__ */ jsx7("button", {
|
|
1438
|
+
type: "button",
|
|
1439
|
+
role: "option",
|
|
1440
|
+
"aria-selected": selected,
|
|
1441
|
+
disabled: disabled || option.disabled,
|
|
1442
|
+
className: getSelectOptionClasses({
|
|
1443
|
+
selected,
|
|
1444
|
+
disabled: disabled || option.disabled,
|
|
1445
|
+
className: option.className
|
|
1446
|
+
}),
|
|
1447
|
+
onClick: () => selectOption(option),
|
|
1448
|
+
children: optionLabel(option)
|
|
1449
|
+
}, valueKey(option.value));
|
|
1450
|
+
}
|
|
1451
|
+
function renderOptions(optionItems) {
|
|
1452
|
+
return optionItems.map((option, index) => {
|
|
1453
|
+
if (!isGroup(option)) {
|
|
1454
|
+
return renderOption(option);
|
|
1455
|
+
}
|
|
1456
|
+
return /* @__PURE__ */ jsxs6("div", {
|
|
1457
|
+
className: cn(selectGroupClass, option.className),
|
|
1458
|
+
role: "group",
|
|
1459
|
+
children: [
|
|
1460
|
+
/* @__PURE__ */ jsx7("div", {
|
|
1461
|
+
className: selectGroupLabelClass,
|
|
1462
|
+
children: option.label
|
|
1463
|
+
}),
|
|
1464
|
+
option.options.map(renderOption)
|
|
1465
|
+
]
|
|
1466
|
+
}, `group-${index}`);
|
|
1467
|
+
});
|
|
1468
|
+
}
|
|
1469
|
+
const selection = multiple ? selectedOptions.map((option) => /* @__PURE__ */ jsx7("span", {
|
|
1470
|
+
className: selectTagClass,
|
|
1471
|
+
children: renderValue(option)
|
|
1472
|
+
}, valueKey(option.value))) : renderValue(selectedOptions[0]);
|
|
1473
|
+
return /* @__PURE__ */ jsxs6("div", {
|
|
1474
|
+
...props,
|
|
1475
|
+
ref,
|
|
1476
|
+
className: getSelectContainerClasses({
|
|
1477
|
+
open,
|
|
1478
|
+
loading,
|
|
1479
|
+
disabled,
|
|
1480
|
+
full: true,
|
|
1481
|
+
className
|
|
1482
|
+
}),
|
|
1483
|
+
children: [
|
|
1484
|
+
/* @__PURE__ */ jsxs6("button", {
|
|
1485
|
+
type: "button",
|
|
1486
|
+
className: getSelectClasses({ size, status, disabled }),
|
|
1487
|
+
disabled: disabled || loading,
|
|
1488
|
+
"aria-haspopup": "listbox",
|
|
1489
|
+
"aria-expanded": open,
|
|
1490
|
+
onClick: () => setOpen((current) => !current),
|
|
1491
|
+
children: [
|
|
1492
|
+
/* @__PURE__ */ jsx7("span", {
|
|
1493
|
+
className: selectSelectionClass,
|
|
1494
|
+
children: hasValue ? selection : /* @__PURE__ */ jsx7("span", {
|
|
1495
|
+
className: selectPlaceholderClass,
|
|
1496
|
+
children: placeholder
|
|
1497
|
+
})
|
|
1498
|
+
}),
|
|
1499
|
+
/* @__PURE__ */ jsx7("span", {
|
|
1500
|
+
className: selectIconClass,
|
|
1501
|
+
"aria-hidden": "true",
|
|
1502
|
+
children: "v"
|
|
1503
|
+
})
|
|
1504
|
+
]
|
|
1505
|
+
}),
|
|
1506
|
+
allowClear && hasValue && !disabled && !loading ? /* @__PURE__ */ jsx7("button", {
|
|
1507
|
+
type: "button",
|
|
1508
|
+
className: selectClearClass,
|
|
1509
|
+
"aria-label": "Clear selection",
|
|
1510
|
+
onClick: clearValue,
|
|
1511
|
+
children: "x"
|
|
1512
|
+
}) : null,
|
|
1513
|
+
open ? /* @__PURE__ */ jsxs6("div", {
|
|
1514
|
+
className: selectDropdownClass,
|
|
1515
|
+
role: "listbox",
|
|
1516
|
+
"aria-multiselectable": multiple || undefined,
|
|
1517
|
+
children: [
|
|
1518
|
+
searchable ? /* @__PURE__ */ jsx7("input", {
|
|
1519
|
+
className: selectSearchClass,
|
|
1520
|
+
value: searchValue,
|
|
1521
|
+
placeholder: typeof placeholder === "string" ? placeholder : undefined,
|
|
1522
|
+
onChange: (event) => setSearchValue(event.currentTarget.value),
|
|
1523
|
+
onKeyDown: (event) => {
|
|
1524
|
+
if (event.key === "Enter") {
|
|
1525
|
+
event.preventDefault();
|
|
1526
|
+
addTag();
|
|
1527
|
+
}
|
|
1528
|
+
}
|
|
1529
|
+
}) : null,
|
|
1530
|
+
visibleOptions.length > 0 ? renderOptions(visibleOptions) : /* @__PURE__ */ jsx7("div", {
|
|
1531
|
+
className: selectEmptyClass,
|
|
1532
|
+
children: "No data"
|
|
1533
|
+
})
|
|
1534
|
+
]
|
|
1535
|
+
}) : null
|
|
1536
|
+
]
|
|
1537
|
+
});
|
|
1538
|
+
});
|
|
1539
|
+
SelectRoot.displayName = "Select";
|
|
1540
|
+
var Select = SelectRoot;
|
|
1541
|
+
Select.Option = Option;
|
|
1542
|
+
Select.OptGroup = OptGroup;
|
|
1543
|
+
// src/components/dm-search/DmSearch.tsx
|
|
1544
|
+
import {
|
|
1545
|
+
forwardRef as forwardRef6,
|
|
1546
|
+
useEffect as useEffect2,
|
|
1547
|
+
useImperativeHandle as useImperativeHandle2,
|
|
1548
|
+
useMemo as useMemo5,
|
|
1549
|
+
useState as useState6
|
|
1550
|
+
} from "react";
|
|
1551
|
+
|
|
1552
|
+
// src/classes/dm-search.ts
|
|
1553
|
+
var dmSearchBaseClass = "dm-search";
|
|
1554
|
+
var dmSearchCompactClass = "dm-search-compact";
|
|
1555
|
+
var dmSearchCollapsedClass = "dm-search-collapsed";
|
|
1556
|
+
var dmSearchFieldsClass = "dm-search-fields";
|
|
1557
|
+
var dmSearchFieldClass = "dm-search-field";
|
|
1558
|
+
var dmSearchActionsClass = "dm-search-actions";
|
|
1559
|
+
var dmSearchFastFilterClass = "dm-search-fast-filter";
|
|
1560
|
+
function getDmSearchClasses({
|
|
1561
|
+
compact,
|
|
1562
|
+
collapsed,
|
|
1563
|
+
className
|
|
1564
|
+
}) {
|
|
1565
|
+
return cn(dmSearchBaseClass, compact && dmSearchCompactClass, collapsed && dmSearchCollapsedClass, className);
|
|
1566
|
+
}
|
|
1567
|
+
|
|
1568
|
+
// src/components/dm-search/DmSearch.tsx
|
|
1569
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1570
|
+
function initialValues(items, searchParams, useSearchParams = true) {
|
|
1571
|
+
return items.reduce((acc, item) => {
|
|
1572
|
+
const defaultValue = item.search.extraProps?.value ?? item.search.formProps?.initialValue;
|
|
1573
|
+
acc[item.dataIndex] = useSearchParams && searchParams && item.dataIndex in searchParams ? searchParams[item.dataIndex] : defaultValue;
|
|
1574
|
+
return acc;
|
|
1575
|
+
}, {});
|
|
1576
|
+
}
|
|
1577
|
+
function optionList(extraProps) {
|
|
1578
|
+
return Array.isArray(extraProps?.options) ? extraProps.options : [];
|
|
1579
|
+
}
|
|
1580
|
+
function renderField({
|
|
1581
|
+
item,
|
|
1582
|
+
value,
|
|
1583
|
+
setValue,
|
|
1584
|
+
loading,
|
|
1585
|
+
enableDefaultPlaceHolder
|
|
1586
|
+
}) {
|
|
1587
|
+
const extraProps = item.search.extraProps ?? {};
|
|
1588
|
+
const placeholder = extraProps.placeholder ?? (enableDefaultPlaceHolder ? item.search.type === "select" ? "Please select" : "Please enter" : undefined);
|
|
1589
|
+
if (item.search.type === "custom") {
|
|
1590
|
+
return item.search.render?.(value, setValue, item) ?? null;
|
|
1591
|
+
}
|
|
1592
|
+
if (item.search.type === "select") {
|
|
1593
|
+
return /* @__PURE__ */ jsx8(Select, {
|
|
1594
|
+
...extraProps,
|
|
1595
|
+
disabled: Boolean(loading || extraProps.disabled),
|
|
1596
|
+
value,
|
|
1597
|
+
placeholder,
|
|
1598
|
+
onChange: (nextValue) => setValue(nextValue)
|
|
1599
|
+
});
|
|
1600
|
+
}
|
|
1601
|
+
if (item.search.type === "dateRange") {
|
|
1602
|
+
return /* @__PURE__ */ jsx8(DatePicker.RangePicker, {
|
|
1603
|
+
...extraProps,
|
|
1604
|
+
value,
|
|
1605
|
+
onChange: (nextValue) => setValue(nextValue)
|
|
1606
|
+
});
|
|
1607
|
+
}
|
|
1608
|
+
if (item.search.type === "date") {
|
|
1609
|
+
return /* @__PURE__ */ jsx8(DatePicker, {
|
|
1610
|
+
...extraProps,
|
|
1611
|
+
value,
|
|
1612
|
+
onChange: (nextValue) => setValue(nextValue)
|
|
1613
|
+
});
|
|
1614
|
+
}
|
|
1615
|
+
if (item.search.type === "radio" || item.search.type === "checkbox") {
|
|
1616
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
1617
|
+
role: item.search.type === "radio" ? "radiogroup" : "group",
|
|
1618
|
+
children: optionList(extraProps).map((option) => /* @__PURE__ */ jsxs7("label", {
|
|
1619
|
+
children: [
|
|
1620
|
+
/* @__PURE__ */ jsx8("input", {
|
|
1621
|
+
type: item.search.type,
|
|
1622
|
+
disabled: loading,
|
|
1623
|
+
checked: item.search.type === "checkbox" ? Array.isArray(value) && value.includes(option.value) : value === option.value,
|
|
1624
|
+
onChange: (event) => {
|
|
1625
|
+
if (item.search.type === "radio") {
|
|
1626
|
+
setValue(option.value);
|
|
1627
|
+
return;
|
|
1628
|
+
}
|
|
1629
|
+
const current = Array.isArray(value) ? value : [];
|
|
1630
|
+
setValue(event.currentTarget.checked ? [...current, option.value] : current.filter((entry) => entry !== option.value));
|
|
1631
|
+
}
|
|
1632
|
+
}),
|
|
1633
|
+
option.label ?? option.value
|
|
1634
|
+
]
|
|
1635
|
+
}, String(option.value)))
|
|
1636
|
+
});
|
|
1637
|
+
}
|
|
1638
|
+
return /* @__PURE__ */ jsx8(Input, {
|
|
1639
|
+
...extraProps,
|
|
1640
|
+
type: item.search.type === "input-number" ? "number" : "text",
|
|
1641
|
+
disabled: Boolean(loading || extraProps.disabled),
|
|
1642
|
+
placeholder,
|
|
1643
|
+
value: value == null ? "" : String(value),
|
|
1644
|
+
onChange: (event) => setValue(event.currentTarget.value),
|
|
1645
|
+
onKeyDown: (event) => {
|
|
1646
|
+
if (event.key === "Enter") {
|
|
1647
|
+
event.currentTarget.form?.requestSubmit();
|
|
1648
|
+
}
|
|
1649
|
+
}
|
|
1650
|
+
});
|
|
1651
|
+
}
|
|
1652
|
+
var DmSearch = forwardRef6(({
|
|
1653
|
+
items = [],
|
|
1654
|
+
onSearch,
|
|
1655
|
+
extra,
|
|
1656
|
+
fastFilterItem,
|
|
1657
|
+
defaultCollapsed = true,
|
|
1658
|
+
hideCollapseBtn = false,
|
|
1659
|
+
compact = false,
|
|
1660
|
+
searchParams,
|
|
1661
|
+
loading = false,
|
|
1662
|
+
enableDefaultPlaceHolder = false,
|
|
1663
|
+
className
|
|
1664
|
+
}, ref) => {
|
|
1665
|
+
const allItems = useMemo5(() => fastFilterItem ? [fastFilterItem, ...items] : items, [fastFilterItem, items]);
|
|
1666
|
+
const [collapsed, setCollapsed] = useState6(defaultCollapsed);
|
|
1667
|
+
const [values, setValues] = useState6(() => initialValues(allItems, searchParams));
|
|
1668
|
+
const visibleItems = collapsed ? allItems.slice(0, 1) : allItems;
|
|
1669
|
+
useEffect2(() => {
|
|
1670
|
+
setValues(initialValues(allItems, searchParams));
|
|
1671
|
+
}, [allItems, searchParams]);
|
|
1672
|
+
function reset(useSearchParams = false) {
|
|
1673
|
+
const nextValues = initialValues(allItems, searchParams, useSearchParams);
|
|
1674
|
+
setValues(nextValues);
|
|
1675
|
+
return nextValues;
|
|
1676
|
+
}
|
|
1677
|
+
useImperativeHandle2(ref, () => ({
|
|
1678
|
+
onReset: () => {
|
|
1679
|
+
reset(false);
|
|
1680
|
+
}
|
|
1681
|
+
}));
|
|
1682
|
+
return /* @__PURE__ */ jsxs7("form", {
|
|
1683
|
+
id: "searchForm",
|
|
1684
|
+
className: getDmSearchClasses({ compact, collapsed, className }),
|
|
1685
|
+
onSubmit: (event) => {
|
|
1686
|
+
event.preventDefault();
|
|
1687
|
+
onSearch?.(values);
|
|
1688
|
+
},
|
|
1689
|
+
children: [
|
|
1690
|
+
fastFilterItem ? /* @__PURE__ */ jsx8("div", {
|
|
1691
|
+
className: dmSearchFastFilterClass,
|
|
1692
|
+
children: fastFilterItem.title
|
|
1693
|
+
}) : null,
|
|
1694
|
+
/* @__PURE__ */ jsx8("div", {
|
|
1695
|
+
className: dmSearchFieldsClass,
|
|
1696
|
+
children: visibleItems.map((item) => /* @__PURE__ */ jsxs7("label", {
|
|
1697
|
+
className: dmSearchFieldClass,
|
|
1698
|
+
children: [
|
|
1699
|
+
compact ? null : /* @__PURE__ */ jsx8("span", {
|
|
1700
|
+
children: item.title
|
|
1701
|
+
}),
|
|
1702
|
+
renderField({
|
|
1703
|
+
item,
|
|
1704
|
+
value: values[item.dataIndex],
|
|
1705
|
+
loading,
|
|
1706
|
+
enableDefaultPlaceHolder,
|
|
1707
|
+
setValue: (value) => setValues((current) => ({ ...current, [item.dataIndex]: value }))
|
|
1708
|
+
})
|
|
1709
|
+
]
|
|
1710
|
+
}, item.key))
|
|
1711
|
+
}),
|
|
1712
|
+
/* @__PURE__ */ jsxs7("div", {
|
|
1713
|
+
className: dmSearchActionsClass,
|
|
1714
|
+
children: [
|
|
1715
|
+
/* @__PURE__ */ jsx8(Button, {
|
|
1716
|
+
type: "submit",
|
|
1717
|
+
isLoading: loading,
|
|
1718
|
+
children: "Search"
|
|
1719
|
+
}),
|
|
1720
|
+
/* @__PURE__ */ jsx8(Button, {
|
|
1721
|
+
type: "button",
|
|
1722
|
+
color: "secondary",
|
|
1723
|
+
appearance: "outline",
|
|
1724
|
+
onClick: () => onSearch?.(reset(false)),
|
|
1725
|
+
children: "Reset"
|
|
1726
|
+
}),
|
|
1727
|
+
!hideCollapseBtn && allItems.length > 1 ? /* @__PURE__ */ jsx8(Button, {
|
|
1728
|
+
type: "button",
|
|
1729
|
+
color: "secondary",
|
|
1730
|
+
appearance: "text",
|
|
1731
|
+
onClick: () => {
|
|
1732
|
+
setCollapsed((current) => !current);
|
|
1733
|
+
setValues(initialValues(allItems, searchParams));
|
|
1734
|
+
},
|
|
1735
|
+
children: collapsed ? "Expand" : "Collapse"
|
|
1736
|
+
}) : null,
|
|
1737
|
+
extra
|
|
1738
|
+
]
|
|
1739
|
+
})
|
|
1740
|
+
]
|
|
1741
|
+
});
|
|
1742
|
+
});
|
|
1743
|
+
DmSearch.displayName = "DmSearch";
|
|
1744
|
+
// src/components/table/Table.tsx
|
|
1745
|
+
import React7, {
|
|
1746
|
+
forwardRef as forwardRef7,
|
|
1747
|
+
useMemo as useMemo6,
|
|
1748
|
+
useState as useState7
|
|
1749
|
+
} from "react";
|
|
1750
|
+
|
|
1751
|
+
// src/classes/table.ts
|
|
1752
|
+
var tableWrapperClass = "table-wrapper";
|
|
1753
|
+
var tableBaseClass = "table";
|
|
1754
|
+
var tableBorderedClass = "table-bordered";
|
|
1755
|
+
var tableLoadingClass = "table-loading";
|
|
1756
|
+
var tableSmallClass = "table-sm";
|
|
1757
|
+
var tableLargeClass = "table-lg";
|
|
1758
|
+
var tableHeaderCellClass = "table-header-cell";
|
|
1759
|
+
var tableCellClass = "table-cell";
|
|
1760
|
+
var tableRowClass = "table-row";
|
|
1761
|
+
var tableRowSelectedClass = "table-row-selected";
|
|
1762
|
+
var tableRowExpandedClass = "table-row-expanded";
|
|
1763
|
+
var tableEmptyClass = "table-empty";
|
|
1764
|
+
var tableLoadingIndicatorClass = "table-loading-indicator";
|
|
1765
|
+
var tableSorterClass = "table-sorter";
|
|
1766
|
+
var tableSorterActiveClass = "table-sorter-active";
|
|
1767
|
+
var tableFilterClass = "table-filter";
|
|
1768
|
+
var tableSelectionCellClass = "table-selection-cell";
|
|
1769
|
+
var tableExpandCellClass = "table-expand-cell";
|
|
1770
|
+
var tableExpandButtonClass = "table-expand-button";
|
|
1771
|
+
var tablePaginationClass = "table-pagination";
|
|
1772
|
+
var tablePaginationButtonClass = "table-pagination-button";
|
|
1773
|
+
var tablePaginationInfoClass = "table-pagination-info";
|
|
1774
|
+
function getTableWrapperClasses({
|
|
1775
|
+
loading,
|
|
1776
|
+
className
|
|
1777
|
+
}) {
|
|
1778
|
+
return cn(tableWrapperClass, loading && tableLoadingClass, className);
|
|
1779
|
+
}
|
|
1780
|
+
function getTableClasses({
|
|
1781
|
+
bordered,
|
|
1782
|
+
size
|
|
1783
|
+
}) {
|
|
1784
|
+
return cn(tableBaseClass, bordered && tableBorderedClass, size === "small" && tableSmallClass, size === "large" && tableLargeClass);
|
|
1785
|
+
}
|
|
1786
|
+
function getTableRowClasses({
|
|
1787
|
+
selected,
|
|
1788
|
+
expanded,
|
|
1789
|
+
className
|
|
1790
|
+
}) {
|
|
1791
|
+
return cn(tableRowClass, selected && tableRowSelectedClass, expanded && tableRowExpandedClass, className);
|
|
1792
|
+
}
|
|
1793
|
+
function getTableSorterClasses(active) {
|
|
1794
|
+
return cn(tableSorterClass, active && tableSorterActiveClass);
|
|
1795
|
+
}
|
|
1796
|
+
|
|
1797
|
+
// src/components/table/Table.tsx
|
|
1798
|
+
import { jsx as jsx9, jsxs as jsxs8 } from "react/jsx-runtime";
|
|
1799
|
+
import { createElement } from "react";
|
|
1800
|
+
var defaultPageSize = 10;
|
|
1801
|
+
var defaultSortDirections = ["ascend", "descend", null];
|
|
1802
|
+
function hasNode(node) {
|
|
1803
|
+
return node !== undefined && node !== null && node !== false;
|
|
1804
|
+
}
|
|
1805
|
+
function textFromNode(node, fallback) {
|
|
1806
|
+
return typeof node === "string" || typeof node === "number" ? String(node) : fallback;
|
|
1807
|
+
}
|
|
1808
|
+
function dataIndexKey(dataIndex) {
|
|
1809
|
+
if (dataIndex === undefined) {
|
|
1810
|
+
return;
|
|
1811
|
+
}
|
|
1812
|
+
return typeof dataIndex === "string" || typeof dataIndex === "number" ? dataIndex : Array.from(dataIndex).join(".");
|
|
1813
|
+
}
|
|
1814
|
+
function getValue(record, dataIndex) {
|
|
1815
|
+
if (dataIndex === undefined) {
|
|
1816
|
+
return;
|
|
1817
|
+
}
|
|
1818
|
+
const path = Array.isArray(dataIndex) ? dataIndex : [dataIndex];
|
|
1819
|
+
return path.reduce((current, key) => {
|
|
1820
|
+
if (current === null || current === undefined) {
|
|
1821
|
+
return;
|
|
1822
|
+
}
|
|
1823
|
+
return current[key];
|
|
1824
|
+
}, record);
|
|
1825
|
+
}
|
|
1826
|
+
function getRecordKey(record, index, rowKey) {
|
|
1827
|
+
if (typeof rowKey === "function") {
|
|
1828
|
+
return rowKey(record, index);
|
|
1829
|
+
}
|
|
1830
|
+
if (rowKey) {
|
|
1831
|
+
const key2 = record[rowKey];
|
|
1832
|
+
return typeof key2 === "string" || typeof key2 === "number" ? key2 : index;
|
|
1833
|
+
}
|
|
1834
|
+
const key = record.key;
|
|
1835
|
+
return typeof key === "string" || typeof key === "number" ? key : index;
|
|
1836
|
+
}
|
|
1837
|
+
function normalizeKeys(keys) {
|
|
1838
|
+
return keys?.map(String) ?? [];
|
|
1839
|
+
}
|
|
1840
|
+
function normalizeColumns(columns, prefix = "column") {
|
|
1841
|
+
return columns.map((column, index) => {
|
|
1842
|
+
const rawKey = column.key ?? dataIndexKey(column.dataIndex) ?? `${prefix}-${index}`;
|
|
1843
|
+
return {
|
|
1844
|
+
...column,
|
|
1845
|
+
columnKey: rawKey,
|
|
1846
|
+
children: column.children ? normalizeColumns(column.children, String(rawKey)) : undefined
|
|
1847
|
+
};
|
|
1848
|
+
});
|
|
1849
|
+
}
|
|
1850
|
+
function leafColumns(columns) {
|
|
1851
|
+
return columns.flatMap((column) => column.children?.length ? leafColumns(column.children) : [column]);
|
|
1852
|
+
}
|
|
1853
|
+
function getDepth(columns) {
|
|
1854
|
+
if (columns.length === 0) {
|
|
1855
|
+
return 1;
|
|
1856
|
+
}
|
|
1857
|
+
return Math.max(...columns.map((column) => column.children?.length ? 1 + getDepth(column.children) : 1));
|
|
1858
|
+
}
|
|
1859
|
+
function getLeafCount(column) {
|
|
1860
|
+
return column.children?.length ? column.children.reduce((count, child) => count + getLeafCount(child), 0) : 1;
|
|
1861
|
+
}
|
|
1862
|
+
function buildHeaderRows(columns, depth, level = 0, rows = []) {
|
|
1863
|
+
rows[level] ??= [];
|
|
1864
|
+
columns.forEach((column) => {
|
|
1865
|
+
const grouped = Boolean(column.children?.length);
|
|
1866
|
+
rows[level].push({
|
|
1867
|
+
column,
|
|
1868
|
+
colSpan: grouped ? getLeafCount(column) : 1,
|
|
1869
|
+
rowSpan: grouped ? 1 : depth - level
|
|
1870
|
+
});
|
|
1871
|
+
if (column.children?.length) {
|
|
1872
|
+
buildHeaderRows(column.children, depth, level + 1, rows);
|
|
1873
|
+
}
|
|
1874
|
+
});
|
|
1875
|
+
return rows;
|
|
1876
|
+
}
|
|
1877
|
+
function optionValues(filters) {
|
|
1878
|
+
return (filters ?? []).flatMap((filter) => [
|
|
1879
|
+
filter,
|
|
1880
|
+
...filter.children ?? []
|
|
1881
|
+
]);
|
|
1882
|
+
}
|
|
1883
|
+
function sortCompare(sorter) {
|
|
1884
|
+
if (typeof sorter === "function") {
|
|
1885
|
+
return sorter;
|
|
1886
|
+
}
|
|
1887
|
+
if (typeof sorter === "object" && sorter.compare) {
|
|
1888
|
+
return sorter.compare;
|
|
1889
|
+
}
|
|
1890
|
+
return;
|
|
1891
|
+
}
|
|
1892
|
+
function sortOrderFor(column, sortStates) {
|
|
1893
|
+
if (column.sortOrder !== undefined) {
|
|
1894
|
+
return column.sortOrder;
|
|
1895
|
+
}
|
|
1896
|
+
return sortStates[String(column.columnKey)] ?? column.defaultSortOrder;
|
|
1897
|
+
}
|
|
1898
|
+
function filterValueFor(column, filterStates) {
|
|
1899
|
+
if (column.filteredValue !== undefined) {
|
|
1900
|
+
return column.filteredValue;
|
|
1901
|
+
}
|
|
1902
|
+
const state = filterStates[String(column.columnKey)];
|
|
1903
|
+
return state !== undefined ? state : column.defaultFilteredValue;
|
|
1904
|
+
}
|
|
1905
|
+
function nextSortOrder(column, current) {
|
|
1906
|
+
const directions = column.sortDirections ?? defaultSortDirections;
|
|
1907
|
+
const index = directions.findIndex((order) => order === (current ?? null));
|
|
1908
|
+
return directions[(index + 1) % directions.length] ?? null;
|
|
1909
|
+
}
|
|
1910
|
+
function selectedRowsForKeys(data, keys, rowKey) {
|
|
1911
|
+
const keySet = new Set(normalizeKeys(keys));
|
|
1912
|
+
return data.filter((record, index) => keySet.has(String(getRecordKey(record, index, rowKey))));
|
|
1913
|
+
}
|
|
1914
|
+
var Column = forwardRef7(() => null);
|
|
1915
|
+
Column.displayName = "Table.Column";
|
|
1916
|
+
var ColumnGroup = forwardRef7(() => null);
|
|
1917
|
+
ColumnGroup.displayName = "Table.ColumnGroup";
|
|
1918
|
+
var SummaryRow = forwardRef7((props, ref) => /* @__PURE__ */ jsx9("tr", {
|
|
1919
|
+
...props,
|
|
1920
|
+
ref
|
|
1921
|
+
}));
|
|
1922
|
+
SummaryRow.displayName = "Table.Summary.Row";
|
|
1923
|
+
var SummaryCell = forwardRef7(({ index, ...props }, ref) => {
|
|
1924
|
+
return /* @__PURE__ */ jsx9("td", {
|
|
1925
|
+
...props,
|
|
1926
|
+
ref
|
|
1927
|
+
});
|
|
1928
|
+
});
|
|
1929
|
+
SummaryCell.displayName = "Table.Summary.Cell";
|
|
1930
|
+
var Summary = Object.assign(forwardRef7(({ fixed, ...props }, ref) => {
|
|
1931
|
+
return /* @__PURE__ */ jsx9("tfoot", {
|
|
1932
|
+
...props,
|
|
1933
|
+
ref
|
|
1934
|
+
});
|
|
1935
|
+
}), {
|
|
1936
|
+
Row: SummaryRow,
|
|
1937
|
+
Cell: SummaryCell
|
|
1938
|
+
});
|
|
1939
|
+
Summary.displayName = "Table.Summary";
|
|
1940
|
+
function columnsFromChildren(children) {
|
|
1941
|
+
return React7.Children.toArray(children).flatMap((child) => {
|
|
1942
|
+
if (!React7.isValidElement(child)) {
|
|
1943
|
+
return [];
|
|
1944
|
+
}
|
|
1945
|
+
if (child.type === Column) {
|
|
1946
|
+
const props = child.props;
|
|
1947
|
+
const { children: columnChildren, ...column } = props;
|
|
1948
|
+
return [column];
|
|
1949
|
+
}
|
|
1950
|
+
if (child.type === ColumnGroup) {
|
|
1951
|
+
const props = child.props;
|
|
1952
|
+
const { children: groupChildren, ...column } = props;
|
|
1953
|
+
return [
|
|
1954
|
+
{
|
|
1955
|
+
...column,
|
|
1956
|
+
children: columnsFromChildren(groupChildren)
|
|
1957
|
+
}
|
|
1958
|
+
];
|
|
1959
|
+
}
|
|
1960
|
+
return [];
|
|
1961
|
+
});
|
|
1962
|
+
}
|
|
1963
|
+
function renderSummary(summary, pageData, colSpan) {
|
|
1964
|
+
if (!summary) {
|
|
1965
|
+
return null;
|
|
1966
|
+
}
|
|
1967
|
+
const node = summary(pageData);
|
|
1968
|
+
if (React7.isValidElement(node) && node.type === Summary) {
|
|
1969
|
+
return node;
|
|
1970
|
+
}
|
|
1971
|
+
return /* @__PURE__ */ jsx9("tfoot", {
|
|
1972
|
+
children: /* @__PURE__ */ jsx9("tr", {
|
|
1973
|
+
children: /* @__PURE__ */ jsx9("td", {
|
|
1974
|
+
className: tableCellClass,
|
|
1975
|
+
colSpan,
|
|
1976
|
+
children: node
|
|
1977
|
+
})
|
|
1978
|
+
})
|
|
1979
|
+
});
|
|
1980
|
+
}
|
|
1981
|
+
function resolvePagination(pagination, total) {
|
|
1982
|
+
if (pagination === false) {
|
|
1983
|
+
return null;
|
|
1984
|
+
}
|
|
1985
|
+
const config = pagination ?? {};
|
|
1986
|
+
return {
|
|
1987
|
+
current: config.current,
|
|
1988
|
+
defaultCurrent: config.defaultCurrent ?? 1,
|
|
1989
|
+
pageSize: config.pageSize,
|
|
1990
|
+
defaultPageSize: config.defaultPageSize ?? defaultPageSize,
|
|
1991
|
+
total: config.total ?? total,
|
|
1992
|
+
disabled: config.disabled,
|
|
1993
|
+
hideOnSinglePage: config.hideOnSinglePage,
|
|
1994
|
+
showTotal: config.showTotal,
|
|
1995
|
+
onChange: config.onChange
|
|
1996
|
+
};
|
|
1997
|
+
}
|
|
1998
|
+
function TableRoot({
|
|
1999
|
+
columns,
|
|
2000
|
+
dataSource = [],
|
|
2001
|
+
rowKey,
|
|
2002
|
+
loading,
|
|
2003
|
+
bordered,
|
|
2004
|
+
size = "middle",
|
|
2005
|
+
pagination,
|
|
2006
|
+
rowSelection,
|
|
2007
|
+
expandable,
|
|
2008
|
+
summary,
|
|
2009
|
+
locale,
|
|
2010
|
+
tableLayout,
|
|
2011
|
+
scroll,
|
|
2012
|
+
onChange,
|
|
2013
|
+
children,
|
|
2014
|
+
className,
|
|
2015
|
+
...props
|
|
2016
|
+
}, ref) {
|
|
2017
|
+
const childColumns = useMemo6(() => columnsFromChildren(children), [children]);
|
|
2018
|
+
const normalizedColumns = useMemo6(() => normalizeColumns(columns ?? childColumns), [childColumns, columns]);
|
|
2019
|
+
const leaves = useMemo6(() => leafColumns(normalizedColumns), [normalizedColumns]);
|
|
2020
|
+
const headerRows = useMemo6(() => buildHeaderRows(normalizedColumns, getDepth(normalizedColumns)), [normalizedColumns]);
|
|
2021
|
+
const [sortStates, setSortStates] = useState7({});
|
|
2022
|
+
const [filterStates, setFilterStates] = useState7({});
|
|
2023
|
+
const [internalCurrent, setInternalCurrent] = useState7(1);
|
|
2024
|
+
const [internalPageSize, setInternalPageSize] = useState7(defaultPageSize);
|
|
2025
|
+
const [internalSelectedKeys, setInternalSelectedKeys] = useState7(rowSelection?.defaultSelectedRowKeys ?? []);
|
|
2026
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState7(expandable?.defaultExpandedRowKeys ?? []);
|
|
2027
|
+
const spinning = typeof loading === "object" ? loading.spinning : Boolean(loading);
|
|
2028
|
+
const activeFilters = useMemo6(() => {
|
|
2029
|
+
return leaves.reduce((result, column) => {
|
|
2030
|
+
const value = filterValueFor(column, filterStates) ?? null;
|
|
2031
|
+
if (value !== null) {
|
|
2032
|
+
result[String(column.columnKey)] = value;
|
|
2033
|
+
}
|
|
2034
|
+
return result;
|
|
2035
|
+
}, {});
|
|
2036
|
+
}, [filterStates, leaves]);
|
|
2037
|
+
const activeSorter = useMemo6(() => {
|
|
2038
|
+
const column = leaves.find((item) => sortOrderFor(item, sortStates));
|
|
2039
|
+
if (!column) {
|
|
2040
|
+
return {};
|
|
2041
|
+
}
|
|
2042
|
+
return {
|
|
2043
|
+
column,
|
|
2044
|
+
columnKey: column.columnKey,
|
|
2045
|
+
field: column.dataIndex,
|
|
2046
|
+
order: sortOrderFor(column, sortStates) ?? null
|
|
2047
|
+
};
|
|
2048
|
+
}, [leaves, sortStates]);
|
|
2049
|
+
const filteredData = useMemo6(() => {
|
|
2050
|
+
return leaves.reduce((records, column) => {
|
|
2051
|
+
const values = filterValueFor(column, filterStates);
|
|
2052
|
+
if (!values?.length || !column.onFilter) {
|
|
2053
|
+
return records;
|
|
2054
|
+
}
|
|
2055
|
+
return records.filter((record) => values.some((value) => column.onFilter?.(value, record)));
|
|
2056
|
+
}, dataSource);
|
|
2057
|
+
}, [dataSource, filterStates, leaves]);
|
|
2058
|
+
const sortedData = useMemo6(() => {
|
|
2059
|
+
const sorterColumn = leaves.find((column) => sortOrderFor(column, sortStates));
|
|
2060
|
+
const order = sorterColumn ? sortOrderFor(sorterColumn, sortStates) : null;
|
|
2061
|
+
const compare = sorterColumn ? sortCompare(sorterColumn.sorter) : undefined;
|
|
2062
|
+
if (!sorterColumn || !order || !compare) {
|
|
2063
|
+
return filteredData;
|
|
2064
|
+
}
|
|
2065
|
+
return [...filteredData].sort((first, second) => {
|
|
2066
|
+
const result = compare(first, second);
|
|
2067
|
+
return order === "descend" ? -result : result;
|
|
2068
|
+
});
|
|
2069
|
+
}, [filteredData, leaves, sortStates]);
|
|
2070
|
+
const paginationConfig = resolvePagination(pagination, sortedData.length);
|
|
2071
|
+
const pageSize = Math.max(1, Math.floor(paginationConfig?.pageSize ?? (internalPageSize === defaultPageSize ? paginationConfig?.defaultPageSize : internalPageSize) ?? defaultPageSize));
|
|
2072
|
+
const pageCount = paginationConfig ? Math.max(1, Math.ceil(Math.max(0, paginationConfig.total ?? sortedData.length) / pageSize)) : 1;
|
|
2073
|
+
const current = paginationConfig ? Math.min(pageCount, Math.max(1, Math.floor(paginationConfig.current ?? internalCurrent ?? paginationConfig.defaultCurrent ?? 1))) : 1;
|
|
2074
|
+
const pageData = paginationConfig ? sortedData.slice((current - 1) * pageSize, current * pageSize) : sortedData;
|
|
2075
|
+
const selectedKeys = rowSelection?.selectedRowKeys ?? internalSelectedKeys;
|
|
2076
|
+
const selectedKeySet = new Set(normalizeKeys(selectedKeys));
|
|
2077
|
+
const expandedKeys = expandable?.expandedRowKeys ?? internalExpandedKeys;
|
|
2078
|
+
const expandedKeySet = new Set(normalizeKeys(expandedKeys));
|
|
2079
|
+
const hasSelection = Boolean(rowSelection);
|
|
2080
|
+
const hasExpandable = Boolean(expandable?.expandedRowRender);
|
|
2081
|
+
const structuralColumnCount = leaves.length + (hasSelection ? 1 : 0) + (hasExpandable ? 1 : 0);
|
|
2082
|
+
const bodyEmpty = pageData.length === 0;
|
|
2083
|
+
function emitTableChange(nextPagination, nextFilters, nextSorter, action) {
|
|
2084
|
+
onChange?.(nextPagination, nextFilters, nextSorter, {
|
|
2085
|
+
currentDataSource: sortedData,
|
|
2086
|
+
action
|
|
2087
|
+
});
|
|
2088
|
+
}
|
|
2089
|
+
function changePage(nextPage, nextPageSize = pageSize) {
|
|
2090
|
+
if (!paginationConfig || paginationConfig.disabled) {
|
|
2091
|
+
return;
|
|
2092
|
+
}
|
|
2093
|
+
const nextPageCount = Math.max(1, Math.ceil((paginationConfig.total ?? sortedData.length) / nextPageSize));
|
|
2094
|
+
const normalizedPage = Math.min(nextPageCount, Math.max(1, nextPage));
|
|
2095
|
+
if (paginationConfig.current === undefined) {
|
|
2096
|
+
setInternalCurrent(normalizedPage);
|
|
2097
|
+
}
|
|
2098
|
+
if (paginationConfig.pageSize === undefined) {
|
|
2099
|
+
setInternalPageSize(nextPageSize);
|
|
2100
|
+
}
|
|
2101
|
+
paginationConfig.onChange?.(normalizedPage, nextPageSize);
|
|
2102
|
+
emitTableChange({ ...paginationConfig, current: normalizedPage, pageSize: nextPageSize }, activeFilters, activeSorter, "paginate");
|
|
2103
|
+
}
|
|
2104
|
+
function changeSorter(column) {
|
|
2105
|
+
if (!column.sorter) {
|
|
2106
|
+
return;
|
|
2107
|
+
}
|
|
2108
|
+
const nextOrder = nextSortOrder(column, sortOrderFor(column, sortStates));
|
|
2109
|
+
const nextSortStates = { [String(column.columnKey)]: nextOrder };
|
|
2110
|
+
const nextSorter = nextOrder ? {
|
|
2111
|
+
column,
|
|
2112
|
+
columnKey: column.columnKey,
|
|
2113
|
+
field: column.dataIndex,
|
|
2114
|
+
order: nextOrder
|
|
2115
|
+
} : {};
|
|
2116
|
+
setSortStates(nextSortStates);
|
|
2117
|
+
setInternalCurrent(1);
|
|
2118
|
+
emitTableChange({ ...paginationConfig ?? {}, current: 1, pageSize }, activeFilters, nextSorter, "sort");
|
|
2119
|
+
}
|
|
2120
|
+
function changeFilter(column, event) {
|
|
2121
|
+
const selected = Array.from(event.currentTarget.selectedOptions).map((option) => option.value).filter((value) => value !== "");
|
|
2122
|
+
const nextValue = selected.length > 0 ? selected : null;
|
|
2123
|
+
const nextFilters = {
|
|
2124
|
+
...activeFilters,
|
|
2125
|
+
[String(column.columnKey)]: nextValue
|
|
2126
|
+
};
|
|
2127
|
+
if (nextValue === null) {
|
|
2128
|
+
delete nextFilters[String(column.columnKey)];
|
|
2129
|
+
}
|
|
2130
|
+
setFilterStates((currentFilters) => ({
|
|
2131
|
+
...currentFilters,
|
|
2132
|
+
[String(column.columnKey)]: nextValue
|
|
2133
|
+
}));
|
|
2134
|
+
setInternalCurrent(1);
|
|
2135
|
+
emitTableChange({ ...paginationConfig ?? {}, current: 1, pageSize }, nextFilters, activeSorter, "filter");
|
|
2136
|
+
}
|
|
2137
|
+
function commitSelection(nextKeys, nativeEvent, changedRecord, selected, changedRows) {
|
|
2138
|
+
if (!rowSelection) {
|
|
2139
|
+
return;
|
|
2140
|
+
}
|
|
2141
|
+
const normalizedNextKeys = Array.from(new Set(nextKeys.map(String)));
|
|
2142
|
+
const originalKeys = normalizedNextKeys.map((key) => {
|
|
2143
|
+
const index = dataSource.findIndex((record, itemIndex) => String(getRecordKey(record, itemIndex, rowKey)) === key);
|
|
2144
|
+
return index >= 0 ? getRecordKey(dataSource[index], index, rowKey) : key;
|
|
2145
|
+
});
|
|
2146
|
+
const selectedRows = selectedRowsForKeys(dataSource, originalKeys, rowKey);
|
|
2147
|
+
if (rowSelection.selectedRowKeys === undefined) {
|
|
2148
|
+
setInternalSelectedKeys(originalKeys);
|
|
2149
|
+
}
|
|
2150
|
+
rowSelection.onChange?.(originalKeys, selectedRows);
|
|
2151
|
+
if (changedRecord && selected !== undefined) {
|
|
2152
|
+
rowSelection.onSelect?.(changedRecord, selected, selectedRows, nativeEvent);
|
|
2153
|
+
}
|
|
2154
|
+
if (changedRows) {
|
|
2155
|
+
rowSelection.onSelectAll?.(Boolean(selected), selectedRows, changedRows);
|
|
2156
|
+
}
|
|
2157
|
+
}
|
|
2158
|
+
function toggleRowSelection(record, index, event) {
|
|
2159
|
+
if (!rowSelection) {
|
|
2160
|
+
return;
|
|
2161
|
+
}
|
|
2162
|
+
const key = getRecordKey(record, index, rowKey);
|
|
2163
|
+
const keyString = String(key);
|
|
2164
|
+
const checked = event.currentTarget.checked;
|
|
2165
|
+
const nextKeys = rowSelection.type === "radio" ? checked ? [key] : [] : checked ? [...selectedKeys, key] : selectedKeys.filter((selectedKey) => String(selectedKey) !== keyString);
|
|
2166
|
+
commitSelection(nextKeys, event.nativeEvent, record, checked);
|
|
2167
|
+
}
|
|
2168
|
+
function toggleAllRows(event) {
|
|
2169
|
+
if (!rowSelection) {
|
|
2170
|
+
return;
|
|
2171
|
+
}
|
|
2172
|
+
const checked = event.currentTarget.checked;
|
|
2173
|
+
const selectableRows = pageData.filter((record, index) => {
|
|
2174
|
+
const checkboxProps = rowSelection.getCheckboxProps?.(record);
|
|
2175
|
+
return !checkboxProps?.disabled && getRecordKey(record, index, rowKey) !== undefined;
|
|
2176
|
+
});
|
|
2177
|
+
const pageKeys = selectableRows.map((record, index) => getRecordKey(record, index, rowKey));
|
|
2178
|
+
const pageKeySet = new Set(normalizeKeys(pageKeys));
|
|
2179
|
+
const nextKeys = checked ? [...selectedKeys, ...pageKeys] : selectedKeys.filter((key) => !pageKeySet.has(String(key)));
|
|
2180
|
+
commitSelection(nextKeys, event.nativeEvent, undefined, checked, selectableRows);
|
|
2181
|
+
}
|
|
2182
|
+
function toggleExpand(record, index) {
|
|
2183
|
+
if (!expandable?.expandedRowRender) {
|
|
2184
|
+
return;
|
|
2185
|
+
}
|
|
2186
|
+
const key = getRecordKey(record, index, rowKey);
|
|
2187
|
+
const keyString = String(key);
|
|
2188
|
+
const expanded = !expandedKeySet.has(keyString);
|
|
2189
|
+
const nextKeys = expanded ? [...expandedKeys, key] : expandedKeys.filter((expandedKey) => String(expandedKey) !== keyString);
|
|
2190
|
+
if (expandable.expandedRowKeys === undefined) {
|
|
2191
|
+
setInternalExpandedKeys(nextKeys);
|
|
2192
|
+
}
|
|
2193
|
+
expandable.onExpand?.(expanded, record);
|
|
2194
|
+
expandable.onExpandedRowsChange?.(nextKeys);
|
|
2195
|
+
}
|
|
2196
|
+
function renderSelectionHeader() {
|
|
2197
|
+
if (!rowSelection) {
|
|
2198
|
+
return null;
|
|
2199
|
+
}
|
|
2200
|
+
if (rowSelection.type === "radio" || rowSelection.hideSelectAll) {
|
|
2201
|
+
return /* @__PURE__ */ jsx9("th", {
|
|
2202
|
+
className: cn(tableHeaderCellClass, tableSelectionCellClass),
|
|
2203
|
+
children: rowSelection.columnTitle
|
|
2204
|
+
});
|
|
2205
|
+
}
|
|
2206
|
+
const pageKeys = pageData.map((record, index) => getRecordKey(record, index, rowKey));
|
|
2207
|
+
const allSelected = pageKeys.length > 0 && pageKeys.every((key) => selectedKeySet.has(String(key)));
|
|
2208
|
+
return /* @__PURE__ */ jsx9("th", {
|
|
2209
|
+
className: cn(tableHeaderCellClass, tableSelectionCellClass),
|
|
2210
|
+
children: /* @__PURE__ */ jsxs8("label", {
|
|
2211
|
+
children: [
|
|
2212
|
+
/* @__PURE__ */ jsx9("input", {
|
|
2213
|
+
type: "checkbox",
|
|
2214
|
+
"aria-label": "Select all rows",
|
|
2215
|
+
checked: allSelected,
|
|
2216
|
+
onChange: toggleAllRows
|
|
2217
|
+
}),
|
|
2218
|
+
hasNode(rowSelection.columnTitle) ? rowSelection.columnTitle : null
|
|
2219
|
+
]
|
|
2220
|
+
})
|
|
2221
|
+
});
|
|
2222
|
+
}
|
|
2223
|
+
function renderHeaderCell(cell, index) {
|
|
2224
|
+
const { column } = cell;
|
|
2225
|
+
const title = column.title ?? dataIndexKey(column.dataIndex) ?? index + 1;
|
|
2226
|
+
const sortOrder = sortOrderFor(column, sortStates);
|
|
2227
|
+
const headerProps = column.onHeaderCell?.(column) ?? {};
|
|
2228
|
+
return /* @__PURE__ */ createElement("th", {
|
|
2229
|
+
...headerProps,
|
|
2230
|
+
key: String(column.columnKey),
|
|
2231
|
+
className: cn(tableHeaderCellClass, column.className, headerProps.className),
|
|
2232
|
+
colSpan: cell.colSpan,
|
|
2233
|
+
rowSpan: cell.rowSpan,
|
|
2234
|
+
style: {
|
|
2235
|
+
width: column.width,
|
|
2236
|
+
textAlign: column.align,
|
|
2237
|
+
...headerProps.style
|
|
2238
|
+
}
|
|
2239
|
+
}, /* @__PURE__ */ jsx9("span", {
|
|
2240
|
+
children: title
|
|
2241
|
+
}), column.sorter ? /* @__PURE__ */ jsx9("button", {
|
|
2242
|
+
type: "button",
|
|
2243
|
+
className: getTableSorterClasses(Boolean(sortOrder)),
|
|
2244
|
+
"aria-label": `Sort ${textFromNode(title, String(column.columnKey))}`,
|
|
2245
|
+
onClick: () => changeSorter(column),
|
|
2246
|
+
children: sortOrder === "ascend" ? "Asc" : sortOrder === "descend" ? "Desc" : "Sort"
|
|
2247
|
+
}) : null, column.filters?.length ? /* @__PURE__ */ jsxs8("select", {
|
|
2248
|
+
className: tableFilterClass,
|
|
2249
|
+
"aria-label": `Filter ${textFromNode(title, String(column.columnKey))}`,
|
|
2250
|
+
multiple: column.filterMultiple !== false,
|
|
2251
|
+
value: column.filterMultiple === false ? String((filterValueFor(column, filterStates) ?? [])[0] ?? "") : (filterValueFor(column, filterStates) ?? []).map(String),
|
|
2252
|
+
onChange: (event) => changeFilter(column, event),
|
|
2253
|
+
children: [
|
|
2254
|
+
column.filterMultiple === false ? /* @__PURE__ */ jsx9("option", {
|
|
2255
|
+
value: "",
|
|
2256
|
+
children: "All"
|
|
2257
|
+
}) : null,
|
|
2258
|
+
optionValues(column.filters).map((filter) => /* @__PURE__ */ jsx9("option", {
|
|
2259
|
+
value: String(filter.value),
|
|
2260
|
+
children: filter.text
|
|
2261
|
+
}, String(filter.value)))
|
|
2262
|
+
]
|
|
2263
|
+
}) : null);
|
|
2264
|
+
}
|
|
2265
|
+
function renderCell(record, recordIndex, column) {
|
|
2266
|
+
const value = getValue(record, column.dataIndex);
|
|
2267
|
+
const rendered = column.render ? column.render(value, record, recordIndex) : value;
|
|
2268
|
+
const cellProps = column.onCell?.(record, recordIndex) ?? {};
|
|
2269
|
+
return /* @__PURE__ */ createElement("td", {
|
|
2270
|
+
...cellProps,
|
|
2271
|
+
key: String(column.columnKey),
|
|
2272
|
+
className: cn(tableCellClass, column.className, cellProps.className),
|
|
2273
|
+
style: { textAlign: column.align, ...cellProps.style }
|
|
2274
|
+
}, hasNode(rendered) ? rendered : null);
|
|
2275
|
+
}
|
|
2276
|
+
function renderSelectionCell(record, index) {
|
|
2277
|
+
if (!rowSelection) {
|
|
2278
|
+
return null;
|
|
2279
|
+
}
|
|
2280
|
+
const key = getRecordKey(record, index, rowKey);
|
|
2281
|
+
const checked = selectedKeySet.has(String(key));
|
|
2282
|
+
const checkboxProps = rowSelection.getCheckboxProps?.(record) ?? {};
|
|
2283
|
+
const originNode = /* @__PURE__ */ jsx9("input", {
|
|
2284
|
+
...checkboxProps,
|
|
2285
|
+
type: rowSelection.type === "radio" ? "radio" : "checkbox",
|
|
2286
|
+
"aria-label": `Select row ${index + 1}`,
|
|
2287
|
+
checked,
|
|
2288
|
+
onChange: (event) => toggleRowSelection(record, index, event)
|
|
2289
|
+
});
|
|
2290
|
+
return /* @__PURE__ */ jsx9("td", {
|
|
2291
|
+
className: cn(tableCellClass, tableSelectionCellClass),
|
|
2292
|
+
children: rowSelection.renderCell ? rowSelection.renderCell(checked, record, index, originNode) : originNode
|
|
2293
|
+
});
|
|
2294
|
+
}
|
|
2295
|
+
function renderExpandCell(record, index) {
|
|
2296
|
+
if (!expandable?.expandedRowRender) {
|
|
2297
|
+
return null;
|
|
2298
|
+
}
|
|
2299
|
+
const key = getRecordKey(record, index, rowKey);
|
|
2300
|
+
const expanded = expandedKeySet.has(String(key));
|
|
2301
|
+
const expandableRow = expandable.rowExpandable?.(record) ?? true;
|
|
2302
|
+
return /* @__PURE__ */ jsx9("td", {
|
|
2303
|
+
className: cn(tableCellClass, tableExpandCellClass),
|
|
2304
|
+
children: expandableRow ? /* @__PURE__ */ jsx9("button", {
|
|
2305
|
+
type: "button",
|
|
2306
|
+
className: tableExpandButtonClass,
|
|
2307
|
+
"aria-label": `${expanded ? "Collapse" : "Expand"} row ${index + 1}`,
|
|
2308
|
+
onClick: () => toggleExpand(record, index),
|
|
2309
|
+
children: expanded ? "-" : "+"
|
|
2310
|
+
}) : null
|
|
2311
|
+
});
|
|
2312
|
+
}
|
|
2313
|
+
function renderRow(record, index) {
|
|
2314
|
+
const key = getRecordKey(record, index, rowKey);
|
|
2315
|
+
const expanded = expandedKeySet.has(String(key));
|
|
2316
|
+
const selected = selectedKeySet.has(String(key));
|
|
2317
|
+
const row = /* @__PURE__ */ jsxs8("tr", {
|
|
2318
|
+
className: getTableRowClasses({ selected, expanded }),
|
|
2319
|
+
onClick: () => {
|
|
2320
|
+
if (expandable?.expandRowByClick) {
|
|
2321
|
+
toggleExpand(record, index);
|
|
2322
|
+
}
|
|
2323
|
+
},
|
|
2324
|
+
children: [
|
|
2325
|
+
renderSelectionCell(record, index),
|
|
2326
|
+
renderExpandCell(record, index),
|
|
2327
|
+
leaves.map((column) => renderCell(record, index, column))
|
|
2328
|
+
]
|
|
2329
|
+
}, String(key));
|
|
2330
|
+
if (!expanded || !expandable?.expandedRowRender) {
|
|
2331
|
+
return row;
|
|
2332
|
+
}
|
|
2333
|
+
return /* @__PURE__ */ jsxs8(React7.Fragment, {
|
|
2334
|
+
children: [
|
|
2335
|
+
row,
|
|
2336
|
+
/* @__PURE__ */ jsx9("tr", {
|
|
2337
|
+
className: "table-expanded-row",
|
|
2338
|
+
children: /* @__PURE__ */ jsx9("td", {
|
|
2339
|
+
className: tableCellClass,
|
|
2340
|
+
colSpan: structuralColumnCount,
|
|
2341
|
+
children: expandable.expandedRowRender(record, index, 0, expanded)
|
|
2342
|
+
})
|
|
2343
|
+
})
|
|
2344
|
+
]
|
|
2345
|
+
}, String(key));
|
|
2346
|
+
}
|
|
2347
|
+
const tableNode = /* @__PURE__ */ jsxs8("table", {
|
|
2348
|
+
className: getTableClasses({ bordered, size }),
|
|
2349
|
+
style: { tableLayout },
|
|
2350
|
+
children: [
|
|
2351
|
+
/* @__PURE__ */ jsx9("thead", {
|
|
2352
|
+
children: headerRows.map((row, rowIndex) => /* @__PURE__ */ jsxs8("tr", {
|
|
2353
|
+
children: [
|
|
2354
|
+
rowIndex === 0 ? renderSelectionHeader() : null,
|
|
2355
|
+
rowIndex === 0 && hasExpandable ? /* @__PURE__ */ jsx9("th", {
|
|
2356
|
+
className: cn(tableHeaderCellClass, tableExpandCellClass),
|
|
2357
|
+
children: expandable?.columnTitle
|
|
2358
|
+
}) : null,
|
|
2359
|
+
row.map(renderHeaderCell)
|
|
2360
|
+
]
|
|
2361
|
+
}, rowIndex))
|
|
2362
|
+
}),
|
|
2363
|
+
/* @__PURE__ */ jsx9("tbody", {
|
|
2364
|
+
children: bodyEmpty ? /* @__PURE__ */ jsx9("tr", {
|
|
2365
|
+
children: /* @__PURE__ */ jsx9("td", {
|
|
2366
|
+
className: tableEmptyClass,
|
|
2367
|
+
colSpan: structuralColumnCount,
|
|
2368
|
+
children: locale?.emptyText ?? "No data"
|
|
2369
|
+
})
|
|
2370
|
+
}) : pageData.map(renderRow)
|
|
2371
|
+
}),
|
|
2372
|
+
renderSummary(summary, pageData, structuralColumnCount)
|
|
2373
|
+
]
|
|
2374
|
+
});
|
|
2375
|
+
return /* @__PURE__ */ jsxs8("div", {
|
|
2376
|
+
...props,
|
|
2377
|
+
ref,
|
|
2378
|
+
className: getTableWrapperClasses({ loading: spinning, className }),
|
|
2379
|
+
children: [
|
|
2380
|
+
scroll?.x || scroll?.y ? /* @__PURE__ */ jsx9("div", {
|
|
2381
|
+
style: {
|
|
2382
|
+
overflow: "auto",
|
|
2383
|
+
maxHeight: scroll.y,
|
|
2384
|
+
width: scroll.x === true ? "100%" : scroll.x
|
|
2385
|
+
},
|
|
2386
|
+
children: tableNode
|
|
2387
|
+
}) : tableNode,
|
|
2388
|
+
spinning ? /* @__PURE__ */ jsx9("div", {
|
|
2389
|
+
className: tableLoadingIndicatorClass,
|
|
2390
|
+
role: "status",
|
|
2391
|
+
children: typeof loading === "object" && loading.indicator ? loading.indicator : "Loading"
|
|
2392
|
+
}) : null,
|
|
2393
|
+
paginationConfig && !(paginationConfig.hideOnSinglePage && pageCount <= 1) ? /* @__PURE__ */ jsxs8("nav", {
|
|
2394
|
+
className: tablePaginationClass,
|
|
2395
|
+
"aria-label": "Table pagination",
|
|
2396
|
+
children: [
|
|
2397
|
+
/* @__PURE__ */ jsx9("button", {
|
|
2398
|
+
type: "button",
|
|
2399
|
+
className: tablePaginationButtonClass,
|
|
2400
|
+
disabled: paginationConfig.disabled || current <= 1,
|
|
2401
|
+
onClick: () => changePage(current - 1),
|
|
2402
|
+
children: "Previous"
|
|
2403
|
+
}),
|
|
2404
|
+
/* @__PURE__ */ jsx9("span", {
|
|
2405
|
+
className: tablePaginationInfoClass,
|
|
2406
|
+
children: paginationConfig.showTotal ? paginationConfig.showTotal(paginationConfig.total ?? sortedData.length, [
|
|
2407
|
+
bodyEmpty ? 0 : (current - 1) * pageSize + 1,
|
|
2408
|
+
Math.min(current * pageSize, sortedData.length)
|
|
2409
|
+
]) : `${current} / ${pageCount}`
|
|
2410
|
+
}),
|
|
2411
|
+
/* @__PURE__ */ jsx9("button", {
|
|
2412
|
+
type: "button",
|
|
2413
|
+
className: tablePaginationButtonClass,
|
|
2414
|
+
disabled: paginationConfig.disabled || current >= pageCount,
|
|
2415
|
+
onClick: () => changePage(current + 1),
|
|
2416
|
+
children: "Next"
|
|
2417
|
+
})
|
|
2418
|
+
]
|
|
2419
|
+
}) : null
|
|
2420
|
+
]
|
|
2421
|
+
});
|
|
2422
|
+
}
|
|
2423
|
+
var TableWithRef = forwardRef7(TableRoot);
|
|
2424
|
+
var Table = Object.assign(TableWithRef, {
|
|
2425
|
+
Column,
|
|
2426
|
+
ColumnGroup,
|
|
2427
|
+
Summary,
|
|
2428
|
+
SELECTION_ALL: "SELECT_ALL",
|
|
2429
|
+
SELECTION_INVERT: "SELECT_INVERT",
|
|
2430
|
+
SELECTION_NONE: "SELECT_NONE",
|
|
2431
|
+
SELECTION_COLUMN: "SELECTION_COLUMN",
|
|
2432
|
+
EXPAND_COLUMN: "EXPAND_COLUMN"
|
|
2433
|
+
});
|
|
2434
|
+
Table.displayName = "Table";
|
|
2435
|
+
// src/components/dm-table/DmTable.tsx
|
|
2436
|
+
import { useMemo as useMemo7, useState as useState8 } from "react";
|
|
2437
|
+
|
|
2438
|
+
// src/classes/dm-table.ts
|
|
2439
|
+
var dmTableBaseClass = "dm-table";
|
|
2440
|
+
var dmTableSearchClass = "dm-table-search";
|
|
2441
|
+
var dmTableCardClass = "dm-table-card";
|
|
2442
|
+
var dmTableHeaderClass = "dm-table-header";
|
|
2443
|
+
var dmTableTitleClass = "dm-table-title";
|
|
2444
|
+
var dmTableExtraClass = "dm-table-extra";
|
|
2445
|
+
var dmTableIndicatorsClass = "dm-table-indicators";
|
|
2446
|
+
var dmTableTableExtraClass = "dm-table-table-extra";
|
|
2447
|
+
var dmTableColumnSettingClass = "dm-table-column-setting";
|
|
2448
|
+
var dmTablePaginationClass = "dm-table-pagination";
|
|
2449
|
+
function getDmTableClasses({ className }) {
|
|
2450
|
+
return cn(dmTableBaseClass, className);
|
|
2451
|
+
}
|
|
2452
|
+
|
|
2453
|
+
// src/components/dm-table/DmTable.tsx
|
|
2454
|
+
import { jsx as jsx10, jsxs as jsxs9 } from "react/jsx-runtime";
|
|
2455
|
+
function mapAndFilter(list, mapper) {
|
|
2456
|
+
return list.map(mapper).filter((item) => item !== false && item != null);
|
|
2457
|
+
}
|
|
2458
|
+
function filterDmTableColumn(column) {
|
|
2459
|
+
if (column.onlySearch || column.hideInTable)
|
|
2460
|
+
return false;
|
|
2461
|
+
if (Array.isArray(column.children)) {
|
|
2462
|
+
const children = mapAndFilter(column.children, filterDmTableColumn);
|
|
2463
|
+
return children.length > 0 ? { ...column, children } : null;
|
|
2464
|
+
}
|
|
2465
|
+
return column;
|
|
2466
|
+
}
|
|
2467
|
+
function filterSearchColumn(column) {
|
|
2468
|
+
if (Array.isArray(column.children)) {
|
|
2469
|
+
const children = mapAndFilter(column.children, filterSearchColumn);
|
|
2470
|
+
return children.length > 0 ? { ...column, children } : null;
|
|
2471
|
+
}
|
|
2472
|
+
return column.search ? column : false;
|
|
2473
|
+
}
|
|
2474
|
+
function flattenSearchColumns(column) {
|
|
2475
|
+
return Array.isArray(column.children) ? column.children.flatMap(flattenSearchColumns) : [column];
|
|
2476
|
+
}
|
|
2477
|
+
function searchItems(columns) {
|
|
2478
|
+
return mapAndFilter(columns, filterSearchColumn).flatMap(flattenSearchColumns).map((column) => ({
|
|
2479
|
+
key: String(column.key ?? column.dataIndex),
|
|
2480
|
+
title: column.title,
|
|
2481
|
+
dataIndex: String(column.dataIndex ?? column.key),
|
|
2482
|
+
search: column.search || {
|
|
2483
|
+
type: "input",
|
|
2484
|
+
extraProps: {},
|
|
2485
|
+
formProps: {}
|
|
2486
|
+
}
|
|
2487
|
+
}));
|
|
2488
|
+
}
|
|
2489
|
+
function DmTable({
|
|
2490
|
+
name,
|
|
2491
|
+
extra,
|
|
2492
|
+
indicators,
|
|
2493
|
+
pagination,
|
|
2494
|
+
columns: inputColumns,
|
|
2495
|
+
columnSettingVisible = true,
|
|
2496
|
+
onColumnsChange,
|
|
2497
|
+
columnState,
|
|
2498
|
+
searchProps,
|
|
2499
|
+
tableExtra,
|
|
2500
|
+
className,
|
|
2501
|
+
dataSource,
|
|
2502
|
+
rowSelection,
|
|
2503
|
+
...props
|
|
2504
|
+
}) {
|
|
2505
|
+
const tableColumns = useMemo7(() => mapAndFilter(inputColumns, filterDmTableColumn), [inputColumns]);
|
|
2506
|
+
const [columns, setColumns] = useState8(tableColumns);
|
|
2507
|
+
const [columnSettingsOpen, setColumnSettingsOpen] = useState8(false);
|
|
2508
|
+
const items = searchProps?.items?.length ? searchProps.items : searchItems(inputColumns);
|
|
2509
|
+
const paginationObj = typeof pagination === "object" ? pagination : undefined;
|
|
2510
|
+
const paginationProps = paginationObj ? Object.fromEntries(Object.entries(paginationObj).filter(([key]) => key !== "ref")) : {};
|
|
2511
|
+
const total = paginationObj?.total ?? dataSource?.length ?? 0;
|
|
2512
|
+
const selectedTotal = rowSelection?.selectedRowKeys?.length ?? 0;
|
|
2513
|
+
function resetColumns() {
|
|
2514
|
+
setColumns(tableColumns);
|
|
2515
|
+
onColumnsChange?.(tableColumns);
|
|
2516
|
+
if (columnState?.persistenceKey) {
|
|
2517
|
+
globalThis.localStorage?.removeItem(columnState.persistenceKey);
|
|
2518
|
+
}
|
|
2519
|
+
}
|
|
2520
|
+
return /* @__PURE__ */ jsxs9("div", {
|
|
2521
|
+
className: getDmTableClasses({ className }),
|
|
2522
|
+
children: [
|
|
2523
|
+
items.length > 0 || searchProps?.fastFilterItem ? /* @__PURE__ */ jsx10(Card, {
|
|
2524
|
+
className: dmTableSearchClass,
|
|
2525
|
+
padding: "md",
|
|
2526
|
+
children: /* @__PURE__ */ jsx10(DmSearch, {
|
|
2527
|
+
...searchProps,
|
|
2528
|
+
items
|
|
2529
|
+
})
|
|
2530
|
+
}) : null,
|
|
2531
|
+
indicators ? /* @__PURE__ */ jsx10("div", {
|
|
2532
|
+
className: dmTableIndicatorsClass,
|
|
2533
|
+
children: indicators
|
|
2534
|
+
}) : null,
|
|
2535
|
+
/* @__PURE__ */ jsxs9(Card, {
|
|
2536
|
+
className: dmTableCardClass,
|
|
2537
|
+
padding: "md",
|
|
2538
|
+
children: [
|
|
2539
|
+
name || extra || columnSettingVisible ? /* @__PURE__ */ jsxs9("div", {
|
|
2540
|
+
className: dmTableHeaderClass,
|
|
2541
|
+
children: [
|
|
2542
|
+
/* @__PURE__ */ jsx10("div", {
|
|
2543
|
+
className: dmTableTitleClass,
|
|
2544
|
+
children: name
|
|
2545
|
+
}),
|
|
2546
|
+
/* @__PURE__ */ jsxs9("div", {
|
|
2547
|
+
className: dmTableExtraClass,
|
|
2548
|
+
children: [
|
|
2549
|
+
extra,
|
|
2550
|
+
columnSettingVisible ? /* @__PURE__ */ jsx10(Button, {
|
|
2551
|
+
type: "button",
|
|
2552
|
+
color: "secondary",
|
|
2553
|
+
appearance: "outline",
|
|
2554
|
+
className: dmTableColumnSettingClass,
|
|
2555
|
+
onClick: () => setColumnSettingsOpen((open) => !open),
|
|
2556
|
+
children: "Columns"
|
|
2557
|
+
}) : null
|
|
2558
|
+
]
|
|
2559
|
+
})
|
|
2560
|
+
]
|
|
2561
|
+
}) : null,
|
|
2562
|
+
columnSettingsOpen ? /* @__PURE__ */ jsx10("div", {
|
|
2563
|
+
role: "dialog",
|
|
2564
|
+
"aria-label": "Column settings",
|
|
2565
|
+
children: /* @__PURE__ */ jsx10(Button, {
|
|
2566
|
+
type: "button",
|
|
2567
|
+
onClick: resetColumns,
|
|
2568
|
+
children: "Reset columns"
|
|
2569
|
+
})
|
|
2570
|
+
}) : null,
|
|
2571
|
+
tableExtra ? /* @__PURE__ */ jsx10("div", {
|
|
2572
|
+
className: dmTableTableExtraClass,
|
|
2573
|
+
children: tableExtra
|
|
2574
|
+
}) : null,
|
|
2575
|
+
/* @__PURE__ */ jsx10(Table, {
|
|
2576
|
+
...props,
|
|
2577
|
+
dataSource,
|
|
2578
|
+
rowSelection,
|
|
2579
|
+
size: props.size ?? "small",
|
|
2580
|
+
scroll: props.scroll ?? { x: 680 },
|
|
2581
|
+
columns,
|
|
2582
|
+
pagination: pagination ? {
|
|
2583
|
+
current: paginationObj?.current,
|
|
2584
|
+
defaultCurrent: paginationObj?.defaultCurrent,
|
|
2585
|
+
pageSize: paginationObj?.pageSize,
|
|
2586
|
+
defaultPageSize: paginationObj?.defaultPageSize,
|
|
2587
|
+
total,
|
|
2588
|
+
onChange: paginationObj?.onChange
|
|
2589
|
+
} : false
|
|
2590
|
+
}),
|
|
2591
|
+
pagination ? /* @__PURE__ */ jsx10(DmPagination, {
|
|
2592
|
+
...paginationProps,
|
|
2593
|
+
className: dmTablePaginationClass,
|
|
2594
|
+
total,
|
|
2595
|
+
selectedTotal,
|
|
2596
|
+
showSizeChanger: true
|
|
2597
|
+
}) : null
|
|
2598
|
+
]
|
|
2599
|
+
})
|
|
2600
|
+
]
|
|
2601
|
+
});
|
|
2602
|
+
}
|
|
2603
|
+
DmTable.displayName = "DmTable";
|
|
2604
|
+
export {
|
|
2605
|
+
filterDmTableColumn,
|
|
2606
|
+
DmTable
|
|
2607
|
+
};
|