@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
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Tooltip, TooltipProps } from "antd";
|
|
2
2
|
import { ReactNode, useEffect, useRef, useState } from "react";
|
|
3
3
|
import cssStyles from "./index.module.scss";
|
|
4
|
+
import { mergeSemantic } from "../../utils/semantic";
|
|
4
5
|
|
|
5
6
|
// Default Tooltip width
|
|
6
7
|
const DEFAULT_TOOLTIP_WIDTH = 200;
|
|
@@ -201,15 +202,16 @@ const TextEllipsis: React.FC<TextEllipsisProps> = ({
|
|
|
201
202
|
placement="bottomLeft"
|
|
202
203
|
{...restTooltipConfig}
|
|
203
204
|
title={isOverflow && !disabled ? tooltipTitle : undefined}
|
|
204
|
-
styles={{
|
|
205
|
-
body
|
|
205
|
+
styles={mergeSemantic(styles, (outer) => ({
|
|
206
|
+
// v5 called this slot `body`; v6 renamed it to `container`
|
|
207
|
+
container: {
|
|
206
208
|
width: tooltipWidth,
|
|
207
209
|
overflow: "auto",
|
|
208
210
|
maxHeight: "300px",
|
|
209
211
|
whiteSpace: "pre-wrap",
|
|
210
212
|
},
|
|
211
|
-
...
|
|
212
|
-
}}
|
|
213
|
+
...outer,
|
|
214
|
+
}))}
|
|
213
215
|
>
|
|
214
216
|
{content}
|
|
215
217
|
</Tooltip>
|
|
@@ -55,6 +55,15 @@ export default () => (
|
|
|
55
55
|
);
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
+
## 子组件
|
|
59
|
+
|
|
60
|
+
```tsx | pure
|
|
61
|
+
Tree.DirectoryTree // antd 的目录树(文件夹图标 + 目录态选中)
|
|
62
|
+
Tree.TreeNode // antd 的 JSX 节点声明
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
`TreeNode` 供 JSX 写法,本库更推荐用 `treeData`。
|
|
66
|
+
|
|
58
67
|
## API
|
|
59
68
|
|
|
60
69
|
在 [antd TreeProps](https://ant.design/components/tree-cn)(已 `Omit` 掉 `treeData`、`loadData`、`loadedKeys`、`titleRender`)基础上扩展:
|
|
@@ -11,9 +11,9 @@
|
|
|
11
11
|
height: 100%;
|
|
12
12
|
min-height: 0px !important;
|
|
13
13
|
|
|
14
|
-
background: var(--
|
|
14
|
+
background: var(--vita-surface);
|
|
15
15
|
|
|
16
|
-
border-radius:
|
|
16
|
+
border-radius: var(--vita-radius);
|
|
17
17
|
|
|
18
18
|
.title_search {
|
|
19
19
|
display: flex;
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
.search {
|
|
38
|
-
height:
|
|
38
|
+
height: var(--vita-control-height);
|
|
39
39
|
|
|
40
40
|
.searchIcon {
|
|
41
41
|
font-size: 16px;
|
|
@@ -58,11 +58,11 @@
|
|
|
58
58
|
|
|
59
59
|
:global(.ant-tree-treenode) {
|
|
60
60
|
&:hover {
|
|
61
|
-
background: var(--
|
|
61
|
+
background: var(--vita-muted);
|
|
62
62
|
}
|
|
63
63
|
|
|
64
64
|
&:has(> :global(.ant-tree-node-selected)) {
|
|
65
|
-
background-color: color-mix(in srgb, var(--primary
|
|
65
|
+
background-color: color-mix(in srgb, var(--vita-primary) 12%, transparent);
|
|
66
66
|
|
|
67
67
|
:global(.ant-tree-node-selected) {
|
|
68
68
|
background-color: transparent;
|
|
@@ -131,7 +131,7 @@
|
|
|
131
131
|
&.legacyHasSelectedNodeBackground {
|
|
132
132
|
.treeContainer {
|
|
133
133
|
:global(.ant-tree-treenode):global(.ant-tree-treenode-selected) {
|
|
134
|
-
background-color: color-mix(in srgb, var(--primary
|
|
134
|
+
background-color: color-mix(in srgb, var(--vita-primary) 12%, transparent);
|
|
135
135
|
|
|
136
136
|
:global(.ant-tree-node-selected) {
|
|
137
137
|
background-color: transparent;
|
|
@@ -72,7 +72,14 @@ export interface TreeProps extends Omit<
|
|
|
72
72
|
titleSearchBarClassName?: string;
|
|
73
73
|
}
|
|
74
74
|
|
|
75
|
-
|
|
75
|
+
interface TreeFC extends React.FC<TreeProps> {
|
|
76
|
+
/** antd 的目录树(带文件夹图标与目录态选中) */
|
|
77
|
+
DirectoryTree: typeof AntdTree.DirectoryTree;
|
|
78
|
+
/** antd 的 `Tree.TreeNode`,供 JSX 写法(本库更推荐用 `treeData`) */
|
|
79
|
+
TreeNode: typeof AntdTree.TreeNode;
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
const Tree = ((props: TreeProps) => {
|
|
76
83
|
const {
|
|
77
84
|
title,
|
|
78
85
|
titleRender,
|
|
@@ -304,6 +311,9 @@ const Tree: React.FC<TreeProps> = (props) => {
|
|
|
304
311
|
</div>
|
|
305
312
|
</div>
|
|
306
313
|
);
|
|
307
|
-
};
|
|
314
|
+
}) as TreeFC;
|
|
315
|
+
|
|
316
|
+
Tree.DirectoryTree = AntdTree.DirectoryTree;
|
|
317
|
+
Tree.TreeNode = AntdTree.TreeNode;
|
|
308
318
|
|
|
309
319
|
export default Tree;
|
|
@@ -94,9 +94,9 @@ export const UploadedItem: React.FC<UploadedItemProps> = ({
|
|
|
94
94
|
<div className={classNames(styles.fileItem, listProps?.item)}>
|
|
95
95
|
<Tooltip
|
|
96
96
|
title={name}
|
|
97
|
-
color="var(--
|
|
97
|
+
color="var(--vita-muted)"
|
|
98
98
|
styles={{
|
|
99
|
-
|
|
99
|
+
container: { color: "var(--vita-foreground)", padding: "6px 16px" },
|
|
100
100
|
}}
|
|
101
101
|
>
|
|
102
102
|
<div className={classNames(styles.fileName, listProps?.itemName)}>
|
|
@@ -32,9 +32,9 @@ export const UploadingItem: React.FC<UploadingItemProps> = ({
|
|
|
32
32
|
<div className={styles.uploading}>
|
|
33
33
|
<Tooltip
|
|
34
34
|
title={name}
|
|
35
|
-
color="var(--
|
|
35
|
+
color="var(--vita-muted)"
|
|
36
36
|
styles={{
|
|
37
|
-
|
|
37
|
+
container: { color: "var(--vita-foreground)", padding: "6px 16px" },
|
|
38
38
|
}}
|
|
39
39
|
>
|
|
40
40
|
<div
|
|
@@ -3,7 +3,7 @@ import { RcFile } from "antd/es/upload";
|
|
|
3
3
|
import { deepCopy } from "hsu-utils";
|
|
4
4
|
import { validateFile, createFormData, isSuccessResponse } from ".";
|
|
5
5
|
import { UploadingList } from "..";
|
|
6
|
-
import type { UploadRequestOption } from "
|
|
6
|
+
import type { UploadRequestOption } from "../../../types/antd";
|
|
7
7
|
|
|
8
8
|
interface NormalUploadOptions {
|
|
9
9
|
file: RcFile;
|
|
@@ -8,6 +8,60 @@ interface ValidateFileOptions {
|
|
|
8
8
|
en?: boolean;
|
|
9
9
|
}
|
|
10
10
|
|
|
11
|
+
/**
|
|
12
|
+
* 文件是否命中 accept —— 与 antd 保持一致的语义。
|
|
13
|
+
*
|
|
14
|
+
* 此前是把 accept 拼进正则:`new RegExp(`(${accept.replace(/,/g, "|")})$`)`,有两个问题:
|
|
15
|
+
* 字符没转义(`.png` 里的 `.` 是「任意字符」,实测放行了 `axpng`),且 HTML 允许的 MIME
|
|
16
|
+
* 形式里 `image/*` 的 `*` 会被当成量词(实测把 photo.png 判成了格式错误)。把外部字符串
|
|
17
|
+
* 拼进正则本身也是 ReDoS 入口。
|
|
18
|
+
*
|
|
19
|
+
* 这里照抄 @rc-component/upload 的 attr-accept 语义,而不是另写一套:这个函数是上传前的
|
|
20
|
+
* 预校验,antd 自己的 accept 过滤也在跑,两边规则一旦不一致,就会出现「antd 放行、我们拦下」
|
|
21
|
+
* 或反过来的割裂。逐条 some(),任一命中即通过,全不命中即拒绝 —— 不做额外兜底。
|
|
22
|
+
*/
|
|
23
|
+
const matchesAccept = (
|
|
24
|
+
file: { name: string; type?: string },
|
|
25
|
+
accept: string
|
|
26
|
+
): boolean => {
|
|
27
|
+
const items = accept.split(",");
|
|
28
|
+
const fileName = file.name || "";
|
|
29
|
+
const mimeType = file.type || "";
|
|
30
|
+
const baseMimeType = mimeType.replace(/\/.*$/, "");
|
|
31
|
+
|
|
32
|
+
return items.some((item) => {
|
|
33
|
+
const validType = item.trim();
|
|
34
|
+
if (!validType) return false;
|
|
35
|
+
|
|
36
|
+
// `*` / `*/*`:全部放行
|
|
37
|
+
if (/^\*(\/\*)?$/.test(validType)) return true;
|
|
38
|
+
|
|
39
|
+
// 扩展名。jpg 与 jpeg 互认,与 attr-accept 一致
|
|
40
|
+
if (validType.charAt(0) === ".") {
|
|
41
|
+
const lowerName = fileName.toLowerCase();
|
|
42
|
+
const lowerType = validType.toLowerCase();
|
|
43
|
+
const affixes =
|
|
44
|
+
lowerType === ".jpg" || lowerType === ".jpeg"
|
|
45
|
+
? [".jpg", ".jpeg"]
|
|
46
|
+
: [lowerType];
|
|
47
|
+
return affixes.some((affix) => lowerName.endsWith(affix));
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
// `image/*` 这类通配
|
|
51
|
+
if (/\/\*$/.test(validType)) {
|
|
52
|
+
return baseMimeType === validType.replace(/\/.*$/, "");
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// MIME 全等
|
|
56
|
+
if (mimeType === validType) return true;
|
|
57
|
+
|
|
58
|
+
// `png` 这种没有点也没有斜杠的写法是无效 accept,attr-accept 选择跳过而不是拦下
|
|
59
|
+
if (/^\w+$/.test(validType)) return true;
|
|
60
|
+
|
|
61
|
+
return false;
|
|
62
|
+
});
|
|
63
|
+
};
|
|
64
|
+
|
|
11
65
|
/**
|
|
12
66
|
* Validate file format and size
|
|
13
67
|
*/
|
|
@@ -18,8 +72,7 @@ export function validateFile({
|
|
|
18
72
|
en,
|
|
19
73
|
}: ValidateFileOptions): { valid: boolean; error?: Error } {
|
|
20
74
|
if (accept) {
|
|
21
|
-
|
|
22
|
-
if (!fileRegex.test(file.name.toLowerCase())) {
|
|
75
|
+
if (!matchesAccept(file, accept)) {
|
|
23
76
|
return {
|
|
24
77
|
valid: false,
|
|
25
78
|
error: new Error(
|
|
@@ -64,6 +64,15 @@ export default () => {
|
|
|
64
64
|
};
|
|
65
65
|
```
|
|
66
66
|
|
|
67
|
+
## 子组件
|
|
68
|
+
|
|
69
|
+
```tsx | pure
|
|
70
|
+
Upload.Dragger // antd 的拖拽上传区
|
|
71
|
+
Upload.LIST_IGNORE // beforeUpload 返回它表示「跳过该文件且不进 fileList」
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
本库的 `Upload` 传 `drop` 属性即可切成拖拽形态;`Upload.Dragger` 是 antd 原生的那个,两者不要混用。
|
|
75
|
+
|
|
67
76
|
## API
|
|
68
77
|
|
|
69
78
|
继承 antd [UploadProps](https://ant.design/components/upload-cn)(移除原 `action`、`data` 后重新定义),新增/重写属性如下:
|
|
@@ -3,7 +3,7 @@ import {
|
|
|
3
3
|
UploadProps as AntdUploadProps,
|
|
4
4
|
UploadFile,
|
|
5
5
|
} from "antd";
|
|
6
|
-
import type { UploadRequestOption } from "
|
|
6
|
+
import type { UploadRequestOption } from "../../types/antd";
|
|
7
7
|
import React, { useCallback } from "react";
|
|
8
8
|
import { Canceler } from "axios";
|
|
9
9
|
import { RcFile } from "antd/es/upload";
|
|
@@ -58,7 +58,14 @@ export interface UploadProps extends Omit<AntdUploadProps, "action" | "data"> {
|
|
|
58
58
|
en?: boolean;
|
|
59
59
|
}
|
|
60
60
|
|
|
61
|
-
|
|
61
|
+
interface UploadFC extends React.FC<UploadProps> {
|
|
62
|
+
/** antd 的拖拽上传区 */
|
|
63
|
+
Dragger: typeof AntdUpload.Dragger;
|
|
64
|
+
/** `beforeUpload` 返回它表示「跳过这个文件且不进 fileList」 */
|
|
65
|
+
LIST_IGNORE: typeof AntdUpload.LIST_IGNORE;
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
const Upload = ((props: UploadProps) => {
|
|
62
69
|
const {
|
|
63
70
|
disabled = false,
|
|
64
71
|
drop,
|
|
@@ -86,6 +93,11 @@ const Upload: React.FC<UploadProps> = (props) => {
|
|
|
86
93
|
...uploadConfig
|
|
87
94
|
} = props;
|
|
88
95
|
|
|
96
|
+
// antd v6 widened `accept` to `string | { format: string; filter?: ... }`. This component's own
|
|
97
|
+
// extension check (validateFile) only understands the comma-separated string, so read the format
|
|
98
|
+
// out of the object form; antd still applies the full config to the native file input.
|
|
99
|
+
const acceptFormat = typeof accept === "string" ? accept : accept.format;
|
|
100
|
+
|
|
89
101
|
const {
|
|
90
102
|
fileList: _fileList,
|
|
91
103
|
setFileList,
|
|
@@ -131,7 +143,7 @@ const Upload: React.FC<UploadProps> = (props) => {
|
|
|
131
143
|
chunkNum,
|
|
132
144
|
data,
|
|
133
145
|
headers,
|
|
134
|
-
accept,
|
|
146
|
+
accept: acceptFormat,
|
|
135
147
|
size,
|
|
136
148
|
en,
|
|
137
149
|
uploadingList,
|
|
@@ -148,7 +160,7 @@ const Upload: React.FC<UploadProps> = (props) => {
|
|
|
148
160
|
chunkNum,
|
|
149
161
|
data,
|
|
150
162
|
headers,
|
|
151
|
-
|
|
163
|
+
acceptFormat,
|
|
152
164
|
size,
|
|
153
165
|
en,
|
|
154
166
|
uploadingList,
|
|
@@ -180,7 +192,7 @@ const Upload: React.FC<UploadProps> = (props) => {
|
|
|
180
192
|
action,
|
|
181
193
|
data,
|
|
182
194
|
headers,
|
|
183
|
-
accept,
|
|
195
|
+
accept: acceptFormat,
|
|
184
196
|
size,
|
|
185
197
|
en,
|
|
186
198
|
uploadingList,
|
|
@@ -195,7 +207,7 @@ const Upload: React.FC<UploadProps> = (props) => {
|
|
|
195
207
|
action,
|
|
196
208
|
data,
|
|
197
209
|
headers,
|
|
198
|
-
|
|
210
|
+
acceptFormat,
|
|
199
211
|
size,
|
|
200
212
|
en,
|
|
201
213
|
uploadingList,
|
|
@@ -301,6 +313,9 @@ const Upload: React.FC<UploadProps> = (props) => {
|
|
|
301
313
|
/>
|
|
302
314
|
</>
|
|
303
315
|
);
|
|
304
|
-
};
|
|
316
|
+
}) as UploadFC;
|
|
317
|
+
|
|
318
|
+
Upload.Dragger = AntdUpload.Dragger;
|
|
319
|
+
Upload.LIST_IGNORE = AntdUpload.LIST_IGNORE;
|
|
305
320
|
|
|
306
321
|
export default Upload;
|
|
@@ -1,27 +1,70 @@
|
|
|
1
|
-
import React, { useMemo } from "react";
|
|
1
|
+
import React, { useEffect, useMemo } from "react";
|
|
2
|
+
import {
|
|
3
|
+
ConfigProvider as AntdConfigProvider,
|
|
4
|
+
theme as antdTheme,
|
|
5
|
+
type ThemeConfig,
|
|
6
|
+
} from "antd";
|
|
2
7
|
|
|
3
8
|
import { PermissionsContent } from "../hooks/usePermissions";
|
|
9
|
+
import useIsDark from "../hooks/useIsDark";
|
|
4
10
|
import { configureRequest, RequestImpl } from "../request";
|
|
11
|
+
import { toAntdComponents, toAntdTheme } from "../styles/tokens";
|
|
12
|
+
import { FeedbackHolder } from "../feedback";
|
|
5
13
|
|
|
6
14
|
export interface ConfigProviderProps {
|
|
7
15
|
/** Current user's permission code list; when provided, usePermissions / hasPermi validate against it. If omitted, everything is allowed by default */
|
|
8
16
|
permissions?: string[] | null;
|
|
9
17
|
/** Inject the HTTP request implementation, used by smart components such as ImportForm */
|
|
10
18
|
request?: Partial<RequestImpl>;
|
|
19
|
+
/**
|
|
20
|
+
* Brand colour. Sets both halves of the token layer at once: the `--vita-primary` CSS variable
|
|
21
|
+
* (via `--primary-color`, so pre-2.0 overrides keep working) and antd's `colorPrimary`.
|
|
22
|
+
*
|
|
23
|
+
* Setting the CSS variable by hand only moves this library's own styles — antd derives a
|
|
24
|
+
* 10-step palette from the JS token and cannot read a `var()`. Going through this prop is what
|
|
25
|
+
* keeps the two in step.
|
|
26
|
+
*/
|
|
27
|
+
primaryColor?: string;
|
|
28
|
+
/**
|
|
29
|
+
* Force light/dark instead of following `html[data-theme]` / the OS preference.
|
|
30
|
+
* The CSS variables follow the same signals on their own.
|
|
31
|
+
*/
|
|
32
|
+
dark?: boolean;
|
|
33
|
+
/**
|
|
34
|
+
* Extra antd theme config, merged on top of the generated one — escape hatch for a consumer
|
|
35
|
+
* that wants a token this library does not map.
|
|
36
|
+
*/
|
|
37
|
+
theme?: ThemeConfig;
|
|
38
|
+
/**
|
|
39
|
+
* Set to `false` to stop managing antd's theme entirely, leaving it to the host app.
|
|
40
|
+
* Components this library wraps still follow the `--vita-*` variables; antd components it does
|
|
41
|
+
* not wrap will fall back to antd's stock look.
|
|
42
|
+
*/
|
|
43
|
+
antdTheme?: boolean;
|
|
11
44
|
children?: React.ReactNode;
|
|
12
45
|
}
|
|
13
46
|
|
|
14
47
|
/**
|
|
15
|
-
* Hsu UI global configuration:
|
|
48
|
+
* Hsu UI global configuration: permissions, the request implementation, and the design tokens.
|
|
49
|
+
*
|
|
50
|
+
* On the theme: the `--vita-*` CSS variables cover everything this library styles itself, but not
|
|
51
|
+
* the antd components it merely re-exports or that a page uses directly. Feeding antd's
|
|
52
|
+
* `theme.token` from the very same tokens is what makes an unwrapped `<Steps />` land on the same
|
|
53
|
+
* palette, radii and type scale as a wrapped `<Table />` — without this library having to wrap all
|
|
54
|
+
* 75 antd components to keep the look consistent.
|
|
16
55
|
*
|
|
17
56
|
* @example
|
|
18
|
-
* <ConfigProvider permissions={perms} request={{ get, post, del, put }}>
|
|
57
|
+
* <ConfigProvider permissions={perms} request={{ get, post, del, put }} primaryColor="#7c3aed">
|
|
19
58
|
* <App />
|
|
20
59
|
* </ConfigProvider>
|
|
21
60
|
*/
|
|
22
61
|
const ConfigProvider: React.FC<ConfigProviderProps> = ({
|
|
23
62
|
permissions = null,
|
|
24
63
|
request,
|
|
64
|
+
primaryColor,
|
|
65
|
+
dark,
|
|
66
|
+
theme,
|
|
67
|
+
antdTheme: manageAntdTheme = true,
|
|
25
68
|
children,
|
|
26
69
|
}) => {
|
|
27
70
|
// Inject synchronously during render so child components get the request implementation on their very first interaction
|
|
@@ -31,11 +74,48 @@ const ConfigProvider: React.FC<ConfigProviderProps> = ({
|
|
|
31
74
|
|
|
32
75
|
const permissionsValue = useMemo(() => ({ permissions }), [permissions]);
|
|
33
76
|
|
|
34
|
-
|
|
77
|
+
const detectedDark = useIsDark();
|
|
78
|
+
const isDark = dark ?? detectedDark;
|
|
79
|
+
|
|
80
|
+
const themeConfig = useMemo<ThemeConfig>(
|
|
81
|
+
() => ({
|
|
82
|
+
algorithm: isDark ? antdTheme.darkAlgorithm : antdTheme.defaultAlgorithm,
|
|
83
|
+
...theme,
|
|
84
|
+
token: { ...toAntdTheme({ dark: isDark, primaryColor }), ...theme?.token },
|
|
85
|
+
components: { ...toAntdComponents(), ...theme?.components },
|
|
86
|
+
}),
|
|
87
|
+
[isDark, primaryColor, theme]
|
|
88
|
+
);
|
|
89
|
+
|
|
90
|
+
// Written onto <html> rather than a wrapper element: this provider usually sits at the very top
|
|
91
|
+
// of the tree, and slipping an extra div in there would change the layout of whatever it wraps.
|
|
92
|
+
// `--primary-color` rather than `--vita-primary` because the generated tokens make the latter
|
|
93
|
+
// point at the former, so writing the legacy name keeps both spellings working for consumers.
|
|
94
|
+
useEffect(() => {
|
|
95
|
+
if (!primaryColor || typeof document === "undefined") return;
|
|
96
|
+
|
|
97
|
+
const root = document.documentElement;
|
|
98
|
+
const previous = root.style.getPropertyValue("--primary-color");
|
|
99
|
+
root.style.setProperty("--primary-color", primaryColor);
|
|
100
|
+
|
|
101
|
+
return () => {
|
|
102
|
+
if (previous) root.style.setProperty("--primary-color", previous);
|
|
103
|
+
else root.style.removeProperty("--primary-color");
|
|
104
|
+
};
|
|
105
|
+
}, [primaryColor]);
|
|
106
|
+
|
|
107
|
+
const tree = (
|
|
35
108
|
<PermissionsContent.Provider value={permissionsValue}>
|
|
109
|
+
{/* 让 message / notification / Modal.confirm 这类命令式 API 的输出落在树内,
|
|
110
|
+
从而能读到下面注入的主题。见 ../feedback。 */}
|
|
111
|
+
<FeedbackHolder />
|
|
36
112
|
{children}
|
|
37
113
|
</PermissionsContent.Provider>
|
|
38
114
|
);
|
|
115
|
+
|
|
116
|
+
if (!manageAntdTheme) return tree;
|
|
117
|
+
|
|
118
|
+
return <AntdConfigProvider theme={themeConfig}>{tree}</AntdConfigProvider>;
|
|
39
119
|
};
|
|
40
120
|
|
|
41
121
|
export default ConfigProvider;
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
import React, { useMemo } from "react";
|
|
2
|
+
import {
|
|
3
|
+
Modal as AntdModal,
|
|
4
|
+
message as antdMessage,
|
|
5
|
+
notification as antdNotification,
|
|
6
|
+
} from "antd";
|
|
7
|
+
import type { HookAPI as ModalHookApi } from "antd/es/modal/useModal";
|
|
8
|
+
import type { MessageInstance } from "antd/es/message/interface";
|
|
9
|
+
import type { NotificationInstance } from "antd/es/notification/interface";
|
|
10
|
+
|
|
11
|
+
/**
|
|
12
|
+
* 主题化的 message / notification / modal。
|
|
13
|
+
*
|
|
14
|
+
* 问题:antd 的 `message.success()`、`Modal.confirm()` 这类是命令式静态方法,调用时不在
|
|
15
|
+
* React 树里,读不到 `ConfigProvider` 注入的 `theme.token` —— 换过品牌色或切到暗色之后,
|
|
16
|
+
* 弹出来的东西还是 antd 的默认观感,与页面割裂。antd 官方的答案是改用 hook 版本
|
|
17
|
+
* (`Modal.useModal()` 等)并把返回的 contextHolder 渲染进树里,但那样每个调用点都得先拿
|
|
18
|
+
* 到实例,命令式的写法就没了。
|
|
19
|
+
*
|
|
20
|
+
* 这里的做法:`ConfigProvider` 内部挂一个 `FeedbackHolder`,它调用那三个 hook,把拿到的
|
|
21
|
+
* 实例存到模块级变量,并渲染各自的 contextHolder。下面导出的同名函数只是代理,转发给
|
|
22
|
+
* 被捕获的实例。于是调用写法不变,输出却在树内、能读到主题。
|
|
23
|
+
*
|
|
24
|
+
* 没挂 `ConfigProvider` 时回退到 antd 的静态方法:功能照常,只是不跟随主题,
|
|
25
|
+
* 并在开发环境提示一次。
|
|
26
|
+
*/
|
|
27
|
+
|
|
28
|
+
let modalInstance: ModalHookApi | null = null;
|
|
29
|
+
let messageInstance: MessageInstance | null = null;
|
|
30
|
+
let notificationInstance: NotificationInstance | null = null;
|
|
31
|
+
|
|
32
|
+
let warned = false;
|
|
33
|
+
const warnOnce = (name: string) => {
|
|
34
|
+
if (warned || process.env.NODE_ENV === "production") return;
|
|
35
|
+
warned = true;
|
|
36
|
+
console.warn(
|
|
37
|
+
`[@hsu-react/ui] ${name} 在 <ConfigProvider> 之外被调用,已回退到 antd 的静态方法。` +
|
|
38
|
+
`功能正常,但不会跟随 ConfigProvider 注入的主题(品牌色、暗色等)。` +
|
|
39
|
+
`把应用包在 <ConfigProvider> 里即可。`
|
|
40
|
+
);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* 捕获三个 hook 实例并渲染它们的 contextHolder。由 `ConfigProvider` 内部渲染,
|
|
45
|
+
* 消费方不需要自己挂。
|
|
46
|
+
*/
|
|
47
|
+
export const FeedbackHolder: React.FC = () => {
|
|
48
|
+
const [modalApi, modalHolder] = AntdModal.useModal();
|
|
49
|
+
const [messageApi, messageHolder] = antdMessage.useMessage();
|
|
50
|
+
const [notificationApi, notificationHolder] =
|
|
51
|
+
antdNotification.useNotification();
|
|
52
|
+
|
|
53
|
+
// 同步赋值而不是放进 useEffect:子树里如果有组件在自己的 effect 里就弹提示,
|
|
54
|
+
// effect 的执行顺序是自下而上的,等到这里的 effect 跑完就已经晚了。
|
|
55
|
+
useMemo(() => {
|
|
56
|
+
modalInstance = modalApi;
|
|
57
|
+
messageInstance = messageApi;
|
|
58
|
+
notificationInstance = notificationApi;
|
|
59
|
+
}, [modalApi, messageApi, notificationApi]);
|
|
60
|
+
|
|
61
|
+
return (
|
|
62
|
+
<>
|
|
63
|
+
{modalHolder}
|
|
64
|
+
{messageHolder}
|
|
65
|
+
{notificationHolder}
|
|
66
|
+
</>
|
|
67
|
+
);
|
|
68
|
+
};
|
|
69
|
+
|
|
70
|
+
/** 仅供测试 / 卸载时清理 */
|
|
71
|
+
export const resetFeedbackInstances = () => {
|
|
72
|
+
modalInstance = null;
|
|
73
|
+
messageInstance = null;
|
|
74
|
+
notificationInstance = null;
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
type MessageKey = keyof MessageInstance;
|
|
78
|
+
type NotificationKey = keyof NotificationInstance;
|
|
79
|
+
type ModalKey = keyof ModalHookApi;
|
|
80
|
+
|
|
81
|
+
const proxyMessage = <K extends MessageKey>(key: K): MessageInstance[K] =>
|
|
82
|
+
((...args: unknown[]) => {
|
|
83
|
+
const api = messageInstance;
|
|
84
|
+
if (!api) warnOnce("message");
|
|
85
|
+
return (
|
|
86
|
+
(api ?? antdMessage)[key] as unknown as (...a: unknown[]) => unknown
|
|
87
|
+
)(...args);
|
|
88
|
+
}) as MessageInstance[K];
|
|
89
|
+
|
|
90
|
+
const proxyNotification = <K extends NotificationKey>(
|
|
91
|
+
key: K
|
|
92
|
+
): NotificationInstance[K] =>
|
|
93
|
+
((...args: unknown[]) => {
|
|
94
|
+
const api = notificationInstance;
|
|
95
|
+
if (!api) warnOnce("notification");
|
|
96
|
+
return (
|
|
97
|
+
(api ?? antdNotification)[key] as unknown as (...a: unknown[]) => unknown
|
|
98
|
+
)(...args);
|
|
99
|
+
}) as NotificationInstance[K];
|
|
100
|
+
|
|
101
|
+
const proxyModal = <K extends ModalKey>(key: K): ModalHookApi[K] =>
|
|
102
|
+
((...args: unknown[]) => {
|
|
103
|
+
const api = modalInstance;
|
|
104
|
+
if (!api) warnOnce("Modal");
|
|
105
|
+
return (
|
|
106
|
+
(api ?? AntdModal)[key] as unknown as (...a: unknown[]) => unknown
|
|
107
|
+
)(...args);
|
|
108
|
+
}) as ModalHookApi[K];
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* 与 antd 的 `message` 同名同签名,区别是输出在 React 树内,会跟随主题。
|
|
112
|
+
* 直接把 `import { message } from "antd"` 换成从本库引入即可。
|
|
113
|
+
*/
|
|
114
|
+
export const message: MessageInstance = {
|
|
115
|
+
info: proxyMessage("info"),
|
|
116
|
+
success: proxyMessage("success"),
|
|
117
|
+
error: proxyMessage("error"),
|
|
118
|
+
warning: proxyMessage("warning"),
|
|
119
|
+
loading: proxyMessage("loading"),
|
|
120
|
+
open: proxyMessage("open"),
|
|
121
|
+
destroy: proxyMessage("destroy"),
|
|
122
|
+
};
|
|
123
|
+
|
|
124
|
+
/** 与 antd 的 `notification` 同名同签名,输出跟随主题 */
|
|
125
|
+
export const notification: NotificationInstance = {
|
|
126
|
+
success: proxyNotification("success"),
|
|
127
|
+
error: proxyNotification("error"),
|
|
128
|
+
info: proxyNotification("info"),
|
|
129
|
+
warning: proxyNotification("warning"),
|
|
130
|
+
open: proxyNotification("open"),
|
|
131
|
+
destroy: proxyNotification("destroy"),
|
|
132
|
+
};
|
|
133
|
+
|
|
134
|
+
/** 与 antd 的 `Modal.confirm` 等同名同签名,输出跟随主题 */
|
|
135
|
+
export const modalFuncs: ModalHookApi = {
|
|
136
|
+
info: proxyModal("info"),
|
|
137
|
+
success: proxyModal("success"),
|
|
138
|
+
error: proxyModal("error"),
|
|
139
|
+
warning: proxyModal("warning"),
|
|
140
|
+
confirm: proxyModal("confirm"),
|
|
141
|
+
};
|
package/src/hooks/index.ts
CHANGED
|
@@ -1,2 +1,7 @@
|
|
|
1
1
|
export { default as usePermissions, PermissionsContent } from "./usePermissions";
|
|
2
2
|
export { default as useLabelWidth } from "./useLabelWidth";
|
|
3
|
+
export { default as useIsDark } from "./useIsDark";
|
|
4
|
+
export { default as useBreakpoint } from "./useBreakpoint";
|
|
5
|
+
export type { BreakpointName, BreakpointState } from "./useBreakpoint";
|
|
6
|
+
export { default as usePointerType } from "./usePointerType";
|
|
7
|
+
export type { PointerType } from "./usePointerType";
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { useEffect, useState } from "react";
|
|
2
|
+
|
|
3
|
+
import { breakpoints } from "../styles/tokens";
|
|
4
|
+
|
|
5
|
+
export type BreakpointName = keyof typeof breakpoints;
|
|
6
|
+
|
|
7
|
+
export interface BreakpointState {
|
|
8
|
+
/** 当前命中的最大断点;视口比 sm 还窄时为 `xs` */
|
|
9
|
+
current: BreakpointName | "xs";
|
|
10
|
+
/** 视口 >= 对应断点 */
|
|
11
|
+
up: Record<BreakpointName, boolean>;
|
|
12
|
+
/** 视口 < 对应断点 */
|
|
13
|
+
down: Record<BreakpointName, boolean>;
|
|
14
|
+
/** `< md`,用于「这是不是手机」这类粗判断 */
|
|
15
|
+
isMobile: boolean;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
const NAMES = Object.keys(breakpoints) as BreakpointName[];
|
|
19
|
+
|
|
20
|
+
const read = (): BreakpointState => {
|
|
21
|
+
const width =
|
|
22
|
+
typeof window === "undefined" ? breakpoints.xl : window.innerWidth;
|
|
23
|
+
|
|
24
|
+
const up = {} as Record<BreakpointName, boolean>;
|
|
25
|
+
const down = {} as Record<BreakpointName, boolean>;
|
|
26
|
+
let current: BreakpointName | "xs" = "xs";
|
|
27
|
+
|
|
28
|
+
for (const name of NAMES) {
|
|
29
|
+
const hit = width >= breakpoints[name];
|
|
30
|
+
up[name] = hit;
|
|
31
|
+
down[name] = !hit;
|
|
32
|
+
if (hit) current = name;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
return { current, up, down, isMobile: width < breakpoints.md };
|
|
36
|
+
};
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* 当前视口命中的断点。
|
|
40
|
+
*
|
|
41
|
+
* 断点值与 `styles/_responsive.scss` 的 mixin 同源(都由 tokens.json 生成),所以 JS 里的判断
|
|
42
|
+
* 不会和 CSS 里的媒体查询错开。
|
|
43
|
+
*
|
|
44
|
+
* 能用 CSS 解决的就别用它 —— 媒体查询不需要 JS 参与、没有首屏闪烁、也不会因 SSR 拿不到
|
|
45
|
+
* `window` 而先渲染错一帧。只有当**结构**要变(比如小屏把表格换成卡片列表、把工具栏收进抽屉)
|
|
46
|
+
* 时才需要它。
|
|
47
|
+
*/
|
|
48
|
+
const useBreakpoint = (): BreakpointState => {
|
|
49
|
+
const [state, setState] = useState<BreakpointState>(read);
|
|
50
|
+
|
|
51
|
+
useEffect(() => {
|
|
52
|
+
const update = () => setState(read());
|
|
53
|
+
update();
|
|
54
|
+
|
|
55
|
+
window.addEventListener("resize", update);
|
|
56
|
+
return () => window.removeEventListener("resize", update);
|
|
57
|
+
}, []);
|
|
58
|
+
|
|
59
|
+
return state;
|
|
60
|
+
};
|
|
61
|
+
|
|
62
|
+
export default useBreakpoint;
|