@hsu-react/ui 1.0.0 → 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 +15 -6
- 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,64 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Attributes that mark the document as dark. These are the same selectors the generated
|
|
5
|
+
* `tokens.scss` keys off, so the CSS-variable layer and the antd theme always agree on which
|
|
6
|
+
* palette is active — `data-theme` is what consuming apps toggle, the `prefers-color*` pair is
|
|
7
|
+
* what the dumi docs site sets.
|
|
8
|
+
*/
|
|
9
|
+
const DARK_ATTRS = [
|
|
10
|
+
"data-theme",
|
|
11
|
+
"data-prefers-color",
|
|
12
|
+
"data-prefers-color-scheme",
|
|
13
|
+
] as const;
|
|
14
|
+
|
|
15
|
+
const read = (): boolean => {
|
|
16
|
+
if (typeof document === "undefined") return false;
|
|
17
|
+
|
|
18
|
+
const root = document.documentElement;
|
|
19
|
+
for (const attr of DARK_ATTRS) {
|
|
20
|
+
const value = root.getAttribute(attr);
|
|
21
|
+
if (value === "dark") return true;
|
|
22
|
+
if (value === "light") return false;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return (
|
|
26
|
+
typeof window !== "undefined" &&
|
|
27
|
+
window.matchMedia?.("(prefers-color-scheme: dark)").matches
|
|
28
|
+
);
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Whether the document is currently in dark mode.
|
|
33
|
+
*
|
|
34
|
+
* The CSS variables switch on their own — they are plain CSS. antd's theme cannot: its tokens are
|
|
35
|
+
* computed in JS, so the algorithm has to be swapped on re-render. This hook is that bridge, and
|
|
36
|
+
* `ConfigProvider` uses it to pick `darkAlgorithm`.
|
|
37
|
+
*/
|
|
38
|
+
const useIsDark = (): boolean => {
|
|
39
|
+
const [isDark, setIsDark] = useState(read);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const update = () => setIsDark(read());
|
|
43
|
+
update();
|
|
44
|
+
|
|
45
|
+
const observer = new MutationObserver(update);
|
|
46
|
+
observer.observe(document.documentElement, {
|
|
47
|
+
attributes: true,
|
|
48
|
+
attributeFilter: [...DARK_ATTRS],
|
|
49
|
+
});
|
|
50
|
+
|
|
51
|
+
// Only relevant while no explicit attribute is set, but harmless otherwise.
|
|
52
|
+
const media = window.matchMedia?.("(prefers-color-scheme: dark)");
|
|
53
|
+
media?.addEventListener?.("change", update);
|
|
54
|
+
|
|
55
|
+
return () => {
|
|
56
|
+
observer.disconnect();
|
|
57
|
+
media?.removeEventListener?.("change", update);
|
|
58
|
+
};
|
|
59
|
+
}, []);
|
|
60
|
+
|
|
61
|
+
return isDark;
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
export default useIsDark;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
export interface PointerType {
|
|
4
|
+
/** 主要输入设备是粗指针(手指、触控笔) */
|
|
5
|
+
isCoarse: boolean;
|
|
6
|
+
/** 设备具备真正的悬停能力(鼠标、触控板) */
|
|
7
|
+
canHover: boolean;
|
|
8
|
+
/** 粗指针且不能悬停 —— 通常意义上的「触屏设备」 */
|
|
9
|
+
isTouch: boolean;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
const QUERY_COARSE = "(pointer: coarse)";
|
|
13
|
+
const QUERY_HOVER = "(hover: hover)";
|
|
14
|
+
|
|
15
|
+
const read = (): PointerType => {
|
|
16
|
+
if (typeof window === "undefined" || !window.matchMedia) {
|
|
17
|
+
return { isCoarse: false, canHover: true, isTouch: false };
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
const isCoarse = window.matchMedia(QUERY_COARSE).matches;
|
|
21
|
+
const canHover = window.matchMedia(QUERY_HOVER).matches;
|
|
22
|
+
|
|
23
|
+
return { isCoarse, canHover, isTouch: isCoarse && !canHover };
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
/**
|
|
27
|
+
* 当前设备的指针能力。
|
|
28
|
+
*
|
|
29
|
+
* 刻意**不**做 UA 嗅探:二合一设备可以在触摸与鼠标之间来回切换,媒体查询会跟着变,UA 不会。
|
|
30
|
+
*
|
|
31
|
+
* 另外说明一个常见误解:不需要为了移动端把 `onClick` 换成 `onTouchStart`。触摸事件序列本来
|
|
32
|
+
* 就会合成 click,`onClick` 在触屏上一直是能用的;换成 touch 反而会丢掉键盘可访问性、在滚动
|
|
33
|
+
* 时误触发、并与合成的 click 重复触发。移动端真正要处理的是别的东西 —— 300ms 点击延迟
|
|
34
|
+
* (用 `touch-action: manipulation`)、点完粘住不消的 `:hover`(用 `_responsive.scss` 的
|
|
35
|
+
* `hover` mixin 包起来)、以及过小的点按目标。这个 hook 用于最后一类:需要按指针类型
|
|
36
|
+
* **改变结构或尺寸**的场合。
|
|
37
|
+
*/
|
|
38
|
+
const usePointerType = (): PointerType => {
|
|
39
|
+
const [state, setState] = useState<PointerType>(read);
|
|
40
|
+
|
|
41
|
+
useEffect(() => {
|
|
42
|
+
const update = () => setState(read());
|
|
43
|
+
update();
|
|
44
|
+
|
|
45
|
+
const coarse = window.matchMedia(QUERY_COARSE);
|
|
46
|
+
const hover = window.matchMedia(QUERY_HOVER);
|
|
47
|
+
coarse.addEventListener?.("change", update);
|
|
48
|
+
hover.addEventListener?.("change", update);
|
|
49
|
+
|
|
50
|
+
return () => {
|
|
51
|
+
coarse.removeEventListener?.("change", update);
|
|
52
|
+
hover.removeEventListener?.("change", update);
|
|
53
|
+
};
|
|
54
|
+
}, []);
|
|
55
|
+
|
|
56
|
+
return state;
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
export default usePointerType;
|
package/src/index.ts
CHANGED
|
@@ -13,20 +13,52 @@ export {
|
|
|
13
13
|
export type { RequestImpl, RequestConfig, ResType, ListRes, FileRes } from "./request";
|
|
14
14
|
|
|
15
15
|
// hooks & utils
|
|
16
|
-
export {
|
|
16
|
+
export {
|
|
17
|
+
usePermissions,
|
|
18
|
+
PermissionsContent,
|
|
19
|
+
useLabelWidth,
|
|
20
|
+
useIsDark,
|
|
21
|
+
useBreakpoint,
|
|
22
|
+
usePointerType,
|
|
23
|
+
} from "./hooks";
|
|
24
|
+
export type { BreakpointName, BreakpointState, PointerType } from "./hooks";
|
|
17
25
|
export { getUUID, supportsHasSelector, isLegacyHasSelectorBrowser } from "./utils";
|
|
18
26
|
|
|
19
|
-
// Design tokens
|
|
20
|
-
|
|
27
|
+
// Design tokens. src/styles/tokens.json is the single source of truth: this module is its JS side
|
|
28
|
+
// (including toAntdTheme, which ConfigProvider feeds to antd), and es/styles/tokens.scss is the
|
|
29
|
+
// generated --vita-* CSS-variable side.
|
|
30
|
+
export {
|
|
31
|
+
lightTokens,
|
|
32
|
+
darkTokens,
|
|
33
|
+
defaultPrimaryColor,
|
|
34
|
+
radius,
|
|
35
|
+
fontTokens,
|
|
36
|
+
controlTokens,
|
|
37
|
+
modalWidth,
|
|
38
|
+
breakpoints,
|
|
39
|
+
toAntdTheme,
|
|
40
|
+
} from "./styles/tokens";
|
|
21
41
|
export type { HsuThemeTokens } from "./styles/tokens";
|
|
22
42
|
|
|
43
|
+
// 主题化的命令式反馈 API。与 antd 的 message / notification 同名同签名,区别是输出落在
|
|
44
|
+
// ConfigProvider 内,会跟随注入的主题;把 `from "antd"` 换成 `from "@hsu-react/ui"` 即可。
|
|
45
|
+
export { message, notification } from "./feedback";
|
|
46
|
+
|
|
47
|
+
// 布局组件**刻意不从这里导出**。
|
|
48
|
+
//
|
|
49
|
+
// 它们依赖 react-router / react-intl,而这两个是可选 peerDependency。一旦在根入口静态
|
|
50
|
+
// re-export,`import { Button } from "@hsu-react/ui"` 也会让打包器去解析 react-router ——
|
|
51
|
+
// 没装的项目直接构建失败,"可选" 就名存实亡了。
|
|
52
|
+
//
|
|
53
|
+
// 改为子路径引入:
|
|
54
|
+
// import Layout from "@hsu-react/ui/es/layout";
|
|
55
|
+
// import type { RouteType } from "@hsu-react/ui/es/layout";
|
|
56
|
+
|
|
23
57
|
// Components
|
|
24
58
|
export { default as Button } from "./components/Button";
|
|
25
59
|
export * from "./components/Button";
|
|
26
60
|
export { default as ChainGraph } from "./components/ChainGraph";
|
|
27
61
|
export * from "./components/ChainGraph";
|
|
28
|
-
export { default as ChakraRoot } from "./components/ChakraRoot";
|
|
29
|
-
export * from "./components/ChakraRoot";
|
|
30
62
|
export { default as Chart } from "./components/Chart";
|
|
31
63
|
export * from "./components/Chart";
|
|
32
64
|
export { default as Chat } from "./components/Chat";
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React, { ReactNode } from "react";
|
|
2
|
+
import { Space } from "antd";
|
|
3
|
+
import Icon from "../../../../components/Icon";
|
|
4
|
+
|
|
5
|
+
interface BreadcrumbItemIconProps {
|
|
6
|
+
icon?: ReactNode;
|
|
7
|
+
title?: ReactNode;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* Breadcrumb item icon and title component
|
|
12
|
+
*/
|
|
13
|
+
const BreadcrumbItemIcon: React.FC<BreadcrumbItemIconProps> = ({
|
|
14
|
+
icon,
|
|
15
|
+
title,
|
|
16
|
+
}) => {
|
|
17
|
+
return (
|
|
18
|
+
<Space size={5}>
|
|
19
|
+
{typeof icon === "string" ? <Icon icon={icon} /> : icon}
|
|
20
|
+
{title}
|
|
21
|
+
</Space>
|
|
22
|
+
);
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default BreadcrumbItemIcon;
|
|
26
|
+
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { Space } from "antd";
|
|
3
|
+
import Icon from "../../../../components/Icon";
|
|
4
|
+
import { BreadcrumbType } from "../..";
|
|
5
|
+
|
|
6
|
+
interface BreadcrumbMenuItemProps {
|
|
7
|
+
item: BreadcrumbType;
|
|
8
|
+
navigate: (path: string) => void;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* Breadcrumb menu item component
|
|
13
|
+
*/
|
|
14
|
+
const BreadcrumbMenuItem: React.FC<BreadcrumbMenuItemProps> = ({
|
|
15
|
+
item,
|
|
16
|
+
navigate,
|
|
17
|
+
}) => {
|
|
18
|
+
const handleClick = () => {
|
|
19
|
+
if ((!item.children || item.route?.index) && item.path) {
|
|
20
|
+
navigate(item.path);
|
|
21
|
+
}
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
return (
|
|
25
|
+
<Space size={5} onClick={handleClick}>
|
|
26
|
+
{typeof item.icon === "string" ? <Icon icon={item.icon} /> : item.icon}
|
|
27
|
+
{item.title}
|
|
28
|
+
</Space>
|
|
29
|
+
);
|
|
30
|
+
};
|
|
31
|
+
|
|
32
|
+
export default BreadcrumbMenuItem;
|
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import { useEffect, useState, useContext, useMemo } from "react";
|
|
2
|
+
import { useLocation } from "react-router";
|
|
3
|
+
import { BreadcrumbType } from "..";
|
|
4
|
+
import { checkBreadcrumbPathMatch } from "../_utils/pathMatch";
|
|
5
|
+
import { NavTabBarTitleContent } from "../../_hooks/useSetTabTitle";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Hook that handles breadcrumb path matching
|
|
9
|
+
*/
|
|
10
|
+
export const useBreadcrumbPath = (_routes: BreadcrumbType[]) => {
|
|
11
|
+
const location = useLocation();
|
|
12
|
+
const { tabTitles } = useContext(NavTabBarTitleContent);
|
|
13
|
+
const [breadcrumb, setBreadcrumb] = useState<BreadcrumbType[]>([]);
|
|
14
|
+
|
|
15
|
+
const pathname = useMemo(
|
|
16
|
+
() => decodeURI(location.pathname),
|
|
17
|
+
[location.pathname]
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
useEffect(() => {
|
|
21
|
+
const _setBreadcrumb = (
|
|
22
|
+
routes: BreadcrumbType[],
|
|
23
|
+
parents?: BreadcrumbType[]
|
|
24
|
+
) => {
|
|
25
|
+
const checkPath = (item: BreadcrumbType) => {
|
|
26
|
+
if (item.path) {
|
|
27
|
+
const isMatch = checkBreadcrumbPathMatch(
|
|
28
|
+
pathname,
|
|
29
|
+
item.path,
|
|
30
|
+
item.parent?.path
|
|
31
|
+
);
|
|
32
|
+
|
|
33
|
+
if (isMatch) {
|
|
34
|
+
// If tabTitles has a title for the current path, apply the custom title
|
|
35
|
+
const finalItem =
|
|
36
|
+
tabTitles && tabTitles[pathname] !== undefined
|
|
37
|
+
? { ...item, title: tabTitles[pathname] }
|
|
38
|
+
: item;
|
|
39
|
+
|
|
40
|
+
if (parents) {
|
|
41
|
+
return [...parents, finalItem];
|
|
42
|
+
} else {
|
|
43
|
+
return [finalItem];
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
return [];
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
routes?.forEach((item) => {
|
|
52
|
+
if (item.children) {
|
|
53
|
+
if (item.route?.index) {
|
|
54
|
+
const _breadcrumb = checkPath(item);
|
|
55
|
+
if (_breadcrumb.length > 0) {
|
|
56
|
+
setBreadcrumb(_breadcrumb);
|
|
57
|
+
} else {
|
|
58
|
+
const _newParents = parents ? [...parents, item] : [item];
|
|
59
|
+
_setBreadcrumb(item.children, _newParents);
|
|
60
|
+
}
|
|
61
|
+
} else {
|
|
62
|
+
const _newParents = parents ? [...parents, item] : [item];
|
|
63
|
+
_setBreadcrumb(item.children, _newParents);
|
|
64
|
+
}
|
|
65
|
+
} else {
|
|
66
|
+
const _breadcrumb = checkPath(item);
|
|
67
|
+
if (_breadcrumb.length > 0) {
|
|
68
|
+
setBreadcrumb(_breadcrumb);
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
setBreadcrumb([]);
|
|
75
|
+
_setBreadcrumb(_routes);
|
|
76
|
+
}, [_routes, pathname, tabTitles]);
|
|
77
|
+
|
|
78
|
+
// When tabTitles changes, update the title of the last breadcrumb item
|
|
79
|
+
useEffect(() => {
|
|
80
|
+
if (!pathname) return;
|
|
81
|
+
|
|
82
|
+
setBreadcrumb((prev) => {
|
|
83
|
+
if (prev.length === 0) return prev;
|
|
84
|
+
|
|
85
|
+
const newBreadcrumb = [...prev];
|
|
86
|
+
const lastItem = newBreadcrumb[newBreadcrumb.length - 1];
|
|
87
|
+
|
|
88
|
+
// Check whether the current path matches the last breadcrumb item
|
|
89
|
+
const isPathMatch =
|
|
90
|
+
lastItem.path === pathname ||
|
|
91
|
+
(lastItem.path &&
|
|
92
|
+
checkBreadcrumbPathMatch(
|
|
93
|
+
pathname,
|
|
94
|
+
lastItem.path,
|
|
95
|
+
lastItem.parent?.path
|
|
96
|
+
));
|
|
97
|
+
|
|
98
|
+
if (isPathMatch && tabTitles && tabTitles[pathname] !== undefined) {
|
|
99
|
+
// If tabTitles has a title for the current path, update it
|
|
100
|
+
newBreadcrumb[newBreadcrumb.length - 1] = {
|
|
101
|
+
...lastItem,
|
|
102
|
+
title: tabTitles[pathname],
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
return newBreadcrumb;
|
|
107
|
+
});
|
|
108
|
+
}, [tabTitles, pathname]);
|
|
109
|
+
|
|
110
|
+
return breadcrumb;
|
|
111
|
+
};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import { BreadcrumbType } from "..";
|
|
3
|
+
import { ItemType as MenuItemType } from "antd/es/menu/interface";
|
|
4
|
+
import BreadcrumbMenuItem from "../_components/BreadcrumbMenuItem";
|
|
5
|
+
import { cloneDeep } from "lodash";
|
|
6
|
+
|
|
7
|
+
/**
|
|
8
|
+
* Format the breadcrumb submenu
|
|
9
|
+
* @param children Child breadcrumb items
|
|
10
|
+
* @param navigate Navigation function
|
|
11
|
+
* @returns Array of menu items
|
|
12
|
+
*/
|
|
13
|
+
export const formatBreadcrumbMenu = (
|
|
14
|
+
children: BreadcrumbType[],
|
|
15
|
+
navigate: (path: string) => void
|
|
16
|
+
): Omit<MenuItemType, "null">[] => {
|
|
17
|
+
return children?.map((item) => {
|
|
18
|
+
const children = item.children?.filter((i) => !i.path?.includes(":"));
|
|
19
|
+
const childrenBreadcrumb = formatBreadcrumbMenu(
|
|
20
|
+
cloneDeep(children || []),
|
|
21
|
+
navigate
|
|
22
|
+
);
|
|
23
|
+
|
|
24
|
+
return {
|
|
25
|
+
key: decodeURI(item.path ?? ""),
|
|
26
|
+
label: React.createElement(BreadcrumbMenuItem, { item, navigate }),
|
|
27
|
+
children: childrenBreadcrumb.length > 0 ? childrenBreadcrumb : undefined,
|
|
28
|
+
};
|
|
29
|
+
});
|
|
30
|
+
};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import { cloneDeep } from "lodash";
|
|
2
|
+
import { RouteType } from "../../types";
|
|
3
|
+
import { BreadcrumbType } from "..";
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* Format routes into breadcrumb items
|
|
7
|
+
* @param router Route configuration
|
|
8
|
+
* @param parent Parent route
|
|
9
|
+
* @returns Array of breadcrumb items
|
|
10
|
+
*/
|
|
11
|
+
export const formatRoutes = (
|
|
12
|
+
router: RouteType[],
|
|
13
|
+
parent?: RouteType
|
|
14
|
+
): BreadcrumbType[] => {
|
|
15
|
+
const newRoutes: BreadcrumbType[] = [];
|
|
16
|
+
|
|
17
|
+
router?.forEach((route) => {
|
|
18
|
+
let children: BreadcrumbType[] | undefined = undefined;
|
|
19
|
+
if (route.children) {
|
|
20
|
+
children = formatRoutes(route.children, cloneDeep(route) as RouteType);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
const { meta } = route;
|
|
24
|
+
|
|
25
|
+
if (meta?.menu || !meta?.noTabsView) {
|
|
26
|
+
let path = "";
|
|
27
|
+
|
|
28
|
+
if (route.path) {
|
|
29
|
+
path = decodeURI(route.path);
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
if (route.index) {
|
|
33
|
+
newRoutes.push({
|
|
34
|
+
path: parent?.path,
|
|
35
|
+
title: meta?.name,
|
|
36
|
+
children: (children?.length || 0) > 0 ? children : undefined,
|
|
37
|
+
icon: meta?.icon,
|
|
38
|
+
parent: parent,
|
|
39
|
+
route: route,
|
|
40
|
+
index: true,
|
|
41
|
+
});
|
|
42
|
+
} else {
|
|
43
|
+
const indexChild = children?.find((child) => child?.index);
|
|
44
|
+
const newChildren = children?.filter((child) => !child?.index);
|
|
45
|
+
|
|
46
|
+
if (indexChild) {
|
|
47
|
+
newRoutes.push({
|
|
48
|
+
...indexChild,
|
|
49
|
+
index: false,
|
|
50
|
+
parent: parent,
|
|
51
|
+
children: (newChildren?.length || 0) > 0 ? newChildren : undefined,
|
|
52
|
+
});
|
|
53
|
+
} else {
|
|
54
|
+
newRoutes.push({
|
|
55
|
+
path,
|
|
56
|
+
title: meta?.name,
|
|
57
|
+
children: (children?.length || 0) > 0 ? children : undefined,
|
|
58
|
+
icon: meta?.icon,
|
|
59
|
+
parent: parent,
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
} else {
|
|
64
|
+
if (children) {
|
|
65
|
+
newRoutes.push(...children);
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
});
|
|
69
|
+
|
|
70
|
+
return newRoutes;
|
|
71
|
+
};
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { array_is_includes } from "hsu-utils";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Check whether a path matches (used by the breadcrumb)
|
|
5
|
+
* @param pathname Current path
|
|
6
|
+
* @param itemPath Route path
|
|
7
|
+
* @param parentPath Parent path
|
|
8
|
+
* @returns Whether it matches
|
|
9
|
+
*/
|
|
10
|
+
export const checkBreadcrumbPathMatch = (
|
|
11
|
+
pathname: string,
|
|
12
|
+
itemPath: string,
|
|
13
|
+
parentPath?: string
|
|
14
|
+
): boolean => {
|
|
15
|
+
if (!itemPath) {
|
|
16
|
+
return pathname === "/" && itemPath === "/";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const pathArr = pathname.split("/").filter(Boolean);
|
|
20
|
+
const keyArr = itemPath.split("/").filter(Boolean);
|
|
21
|
+
|
|
22
|
+
if (keyArr.length === 0) {
|
|
23
|
+
return false;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
if (pathArr.length !== keyArr.length) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// Handle the root path
|
|
31
|
+
if (pathname === "/" && itemPath === "/") {
|
|
32
|
+
return true;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
// Handle routes containing params (e.g. /user/:id)
|
|
36
|
+
if (itemPath.includes(":")) {
|
|
37
|
+
if (parentPath === "/") {
|
|
38
|
+
// If the parent path is the root path, check that there are no non-param segments
|
|
39
|
+
return !keyArr.filter((i: string) => !i.startsWith(":")).length;
|
|
40
|
+
} else {
|
|
41
|
+
// Filter out param segments and compare only the non-param parts
|
|
42
|
+
return array_is_includes(
|
|
43
|
+
keyArr.filter((i: string) => !i.startsWith(":")),
|
|
44
|
+
pathArr
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
} else {
|
|
48
|
+
// Plain path matching
|
|
49
|
+
return array_is_includes(keyArr, pathArr);
|
|
50
|
+
}
|
|
51
|
+
};
|
|
52
|
+
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Breadcrumb 面包屑
|
|
3
|
+
order: 3
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Breadcrumb 面包屑
|
|
7
|
+
|
|
8
|
+
从路由配置推导当前位置的层级路径,父级带下拉菜单可直接跳转到同级页面。
|
|
9
|
+
|
|
10
|
+
## 引入
|
|
11
|
+
|
|
12
|
+
布局组件走**子路径**引入(原因见 [与路由的关系](/layouts/header#与路由的关系)):
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import Layout from "@hsu-react/ui/es/layout";
|
|
16
|
+
|
|
17
|
+
<Layout.Breadcrumb router={router} />;
|
|
18
|
+
```
|
|
19
|
+
|
|
20
|
+
## 说明
|
|
21
|
+
|
|
22
|
+
`router` 传的就是应用的路由配置(`RouteType[]`)。组件会:
|
|
23
|
+
|
|
24
|
+
- 按当前 `location.pathname` 逐级匹配出路径链
|
|
25
|
+
- 用每级的 `meta.name` 作为文案、`meta.icon` 作为图标
|
|
26
|
+
- 父级若有多个子路由,渲染成下拉菜单,点击直接跳转
|
|
27
|
+
|
|
28
|
+
面包屑比菜单**宽松**:只要 `meta.menu` 为真、**或者** `meta.noTabsView` 不为真,该层就会出现在路径链里。所以「不进菜单但能访问」的详情页照样有面包屑,只有显式标了 `noTabsView` 且没开 `menu` 的路由才会被跳过(它的子级会顶上来)。
|
|
29
|
+
|
|
30
|
+
带路径参数的子路由(`path` 里含 `:`)不会进下拉菜单 —— 没有具体参数值,跳过去也没有意义。
|
|
31
|
+
|
|
32
|
+
## API
|
|
33
|
+
|
|
34
|
+
| 属性 | 说明 | 类型 | 默认值 |
|
|
35
|
+
| --- | --- | --- | --- |
|
|
36
|
+
| router | 路由配置 | `RouteType[]` | - |
|
|
37
|
+
| className | 自定义类名 | `string` | - |
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
.Breadcrumb {
|
|
2
|
+
cursor: default;
|
|
3
|
+
|
|
4
|
+
// On narrow screens, keep long paths on one line so they do not squeeze the top bar; hide the overflow
|
|
5
|
+
overflow: hidden;
|
|
6
|
+
|
|
7
|
+
:global(ol) {
|
|
8
|
+
flex-wrap: nowrap;
|
|
9
|
+
white-space: nowrap;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
* {
|
|
13
|
+
color: inherit !important;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { Breadcrumb as AntBreadcrumb } from "antd";
|
|
2
|
+
import React, { ReactNode, useMemo, useCallback } from "react";
|
|
3
|
+
import { useNavigate } from "react-router";
|
|
4
|
+
|
|
5
|
+
import { ItemType } from "antd/es/breadcrumb/Breadcrumb";
|
|
6
|
+
import { RouteType } from "../types";
|
|
7
|
+
import styles from "./index.module.scss";
|
|
8
|
+
import { cloneDeep } from "lodash";
|
|
9
|
+
import classNames from "classnames";
|
|
10
|
+
import { formatRoutes } from "./_utils/formatRoutes";
|
|
11
|
+
import { formatBreadcrumbMenu } from "./_utils/formatMenu";
|
|
12
|
+
import { useBreadcrumbPath } from "./_hooks/useBreadcrumbPath";
|
|
13
|
+
import BreadcrumbItemIcon from "./_components/BreadcrumbItemIcon";
|
|
14
|
+
|
|
15
|
+
// Omit 掉 children:antd v6 把 BreadcrumbItemType.children 收窄成了
|
|
16
|
+
// `Omit<BreadcrumbItemType, "children">[]`,而这里的 children 要能递归携带 parent / route
|
|
17
|
+
// 这些自有字段,直接 extends 会判为不兼容。渲染时再转回 antd 认识的形状。
|
|
18
|
+
export interface BreadcrumbType extends Omit<ItemType, "children"> {
|
|
19
|
+
children?: BreadcrumbType[];
|
|
20
|
+
icon?: ReactNode;
|
|
21
|
+
parent?: RouteType;
|
|
22
|
+
route?: RouteType;
|
|
23
|
+
index?: boolean;
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
interface BreadcrumbProps {
|
|
27
|
+
router: RouteType[];
|
|
28
|
+
className?: string;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* Breadcrumb component
|
|
33
|
+
*/
|
|
34
|
+
const Breadcrumb: React.FC<BreadcrumbProps> = (props) => {
|
|
35
|
+
const { router, className } = props;
|
|
36
|
+
const navigate = useNavigate();
|
|
37
|
+
|
|
38
|
+
const _routes = useMemo(() => {
|
|
39
|
+
return formatRoutes(router);
|
|
40
|
+
}, [router]);
|
|
41
|
+
|
|
42
|
+
const breadcrumb = useBreadcrumbPath(_routes);
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Handle the breadcrumb item click event
|
|
46
|
+
*/
|
|
47
|
+
const handleItemClick = useCallback(
|
|
48
|
+
(path: string) => {
|
|
49
|
+
navigate(path);
|
|
50
|
+
},
|
|
51
|
+
[navigate]
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* Format breadcrumb items
|
|
56
|
+
*/
|
|
57
|
+
const formattedItems = useMemo(() => {
|
|
58
|
+
return cloneDeep(breadcrumb)?.map((item, index) => {
|
|
59
|
+
const isLastItem = index === breadcrumb.length - 1;
|
|
60
|
+
const children = item.children?.filter((i) => !i.path?.includes(":"));
|
|
61
|
+
const hasChildren = children && children.length > 0;
|
|
62
|
+
|
|
63
|
+
// If there are child menus, set the menu items
|
|
64
|
+
if (hasChildren) {
|
|
65
|
+
item.onClick = (e) => e.preventDefault();
|
|
66
|
+
item.menu = {
|
|
67
|
+
items: formatBreadcrumbMenu(cloneDeep(children), navigate),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
// The last item does not show a path
|
|
72
|
+
if (isLastItem) {
|
|
73
|
+
item.path = undefined;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// If there is an icon, wrap the title
|
|
77
|
+
if (item.icon) {
|
|
78
|
+
item.title = <BreadcrumbItemIcon icon={item.icon} title={item.title} />;
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// If there is a path and no child menu, set the click handler
|
|
82
|
+
if (item.path && !hasChildren) {
|
|
83
|
+
item.onClick = (e) => {
|
|
84
|
+
e.preventDefault();
|
|
85
|
+
handleItemClick(item.path as string);
|
|
86
|
+
};
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
return { ...item };
|
|
90
|
+
});
|
|
91
|
+
}, [breadcrumb, navigate, handleItemClick]);
|
|
92
|
+
|
|
93
|
+
return (
|
|
94
|
+
<AntBreadcrumb
|
|
95
|
+
className={classNames(styles.Breadcrumb, className)}
|
|
96
|
+
// BreadcrumbType 比 antd 的 ItemType 多带了 parent / route / children 这些自有字段,
|
|
97
|
+
// 供上面的格式化与点击逻辑使用;渲染时 antd 只读它认识的那几个,多出来的会被忽略。
|
|
98
|
+
items={formattedItems as ItemType[]}
|
|
99
|
+
/>
|
|
100
|
+
);
|
|
101
|
+
};
|
|
102
|
+
|
|
103
|
+
export default Breadcrumb;
|