@ant-design/pro-components 3.1.4-0 → 3.1.6-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.
Files changed (214) hide show
  1. package/dist/pro-components.min.js +1 -1
  2. package/es/card/ProCard.js +15 -7
  3. package/es/card/components/Card/index.js +43 -19
  4. package/es/card/components/Card/style.js +12 -1
  5. package/es/card/components/Statistic/index.js +2 -2
  6. package/es/card/components/StatisticCard/index.js +1 -1
  7. package/es/card/typing.d.ts +27 -8
  8. package/es/field/AllProField.d.ts +2 -0
  9. package/es/field/AllProField.js +3 -0
  10. package/es/field/PureProField.d.ts +2 -0
  11. package/es/field/PureProField.js +2 -0
  12. package/es/field/components/Cascader/index.js +8 -1
  13. package/es/field/components/Checkbox/index.js +5 -1
  14. package/es/field/components/ColorPicker/index.d.ts +1 -1
  15. package/es/field/components/DatePicker/index.d.ts +1 -1
  16. package/es/field/components/DatePicker/index.js +13 -1
  17. package/es/field/components/Digit/index.js +20 -3
  18. package/es/field/components/Money/index.js +51 -3
  19. package/es/field/components/Password/index.js +12 -11
  20. package/es/field/components/Radio/index.js +5 -1
  21. package/es/field/components/RangePicker/index.d.ts +1 -1
  22. package/es/field/components/Segmented/index.js +2 -1
  23. package/es/field/components/Select/SearchSelect/index.js +3 -5
  24. package/es/field/components/Select/index.d.ts +1 -1
  25. package/es/field/components/Select/index.js +1 -1
  26. package/es/field/components/Switch/index.js +10 -2
  27. package/es/field/components/Text/index.js +7 -1
  28. package/es/field/components/TextArea/index.js +6 -3
  29. package/es/field/components/TimePicker/index.js +10 -1
  30. package/es/field/components/TreeSelect/index.d.ts +2 -12
  31. package/es/field/components/TreeSelect/index.js +31 -17
  32. package/es/form/BaseForm/BaseForm.js +4 -3
  33. package/es/form/BaseForm/Submitter/index.d.ts +1 -1
  34. package/es/form/components/Digit/DigitRange.js +5 -2
  35. package/es/form/components/Digit/index.js +7 -2
  36. package/es/form/components/FormItem/FormItemRender/index.d.ts +1 -1
  37. package/es/form/components/FormItem/FormItemRender/index.js +10 -2
  38. package/es/form/components/FormItem/Group/index.js +12 -2
  39. package/es/form/components/List/ListContainer.js +2 -1
  40. package/es/form/components/Select/index.js +11 -1
  41. package/es/form/layouts/DrawerForm/index.d.ts +4 -4
  42. package/es/form/layouts/DrawerForm/index.js +1 -1
  43. package/es/form/layouts/LightFilter/index.js +22 -31
  44. package/es/form/layouts/LoginForm/index.js +10 -9
  45. package/es/form/layouts/LoginFormPage/index.js +17 -16
  46. package/es/form/layouts/ModalForm/index.d.ts +2 -2
  47. package/es/form/layouts/ProForm/index.d.ts +1 -1
  48. package/es/form/layouts/QueryFilter/Actions.js +2 -1
  49. package/es/form/layouts/QueryFilter/index.js +40 -23
  50. package/es/form/layouts/StepsForm/index.js +2 -2
  51. package/es/layout/ProLayout.d.ts +3 -3
  52. package/es/layout/ProLayout.js +13 -25
  53. package/es/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
  54. package/es/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
  55. package/es/layout/components/FooterToolbar/index.d.ts +1 -1
  56. package/es/layout/components/FooterToolbar/index.js +2 -2
  57. package/es/layout/components/GlobalFooter/index.js +3 -3
  58. package/es/layout/components/GlobalHeader/ActionsContent.js +6 -6
  59. package/es/layout/components/GlobalHeader/index.js +1 -1
  60. package/es/layout/components/GridContent/index.js +1 -1
  61. package/es/layout/components/Help/ProHelpPanel.js +11 -10
  62. package/es/layout/components/PageContainer/index.js +9 -9
  63. package/es/layout/components/PageHeader/index.js +10 -10
  64. package/es/layout/components/SettingDrawer/BlockCheckbox.js +2 -2
  65. package/es/layout/components/SettingDrawer/LayoutChange.js +3 -2
  66. package/es/layout/components/SettingDrawer/RegionalChange.js +3 -2
  67. package/es/layout/components/SettingDrawer/ThemeColor.js +3 -2
  68. package/es/layout/components/SettingDrawer/index.js +5 -4
  69. package/es/layout/components/SiderMenu/BaseMenu.js +3 -3
  70. package/es/layout/components/SiderMenu/SiderMenu.js +5 -5
  71. package/es/layout/components/TopNavHeader/index.js +3 -3
  72. package/es/layout/utils/getBreadcrumbProps.js +1 -1
  73. package/es/list/Item.d.ts +3 -3
  74. package/es/list/Item.js +8 -1
  75. package/es/list/ListView.js +1 -2
  76. package/es/list/ProListBase.d.ts +1 -1
  77. package/es/list/ProListBase.js +43 -37
  78. package/es/list/style/index.js +13 -0
  79. package/es/provider/index.d.ts +2 -2
  80. package/es/table/Table.js +14 -5
  81. package/es/table/components/Alert/index.js +6 -5
  82. package/es/table/components/ColumnSetting/index.js +9 -9
  83. package/es/table/components/DragSortTable/index.js +8 -4
  84. package/es/table/components/EditableTable/index.d.ts +1 -1
  85. package/es/table/components/EditableTable/index.js +5 -70
  86. package/es/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
  87. package/es/table/components/ListToolBar/HeaderMenu.js +4 -3
  88. package/es/table/components/ListToolBar/index.js +15 -12
  89. package/es/table/components/ListToolBar/style.js +2 -2
  90. package/es/table/components/ToolBar/DensityIcon.d.ts +2 -2
  91. package/es/table/components/ToolBar/DensityIcon.js +6 -3
  92. package/es/table/components/ToolBar/FullscreenIcon.d.ts +1 -1
  93. package/es/table/components/ToolBar/FullscreenIcon.js +11 -5
  94. package/es/table/useFetchData.js +4 -1
  95. package/es/table/utils/cellRenderToFromItem.js +1 -1
  96. package/es/table/utils/useDragSort.js +1 -1
  97. package/es/utils/components/DropdownFooter/index.d.ts +1 -1
  98. package/es/utils/components/FieldLabel/index.js +1 -1
  99. package/es/utils/components/FilterDropdown/index.d.ts +1 -1
  100. package/es/utils/components/FilterDropdown/index.js +1 -1
  101. package/es/utils/components/InlineErrorFormItem/index.js +5 -4
  102. package/es/utils/components/LabelIconTip/index.js +2 -2
  103. package/es/utils/hooks/useFetchData/index.js +0 -2
  104. package/es/utils/isUrl/index.js +1 -1
  105. package/es/utils/proFieldParsingText/index.d.ts +2 -2
  106. package/es/utils/proFieldParsingText/index.js +2 -2
  107. package/guidelines/components/pro-card.md +5 -4
  108. package/lib/card/ProCard.js +15 -7
  109. package/lib/card/components/Card/index.js +43 -19
  110. package/lib/card/components/Card/style.js +12 -1
  111. package/lib/card/components/Statistic/index.js +2 -2
  112. package/lib/card/components/StatisticCard/index.js +1 -1
  113. package/lib/card/typing.d.ts +27 -8
  114. package/lib/field/AllProField.d.ts +2 -0
  115. package/lib/field/AllProField.js +3 -0
  116. package/lib/field/PureProField.d.ts +2 -0
  117. package/lib/field/PureProField.js +2 -0
  118. package/lib/field/components/Cascader/index.js +8 -1
  119. package/lib/field/components/Checkbox/index.js +5 -1
  120. package/lib/field/components/ColorPicker/index.d.ts +1 -1
  121. package/lib/field/components/DatePicker/index.d.ts +1 -1
  122. package/lib/field/components/DatePicker/index.js +13 -1
  123. package/lib/field/components/Digit/index.js +20 -3
  124. package/lib/field/components/Money/index.js +50 -2
  125. package/lib/field/components/Password/index.js +11 -10
  126. package/lib/field/components/Percent/util.d.ts +1 -1
  127. package/lib/field/components/Radio/index.js +5 -1
  128. package/lib/field/components/RangePicker/index.d.ts +1 -1
  129. package/lib/field/components/Segmented/index.js +2 -1
  130. package/lib/field/components/Select/SearchSelect/index.js +2 -4
  131. package/lib/field/components/Select/index.d.ts +1 -1
  132. package/lib/field/components/Select/index.js +1 -1
  133. package/lib/field/components/Switch/index.js +10 -2
  134. package/lib/field/components/Text/index.js +7 -1
  135. package/lib/field/components/TextArea/index.js +6 -3
  136. package/lib/field/components/TimePicker/index.js +10 -1
  137. package/lib/field/components/TreeSelect/index.d.ts +2 -12
  138. package/lib/field/components/TreeSelect/index.js +30 -16
  139. package/lib/form/BaseForm/BaseForm.js +4 -3
  140. package/lib/form/BaseForm/Submitter/index.d.ts +1 -1
  141. package/lib/form/components/Digit/DigitRange.js +5 -2
  142. package/lib/form/components/Digit/index.js +7 -2
  143. package/lib/form/components/FormItem/FormItemRender/index.d.ts +1 -1
  144. package/lib/form/components/FormItem/FormItemRender/index.js +10 -2
  145. package/lib/form/components/FormItem/Group/index.js +12 -2
  146. package/lib/form/components/List/ListContainer.js +2 -1
  147. package/lib/form/components/Select/index.js +11 -1
  148. package/lib/form/layouts/DrawerForm/index.d.ts +4 -4
  149. package/lib/form/layouts/DrawerForm/index.js +1 -1
  150. package/lib/form/layouts/LightFilter/index.js +21 -30
  151. package/lib/form/layouts/LoginForm/index.js +10 -9
  152. package/lib/form/layouts/LoginFormPage/index.js +17 -16
  153. package/lib/form/layouts/ModalForm/index.d.ts +2 -2
  154. package/lib/form/layouts/ProForm/index.d.ts +1 -1
  155. package/lib/form/layouts/QueryFilter/Actions.js +2 -1
  156. package/lib/form/layouts/QueryFilter/index.js +39 -22
  157. package/lib/form/layouts/StepsForm/index.js +2 -2
  158. package/lib/layout/ProLayout.d.ts +3 -3
  159. package/lib/layout/ProLayout.js +13 -25
  160. package/lib/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
  161. package/lib/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
  162. package/lib/layout/components/FooterToolbar/index.d.ts +1 -1
  163. package/lib/layout/components/FooterToolbar/index.js +2 -2
  164. package/lib/layout/components/GlobalFooter/index.js +3 -3
  165. package/lib/layout/components/GlobalHeader/ActionsContent.js +6 -6
  166. package/lib/layout/components/GlobalHeader/index.js +1 -1
  167. package/lib/layout/components/GridContent/index.js +1 -1
  168. package/lib/layout/components/Help/ProHelpPanel.js +11 -10
  169. package/lib/layout/components/PageContainer/index.js +9 -9
  170. package/lib/layout/components/PageHeader/index.js +10 -10
  171. package/lib/layout/components/SettingDrawer/BlockCheckbox.js +2 -2
  172. package/lib/layout/components/SettingDrawer/LayoutChange.js +3 -2
  173. package/lib/layout/components/SettingDrawer/RegionalChange.js +3 -2
  174. package/lib/layout/components/SettingDrawer/ThemeColor.js +3 -2
  175. package/lib/layout/components/SettingDrawer/index.js +5 -4
  176. package/lib/layout/components/SiderMenu/BaseMenu.js +3 -3
  177. package/lib/layout/components/SiderMenu/SiderMenu.js +5 -5
  178. package/lib/layout/components/TopNavHeader/index.js +3 -3
  179. package/lib/layout/utils/getBreadcrumbProps.js +1 -1
  180. package/lib/list/Item.d.ts +3 -3
  181. package/lib/list/Item.js +8 -1
  182. package/lib/list/ListView.js +1 -2
  183. package/lib/list/ProListBase.d.ts +1 -1
  184. package/lib/list/ProListBase.js +42 -36
  185. package/lib/list/style/index.js +13 -0
  186. package/lib/provider/index.d.ts +2 -2
  187. package/lib/table/Table.js +14 -5
  188. package/lib/table/components/Alert/index.js +6 -5
  189. package/lib/table/components/ColumnSetting/index.js +9 -9
  190. package/lib/table/components/DragSortTable/index.js +8 -4
  191. package/lib/table/components/EditableTable/index.d.ts +1 -1
  192. package/lib/table/components/EditableTable/index.js +5 -70
  193. package/lib/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
  194. package/lib/table/components/ListToolBar/HeaderMenu.js +4 -3
  195. package/lib/table/components/ListToolBar/index.js +15 -12
  196. package/lib/table/components/ListToolBar/style.js +2 -2
  197. package/lib/table/components/ToolBar/DensityIcon.d.ts +2 -2
  198. package/lib/table/components/ToolBar/DensityIcon.js +6 -3
  199. package/lib/table/components/ToolBar/FullscreenIcon.d.ts +1 -1
  200. package/lib/table/components/ToolBar/FullscreenIcon.js +11 -5
  201. package/lib/table/useFetchData.js +4 -1
  202. package/lib/table/utils/cellRenderToFromItem.js +1 -1
  203. package/lib/table/utils/useDragSort.js +1 -1
  204. package/lib/utils/components/DropdownFooter/index.d.ts +1 -1
  205. package/lib/utils/components/FieldLabel/index.js +1 -1
  206. package/lib/utils/components/FilterDropdown/index.d.ts +1 -1
  207. package/lib/utils/components/FilterDropdown/index.js +1 -1
  208. package/lib/utils/components/InlineErrorFormItem/index.js +5 -4
  209. package/lib/utils/components/LabelIconTip/index.js +2 -2
  210. package/lib/utils/hooks/useFetchData/index.js +0 -2
  211. package/lib/utils/isUrl/index.js +1 -1
  212. package/lib/utils/proFieldParsingText/index.d.ts +2 -2
  213. package/lib/utils/proFieldParsingText/index.js +2 -2
  214. package/package.json +31 -30
