@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
|
@@ -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;
|
|
@@ -70,10 +70,10 @@ const UploadedItem = ({
|
|
|
70
70
|
className: (0, _classnames.default)(_indexModule.default.fileItem, listProps?.item),
|
|
71
71
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
72
72
|
title: name,
|
|
73
|
-
color: "var(--
|
|
73
|
+
color: "var(--vita-muted)",
|
|
74
74
|
styles: {
|
|
75
|
-
|
|
76
|
-
color: "var(--
|
|
75
|
+
container: {
|
|
76
|
+
color: "var(--vita-foreground)",
|
|
77
77
|
padding: "6px 16px"
|
|
78
78
|
}
|
|
79
79
|
},
|
|
@@ -28,10 +28,10 @@ const UploadingItem = ({
|
|
|
28
28
|
className: _indexModule.default.uploading,
|
|
29
29
|
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Tooltip, {
|
|
30
30
|
title: name,
|
|
31
|
-
color: "var(--
|
|
31
|
+
color: "var(--vita-muted)",
|
|
32
32
|
styles: {
|
|
33
|
-
|
|
34
|
-
color: "var(--
|
|
33
|
+
container: {
|
|
34
|
+
color: "var(--vita-foreground)",
|
|
35
35
|
padding: "6px 16px"
|
|
36
36
|
}
|
|
37
37
|
},
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AxiosRequestConfig } from "axios";
|
|
2
2
|
import { RcFile } from "antd/es/upload";
|
|
3
3
|
import { UploadingList } from "..";
|
|
4
|
-
import type { UploadRequestOption } from "
|
|
4
|
+
import type { UploadRequestOption } from "../../../types/antd";
|
|
5
5
|
interface NormalUploadOptions {
|
|
6
6
|
file: RcFile;
|
|
7
7
|
action: string;
|
|
@@ -5,6 +5,52 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.validateFile = validateFile;
|
|
7
7
|
var _toMB = require("./toMB");
|
|
8
|
+
/**
|
|
9
|
+
* 文件是否命中 accept —— 与 antd 保持一致的语义。
|
|
10
|
+
*
|
|
11
|
+
* 此前是把 accept 拼进正则:`new RegExp(`(${accept.replace(/,/g, "|")})$`)`,有两个问题:
|
|
12
|
+
* 字符没转义(`.png` 里的 `.` 是「任意字符」,实测放行了 `axpng`),且 HTML 允许的 MIME
|
|
13
|
+
* 形式里 `image/*` 的 `*` 会被当成量词(实测把 photo.png 判成了格式错误)。把外部字符串
|
|
14
|
+
* 拼进正则本身也是 ReDoS 入口。
|
|
15
|
+
*
|
|
16
|
+
* 这里照抄 @rc-component/upload 的 attr-accept 语义,而不是另写一套:这个函数是上传前的
|
|
17
|
+
* 预校验,antd 自己的 accept 过滤也在跑,两边规则一旦不一致,就会出现「antd 放行、我们拦下」
|
|
18
|
+
* 或反过来的割裂。逐条 some(),任一命中即通过,全不命中即拒绝 —— 不做额外兜底。
|
|
19
|
+
*/
|
|
20
|
+
const matchesAccept = (file, accept) => {
|
|
21
|
+
const items = accept.split(",");
|
|
22
|
+
const fileName = file.name || "";
|
|
23
|
+
const mimeType = file.type || "";
|
|
24
|
+
const baseMimeType = mimeType.replace(/\/.*$/, "");
|
|
25
|
+
return items.some(item => {
|
|
26
|
+
const validType = item.trim();
|
|
27
|
+
if (!validType) return false;
|
|
28
|
+
|
|
29
|
+
// `*` / `*/*`:全部放行
|
|
30
|
+
if (/^\*(\/\*)?$/.test(validType)) return true;
|
|
31
|
+
|
|
32
|
+
// 扩展名。jpg 与 jpeg 互认,与 attr-accept 一致
|
|
33
|
+
if (validType.charAt(0) === ".") {
|
|
34
|
+
const lowerName = fileName.toLowerCase();
|
|
35
|
+
const lowerType = validType.toLowerCase();
|
|
36
|
+
const affixes = lowerType === ".jpg" || lowerType === ".jpeg" ? [".jpg", ".jpeg"] : [lowerType];
|
|
37
|
+
return affixes.some(affix => lowerName.endsWith(affix));
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// `image/*` 这类通配
|
|
41
|
+
if (/\/\*$/.test(validType)) {
|
|
42
|
+
return baseMimeType === validType.replace(/\/.*$/, "");
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// MIME 全等
|
|
46
|
+
if (mimeType === validType) return true;
|
|
47
|
+
|
|
48
|
+
// `png` 这种没有点也没有斜杠的写法是无效 accept,attr-accept 选择跳过而不是拦下
|
|
49
|
+
if (/^\w+$/.test(validType)) return true;
|
|
50
|
+
return false;
|
|
51
|
+
});
|
|
52
|
+
};
|
|
53
|
+
|
|
8
54
|
/**
|
|
9
55
|
* Validate file format and size
|
|
10
56
|
*/
|
|
@@ -15,8 +61,7 @@ function validateFile({
|
|
|
15
61
|
en
|
|
16
62
|
}) {
|
|
17
63
|
if (accept) {
|
|
18
|
-
|
|
19
|
-
if (!fileRegex.test(file.name.toLowerCase())) {
|
|
64
|
+
if (!matchesAccept(file, accept)) {
|
|
20
65
|
return {
|
|
21
66
|
valid: false,
|
|
22
67
|
error: new Error(en ? `File format error, please upload ${accept} file` : `文件格式错误,请上传 ${accept} 文件`)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { UploadProps as AntdUploadProps, UploadFile } from "antd";
|
|
1
|
+
import { Upload as AntdUpload, UploadProps as AntdUploadProps, UploadFile } from "antd";
|
|
2
2
|
import React from "react";
|
|
3
3
|
import { Canceler } from "axios";
|
|
4
4
|
import { ButtonProps, ProgressProps } from "antd";
|
|
@@ -38,5 +38,11 @@ export interface UploadProps extends Omit<AntdUploadProps, "action" | "data"> {
|
|
|
38
38
|
};
|
|
39
39
|
en?: boolean;
|
|
40
40
|
}
|
|
41
|
-
|
|
41
|
+
interface UploadFC extends React.FC<UploadProps> {
|
|
42
|
+
/** antd 的拖拽上传区 */
|
|
43
|
+
Dragger: typeof AntdUpload.Dragger;
|
|
44
|
+
/** `beforeUpload` 返回它表示「跳过这个文件且不进 fileList」 */
|
|
45
|
+
LIST_IGNORE: typeof AntdUpload.LIST_IGNORE;
|
|
46
|
+
}
|
|
47
|
+
declare const Upload: UploadFC;
|
|
42
48
|
export default Upload;
|
|
@@ -45,6 +45,11 @@ const Upload = props => {
|
|
|
45
45
|
onPreview,
|
|
46
46
|
...uploadConfig
|
|
47
47
|
} = props;
|
|
48
|
+
|
|
49
|
+
// antd v6 widened `accept` to `string | { format: string; filter?: ... }`. This component's own
|
|
50
|
+
// extension check (validateFile) only understands the comma-separated string, so read the format
|
|
51
|
+
// out of the object form; antd still applies the full config to the native file input.
|
|
52
|
+
const acceptFormat = typeof accept === "string" ? accept : accept.format;
|
|
48
53
|
const {
|
|
49
54
|
fileList: _fileList,
|
|
50
55
|
setFileList,
|
|
@@ -90,7 +95,7 @@ const Upload = props => {
|
|
|
90
95
|
chunkNum,
|
|
91
96
|
data,
|
|
92
97
|
headers,
|
|
93
|
-
accept,
|
|
98
|
+
accept: acceptFormat,
|
|
94
99
|
size,
|
|
95
100
|
en,
|
|
96
101
|
uploadingList,
|
|
@@ -100,7 +105,7 @@ const Upload = props => {
|
|
|
100
105
|
onError,
|
|
101
106
|
onUploadSuccess
|
|
102
107
|
});
|
|
103
|
-
}, [chunkAction, mergeChunkAction, chunkNum, data, headers,
|
|
108
|
+
}, [chunkAction, mergeChunkAction, chunkNum, data, headers, acceptFormat, size, en, uploadingList, setUploadingList, onUploadSuccess]);
|
|
104
109
|
|
|
105
110
|
// Normal upload
|
|
106
111
|
const customRequest = (0, _react.useCallback)(async options => {
|
|
@@ -123,7 +128,7 @@ const Upload = props => {
|
|
|
123
128
|
action,
|
|
124
129
|
data,
|
|
125
130
|
headers,
|
|
126
|
-
accept,
|
|
131
|
+
accept: acceptFormat,
|
|
127
132
|
size,
|
|
128
133
|
en,
|
|
129
134
|
uploadingList,
|
|
@@ -133,7 +138,7 @@ const Upload = props => {
|
|
|
133
138
|
onError,
|
|
134
139
|
onUploadSuccess
|
|
135
140
|
});
|
|
136
|
-
}, [action, data, headers,
|
|
141
|
+
}, [action, data, headers, acceptFormat, size, en, uploadingList, setUploadingList, onUploadSuccess]);
|
|
137
142
|
const handleChange = ({
|
|
138
143
|
file,
|
|
139
144
|
fileList: newFileList
|
|
@@ -208,4 +213,6 @@ const Upload = props => {
|
|
|
208
213
|
})]
|
|
209
214
|
});
|
|
210
215
|
};
|
|
216
|
+
Upload.Dragger = _antd.Upload.Dragger;
|
|
217
|
+
Upload.LIST_IGNORE = _antd.Upload.LIST_IGNORE;
|
|
211
218
|
var _default = exports.default = Upload;
|
|
@@ -1,17 +1,49 @@
|
|
|
1
1
|
import React from "react";
|
|
2
|
+
import { type ThemeConfig } from "antd";
|
|
2
3
|
import { RequestImpl } from "../request";
|
|
3
4
|
export interface ConfigProviderProps {
|
|
4
5
|
/** Current user's permission code list; when provided, usePermissions / hasPermi validate against it. If omitted, everything is allowed by default */
|
|
5
6
|
permissions?: string[] | null;
|
|
6
7
|
/** Inject the HTTP request implementation, used by smart components such as ImportForm */
|
|
7
8
|
request?: Partial<RequestImpl>;
|
|
9
|
+
/**
|
|
10
|
+
* Brand colour. Sets both halves of the token layer at once: the `--vita-primary` CSS variable
|
|
11
|
+
* (via `--primary-color`, so pre-2.0 overrides keep working) and antd's `colorPrimary`.
|
|
12
|
+
*
|
|
13
|
+
* Setting the CSS variable by hand only moves this library's own styles — antd derives a
|
|
14
|
+
* 10-step palette from the JS token and cannot read a `var()`. Going through this prop is what
|
|
15
|
+
* keeps the two in step.
|
|
16
|
+
*/
|
|
17
|
+
primaryColor?: string;
|
|
18
|
+
/**
|
|
19
|
+
* Force light/dark instead of following `html[data-theme]` / the OS preference.
|
|
20
|
+
* The CSS variables follow the same signals on their own.
|
|
21
|
+
*/
|
|
22
|
+
dark?: boolean;
|
|
23
|
+
/**
|
|
24
|
+
* Extra antd theme config, merged on top of the generated one — escape hatch for a consumer
|
|
25
|
+
* that wants a token this library does not map.
|
|
26
|
+
*/
|
|
27
|
+
theme?: ThemeConfig;
|
|
28
|
+
/**
|
|
29
|
+
* Set to `false` to stop managing antd's theme entirely, leaving it to the host app.
|
|
30
|
+
* Components this library wraps still follow the `--vita-*` variables; antd components it does
|
|
31
|
+
* not wrap will fall back to antd's stock look.
|
|
32
|
+
*/
|
|
33
|
+
antdTheme?: boolean;
|
|
8
34
|
children?: React.ReactNode;
|
|
9
35
|
}
|
|
10
36
|
/**
|
|
11
|
-
* Hsu UI global configuration:
|
|
37
|
+
* Hsu UI global configuration: permissions, the request implementation, and the design tokens.
|
|
38
|
+
*
|
|
39
|
+
* On the theme: the `--vita-*` CSS variables cover everything this library styles itself, but not
|
|
40
|
+
* the antd components it merely re-exports or that a page uses directly. Feeding antd's
|
|
41
|
+
* `theme.token` from the very same tokens is what makes an unwrapped `<Steps />` land on the same
|
|
42
|
+
* palette, radii and type scale as a wrapped `<Table />` — without this library having to wrap all
|
|
43
|
+
* 75 antd components to keep the look consistent.
|
|
12
44
|
*
|
|
13
45
|
* @example
|
|
14
|
-
* <ConfigProvider permissions={perms} request={{ get, post, del, put }}>
|
|
46
|
+
* <ConfigProvider permissions={perms} request={{ get, post, del, put }} primaryColor="#7c3aed">
|
|
15
47
|
* <App />
|
|
16
48
|
* </ConfigProvider>
|
|
17
49
|
*/
|
|
@@ -5,22 +5,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
7
|
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _antd = require("antd");
|
|
8
9
|
var _usePermissions = require("../hooks/usePermissions");
|
|
10
|
+
var _useIsDark = _interopRequireDefault(require("../hooks/useIsDark"));
|
|
9
11
|
var _request = require("../request");
|
|
12
|
+
var _tokens = require("../styles/tokens");
|
|
13
|
+
var _feedback = require("../feedback");
|
|
10
14
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
15
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
11
16
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
12
17
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
13
18
|
/**
|
|
14
|
-
* Hsu UI global configuration:
|
|
19
|
+
* Hsu UI global configuration: permissions, the request implementation, and the design tokens.
|
|
20
|
+
*
|
|
21
|
+
* On the theme: the `--vita-*` CSS variables cover everything this library styles itself, but not
|
|
22
|
+
* the antd components it merely re-exports or that a page uses directly. Feeding antd's
|
|
23
|
+
* `theme.token` from the very same tokens is what makes an unwrapped `<Steps />` land on the same
|
|
24
|
+
* palette, radii and type scale as a wrapped `<Table />` — without this library having to wrap all
|
|
25
|
+
* 75 antd components to keep the look consistent.
|
|
15
26
|
*
|
|
16
27
|
* @example
|
|
17
|
-
* <ConfigProvider permissions={perms} request={{ get, post, del, put }}>
|
|
28
|
+
* <ConfigProvider permissions={perms} request={{ get, post, del, put }} primaryColor="#7c3aed">
|
|
18
29
|
* <App />
|
|
19
30
|
* </ConfigProvider>
|
|
20
31
|
*/
|
|
21
32
|
const ConfigProvider = ({
|
|
22
33
|
permissions = null,
|
|
23
34
|
request,
|
|
35
|
+
primaryColor,
|
|
36
|
+
dark,
|
|
37
|
+
theme,
|
|
38
|
+
antdTheme: manageAntdTheme = true,
|
|
24
39
|
children
|
|
25
40
|
}) => {
|
|
26
41
|
// Inject synchronously during render so child components get the request implementation on their very first interaction
|
|
@@ -30,9 +45,45 @@ const ConfigProvider = ({
|
|
|
30
45
|
const permissionsValue = (0, _react.useMemo)(() => ({
|
|
31
46
|
permissions
|
|
32
47
|
}), [permissions]);
|
|
33
|
-
|
|
48
|
+
const detectedDark = (0, _useIsDark.default)();
|
|
49
|
+
const isDark = dark ?? detectedDark;
|
|
50
|
+
const themeConfig = (0, _react.useMemo)(() => ({
|
|
51
|
+
algorithm: isDark ? _antd.theme.darkAlgorithm : _antd.theme.defaultAlgorithm,
|
|
52
|
+
...theme,
|
|
53
|
+
token: {
|
|
54
|
+
...(0, _tokens.toAntdTheme)({
|
|
55
|
+
dark: isDark,
|
|
56
|
+
primaryColor
|
|
57
|
+
}),
|
|
58
|
+
...theme?.token
|
|
59
|
+
},
|
|
60
|
+
components: {
|
|
61
|
+
...(0, _tokens.toAntdComponents)(),
|
|
62
|
+
...theme?.components
|
|
63
|
+
}
|
|
64
|
+
}), [isDark, primaryColor, theme]);
|
|
65
|
+
|
|
66
|
+
// Written onto <html> rather than a wrapper element: this provider usually sits at the very top
|
|
67
|
+
// of the tree, and slipping an extra div in there would change the layout of whatever it wraps.
|
|
68
|
+
// `--primary-color` rather than `--vita-primary` because the generated tokens make the latter
|
|
69
|
+
// point at the former, so writing the legacy name keeps both spellings working for consumers.
|
|
70
|
+
(0, _react.useEffect)(() => {
|
|
71
|
+
if (!primaryColor || typeof document === "undefined") return;
|
|
72
|
+
const root = document.documentElement;
|
|
73
|
+
const previous = root.style.getPropertyValue("--primary-color");
|
|
74
|
+
root.style.setProperty("--primary-color", primaryColor);
|
|
75
|
+
return () => {
|
|
76
|
+
if (previous) root.style.setProperty("--primary-color", previous);else root.style.removeProperty("--primary-color");
|
|
77
|
+
};
|
|
78
|
+
}, [primaryColor]);
|
|
79
|
+
const tree = /*#__PURE__*/(0, _jsxRuntime.jsxs)(_usePermissions.PermissionsContent.Provider, {
|
|
34
80
|
value: permissionsValue,
|
|
35
|
-
children: children
|
|
81
|
+
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_feedback.FeedbackHolder, {}), children]
|
|
82
|
+
});
|
|
83
|
+
if (!manageAntdTheme) return tree;
|
|
84
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.ConfigProvider, {
|
|
85
|
+
theme: themeConfig,
|
|
86
|
+
children: tree
|
|
36
87
|
});
|
|
37
88
|
};
|
|
38
89
|
var _default = exports.default = ConfigProvider;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import React from "react";
|
|
2
|
+
import type { HookAPI as ModalHookApi } from "antd/es/modal/useModal";
|
|
3
|
+
import type { MessageInstance } from "antd/es/message/interface";
|
|
4
|
+
import type { NotificationInstance } from "antd/es/notification/interface";
|
|
5
|
+
/**
|
|
6
|
+
* 捕获三个 hook 实例并渲染它们的 contextHolder。由 `ConfigProvider` 内部渲染,
|
|
7
|
+
* 消费方不需要自己挂。
|
|
8
|
+
*/
|
|
9
|
+
export declare const FeedbackHolder: React.FC;
|
|
10
|
+
/** 仅供测试 / 卸载时清理 */
|
|
11
|
+
export declare const resetFeedbackInstances: () => void;
|
|
12
|
+
/**
|
|
13
|
+
* 与 antd 的 `message` 同名同签名,区别是输出在 React 树内,会跟随主题。
|
|
14
|
+
* 直接把 `import { message } from "antd"` 换成从本库引入即可。
|
|
15
|
+
*/
|
|
16
|
+
export declare const message: MessageInstance;
|
|
17
|
+
/** 与 antd 的 `notification` 同名同签名,输出跟随主题 */
|
|
18
|
+
export declare const notification: NotificationInstance;
|
|
19
|
+
/** 与 antd 的 `Modal.confirm` 等同名同签名,输出跟随主题 */
|
|
20
|
+
export declare const modalFuncs: ModalHookApi;
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.resetFeedbackInstances = exports.notification = exports.modalFuncs = exports.message = exports.FeedbackHolder = void 0;
|
|
7
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
8
|
+
var _antd = require("antd");
|
|
9
|
+
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
+
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
11
|
+
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
12
|
+
/**
|
|
13
|
+
* 主题化的 message / notification / modal。
|
|
14
|
+
*
|
|
15
|
+
* 问题:antd 的 `message.success()`、`Modal.confirm()` 这类是命令式静态方法,调用时不在
|
|
16
|
+
* React 树里,读不到 `ConfigProvider` 注入的 `theme.token` —— 换过品牌色或切到暗色之后,
|
|
17
|
+
* 弹出来的东西还是 antd 的默认观感,与页面割裂。antd 官方的答案是改用 hook 版本
|
|
18
|
+
* (`Modal.useModal()` 等)并把返回的 contextHolder 渲染进树里,但那样每个调用点都得先拿
|
|
19
|
+
* 到实例,命令式的写法就没了。
|
|
20
|
+
*
|
|
21
|
+
* 这里的做法:`ConfigProvider` 内部挂一个 `FeedbackHolder`,它调用那三个 hook,把拿到的
|
|
22
|
+
* 实例存到模块级变量,并渲染各自的 contextHolder。下面导出的同名函数只是代理,转发给
|
|
23
|
+
* 被捕获的实例。于是调用写法不变,输出却在树内、能读到主题。
|
|
24
|
+
*
|
|
25
|
+
* 没挂 `ConfigProvider` 时回退到 antd 的静态方法:功能照常,只是不跟随主题,
|
|
26
|
+
* 并在开发环境提示一次。
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
let modalInstance = null;
|
|
30
|
+
let messageInstance = null;
|
|
31
|
+
let notificationInstance = null;
|
|
32
|
+
let warned = false;
|
|
33
|
+
const warnOnce = name => {
|
|
34
|
+
if (warned || process.env.NODE_ENV === "production") return;
|
|
35
|
+
warned = true;
|
|
36
|
+
console.warn(`[@hsu-react/ui] ${name} 在 <ConfigProvider> 之外被调用,已回退到 antd 的静态方法。` + `功能正常,但不会跟随 ConfigProvider 注入的主题(品牌色、暗色等)。` + `把应用包在 <ConfigProvider> 里即可。`);
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* 捕获三个 hook 实例并渲染它们的 contextHolder。由 `ConfigProvider` 内部渲染,
|
|
41
|
+
* 消费方不需要自己挂。
|
|
42
|
+
*/
|
|
43
|
+
const FeedbackHolder = () => {
|
|
44
|
+
const [modalApi, modalHolder] = _antd.Modal.useModal();
|
|
45
|
+
const [messageApi, messageHolder] = _antd.message.useMessage();
|
|
46
|
+
const [notificationApi, notificationHolder] = _antd.notification.useNotification();
|
|
47
|
+
|
|
48
|
+
// 同步赋值而不是放进 useEffect:子树里如果有组件在自己的 effect 里就弹提示,
|
|
49
|
+
// effect 的执行顺序是自下而上的,等到这里的 effect 跑完就已经晚了。
|
|
50
|
+
(0, _react.useMemo)(() => {
|
|
51
|
+
modalInstance = modalApi;
|
|
52
|
+
messageInstance = messageApi;
|
|
53
|
+
notificationInstance = notificationApi;
|
|
54
|
+
}, [modalApi, messageApi, notificationApi]);
|
|
55
|
+
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(_jsxRuntime.Fragment, {
|
|
56
|
+
children: [modalHolder, messageHolder, notificationHolder]
|
|
57
|
+
});
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
/** 仅供测试 / 卸载时清理 */
|
|
61
|
+
exports.FeedbackHolder = FeedbackHolder;
|
|
62
|
+
const resetFeedbackInstances = () => {
|
|
63
|
+
modalInstance = null;
|
|
64
|
+
messageInstance = null;
|
|
65
|
+
notificationInstance = null;
|
|
66
|
+
};
|
|
67
|
+
exports.resetFeedbackInstances = resetFeedbackInstances;
|
|
68
|
+
const proxyMessage = key => (...args) => {
|
|
69
|
+
const api = messageInstance;
|
|
70
|
+
if (!api) warnOnce("message");
|
|
71
|
+
return (api ?? _antd.message)[key](...args);
|
|
72
|
+
};
|
|
73
|
+
const proxyNotification = key => (...args) => {
|
|
74
|
+
const api = notificationInstance;
|
|
75
|
+
if (!api) warnOnce("notification");
|
|
76
|
+
return (api ?? _antd.notification)[key](...args);
|
|
77
|
+
};
|
|
78
|
+
const proxyModal = key => (...args) => {
|
|
79
|
+
const api = modalInstance;
|
|
80
|
+
if (!api) warnOnce("Modal");
|
|
81
|
+
return (api ?? _antd.Modal)[key](...args);
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
/**
|
|
85
|
+
* 与 antd 的 `message` 同名同签名,区别是输出在 React 树内,会跟随主题。
|
|
86
|
+
* 直接把 `import { message } from "antd"` 换成从本库引入即可。
|
|
87
|
+
*/
|
|
88
|
+
const message = exports.message = {
|
|
89
|
+
info: proxyMessage("info"),
|
|
90
|
+
success: proxyMessage("success"),
|
|
91
|
+
error: proxyMessage("error"),
|
|
92
|
+
warning: proxyMessage("warning"),
|
|
93
|
+
loading: proxyMessage("loading"),
|
|
94
|
+
open: proxyMessage("open"),
|
|
95
|
+
destroy: proxyMessage("destroy")
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
/** 与 antd 的 `notification` 同名同签名,输出跟随主题 */
|
|
99
|
+
const notification = exports.notification = {
|
|
100
|
+
success: proxyNotification("success"),
|
|
101
|
+
error: proxyNotification("error"),
|
|
102
|
+
info: proxyNotification("info"),
|
|
103
|
+
warning: proxyNotification("warning"),
|
|
104
|
+
open: proxyNotification("open"),
|
|
105
|
+
destroy: proxyNotification("destroy")
|
|
106
|
+
};
|
|
107
|
+
|
|
108
|
+
/** 与 antd 的 `Modal.confirm` 等同名同签名,输出跟随主题 */
|
|
109
|
+
const modalFuncs = exports.modalFuncs = {
|
|
110
|
+
info: proxyModal("info"),
|
|
111
|
+
success: proxyModal("success"),
|
|
112
|
+
error: proxyModal("error"),
|
|
113
|
+
warning: proxyModal("warning"),
|
|
114
|
+
confirm: proxyModal("confirm")
|
|
115
|
+
};
|
package/lib/hooks/index.d.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";
|
package/lib/hooks/index.js
CHANGED
|
@@ -9,6 +9,18 @@ Object.defineProperty(exports, "PermissionsContent", {
|
|
|
9
9
|
return _usePermissions.PermissionsContent;
|
|
10
10
|
}
|
|
11
11
|
});
|
|
12
|
+
Object.defineProperty(exports, "useBreakpoint", {
|
|
13
|
+
enumerable: true,
|
|
14
|
+
get: function () {
|
|
15
|
+
return _useBreakpoint.default;
|
|
16
|
+
}
|
|
17
|
+
});
|
|
18
|
+
Object.defineProperty(exports, "useIsDark", {
|
|
19
|
+
enumerable: true,
|
|
20
|
+
get: function () {
|
|
21
|
+
return _useIsDark.default;
|
|
22
|
+
}
|
|
23
|
+
});
|
|
12
24
|
Object.defineProperty(exports, "useLabelWidth", {
|
|
13
25
|
enumerable: true,
|
|
14
26
|
get: function () {
|
|
@@ -21,8 +33,17 @@ Object.defineProperty(exports, "usePermissions", {
|
|
|
21
33
|
return _usePermissions.default;
|
|
22
34
|
}
|
|
23
35
|
});
|
|
36
|
+
Object.defineProperty(exports, "usePointerType", {
|
|
37
|
+
enumerable: true,
|
|
38
|
+
get: function () {
|
|
39
|
+
return _usePointerType.default;
|
|
40
|
+
}
|
|
41
|
+
});
|
|
24
42
|
var _usePermissions = _interopRequireWildcard(require("./usePermissions"));
|
|
25
43
|
var _useLabelWidth = _interopRequireDefault(require("./useLabelWidth"));
|
|
44
|
+
var _useIsDark = _interopRequireDefault(require("./useIsDark"));
|
|
45
|
+
var _useBreakpoint = _interopRequireDefault(require("./useBreakpoint"));
|
|
46
|
+
var _usePointerType = _interopRequireDefault(require("./usePointerType"));
|
|
26
47
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
27
48
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
|
|
28
49
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { breakpoints } from "../styles/tokens";
|
|
2
|
+
export type BreakpointName = keyof typeof breakpoints;
|
|
3
|
+
export interface BreakpointState {
|
|
4
|
+
/** 当前命中的最大断点;视口比 sm 还窄时为 `xs` */
|
|
5
|
+
current: BreakpointName | "xs";
|
|
6
|
+
/** 视口 >= 对应断点 */
|
|
7
|
+
up: Record<BreakpointName, boolean>;
|
|
8
|
+
/** 视口 < 对应断点 */
|
|
9
|
+
down: Record<BreakpointName, boolean>;
|
|
10
|
+
/** `< md`,用于「这是不是手机」这类粗判断 */
|
|
11
|
+
isMobile: boolean;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* 当前视口命中的断点。
|
|
15
|
+
*
|
|
16
|
+
* 断点值与 `styles/_responsive.scss` 的 mixin 同源(都由 tokens.json 生成),所以 JS 里的判断
|
|
17
|
+
* 不会和 CSS 里的媒体查询错开。
|
|
18
|
+
*
|
|
19
|
+
* 能用 CSS 解决的就别用它 —— 媒体查询不需要 JS 参与、没有首屏闪烁、也不会因 SSR 拿不到
|
|
20
|
+
* `window` 而先渲染错一帧。只有当**结构**要变(比如小屏把表格换成卡片列表、把工具栏收进抽屉)
|
|
21
|
+
* 时才需要它。
|
|
22
|
+
*/
|
|
23
|
+
declare const useBreakpoint: () => BreakpointState;
|
|
24
|
+
export default useBreakpoint;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports.default = void 0;
|
|
7
|
+
var _react = require("react");
|
|
8
|
+
var _tokens = require("../styles/tokens");
|
|
9
|
+
const NAMES = Object.keys(_tokens.breakpoints);
|
|
10
|
+
const read = () => {
|
|
11
|
+
const width = typeof window === "undefined" ? _tokens.breakpoints.xl : window.innerWidth;
|
|
12
|
+
const up = {};
|
|
13
|
+
const down = {};
|
|
14
|
+
let current = "xs";
|
|
15
|
+
for (const name of NAMES) {
|
|
16
|
+
const hit = width >= _tokens.breakpoints[name];
|
|
17
|
+
up[name] = hit;
|
|
18
|
+
down[name] = !hit;
|
|
19
|
+
if (hit) current = name;
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
current,
|
|
23
|
+
up,
|
|
24
|
+
down,
|
|
25
|
+
isMobile: width < _tokens.breakpoints.md
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* 当前视口命中的断点。
|
|
31
|
+
*
|
|
32
|
+
* 断点值与 `styles/_responsive.scss` 的 mixin 同源(都由 tokens.json 生成),所以 JS 里的判断
|
|
33
|
+
* 不会和 CSS 里的媒体查询错开。
|
|
34
|
+
*
|
|
35
|
+
* 能用 CSS 解决的就别用它 —— 媒体查询不需要 JS 参与、没有首屏闪烁、也不会因 SSR 拿不到
|
|
36
|
+
* `window` 而先渲染错一帧。只有当**结构**要变(比如小屏把表格换成卡片列表、把工具栏收进抽屉)
|
|
37
|
+
* 时才需要它。
|
|
38
|
+
*/
|
|
39
|
+
const useBreakpoint = () => {
|
|
40
|
+
const [state, setState] = (0, _react.useState)(read);
|
|
41
|
+
(0, _react.useEffect)(() => {
|
|
42
|
+
const update = () => setState(read());
|
|
43
|
+
update();
|
|
44
|
+
window.addEventListener("resize", update);
|
|
45
|
+
return () => window.removeEventListener("resize", update);
|
|
46
|
+
}, []);
|
|
47
|
+
return state;
|
|
48
|
+
};
|
|
49
|
+
var _default = exports.default = useBreakpoint;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether the document is currently in dark mode.
|
|
3
|
+
*
|
|
4
|
+
* The CSS variables switch on their own — they are plain CSS. antd's theme cannot: its tokens are
|
|
5
|
+
* computed in JS, so the algorithm has to be swapped on re-render. This hook is that bridge, and
|
|
6
|
+
* `ConfigProvider` uses it to pick `darkAlgorithm`.
|
|
7
|
+
*/
|
|
8
|
+
declare const useIsDark: () => boolean;
|
|
9
|
+
export default useIsDark;
|