@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,1852 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/components/input/Input.tsx
|
|
4
|
+
import {
|
|
5
|
+
forwardRef,
|
|
6
|
+
useImperativeHandle,
|
|
7
|
+
useRef,
|
|
8
|
+
useState
|
|
9
|
+
} from "react";
|
|
10
|
+
|
|
11
|
+
// ../../node_modules/.bun/clsx@2.1.1/node_modules/clsx/dist/clsx.mjs
|
|
12
|
+
function r(e) {
|
|
13
|
+
var t, f, n = "";
|
|
14
|
+
if (typeof e == "string" || typeof e == "number")
|
|
15
|
+
n += e;
|
|
16
|
+
else if (typeof e == "object")
|
|
17
|
+
if (Array.isArray(e)) {
|
|
18
|
+
var o = e.length;
|
|
19
|
+
for (t = 0;t < o; t++)
|
|
20
|
+
e[t] && (f = r(e[t])) && (n && (n += " "), n += f);
|
|
21
|
+
} else
|
|
22
|
+
for (f in e)
|
|
23
|
+
e[f] && (n && (n += " "), n += f);
|
|
24
|
+
return n;
|
|
25
|
+
}
|
|
26
|
+
function clsx() {
|
|
27
|
+
for (var e, t, f = 0, n = "", o = arguments.length;f < o; f++)
|
|
28
|
+
(e = arguments[f]) && (t = r(e)) && (n && (n += " "), n += t);
|
|
29
|
+
return n;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
// src/utils/cn.ts
|
|
33
|
+
function cn(...inputs) {
|
|
34
|
+
return clsx(inputs);
|
|
35
|
+
}
|
|
36
|
+
// src/classes/input.ts
|
|
37
|
+
var inputBaseClass = "input";
|
|
38
|
+
var inputWrapperClass = "input-wrapper";
|
|
39
|
+
var inputAffixWrapperClass = "input-affix-wrapper";
|
|
40
|
+
var inputPrefixClass = "input-prefix";
|
|
41
|
+
var inputSuffixClass = "input-suffix";
|
|
42
|
+
var inputClearClass = "input-clear";
|
|
43
|
+
var inputSearchClass = "input-search";
|
|
44
|
+
var inputSearchButtonClass = "input-search-button";
|
|
45
|
+
var inputPasswordClass = "input-password";
|
|
46
|
+
var inputPasswordToggleClass = "input-password-toggle";
|
|
47
|
+
var inputGroupClass = "input-group";
|
|
48
|
+
var textAreaBaseClass = "textarea";
|
|
49
|
+
var textAreaWrapperClass = "textarea-wrapper";
|
|
50
|
+
var textAreaCountClass = "textarea-counter";
|
|
51
|
+
var textAreaCountExceededClass = "textarea-counter-exceeded";
|
|
52
|
+
var textAreaAutoSizeClass = "textarea-auto-resize";
|
|
53
|
+
var inputVariantClasses = {
|
|
54
|
+
filled: "input-filled",
|
|
55
|
+
outlined: "input-outlined"
|
|
56
|
+
};
|
|
57
|
+
var inputSizeClasses = {
|
|
58
|
+
sm: "input-sm",
|
|
59
|
+
md: "input-md",
|
|
60
|
+
lg: "input-lg"
|
|
61
|
+
};
|
|
62
|
+
var inputStatusClasses = {
|
|
63
|
+
error: "input-error",
|
|
64
|
+
success: "input-success"
|
|
65
|
+
};
|
|
66
|
+
var textAreaVariantClasses = {
|
|
67
|
+
filled: "textarea-filled",
|
|
68
|
+
outlined: "textarea-outlined"
|
|
69
|
+
};
|
|
70
|
+
var textAreaSizeClasses = {
|
|
71
|
+
sm: "textarea-sm",
|
|
72
|
+
md: "",
|
|
73
|
+
lg: "textarea-lg"
|
|
74
|
+
};
|
|
75
|
+
var textAreaStatusClasses = {
|
|
76
|
+
error: "textarea-error",
|
|
77
|
+
success: "textarea-success"
|
|
78
|
+
};
|
|
79
|
+
var textAreaResizeClasses = {
|
|
80
|
+
none: "textarea-resize-none",
|
|
81
|
+
both: "textarea-resize-both",
|
|
82
|
+
horizontal: "textarea-resize-horizontal",
|
|
83
|
+
vertical: "textarea-resize-vertical"
|
|
84
|
+
};
|
|
85
|
+
function getInputClasses({
|
|
86
|
+
size = "md",
|
|
87
|
+
status,
|
|
88
|
+
variant = "outlined",
|
|
89
|
+
className
|
|
90
|
+
}) {
|
|
91
|
+
return cn(inputBaseClass, inputVariantClasses[variant], inputSizeClasses[size], status && inputStatusClasses[status], className);
|
|
92
|
+
}
|
|
93
|
+
function getInputWrapperClasses({
|
|
94
|
+
affixed,
|
|
95
|
+
className
|
|
96
|
+
}) {
|
|
97
|
+
return cn(inputWrapperClass, affixed && inputAffixWrapperClass, className);
|
|
98
|
+
}
|
|
99
|
+
function getSearchWrapperClasses({ className }) {
|
|
100
|
+
return cn(inputSearchClass, className);
|
|
101
|
+
}
|
|
102
|
+
function getPasswordWrapperClasses({
|
|
103
|
+
className
|
|
104
|
+
}) {
|
|
105
|
+
return cn(inputPasswordClass, className);
|
|
106
|
+
}
|
|
107
|
+
function getTextAreaClasses({
|
|
108
|
+
size = "md",
|
|
109
|
+
status,
|
|
110
|
+
variant = "outlined",
|
|
111
|
+
resize = "vertical",
|
|
112
|
+
autoSize,
|
|
113
|
+
className
|
|
114
|
+
}) {
|
|
115
|
+
return cn(textAreaBaseClass, textAreaVariantClasses[variant], textAreaSizeClasses[size], status && textAreaStatusClasses[status], textAreaResizeClasses[resize], autoSize && textAreaAutoSizeClass, className);
|
|
116
|
+
}
|
|
117
|
+
function getTextAreaCountClasses({ exceeded }) {
|
|
118
|
+
return cn(textAreaCountClass, exceeded && textAreaCountExceededClass);
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
// src/components/input/Input.tsx
|
|
122
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
123
|
+
function toTextValue(value) {
|
|
124
|
+
if (Array.isArray(value)) {
|
|
125
|
+
return value.join(",");
|
|
126
|
+
}
|
|
127
|
+
return value == null ? "" : String(value);
|
|
128
|
+
}
|
|
129
|
+
var InputRoot = forwardRef(({
|
|
130
|
+
allowClear,
|
|
131
|
+
className,
|
|
132
|
+
defaultValue,
|
|
133
|
+
disabled,
|
|
134
|
+
onChange,
|
|
135
|
+
prefix,
|
|
136
|
+
size = "md",
|
|
137
|
+
status,
|
|
138
|
+
suffix,
|
|
139
|
+
type = "text",
|
|
140
|
+
value,
|
|
141
|
+
variant = "outlined",
|
|
142
|
+
...props
|
|
143
|
+
}, ref) => {
|
|
144
|
+
const inputRef = useRef(null);
|
|
145
|
+
const [internalValue, setInternalValue] = useState(() => toTextValue(defaultValue));
|
|
146
|
+
const isControlled = value !== undefined;
|
|
147
|
+
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
148
|
+
const hasAffix = prefix != null || suffix != null || allowClear;
|
|
149
|
+
useImperativeHandle(ref, () => inputRef.current);
|
|
150
|
+
function handleChange(event) {
|
|
151
|
+
if (!isControlled) {
|
|
152
|
+
setInternalValue(event.currentTarget.value);
|
|
153
|
+
}
|
|
154
|
+
onChange?.(event);
|
|
155
|
+
}
|
|
156
|
+
function handleClear() {
|
|
157
|
+
const input = inputRef.current;
|
|
158
|
+
if (!input || disabled) {
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
input.value = "";
|
|
162
|
+
if (!isControlled) {
|
|
163
|
+
setInternalValue("");
|
|
164
|
+
}
|
|
165
|
+
onChange?.({
|
|
166
|
+
currentTarget: input,
|
|
167
|
+
target: input,
|
|
168
|
+
type: "change"
|
|
169
|
+
});
|
|
170
|
+
input.focus();
|
|
171
|
+
}
|
|
172
|
+
const control = /* @__PURE__ */ jsx("input", {
|
|
173
|
+
...props,
|
|
174
|
+
ref: inputRef,
|
|
175
|
+
type,
|
|
176
|
+
className: getInputClasses({ size, status, variant, className }),
|
|
177
|
+
disabled,
|
|
178
|
+
value: currentValue,
|
|
179
|
+
onChange: handleChange
|
|
180
|
+
});
|
|
181
|
+
if (!hasAffix) {
|
|
182
|
+
return control;
|
|
183
|
+
}
|
|
184
|
+
const showClear = allowClear && !disabled && currentValue.length > 0;
|
|
185
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
186
|
+
className: getInputWrapperClasses({ affixed: hasAffix }),
|
|
187
|
+
children: [
|
|
188
|
+
prefix != null ? /* @__PURE__ */ jsx("span", {
|
|
189
|
+
className: inputPrefixClass,
|
|
190
|
+
children: prefix
|
|
191
|
+
}) : null,
|
|
192
|
+
control,
|
|
193
|
+
showClear ? /* @__PURE__ */ jsx("button", {
|
|
194
|
+
type: "button",
|
|
195
|
+
className: inputClearClass,
|
|
196
|
+
"aria-label": "Clear input",
|
|
197
|
+
onClick: handleClear,
|
|
198
|
+
children: "x"
|
|
199
|
+
}) : null,
|
|
200
|
+
suffix != null ? /* @__PURE__ */ jsx("span", {
|
|
201
|
+
className: inputSuffixClass,
|
|
202
|
+
children: suffix
|
|
203
|
+
}) : null
|
|
204
|
+
]
|
|
205
|
+
});
|
|
206
|
+
});
|
|
207
|
+
InputRoot.displayName = "Input";
|
|
208
|
+
var Search = forwardRef(({
|
|
209
|
+
className,
|
|
210
|
+
disabled,
|
|
211
|
+
enterButton,
|
|
212
|
+
loading,
|
|
213
|
+
onKeyDown,
|
|
214
|
+
onSearch,
|
|
215
|
+
...props
|
|
216
|
+
}, ref) => {
|
|
217
|
+
const inputRef = useRef(null);
|
|
218
|
+
useImperativeHandle(ref, () => inputRef.current);
|
|
219
|
+
function emitSearch(event) {
|
|
220
|
+
onSearch?.(inputRef.current?.value ?? "", event);
|
|
221
|
+
}
|
|
222
|
+
function handleKeyDown(event) {
|
|
223
|
+
onKeyDown?.(event);
|
|
224
|
+
if (!event.defaultPrevented && event.key === "Enter") {
|
|
225
|
+
emitSearch(event);
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
const buttonContent = enterButton === true ? "Search" : enterButton ?? "Search";
|
|
229
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
230
|
+
className: getSearchWrapperClasses({ className }),
|
|
231
|
+
children: [
|
|
232
|
+
/* @__PURE__ */ jsx(InputRoot, {
|
|
233
|
+
...props,
|
|
234
|
+
ref: inputRef,
|
|
235
|
+
disabled,
|
|
236
|
+
onKeyDown: handleKeyDown
|
|
237
|
+
}),
|
|
238
|
+
enterButton || loading ? /* @__PURE__ */ jsx("button", {
|
|
239
|
+
type: "button",
|
|
240
|
+
className: inputSearchButtonClass,
|
|
241
|
+
disabled: disabled || loading,
|
|
242
|
+
"aria-busy": loading || undefined,
|
|
243
|
+
onClick: emitSearch,
|
|
244
|
+
children: loading ? "Loading" : buttonContent
|
|
245
|
+
}) : null
|
|
246
|
+
]
|
|
247
|
+
});
|
|
248
|
+
});
|
|
249
|
+
Search.displayName = "Input.Search";
|
|
250
|
+
var Password = forwardRef(({ className, disabled, visibilityToggle = true, ...props }, ref) => {
|
|
251
|
+
const [visible, setVisible] = useState(false);
|
|
252
|
+
const type = visible ? "text" : "password";
|
|
253
|
+
const toggle = visibilityToggle ? /* @__PURE__ */ jsx("button", {
|
|
254
|
+
type: "button",
|
|
255
|
+
className: inputPasswordToggleClass,
|
|
256
|
+
disabled,
|
|
257
|
+
"aria-label": visible ? "Hide password" : "Show password",
|
|
258
|
+
onClick: () => {
|
|
259
|
+
setVisible((current) => !current);
|
|
260
|
+
},
|
|
261
|
+
children: visible ? "Hide" : "Show"
|
|
262
|
+
}) : undefined;
|
|
263
|
+
return /* @__PURE__ */ jsx("span", {
|
|
264
|
+
className: getPasswordWrapperClasses({ className }),
|
|
265
|
+
children: /* @__PURE__ */ jsx(InputRoot, {
|
|
266
|
+
...props,
|
|
267
|
+
ref,
|
|
268
|
+
disabled,
|
|
269
|
+
type,
|
|
270
|
+
suffix: toggle
|
|
271
|
+
})
|
|
272
|
+
});
|
|
273
|
+
});
|
|
274
|
+
Password.displayName = "Input.Password";
|
|
275
|
+
var TextArea = forwardRef(({
|
|
276
|
+
autoSize,
|
|
277
|
+
className,
|
|
278
|
+
defaultValue,
|
|
279
|
+
maxLength,
|
|
280
|
+
onChange,
|
|
281
|
+
resize = "vertical",
|
|
282
|
+
showCount,
|
|
283
|
+
size = "md",
|
|
284
|
+
status,
|
|
285
|
+
value,
|
|
286
|
+
variant = "outlined",
|
|
287
|
+
...props
|
|
288
|
+
}, ref) => {
|
|
289
|
+
const [internalValue, setInternalValue] = useState(() => toTextValue(defaultValue));
|
|
290
|
+
const isControlled = value !== undefined;
|
|
291
|
+
const currentValue = isControlled ? toTextValue(value) : internalValue;
|
|
292
|
+
const count = currentValue.length;
|
|
293
|
+
const exceeded = maxLength !== undefined && count > maxLength;
|
|
294
|
+
function handleChange(event) {
|
|
295
|
+
if (!isControlled) {
|
|
296
|
+
setInternalValue(event.currentTarget.value);
|
|
297
|
+
}
|
|
298
|
+
onChange?.(event);
|
|
299
|
+
}
|
|
300
|
+
const control = /* @__PURE__ */ jsx("textarea", {
|
|
301
|
+
...props,
|
|
302
|
+
ref,
|
|
303
|
+
className: getTextAreaClasses({
|
|
304
|
+
size,
|
|
305
|
+
status,
|
|
306
|
+
variant,
|
|
307
|
+
resize,
|
|
308
|
+
autoSize: Boolean(autoSize),
|
|
309
|
+
className
|
|
310
|
+
}),
|
|
311
|
+
maxLength,
|
|
312
|
+
value: currentValue,
|
|
313
|
+
onChange: handleChange
|
|
314
|
+
});
|
|
315
|
+
if (!showCount) {
|
|
316
|
+
return control;
|
|
317
|
+
}
|
|
318
|
+
return /* @__PURE__ */ jsxs("span", {
|
|
319
|
+
className: textAreaWrapperClass,
|
|
320
|
+
children: [
|
|
321
|
+
control,
|
|
322
|
+
/* @__PURE__ */ jsxs("span", {
|
|
323
|
+
className: getTextAreaCountClasses({ exceeded }),
|
|
324
|
+
children: [
|
|
325
|
+
count,
|
|
326
|
+
maxLength !== undefined ? ` / ${maxLength}` : null
|
|
327
|
+
]
|
|
328
|
+
})
|
|
329
|
+
]
|
|
330
|
+
});
|
|
331
|
+
});
|
|
332
|
+
TextArea.displayName = "Input.TextArea";
|
|
333
|
+
var Group = forwardRef(({ className, children, ...props }, ref) => /* @__PURE__ */ jsx("div", {
|
|
334
|
+
...props,
|
|
335
|
+
ref,
|
|
336
|
+
className: cn(inputGroupClass, className),
|
|
337
|
+
children
|
|
338
|
+
}));
|
|
339
|
+
Group.displayName = "Input.Group";
|
|
340
|
+
var Input = Object.assign(InputRoot, {
|
|
341
|
+
Search,
|
|
342
|
+
Password,
|
|
343
|
+
TextArea,
|
|
344
|
+
Group
|
|
345
|
+
});
|
|
346
|
+
// src/components/empty/Empty.tsx
|
|
347
|
+
import { forwardRef as forwardRef2 } from "react";
|
|
348
|
+
|
|
349
|
+
// src/classes/empty.ts
|
|
350
|
+
var emptyBaseClass = "empty";
|
|
351
|
+
var emptyImageClass = "empty-image";
|
|
352
|
+
var emptyDescriptionClass = "empty-description";
|
|
353
|
+
var emptyFooterClass = "empty-footer";
|
|
354
|
+
function getEmptyClasses({ className }) {
|
|
355
|
+
return cn(emptyBaseClass, className);
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// src/components/empty/Empty.tsx
|
|
359
|
+
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
360
|
+
var defaultImage = /* @__PURE__ */ jsxs2("svg", {
|
|
361
|
+
"aria-hidden": "true",
|
|
362
|
+
focusable: "false",
|
|
363
|
+
viewBox: "0 0 64 48",
|
|
364
|
+
width: "64",
|
|
365
|
+
height: "48",
|
|
366
|
+
children: [
|
|
367
|
+
/* @__PURE__ */ jsx2("rect", {
|
|
368
|
+
x: "8",
|
|
369
|
+
y: "12",
|
|
370
|
+
width: "48",
|
|
371
|
+
height: "28",
|
|
372
|
+
rx: "4",
|
|
373
|
+
fill: "currentColor",
|
|
374
|
+
opacity: "0.16"
|
|
375
|
+
}),
|
|
376
|
+
/* @__PURE__ */ jsx2("path", {
|
|
377
|
+
d: "M16 20h32M16 28h20",
|
|
378
|
+
stroke: "currentColor",
|
|
379
|
+
strokeWidth: "3",
|
|
380
|
+
strokeLinecap: "round",
|
|
381
|
+
opacity: "0.38"
|
|
382
|
+
})
|
|
383
|
+
]
|
|
384
|
+
});
|
|
385
|
+
var simpleImage = /* @__PURE__ */ jsx2("svg", {
|
|
386
|
+
"aria-hidden": "true",
|
|
387
|
+
focusable: "false",
|
|
388
|
+
viewBox: "0 0 48 36",
|
|
389
|
+
width: "48",
|
|
390
|
+
height: "36",
|
|
391
|
+
children: /* @__PURE__ */ jsx2("rect", {
|
|
392
|
+
x: "6",
|
|
393
|
+
y: "10",
|
|
394
|
+
width: "36",
|
|
395
|
+
height: "20",
|
|
396
|
+
rx: "3",
|
|
397
|
+
fill: "currentColor",
|
|
398
|
+
opacity: "0.16"
|
|
399
|
+
})
|
|
400
|
+
});
|
|
401
|
+
var EmptyBase = forwardRef2(({
|
|
402
|
+
image = defaultImage,
|
|
403
|
+
imageStyle,
|
|
404
|
+
description = "No data",
|
|
405
|
+
children,
|
|
406
|
+
className,
|
|
407
|
+
...props
|
|
408
|
+
}, ref) => /* @__PURE__ */ jsxs2("div", {
|
|
409
|
+
ref,
|
|
410
|
+
className: getEmptyClasses({ className }),
|
|
411
|
+
...props,
|
|
412
|
+
children: [
|
|
413
|
+
image !== null && image !== false ? /* @__PURE__ */ jsx2("div", {
|
|
414
|
+
className: emptyImageClass,
|
|
415
|
+
style: imageStyle,
|
|
416
|
+
children: image
|
|
417
|
+
}) : null,
|
|
418
|
+
description !== false ? /* @__PURE__ */ jsx2("div", {
|
|
419
|
+
className: emptyDescriptionClass,
|
|
420
|
+
children: description
|
|
421
|
+
}) : null,
|
|
422
|
+
children ? /* @__PURE__ */ jsx2("div", {
|
|
423
|
+
className: emptyFooterClass,
|
|
424
|
+
children
|
|
425
|
+
}) : null
|
|
426
|
+
]
|
|
427
|
+
}));
|
|
428
|
+
EmptyBase.displayName = "Empty";
|
|
429
|
+
var Empty = EmptyBase;
|
|
430
|
+
Empty.PRESENTED_IMAGE_DEFAULT = defaultImage;
|
|
431
|
+
Empty.PRESENTED_IMAGE_SIMPLE = simpleImage;
|
|
432
|
+
// src/components/spin/Spin.tsx
|
|
433
|
+
import { forwardRef as forwardRef3, useEffect, useState as useState2 } from "react";
|
|
434
|
+
|
|
435
|
+
// src/classes/spin.ts
|
|
436
|
+
var spinBaseClass = "spin";
|
|
437
|
+
var spinSpinningClass = "spin-spinning";
|
|
438
|
+
var spinNestedLoadingClass = "spin-nested-loading";
|
|
439
|
+
var spinContainerClass = "spin-container";
|
|
440
|
+
var spinBlurClass = "spin-blur";
|
|
441
|
+
var spinDotClass = "spin-dot";
|
|
442
|
+
var spinTipClass = "spin-tip";
|
|
443
|
+
var spinFullscreenClass = "spin-fullscreen";
|
|
444
|
+
var spinSizeClasses = {
|
|
445
|
+
small: "spin-sm progress-circular-sm",
|
|
446
|
+
default: "spin-md progress-circular-md",
|
|
447
|
+
large: "spin-lg progress-circular-lg"
|
|
448
|
+
};
|
|
449
|
+
function getSpinClasses({
|
|
450
|
+
spinning,
|
|
451
|
+
size = "default",
|
|
452
|
+
fullscreen,
|
|
453
|
+
className
|
|
454
|
+
}) {
|
|
455
|
+
return cn(spinBaseClass, "progress-circular progress-circular-indeterminate", spinSizeClasses[size], spinning && spinSpinningClass, fullscreen && spinFullscreenClass, className);
|
|
456
|
+
}
|
|
457
|
+
|
|
458
|
+
// src/components/spin/Spin.tsx
|
|
459
|
+
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
460
|
+
var defaultIndicator;
|
|
461
|
+
function setDefaultIndicator(indicator) {
|
|
462
|
+
defaultIndicator = indicator;
|
|
463
|
+
}
|
|
464
|
+
function useDelayedSpinning(spinning, delay) {
|
|
465
|
+
const [delayedActive, setDelayedActive] = useState2(false);
|
|
466
|
+
const hasDelay = Boolean(delay && delay > 0);
|
|
467
|
+
useEffect(() => {
|
|
468
|
+
if (!hasDelay) {
|
|
469
|
+
return;
|
|
470
|
+
}
|
|
471
|
+
if (!spinning) {
|
|
472
|
+
const resetTimer2 = window.setTimeout(() => setDelayedActive(false), 0);
|
|
473
|
+
return () => window.clearTimeout(resetTimer2);
|
|
474
|
+
}
|
|
475
|
+
const resetTimer = window.setTimeout(() => setDelayedActive(false), 0);
|
|
476
|
+
const showTimer = window.setTimeout(() => setDelayedActive(true), delay);
|
|
477
|
+
return () => {
|
|
478
|
+
window.clearTimeout(resetTimer);
|
|
479
|
+
window.clearTimeout(showTimer);
|
|
480
|
+
};
|
|
481
|
+
}, [delay, hasDelay, spinning]);
|
|
482
|
+
if (!hasDelay) {
|
|
483
|
+
return spinning;
|
|
484
|
+
}
|
|
485
|
+
return spinning && delayedActive;
|
|
486
|
+
}
|
|
487
|
+
var SpinBase = forwardRef3(({
|
|
488
|
+
spinning = true,
|
|
489
|
+
size = "default",
|
|
490
|
+
tip,
|
|
491
|
+
indicator,
|
|
492
|
+
delay,
|
|
493
|
+
fullscreen,
|
|
494
|
+
wrapperClassName,
|
|
495
|
+
className,
|
|
496
|
+
children,
|
|
497
|
+
...props
|
|
498
|
+
}, ref) => {
|
|
499
|
+
const active = useDelayedSpinning(spinning, delay);
|
|
500
|
+
const finalIndicator = indicator ?? defaultIndicator;
|
|
501
|
+
const spin = /* @__PURE__ */ jsxs3("div", {
|
|
502
|
+
ref,
|
|
503
|
+
role: "status",
|
|
504
|
+
"aria-live": "polite",
|
|
505
|
+
"aria-busy": active,
|
|
506
|
+
className: getSpinClasses({
|
|
507
|
+
spinning: active,
|
|
508
|
+
size,
|
|
509
|
+
fullscreen,
|
|
510
|
+
className
|
|
511
|
+
}),
|
|
512
|
+
...props,
|
|
513
|
+
children: [
|
|
514
|
+
finalIndicator ?? /* @__PURE__ */ jsx3("span", {
|
|
515
|
+
className: spinDotClass
|
|
516
|
+
}),
|
|
517
|
+
tip ? /* @__PURE__ */ jsx3("div", {
|
|
518
|
+
className: spinTipClass,
|
|
519
|
+
children: tip
|
|
520
|
+
}) : null
|
|
521
|
+
]
|
|
522
|
+
});
|
|
523
|
+
if (!children) {
|
|
524
|
+
return spin;
|
|
525
|
+
}
|
|
526
|
+
return /* @__PURE__ */ jsxs3("div", {
|
|
527
|
+
className: cn(spinNestedLoadingClass, wrapperClassName),
|
|
528
|
+
children: [
|
|
529
|
+
active ? spin : null,
|
|
530
|
+
/* @__PURE__ */ jsx3("div", {
|
|
531
|
+
className: cn(spinContainerClass, active && spinBlurClass),
|
|
532
|
+
children
|
|
533
|
+
})
|
|
534
|
+
]
|
|
535
|
+
});
|
|
536
|
+
});
|
|
537
|
+
SpinBase.displayName = "Spin";
|
|
538
|
+
var Spin = SpinBase;
|
|
539
|
+
Spin.setDefaultIndicator = setDefaultIndicator;
|
|
540
|
+
// src/components/dm-status/DmStatus.tsx
|
|
541
|
+
import { forwardRef as forwardRef4 } from "react";
|
|
542
|
+
|
|
543
|
+
// src/classes/dm-status.ts
|
|
544
|
+
var dmStatusBaseClass = "dm-status";
|
|
545
|
+
var dmStatusLoadingClass = "dm-status-loading";
|
|
546
|
+
var dmStatusContentClass = "dm-status-content";
|
|
547
|
+
var dmStatusImageClass = "dm-status-image";
|
|
548
|
+
var dmStatusTypeClasses = {
|
|
549
|
+
empty: "dm-status-empty",
|
|
550
|
+
loading: "dm-status-loading-state",
|
|
551
|
+
error: "dm-status-error",
|
|
552
|
+
success: "dm-status-success"
|
|
553
|
+
};
|
|
554
|
+
function getDmStatusClasses({
|
|
555
|
+
status,
|
|
556
|
+
className
|
|
557
|
+
}) {
|
|
558
|
+
return cn(dmStatusBaseClass, dmStatusTypeClasses[status], className);
|
|
559
|
+
}
|
|
560
|
+
|
|
561
|
+
// src/components/dm-status/DmStatus.tsx
|
|
562
|
+
import { jsx as jsx4, jsxs as jsxs4, Fragment } from "react/jsx-runtime";
|
|
563
|
+
var defaultDescriptions = {
|
|
564
|
+
empty: "No data",
|
|
565
|
+
error: "Loading failed"
|
|
566
|
+
};
|
|
567
|
+
var emptyImage = /* @__PURE__ */ jsxs4("svg", {
|
|
568
|
+
"aria-hidden": "true",
|
|
569
|
+
focusable: "false",
|
|
570
|
+
viewBox: "0 0 96 72",
|
|
571
|
+
width: "96",
|
|
572
|
+
height: "72",
|
|
573
|
+
children: [
|
|
574
|
+
/* @__PURE__ */ jsx4("rect", {
|
|
575
|
+
x: "14",
|
|
576
|
+
y: "18",
|
|
577
|
+
width: "68",
|
|
578
|
+
height: "40",
|
|
579
|
+
rx: "6",
|
|
580
|
+
fill: "currentColor",
|
|
581
|
+
opacity: "0.12"
|
|
582
|
+
}),
|
|
583
|
+
/* @__PURE__ */ jsx4("path", {
|
|
584
|
+
d: "M28 31h40M28 42h24",
|
|
585
|
+
stroke: "currentColor",
|
|
586
|
+
strokeWidth: "4",
|
|
587
|
+
strokeLinecap: "round",
|
|
588
|
+
opacity: "0.32"
|
|
589
|
+
})
|
|
590
|
+
]
|
|
591
|
+
});
|
|
592
|
+
var errorImage = /* @__PURE__ */ jsxs4("svg", {
|
|
593
|
+
"aria-hidden": "true",
|
|
594
|
+
focusable: "false",
|
|
595
|
+
viewBox: "0 0 96 72",
|
|
596
|
+
width: "96",
|
|
597
|
+
height: "72",
|
|
598
|
+
children: [
|
|
599
|
+
/* @__PURE__ */ jsx4("circle", {
|
|
600
|
+
cx: "48",
|
|
601
|
+
cy: "36",
|
|
602
|
+
r: "25",
|
|
603
|
+
fill: "currentColor",
|
|
604
|
+
opacity: "0.12"
|
|
605
|
+
}),
|
|
606
|
+
/* @__PURE__ */ jsx4("path", {
|
|
607
|
+
d: "M39 27l18 18M57 27L39 45",
|
|
608
|
+
stroke: "currentColor",
|
|
609
|
+
strokeWidth: "5",
|
|
610
|
+
strokeLinecap: "round",
|
|
611
|
+
opacity: "0.48"
|
|
612
|
+
})
|
|
613
|
+
]
|
|
614
|
+
});
|
|
615
|
+
function normalizeHeight(height) {
|
|
616
|
+
if (typeof height === "number") {
|
|
617
|
+
return `${height}px`;
|
|
618
|
+
}
|
|
619
|
+
return height ?? "100%";
|
|
620
|
+
}
|
|
621
|
+
function normalizeImage(image, imageStyle) {
|
|
622
|
+
if (typeof image !== "string") {
|
|
623
|
+
return image;
|
|
624
|
+
}
|
|
625
|
+
return /* @__PURE__ */ jsx4("img", {
|
|
626
|
+
src: image,
|
|
627
|
+
alt: "",
|
|
628
|
+
className: dmStatusImageClass,
|
|
629
|
+
style: imageStyle
|
|
630
|
+
});
|
|
631
|
+
}
|
|
632
|
+
var DmStatus = forwardRef4(({
|
|
633
|
+
status = "empty",
|
|
634
|
+
height,
|
|
635
|
+
style,
|
|
636
|
+
loadingProps,
|
|
637
|
+
description,
|
|
638
|
+
image,
|
|
639
|
+
imageStyle,
|
|
640
|
+
className,
|
|
641
|
+
children,
|
|
642
|
+
...props
|
|
643
|
+
}, ref) => {
|
|
644
|
+
if (status === "success") {
|
|
645
|
+
return /* @__PURE__ */ jsx4(Fragment, {
|
|
646
|
+
children
|
|
647
|
+
});
|
|
648
|
+
}
|
|
649
|
+
const mergedStyle = {
|
|
650
|
+
height: normalizeHeight(height),
|
|
651
|
+
...style
|
|
652
|
+
};
|
|
653
|
+
if (status === "loading") {
|
|
654
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
655
|
+
ref,
|
|
656
|
+
className: getDmStatusClasses({ status, className }),
|
|
657
|
+
style: mergedStyle,
|
|
658
|
+
...props,
|
|
659
|
+
children: /* @__PURE__ */ jsx4(Spin, {
|
|
660
|
+
...loadingProps,
|
|
661
|
+
wrapperClassName: dmStatusLoadingClass,
|
|
662
|
+
children
|
|
663
|
+
})
|
|
664
|
+
});
|
|
665
|
+
}
|
|
666
|
+
const finalImage = normalizeImage(image ?? (status === "error" ? errorImage : emptyImage), imageStyle);
|
|
667
|
+
const finalDescription = description ?? defaultDescriptions[status === "error" ? "error" : "empty"];
|
|
668
|
+
return /* @__PURE__ */ jsx4("div", {
|
|
669
|
+
ref,
|
|
670
|
+
className: getDmStatusClasses({ status, className }),
|
|
671
|
+
style: mergedStyle,
|
|
672
|
+
...props,
|
|
673
|
+
children: /* @__PURE__ */ jsx4("div", {
|
|
674
|
+
className: dmStatusContentClass,
|
|
675
|
+
children: /* @__PURE__ */ jsx4(Empty, {
|
|
676
|
+
image: finalImage,
|
|
677
|
+
imageStyle: typeof image === "string" ? undefined : imageStyle,
|
|
678
|
+
description: finalDescription,
|
|
679
|
+
children
|
|
680
|
+
})
|
|
681
|
+
})
|
|
682
|
+
});
|
|
683
|
+
});
|
|
684
|
+
DmStatus.displayName = "DmStatus";
|
|
685
|
+
// src/components/tabs/Tabs.tsx
|
|
686
|
+
import {
|
|
687
|
+
Children,
|
|
688
|
+
Fragment as Fragment2,
|
|
689
|
+
forwardRef as forwardRef5,
|
|
690
|
+
isValidElement,
|
|
691
|
+
useId,
|
|
692
|
+
useRef as useRef2,
|
|
693
|
+
useState as useState3
|
|
694
|
+
} from "react";
|
|
695
|
+
|
|
696
|
+
// src/classes/tabs.ts
|
|
697
|
+
var tabsRootClass = "tabs-root";
|
|
698
|
+
var tabsRootVerticalClass = "tabs-root-vertical";
|
|
699
|
+
var tabsRootBottomClass = "tabs-root-bottom";
|
|
700
|
+
var tabsRootRightClass = "tabs-root-right";
|
|
701
|
+
var tabsBarClass = "tabs-bar";
|
|
702
|
+
var tabsBaseClass = "tabs";
|
|
703
|
+
var tabsVerticalClass = "tabs-vertical";
|
|
704
|
+
var tabsScrollableClass = "tabs-scrollable";
|
|
705
|
+
var tabsCenteredClass = "tabs-center";
|
|
706
|
+
var tabsBoxedClass = "tabs-boxed";
|
|
707
|
+
var tabBaseClass = "tab";
|
|
708
|
+
var tabActiveClass = "tab-active";
|
|
709
|
+
var tabDisabledClass = "tab-disabled";
|
|
710
|
+
var tabIconClass = "tab-icon";
|
|
711
|
+
var tabIconOnlyClass = "tab-icon-only";
|
|
712
|
+
var tabPanelClass = "tab-panel";
|
|
713
|
+
var tabPanelShowClass = "tab-panel-show";
|
|
714
|
+
var tabsAddClass = "tab tab-add";
|
|
715
|
+
var tabsCloseClass = "tab-icon tab-close";
|
|
716
|
+
var tabsSizeClasses = {
|
|
717
|
+
small: "tabs-sm",
|
|
718
|
+
middle: "tabs-md",
|
|
719
|
+
large: "tabs-lg",
|
|
720
|
+
sm: "tabs-sm",
|
|
721
|
+
md: "tabs-md",
|
|
722
|
+
lg: "tabs-lg"
|
|
723
|
+
};
|
|
724
|
+
var tabsTypeClasses = {
|
|
725
|
+
line: "",
|
|
726
|
+
card: tabsBoxedClass,
|
|
727
|
+
"editable-card": tabsBoxedClass
|
|
728
|
+
};
|
|
729
|
+
function getTabsRootClasses({
|
|
730
|
+
tabPosition = "top",
|
|
731
|
+
className
|
|
732
|
+
}) {
|
|
733
|
+
return cn(tabsRootClass, (tabPosition === "left" || tabPosition === "right") && tabsRootVerticalClass, tabPosition === "bottom" && tabsRootBottomClass, tabPosition === "right" && tabsRootRightClass, className);
|
|
734
|
+
}
|
|
735
|
+
function getTabsListClasses({
|
|
736
|
+
tabPosition = "top",
|
|
737
|
+
type = "line",
|
|
738
|
+
size = "middle",
|
|
739
|
+
centered
|
|
740
|
+
}) {
|
|
741
|
+
return cn(tabsBaseClass, tabsScrollableClass, (tabPosition === "left" || tabPosition === "right") && tabsVerticalClass, tabsSizeClasses[size], tabsTypeClasses[type], centered && tabsCenteredClass);
|
|
742
|
+
}
|
|
743
|
+
function getTabClasses({
|
|
744
|
+
active,
|
|
745
|
+
disabled,
|
|
746
|
+
iconOnly,
|
|
747
|
+
className
|
|
748
|
+
}) {
|
|
749
|
+
return cn(tabBaseClass, active && tabActiveClass, disabled && tabDisabledClass, iconOnly && tabIconOnlyClass, className);
|
|
750
|
+
}
|
|
751
|
+
function getTabPanelClasses({
|
|
752
|
+
active,
|
|
753
|
+
className
|
|
754
|
+
}) {
|
|
755
|
+
return cn(tabPanelClass, active && tabPanelShowClass, className);
|
|
756
|
+
}
|
|
757
|
+
|
|
758
|
+
// src/components/tabs/Tabs.tsx
|
|
759
|
+
import { jsx as jsx5, jsxs as jsxs5, Fragment as Fragment3 } from "react/jsx-runtime";
|
|
760
|
+
function stringifyKey(key, index) {
|
|
761
|
+
return key == null ? String(index) : String(key);
|
|
762
|
+
}
|
|
763
|
+
function normalizeItems(items, children) {
|
|
764
|
+
if (items)
|
|
765
|
+
return items;
|
|
766
|
+
const paneItems = [];
|
|
767
|
+
Children.forEach(children, (child, index) => {
|
|
768
|
+
if (!isValidElement(child))
|
|
769
|
+
return;
|
|
770
|
+
paneItems.push({
|
|
771
|
+
key: stringifyKey(child.key, index),
|
|
772
|
+
label: child.props.tab ?? child.props.label,
|
|
773
|
+
icon: child.props.icon,
|
|
774
|
+
disabled: child.props.disabled,
|
|
775
|
+
closable: child.props.closable,
|
|
776
|
+
closeIcon: child.props.closeIcon,
|
|
777
|
+
forceRender: child.props.forceRender,
|
|
778
|
+
className: child.props.className,
|
|
779
|
+
style: child.props.style,
|
|
780
|
+
children: child.props.children
|
|
781
|
+
});
|
|
782
|
+
});
|
|
783
|
+
return paneItems;
|
|
784
|
+
}
|
|
785
|
+
function getInitialActiveKey(items, defaultActiveKey) {
|
|
786
|
+
if (defaultActiveKey !== undefined)
|
|
787
|
+
return defaultActiveKey;
|
|
788
|
+
return items.find((item) => !item.disabled)?.key ?? items[0]?.key;
|
|
789
|
+
}
|
|
790
|
+
function getCurrentActiveKey(items, activeKey) {
|
|
791
|
+
if (activeKey !== undefined && items.some((item) => item.key === activeKey)) {
|
|
792
|
+
return activeKey;
|
|
793
|
+
}
|
|
794
|
+
return items.find((item) => !item.disabled)?.key ?? items[0]?.key;
|
|
795
|
+
}
|
|
796
|
+
function isEditable(type) {
|
|
797
|
+
return type === "editable-card";
|
|
798
|
+
}
|
|
799
|
+
function getTabLabel(item) {
|
|
800
|
+
const label = item.label ?? item.key;
|
|
801
|
+
return /* @__PURE__ */ jsxs5(Fragment3, {
|
|
802
|
+
children: [
|
|
803
|
+
item.icon ? /* @__PURE__ */ jsx5("span", {
|
|
804
|
+
className: tabIconClass,
|
|
805
|
+
children: item.icon
|
|
806
|
+
}) : null,
|
|
807
|
+
label
|
|
808
|
+
]
|
|
809
|
+
});
|
|
810
|
+
}
|
|
811
|
+
function shouldRenderPanel({
|
|
812
|
+
item,
|
|
813
|
+
active,
|
|
814
|
+
destroyInactiveTabPane
|
|
815
|
+
}) {
|
|
816
|
+
if (active || item.forceRender)
|
|
817
|
+
return true;
|
|
818
|
+
return !(item.destroyInactiveTabPane ?? destroyInactiveTabPane);
|
|
819
|
+
}
|
|
820
|
+
var TabPane = (props) => /* @__PURE__ */ jsx5(Fragment3, {
|
|
821
|
+
children: props.children
|
|
822
|
+
});
|
|
823
|
+
TabPane.displayName = "Tabs.TabPane";
|
|
824
|
+
var TabsBase = forwardRef5(({
|
|
825
|
+
items,
|
|
826
|
+
activeKey,
|
|
827
|
+
defaultActiveKey,
|
|
828
|
+
onChange,
|
|
829
|
+
onTabClick,
|
|
830
|
+
tabPosition = "top",
|
|
831
|
+
type = "line",
|
|
832
|
+
size = "middle",
|
|
833
|
+
hideAdd,
|
|
834
|
+
addIcon,
|
|
835
|
+
removeIcon,
|
|
836
|
+
onEdit,
|
|
837
|
+
destroyInactiveTabPane,
|
|
838
|
+
centered,
|
|
839
|
+
className,
|
|
840
|
+
children,
|
|
841
|
+
id,
|
|
842
|
+
...props
|
|
843
|
+
}, ref) => {
|
|
844
|
+
const reactId = useId();
|
|
845
|
+
const tabsId = id ?? `tabs-${reactId}`;
|
|
846
|
+
const finalItems = normalizeItems(items, children);
|
|
847
|
+
const [internalActiveKey, setInternalActiveKey] = useState3(() => getInitialActiveKey(finalItems, defaultActiveKey));
|
|
848
|
+
const isControlled = activeKey !== undefined;
|
|
849
|
+
const selectedKey = getCurrentActiveKey(finalItems, isControlled ? activeKey : internalActiveKey);
|
|
850
|
+
const tabRefs = useRef2([]);
|
|
851
|
+
const editable = isEditable(type);
|
|
852
|
+
function changeActive(nextKey) {
|
|
853
|
+
if (nextKey === selectedKey)
|
|
854
|
+
return;
|
|
855
|
+
if (!isControlled) {
|
|
856
|
+
setInternalActiveKey(nextKey);
|
|
857
|
+
}
|
|
858
|
+
onChange?.(nextKey);
|
|
859
|
+
}
|
|
860
|
+
function selectItem(item, event) {
|
|
861
|
+
if (item.disabled)
|
|
862
|
+
return;
|
|
863
|
+
if (event) {
|
|
864
|
+
onTabClick?.(item.key, event);
|
|
865
|
+
}
|
|
866
|
+
changeActive(item.key);
|
|
867
|
+
}
|
|
868
|
+
function closeItem(item) {
|
|
869
|
+
if (item.disabled)
|
|
870
|
+
return;
|
|
871
|
+
onEdit?.(item.key, "remove");
|
|
872
|
+
}
|
|
873
|
+
function addItem(event) {
|
|
874
|
+
onEdit?.(event, "add");
|
|
875
|
+
}
|
|
876
|
+
function focusByOffset(index, offset) {
|
|
877
|
+
if (finalItems.length === 0)
|
|
878
|
+
return;
|
|
879
|
+
for (let step = 1;step <= finalItems.length; step += 1) {
|
|
880
|
+
const nextIndex = (index + offset * step + finalItems.length) % finalItems.length;
|
|
881
|
+
const nextItem = finalItems[nextIndex];
|
|
882
|
+
if (!nextItem.disabled) {
|
|
883
|
+
tabRefs.current[nextIndex]?.focus();
|
|
884
|
+
changeActive(nextItem.key);
|
|
885
|
+
return;
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
}
|
|
889
|
+
function focusEdge(edge) {
|
|
890
|
+
const candidates = edge === "first" ? finalItems : [...finalItems].reverse();
|
|
891
|
+
const item = candidates.find((candidate) => !candidate.disabled);
|
|
892
|
+
if (!item)
|
|
893
|
+
return;
|
|
894
|
+
const index = finalItems.findIndex((candidate) => candidate.key === item.key);
|
|
895
|
+
tabRefs.current[index]?.focus();
|
|
896
|
+
changeActive(item.key);
|
|
897
|
+
}
|
|
898
|
+
function handleKeyDown(item, index, event) {
|
|
899
|
+
if (event.key === "ArrowRight" || event.key === "ArrowDown") {
|
|
900
|
+
event.preventDefault();
|
|
901
|
+
focusByOffset(index, 1);
|
|
902
|
+
} else if (event.key === "ArrowLeft" || event.key === "ArrowUp") {
|
|
903
|
+
event.preventDefault();
|
|
904
|
+
focusByOffset(index, -1);
|
|
905
|
+
} else if (event.key === "Home") {
|
|
906
|
+
event.preventDefault();
|
|
907
|
+
focusEdge("first");
|
|
908
|
+
} else if (event.key === "End") {
|
|
909
|
+
event.preventDefault();
|
|
910
|
+
focusEdge("last");
|
|
911
|
+
} else if (event.key === "Delete" && editable && item.closable !== false) {
|
|
912
|
+
event.preventDefault();
|
|
913
|
+
onEdit?.(item.key, "remove");
|
|
914
|
+
}
|
|
915
|
+
}
|
|
916
|
+
const tabList = /* @__PURE__ */ jsx5("div", {
|
|
917
|
+
className: tabsBarClass,
|
|
918
|
+
children: /* @__PURE__ */ jsxs5("div", {
|
|
919
|
+
role: "tablist",
|
|
920
|
+
"aria-orientation": tabPosition === "left" || tabPosition === "right" ? "vertical" : "horizontal",
|
|
921
|
+
className: getTabsListClasses({
|
|
922
|
+
tabPosition,
|
|
923
|
+
type,
|
|
924
|
+
size,
|
|
925
|
+
centered
|
|
926
|
+
}),
|
|
927
|
+
children: [
|
|
928
|
+
finalItems.map((item, index) => {
|
|
929
|
+
const active = item.key === selectedKey;
|
|
930
|
+
const panelId = `${tabsId}-panel-${item.key}`;
|
|
931
|
+
const tabId = `${tabsId}-tab-${item.key}`;
|
|
932
|
+
const showClose = editable && item.closable !== false && !item.disabled;
|
|
933
|
+
return /* @__PURE__ */ jsxs5(Fragment2, {
|
|
934
|
+
children: [
|
|
935
|
+
/* @__PURE__ */ jsx5("button", {
|
|
936
|
+
ref: (element) => {
|
|
937
|
+
tabRefs.current[index] = element;
|
|
938
|
+
},
|
|
939
|
+
id: tabId,
|
|
940
|
+
type: "button",
|
|
941
|
+
role: "tab",
|
|
942
|
+
"aria-selected": active,
|
|
943
|
+
"aria-controls": panelId,
|
|
944
|
+
tabIndex: active ? 0 : -1,
|
|
945
|
+
disabled: item.disabled,
|
|
946
|
+
className: getTabClasses({
|
|
947
|
+
active,
|
|
948
|
+
disabled: item.disabled,
|
|
949
|
+
iconOnly: item.icon != null && item.label == null
|
|
950
|
+
}),
|
|
951
|
+
onClick: (event) => selectItem(item, event),
|
|
952
|
+
onKeyDown: (event) => handleKeyDown(item, index, event),
|
|
953
|
+
children: getTabLabel(item)
|
|
954
|
+
}),
|
|
955
|
+
showClose ? /* @__PURE__ */ jsx5("button", {
|
|
956
|
+
type: "button",
|
|
957
|
+
className: tabsCloseClass,
|
|
958
|
+
"aria-label": `Close tab ${item.key}`,
|
|
959
|
+
onClick: (event) => {
|
|
960
|
+
event.stopPropagation();
|
|
961
|
+
closeItem(item);
|
|
962
|
+
},
|
|
963
|
+
children: item.closeIcon ?? removeIcon ?? "x"
|
|
964
|
+
}) : null
|
|
965
|
+
]
|
|
966
|
+
}, item.key);
|
|
967
|
+
}),
|
|
968
|
+
editable && !hideAdd ? /* @__PURE__ */ jsx5("button", {
|
|
969
|
+
type: "button",
|
|
970
|
+
className: tabsAddClass,
|
|
971
|
+
"aria-label": "Add tab",
|
|
972
|
+
onClick: addItem,
|
|
973
|
+
children: addIcon ?? "+"
|
|
974
|
+
}) : null
|
|
975
|
+
]
|
|
976
|
+
})
|
|
977
|
+
});
|
|
978
|
+
const panels = finalItems.map((item) => {
|
|
979
|
+
const active = item.key === selectedKey;
|
|
980
|
+
if (!shouldRenderPanel({ item, active, destroyInactiveTabPane })) {
|
|
981
|
+
return null;
|
|
982
|
+
}
|
|
983
|
+
return /* @__PURE__ */ jsx5("div", {
|
|
984
|
+
id: `${tabsId}-panel-${item.key}`,
|
|
985
|
+
role: "tabpanel",
|
|
986
|
+
"aria-labelledby": `${tabsId}-tab-${item.key}`,
|
|
987
|
+
hidden: !active,
|
|
988
|
+
"data-active": active ? "true" : undefined,
|
|
989
|
+
className: getTabPanelClasses({
|
|
990
|
+
active,
|
|
991
|
+
className: item.className
|
|
992
|
+
}),
|
|
993
|
+
style: item.style,
|
|
994
|
+
children: item.children
|
|
995
|
+
}, item.key);
|
|
996
|
+
});
|
|
997
|
+
return /* @__PURE__ */ jsxs5("div", {
|
|
998
|
+
...props,
|
|
999
|
+
ref,
|
|
1000
|
+
id,
|
|
1001
|
+
className: getTabsRootClasses({ tabPosition, className }),
|
|
1002
|
+
children: [
|
|
1003
|
+
tabPosition === "bottom" || tabPosition === "right" ? panels : null,
|
|
1004
|
+
tabList,
|
|
1005
|
+
tabPosition === "bottom" || tabPosition === "right" ? null : panels
|
|
1006
|
+
]
|
|
1007
|
+
});
|
|
1008
|
+
});
|
|
1009
|
+
TabsBase.displayName = "Tabs";
|
|
1010
|
+
var Tabs = Object.assign(TabsBase, {
|
|
1011
|
+
TabPane
|
|
1012
|
+
});
|
|
1013
|
+
// src/components/dm-tabs/DmTabs.tsx
|
|
1014
|
+
import { forwardRef as forwardRef6 } from "react";
|
|
1015
|
+
|
|
1016
|
+
// src/classes/dm-tabs.ts
|
|
1017
|
+
var dmTabsShellClass = "dm-tabs-shell";
|
|
1018
|
+
var dmTabsLineHorizontalClass = "dm-line-horizontal-tabs";
|
|
1019
|
+
var dmTabsLineVerticalClass = "dm-line-vertical-tabs";
|
|
1020
|
+
var dmTabsCardClass = "dm-card-tabs";
|
|
1021
|
+
var dmTabsCardTransparentClass = "dm-card-transparent-tabs";
|
|
1022
|
+
var dmTabsOptionTreeClass = "dm-option-tree-tabs";
|
|
1023
|
+
function getDmTabsShellClasses({ className }) {
|
|
1024
|
+
return cn(dmTabsShellClass, className);
|
|
1025
|
+
}
|
|
1026
|
+
function getDmTabsClasses({
|
|
1027
|
+
type = "line",
|
|
1028
|
+
tabPosition = "top",
|
|
1029
|
+
transparentCard,
|
|
1030
|
+
optionTree,
|
|
1031
|
+
className
|
|
1032
|
+
}) {
|
|
1033
|
+
const isVerticalLine = type === "line" && (tabPosition === "left" || tabPosition === "right");
|
|
1034
|
+
return cn(type === "line" && (isVerticalLine ? dmTabsLineVerticalClass : dmTabsLineHorizontalClass), type !== "line" && (transparentCard ? dmTabsCardTransparentClass : dmTabsCardClass), optionTree && dmTabsOptionTreeClass, className);
|
|
1035
|
+
}
|
|
1036
|
+
|
|
1037
|
+
// src/components/dm-tabs/DmTabs.tsx
|
|
1038
|
+
import { jsx as jsx6 } from "react/jsx-runtime";
|
|
1039
|
+
var DmTabs = forwardRef6(({
|
|
1040
|
+
type = "line",
|
|
1041
|
+
tabPosition = "top",
|
|
1042
|
+
transparentCard = false,
|
|
1043
|
+
optionTree = false,
|
|
1044
|
+
destroyOnHidden = true,
|
|
1045
|
+
destroyInactiveTabPane,
|
|
1046
|
+
className,
|
|
1047
|
+
style,
|
|
1048
|
+
items,
|
|
1049
|
+
...props
|
|
1050
|
+
}, ref) => /* @__PURE__ */ jsx6("div", {
|
|
1051
|
+
className: getDmTabsShellClasses({}),
|
|
1052
|
+
style,
|
|
1053
|
+
children: /* @__PURE__ */ jsx6(Tabs, {
|
|
1054
|
+
...props,
|
|
1055
|
+
ref,
|
|
1056
|
+
items,
|
|
1057
|
+
type,
|
|
1058
|
+
tabPosition,
|
|
1059
|
+
destroyInactiveTabPane: destroyInactiveTabPane ?? destroyOnHidden,
|
|
1060
|
+
className: getDmTabsClasses({
|
|
1061
|
+
type,
|
|
1062
|
+
tabPosition,
|
|
1063
|
+
transparentCard,
|
|
1064
|
+
optionTree,
|
|
1065
|
+
className
|
|
1066
|
+
})
|
|
1067
|
+
})
|
|
1068
|
+
}));
|
|
1069
|
+
DmTabs.displayName = "DmTabs";
|
|
1070
|
+
// src/components/tree/Tree.tsx
|
|
1071
|
+
import React6, { forwardRef as forwardRef7, useMemo, useState as useState4 } from "react";
|
|
1072
|
+
|
|
1073
|
+
// src/classes/tree.ts
|
|
1074
|
+
var treeBaseClass = "tree";
|
|
1075
|
+
var treeDirectoryClass = "tree-directory";
|
|
1076
|
+
var treeDisabledClass = "tree-disabled";
|
|
1077
|
+
var treeShowLineClass = "tree-show-line";
|
|
1078
|
+
var treeCheckableClass = "tree-checkable";
|
|
1079
|
+
var treeMultipleClass = "tree-multiple";
|
|
1080
|
+
var treeListClass = "tree-list";
|
|
1081
|
+
var treeNodeClass = "tree-node";
|
|
1082
|
+
var treeNodeSelectedClass = "tree-node-selected";
|
|
1083
|
+
var treeNodeCheckedClass = "tree-node-checked";
|
|
1084
|
+
var treeNodeDisabledClass = "tree-node-disabled";
|
|
1085
|
+
var treeNodeExpandedClass = "tree-node-expanded";
|
|
1086
|
+
var treeNodeDraggableClass = "tree-node-draggable";
|
|
1087
|
+
var treeNodeSwitcherClass = "tree-node-switcher";
|
|
1088
|
+
var treeNodeCheckboxClass = "tree-node-checkbox";
|
|
1089
|
+
var treeNodeIconClass = "tree-node-icon";
|
|
1090
|
+
var treeNodeTitleClass = "tree-node-title";
|
|
1091
|
+
var treeNodeChildrenClass = "tree-node-children";
|
|
1092
|
+
function getTreeClasses({
|
|
1093
|
+
disabled,
|
|
1094
|
+
checkable,
|
|
1095
|
+
multiple,
|
|
1096
|
+
showLine,
|
|
1097
|
+
directory,
|
|
1098
|
+
className
|
|
1099
|
+
}) {
|
|
1100
|
+
return cn(treeBaseClass, disabled && treeDisabledClass, checkable && treeCheckableClass, multiple && treeMultipleClass, showLine && treeShowLineClass, directory && treeDirectoryClass, className);
|
|
1101
|
+
}
|
|
1102
|
+
function getTreeNodeClasses({
|
|
1103
|
+
selected,
|
|
1104
|
+
checked,
|
|
1105
|
+
disabled,
|
|
1106
|
+
expanded,
|
|
1107
|
+
draggable,
|
|
1108
|
+
className
|
|
1109
|
+
}) {
|
|
1110
|
+
return cn(treeNodeClass, selected && treeNodeSelectedClass, checked && treeNodeCheckedClass, disabled && treeNodeDisabledClass, expanded && treeNodeExpandedClass, draggable && treeNodeDraggableClass, className);
|
|
1111
|
+
}
|
|
1112
|
+
|
|
1113
|
+
// src/components/tree/Tree.tsx
|
|
1114
|
+
import { jsx as jsx7, jsxs as jsxs6 } from "react/jsx-runtime";
|
|
1115
|
+
function normalizeKeys(keys) {
|
|
1116
|
+
return keys?.map(String) ?? [];
|
|
1117
|
+
}
|
|
1118
|
+
function uniqueKeys(keys) {
|
|
1119
|
+
return Array.from(new Set(keys));
|
|
1120
|
+
}
|
|
1121
|
+
function hasNode(node) {
|
|
1122
|
+
return node !== undefined && node !== null && node !== false;
|
|
1123
|
+
}
|
|
1124
|
+
function isCurrentTreeItemEvent(event) {
|
|
1125
|
+
return event.target instanceof Element && event.target.closest('[role="treeitem"]') === event.currentTarget;
|
|
1126
|
+
}
|
|
1127
|
+
function isActivationKey(key) {
|
|
1128
|
+
return key === "Enter" || key === " ";
|
|
1129
|
+
}
|
|
1130
|
+
function buildFlatTree(nodes, level = 0, parentKey = undefined, parentPos = "0") {
|
|
1131
|
+
return nodes.map((node, index) => {
|
|
1132
|
+
const keyString = String(node.key);
|
|
1133
|
+
const pos = `${parentPos}-${index}`;
|
|
1134
|
+
const item = {
|
|
1135
|
+
key: node.key,
|
|
1136
|
+
keyString,
|
|
1137
|
+
node,
|
|
1138
|
+
parentKey,
|
|
1139
|
+
children: [],
|
|
1140
|
+
level,
|
|
1141
|
+
pos
|
|
1142
|
+
};
|
|
1143
|
+
item.children = buildFlatTree(node.children ?? [], level + 1, keyString, pos);
|
|
1144
|
+
return item;
|
|
1145
|
+
});
|
|
1146
|
+
}
|
|
1147
|
+
function flattenTree(nodes) {
|
|
1148
|
+
return nodes.flatMap((node) => [node, ...flattenTree(node.children)]);
|
|
1149
|
+
}
|
|
1150
|
+
function descendantKeys(node) {
|
|
1151
|
+
return flattenTree(node.children).map((child) => child.keyString);
|
|
1152
|
+
}
|
|
1153
|
+
function eventNode(item) {
|
|
1154
|
+
return {
|
|
1155
|
+
...item.node,
|
|
1156
|
+
key: item.key,
|
|
1157
|
+
pos: item.pos,
|
|
1158
|
+
data: item.node
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
function eventInfo(item, nativeEvent) {
|
|
1162
|
+
return {
|
|
1163
|
+
node: eventNode(item),
|
|
1164
|
+
nativeEvent
|
|
1165
|
+
};
|
|
1166
|
+
}
|
|
1167
|
+
function checkedNodesFromKeys(flatNodes, keys) {
|
|
1168
|
+
const keySet = new Set(keys);
|
|
1169
|
+
return flatNodes.filter((item) => keySet.has(item.keyString)).map((item) => item.node);
|
|
1170
|
+
}
|
|
1171
|
+
function treeDataFromChildren(children) {
|
|
1172
|
+
return React6.Children.toArray(children).flatMap((child, index) => {
|
|
1173
|
+
if (!React6.isValidElement(child)) {
|
|
1174
|
+
return [];
|
|
1175
|
+
}
|
|
1176
|
+
const {
|
|
1177
|
+
title,
|
|
1178
|
+
eventKey,
|
|
1179
|
+
children: childChildren,
|
|
1180
|
+
disabled,
|
|
1181
|
+
disableCheckbox,
|
|
1182
|
+
selectable,
|
|
1183
|
+
checkable,
|
|
1184
|
+
icon,
|
|
1185
|
+
isLeaf,
|
|
1186
|
+
className
|
|
1187
|
+
} = child.props;
|
|
1188
|
+
return [
|
|
1189
|
+
{
|
|
1190
|
+
key: eventKey ?? child.key ?? index,
|
|
1191
|
+
title,
|
|
1192
|
+
disabled,
|
|
1193
|
+
disableCheckbox,
|
|
1194
|
+
selectable,
|
|
1195
|
+
checkable,
|
|
1196
|
+
icon,
|
|
1197
|
+
isLeaf,
|
|
1198
|
+
className,
|
|
1199
|
+
children: treeDataFromChildren(childChildren)
|
|
1200
|
+
}
|
|
1201
|
+
];
|
|
1202
|
+
});
|
|
1203
|
+
}
|
|
1204
|
+
var TreeNode = forwardRef7(({
|
|
1205
|
+
title,
|
|
1206
|
+
children,
|
|
1207
|
+
disabled,
|
|
1208
|
+
checkable,
|
|
1209
|
+
selectable,
|
|
1210
|
+
icon,
|
|
1211
|
+
className,
|
|
1212
|
+
...props
|
|
1213
|
+
}, ref) => /* @__PURE__ */ jsxs6("div", {
|
|
1214
|
+
...props,
|
|
1215
|
+
ref,
|
|
1216
|
+
"aria-disabled": disabled || undefined,
|
|
1217
|
+
className: getTreeNodeClasses({ disabled, className }),
|
|
1218
|
+
children: [
|
|
1219
|
+
checkable ? /* @__PURE__ */ jsx7("input", {
|
|
1220
|
+
type: "checkbox",
|
|
1221
|
+
className: treeNodeCheckboxClass,
|
|
1222
|
+
disabled,
|
|
1223
|
+
readOnly: true
|
|
1224
|
+
}) : null,
|
|
1225
|
+
hasNode(icon) ? /* @__PURE__ */ jsx7("span", {
|
|
1226
|
+
className: treeNodeIconClass,
|
|
1227
|
+
children: icon
|
|
1228
|
+
}) : null,
|
|
1229
|
+
/* @__PURE__ */ jsx7("span", {
|
|
1230
|
+
className: treeNodeTitleClass,
|
|
1231
|
+
children: title
|
|
1232
|
+
}),
|
|
1233
|
+
selectable === false ? null : children
|
|
1234
|
+
]
|
|
1235
|
+
}));
|
|
1236
|
+
TreeNode.displayName = "Tree.TreeNode";
|
|
1237
|
+
function TreeRoot({
|
|
1238
|
+
treeData,
|
|
1239
|
+
children,
|
|
1240
|
+
expandedKeys,
|
|
1241
|
+
defaultExpandedKeys,
|
|
1242
|
+
selectedKeys,
|
|
1243
|
+
defaultSelectedKeys,
|
|
1244
|
+
checkedKeys,
|
|
1245
|
+
defaultCheckedKeys,
|
|
1246
|
+
checkable,
|
|
1247
|
+
selectable = true,
|
|
1248
|
+
multiple,
|
|
1249
|
+
disabled,
|
|
1250
|
+
showLine,
|
|
1251
|
+
showIcon,
|
|
1252
|
+
draggable,
|
|
1253
|
+
blockNode,
|
|
1254
|
+
defaultExpandAll,
|
|
1255
|
+
loadData,
|
|
1256
|
+
titleRender,
|
|
1257
|
+
onExpand,
|
|
1258
|
+
onSelect,
|
|
1259
|
+
onCheck,
|
|
1260
|
+
onDragStart,
|
|
1261
|
+
onDragEnter,
|
|
1262
|
+
onDragOver,
|
|
1263
|
+
onDragLeave,
|
|
1264
|
+
onDragEnd,
|
|
1265
|
+
onDrop,
|
|
1266
|
+
className,
|
|
1267
|
+
...props
|
|
1268
|
+
}, ref) {
|
|
1269
|
+
const data = useMemo(() => treeData ?? treeDataFromChildren(children), [children, treeData]);
|
|
1270
|
+
const flatRoots = useMemo(() => buildFlatTree(data), [data]);
|
|
1271
|
+
const flatNodes = useMemo(() => flattenTree(flatRoots), [flatRoots]);
|
|
1272
|
+
const allExpandableKeys = useMemo(() => flatNodes.filter((item) => item.children.length > 0 || item.node.isLeaf === false).map((item) => item.keyString), [flatNodes]);
|
|
1273
|
+
const expandedControlled = expandedKeys !== undefined;
|
|
1274
|
+
const selectedControlled = selectedKeys !== undefined;
|
|
1275
|
+
const checkedControlled = checkedKeys !== undefined;
|
|
1276
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState4(() => defaultExpandAll ? allExpandableKeys : normalizeKeys(defaultExpandedKeys));
|
|
1277
|
+
const [internalSelectedKeys, setInternalSelectedKeys] = useState4(() => normalizeKeys(defaultSelectedKeys));
|
|
1278
|
+
const [internalCheckedKeys, setInternalCheckedKeys] = useState4(() => normalizeKeys(defaultCheckedKeys));
|
|
1279
|
+
const [dragNodeKey, setDragNodeKey] = useState4();
|
|
1280
|
+
const currentExpandedKeys = expandedControlled ? normalizeKeys(expandedKeys) : internalExpandedKeys;
|
|
1281
|
+
const currentSelectedKeys = selectedControlled ? normalizeKeys(selectedKeys) : internalSelectedKeys;
|
|
1282
|
+
const currentCheckedKeys = checkedControlled ? normalizeKeys(checkedKeys) : internalCheckedKeys;
|
|
1283
|
+
const expandedKeySet = useMemo(() => new Set(currentExpandedKeys), [currentExpandedKeys]);
|
|
1284
|
+
const selectedKeySet = useMemo(() => new Set(currentSelectedKeys), [currentSelectedKeys]);
|
|
1285
|
+
const checkedKeySet = useMemo(() => new Set(currentCheckedKeys), [currentCheckedKeys]);
|
|
1286
|
+
function updateExpandedKeys(nextExpandedKeys, item, nativeEvent, expanded) {
|
|
1287
|
+
if (!expandedControlled) {
|
|
1288
|
+
setInternalExpandedKeys(nextExpandedKeys);
|
|
1289
|
+
}
|
|
1290
|
+
onExpand?.(nextExpandedKeys, {
|
|
1291
|
+
...eventInfo(item, nativeEvent),
|
|
1292
|
+
expanded
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
function toggleExpand(item, nativeEvent) {
|
|
1296
|
+
if (disabled || item.node.disabled || item.node.isLeaf) {
|
|
1297
|
+
return;
|
|
1298
|
+
}
|
|
1299
|
+
const expanded = !expandedKeySet.has(item.keyString);
|
|
1300
|
+
const nextExpandedKeys = expanded ? uniqueKeys([...currentExpandedKeys, item.keyString]) : currentExpandedKeys.filter((key) => key !== item.keyString);
|
|
1301
|
+
updateExpandedKeys(nextExpandedKeys, item, nativeEvent, expanded);
|
|
1302
|
+
if (expanded && loadData) {
|
|
1303
|
+
loadData(eventNode(item));
|
|
1304
|
+
}
|
|
1305
|
+
}
|
|
1306
|
+
function selectNode(item, nativeEvent) {
|
|
1307
|
+
if (disabled || item.node.disabled || selectable === false || item.node.selectable === false) {
|
|
1308
|
+
return;
|
|
1309
|
+
}
|
|
1310
|
+
const selected = selectedKeySet.has(item.keyString);
|
|
1311
|
+
const nextSelectedKeys = selected && multiple ? currentSelectedKeys.filter((key) => key !== item.keyString) : selected ? currentSelectedKeys : multiple ? uniqueKeys([...currentSelectedKeys, item.keyString]) : [item.keyString];
|
|
1312
|
+
if (!selectedControlled) {
|
|
1313
|
+
setInternalSelectedKeys(nextSelectedKeys);
|
|
1314
|
+
}
|
|
1315
|
+
onSelect?.(nextSelectedKeys, {
|
|
1316
|
+
...eventInfo(item, nativeEvent),
|
|
1317
|
+
selected: !selected,
|
|
1318
|
+
selectedNodes: flatNodes.filter((node) => nextSelectedKeys.includes(node.keyString)).map((node) => node.node)
|
|
1319
|
+
});
|
|
1320
|
+
}
|
|
1321
|
+
function checkNode(item, nativeEvent) {
|
|
1322
|
+
if (disabled || item.node.disabled || item.node.disableCheckbox || checkable === false || item.node.checkable === false) {
|
|
1323
|
+
return;
|
|
1324
|
+
}
|
|
1325
|
+
const checked = checkedKeySet.has(item.keyString);
|
|
1326
|
+
const affectedKeys = [item.keyString, ...descendantKeys(item)];
|
|
1327
|
+
const nextCheckedKeys = checked ? currentCheckedKeys.filter((key) => !affectedKeys.includes(key)) : uniqueKeys([...currentCheckedKeys, ...affectedKeys]);
|
|
1328
|
+
if (!checkedControlled) {
|
|
1329
|
+
setInternalCheckedKeys(nextCheckedKeys);
|
|
1330
|
+
}
|
|
1331
|
+
onCheck?.(nextCheckedKeys, {
|
|
1332
|
+
...eventInfo(item, nativeEvent),
|
|
1333
|
+
checked: !checked,
|
|
1334
|
+
checkedNodes: checkedNodesFromKeys(flatNodes, nextCheckedKeys)
|
|
1335
|
+
});
|
|
1336
|
+
}
|
|
1337
|
+
function dragInfo(item, event) {
|
|
1338
|
+
return {
|
|
1339
|
+
...eventInfo(item, event),
|
|
1340
|
+
event
|
|
1341
|
+
};
|
|
1342
|
+
}
|
|
1343
|
+
function handleDrop(item, event) {
|
|
1344
|
+
event.preventDefault();
|
|
1345
|
+
const dragNode = flatNodes.find((node) => node.keyString === dragNodeKey);
|
|
1346
|
+
const info = {
|
|
1347
|
+
...dragInfo(item, event),
|
|
1348
|
+
dragNode: dragNode ? eventNode(dragNode) : undefined,
|
|
1349
|
+
dragNodesKeys: dragNode ? [dragNode.key] : [],
|
|
1350
|
+
dropPosition: 0,
|
|
1351
|
+
dropToGap: false
|
|
1352
|
+
};
|
|
1353
|
+
onDrop?.(info);
|
|
1354
|
+
}
|
|
1355
|
+
function renderNode(item) {
|
|
1356
|
+
const nodeDisabled = disabled || item.node.disabled;
|
|
1357
|
+
const expanded = expandedKeySet.has(item.keyString);
|
|
1358
|
+
const checked = checkedKeySet.has(item.keyString);
|
|
1359
|
+
const selected = selectedKeySet.has(item.keyString);
|
|
1360
|
+
const expandable = item.children.length > 0 || item.node.isLeaf === false;
|
|
1361
|
+
const nodeCheckable = checkable && item.node.checkable !== false;
|
|
1362
|
+
const nodeDraggable = Boolean(draggable && !nodeDisabled);
|
|
1363
|
+
const title = titleRender?.(item.node) ?? item.node.title ?? item.key;
|
|
1364
|
+
return /* @__PURE__ */ jsxs6("li", {
|
|
1365
|
+
role: "treeitem",
|
|
1366
|
+
"aria-expanded": expandable ? expanded : undefined,
|
|
1367
|
+
"aria-selected": selected,
|
|
1368
|
+
"aria-disabled": nodeDisabled || undefined,
|
|
1369
|
+
tabIndex: nodeDisabled ? undefined : 0,
|
|
1370
|
+
onClick: (event) => {
|
|
1371
|
+
if (isCurrentTreeItemEvent(event)) {
|
|
1372
|
+
selectNode(item, event);
|
|
1373
|
+
}
|
|
1374
|
+
},
|
|
1375
|
+
onKeyDown: (event) => {
|
|
1376
|
+
if (isActivationKey(event.key) && isCurrentTreeItemEvent(event)) {
|
|
1377
|
+
event.preventDefault();
|
|
1378
|
+
selectNode(item, event);
|
|
1379
|
+
}
|
|
1380
|
+
},
|
|
1381
|
+
onDragStart: (event) => {
|
|
1382
|
+
setDragNodeKey(item.keyString);
|
|
1383
|
+
onDragStart?.(dragInfo(item, event));
|
|
1384
|
+
},
|
|
1385
|
+
onDragEnter: (event) => onDragEnter?.(dragInfo(item, event)),
|
|
1386
|
+
onDragOver: (event) => {
|
|
1387
|
+
if (onDrop) {
|
|
1388
|
+
event.preventDefault();
|
|
1389
|
+
}
|
|
1390
|
+
onDragOver?.(dragInfo(item, event));
|
|
1391
|
+
},
|
|
1392
|
+
onDragLeave: (event) => onDragLeave?.(dragInfo(item, event)),
|
|
1393
|
+
onDragEnd: (event) => onDragEnd?.(dragInfo(item, event)),
|
|
1394
|
+
onDrop: (event) => handleDrop(item, event),
|
|
1395
|
+
children: [
|
|
1396
|
+
/* @__PURE__ */ jsxs6("div", {
|
|
1397
|
+
className: getTreeNodeClasses({
|
|
1398
|
+
selected,
|
|
1399
|
+
checked,
|
|
1400
|
+
disabled: nodeDisabled,
|
|
1401
|
+
expanded,
|
|
1402
|
+
draggable: nodeDraggable,
|
|
1403
|
+
className: cn(item.node.className, blockNode && "tree-node-block")
|
|
1404
|
+
}),
|
|
1405
|
+
style: { paddingInlineStart: item.level * 16 },
|
|
1406
|
+
draggable: nodeDraggable,
|
|
1407
|
+
children: [
|
|
1408
|
+
/* @__PURE__ */ jsx7("button", {
|
|
1409
|
+
type: "button",
|
|
1410
|
+
"aria-label": expanded ? `Collapse ${item.keyString}` : `Expand ${item.keyString}`,
|
|
1411
|
+
className: treeNodeSwitcherClass,
|
|
1412
|
+
disabled: nodeDisabled || !expandable,
|
|
1413
|
+
onClick: (event) => {
|
|
1414
|
+
event.stopPropagation();
|
|
1415
|
+
toggleExpand(item, event);
|
|
1416
|
+
},
|
|
1417
|
+
children: expandable ? expanded ? "v" : ">" : showLine ? "-" : ""
|
|
1418
|
+
}),
|
|
1419
|
+
nodeCheckable ? /* @__PURE__ */ jsx7("input", {
|
|
1420
|
+
type: "checkbox",
|
|
1421
|
+
className: treeNodeCheckboxClass,
|
|
1422
|
+
"aria-label": `Check ${item.keyString}`,
|
|
1423
|
+
checked,
|
|
1424
|
+
disabled: nodeDisabled || item.node.disableCheckbox,
|
|
1425
|
+
onChange: (event) => checkNode(item, event),
|
|
1426
|
+
onClick: (event) => event.stopPropagation()
|
|
1427
|
+
}) : null,
|
|
1428
|
+
showIcon && hasNode(item.node.icon) ? /* @__PURE__ */ jsx7("span", {
|
|
1429
|
+
className: treeNodeIconClass,
|
|
1430
|
+
children: item.node.icon
|
|
1431
|
+
}) : null,
|
|
1432
|
+
/* @__PURE__ */ jsx7("span", {
|
|
1433
|
+
className: treeNodeTitleClass,
|
|
1434
|
+
children: title
|
|
1435
|
+
})
|
|
1436
|
+
]
|
|
1437
|
+
}),
|
|
1438
|
+
expanded && item.children.length > 0 ? /* @__PURE__ */ jsx7("ul", {
|
|
1439
|
+
className: treeNodeChildrenClass,
|
|
1440
|
+
role: "group",
|
|
1441
|
+
children: item.children.map(renderNode)
|
|
1442
|
+
}) : null
|
|
1443
|
+
]
|
|
1444
|
+
}, item.keyString);
|
|
1445
|
+
}
|
|
1446
|
+
return /* @__PURE__ */ jsx7("div", {
|
|
1447
|
+
...props,
|
|
1448
|
+
ref,
|
|
1449
|
+
className: getTreeClasses({
|
|
1450
|
+
disabled,
|
|
1451
|
+
checkable,
|
|
1452
|
+
multiple,
|
|
1453
|
+
showLine,
|
|
1454
|
+
className
|
|
1455
|
+
}),
|
|
1456
|
+
role: "tree",
|
|
1457
|
+
"aria-multiselectable": multiple || undefined,
|
|
1458
|
+
children: /* @__PURE__ */ jsx7("ul", {
|
|
1459
|
+
className: treeListClass,
|
|
1460
|
+
children: flatRoots.map(renderNode)
|
|
1461
|
+
})
|
|
1462
|
+
});
|
|
1463
|
+
}
|
|
1464
|
+
var TreeBase = forwardRef7(TreeRoot);
|
|
1465
|
+
function DirectoryTreeRoot({ className, multiple = true, ...props }, ref) {
|
|
1466
|
+
return /* @__PURE__ */ jsx7(TreeBase, {
|
|
1467
|
+
...props,
|
|
1468
|
+
ref,
|
|
1469
|
+
multiple,
|
|
1470
|
+
className: cn("tree-directory", className)
|
|
1471
|
+
});
|
|
1472
|
+
}
|
|
1473
|
+
var DirectoryTree = forwardRef7(DirectoryTreeRoot);
|
|
1474
|
+
var TreeNodeComponent = TreeNode;
|
|
1475
|
+
var Tree = TreeBase;
|
|
1476
|
+
Tree.TreeNode = TreeNodeComponent;
|
|
1477
|
+
Tree.DirectoryTree = DirectoryTree;
|
|
1478
|
+
Tree.displayName = "Tree";
|
|
1479
|
+
// src/components/dm-tree/DmTree.tsx
|
|
1480
|
+
import { useMemo as useMemo2, useState as useState5 } from "react";
|
|
1481
|
+
|
|
1482
|
+
// src/classes/dm-tree.ts
|
|
1483
|
+
var dmTreeBaseClass = "dm-tree";
|
|
1484
|
+
var dmTreeAutoWidthClass = "dm-tree-auto-width";
|
|
1485
|
+
var dmTreeContentClass = "dm-tree-content";
|
|
1486
|
+
var dmTreeToolbarClass = "dm-tree-toolbar";
|
|
1487
|
+
var dmTreeIconToolbarClass = "dm-tree-icon-toolbar";
|
|
1488
|
+
var dmTreeAllButtonClass = "dm-tree-all-button";
|
|
1489
|
+
var dmTreeAllButtonSelectedClass = "dm-tree-all-button-selected";
|
|
1490
|
+
var dmTreeSearchClass = "dm-tree-search";
|
|
1491
|
+
var dmTreeBodyClass = "dm-tree-body";
|
|
1492
|
+
var dmTreeNodeTitleClass = "dm-tree-node-title";
|
|
1493
|
+
var dmTreeNodePrefixClass = "dm-tree-node-prefix";
|
|
1494
|
+
var dmTreeItemToolbarClass = "dm-tree-item-toolbar";
|
|
1495
|
+
var dmTreeItemToolbarVisibleClass = "dm-tree-item-toolbar-visible";
|
|
1496
|
+
var dmTreeOptionClass = "dm-tree-option";
|
|
1497
|
+
function getDmTreeClasses({
|
|
1498
|
+
autoWidth,
|
|
1499
|
+
optionTree,
|
|
1500
|
+
className
|
|
1501
|
+
}) {
|
|
1502
|
+
return cn(dmTreeBaseClass, autoWidth && dmTreeAutoWidthClass, optionTree && dmTreeOptionClass, className);
|
|
1503
|
+
}
|
|
1504
|
+
function getDmTreeAllButtonClasses({
|
|
1505
|
+
selected,
|
|
1506
|
+
className
|
|
1507
|
+
}) {
|
|
1508
|
+
return cn(dmTreeAllButtonClass, selected && dmTreeAllButtonSelectedClass, className);
|
|
1509
|
+
}
|
|
1510
|
+
function getDmTreeItemToolbarClasses({
|
|
1511
|
+
alwaysShow,
|
|
1512
|
+
className
|
|
1513
|
+
}) {
|
|
1514
|
+
return cn(dmTreeItemToolbarClass, alwaysShow && dmTreeItemToolbarVisibleClass, className);
|
|
1515
|
+
}
|
|
1516
|
+
|
|
1517
|
+
// src/components/dm-tree/DmTree.tsx
|
|
1518
|
+
import { jsx as jsx8, jsxs as jsxs7 } from "react/jsx-runtime";
|
|
1519
|
+
var defaultFieldNames = {
|
|
1520
|
+
title: "title",
|
|
1521
|
+
key: "key",
|
|
1522
|
+
children: "children"
|
|
1523
|
+
};
|
|
1524
|
+
function cssSize(value) {
|
|
1525
|
+
if (value === undefined)
|
|
1526
|
+
return;
|
|
1527
|
+
return typeof value === "number" ? `${value}px` : value;
|
|
1528
|
+
}
|
|
1529
|
+
function fieldName(fieldNames, name) {
|
|
1530
|
+
return String(fieldNames?.[name] ?? defaultFieldNames[name]);
|
|
1531
|
+
}
|
|
1532
|
+
function readField(node, field) {
|
|
1533
|
+
return node[field];
|
|
1534
|
+
}
|
|
1535
|
+
function normalizeTreeData(treeData, fieldNames) {
|
|
1536
|
+
const titleField = fieldName(fieldNames, "title");
|
|
1537
|
+
const keyField = fieldName(fieldNames, "key");
|
|
1538
|
+
const childrenField = fieldName(fieldNames, "children");
|
|
1539
|
+
return treeData.map((node) => {
|
|
1540
|
+
const record = node;
|
|
1541
|
+
const children = readField(record, childrenField);
|
|
1542
|
+
return {
|
|
1543
|
+
...node,
|
|
1544
|
+
key: readField(record, keyField) ?? node.key,
|
|
1545
|
+
title: readField(record, titleField) ?? node.title,
|
|
1546
|
+
children: Array.isArray(children) ? normalizeTreeData(children, fieldNames) : undefined,
|
|
1547
|
+
data: node
|
|
1548
|
+
};
|
|
1549
|
+
});
|
|
1550
|
+
}
|
|
1551
|
+
function findNode(treeData, key, fieldNames) {
|
|
1552
|
+
if (key === undefined)
|
|
1553
|
+
return;
|
|
1554
|
+
const keyField = fieldName(fieldNames, "key");
|
|
1555
|
+
const childrenField = fieldName(fieldNames, "children");
|
|
1556
|
+
const queue = [...treeData];
|
|
1557
|
+
for (const node of queue) {
|
|
1558
|
+
if (node[keyField] === key || node.key === key) {
|
|
1559
|
+
return node;
|
|
1560
|
+
}
|
|
1561
|
+
const children = node[childrenField];
|
|
1562
|
+
if (Array.isArray(children)) {
|
|
1563
|
+
queue.push(...children);
|
|
1564
|
+
}
|
|
1565
|
+
}
|
|
1566
|
+
return;
|
|
1567
|
+
}
|
|
1568
|
+
function filterTreeData(treeData, search, fieldNames) {
|
|
1569
|
+
if (!search)
|
|
1570
|
+
return treeData;
|
|
1571
|
+
const titleField = fieldName(fieldNames, "title");
|
|
1572
|
+
const childrenField = fieldName(fieldNames, "children");
|
|
1573
|
+
const needle = search.toLowerCase();
|
|
1574
|
+
return treeData.flatMap((node) => {
|
|
1575
|
+
const record = node;
|
|
1576
|
+
const children = record[childrenField];
|
|
1577
|
+
const filteredChildren = Array.isArray(children) ? filterTreeData(children, search, fieldNames) : [];
|
|
1578
|
+
const title = String(record[titleField] ?? node.title ?? "");
|
|
1579
|
+
const matched = title.toLowerCase().includes(needle);
|
|
1580
|
+
if (!matched && filteredChildren.length === 0)
|
|
1581
|
+
return [];
|
|
1582
|
+
return [
|
|
1583
|
+
{
|
|
1584
|
+
...node,
|
|
1585
|
+
[childrenField]: filteredChildren.length > 0 ? filteredChildren : undefined
|
|
1586
|
+
}
|
|
1587
|
+
];
|
|
1588
|
+
});
|
|
1589
|
+
}
|
|
1590
|
+
function parentKeys(treeData, fieldNames) {
|
|
1591
|
+
if (!treeData)
|
|
1592
|
+
return [];
|
|
1593
|
+
const keyField = fieldName(fieldNames, "key");
|
|
1594
|
+
const childrenField = fieldName(fieldNames, "children");
|
|
1595
|
+
const keys = [];
|
|
1596
|
+
function visit(nodes) {
|
|
1597
|
+
nodes.forEach((node) => {
|
|
1598
|
+
const children = node[childrenField];
|
|
1599
|
+
if (Array.isArray(children) && children.length > 0) {
|
|
1600
|
+
keys.push(node[keyField] ?? node.key);
|
|
1601
|
+
visit(children);
|
|
1602
|
+
}
|
|
1603
|
+
});
|
|
1604
|
+
}
|
|
1605
|
+
visit(treeData);
|
|
1606
|
+
return keys;
|
|
1607
|
+
}
|
|
1608
|
+
function renderToolbar(toolbar, selectedKey, getSelectedItem) {
|
|
1609
|
+
if (!toolbar)
|
|
1610
|
+
return null;
|
|
1611
|
+
if (typeof toolbar === "function") {
|
|
1612
|
+
return toolbar(selectedKey, getSelectedItem);
|
|
1613
|
+
}
|
|
1614
|
+
return toolbar.map((item, index) => /* @__PURE__ */ jsxs7("button", {
|
|
1615
|
+
type: "button",
|
|
1616
|
+
disabled: item.disabled,
|
|
1617
|
+
title: typeof item.label === "string" ? item.label : undefined,
|
|
1618
|
+
onClick: () => item.onClick?.(selectedKey, getSelectedItem),
|
|
1619
|
+
children: [
|
|
1620
|
+
item.icon,
|
|
1621
|
+
item.label
|
|
1622
|
+
]
|
|
1623
|
+
}, index));
|
|
1624
|
+
}
|
|
1625
|
+
function shouldShowAction(action, item) {
|
|
1626
|
+
if (typeof action.show === "function")
|
|
1627
|
+
return action.show(item);
|
|
1628
|
+
return action.show !== false;
|
|
1629
|
+
}
|
|
1630
|
+
function isActionDisabled(action, item) {
|
|
1631
|
+
if (typeof action.disabled === "function")
|
|
1632
|
+
return action.disabled(item);
|
|
1633
|
+
return Boolean(action.disabled);
|
|
1634
|
+
}
|
|
1635
|
+
function CommonDmTree({
|
|
1636
|
+
treeData = [],
|
|
1637
|
+
selectedKey,
|
|
1638
|
+
showAll = true,
|
|
1639
|
+
allItem = { value: 0, label: "All" },
|
|
1640
|
+
buttonTopToolbar,
|
|
1641
|
+
iconTopToolbar,
|
|
1642
|
+
customTopToolbar,
|
|
1643
|
+
itemToolbar,
|
|
1644
|
+
itemToolbarAlwaysShow,
|
|
1645
|
+
beforeSelect,
|
|
1646
|
+
onChange,
|
|
1647
|
+
loading,
|
|
1648
|
+
showSearch,
|
|
1649
|
+
searchPlaceholder = "Search",
|
|
1650
|
+
customSearch,
|
|
1651
|
+
beforeIcon,
|
|
1652
|
+
emptyNode,
|
|
1653
|
+
width = "auto",
|
|
1654
|
+
minNodeWidth = "3rem",
|
|
1655
|
+
fieldNames,
|
|
1656
|
+
className,
|
|
1657
|
+
style,
|
|
1658
|
+
defaultExpandedKeys,
|
|
1659
|
+
expandedKeys,
|
|
1660
|
+
onExpand,
|
|
1661
|
+
showLine,
|
|
1662
|
+
...treeProps
|
|
1663
|
+
}) {
|
|
1664
|
+
const [searchValue, setSearchValue] = useState5("");
|
|
1665
|
+
const [internalExpandedKeys, setInternalExpandedKeys] = useState5(() => defaultExpandedKeys ?? parentKeys(treeData, fieldNames));
|
|
1666
|
+
const filteredTree = useMemo2(() => customSearch || !searchValue ? treeData : filterTreeData(treeData, searchValue, fieldNames), [customSearch, fieldNames, searchValue, treeData]);
|
|
1667
|
+
const normalizedTree = useMemo2(() => normalizeTreeData(filteredTree, fieldNames), [fieldNames, filteredTree]);
|
|
1668
|
+
const searchExpandedKeys = useMemo2(() => parentKeys(filteredTree, fieldNames), [fieldNames, filteredTree]);
|
|
1669
|
+
const treeExpandedKeys = expandedKeys ?? (searchValue && !customSearch ? searchExpandedKeys : internalExpandedKeys);
|
|
1670
|
+
const selectedItem = () => findNode(treeData, selectedKey, fieldNames);
|
|
1671
|
+
const autoWidth = width === "auto";
|
|
1672
|
+
const mergedWidth = autoWidth ? "100%" : cssSize(width);
|
|
1673
|
+
function handleSearch(event) {
|
|
1674
|
+
setSearchValue(event.currentTarget.value);
|
|
1675
|
+
customSearch?.(event);
|
|
1676
|
+
}
|
|
1677
|
+
function commitSelection(nextItem, nextKey) {
|
|
1678
|
+
onChange?.(nextItem, nextKey, selectedKey);
|
|
1679
|
+
}
|
|
1680
|
+
function handleSelect(keys) {
|
|
1681
|
+
const nextKey = keys[0];
|
|
1682
|
+
const nextItem = findNode(treeData, nextKey, fieldNames);
|
|
1683
|
+
if (!nextItem || nextKey === undefined)
|
|
1684
|
+
return;
|
|
1685
|
+
const allowed = beforeSelect?.(nextItem, nextKey, selectedKey);
|
|
1686
|
+
if (allowed && typeof allowed.then === "function") {
|
|
1687
|
+
Promise.resolve(allowed).then((result) => {
|
|
1688
|
+
if (result !== false)
|
|
1689
|
+
commitSelection(nextItem, nextKey);
|
|
1690
|
+
});
|
|
1691
|
+
return;
|
|
1692
|
+
}
|
|
1693
|
+
if (allowed !== false) {
|
|
1694
|
+
commitSelection(nextItem, nextKey);
|
|
1695
|
+
}
|
|
1696
|
+
}
|
|
1697
|
+
function renderTitle(node) {
|
|
1698
|
+
const source = node.data ?? node;
|
|
1699
|
+
const titleField = fieldName(fieldNames, "title");
|
|
1700
|
+
const title = source[titleField] ?? source.title;
|
|
1701
|
+
const actions = typeof itemToolbar === "function" ? itemToolbar(source) : Array.isArray(itemToolbar) ? /* @__PURE__ */ jsx8("span", {
|
|
1702
|
+
className: getDmTreeItemToolbarClasses({ alwaysShow: itemToolbarAlwaysShow }),
|
|
1703
|
+
children: itemToolbar.filter((action) => shouldShowAction(action, source)).map((action, index) => {
|
|
1704
|
+
const disabled = isActionDisabled(action, source);
|
|
1705
|
+
return /* @__PURE__ */ jsx8("button", {
|
|
1706
|
+
type: "button",
|
|
1707
|
+
className: dmTreeItemToolbarClass,
|
|
1708
|
+
"aria-label": action.title,
|
|
1709
|
+
title: action.title,
|
|
1710
|
+
disabled,
|
|
1711
|
+
onClick: (event) => {
|
|
1712
|
+
event.stopPropagation();
|
|
1713
|
+
if (!disabled)
|
|
1714
|
+
action.onClick?.(source);
|
|
1715
|
+
},
|
|
1716
|
+
children: action.icon
|
|
1717
|
+
}, index);
|
|
1718
|
+
})
|
|
1719
|
+
}) : null;
|
|
1720
|
+
return /* @__PURE__ */ jsxs7("span", {
|
|
1721
|
+
className: dmTreeNodeTitleClass,
|
|
1722
|
+
children: [
|
|
1723
|
+
beforeIcon ? /* @__PURE__ */ jsx8("span", {
|
|
1724
|
+
className: dmTreeNodePrefixClass,
|
|
1725
|
+
children: typeof beforeIcon === "function" ? beforeIcon(source) : beforeIcon
|
|
1726
|
+
}) : null,
|
|
1727
|
+
/* @__PURE__ */ jsx8("span", {
|
|
1728
|
+
style: { minWidth: cssSize(minNodeWidth) },
|
|
1729
|
+
children: title
|
|
1730
|
+
}),
|
|
1731
|
+
actions
|
|
1732
|
+
]
|
|
1733
|
+
});
|
|
1734
|
+
}
|
|
1735
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
1736
|
+
className: getDmTreeClasses({ autoWidth, className }),
|
|
1737
|
+
style: { width: mergedWidth, height: "100%", ...style },
|
|
1738
|
+
children: /* @__PURE__ */ jsxs7("div", {
|
|
1739
|
+
className: dmTreeContentClass,
|
|
1740
|
+
children: [
|
|
1741
|
+
customTopToolbar ? /* @__PURE__ */ jsx8("div", {
|
|
1742
|
+
className: dmTreeToolbarClass,
|
|
1743
|
+
children: customTopToolbar
|
|
1744
|
+
}) : null,
|
|
1745
|
+
buttonTopToolbar ? /* @__PURE__ */ jsx8("div", {
|
|
1746
|
+
className: dmTreeToolbarClass,
|
|
1747
|
+
children: renderToolbar(buttonTopToolbar, selectedKey, selectedItem)
|
|
1748
|
+
}) : null,
|
|
1749
|
+
iconTopToolbar ? /* @__PURE__ */ jsx8("div", {
|
|
1750
|
+
className: dmTreeIconToolbarClass,
|
|
1751
|
+
children: renderToolbar(iconTopToolbar, selectedKey, selectedItem)
|
|
1752
|
+
}) : null,
|
|
1753
|
+
showAll ? /* @__PURE__ */ jsx8("button", {
|
|
1754
|
+
type: "button",
|
|
1755
|
+
className: getDmTreeAllButtonClasses({
|
|
1756
|
+
selected: selectedKey === allItem.value
|
|
1757
|
+
}),
|
|
1758
|
+
onClick: () => onChange?.(undefined, allItem.value, selectedKey),
|
|
1759
|
+
children: allItem.label
|
|
1760
|
+
}) : null,
|
|
1761
|
+
showSearch ? /* @__PURE__ */ jsx8("div", {
|
|
1762
|
+
className: dmTreeSearchClass,
|
|
1763
|
+
children: /* @__PURE__ */ jsx8(Input, {
|
|
1764
|
+
allowClear: true,
|
|
1765
|
+
placeholder: searchPlaceholder,
|
|
1766
|
+
value: searchValue,
|
|
1767
|
+
onChange: handleSearch
|
|
1768
|
+
})
|
|
1769
|
+
}) : null,
|
|
1770
|
+
/* @__PURE__ */ jsx8("div", {
|
|
1771
|
+
className: dmTreeBodyClass,
|
|
1772
|
+
children: loading ? /* @__PURE__ */ jsx8(DmStatus, {
|
|
1773
|
+
status: "loading"
|
|
1774
|
+
}) : normalizedTree.length > 0 ? /* @__PURE__ */ jsx8(Tree, {
|
|
1775
|
+
...treeProps,
|
|
1776
|
+
treeData: normalizedTree,
|
|
1777
|
+
selectedKeys: selectedKey === undefined ? [] : [selectedKey],
|
|
1778
|
+
expandedKeys: treeExpandedKeys,
|
|
1779
|
+
showLine: showLine ?? parentKeys(treeData, fieldNames).length > 0,
|
|
1780
|
+
blockNode: true,
|
|
1781
|
+
titleRender: renderTitle,
|
|
1782
|
+
onSelect: (keys) => handleSelect(keys),
|
|
1783
|
+
onExpand: (keys, info) => {
|
|
1784
|
+
setInternalExpandedKeys(keys);
|
|
1785
|
+
onExpand?.(keys, info);
|
|
1786
|
+
}
|
|
1787
|
+
}) : emptyNode ?? /* @__PURE__ */ jsx8(DmStatus, {
|
|
1788
|
+
status: "empty"
|
|
1789
|
+
})
|
|
1790
|
+
})
|
|
1791
|
+
]
|
|
1792
|
+
})
|
|
1793
|
+
});
|
|
1794
|
+
}
|
|
1795
|
+
function OptionDmTree(props) {
|
|
1796
|
+
const {
|
|
1797
|
+
items,
|
|
1798
|
+
defaultActiveKey,
|
|
1799
|
+
activeKey,
|
|
1800
|
+
clearOtherSelection = true,
|
|
1801
|
+
width = "auto",
|
|
1802
|
+
minNodeWidth,
|
|
1803
|
+
onChange,
|
|
1804
|
+
className,
|
|
1805
|
+
style,
|
|
1806
|
+
isTabTree,
|
|
1807
|
+
...rest
|
|
1808
|
+
} = props;
|
|
1809
|
+
const tabItems = items.map(({ TreeSetting, key, ...item }) => ({
|
|
1810
|
+
...item,
|
|
1811
|
+
key,
|
|
1812
|
+
children: /* @__PURE__ */ jsx8(CommonDmTree, {
|
|
1813
|
+
...TreeSetting,
|
|
1814
|
+
minNodeWidth: TreeSetting.minNodeWidth ?? minNodeWidth,
|
|
1815
|
+
onChange: (node, selected, before) => {
|
|
1816
|
+
if (clearOtherSelection) {
|
|
1817
|
+
items.forEach((other) => {
|
|
1818
|
+
if (other.key !== key && other.TreeSetting.selectedKey !== undefined) {
|
|
1819
|
+
other.TreeSetting.onChange?.(undefined, undefined, other.TreeSetting.selectedKey);
|
|
1820
|
+
}
|
|
1821
|
+
});
|
|
1822
|
+
}
|
|
1823
|
+
TreeSetting.onChange?.(node, selected, before);
|
|
1824
|
+
}
|
|
1825
|
+
})
|
|
1826
|
+
}));
|
|
1827
|
+
return /* @__PURE__ */ jsx8("div", {
|
|
1828
|
+
...rest,
|
|
1829
|
+
className: getDmTreeClasses({ optionTree: true, className }),
|
|
1830
|
+
style: { width: cssSize(width) ?? "100%", height: "100%", ...style },
|
|
1831
|
+
children: /* @__PURE__ */ jsx8(DmTabs, {
|
|
1832
|
+
centered: true,
|
|
1833
|
+
optionTree: true,
|
|
1834
|
+
type: "line",
|
|
1835
|
+
activeKey,
|
|
1836
|
+
defaultActiveKey,
|
|
1837
|
+
items: tabItems,
|
|
1838
|
+
onChange
|
|
1839
|
+
})
|
|
1840
|
+
});
|
|
1841
|
+
}
|
|
1842
|
+
var DmTree = (props) => {
|
|
1843
|
+
if ("isTabTree" in props && props.isTabTree) {
|
|
1844
|
+
return /* @__PURE__ */ jsx8(OptionDmTree, {
|
|
1845
|
+
...props
|
|
1846
|
+
});
|
|
1847
|
+
}
|
|
1848
|
+
return CommonDmTree(props);
|
|
1849
|
+
};
|
|
1850
|
+
export {
|
|
1851
|
+
DmTree
|
|
1852
|
+
};
|