@@ -1,5 +1,5 @@
1
- /// <reference types="react" />
2
1
  import type { FormProps, ModalProps } from 'antd';
2
+ import React from 'react';
3
3
  import type { CommonFormProps } from '../../BaseForm';
4
4
  export type ModalFormProps<T = Record<string, any>, U = Record<string, any>> = Omit<FormProps<T>, 'onFinish' | 'title'> & CommonFormProps<T, U> & {
5
5
  /**
@@ -17,7 +17,7 @@ export type ModalFormProps<T = Record<string, any>, U = Record<string, any>> = O
17
17
  /** @name 提交数据时,禁用取消按钮的超时时间(毫秒)。 */
18
18
  submitTimeout?: number;
19
19
  /** @name 用于触发抽屉打开的 dom */
20
- trigger?: JSX.Element;
20
+ trigger?: React.JSX.Element;
21
21
  /** @name 受控的打开关闭 */
22
22
  open?: ModalProps['open'];
23
23
  /** @name 打开关闭的事件 */
@@ -9,7 +9,7 @@ declare namespace ProForm {
9
9
  var Group: React.FC<import("src/form").GroupProps>;
10
10
  var useForm: typeof import("antd/es/form/Form").useForm;
11
11
  var Item: React.FC<import("src/form/components/FormItem").ProFormItemProps>;
12
- var useWatch: typeof import("antd/es/form/Form").useWatch;
12
+ var useWatch: typeof import("@rc-component/form").useWatch;
13
13
  var ErrorList: React.FC<import("antd/es/form").ErrorListProps>;
14
14
  var Provider: React.FC<import("antd/es/form/context").FormProviderProps>;
15
15
  var useFormInstance: typeof import("antd/es/form/hooks/useFormInstance").default;
@@ -1,5 +1,6 @@
1
1
  import { DownOutlined } from '@ant-design/icons';
2
2
  import { ConfigProvider, Space } from 'antd';
3
+ import { clsx } from 'clsx';
3
4
  import React, { useContext } from 'react';
4
5
  import { ProProvider, useIntl } from "../../../provider";
5
6
  import { omitBoolean } from "../../../utils";
@@ -54,7 +55,7 @@ const Actions = props => {
54
55
  style: style,
55
56
  size: 16,
56
57
  children: [submitter, props.collapseRender !== false && /*#__PURE__*/_jsx("a", {
57
- className: `${getPrefixCls('pro-query-filter-collapse-button')} ${hashId}`.trim(),
58
+ className: clsx(getPrefixCls('pro-query-filter-collapse-button'), hashId),
58
59
  onClick: () => setCollapsed(!collapsed),
59
60
  children: collapseRender?.(collapsed, props, intl, hiddenNum)
60
61
  })]
@@ -1,6 +1,6 @@
1
1
  import RcResizeObserver from '@rc-component/resize-observer';
2
2
  import { useControlledState } from '@rc-component/util';
3
- import { Col, ConfigProvider, Form, Row } from 'antd';
3
+ import { Col, ConfigProvider, Form, Row, theme } from 'antd';
4
4
  import { clsx } from 'clsx';
5
5
  import React, { useCallback, useContext, useMemo, useState } from 'react';
6
6
  import { ProProvider, useIntl } from "../../../provider";
@@ -10,20 +10,28 @@ import Actions from "./Actions";
10
10
  import { useStyle } from "./style";
11
11
  import { jsx as _jsx } from "react/jsx-runtime";
12
12
  import { jsxs as _jsxs } from "react/jsx-runtime";
13
- const CONFIG_SPAN_BREAKPOINTS = {
14
- xs: 513,
15
- sm: 513,
16
- md: 785,
17
- lg: 992,
18
- xl: 1057,
19
- xxl: Infinity
20
- };
21
- /** 配置表单列变化的容器宽度断点 */
22
- const BREAKPOINTS = {
23
- vertical: [
24
- // [breakpoint, cols, layout]
25
- [513, 1, 'vertical'], [785, 2, 'vertical'], [1057, 3, 'vertical'], [Infinity, 4, 'vertical']],
26
- default: [[513, 1, 'vertical'], [701, 2, 'vertical'], [1062, 3, 'horizontal'], [1352, 3, 'horizontal'], [Infinity, 4, 'horizontal']]
13
+ /** antd 设计 token 获取断点配置,与 Grid 响应式布局保持一致 */
14
+ const getBreakpointsConfig = token => {
15
+ const defaultToken = theme.getDesignToken();
16
+ const t = {
17
+ ...defaultToken,
18
+ ...token
19
+ };
20
+ const bp = {
21
+ xs: t.screenSMMin ?? 576,
22
+ sm: t.screenMDMin ?? 768,
23
+ md: t.screenLGMin ?? 992,
24
+ lg: t.screenXLMin ?? 1200,
25
+ xl: t.screenXXLMin ?? 1600,
26
+ xxl: Infinity
27
+ };
28
+ return {
29
+ configSpanBreakpoints: bp,
30
+ breakpoints: {
31
+ vertical: [[bp.xs, 1, 'vertical'], [bp.md, 2, 'vertical'], [bp.xl, 3, 'vertical'], [Infinity, 4, 'vertical']],
32
+ default: [[bp.xs, 1, 'vertical'], [bp.sm, 2, 'vertical'], [bp.xl, 3, 'horizontal'], [Infinity, 4, 'horizontal']]
33
+ }
34
+ };
27
35
  };
28
36
 
29
37
  /**
@@ -31,16 +39,21 @@ const BREAKPOINTS = {
31
39
  *
32
40
  * @param layout
33
41
  * @param width
42
+ * @param breakpointsConfig 从 theme.useToken() 获取,支持 ConfigProvider 主题定制
34
43
  */
35
- const getSpanConfig = (layout, width, span) => {
44
+ const getSpanConfig = (layout, width, span, breakpointsConfig) => {
36
45
  if (span && typeof span === 'number') {
37
46
  return {
38
47
  span,
39
48
  layout
40
49
  };
41
50
  }
42
- const spanConfig = span ? ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].map(key => [CONFIG_SPAN_BREAKPOINTS[key], 24 / span[key], 'horizontal']) : BREAKPOINTS[layout || 'default'];
43
- const breakPoint = (spanConfig || BREAKPOINTS.default).find(item => width < item[0] + 16 // 16 = 2 * (ant-row -8px margin)
51
+ const {
52
+ breakpoints,
53
+ configSpanBreakpoints
54
+ } = breakpointsConfig;
55
+ const spanConfig = span ? ['xs', 'sm', 'md', 'lg', 'xl', 'xxl'].map(key => [configSpanBreakpoints[key], 24 / span[key], 'horizontal']) : breakpoints[layout || 'default'];
56
+ const breakPoint = (spanConfig || breakpoints.default).find(item => width < item[0] + 16 // 16 = 2 * (ant-row -8px margin)
44
57
  );
45
58
  if (!breakPoint) {
46
59
  return {
@@ -199,12 +212,12 @@ const QueryFilterContent = props => {
199
212
  if (split && currentSpan % 24 === 0 && index < itemLength - 1) {
200
213
  return /*#__PURE__*/_jsx(Col, {
201
214
  span: colSpan,
202
- className: `${props.baseClassName}-row-split-line ${props.baseClassName}-row-split ${hashId}`.trim(),
215
+ className: clsx(`${props.baseClassName}-row-split-line`, `${props.baseClassName}-row-split`, hashId),
203
216
  children: itemDom
204
217
  }, itemKey);
205
218
  }
206
219
  return /*#__PURE__*/_jsx(Col, {
207
- className: `${props.baseClassName}-row-split ${hashId}`.trim(),
220
+ className: clsx(`${props.baseClassName}-row-split`, hashId),
208
221
  span: colSpan,
209
222
  children: itemDom
210
223
  }, itemKey);
@@ -243,7 +256,7 @@ const QueryFilterContent = props => {
243
256
  label: " ",
244
257
  colon: false,
245
258
  shouldUpdate: false,
246
- className: `${baseClassName}-actions ${hashId}`.trim(),
259
+ className: clsx(`${baseClassName}-actions`, hashId),
247
260
  children: /*#__PURE__*/_jsx(Actions, {
248
261
  hiddenNum: hiddenNum,
249
262
  collapsed: collapsed,
@@ -286,8 +299,12 @@ function QueryFilter(props) {
286
299
  wrapSSR,
287
300
  hashId
288
301
  } = useStyle(baseClassName);
302
+ const {
303
+ token
304
+ } = theme.useToken();
289
305
  const [width, setWidth] = useState(() => typeof style?.width === 'number' ? style?.width : defaultWidth);
290
- const spanSize = useMemo(() => getSpanConfig(layout, width + 16, span), [layout, width, span]);
306
+ const breakpointsConfig = useMemo(() => getBreakpointsConfig(token), [token.screenSMMin, token.screenMDMin, token.screenLGMin, token.screenXLMin, token.screenXXLMin]);
307
+ const spanSize = useMemo(() => getSpanConfig(layout, width + 16, span, breakpointsConfig), [layout, width, span, breakpointsConfig]);
291
308
  const showLength = useMemo(() => {
292
309
  if (defaultFormItemsNumber !== undefined) {
293
310
  return defaultFormItemsNumber;
@@ -327,7 +344,7 @@ function QueryFilter(props) {
327
344
  },
328
345
  children: ref => /*#__PURE__*/_jsx("div", {
329
346
  ref: ref,
330
- className: `${baseClassName}-container ${hashId}`,
347
+ className: clsx(`${baseClassName}-container`, hashId),
331
348
  style: props.containerStyle,
332
349
  children: /*#__PURE__*/_jsx(BaseForm, {
333
350
  isKeyPressSubmit: true,
@@ -208,7 +208,7 @@ function StepsForm(props) {
208
208
  })
209
209
  };
210
210
  return /*#__PURE__*/_jsx("div", {
211
- className: `${prefixCls}-steps-container ${hashId}`.trim(),
211
+ className: clsx(`${prefixCls}-steps-container`, hashId),
212
212
  style: {
213
213
  maxWidth: Math.min(formArray.length * 320, 1160)
214
214
  },
@@ -337,7 +337,7 @@ function StepsForm(props) {
337
337
  return stepsDom;
338
338
  }, [formArray, stepsDom, stepsRender]);
339
339
  const formContainer = useMemo(() => /*#__PURE__*/_jsxs("div", {
340
- className: `${prefixCls}-container ${hashId}`.trim(),
340
+ className: clsx(`${prefixCls}-container`, hashId),
341
341
  style: containerStyle,
342
342
  children: [formDom, stepsFormRender ? null : /*#__PURE__*/_jsx(Space, {
343
343
  children: submitterDom
@@ -46,11 +46,11 @@ export type ProLayoutProps = GlobalTypes & {
46
46
  * @name logo 的配置,可以配置url,React 组件 和 false
47
47
  *
48
48
  * @example 设置 logo 为网络地址 logo="https://avatars1.githubusercontent.com/u/8186664?s=460&v=4"
49
- * @example 设置 logo 为组件 logo={<img src="https://avatars1.githubusercontent.com/u/8186664?s=460&v=4"/>}
49
+ * @example 设置 logo 为组件 logo={<img src="https://avatars1.githubusercontent.com/u/8186664?s=460&v=4" alt="" />}
50
50
  * @example 设置 logo 为 false 不显示 logo logo={false}
51
- * @example 设置 logo 为 方法 logo={()=> <img src="https://avatars1.githubusercontent.com/u/8186664?s=460&v=4"/> }
51
+ * @example 设置 logo 为 方法 logo={()=> <img src="https://avatars1.githubusercontent.com/u/8186664?s=460&v=4" alt="" /> }
52
52
  * */
53
- logo?: React.ReactNode | JSX.Element | WithFalse<() => React.ReactNode | JSX.Element>;
53
+ logo?: React.ReactNode | React.JSX.Element | WithFalse<() => React.ReactNode | React.JSX.Element>;
54
54
  /**
55
55
  * @name 页面切换的时候触发
56
56
  *
@@ -164,7 +164,7 @@ const BaseProLayout = props => {
164
164
  }, [props.layout, propsSiderWidth]);
165
165
  const context = useContext(ConfigProvider.ConfigContext);
166
166
  const prefixCls = props.prefixCls ?? context.getPrefixCls('pro');
167
- const [menuLoading, setMenuLoadingInner] = useControlledState(false, menu?.loading);
167
+ const [menuLoadingState, _setMenuLoadingInner] = useControlledState(false, menu?.loading);
168
168
 
169
169
  /**
170
170
  * 使用 useRefFunction 包装回调,确保引用稳定
@@ -173,20 +173,6 @@ const BaseProLayout = props => {
173
173
  menu?.onLoadingChange?.(loading);
174
174
  });
175
175
 
176
- /**
177
- * 包装 setMenuLoading,使用 queueMicrotask 延迟回调调用
178
- * 避免在渲染阶段调用外部回调导致的 React 警告
179
- */
180
- const setMenuLoading = useCallback(updater => {
181
- setMenuLoadingInner(prev => {
182
- const next = typeof updater === 'function' ? updater(prev) : updater;
183
- queueMicrotask(() => {
184
- menuOnLoadingChange(next);
185
- });
186
- return next;
187
- });
188
- }, [menuOnLoadingChange]);
189
-
190
176
  // give a default key for swr
191
177
  const [defaultId] = useState(() => {
192
178
  layoutIndex += 1;
@@ -216,20 +202,21 @@ const BaseProLayout = props => {
216
202
  const {
217
203
  data,
218
204
  mutate,
219
- isLoading
205
+ isValidating
220
206
  } = useSWR([defaultId, menu?.params], async ([, params]) => {
221
- setMenuLoading(true);
222
- const menuDataItems = await menu?.request?.(params || {}, route?.children || route?.routes || []);
223
- setMenuLoading(false);
224
- return menuDataItems;
207
+ menuOnLoadingChange(true);
208
+ try {
209
+ const menuDataItems = await menu?.request?.(params || {}, route?.children || route?.routes || []);
210
+ return menuDataItems;
211
+ } finally {
212
+ menuOnLoadingChange(false);
213
+ }
225
214
  }, {
226
215
  revalidateOnFocus: false,
227
216
  shouldRetryOnError: false,
228
217
  revalidateOnReconnect: false
229
218
  });
230
- useEffect(() => {
231
- setMenuLoading(isLoading);
232
- }, [isLoading]);
219
+ const menuLoading = menu?.loading ?? (menu?.request ? isValidating : menuLoadingState);
233
220
  const {
234
221
  cache
235
222
  } = useSWRConfig();
@@ -414,11 +401,12 @@ const BaseProLayout = props => {
414
401
  return bgLayoutImgList?.map((item, index) => {
415
402
  return /*#__PURE__*/_jsx("img", {
416
403
  src: item.src,
404
+ alt: "",
417
405
  style: {
418
406
  position: 'absolute',
419
407
  ...item
420
408
  }
421
- }, index);
409
+ }, item.src ?? `bg-layout-${index}`);
422
410
  });
423
411
  }
424
412
  return null;
@@ -490,7 +478,7 @@ const BaseProLayout = props => {
490
478
  children: siderMenuDom
491
479
  }), /*#__PURE__*/_jsxs("div", {
492
480
  style: genLayoutStyle,
493
- className: `${proLayoutClassName}-container ${hashId}`.trim(),
481
+ className: clsx(`${proLayoutClassName}-container`, hashId),
494
482
  children: [headerDom, /*#__PURE__*/_jsx(WrapContent, {
495
483
  hasPageContainer: hasPageContainer,
496
484
  isChildrenLayout: isChildrenLayout,
@@ -1,3 +1,4 @@
1
+ import { clsx } from 'clsx';
1
2
  import React from 'react';
2
3
  import { defaultRenderLogo } from "./index";
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -10,15 +11,15 @@ export const DefaultContent = props => {
10
11
  itemClick
11
12
  } = props;
12
13
  return /*#__PURE__*/_jsx("div", {
13
- className: `${baseClassName}-content ${hashId}`.trim(),
14
+ className: clsx(`${baseClassName}-content`, hashId),
14
15
  children: /*#__PURE__*/_jsx("ul", {
15
- className: `${baseClassName}-content-list ${hashId}`.trim(),
16
+ className: clsx(`${baseClassName}-content-list`, hashId),
16
17
  children: appList?.map((app, index) => {
17
18
  if (app?.children?.length) {
18
19
  return /*#__PURE__*/_jsxs("div", {
19
- className: `${baseClassName}-content-list-item-group ${hashId}`.trim(),
20
+ className: clsx(`${baseClassName}-content-list-item-group`, hashId),
20
21
  children: [/*#__PURE__*/_jsx("div", {
21
- className: `${baseClassName}-content-list-item-group-title ${hashId}`.trim(),
22
+ className: clsx(`${baseClassName}-content-list-item-group-title`, hashId),
22
23
  children: app.title
23
24
  }), /*#__PURE__*/_jsx(DefaultContent, {
24
25
  hashId: hashId,
@@ -29,7 +30,7 @@ export const DefaultContent = props => {
29
30
  }, index);
30
31
  }
31
32
  return /*#__PURE__*/_jsx("li", {
32
- className: `${baseClassName}-content-list-item ${hashId}`.trim(),
33
+ className: clsx(`${baseClassName}-content-list-item`, hashId),
33
34
  onClick: e => {
34
35
  e.stopPropagation();
35
36
  itemClick?.(app);
@@ -1,3 +1,4 @@
1
+ import { clsx } from 'clsx';
1
2
  import React from 'react';
2
3
  import { isUrl } from "../../../utils";
3
4
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -42,15 +43,15 @@ export const SimpleContent = props => {
42
43
  itemClick
43
44
  } = props;
44
45
  return /*#__PURE__*/_jsx("div", {
45
- className: `${baseClassName}-content ${hashId}`.trim(),
46
+ className: clsx(`${baseClassName}-content`, hashId),
46
47
  children: /*#__PURE__*/_jsx("ul", {
47
- className: `${baseClassName}-content-list ${hashId}`.trim(),
48
+ className: clsx(`${baseClassName}-content-list`, hashId),
48
49
  children: appList?.map((app, index) => {
49
50
  if (app?.children?.length) {
50
51
  return /*#__PURE__*/_jsxs("div", {
51
- className: `${baseClassName}-content-list-item-group ${hashId}`.trim(),
52
+ className: clsx(`${baseClassName}-content-list-item-group`, hashId),
52
53
  children: [/*#__PURE__*/_jsx("div", {
53
- className: `${baseClassName}-content-list-item-group-title ${hashId}`.trim(),
54
+ className: clsx(`${baseClassName}-content-list-item-group-title`, hashId),
54
55
  children: app.title
55
56
  }), /*#__PURE__*/_jsx(SimpleContent, {
56
57
  hashId: hashId,
@@ -61,7 +62,7 @@ export const SimpleContent = props => {
61
62
  }, index);
62
63
  }
63
64
  return /*#__PURE__*/_jsx("li", {
64
- className: `${baseClassName}-content-list-item ${hashId}`.trim(),
65
+ className: clsx(`${baseClassName}-content-list-item`, hashId),
65
66
  onClick: e => {
66
67
  e.stopPropagation();
67
68
  itemClick?.(app);
@@ -9,7 +9,7 @@ export type FooterToolbarProps = {
9
9
  className?: string;
10
10
  renderContent?: (props: FooterToolbarProps & RouteContextType & {
11
11
  leftWidth?: string;
12
- }, dom: JSX.Element) => ReactNode;
12
+ }, dom: React.JSX.Element) => ReactNode;
13
13
  prefixCls?: string;
14
14
  stylish?: GenerateStyle<FooterToolBarToken>;
15
15
  children?: React.ReactNode;
@@ -56,10 +56,10 @@ const FooterToolbar = props => {
56
56
  });
57
57
  const dom = /*#__PURE__*/_jsxs(_Fragment, {
58
58
  children: [/*#__PURE__*/_jsx("div", {
59
- className: `${baseClassName}-left ${hashId}`.trim(),
59
+ className: clsx(`${baseClassName}-left`, hashId),
60
60
  children: extra
61
61
  }), /*#__PURE__*/_jsx("div", {
62
- className: `${baseClassName}-right ${hashId}`.trim(),
62
+ className: clsx(`${baseClassName}-right`, hashId),
63
63
  children: children
64
64
  })]
65
65
  });
@@ -24,9 +24,9 @@ const GlobalFooter = ({
24
24
  className: clsx(baseClassName, hashId, className),
25
25
  style: style,
26
26
  children: [links && /*#__PURE__*/_jsx("div", {
27
- className: `${baseClassName}-list ${hashId}`.trim(),
27
+ className: clsx(`${baseClassName}-list`, hashId),
28
28
  children: links.map(link => /*#__PURE__*/_jsx("a", {
29
- className: `${baseClassName}-list-link ${hashId}`.trim(),
29
+ className: clsx(`${baseClassName}-list-link`, hashId),
30
30
  title: link.key,
31
31
  target: link.blankTarget ? '_blank' : '_self',
32
32
  href: link.href,
@@ -34,7 +34,7 @@ const GlobalFooter = ({
34
34
  children: link.title
35
35
  }, link.key))
36
36
  }), copyright && /*#__PURE__*/_jsx("div", {
37
- className: `${baseClassName}-copyright ${hashId}`.trim(),
37
+ className: clsx(`${baseClassName}-copyright`, hashId),
38
38
  children: copyright
39
39
  })]
40
40
  }));
@@ -58,14 +58,14 @@ export const ActionsContent = ({
58
58
  const doms = actionsRender && actionsRender?.(restParams);
59
59
  if (!doms && !avatarDom) return null;
60
60
  if (!Array.isArray(doms)) return wrapSSR( /*#__PURE__*/_jsxs("div", {
61
- className: `${prefixCls}-header-actions ${hashId}`.trim(),
61
+ className: clsx(`${prefixCls}-header-actions`, hashId),
62
62
  children: [doms, avatarDom && /*#__PURE__*/_jsx("span", {
63
- className: `${prefixCls}-header-actions-avatar ${hashId}`.trim(),
63
+ className: clsx(`${prefixCls}-header-actions-avatar`, hashId),
64
64
  children: avatarDom
65
65
  })]
66
66
  }));
67
67
  return wrapSSR( /*#__PURE__*/_jsxs("div", {
68
- className: `${prefixCls}-header-actions ${hashId}`.trim(),
68
+ className: clsx(`${prefixCls}-header-actions`, hashId),
69
69
  children: [doms.filter(Boolean).map((dom, index) => {
70
70
  let hideHover = false;
71
71
  // 如果配置了 hideHover 就不展示 hover 效果了
@@ -73,13 +73,13 @@ export const ActionsContent = ({
73
73
  hideHover = !!dom?.props?.['aria-hidden'];
74
74
  }
75
75
  return /*#__PURE__*/_jsx("div", {
76
- className: clsx(`${prefixCls}-header-actions-item ${hashId}`, {
76
+ className: clsx(`${prefixCls}-header-actions-item`, hashId, {
77
77
  [`${prefixCls}-header-actions-hover`]: !hideHover
78
78
  }),
79
79
  children: dom
80
80
  }, index);
81
81
  }), avatarDom && /*#__PURE__*/_jsx("span", {
82
- className: `${prefixCls}-header-actions-avatar ${hashId}`.trim(),
82
+ className: clsx(`${prefixCls}-header-actions-avatar`, hashId),
83
83
  children: avatarDom
84
84
  })]
85
85
  }));
@@ -90,7 +90,7 @@ export const ActionsContent = ({
90
90
  }, 160);
91
91
  const contentRender = rightActionsRender;
92
92
  return /*#__PURE__*/_jsx("div", {
93
- className: `${prefixCls}-right-content ${hashId}`.trim(),
93
+ className: clsx(`${prefixCls}-right-content`, hashId),
94
94
  style: {
95
95
  minWidth: rightSize,
96
96
  height: '100%'
@@ -77,7 +77,7 @@ const GlobalHeader = props => {
77
77
  ...style
78
78
  },
79
79
  children: [isMobile && /*#__PURE__*/_jsx("span", {
80
- className: `${baseClassName}-collapsed-button ${hashId}`.trim(),
80
+ className: clsx(`${baseClassName}-collapsed-button`, hashId),
81
81
  onClick: () => {
82
82
  onCollapse?.(!collapsed);
83
83
  },
@@ -35,7 +35,7 @@ const GridContent = props => {
35
35
  }),
36
36
  style: style,
37
37
  children: /*#__PURE__*/_jsx("div", {
38
- className: `${prefixCls}-grid-content-children ${hashId}`.trim(),
38
+ className: clsx(`${prefixCls}-grid-content-children`, hashId),
39
39
  children: children
40
40
  })
41
41
  }));
@@ -1,6 +1,7 @@
1
1
  import { CloseOutlined, ProfileOutlined } from '@ant-design/icons';
2
2
  import { useControlledState } from '@rc-component/util';
3
3
  import { Card, ConfigProvider, Menu } from 'antd';
4
+ import { clsx } from 'clsx';
4
5
  import React, { useCallback, useContext, useMemo, useState } from 'react';
5
6
  import { ProProvider, isNeedOpenHash } from "../../../provider";
6
7
  import { ProHelpProvide } from "./HelpProvide";
@@ -77,7 +78,7 @@ export const ProHelpPanel = ({
77
78
  const parentKey = useMemo(() => dataSourceKeyMap.get(selectedKey)?.parentKey, [dataSourceKeyMap, selectedKey]);
78
79
  const defaultExtraActions = {
79
80
  collapsePanelAction: /*#__PURE__*/_jsx("div", {
80
- className: `${className}-actions-item ${hashId}`.trim(),
81
+ className: clsx(`${className}-actions-item`, hashId),
81
82
  children: /*#__PURE__*/_jsx(ProfileOutlined, {
82
83
  title: "collapse panel",
83
84
  onClick: () => {
@@ -86,8 +87,8 @@ export const ProHelpPanel = ({
86
87
  })
87
88
  }),
88
89
  helpSelectAction: /*#__PURE__*/_jsx(ProHelpSelect, {
89
- iconClassName: `${className}-actions-item`,
90
- className: `${hashId} ${className}-actions-input`,
90
+ iconClassName: clsx(`${className}-actions-item`, hashId),
91
+ className: clsx(hashId, `${className}-actions-input`),
91
92
  value: selectedKey,
92
93
  onChange: (value, item) => {
93
94
  setSelectedKey(value);
@@ -95,7 +96,7 @@ export const ProHelpPanel = ({
95
96
  }
96
97
  }),
97
98
  closeAction: /*#__PURE__*/_jsx("div", {
98
- className: `${className}-actions-item ${hashId}`.trim(),
99
+ className: clsx(`${className}-actions-item`, hashId),
99
100
  children: /*#__PURE__*/_jsx(CloseOutlined, {
100
101
  title: "close panel",
101
102
  onClick: () => {
@@ -106,7 +107,7 @@ export const ProHelpPanel = ({
106
107
  };
107
108
  const extraDomList = () => {
108
109
  return /*#__PURE__*/_jsx("div", {
109
- className: `${className}-actions ${hashId}`.trim(),
110
+ className: clsx(`${className}-actions`, hashId),
110
111
  children: extraRender ? extraRender(defaultExtraActions.collapsePanelAction, defaultExtraActions.helpSelectAction, defaultExtraActions.closeAction) : /*#__PURE__*/_jsxs(_Fragment, {
111
112
  children: [defaultExtraActions.collapsePanelAction, defaultExtraActions.helpSelectAction, onClose ? defaultExtraActions.closeAction : null]
112
113
  })
@@ -132,7 +133,7 @@ export const ProHelpPanel = ({
132
133
  size: "small",
133
134
  extra: extraDomList(),
134
135
  children: [showLeftPanel ? /*#__PURE__*/_jsx("div", {
135
- className: `${hashId} ${className}-left-panel `,
136
+ className: clsx(hashId, `${className}-left-panel`),
136
137
  style: {
137
138
  height
138
139
  },
@@ -162,7 +163,7 @@ export const ProHelpPanel = ({
162
163
  }
163
164
  },
164
165
  children: /*#__PURE__*/_jsx(Menu, {
165
- className: `${hashId} ${className}-left-panel-menu`,
166
+ className: clsx(hashId, `${className}-left-panel-menu`),
166
167
  openKeys: [parentKey, openKey],
167
168
  onOpenChange: keys => {
168
169
  setOpenKey(keys.at(-1) || '');
@@ -189,17 +190,17 @@ export const ProHelpPanel = ({
189
190
  })
190
191
  })
191
192
  }) : null, /*#__PURE__*/_jsxs("div", {
192
- className: `${hashId} ${className}-content-panel`,
193
+ className: clsx(hashId, `${className}-content-panel`),
193
194
  style: {
194
195
  height
195
196
  },
196
197
  children: [selectedKey ? /*#__PURE__*/_jsx(ProHelpContentPanel, {
197
198
  parentItem: dataSourceKeyMap.get(parentKey),
198
- className: `${className}-content-render`,
199
+ className: clsx(`${className}-content-render`, hashId),
199
200
  selectedKey: selectedKey,
200
201
  onScroll: key => setSelectedKey(key)
201
202
  }) : null, footer ? /*#__PURE__*/_jsx("div", {
202
- className: `${hashId} ${className}-footer`,
203
+ className: clsx(hashId, `${className}-footer`),
203
204
  children: footer
204
205
  }) : null]
205
206
  })]
@@ -36,7 +36,7 @@ const renderFooter = ({
36
36
  }) => {
37
37
  if (Array.isArray(tabList) || tabBarExtraContent) {
38
38
  return /*#__PURE__*/_jsx(Tabs, {
39
- className: `${prefixedClassName}-tabs ${hashId}`.trim(),
39
+ className: clsx(`${prefixedClassName}-tabs`, hashId),
40
40
  activeKey: tabActiveKey,
41
41
  onChange: key => {
42
42
  if (onTabChange) {
@@ -59,16 +59,16 @@ const renderPageHeader = (content, extraContent, prefixedClassName, hashId) => {
59
59
  return null;
60
60
  }
61
61
  return /*#__PURE__*/_jsx("div", {
62
- className: `${prefixedClassName}-detail ${hashId}`.trim(),
62
+ className: clsx(`${prefixedClassName}-detail`, hashId),
63
63
  children: /*#__PURE__*/_jsx("div", {
64
- className: `${prefixedClassName}-main ${hashId}`.trim(),
64
+ className: clsx(`${prefixedClassName}-main`, hashId),
65
65
  children: /*#__PURE__*/_jsxs("div", {
66
- className: `${prefixedClassName}-row ${hashId}`.trim(),
66
+ className: clsx(`${prefixedClassName}-row`, hashId),
67
67
  children: [content && /*#__PURE__*/_jsx("div", {
68
- className: `${prefixedClassName}-content ${hashId}`.trim(),
68
+ className: clsx(`${prefixedClassName}-content`, hashId),
69
69
  children: content
70
70
  }), extraContent && /*#__PURE__*/_jsx("div", {
71
- className: `${prefixedClassName}-extraContent ${hashId}`.trim(),
71
+ className: clsx(`${prefixedClassName}-extraContent`, hashId),
72
72
  children: extraContent
73
73
  })]
74
74
  })
@@ -155,7 +155,7 @@ const memoRenderPageHeader = props => {
155
155
  }
156
156
  return /*#__PURE__*/_jsx(PageHeader, {
157
157
  ...pageHeaderProps,
158
- className: `${prefixedClassName}-warp-page-header ${hashId}`.trim(),
158
+ className: clsx(`${prefixedClassName}-warp-page-header`, hashId),
159
159
  breadcrumb: breadcrumbRender === false ? undefined : {
160
160
  ...pageHeaderProps.breadcrumb,
161
161
  ...value.breadcrumbProps
@@ -276,9 +276,9 @@ const PageContainerBase = props => {
276
276
  _jsx(Affix, {
277
277
  offsetTop: value.hasHeader && value.fixedHeader ? token.layout?.header?.heightLayoutHeader : 1,
278
278
  ...affixProps,
279
- className: `${basePageContainer}-affix ${hashId}`.trim(),
279
+ className: clsx(`${basePageContainer}-affix`, hashId),
280
280
  children: /*#__PURE__*/_jsx("div", {
281
- className: `${basePageContainer}-warp ${hashId}`.trim(),
281
+ className: clsx(`${basePageContainer}-warp`, hashId),
282
282
  children: pageHeaderDom
283
283
  })
284
284
  }) : pageHeaderDom, renderContentDom && /*#__PURE__*/_jsx(GridContent, {