@hsu-react/ui 0.0.25 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +18 -3
- package/es/components/Button/index.d.ts +49 -8
- package/es/components/Button/index.js +68 -25
- package/es/components/Button/index.module.scss +38 -0
- package/es/components/ChainGraph/_components/ExpandButtons/index.module.scss +5 -3
- package/es/components/ChainGraph/_components/SearchSelect/index.module.scss +3 -2
- package/es/components/ChainGraph/index.js +3 -1
- package/es/components/ChainGraph/index.module.scss +2 -2
- package/es/components/Chart/Group/index.module.scss +1 -1
- package/es/components/Chat/ChatHistory/_components/HistoryGroup/index.module.scss +1 -1
- package/es/components/Chat/ChatHistory/_components/HistoryItem/index.module.scss +13 -13
- package/es/components/Chat/ChatHistory/_components/NewChatButton/index.module.scss +6 -6
- package/es/components/Chat/ChatHistory/index.module.scss +3 -3
- package/es/components/Chat/ChatInput/_components/AgentToggleButton/index.module.scss +9 -9
- package/es/components/Chat/ChatInput/_components/FileList/index.module.scss +3 -3
- package/es/components/Chat/ChatInput/_components/SendButton/index.module.scss +3 -3
- package/es/components/Chat/ChatInput/_components/StopButton/index.module.scss +2 -2
- package/es/components/Chat/ChatInput/_components/UploadButton/index.js +1 -1
- package/es/components/Chat/ChatInput/_components/UploadButton/index.module.scss +3 -3
- package/es/components/Chat/ChatInput/_utils/index.js +1 -1
- package/es/components/Chat/ChatInput/index.module.scss +12 -11
- package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/Copy/index.js +1 -1
- package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/Copy/index.module.scss +6 -6
- package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/LikeDislike/index.js +3 -1
- package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/LikeDislike/index.module.scss +6 -6
- package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/QuoteList/index.module.scss +8 -8
- package/es/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.scss +7 -7
- package/es/components/Chat/ChatList/_components/Assistant/index.module.scss +3 -3
- package/es/components/Chat/ChatList/_components/User/index.module.scss +21 -10
- package/es/components/Chat/ChatList/index.js +35 -30
- package/es/components/Checkbox/CheckboxGroup/index.module.scss +10 -13
- package/es/components/Checkbox/index.module.scss +23 -28
- package/es/components/CodeMirror/index.module.scss +6 -6
- package/es/components/Copy/index.d.ts +8 -2
- package/es/components/Copy/index.js +45 -22
- package/es/components/Copy/index.module.scss +5 -5
- package/es/components/DatePicker/RangePicker/index.js +5 -1
- package/es/components/DatePicker/RangePicker/index.module.scss +10 -1
- package/es/components/DatePicker/StepPicker/index.module.scss +6 -4
- package/es/components/DatePicker/index.js +14 -3
- package/es/components/DatePicker/index.module.scss +2 -2
- package/es/components/Descriptions/index.d.ts +6 -2
- package/es/components/Descriptions/index.js +15 -8
- package/es/components/Editor/index.module.scss +7 -7
- package/es/components/FileCol/index.js +3 -3
- package/es/components/FilePreview/_components/BasePreview/index.module.scss +3 -3
- package/es/components/FilePreview/_components/PdfPreview/index.js +9 -2
- package/es/components/FilePreview/_components/PdfPreview/index.module.scss +7 -7
- package/es/components/FilePreview/index.module.scss +4 -4
- package/es/components/Form/DrawerForm/index.js +10 -18
- package/es/components/Form/ImportForm/index.js +15 -16
- package/es/components/Form/ModalForm/index.d.ts +1 -1
- package/es/components/Form/ModalForm/index.js +14 -16
- package/es/components/Form/index.d.ts +12 -0
- package/es/components/Form/index.js +7 -1
- package/es/components/FormItem/FormInput/FormPasswordStrength/index.module.scss +3 -3
- package/es/components/FormItem/FormRadio/index.module.scss +11 -13
- package/es/components/FormItem/FormSegmented/index.module.scss +1 -1
- package/es/components/FormItem/FormSlider/index.module.scss +1 -1
- package/es/components/FormItem/FormUpload/FormImage/index.js +1 -1
- package/es/components/FormItem/FormUpload/index.js +2 -1
- package/es/components/FormItem/FormUpload/index.module.scss +17 -17
- package/es/components/FormItem/ItemContainer/index.js +4 -4
- package/es/components/FormItem/ItemContainer/index.module.scss +33 -7
- package/es/components/Input/Number/index.js +41 -55
- package/es/components/Input/Number/index.module.scss +27 -54
- package/es/components/Input/Range/index.module.scss +16 -5
- package/es/components/Input/TextArea/index.module.scss +13 -13
- package/es/components/Input/index.d.ts +3 -1
- package/es/components/Input/index.js +2 -0
- package/es/components/Input/index.module.scss +1 -1
- package/es/components/Markdown/Editor/index.module.scss +4 -4
- package/es/components/Markdown/Views/MermaidBlock.js +15 -1
- package/es/components/Markdown/Views/blocks.module.scss +13 -13
- package/es/components/Markdown/Views/index.module.scss +3 -3
- package/es/components/Modal/index.d.ts +12 -2
- package/es/components/Modal/index.js +31 -11
- package/es/components/Modal/index.module.scss +11 -1
- package/es/components/Operate/index.js +3 -1
- package/es/components/Operate/index.module.scss +1 -1
- package/es/components/Pagination/index.module.scss +19 -18
- package/es/components/Panel/DefaultPanel/index.module.scss +3 -3
- package/es/components/Panel/IframePanel/index.js +3 -1
- package/es/components/Panel/IframePanel/index.module.scss +2 -2
- package/es/components/Panel/ListPanel/ListModalPanel/index.d.ts +2 -2
- package/es/components/Panel/ListPanel/ListModalPanel/index.module.scss +2 -2
- package/es/components/Panel/ListPanel/_components/ColumnMgt/index.js +9 -17
- package/es/components/Panel/ListPanel/_components/ColumnMgt/index.module.scss +3 -3
- package/es/components/Panel/ListPanel/_components/ToolBar/index.js +1 -1
- package/es/components/Panel/ListPanel/_components/ToolBar/index.module.scss +14 -1
- package/es/components/Panel/ListPanel/index.d.ts +2 -2
- package/es/components/Panel/ListPanel/index.module.scss +9 -9
- package/es/components/Search/SearchAdvanced/index.d.ts +3 -3
- package/es/components/Search/SearchCard/index.module.scss +15 -15
- package/es/components/Search/SearchCollapsible/index.d.ts +3 -3
- package/es/components/Search/SearchWithFilter/index.d.ts +3 -3
- package/es/components/Search/SearchWithMore/index.d.ts +3 -3
- package/es/components/Search/_components/ButtonGroup/index.d.ts +4 -4
- package/es/components/Search/_components/ButtonGroup/index.js +2 -2
- package/es/components/Search/_components/FilterDropdown/index.js +3 -1
- package/es/components/Search/_hooks/useSearchCommon.d.ts +3 -3
- package/es/components/Search/_types/index.d.ts +3 -3
- package/es/components/Search/index.d.ts +3 -3
- package/es/components/Search/index.module.scss +33 -5
- package/es/components/SecondConf/index.js +16 -6
- package/es/components/SecondConf/index.module.scss +3 -3
- package/es/components/Select/AutoCompleteSelect/index.js +17 -7
- package/es/components/Select/AutoCompleteSelect/index.module.scss +73 -132
- package/es/components/Select/IconSelect/index.js +67 -60
- package/es/components/Select/IconSelect/index.module.scss +4 -3
- package/es/components/Select/TreeSelect/_utils/getExpandedKeysByLevel.d.ts +1 -1
- package/es/components/Select/TreeSelect/index.js +18 -7
- package/es/components/Select/TreeSelect/index.module.scss +19 -44
- package/es/components/Select/index.d.ts +17 -2
- package/es/components/Select/index.js +22 -4
- package/es/components/Select/index.module.scss +71 -131
- package/es/components/Slider/index.module.scss +1 -1
- package/es/components/Switch/index.module.scss +1 -1
- package/es/components/TabBar/index.module.scss +11 -11
- package/es/components/Table/_components/Drag/index.js +4 -1
- package/es/components/Table/_hooks/useTableColumns.js +1 -1
- package/es/components/Table/_utils/tableUtils.d.ts +1 -1
- package/es/components/Table/_utils/tableUtils.js +4 -3
- package/es/components/Table/index.d.ts +18 -2
- package/es/components/Table/index.js +9 -0
- package/es/components/Table/index.module.scss +14 -14
- package/es/components/Tags/_components/EllipsisTag/index.js +1 -1
- package/es/components/TextEllipsis/index.js +12 -8
- package/es/components/Tree/index.d.ts +8 -2
- package/es/components/Tree/index.js +2 -0
- package/es/components/Tree/index.module.scss +6 -6
- package/es/components/Upload/_components/UploadedItem/index.js +3 -3
- package/es/components/Upload/_components/UploadingItem/index.js +3 -3
- package/es/components/Upload/_utils/normalUpload.d.ts +1 -1
- package/es/components/Upload/_utils/validateFile.js +49 -2
- package/es/components/Upload/index.d.ts +8 -2
- package/es/components/Upload/index.js +11 -4
- package/es/config-provider/index.d.ts +34 -2
- package/es/config-provider/index.js +59 -5
- package/es/feedback/index.d.ts +20 -0
- package/es/feedback/index.js +130 -0
- package/es/hooks/index.d.ts +5 -0
- package/es/hooks/index.js +4 -1
- package/es/hooks/useBreakpoint.d.ts +24 -0
- package/es/hooks/useBreakpoint.js +57 -0
- package/es/hooks/useIsDark.d.ts +9 -0
- package/es/hooks/useIsDark.js +64 -0
- package/es/hooks/usePointerType.d.ts +22 -0
- package/es/hooks/usePointerType.js +62 -0
- package/es/index.d.ts +4 -4
- package/es/index.js +19 -5
- package/es/layout/Breadcrumb/_components/BreadcrumbItemIcon/index.d.ts +10 -0
- package/es/layout/Breadcrumb/_components/BreadcrumbItemIcon/index.js +19 -0
- package/es/layout/Breadcrumb/_components/BreadcrumbMenuItem/index.d.ts +11 -0
- package/es/layout/Breadcrumb/_components/BreadcrumbMenuItem/index.js +26 -0
- package/es/layout/Breadcrumb/_hooks/useBreadcrumbPath.d.ts +5 -0
- package/es/layout/Breadcrumb/_hooks/useBreadcrumbPath.js +104 -0
- package/es/layout/Breadcrumb/_utils/formatMenu.d.ts +9 -0
- package/es/layout/Breadcrumb/_utils/formatMenu.js +28 -0
- package/es/layout/Breadcrumb/_utils/formatRoutes.d.ts +9 -0
- package/es/layout/Breadcrumb/_utils/formatRoutes.js +76 -0
- package/es/layout/Breadcrumb/_utils/pathMatch.d.ts +8 -0
- package/es/layout/Breadcrumb/_utils/pathMatch.js +45 -0
- package/es/layout/Breadcrumb/index.d.ts +19 -0
- package/es/layout/Breadcrumb/index.js +96 -0
- package/es/layout/Breadcrumb/index.module.scss +15 -0
- package/es/layout/Header/index.d.ts +39 -0
- package/es/layout/Header/index.js +166 -0
- package/es/layout/Header/index.module.scss +215 -0
- package/es/layout/I18n/I18nStore.d.ts +29 -0
- package/es/layout/I18n/I18nStore.js +94 -0
- package/es/layout/I18n/index.d.ts +14 -0
- package/es/layout/I18n/index.js +33 -0
- package/es/layout/I18n/locales/en-US.d.ts +2 -0
- package/es/layout/I18n/locales/en-US.js +15 -0
- package/es/layout/I18n/locales/zh-CN.d.ts +2 -0
- package/es/layout/I18n/locales/zh-CN.js +15 -0
- package/es/layout/Menu/_components/SecondaryHeader/index.d.ts +22 -0
- package/es/layout/Menu/_components/SecondaryHeader/index.js +48 -0
- package/es/layout/Menu/_components/SecondaryHeader/index.module.scss +65 -0
- package/es/layout/Menu/_hooks/useMenuPath.d.ts +17 -0
- package/es/layout/Menu/_hooks/useMenuPath.js +91 -0
- package/es/layout/Menu/_hooks/useOnlyLvOneMenu.d.ts +13 -0
- package/es/layout/Menu/_hooks/useOnlyLvOneMenu.js +25 -0
- package/es/layout/Menu/_utils/formatMenu.d.ts +10 -0
- package/es/layout/Menu/_utils/formatMenu.js +55 -0
- package/es/layout/Menu/_utils/pathMatch.d.ts +8 -0
- package/es/layout/Menu/_utils/pathMatch.js +42 -0
- package/es/layout/Menu/_utils/setActiveIcon.d.ts +7 -0
- package/es/layout/Menu/_utils/setActiveIcon.js +20 -0
- package/es/layout/Menu/index.d.ts +34 -0
- package/es/layout/Menu/index.js +195 -0
- package/es/layout/Menu/index.module.scss +50 -0
- package/es/layout/NavTabBar/_components/SortableTab/index.d.ts +9 -0
- package/es/layout/NavTabBar/_components/SortableTab/index.js +34 -0
- package/es/layout/NavTabBar/_components/TabContextMenu/index.d.ts +20 -0
- package/es/layout/NavTabBar/_components/TabContextMenu/index.js +124 -0
- package/es/layout/NavTabBar/_components/TabDragOverlay/index.d.ts +20 -0
- package/es/layout/NavTabBar/_components/TabDragOverlay/index.js +50 -0
- package/es/layout/NavTabBar/_components/TabLabel/index.d.ts +22 -0
- package/es/layout/NavTabBar/_components/TabLabel/index.js +61 -0
- package/es/layout/NavTabBar/_hooks/useDropTabKey.d.ts +5 -0
- package/es/layout/NavTabBar/_hooks/useDropTabKey.js +25 -0
- package/es/layout/NavTabBar/_hooks/useTabContextMenu.d.ts +8 -0
- package/es/layout/NavTabBar/_hooks/useTabContextMenu.js +31 -0
- package/es/layout/NavTabBar/_hooks/useTabPath.d.ts +16 -0
- package/es/layout/NavTabBar/_hooks/useTabPath.js +131 -0
- package/es/layout/NavTabBar/_hooks/useTabTitle.d.ts +5 -0
- package/es/layout/NavTabBar/_hooks/useTabTitle.js +29 -0
- package/es/layout/NavTabBar/_utils/formatNavTabBar.d.ts +9 -0
- package/es/layout/NavTabBar/_utils/formatNavTabBar.js +48 -0
- package/es/layout/NavTabBar/_utils/pathMatch.d.ts +8 -0
- package/es/layout/NavTabBar/_utils/pathMatch.js +33 -0
- package/es/layout/NavTabBar/_utils/tabActions.d.ts +21 -0
- package/es/layout/NavTabBar/_utils/tabActions.js +114 -0
- package/es/layout/NavTabBar/index.d.ts +21 -0
- package/es/layout/NavTabBar/index.js +224 -0
- package/es/layout/NavTabBar/index.module.scss +179 -0
- package/es/layout/Theme/ThemeStore.d.ts +18 -0
- package/es/layout/Theme/ThemeStore.js +80 -0
- package/es/layout/Theme/index.d.ts +30 -0
- package/es/layout/Theme/index.js +89 -0
- package/es/layout/Theme/index.module.scss +6 -0
- package/es/layout/_hooks/useDropTab.d.ts +6 -0
- package/es/layout/_hooks/useDropTab.js +13 -0
- package/es/layout/_hooks/useReload.d.ts +6 -0
- package/es/layout/_hooks/useReload.js +10 -0
- package/es/layout/_hooks/useSetTabTitle.d.ts +6 -0
- package/es/layout/_hooks/useSetTabTitle.js +10 -0
- package/es/layout/_utils/storage.d.ts +6 -0
- package/es/layout/_utils/storage.js +32 -0
- package/es/layout/index.d.ts +43 -0
- package/es/layout/index.js +50 -0
- package/es/layout/types.d.ts +51 -0
- package/es/layout/types.js +1 -0
- package/es/request/index.js +15 -1
- package/es/styles/_responsive.scss +53 -0
- package/es/styles/antd-overload.scss +77 -21
- package/es/styles/tokens.d.ts +113 -13
- package/es/styles/tokens.js +176 -28
- package/es/styles/tokens.json +82 -0
- package/es/styles/tokens.scss +99 -52
- package/es/types/antd.d.ts +35 -0
- package/es/types/antd.js +1 -0
- package/es/utils/semantic.d.ts +31 -0
- package/es/utils/semantic.js +37 -0
- package/lib/components/Button/index.d.ts +49 -8
- package/lib/components/Button/index.js +62 -20
- package/lib/components/Button/index.module.scss +38 -0
- package/lib/components/ChainGraph/_components/ExpandButtons/index.module.scss +5 -3
- package/lib/components/ChainGraph/_components/SearchSelect/index.module.scss +3 -2
- package/lib/components/ChainGraph/index.js +3 -1
- package/lib/components/ChainGraph/index.module.scss +2 -2
- package/lib/components/Chart/Group/index.module.scss +1 -1
- package/lib/components/Chat/ChatHistory/_components/HistoryGroup/index.module.scss +1 -1
- package/lib/components/Chat/ChatHistory/_components/HistoryItem/index.module.scss +13 -13
- package/lib/components/Chat/ChatHistory/_components/NewChatButton/index.module.scss +6 -6
- package/lib/components/Chat/ChatHistory/index.module.scss +3 -3
- package/lib/components/Chat/ChatInput/_components/AgentToggleButton/index.module.scss +9 -9
- package/lib/components/Chat/ChatInput/_components/FileList/index.module.scss +3 -3
- package/lib/components/Chat/ChatInput/_components/SendButton/index.module.scss +3 -3
- package/lib/components/Chat/ChatInput/_components/StopButton/index.module.scss +2 -2
- package/lib/components/Chat/ChatInput/_components/UploadButton/index.js +1 -1
- package/lib/components/Chat/ChatInput/_components/UploadButton/index.module.scss +3 -3
- package/lib/components/Chat/ChatInput/_utils/index.js +6 -6
- package/lib/components/Chat/ChatInput/index.module.scss +12 -11
- package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/Copy/index.js +2 -2
- package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/Copy/index.module.scss +6 -6
- package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/LikeDislike/index.js +3 -1
- package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/LikeDislike/index.module.scss +6 -6
- package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/QuoteList/index.module.scss +8 -8
- package/lib/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.scss +7 -7
- package/lib/components/Chat/ChatList/_components/Assistant/index.module.scss +3 -3
- package/lib/components/Chat/ChatList/_components/User/index.module.scss +21 -10
- package/lib/components/Chat/ChatList/index.js +33 -27
- package/lib/components/Checkbox/CheckboxGroup/index.module.scss +10 -13
- package/lib/components/Checkbox/index.module.scss +23 -28
- package/lib/components/CodeMirror/index.module.scss +6 -6
- package/lib/components/Copy/index.d.ts +8 -2
- package/lib/components/Copy/index.js +38 -23
- package/lib/components/Copy/index.module.scss +5 -5
- package/lib/components/DatePicker/RangePicker/index.js +5 -1
- package/lib/components/DatePicker/RangePicker/index.module.scss +10 -1
- package/lib/components/DatePicker/StepPicker/index.module.scss +6 -4
- package/lib/components/DatePicker/index.js +14 -3
- package/lib/components/DatePicker/index.module.scss +2 -2
- package/lib/components/Descriptions/index.d.ts +6 -2
- package/lib/components/Descriptions/index.js +14 -12
- package/lib/components/Editor/index.module.scss +7 -7
- package/lib/components/FileCol/index.js +3 -3
- package/lib/components/FilePreview/_components/BasePreview/index.module.scss +3 -3
- package/lib/components/FilePreview/_components/PdfPreview/index.js +9 -2
- package/lib/components/FilePreview/_components/PdfPreview/index.module.scss +7 -7
- package/lib/components/FilePreview/index.module.scss +4 -4
- package/lib/components/Form/DrawerForm/index.js +10 -17
- package/lib/components/Form/ImportForm/index.js +13 -18
- package/lib/components/Form/ModalForm/index.d.ts +1 -1
- package/lib/components/Form/ModalForm/index.js +11 -17
- package/lib/components/Form/index.d.ts +12 -0
- package/lib/components/Form/index.js +7 -1
- package/lib/components/FormItem/FormInput/FormPasswordStrength/index.module.scss +3 -3
- package/lib/components/FormItem/FormRadio/index.module.scss +11 -13
- package/lib/components/FormItem/FormSegmented/index.module.scss +1 -1
- package/lib/components/FormItem/FormSlider/index.module.scss +1 -1
- package/lib/components/FormItem/FormUpload/FormImage/index.js +3 -3
- package/lib/components/FormItem/FormUpload/index.js +3 -2
- package/lib/components/FormItem/FormUpload/index.module.scss +17 -17
- package/lib/components/FormItem/ItemContainer/index.js +4 -4
- package/lib/components/FormItem/ItemContainer/index.module.scss +33 -7
- package/lib/components/Input/Number/index.js +38 -54
- package/lib/components/Input/Number/index.module.scss +27 -54
- package/lib/components/Input/Range/index.module.scss +16 -5
- package/lib/components/Input/TextArea/index.module.scss +13 -13
- package/lib/components/Input/index.d.ts +3 -1
- package/lib/components/Input/index.js +2 -0
- package/lib/components/Input/index.module.scss +1 -1
- package/lib/components/Markdown/Editor/index.module.scss +4 -4
- package/lib/components/Markdown/Views/MermaidBlock.js +15 -1
- package/lib/components/Markdown/Views/blocks.module.scss +13 -13
- package/lib/components/Markdown/Views/index.module.scss +3 -3
- package/lib/components/Modal/index.d.ts +12 -2
- package/lib/components/Modal/index.js +30 -10
- package/lib/components/Modal/index.module.scss +11 -1
- package/lib/components/Operate/index.js +3 -1
- package/lib/components/Operate/index.module.scss +1 -1
- package/lib/components/Pagination/index.module.scss +19 -18
- package/lib/components/Panel/DefaultPanel/index.module.scss +3 -3
- package/lib/components/Panel/IframePanel/index.js +3 -1
- package/lib/components/Panel/IframePanel/index.module.scss +2 -2
- package/lib/components/Panel/ListPanel/ListModalPanel/index.d.ts +2 -2
- package/lib/components/Panel/ListPanel/ListModalPanel/index.module.scss +2 -2
- package/lib/components/Panel/ListPanel/_components/ColumnMgt/index.js +9 -20
- package/lib/components/Panel/ListPanel/_components/ColumnMgt/index.module.scss +3 -3
- package/lib/components/Panel/ListPanel/_components/ToolBar/index.js +1 -1
- package/lib/components/Panel/ListPanel/_components/ToolBar/index.module.scss +14 -1
- package/lib/components/Panel/ListPanel/index.d.ts +2 -2
- package/lib/components/Panel/ListPanel/index.module.scss +9 -9
- package/lib/components/Search/SearchAdvanced/index.d.ts +3 -3
- package/lib/components/Search/SearchCard/index.module.scss +15 -15
- package/lib/components/Search/SearchCollapsible/index.d.ts +3 -3
- package/lib/components/Search/SearchWithFilter/index.d.ts +3 -3
- package/lib/components/Search/SearchWithMore/index.d.ts +3 -3
- package/lib/components/Search/_components/ButtonGroup/index.d.ts +4 -4
- package/lib/components/Search/_components/ButtonGroup/index.js +2 -2
- package/lib/components/Search/_components/FilterDropdown/index.js +3 -1
- package/lib/components/Search/_hooks/useSearchCommon.d.ts +3 -3
- package/lib/components/Search/_types/index.d.ts +3 -3
- package/lib/components/Search/index.d.ts +3 -3
- package/lib/components/Search/index.module.scss +33 -5
- package/lib/components/SecondConf/index.js +14 -6
- package/lib/components/SecondConf/index.module.scss +3 -3
- package/lib/components/Select/AutoCompleteSelect/index.js +15 -5
- package/lib/components/Select/AutoCompleteSelect/index.module.scss +73 -132
- package/lib/components/Select/IconSelect/index.js +64 -57
- package/lib/components/Select/IconSelect/index.module.scss +4 -3
- package/lib/components/Select/TreeSelect/_utils/getExpandedKeysByLevel.d.ts +1 -1
- package/lib/components/Select/TreeSelect/index.js +18 -7
- package/lib/components/Select/TreeSelect/index.module.scss +19 -44
- package/lib/components/Select/index.d.ts +17 -2
- package/lib/components/Select/index.js +22 -4
- package/lib/components/Select/index.module.scss +71 -131
- package/lib/components/Slider/index.module.scss +1 -1
- package/lib/components/Switch/index.module.scss +1 -1
- package/lib/components/TabBar/index.module.scss +11 -11
- package/lib/components/Table/_components/Drag/index.js +6 -2
- package/lib/components/Table/_hooks/useTableColumns.js +1 -1
- package/lib/components/Table/_utils/tableUtils.d.ts +1 -1
- package/lib/components/Table/_utils/tableUtils.js +4 -3
- package/lib/components/Table/index.d.ts +18 -2
- package/lib/components/Table/index.js +9 -0
- package/lib/components/Table/index.module.scss +14 -14
- package/lib/components/Tags/_components/EllipsisTag/index.js +1 -1
- package/lib/components/TextEllipsis/index.js +6 -4
- package/lib/components/Tree/index.d.ts +8 -2
- package/lib/components/Tree/index.js +2 -0
- package/lib/components/Tree/index.module.scss +6 -6
- package/lib/components/Upload/_components/UploadedItem/index.js +3 -3
- package/lib/components/Upload/_components/UploadingItem/index.js +3 -3
- package/lib/components/Upload/_utils/normalUpload.d.ts +1 -1
- package/lib/components/Upload/_utils/validateFile.js +47 -2
- package/lib/components/Upload/index.d.ts +8 -2
- package/lib/components/Upload/index.js +11 -4
- package/lib/config-provider/index.d.ts +34 -2
- package/lib/config-provider/index.js +55 -4
- package/lib/feedback/index.d.ts +20 -0
- package/lib/feedback/index.js +115 -0
- package/lib/hooks/index.d.ts +5 -0
- package/lib/hooks/index.js +21 -0
- package/lib/hooks/useBreakpoint.d.ts +24 -0
- package/lib/hooks/useBreakpoint.js +49 -0
- package/lib/hooks/useIsDark.d.ts +9 -0
- package/lib/hooks/useIsDark.js +54 -0
- package/lib/hooks/usePointerType.d.ts +22 -0
- package/lib/hooks/usePointerType.js +55 -0
- package/lib/index.d.ts +4 -4
- package/lib/index.js +78 -19
- package/lib/layout/Breadcrumb/_components/BreadcrumbItemIcon/index.d.ts +10 -0
- package/lib/layout/Breadcrumb/_components/BreadcrumbItemIcon/index.js +26 -0
- package/lib/layout/Breadcrumb/_components/BreadcrumbMenuItem/index.d.ts +11 -0
- package/lib/layout/Breadcrumb/_components/BreadcrumbMenuItem/index.js +32 -0
- package/lib/layout/Breadcrumb/_hooks/useBreadcrumbPath.d.ts +5 -0
- package/lib/layout/Breadcrumb/_hooks/useBreadcrumbPath.js +89 -0
- package/lib/layout/Breadcrumb/_utils/formatMenu.d.ts +9 -0
- package/lib/layout/Breadcrumb/_utils/formatMenu.js +31 -0
- package/lib/layout/Breadcrumb/_utils/formatRoutes.d.ts +9 -0
- package/lib/layout/Breadcrumb/_utils/formatRoutes.js +67 -0
- package/lib/layout/Breadcrumb/_utils/pathMatch.d.ts +8 -0
- package/lib/layout/Breadcrumb/_utils/pathMatch.js +47 -0
- package/lib/layout/Breadcrumb/index.d.ts +19 -0
- package/lib/layout/Breadcrumb/index.js +96 -0
- package/lib/layout/Breadcrumb/index.module.scss +15 -0
- package/lib/layout/Header/index.d.ts +39 -0
- package/lib/layout/Header/index.js +172 -0
- package/lib/layout/Header/index.module.scss +215 -0
- package/lib/layout/I18n/I18nStore.d.ts +29 -0
- package/lib/layout/I18n/I18nStore.js +82 -0
- package/lib/layout/I18n/index.d.ts +14 -0
- package/lib/layout/I18n/index.js +45 -0
- package/lib/layout/I18n/locales/en-US.d.ts +2 -0
- package/lib/layout/I18n/locales/en-US.js +21 -0
- package/lib/layout/I18n/locales/zh-CN.d.ts +2 -0
- package/lib/layout/I18n/locales/zh-CN.js +21 -0
- package/lib/layout/Menu/_components/SecondaryHeader/index.d.ts +22 -0
- package/lib/layout/Menu/_components/SecondaryHeader/index.js +49 -0
- package/lib/layout/Menu/_components/SecondaryHeader/index.module.scss +65 -0
- package/lib/layout/Menu/_hooks/useMenuPath.d.ts +17 -0
- package/lib/layout/Menu/_hooks/useMenuPath.js +75 -0
- package/lib/layout/Menu/_hooks/useOnlyLvOneMenu.d.ts +13 -0
- package/lib/layout/Menu/_hooks/useOnlyLvOneMenu.js +31 -0
- package/lib/layout/Menu/_utils/formatMenu.d.ts +10 -0
- package/lib/layout/Menu/_utils/formatMenu.js +55 -0
- package/lib/layout/Menu/_utils/pathMatch.d.ts +8 -0
- package/lib/layout/Menu/_utils/pathMatch.js +44 -0
- package/lib/layout/Menu/_utils/setActiveIcon.d.ts +7 -0
- package/lib/layout/Menu/_utils/setActiveIcon.js +27 -0
- package/lib/layout/Menu/index.d.ts +34 -0
- package/lib/layout/Menu/index.js +158 -0
- package/lib/layout/Menu/index.module.scss +50 -0
- package/lib/layout/NavTabBar/_components/SortableTab/index.d.ts +9 -0
- package/lib/layout/NavTabBar/_components/SortableTab/index.js +39 -0
- package/lib/layout/NavTabBar/_components/TabContextMenu/index.d.ts +20 -0
- package/lib/layout/NavTabBar/_components/TabContextMenu/index.js +129 -0
- package/lib/layout/NavTabBar/_components/TabDragOverlay/index.d.ts +20 -0
- package/lib/layout/NavTabBar/_components/TabDragOverlay/index.js +54 -0
- package/lib/layout/NavTabBar/_components/TabLabel/index.d.ts +22 -0
- package/lib/layout/NavTabBar/_components/TabLabel/index.js +68 -0
- package/lib/layout/NavTabBar/_hooks/useDropTabKey.d.ts +5 -0
- package/lib/layout/NavTabBar/_hooks/useDropTabKey.js +32 -0
- package/lib/layout/NavTabBar/_hooks/useTabContextMenu.d.ts +8 -0
- package/lib/layout/NavTabBar/_hooks/useTabContextMenu.js +28 -0
- package/lib/layout/NavTabBar/_hooks/useTabPath.d.ts +16 -0
- package/lib/layout/NavTabBar/_hooks/useTabPath.js +107 -0
- package/lib/layout/NavTabBar/_hooks/useTabTitle.d.ts +5 -0
- package/lib/layout/NavTabBar/_hooks/useTabTitle.js +32 -0
- package/lib/layout/NavTabBar/_utils/formatNavTabBar.d.ts +9 -0
- package/lib/layout/NavTabBar/_utils/formatNavTabBar.js +49 -0
- package/lib/layout/NavTabBar/_utils/pathMatch.d.ts +8 -0
- package/lib/layout/NavTabBar/_utils/pathMatch.js +37 -0
- package/lib/layout/NavTabBar/_utils/tabActions.d.ts +21 -0
- package/lib/layout/NavTabBar/_utils/tabActions.js +93 -0
- package/lib/layout/NavTabBar/index.d.ts +21 -0
- package/lib/layout/NavTabBar/index.js +206 -0
- package/lib/layout/NavTabBar/index.module.scss +179 -0
- package/lib/layout/Theme/ThemeStore.d.ts +18 -0
- package/lib/layout/Theme/ThemeStore.js +63 -0
- package/lib/layout/Theme/index.d.ts +30 -0
- package/lib/layout/Theme/index.js +100 -0
- package/lib/layout/Theme/index.module.scss +6 -0
- package/lib/layout/_hooks/useDropTab.d.ts +6 -0
- package/lib/layout/_hooks/useDropTab.js +21 -0
- package/lib/layout/_hooks/useReload.d.ts +6 -0
- package/lib/layout/_hooks/useReload.js +18 -0
- package/lib/layout/_hooks/useSetTabTitle.d.ts +6 -0
- package/lib/layout/_hooks/useSetTabTitle.js +18 -0
- package/lib/layout/_utils/storage.d.ts +6 -0
- package/lib/layout/_utils/storage.js +39 -0
- package/lib/layout/index.d.ts +43 -0
- package/lib/layout/index.js +95 -0
- package/lib/layout/types.d.ts +51 -0
- package/lib/layout/types.js +5 -0
- package/lib/request/index.js +5 -1
- package/lib/styles/_responsive.scss +53 -0
- package/lib/styles/antd-overload.scss +77 -21
- package/lib/styles/tokens.d.ts +113 -13
- package/lib/styles/tokens.js +157 -30
- package/lib/styles/tokens.json +82 -0
- package/lib/styles/tokens.scss +99 -52
- package/lib/types/antd.d.ts +35 -0
- package/lib/types/antd.js +5 -0
- package/lib/utils/semantic.d.ts +31 -0
- package/lib/utils/semantic.js +40 -0
- package/package.json +28 -22
- package/src/components/Button/index.md +54 -10
- package/src/components/Button/index.module.scss +38 -0
- package/src/components/Button/index.tsx +107 -51
- package/src/components/ChainGraph/_components/ExpandButtons/index.module.scss +5 -3
- package/src/components/ChainGraph/_components/SearchSelect/index.module.scss +3 -2
- package/src/components/ChainGraph/index.module.scss +2 -2
- package/src/components/ChainGraph/index.tsx +1 -1
- package/src/components/Chart/Group/index.module.scss +1 -1
- package/src/components/Chat/ChatHistory/_components/HistoryGroup/index.module.scss +1 -1
- package/src/components/Chat/ChatHistory/_components/HistoryItem/index.module.scss +13 -13
- package/src/components/Chat/ChatHistory/_components/NewChatButton/index.module.scss +6 -6
- package/src/components/Chat/ChatHistory/index.module.scss +3 -3
- package/src/components/Chat/ChatInput/_components/AgentToggleButton/index.module.scss +9 -9
- package/src/components/Chat/ChatInput/_components/FileList/index.module.scss +3 -3
- package/src/components/Chat/ChatInput/_components/SendButton/index.module.scss +3 -3
- package/src/components/Chat/ChatInput/_components/StopButton/index.module.scss +2 -2
- package/src/components/Chat/ChatInput/_components/UploadButton/index.module.scss +3 -3
- package/src/components/Chat/ChatInput/_components/UploadButton/index.tsx +1 -1
- package/src/components/Chat/ChatInput/_utils/index.ts +1 -1
- package/src/components/Chat/ChatInput/index.module.scss +12 -11
- package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/Copy/index.module.scss +6 -6
- package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/Copy/index.tsx +1 -1
- package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/LikeDislike/index.module.scss +6 -6
- package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/LikeDislike/index.tsx +1 -1
- package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/_components/QuoteList/index.module.scss +8 -8
- package/src/components/Chat/ChatList/_components/Assistant/AssistantItem/index.module.scss +7 -7
- package/src/components/Chat/ChatList/_components/Assistant/index.module.scss +3 -3
- package/src/components/Chat/ChatList/_components/User/index.module.scss +21 -10
- package/src/components/Chat/ChatList/index.tsx +5 -2
- package/src/components/Checkbox/CheckboxGroup/index.module.scss +10 -13
- package/src/components/Checkbox/index.module.scss +23 -28
- package/src/components/CodeMirror/index.module.scss +6 -6
- package/src/components/Copy/index.module.scss +5 -5
- package/src/components/Copy/index.tsx +41 -25
- package/src/components/DatePicker/RangePicker/index.module.scss +10 -1
- package/src/components/DatePicker/RangePicker/index.tsx +5 -3
- package/src/components/DatePicker/StepPicker/index.module.scss +6 -4
- package/src/components/DatePicker/index.module.scss +2 -2
- package/src/components/DatePicker/index.tsx +11 -3
- package/src/components/Descriptions/index.md +8 -0
- package/src/components/Descriptions/index.tsx +21 -14
- package/src/components/Editor/index.module.scss +7 -7
- package/src/components/FileCol/index.tsx +4 -2
- package/src/components/FilePreview/_components/BasePreview/index.module.scss +3 -3
- package/src/components/FilePreview/_components/PdfPreview/index.module.scss +7 -7
- package/src/components/FilePreview/_components/PdfPreview/index.tsx +8 -2
- package/src/components/FilePreview/index.module.scss +4 -4
- package/src/components/Form/DrawerForm/index.tsx +10 -11
- package/src/components/Form/ImportForm/index.tsx +11 -12
- package/src/components/Form/ModalForm/index.tsx +10 -12
- package/src/components/Form/index.md +18 -0
- package/src/components/Form/index.tsx +18 -0
- package/src/components/FormItem/FormInput/FormPasswordStrength/index.module.scss +3 -3
- package/src/components/FormItem/FormRadio/index.module.scss +11 -13
- package/src/components/FormItem/FormSegmented/index.module.scss +1 -1
- package/src/components/FormItem/FormSlider/index.module.scss +1 -1
- package/src/components/FormItem/FormUpload/FormImage/index.tsx +2 -1
- package/src/components/FormItem/FormUpload/index.module.scss +17 -17
- package/src/components/FormItem/FormUpload/index.tsx +2 -1
- package/src/components/FormItem/ItemContainer/index.module.scss +33 -7
- package/src/components/FormItem/ItemContainer/index.tsx +3 -3
- package/src/components/Input/Number/index.module.scss +27 -54
- package/src/components/Input/Number/index.tsx +49 -65
- package/src/components/Input/Range/index.module.scss +16 -5
- package/src/components/Input/TextArea/index.module.scss +13 -13
- package/src/components/Input/index.md +14 -0
- package/src/components/Input/index.module.scss +1 -1
- package/src/components/Input/index.tsx +4 -0
- package/src/components/Markdown/Editor/index.module.scss +4 -4
- package/src/components/Markdown/Views/MermaidBlock.tsx +15 -1
- package/src/components/Markdown/Views/blocks.module.scss +13 -13
- package/src/components/Markdown/Views/index.module.scss +3 -3
- package/src/components/Markdown/index.md +22 -0
- package/src/components/Modal/index.md +22 -1
- package/src/components/Modal/index.module.scss +11 -1
- package/src/components/Modal/index.tsx +46 -13
- package/src/components/Operate/index.module.scss +1 -1
- package/src/components/Operate/index.tsx +1 -1
- package/src/components/Pagination/index.md +107 -0
- package/src/components/Pagination/index.module.scss +19 -18
- package/src/components/Pagination/index.tsx +2 -2
- package/src/components/Panel/DefaultPanel/index.module.scss +3 -3
- package/src/components/Panel/IframePanel/index.module.scss +2 -2
- package/src/components/Panel/IframePanel/index.tsx +5 -1
- package/src/components/Panel/ListPanel/ListModalPanel/index.module.scss +2 -2
- package/src/components/Panel/ListPanel/ListModalPanel/index.tsx +2 -2
- package/src/components/Panel/ListPanel/_components/ColumnMgt/index.module.scss +3 -3
- package/src/components/Panel/ListPanel/_components/ColumnMgt/index.tsx +7 -11
- package/src/components/Panel/ListPanel/_components/ToolBar/index.module.scss +14 -1
- package/src/components/Panel/ListPanel/_components/ToolBar/index.tsx +2 -2
- package/src/components/Panel/ListPanel/index.module.scss +9 -9
- package/src/components/Panel/ListPanel/index.tsx +2 -2
- package/src/components/Panel/index.md +1 -1
- package/src/components/Search/SearchAdvanced/index.tsx +3 -3
- package/src/components/Search/SearchCard/index.module.scss +15 -15
- package/src/components/Search/SearchCollapsible/index.tsx +3 -3
- package/src/components/Search/SearchWithFilter/index.tsx +3 -3
- package/src/components/Search/SearchWithMore/index.tsx +3 -3
- package/src/components/Search/_components/ButtonGroup/index.tsx +9 -11
- package/src/components/Search/_components/FilterDropdown/index.tsx +1 -1
- package/src/components/Search/_hooks/useSearchCommon.ts +4 -4
- package/src/components/Search/_types/index.ts +3 -3
- package/src/components/Search/index.md +2 -2
- package/src/components/Search/index.module.scss +33 -5
- package/src/components/Search/index.tsx +3 -3
- package/src/components/SecondConf/index.md +1 -1
- package/src/components/SecondConf/index.module.scss +3 -3
- package/src/components/SecondConf/index.tsx +11 -7
- package/src/components/Select/AutoCompleteSelect/index.module.scss +73 -132
- package/src/components/Select/AutoCompleteSelect/index.tsx +13 -7
- package/src/components/Select/IconSelect/index.module.scss +4 -3
- package/src/components/Select/IconSelect/index.tsx +7 -9
- package/src/components/Select/TreeSelect/_utils/getExpandedKeysByLevel.ts +4 -1
- package/src/components/Select/TreeSelect/index.module.scss +19 -44
- package/src/components/Select/TreeSelect/index.tsx +16 -8
- package/src/components/Select/index.md +12 -0
- package/src/components/Select/index.module.scss +71 -131
- package/src/components/Select/index.tsx +38 -10
- package/src/components/Slider/index.module.scss +1 -1
- package/src/components/Switch/index.module.scss +1 -1
- package/src/components/TabBar/index.module.scss +11 -11
- package/src/components/Table/_components/Drag/index.tsx +3 -2
- package/src/components/Table/_hooks/useTableColumns.tsx +1 -1
- package/src/components/Table/_utils/tableUtils.ts +3 -2
- package/src/components/Table/index.md +16 -0
- package/src/components/Table/index.module.scss +14 -14
- package/src/components/Table/index.tsx +27 -1
- package/src/components/Tags/_components/EllipsisTag/index.tsx +1 -1
- package/src/components/TextEllipsis/index.tsx +6 -4
- package/src/components/Tree/index.md +9 -0
- package/src/components/Tree/index.module.scss +6 -6
- package/src/components/Tree/index.tsx +12 -2
- package/src/components/Upload/_components/UploadedItem/index.tsx +2 -2
- package/src/components/Upload/_components/UploadingItem/index.tsx +2 -2
- package/src/components/Upload/_utils/normalUpload.ts +1 -1
- package/src/components/Upload/_utils/validateFile.ts +55 -2
- package/src/components/Upload/index.md +9 -0
- package/src/components/Upload/index.tsx +22 -7
- package/src/config-provider/index.tsx +84 -4
- package/src/feedback/index.tsx +141 -0
- package/src/hooks/index.ts +5 -0
- package/src/hooks/useBreakpoint.ts +62 -0
- package/src/hooks/useIsDark.ts +64 -0
- package/src/hooks/usePointerType.ts +59 -0
- package/src/index.ts +37 -5
- package/src/layout/Breadcrumb/_components/BreadcrumbItemIcon/index.tsx +26 -0
- package/src/layout/Breadcrumb/_components/BreadcrumbMenuItem/index.tsx +32 -0
- package/src/layout/Breadcrumb/_hooks/useBreadcrumbPath.ts +111 -0
- package/src/layout/Breadcrumb/_utils/formatMenu.ts +30 -0
- package/src/layout/Breadcrumb/_utils/formatRoutes.ts +71 -0
- package/src/layout/Breadcrumb/_utils/pathMatch.ts +52 -0
- package/src/layout/Breadcrumb/index.md +37 -0
- package/src/layout/Breadcrumb/index.module.scss +15 -0
- package/src/layout/Breadcrumb/index.tsx +103 -0
- package/src/layout/Header/index.md +105 -0
- package/src/layout/Header/index.module.scss +215 -0
- package/src/layout/Header/index.tsx +198 -0
- package/src/layout/I18n/I18nStore.ts +98 -0
- package/src/layout/I18n/index.md +45 -0
- package/src/layout/I18n/index.tsx +44 -0
- package/src/layout/I18n/locales/en-US.ts +16 -0
- package/src/layout/I18n/locales/zh-CN.ts +16 -0
- package/src/layout/Menu/_components/SecondaryHeader/index.module.scss +65 -0
- package/src/layout/Menu/_components/SecondaryHeader/index.tsx +61 -0
- package/src/layout/Menu/_hooks/useMenuPath.ts +81 -0
- package/src/layout/Menu/_hooks/useOnlyLvOneMenu.ts +44 -0
- package/src/layout/Menu/_utils/formatMenu.ts +57 -0
- package/src/layout/Menu/_utils/pathMatch.ts +48 -0
- package/src/layout/Menu/_utils/setActiveIcon.ts +23 -0
- package/src/layout/Menu/index.md +43 -0
- package/src/layout/Menu/index.module.scss +50 -0
- package/src/layout/Menu/index.tsx +208 -0
- package/src/layout/NavTabBar/_components/SortableTab/index.tsx +40 -0
- package/src/layout/NavTabBar/_components/TabContextMenu/index.tsx +157 -0
- package/src/layout/NavTabBar/_components/TabDragOverlay/index.tsx +69 -0
- package/src/layout/NavTabBar/_components/TabLabel/index.tsx +84 -0
- package/src/layout/NavTabBar/_hooks/useDropTabKey.ts +27 -0
- package/src/layout/NavTabBar/_hooks/useTabContextMenu.ts +23 -0
- package/src/layout/NavTabBar/_hooks/useTabPath.ts +118 -0
- package/src/layout/NavTabBar/_hooks/useTabTitle.ts +28 -0
- package/src/layout/NavTabBar/_utils/formatNavTabBar.ts +50 -0
- package/src/layout/NavTabBar/_utils/pathMatch.ts +37 -0
- package/src/layout/NavTabBar/_utils/tabActions.ts +131 -0
- package/src/layout/NavTabBar/index.md +76 -0
- package/src/layout/NavTabBar/index.module.scss +179 -0
- package/src/layout/NavTabBar/index.tsx +236 -0
- package/src/layout/Theme/ThemeStore.ts +70 -0
- package/src/layout/Theme/index.md +48 -0
- package/src/layout/Theme/index.module.scss +6 -0
- package/src/layout/Theme/index.tsx +105 -0
- package/src/layout/_hooks/useDropTab.ts +23 -0
- package/src/layout/_hooks/useReload.ts +19 -0
- package/src/layout/_hooks/useSetTabTitle.ts +19 -0
- package/src/layout/_utils/storage.ts +34 -0
- package/src/layout/index.ts +66 -0
- package/src/layout/types.ts +58 -0
- package/src/request/index.ts +8 -1
- package/src/styles/_responsive.scss +53 -0
- package/src/styles/antd-overload.scss +77 -21
- package/src/styles/tokens.json +82 -0
- package/src/styles/tokens.scss +99 -52
- package/src/styles/tokens.ts +198 -33
- package/src/types/antd.ts +46 -0
- package/src/utils/semantic.ts +45 -0
- package/es/components/Button/ChakraButton/index.d.ts +0 -11
- package/es/components/Button/ChakraButton/index.js +0 -66
- package/es/components/Button/ChakraButton/index.module.scss +0 -20
- package/es/components/ChakraRoot/index.d.ts +0 -6
- package/es/components/ChakraRoot/index.js +0 -42
- package/lib/components/Button/ChakraButton/index.d.ts +0 -11
- package/lib/components/Button/ChakraButton/index.js +0 -70
- package/lib/components/Button/ChakraButton/index.module.scss +0 -20
- package/lib/components/ChakraRoot/index.d.ts +0 -6
- package/lib/components/ChakraRoot/index.js +0 -46
- package/src/components/Button/ChakraButton/index.module.scss +0 -20
- package/src/components/Button/ChakraButton/index.tsx +0 -83
- package/src/components/ChakraRoot/index.tsx +0 -43
|
@@ -0,0 +1,208 @@
|
|
|
1
|
+
import React, { ReactNode, useMemo } from "react";
|
|
2
|
+
import { matchPath, useLocation, useNavigate } from "react-router";
|
|
3
|
+
|
|
4
|
+
import { Menu as AntdMenu, MenuProps as AntdMenuProps } from "antd";
|
|
5
|
+
import { ItemType } from "antd/es/menu/interface";
|
|
6
|
+
import { RouteType } from "../types";
|
|
7
|
+
import { cloneDeep } from "lodash";
|
|
8
|
+
import classNames from "classnames";
|
|
9
|
+
import { mergeSemantic } from "../../utils/semantic";
|
|
10
|
+
import styles from "./index.module.scss";
|
|
11
|
+
import { formatMenu } from "./_utils/formatMenu";
|
|
12
|
+
import { setActiveIcon } from "./_utils/setActiveIcon";
|
|
13
|
+
import { useMenuPath } from "./_hooks/useMenuPath";
|
|
14
|
+
import SecondaryHeader from "./_components/SecondaryHeader";
|
|
15
|
+
import { useOnlyLvOneMenu } from "./_hooks/useOnlyLvOneMenu";
|
|
16
|
+
|
|
17
|
+
export type MenuType = ItemType & {
|
|
18
|
+
key: string;
|
|
19
|
+
icon?: ReactNode;
|
|
20
|
+
defaultIcon?: ReactNode;
|
|
21
|
+
activeIcon?: ReactNode;
|
|
22
|
+
children?: MenuType[];
|
|
23
|
+
label?: ReactNode;
|
|
24
|
+
path?: string;
|
|
25
|
+
name?: ReactNode;
|
|
26
|
+
title?: string;
|
|
27
|
+
disabled?: boolean;
|
|
28
|
+
renderLabel?: (label: string) => ReactNode;
|
|
29
|
+
parent?: MenuType;
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
interface MenuProps extends AntdMenuProps {
|
|
33
|
+
router: RouteType[];
|
|
34
|
+
collapsed?: boolean;
|
|
35
|
+
menuItems?: MenuType[];
|
|
36
|
+
onlyLvOneMenu?: boolean;
|
|
37
|
+
getCurrChildItems?: (children: MenuType[]) => void;
|
|
38
|
+
/** 次级菜单顶部的自定义区域(返回入口、标题、检索框之类),只在次级菜单生效 */
|
|
39
|
+
secondaryHeader?: ReactNode;
|
|
40
|
+
/**
|
|
41
|
+
* 次级菜单项的额外过滤,按菜单项的 key(绝对路径)判断。
|
|
42
|
+
* 留给依赖运行时业务数据、菜单表达不了的规则。
|
|
43
|
+
*/
|
|
44
|
+
secondaryItemFilter?: (key: string) => boolean;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
/**
|
|
48
|
+
* 次级菜单根:进入它的子树后,整个侧栏换成那些子页。
|
|
49
|
+
* 由菜单表的 `cat=1` 显式标记,不靠前端推断。
|
|
50
|
+
*/
|
|
51
|
+
const isSecondaryRoot = (route: RouteType): boolean =>
|
|
52
|
+
!!route.path && !!route.children?.length && route.meta?.secondary === true;
|
|
53
|
+
|
|
54
|
+
/** 把菜单项 key 里的路由参数按当前地址回填:/order/:id/detail → /order/1024/detail */
|
|
55
|
+
const fillParams = (key: string, params: Record<string, string | undefined>) =>
|
|
56
|
+
key.replace(/:([^/]+)/g, (seg, name: string) => params[name] ?? seg);
|
|
57
|
+
|
|
58
|
+
const Menu: React.FC<MenuProps> = (props) => {
|
|
59
|
+
const {
|
|
60
|
+
router,
|
|
61
|
+
collapsed = false,
|
|
62
|
+
className,
|
|
63
|
+
theme = "dark",
|
|
64
|
+
mode = "inline",
|
|
65
|
+
getCurrChildItems,
|
|
66
|
+
menuItems,
|
|
67
|
+
onlyLvOneMenu = false,
|
|
68
|
+
secondaryHeader,
|
|
69
|
+
secondaryItemFilter,
|
|
70
|
+
classNames: semanticClassNames,
|
|
71
|
+
...menuConfig
|
|
72
|
+
} = props;
|
|
73
|
+
const navigate = useNavigate();
|
|
74
|
+
const location = useLocation();
|
|
75
|
+
|
|
76
|
+
// 当前地址落在某个次级菜单根之下时,侧栏整个换成那棵子树
|
|
77
|
+
const secondary = useMemo(() => {
|
|
78
|
+
const find = (routes?: RouteType[]): RouteType | undefined => {
|
|
79
|
+
for (const r of routes ?? []) {
|
|
80
|
+
if (
|
|
81
|
+
isSecondaryRoot(r) &&
|
|
82
|
+
matchPath({ path: r.path as string, end: false }, location.pathname)
|
|
83
|
+
) {
|
|
84
|
+
return r;
|
|
85
|
+
}
|
|
86
|
+
const hit = find(r.children);
|
|
87
|
+
if (hit) return hit;
|
|
88
|
+
}
|
|
89
|
+
return undefined;
|
|
90
|
+
};
|
|
91
|
+
return find(router);
|
|
92
|
+
}, [router, location.pathname]);
|
|
93
|
+
|
|
94
|
+
const items = useMemo(() => {
|
|
95
|
+
if (secondary?.path) {
|
|
96
|
+
const rootLen = secondary.path.length;
|
|
97
|
+
// all=true:这些子页本就都不进主侧栏,按 menu 标记会被全部过滤掉
|
|
98
|
+
return formatMenu(secondary.children ?? [], true)
|
|
99
|
+
// 自身那段还带参数的(detail/:id)点不进去,不列
|
|
100
|
+
.filter((i) => !i.key.slice(rootLen).includes(":"))
|
|
101
|
+
.filter((i) => secondaryItemFilter?.(i.key) ?? true);
|
|
102
|
+
}
|
|
103
|
+
return menuItems ? cloneDeep(menuItems) : formatMenu(router);
|
|
104
|
+
}, [router, menuItems, secondary, secondaryItemFilter]);
|
|
105
|
+
|
|
106
|
+
const allItems = useMemo(() => {
|
|
107
|
+
return menuItems
|
|
108
|
+
? cloneDeep(menuItems)
|
|
109
|
+
: formatMenu(cloneDeep(router), true);
|
|
110
|
+
}, [router, menuItems]);
|
|
111
|
+
|
|
112
|
+
const { menuKey, setMenuKey, openKeys, setOpenkeys } = useMenuPath({
|
|
113
|
+
allItems,
|
|
114
|
+
collapsed,
|
|
115
|
+
mode,
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
const _items: MenuType[] = useMemo(() => {
|
|
119
|
+
const _items: MenuType[] = cloneDeep(items);
|
|
120
|
+
setActiveIcon(_items, menuKey);
|
|
121
|
+
return _items;
|
|
122
|
+
}, [items, menuKey]);
|
|
123
|
+
|
|
124
|
+
useOnlyLvOneMenu({
|
|
125
|
+
items,
|
|
126
|
+
onlyLvOneMenu,
|
|
127
|
+
getCurrChildItems,
|
|
128
|
+
setOpenkeys,
|
|
129
|
+
setMenuKey,
|
|
130
|
+
});
|
|
131
|
+
|
|
132
|
+
// Cloudflare style: the sidebar (inline) renders top-level directories as non-collapsible "groups";
|
|
133
|
+
// level 1 = gray section title, level 2 = flat items; collapsible submenus are no longer used in expanded mode.
|
|
134
|
+
const cfGroupItems = useMemo<ItemType[]>(() => {
|
|
135
|
+
return _items.map((it) =>
|
|
136
|
+
it.children?.length && !collapsed
|
|
137
|
+
? ({
|
|
138
|
+
type: "group",
|
|
139
|
+
key: it.key,
|
|
140
|
+
label: it.title ?? it.label,
|
|
141
|
+
children: it.children,
|
|
142
|
+
} as ItemType)
|
|
143
|
+
: (it as ItemType)
|
|
144
|
+
);
|
|
145
|
+
}, [_items, collapsed]);
|
|
146
|
+
|
|
147
|
+
const menu = (
|
|
148
|
+
<AntdMenu
|
|
149
|
+
{...menuConfig}
|
|
150
|
+
mode={mode}
|
|
151
|
+
inlineCollapsed={collapsed}
|
|
152
|
+
items={
|
|
153
|
+
onlyLvOneMenu
|
|
154
|
+
? (_items?.map((i) => ({ ...i, children: undefined })) as ItemType[])
|
|
155
|
+
: mode === "inline"
|
|
156
|
+
? cfGroupItems
|
|
157
|
+
: _items
|
|
158
|
+
}
|
|
159
|
+
onClick={(v) => {
|
|
160
|
+
if (onlyLvOneMenu) {
|
|
161
|
+
getCurrChildItems?.(
|
|
162
|
+
items.find((i) => i.key === v.key)?.children || []
|
|
163
|
+
);
|
|
164
|
+
setOpenkeys([v.key]);
|
|
165
|
+
setMenuKey(v.key);
|
|
166
|
+
} else {
|
|
167
|
+
// 次级菜单的 key 是带参模式(/admin/order/:id/detail),按当前地址回填再跳
|
|
168
|
+
const params = secondary?.path
|
|
169
|
+
? (matchPath({ path: secondary.path, end: false }, location.pathname)
|
|
170
|
+
?.params ?? {})
|
|
171
|
+
: {};
|
|
172
|
+
navigate(fillParams(v.key, params));
|
|
173
|
+
}
|
|
174
|
+
}}
|
|
175
|
+
selectedKeys={[menuKey]}
|
|
176
|
+
openKeys={openKeys}
|
|
177
|
+
onOpenChange={(keys: string[]) => {
|
|
178
|
+
setOpenkeys(keys);
|
|
179
|
+
}}
|
|
180
|
+
theme={theme}
|
|
181
|
+
className={classNames(styles.menu, className)}
|
|
182
|
+
// 弹出的子菜单挂在 body 上,拿不到根节点的类名。给它挂一个自己的类,样式才有地方落
|
|
183
|
+
classNames={mergeSemantic(semanticClassNames, (outer) => ({
|
|
184
|
+
...outer,
|
|
185
|
+
popup: [
|
|
186
|
+
styles.popup,
|
|
187
|
+
typeof outer.popup === "string" ? outer.popup : outer.popup?.root,
|
|
188
|
+
]
|
|
189
|
+
.filter(Boolean)
|
|
190
|
+
.join(" "),
|
|
191
|
+
}))}
|
|
192
|
+
/>
|
|
193
|
+
);
|
|
194
|
+
|
|
195
|
+
// 次级菜单默认带一段头部(至少给出返回入口),调用方可用 secondaryHeader 整块换掉
|
|
196
|
+
return secondary ? (
|
|
197
|
+
<div className={styles.secondaryWrap}>
|
|
198
|
+
{secondaryHeader ?? (
|
|
199
|
+
<SecondaryHeader collapsed={collapsed} theme={theme as "light" | "dark"} />
|
|
200
|
+
)}
|
|
201
|
+
{menu}
|
|
202
|
+
</div>
|
|
203
|
+
) : (
|
|
204
|
+
menu
|
|
205
|
+
);
|
|
206
|
+
};
|
|
207
|
+
|
|
208
|
+
export default Menu;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { useSortable } from "@dnd-kit/sortable";
|
|
3
|
+
import { CSS } from "@dnd-kit/utilities";
|
|
4
|
+
|
|
5
|
+
interface DraggableTabPaneProps extends React.HTMLAttributes<HTMLDivElement> {
|
|
6
|
+
"data-node-key": string;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Draggable tab node component
|
|
11
|
+
*/
|
|
12
|
+
const DraggableTabNode: React.FC<Readonly<DraggableTabPaneProps>> = (props) => {
|
|
13
|
+
const {
|
|
14
|
+
attributes,
|
|
15
|
+
listeners,
|
|
16
|
+
setNodeRef,
|
|
17
|
+
transform,
|
|
18
|
+
transition,
|
|
19
|
+
isDragging,
|
|
20
|
+
} = useSortable({
|
|
21
|
+
id: props["data-node-key"],
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
const style: React.CSSProperties = {
|
|
25
|
+
...props.style,
|
|
26
|
+
transform: CSS.Transform.toString(transform),
|
|
27
|
+
transition,
|
|
28
|
+
opacity: isDragging ? 0 : 1,
|
|
29
|
+
cursor: "pointer",
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
return React.cloneElement(props.children as React.ReactElement, {
|
|
33
|
+
ref: setNodeRef,
|
|
34
|
+
style,
|
|
35
|
+
...attributes,
|
|
36
|
+
...listeners,
|
|
37
|
+
});
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default DraggableTabNode;
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import Button from "../../../../components/Button";
|
|
3
|
+
import Icon from "../../../../components/Icon";
|
|
4
|
+
import { TabType } from "../..";
|
|
5
|
+
import {
|
|
6
|
+
closeTab,
|
|
7
|
+
closeLeftTabs,
|
|
8
|
+
closeRightTabs,
|
|
9
|
+
closeOtherTabs,
|
|
10
|
+
closeAllTabs,
|
|
11
|
+
} from "../../_utils/tabActions";
|
|
12
|
+
import styles from "../../index.module.scss";
|
|
13
|
+
|
|
14
|
+
interface TabContextMenuProps {
|
|
15
|
+
item: TabType;
|
|
16
|
+
index: number;
|
|
17
|
+
openKeys: TabType[];
|
|
18
|
+
basePath: string;
|
|
19
|
+
affixRouter: string[];
|
|
20
|
+
onReload: (key: string) => void;
|
|
21
|
+
refresh: (key: string) => void;
|
|
22
|
+
drop: (key: string) => void;
|
|
23
|
+
setOpenkeys: React.Dispatch<React.SetStateAction<TabType[]>>;
|
|
24
|
+
setOpen: (key: string) => void;
|
|
25
|
+
navigate: (path: string) => void;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* Tab context menu component
|
|
30
|
+
*/
|
|
31
|
+
const TabContextMenu: React.FC<TabContextMenuProps> = ({
|
|
32
|
+
item,
|
|
33
|
+
index,
|
|
34
|
+
openKeys,
|
|
35
|
+
basePath,
|
|
36
|
+
affixRouter,
|
|
37
|
+
onReload,
|
|
38
|
+
refresh,
|
|
39
|
+
drop,
|
|
40
|
+
setOpenkeys,
|
|
41
|
+
setOpen,
|
|
42
|
+
navigate,
|
|
43
|
+
}) => {
|
|
44
|
+
// Determine whether the current tab is affixed
|
|
45
|
+
const isAffixed = affixRouter.includes(item.key) || item.affix;
|
|
46
|
+
|
|
47
|
+
return (
|
|
48
|
+
<div className={styles.tabContextMenu}>
|
|
49
|
+
<div className={styles.part}>
|
|
50
|
+
<Button
|
|
51
|
+
type="text"
|
|
52
|
+
onClick={() => {
|
|
53
|
+
onReload(item.key?.split("?")[0] || "");
|
|
54
|
+
refresh(item.key?.split("?")[0] || "");
|
|
55
|
+
setOpen("");
|
|
56
|
+
}}
|
|
57
|
+
icon={<Icon icon="ep:refresh" />}
|
|
58
|
+
>
|
|
59
|
+
重新加载
|
|
60
|
+
</Button>
|
|
61
|
+
<Button
|
|
62
|
+
type="text"
|
|
63
|
+
disabled={isAffixed}
|
|
64
|
+
onClick={() => {
|
|
65
|
+
const newOpenKeys = closeTab(openKeys, index, drop, affixRouter);
|
|
66
|
+
setOpenkeys(newOpenKeys);
|
|
67
|
+
setOpen("");
|
|
68
|
+
// After closing the tab, select the previous one; fall back to the first one
|
|
69
|
+
const targetIndex = index > 0 ? index - 1 : 0;
|
|
70
|
+
navigate(newOpenKeys[targetIndex]?.key || basePath);
|
|
71
|
+
}}
|
|
72
|
+
icon={<Icon icon="ep:close" />}
|
|
73
|
+
>
|
|
74
|
+
关闭标签页
|
|
75
|
+
</Button>
|
|
76
|
+
</div>
|
|
77
|
+
<div className={styles.part}>
|
|
78
|
+
<Button
|
|
79
|
+
type="text"
|
|
80
|
+
disabled={index === 0}
|
|
81
|
+
onClick={() => {
|
|
82
|
+
const newOpenKeys = closeLeftTabs(
|
|
83
|
+
openKeys,
|
|
84
|
+
index,
|
|
85
|
+
drop,
|
|
86
|
+
affixRouter
|
|
87
|
+
);
|
|
88
|
+
setOpenkeys(newOpenKeys);
|
|
89
|
+
setOpen("");
|
|
90
|
+
navigate(item.key);
|
|
91
|
+
}}
|
|
92
|
+
icon={<Icon icon="ep:d-arrow-left" />}
|
|
93
|
+
>
|
|
94
|
+
关闭左侧标签页
|
|
95
|
+
</Button>
|
|
96
|
+
<Button
|
|
97
|
+
type="text"
|
|
98
|
+
disabled={index === openKeys.length - 1}
|
|
99
|
+
onClick={() => {
|
|
100
|
+
const newOpenKeys = closeRightTabs(
|
|
101
|
+
openKeys,
|
|
102
|
+
index,
|
|
103
|
+
drop,
|
|
104
|
+
affixRouter
|
|
105
|
+
);
|
|
106
|
+
setOpenkeys(newOpenKeys);
|
|
107
|
+
setOpen("");
|
|
108
|
+
navigate(item.key);
|
|
109
|
+
}}
|
|
110
|
+
icon={<Icon icon="ep:d-arrow-right" />}
|
|
111
|
+
>
|
|
112
|
+
关闭右侧标签页
|
|
113
|
+
</Button>
|
|
114
|
+
</div>
|
|
115
|
+
<div className={styles.part}>
|
|
116
|
+
<Button
|
|
117
|
+
type="text"
|
|
118
|
+
disabled={openKeys.length <= 1}
|
|
119
|
+
onClick={() => {
|
|
120
|
+
const newOpenKeys = closeOtherTabs(
|
|
121
|
+
openKeys,
|
|
122
|
+
item,
|
|
123
|
+
drop,
|
|
124
|
+
affixRouter
|
|
125
|
+
);
|
|
126
|
+
setOpenkeys(newOpenKeys);
|
|
127
|
+
setOpen("");
|
|
128
|
+
navigate(item.key);
|
|
129
|
+
}}
|
|
130
|
+
icon={<Icon icon="ep:discount" />}
|
|
131
|
+
>
|
|
132
|
+
关闭其他标签页
|
|
133
|
+
</Button>
|
|
134
|
+
<Button
|
|
135
|
+
type="text"
|
|
136
|
+
disabled={isAffixed && openKeys.length <= 1}
|
|
137
|
+
onClick={() => {
|
|
138
|
+
const newOpenKeys = closeAllTabs(openKeys, drop, affixRouter);
|
|
139
|
+
setOpenkeys(newOpenKeys);
|
|
140
|
+
setOpen("");
|
|
141
|
+
// If any affixed tabs remain, navigate to the first one
|
|
142
|
+
if (newOpenKeys.length > 0) {
|
|
143
|
+
navigate(newOpenKeys[0].key);
|
|
144
|
+
} else {
|
|
145
|
+
navigate(basePath);
|
|
146
|
+
}
|
|
147
|
+
}}
|
|
148
|
+
icon={<Icon icon="ep:minus" />}
|
|
149
|
+
>
|
|
150
|
+
关闭全部标签页
|
|
151
|
+
</Button>
|
|
152
|
+
</div>
|
|
153
|
+
</div>
|
|
154
|
+
);
|
|
155
|
+
};
|
|
156
|
+
|
|
157
|
+
export default TabContextMenu;
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { DragOverlay } from "@dnd-kit/core";
|
|
3
|
+
import { TabType } from "../..";
|
|
4
|
+
import TabLabel from "../TabLabel";
|
|
5
|
+
import styles from "../../index.module.scss";
|
|
6
|
+
|
|
7
|
+
interface TabDragOverlayProps {
|
|
8
|
+
activeId: string | null;
|
|
9
|
+
openKeys: TabType[];
|
|
10
|
+
basePath: string;
|
|
11
|
+
affixRouter: string[];
|
|
12
|
+
open: string;
|
|
13
|
+
onReload: (key: string) => void;
|
|
14
|
+
refresh: (key: string) => void;
|
|
15
|
+
drop: (key: string) => void;
|
|
16
|
+
setOpenkeys: React.Dispatch<React.SetStateAction<TabType[]>>;
|
|
17
|
+
setOpen: (key: string) => void;
|
|
18
|
+
navigate: (path: string) => void;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* Drag overlay component that renders the tab currently being dragged
|
|
23
|
+
*/
|
|
24
|
+
const TabDragOverlay: React.FC<TabDragOverlayProps> = ({
|
|
25
|
+
activeId,
|
|
26
|
+
openKeys,
|
|
27
|
+
basePath,
|
|
28
|
+
affixRouter,
|
|
29
|
+
open,
|
|
30
|
+
onReload,
|
|
31
|
+
refresh,
|
|
32
|
+
drop,
|
|
33
|
+
setOpenkeys,
|
|
34
|
+
setOpen,
|
|
35
|
+
navigate,
|
|
36
|
+
}) => {
|
|
37
|
+
return (
|
|
38
|
+
<DragOverlay adjustScale={false}>
|
|
39
|
+
{activeId ? (
|
|
40
|
+
<div className={styles.dragOverlay}>
|
|
41
|
+
{(() => {
|
|
42
|
+
const item = openKeys.find((item) => item.key === activeId);
|
|
43
|
+
const idx = openKeys.findIndex((item) => item.key === activeId);
|
|
44
|
+
return item ? (
|
|
45
|
+
<TabLabel
|
|
46
|
+
item={item}
|
|
47
|
+
index={idx}
|
|
48
|
+
openKeys={openKeys}
|
|
49
|
+
basePath={basePath}
|
|
50
|
+
affixRouter={affixRouter}
|
|
51
|
+
open={open}
|
|
52
|
+
onReload={onReload}
|
|
53
|
+
refresh={refresh}
|
|
54
|
+
drop={drop}
|
|
55
|
+
setOpenkeys={setOpenkeys}
|
|
56
|
+
setOpen={setOpen}
|
|
57
|
+
navigate={navigate}
|
|
58
|
+
/>
|
|
59
|
+
) : (
|
|
60
|
+
activeId
|
|
61
|
+
);
|
|
62
|
+
})()}
|
|
63
|
+
</div>
|
|
64
|
+
) : null}
|
|
65
|
+
</DragOverlay>
|
|
66
|
+
);
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export default TabDragOverlay;
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Popover } from "antd";
|
|
3
|
+
import { TabType } from "../..";
|
|
4
|
+
import TabContextMenu from "../TabContextMenu";
|
|
5
|
+
import styles from "../../index.module.scss";
|
|
6
|
+
import classNames from "classnames";
|
|
7
|
+
|
|
8
|
+
interface TabLabelProps {
|
|
9
|
+
item: TabType;
|
|
10
|
+
index: number;
|
|
11
|
+
openKeys: TabType[];
|
|
12
|
+
basePath: string;
|
|
13
|
+
affixRouter: string[];
|
|
14
|
+
open: string;
|
|
15
|
+
onReload: (key: string) => void;
|
|
16
|
+
refresh: (key: string) => void;
|
|
17
|
+
drop: (key: string) => void;
|
|
18
|
+
setOpenkeys: React.Dispatch<React.SetStateAction<TabType[]>>;
|
|
19
|
+
setOpen: (key: string) => void;
|
|
20
|
+
navigate: (path: string) => void;
|
|
21
|
+
className?: string;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
/**
|
|
25
|
+
* Tab label component
|
|
26
|
+
*/
|
|
27
|
+
const TabLabel: React.FC<TabLabelProps> = ({
|
|
28
|
+
item,
|
|
29
|
+
index,
|
|
30
|
+
openKeys,
|
|
31
|
+
basePath,
|
|
32
|
+
affixRouter,
|
|
33
|
+
open,
|
|
34
|
+
onReload,
|
|
35
|
+
refresh,
|
|
36
|
+
drop,
|
|
37
|
+
setOpenkeys,
|
|
38
|
+
setOpen,
|
|
39
|
+
navigate,
|
|
40
|
+
className,
|
|
41
|
+
}) => {
|
|
42
|
+
return (
|
|
43
|
+
<Popover
|
|
44
|
+
open={item.key === open}
|
|
45
|
+
placement="bottomLeft"
|
|
46
|
+
classNames={{ root: styles.popover }}
|
|
47
|
+
content={
|
|
48
|
+
<TabContextMenu
|
|
49
|
+
item={item}
|
|
50
|
+
index={index}
|
|
51
|
+
openKeys={openKeys}
|
|
52
|
+
basePath={basePath}
|
|
53
|
+
affixRouter={affixRouter}
|
|
54
|
+
onReload={onReload}
|
|
55
|
+
refresh={refresh}
|
|
56
|
+
drop={drop}
|
|
57
|
+
setOpenkeys={setOpenkeys}
|
|
58
|
+
setOpen={setOpen}
|
|
59
|
+
navigate={navigate}
|
|
60
|
+
/>
|
|
61
|
+
}
|
|
62
|
+
>
|
|
63
|
+
<span
|
|
64
|
+
onContextMenu={(event) => {
|
|
65
|
+
event.preventDefault();
|
|
66
|
+
}}
|
|
67
|
+
onMouseDown={(e) => {
|
|
68
|
+
if (e.button === 2) {
|
|
69
|
+
setOpen(item.key === open ? "" : item.key);
|
|
70
|
+
} else {
|
|
71
|
+
setOpen("");
|
|
72
|
+
navigate(item.key);
|
|
73
|
+
}
|
|
74
|
+
}}
|
|
75
|
+
className={classNames(styles.tabLabel, className)}
|
|
76
|
+
>
|
|
77
|
+
{item.icon}
|
|
78
|
+
{item.label}
|
|
79
|
+
</span>
|
|
80
|
+
</Popover>
|
|
81
|
+
);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
export default TabLabel;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { useEffect, useContext } from "react";
|
|
2
|
+
import { useAliveController } from "react-activation";
|
|
3
|
+
import { NavTabBarContent } from "../../_hooks/useDropTab";
|
|
4
|
+
import { TabType } from "..";
|
|
5
|
+
|
|
6
|
+
/**
|
|
7
|
+
* Hook that closes a tab via dropKey
|
|
8
|
+
*/
|
|
9
|
+
export const useDropTabKey = (
|
|
10
|
+
setOpenkeys: React.Dispatch<React.SetStateAction<TabType[]>>
|
|
11
|
+
) => {
|
|
12
|
+
const { drop } = useAliveController();
|
|
13
|
+
const { dropKey } = useContext(NavTabBarContent);
|
|
14
|
+
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
setTimeout(() => {
|
|
17
|
+
if (dropKey) {
|
|
18
|
+
drop(dropKey);
|
|
19
|
+
|
|
20
|
+
setOpenkeys((prev) => {
|
|
21
|
+
const newOpenKeys = prev.filter((item) => item.key !== dropKey);
|
|
22
|
+
return newOpenKeys;
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
}, 0);
|
|
26
|
+
}, [drop, dropKey, setOpenkeys]);
|
|
27
|
+
};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { useState } from "react";
|
|
2
|
+
import { useDebounceEffect } from "ahooks";
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Hook that handles the tab context menu
|
|
6
|
+
*/
|
|
7
|
+
export const useTabContextMenu = () => {
|
|
8
|
+
const [open, setOpen] = useState<string>("");
|
|
9
|
+
|
|
10
|
+
useDebounceEffect(() => {
|
|
11
|
+
const close = () => {
|
|
12
|
+
setOpen("");
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
document.removeEventListener("click", close);
|
|
16
|
+
if (open) {
|
|
17
|
+
document.addEventListener("click", close);
|
|
18
|
+
}
|
|
19
|
+
}, [open]);
|
|
20
|
+
|
|
21
|
+
return { open, setOpen };
|
|
22
|
+
};
|
|
23
|
+
|