@ant-design/pro-components 3.1.4-0 → 3.1.5-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 (198) 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/DatePicker/index.js +13 -1
  15. package/es/field/components/Digit/index.js +20 -3
  16. package/es/field/components/Money/index.js +51 -3
  17. package/es/field/components/Password/index.js +12 -11
  18. package/es/field/components/Radio/index.js +5 -1
  19. package/es/field/components/Segmented/index.js +2 -1
  20. package/es/field/components/Select/index.d.ts +1 -1
  21. package/es/field/components/Select/index.js +1 -1
  22. package/es/field/components/Switch/index.js +10 -2
  23. package/es/field/components/Text/index.js +7 -1
  24. package/es/field/components/TextArea/index.js +6 -3
  25. package/es/field/components/TimePicker/index.js +10 -1
  26. package/es/field/components/TreeSelect/index.d.ts +2 -12
  27. package/es/field/components/TreeSelect/index.js +31 -17
  28. package/es/form/BaseForm/BaseForm.js +4 -3
  29. package/es/form/BaseForm/Submitter/index.d.ts +1 -1
  30. package/es/form/components/Digit/DigitRange.js +5 -2
  31. package/es/form/components/Digit/index.js +7 -2
  32. package/es/form/components/FormItem/FormItemRender/index.d.ts +1 -1
  33. package/es/form/components/FormItem/FormItemRender/index.js +10 -2
  34. package/es/form/components/FormItem/Group/index.js +1 -1
  35. package/es/form/components/List/ListContainer.js +2 -1
  36. package/es/form/components/Select/index.js +11 -1
  37. package/es/form/layouts/DrawerForm/index.d.ts +4 -4
  38. package/es/form/layouts/DrawerForm/index.js +1 -1
  39. package/es/form/layouts/LightFilter/index.js +5 -5
  40. package/es/form/layouts/LoginForm/index.js +8 -8
  41. package/es/form/layouts/LoginFormPage/index.js +15 -15
  42. package/es/form/layouts/ModalForm/index.d.ts +2 -2
  43. package/es/form/layouts/ProForm/index.d.ts +1 -1
  44. package/es/form/layouts/QueryFilter/Actions.js +2 -1
  45. package/es/form/layouts/QueryFilter/index.js +40 -23
  46. package/es/form/layouts/StepsForm/index.js +2 -2
  47. package/es/layout/ProLayout.d.ts +1 -1
  48. package/es/layout/ProLayout.js +1 -1
  49. package/es/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
  50. package/es/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
  51. package/es/layout/components/FooterToolbar/index.d.ts +1 -1
  52. package/es/layout/components/FooterToolbar/index.js +2 -2
  53. package/es/layout/components/GlobalFooter/index.js +3 -3
  54. package/es/layout/components/GlobalHeader/ActionsContent.js +6 -6
  55. package/es/layout/components/GlobalHeader/index.js +1 -1
  56. package/es/layout/components/GridContent/index.js +1 -1
  57. package/es/layout/components/Help/ProHelpPanel.js +11 -10
  58. package/es/layout/components/PageContainer/index.js +9 -9
  59. package/es/layout/components/PageHeader/index.js +10 -10
  60. package/es/layout/components/SettingDrawer/BlockCheckbox.js +2 -2
  61. package/es/layout/components/SettingDrawer/LayoutChange.js +3 -2
  62. package/es/layout/components/SettingDrawer/RegionalChange.js +3 -2
  63. package/es/layout/components/SettingDrawer/ThemeColor.js +3 -2
  64. package/es/layout/components/SettingDrawer/index.js +5 -4
  65. package/es/layout/components/SiderMenu/BaseMenu.js +3 -3
  66. package/es/layout/components/SiderMenu/SiderMenu.js +5 -5
  67. package/es/layout/components/TopNavHeader/index.js +3 -3
  68. package/es/layout/utils/getBreadcrumbProps.js +1 -1
  69. package/es/list/Item.d.ts +3 -3
  70. package/es/list/Item.js +8 -1
  71. package/es/list/ListView.js +1 -2
  72. package/es/list/ProListBase.d.ts +1 -1
  73. package/es/list/ProListBase.js +29 -21
  74. package/es/list/style/index.js +13 -0
  75. package/es/provider/index.d.ts +2 -2
  76. package/es/table/Table.js +14 -5
  77. package/es/table/components/Alert/index.js +6 -5
  78. package/es/table/components/ColumnSetting/index.js +9 -9
  79. package/es/table/components/DragSortTable/index.js +8 -4
  80. package/es/table/components/EditableTable/index.d.ts +1 -1
  81. package/es/table/components/EditableTable/index.js +6 -7
  82. package/es/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
  83. package/es/table/components/ListToolBar/HeaderMenu.js +4 -3
  84. package/es/table/components/ListToolBar/index.js +15 -12
  85. package/es/table/components/ListToolBar/style.js +2 -2
  86. package/es/table/useFetchData.js +4 -1
  87. package/es/table/utils/cellRenderToFromItem.js +1 -1
  88. package/es/table/utils/useDragSort.js +1 -1
  89. package/es/utils/components/DropdownFooter/index.d.ts +1 -1
  90. package/es/utils/components/FieldLabel/index.js +1 -1
  91. package/es/utils/components/FilterDropdown/index.d.ts +1 -1
  92. package/es/utils/components/FilterDropdown/index.js +1 -1
  93. package/es/utils/components/InlineErrorFormItem/index.js +5 -4
  94. package/es/utils/components/LabelIconTip/index.js +2 -2
  95. package/es/utils/hooks/useFetchData/index.js +0 -2
  96. package/es/utils/isUrl/index.js +1 -1
  97. package/es/utils/proFieldParsingText/index.d.ts +2 -2
  98. package/es/utils/proFieldParsingText/index.js +2 -2
  99. package/guidelines/components/pro-card.md +5 -4
  100. package/lib/card/ProCard.js +15 -7
  101. package/lib/card/components/Card/index.js +43 -19
  102. package/lib/card/components/Card/style.js +12 -1
  103. package/lib/card/components/Statistic/index.js +2 -2
  104. package/lib/card/components/StatisticCard/index.js +1 -1
  105. package/lib/card/typing.d.ts +27 -8
  106. package/lib/field/AllProField.d.ts +2 -0
  107. package/lib/field/AllProField.js +3 -0
  108. package/lib/field/PureProField.d.ts +2 -0
  109. package/lib/field/PureProField.js +2 -0
  110. package/lib/field/components/Cascader/index.js +8 -1
  111. package/lib/field/components/Checkbox/index.js +5 -1
  112. package/lib/field/components/DatePicker/index.js +13 -1
  113. package/lib/field/components/Digit/index.js +20 -3
  114. package/lib/field/components/Money/index.js +50 -2
  115. package/lib/field/components/Password/index.js +11 -10
  116. package/lib/field/components/Percent/util.d.ts +1 -1
  117. package/lib/field/components/Radio/index.js +5 -1
  118. package/lib/field/components/Segmented/index.js +2 -1
  119. package/lib/field/components/Select/index.d.ts +1 -1
  120. package/lib/field/components/Select/index.js +1 -1
  121. package/lib/field/components/Switch/index.js +10 -2
  122. package/lib/field/components/Text/index.js +7 -1
  123. package/lib/field/components/TextArea/index.js +6 -3
  124. package/lib/field/components/TimePicker/index.js +10 -1
  125. package/lib/field/components/TreeSelect/index.d.ts +2 -12
  126. package/lib/field/components/TreeSelect/index.js +30 -16
  127. package/lib/form/BaseForm/BaseForm.js +4 -3
  128. package/lib/form/BaseForm/Submitter/index.d.ts +1 -1
  129. package/lib/form/components/Digit/DigitRange.js +5 -2
  130. package/lib/form/components/Digit/index.js +7 -2
  131. package/lib/form/components/FormItem/FormItemRender/index.d.ts +1 -1
  132. package/lib/form/components/FormItem/FormItemRender/index.js +10 -2
  133. package/lib/form/components/FormItem/Group/index.js +1 -1
  134. package/lib/form/components/List/ListContainer.js +2 -1
  135. package/lib/form/components/Select/index.js +11 -1
  136. package/lib/form/layouts/DrawerForm/index.d.ts +4 -4
  137. package/lib/form/layouts/DrawerForm/index.js +1 -1
  138. package/lib/form/layouts/LightFilter/index.js +5 -5
  139. package/lib/form/layouts/LoginForm/index.js +8 -8
  140. package/lib/form/layouts/LoginFormPage/index.js +15 -15
  141. package/lib/form/layouts/ModalForm/index.d.ts +2 -2
  142. package/lib/form/layouts/ProForm/index.d.ts +1 -1
  143. package/lib/form/layouts/QueryFilter/Actions.js +2 -1
  144. package/lib/form/layouts/QueryFilter/index.js +39 -22
  145. package/lib/form/layouts/StepsForm/index.js +2 -2
  146. package/lib/layout/ProLayout.d.ts +1 -1
  147. package/lib/layout/ProLayout.js +1 -1
  148. package/lib/layout/components/AppsLogoComponents/DefaultContent.js +6 -5
  149. package/lib/layout/components/AppsLogoComponents/SimpleContent.js +6 -5
  150. package/lib/layout/components/FooterToolbar/index.d.ts +1 -1
  151. package/lib/layout/components/FooterToolbar/index.js +2 -2
  152. package/lib/layout/components/GlobalFooter/index.js +3 -3
  153. package/lib/layout/components/GlobalHeader/ActionsContent.js +6 -6
  154. package/lib/layout/components/GlobalHeader/index.js +1 -1
  155. package/lib/layout/components/GridContent/index.js +1 -1
  156. package/lib/layout/components/Help/ProHelpPanel.js +11 -10
  157. package/lib/layout/components/PageContainer/index.js +9 -9
  158. package/lib/layout/components/PageHeader/index.js +10 -10
  159. package/lib/layout/components/SettingDrawer/BlockCheckbox.js +2 -2
  160. package/lib/layout/components/SettingDrawer/LayoutChange.js +3 -2
  161. package/lib/layout/components/SettingDrawer/RegionalChange.js +3 -2
  162. package/lib/layout/components/SettingDrawer/ThemeColor.js +3 -2
  163. package/lib/layout/components/SettingDrawer/index.js +5 -4
  164. package/lib/layout/components/SiderMenu/BaseMenu.js +3 -3
  165. package/lib/layout/components/SiderMenu/SiderMenu.js +5 -5
  166. package/lib/layout/components/TopNavHeader/index.js +3 -3
  167. package/lib/layout/utils/getBreadcrumbProps.js +1 -1
  168. package/lib/list/Item.d.ts +3 -3
  169. package/lib/list/Item.js +8 -1
  170. package/lib/list/ListView.js +1 -2
  171. package/lib/list/ProListBase.d.ts +1 -1
  172. package/lib/list/ProListBase.js +28 -20
  173. package/lib/list/style/index.js +13 -0
  174. package/lib/provider/index.d.ts +2 -2
  175. package/lib/table/Table.js +14 -5
  176. package/lib/table/components/Alert/index.js +6 -5
  177. package/lib/table/components/ColumnSetting/index.js +9 -9
  178. package/lib/table/components/DragSortTable/index.js +8 -4
  179. package/lib/table/components/EditableTable/index.d.ts +1 -1
  180. package/lib/table/components/EditableTable/index.js +6 -7
  181. package/lib/table/components/ListToolBar/HeaderMenu.d.ts +1 -0
  182. package/lib/table/components/ListToolBar/HeaderMenu.js +4 -3
  183. package/lib/table/components/ListToolBar/index.js +15 -12
  184. package/lib/table/components/ListToolBar/style.js +2 -2
  185. package/lib/table/useFetchData.js +4 -1
  186. package/lib/table/utils/cellRenderToFromItem.js +1 -1
  187. package/lib/table/utils/useDragSort.js +1 -1
  188. package/lib/utils/components/DropdownFooter/index.d.ts +1 -1
  189. package/lib/utils/components/FieldLabel/index.js +1 -1
  190. package/lib/utils/components/FilterDropdown/index.d.ts +1 -1
  191. package/lib/utils/components/FilterDropdown/index.js +1 -1
  192. package/lib/utils/components/InlineErrorFormItem/index.js +5 -4
  193. package/lib/utils/components/LabelIconTip/index.js +2 -2
  194. package/lib/utils/hooks/useFetchData/index.js +0 -2
  195. package/lib/utils/isUrl/index.js +1 -1
  196. package/lib/utils/proFieldParsingText/index.d.ts +2 -2
  197. package/lib/utils/proFieldParsingText/index.js +2 -2
  198. package/package.json +31 -30
@@ -42,7 +42,7 @@ export const getBreadcrumb = (breadcrumbMap, url) => {
42
42
  try {
43
43
  if (path?.startsWith('http')) return false;
44
44
  return match(path.replace('?', ''))(url);
45
- } catch (error) {
45
+ } catch (_error) {
46
46
  return false;
47
47
  }
48
48
  }
package/es/list/Item.d.ts CHANGED
@@ -6,7 +6,7 @@ import type { ListGridType } from './ProListBase';
6
6
  export type RenderExpandIconProps<RecordType> = {
7
7
  prefixCls: string;
8
8
  expanded: boolean;
9
- expandIcon: React.ReactNode | JSX.Element | ((props: {
9
+ expandIcon: React.ReactNode | React.JSX.Element | ((props: {
10
10
  onExpand: (expanded: boolean) => void;
11
11
  expanded: boolean;
12
12
  record: RecordType;
@@ -48,8 +48,8 @@ export type ItemProps<RecordType> = {
48
48
  record: RecordType;
49
49
  onRow?: GetComponentProps<RecordType>;
50
50
  onItem?: GetComponentProps<RecordType>;
51
- itemHeaderRender?: ((item: RecordType, index: number, defaultDom: JSX.Element | null) => React.ReactNode) | false;
52
- itemTitleRender?: ((item: RecordType, index: number, defaultDom: JSX.Element | null) => React.ReactNode) | false;
51
+ itemHeaderRender?: ((item: RecordType, index: number, defaultDom: React.JSX.Element | null) => React.ReactNode) | false;
52
+ itemTitleRender?: ((item: RecordType, index: number, defaultDom: React.JSX.Element | null) => React.ReactNode) | false;
53
53
  };
54
54
  declare function ProListItem<RecordType>(props: ItemProps<RecordType>): import("react/jsx-runtime").JSX.Element;
55
55
  export default ProListItem;
package/es/list/Item.js CHANGED
@@ -220,7 +220,14 @@ function ProListItem(props) {
220
220
  expanded,
221
221
  record
222
222
  })]
223
- }), headerDom, actionsArray]
223
+ }), headerDom, actionsArray && actionsArray.length > 0 ? /*#__PURE__*/_jsx("div", {
224
+ className: clsx(`${prefixCls}-item-action`, hashId),
225
+ onClick: e => e.stopPropagation(),
226
+ children: actionsArray.map((action, i) => /*#__PURE__*/_jsx("div", {
227
+ className: clsx(`${prefixCls}-item-action-item`, hashId),
228
+ children: action
229
+ }, i))
230
+ }) : null]
224
231
  }), needExpanded && (content || expandedRowDom) && /*#__PURE__*/_jsxs("div", {
225
232
  className: clsx(`${className}-content`, hashId),
226
233
  children: [content, expandedRowRender && rowSupportExpand && /*#__PURE__*/_jsx("div", {
@@ -59,8 +59,7 @@ function ListView(props) {
59
59
  current = 1,
60
60
  pageSize = 10
61
61
  } = mergedPagination;
62
- const currentPageData = dataSource.slice((current - 1) * pageSize, current * pageSize);
63
- return currentPageData;
62
+ return dataSource.slice((current - 1) * pageSize, current * pageSize);
64
63
  }, [dataSource, mergedPagination, pagination]);
65
64
  const prefixCls = getPrefixCls('pro-list', customizePrefixCls);
66
65
 
@@ -35,7 +35,7 @@ export interface ListProps<T = any> {
35
35
  pagination?: PaginationConfig | false;
36
36
  prefixCls?: string;
37
37
  rowKey?: ((item: T) => React.Key) | keyof T;
38
- renderItem?: (item: T, index: number, defaultDom: JSX.Element | null) => React.ReactNode;
38
+ renderItem?: (item: T, index: number, defaultDom: React.JSX.Element | null) => React.ReactNode;
39
39
  size?: ListSize;
40
40
  split?: boolean;
41
41
  header?: React.ReactNode;
@@ -2,10 +2,9 @@
2
2
  * 内部 List 容器与 List.Item / List.Item.Meta 实现,用于替代 antd List(antd List 已停止维护)
3
3
  * 保持与 antd List 相同的 DOM 结构及类名,以便复用 antd 的 list 样式
4
4
  */
5
- import { ConfigProvider, Empty, Pagination } from 'antd';
5
+ import { ConfigProvider, Empty, Grid, Pagination } from 'antd';
6
6
  import { clsx } from 'clsx';
7
7
  import React, { useContext, useMemo } from 'react';
8
- import { useBreakpoint } from "../utils/useMediaQuery";
9
8
  import { jsx as _jsx } from "react/jsx-runtime";
10
9
  import { jsxs as _jsxs } from "react/jsx-runtime";
11
10
  import { Fragment as _Fragment } from "react/jsx-runtime";
@@ -179,29 +178,41 @@ const ProListContainerInner = /*#__PURE__*/React.forwardRef(function ProListCont
179
178
  children: renderItem(item, index, null)
180
179
  }, key);
181
180
  };
182
- const breakpoint = useBreakpoint();
181
+ const rawScreens = Grid.useBreakpoint();
182
+ const defaultScreens = {
183
+ xs: true,
184
+ sm: true,
185
+ md: true,
186
+ lg: false,
187
+ xl: false,
188
+ xxl: false
189
+ };
190
+ const screens = useMemo(() => {
191
+ if (rawScreens == null) return defaultScreens;
192
+ return {
193
+ xxl: rawScreens.xxl ?? defaultScreens.xxl,
194
+ xl: rawScreens.xl ?? defaultScreens.xl,
195
+ lg: rawScreens.lg ?? defaultScreens.lg,
196
+ md: rawScreens.md ?? defaultScreens.md,
197
+ sm: rawScreens.sm ?? defaultScreens.sm,
198
+ xs: rawScreens.xs ?? defaultScreens.xs
199
+ };
200
+ }, [rawScreens]);
183
201
 
184
202
  /**
185
- * 根据当前断点获取列数
203
+ * 根据当前断点获取列数,与 antd Grid/Card 响应式逻辑一致
186
204
  */
187
205
  const getResponsiveColumn = useMemo(() => {
188
206
  if (!grid) return 1;
189
- const breakpoints = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
190
- const currentBreakpoint = breakpoint || 'md';
191
- const startIndex = breakpoints.indexOf(currentBreakpoint);
192
-
193
- // 从当前断点开始,向下查找第一个已定义的列数
194
- for (let i = startIndex; i < breakpoints.length; i++) {
195
- const bp = breakpoints[i];
196
- const colCount = grid[bp];
197
- if (colCount !== undefined) {
198
- return colCount;
207
+ const responsiveArray = ['xxl', 'xl', 'lg', 'md', 'sm', 'xs'];
208
+ for (let i = 0; i < responsiveArray.length; i += 1) {
209
+ const breakpoint = responsiveArray[i];
210
+ if (screens[breakpoint] && grid[breakpoint] !== undefined) {
211
+ return grid[breakpoint];
199
212
  }
200
213
  }
201
-
202
- // 最后使用 column 默认值,确保不为 0(避免除以零)
203
214
  return grid.column || 1;
204
- }, [grid, breakpoint]);
215
+ }, [grid, screens]);
205
216
 
206
217
  /**
207
218
  * 计算 grid 容器样式(flex 布局)
@@ -274,10 +285,7 @@ const ProListContainerInner = /*#__PURE__*/React.forwardRef(function ProListCont
274
285
  style: colStyle,
275
286
  children: child
276
287
  }, child?.key ?? idx))
277
- }) : /*#__PURE__*/_jsx("ul", {
278
- className: `${prefixCls}-items`,
279
- children: items
280
- });
288
+ }) : items;
281
289
  } else if (!children && !isLoading) {
282
290
  const emptyContent = locale?.emptyText ?? (typeof renderEmpty === 'function' ? renderEmpty('List') : null) ?? /*#__PURE__*/_jsx(Empty, {
283
291
  description: "\u6682\u65E0\u6570\u636E"
@@ -20,6 +20,16 @@ const genProListStyle = token => {
20
20
  boxSizing: 'border-box'
21
21
  },
22
22
  backgroundColor: 'transparent',
23
+ // 确保链接使用默认链接颜色,不被父元素的文本颜色覆盖
24
+ a: {
25
+ color: token.colorLink,
26
+ '&:hover': {
27
+ color: token.colorLinkHover
28
+ },
29
+ '&:active': {
30
+ color: token.colorLinkActive
31
+ }
32
+ },
23
33
  [`${token.proComponentsCls}-table-alert`]: {
24
34
  marginBlockEnd: token.margin
25
35
  },
@@ -323,6 +333,9 @@ const genProListStyle = token => {
323
333
  justifyContent: 'flex-start',
324
334
  width: '100%',
325
335
  minWidth: 0,
336
+ [`${token.proComponentsCls}-list-item-action`]: {
337
+ alignSelf: 'center'
338
+ },
326
339
  h4: {
327
340
  margin: 0,
328
341
  padding: 0,
@@ -75,7 +75,7 @@ export type ProRenderFieldPropsType = {
75
75
  * @params dom 默认的 dom
76
76
  * @return 返回一个用于读的 dom
77
77
  */
78
- render?: ((text: any, props: Omit<ProFieldFCRenderProps, 'value' | 'onChange'>, dom: JSX.Element) => JSX.Element) | undefined;
78
+ render?: ((text: any, props: Omit<ProFieldFCRenderProps, 'value' | 'onChange'>, dom: React.JSX.Element) => React.JSX.Element) | undefined;
79
79
  /**
80
80
  * 一个自定义的编辑渲染器。
81
81
  * @params text 默认的值类型
@@ -83,7 +83,7 @@ export type ProRenderFieldPropsType = {
83
83
  * @params dom 默认的 dom
84
84
  * @return 返回一个用于编辑的dom
85
85
  */
86
- formItemRender?: ((text: any, props: ProFieldFCRenderProps, dom: JSX.Element) => JSX.Element) | undefined;
86
+ formItemRender?: ((text: any, props: ProFieldFCRenderProps, dom: React.JSX.Element) => React.JSX.Element) | undefined;
87
87
  };
88
88
  export type ParamsType = Record<string, any>;
89
89
  /**
package/es/table/Table.js CHANGED
@@ -716,19 +716,28 @@ const ProTable = props => {
716
716
  hideToolbar,
717
717
  toolbarDom
718
718
  });
719
- const tableAreaDom = cardProps === false || notNeedCardDom || !!props.name ? tableContentDom : /*#__PURE__*/_jsx(ProCard, {
719
+
720
+ /** ProTable:有搜索/工具栏/标题时使用卡片包裹;可编辑表格(name)不包裹 */
721
+ /** ProList:始终使用卡片包裹(除非 cardProps 为 false) */
722
+ const useCard = useMemo(() => {
723
+ const useCardForTable = cardProps !== false && !props.name && !notNeedCardDom;
724
+ const useCardForList = cardProps !== false && type === 'list';
725
+ return useCardForTable || useCardForList;
726
+ }, [cardProps, props.name, type, notNeedCardDom]);
727
+ const resolvedCardProps = cardProps === false ? {} : cardProps ?? {};
728
+ const tableAreaDom = useCard ? /*#__PURE__*/_jsx(ProCard, {
729
+ ...resolvedCardProps,
720
730
  ghost: ghost,
721
731
  variant: isBordered('table', cardBordered) ? 'outlined' : 'borderless',
722
732
  styles: {
723
733
  body: {
724
734
  ...cardBodyStyle,
725
- ...(cardProps?.styles?.body ?? {})
735
+ ...(resolvedCardProps.styles?.body ?? {})
726
736
  },
727
- header: cardProps?.styles?.header
737
+ header: resolvedCardProps.styles?.header
728
738
  },
729
- ...cardProps,
730
739
  children: tableContentDom
731
- });
740
+ }) : tableContentDom;
732
741
  const renderTable = () => {
733
742
  if (props.tableRender) {
734
743
  return props.tableRender(props, tableAreaDom, {
@@ -1,4 +1,5 @@
1
1
  import { ConfigProvider, Space } from 'antd';
2
+ import { clsx } from 'clsx';
2
3
  import React, { useContext } from 'react';
3
4
  import { useIntl } from "../../../provider";
4
5
  import { useStyle } from "./style";
@@ -54,16 +55,16 @@ function TableAlert({
54
55
  return null;
55
56
  }
56
57
  return wrapSSR( /*#__PURE__*/_jsx("div", {
57
- className: `${className} ${hashId}`.trim(),
58
+ className: clsx(className, hashId),
58
59
  children: /*#__PURE__*/_jsx("div", {
59
- className: `${className}-container ${hashId}`.trim(),
60
+ className: clsx(`${className}-container`, hashId),
60
61
  children: /*#__PURE__*/_jsxs("div", {
61
- className: `${className}-info ${hashId}`.trim(),
62
+ className: clsx(`${className}-info`, hashId),
62
63
  children: [/*#__PURE__*/_jsx("div", {
63
- className: `${className}-info-content ${hashId}`.trim(),
64
+ className: clsx(`${className}-info-content`, hashId),
64
65
  children: dom
65
66
  }), option ? /*#__PURE__*/_jsx("div", {
66
- className: `${className}-info-option ${hashId}`.trim(),
67
+ className: clsx(`${className}-info-option`, hashId),
67
68
  children: option
68
69
  }) : null]
69
70
  })
@@ -58,7 +58,7 @@ const CheckboxListItem = ({
58
58
  hashId
59
59
  } = useContext(ProProvider);
60
60
  const dom = /*#__PURE__*/_jsxs("span", {
61
- className: `${className}-list-item-option ${hashId}`.trim(),
61
+ className: clsx(`${className}-list-item-option`, hashId),
62
62
  children: [/*#__PURE__*/_jsx(ToolTipIcon, {
63
63
  columnKey: columnKey,
64
64
  fixed: "left",
@@ -80,9 +80,9 @@ const CheckboxListItem = ({
80
80
  })]
81
81
  });
82
82
  return /*#__PURE__*/_jsxs("span", {
83
- className: `${className}-list-item ${hashId}`.trim(),
83
+ className: clsx(`${className}-list-item`, hashId),
84
84
  children: [/*#__PURE__*/_jsx("div", {
85
- className: `${className}-list-item-title ${hashId}`.trim(),
85
+ className: clsx(`${className}-list-item-title`, hashId),
86
86
  children: title
87
87
  }), showListItemOption && !isLeaf ? dom : null]
88
88
  }, columnKey);
@@ -113,7 +113,7 @@ const CheckboxList = ({
113
113
  const treeMap = new Map();
114
114
  const loopData = (data, parentConfig) => data.map(({
115
115
  key,
116
- dataIndex,
116
+ dataIndex: _dataIndex,
117
117
  children,
118
118
  ...rest
119
119
  }) => {
@@ -261,13 +261,13 @@ const CheckboxList = ({
261
261
  },
262
262
  height: listHeight,
263
263
  treeData: treeDataConfig.list?.map(({
264
- disabled /* 不透传 disabled,使子节点禁用时也可以拖动调整顺序 */,
264
+ disabled: _disabled /* 不透传 disabled,使子节点禁用时也可以拖动调整顺序 */,
265
265
  ...config
266
266
  }) => config)
267
267
  });
268
268
  return /*#__PURE__*/_jsxs(_Fragment, {
269
269
  children: [showTitle && /*#__PURE__*/_jsx("span", {
270
- className: `${className}-list-title ${hashId}`.trim(),
270
+ className: clsx(`${className}-list-title`, hashId),
271
271
  children: listTitle
272
272
  }), listDom]
273
273
  });
@@ -424,7 +424,7 @@ function ColumnSetting(props) {
424
424
  return wrapSSR( /*#__PURE__*/_jsx(Popover, {
425
425
  arrow: false,
426
426
  title: /*#__PURE__*/_jsxs("div", {
427
- className: `${className}-title ${hashId}`.trim(),
427
+ className: clsx(`${className}-title`, hashId),
428
428
  children: [props.checkable === false ? /*#__PURE__*/_jsx("div", {}) : /*#__PURE__*/_jsx(Checkbox, {
429
429
  indeterminate: indeterminate,
430
430
  checked: unCheckedKeys.length === 0 && unCheckedKeys.length !== localColumns.length,
@@ -434,7 +434,7 @@ function ColumnSetting(props) {
434
434
  children: intl.getMessage('tableToolBar.columnDisplay', '列展示')
435
435
  }), checkedReset ? /*#__PURE__*/_jsx("a", {
436
436
  onClick: clearClick,
437
- className: `${className}-action-rest-button ${hashId}`.trim(),
437
+ className: clsx(`${className}-action-rest-button`, hashId),
438
438
  children: intl.getMessage('tableToolBar.reset', '重置')
439
439
  }) : null, props?.extra ? /*#__PURE__*/_jsx(Space, {
440
440
  size: 12,
@@ -443,7 +443,7 @@ function ColumnSetting(props) {
443
443
  }) : null]
444
444
  }),
445
445
  classNames: {
446
- root: `${className}-overlay ${hashId}`.trim()
446
+ root: clsx(`${className}-overlay`, hashId)
447
447
  },
448
448
  trigger: "click",
449
449
  placement: "bottomRight",
@@ -1,6 +1,7 @@
1
1
  import { HolderOutlined } from '@ant-design/icons';
2
2
  import { useControlledState } from '@rc-component/util';
3
3
  import { ConfigProvider } from 'antd';
4
+ import { clsx } from 'clsx';
4
5
  import React, { useCallback, useContext, useMemo } from 'react';
5
6
  import ProTable from "../../Table";
6
7
  import { useDragSort } from "../../utils/useDragSort";
@@ -25,7 +26,10 @@ function DragSortTable(props) {
25
26
  const setDataSource = useCallback(updater => {
26
27
  setDataSourceInner(prev => {
27
28
  const next = typeof updater === 'function' ? updater(prev) : updater;
28
- onDataSourceChange?.(next);
29
+ // 使用 queueMicrotask 延迟回调,避免在渲染期间更新其他组件状态
30
+ queueMicrotask(() => {
31
+ onDataSourceChange?.(next);
32
+ });
29
33
  return next;
30
34
  });
31
35
  }, [onDataSourceChange]);
@@ -38,14 +42,14 @@ function DragSortTable(props) {
38
42
  const DragHandle = useMemo(() => {
39
43
  return dragHandleProps => {
40
44
  const {
41
- rowData,
42
- index,
45
+ rowData: _rowData,
46
+ index: _index,
43
47
  className,
44
48
  ...rest
45
49
  } = dragHandleProps;
46
50
  const defaultDom = /*#__PURE__*/_jsx(HolderOutlined, {
47
51
  ...rest,
48
- className: `${getPrefixCls('pro-table-drag-icon')} ${className || ''} ${hashId || ''}`.trim()
52
+ className: clsx(getPrefixCls('pro-table-drag-icon'), className, hashId)
49
53
  });
50
54
  const handel = dragSortHandlerRender ? dragSortHandlerRender(dragHandleProps?.rowData, dragHandleProps?.index) : defaultDom;
51
55
  return /*#__PURE__*/_jsx("div", {
@@ -86,7 +86,7 @@ export type EditableProTableProps<T, U extends ParamsType, ValueType = 'text'> =
86
86
  declare function FieldEditableTable<DataType extends Record<string, any>, Params extends ParamsType = ParamsType, ValueType = 'text'>(props: EditableProTableProps<DataType, Params, ValueType>): import("react/jsx-runtime").JSX.Element;
87
87
  declare namespace FieldEditableTable {
88
88
  var RecordCreator: <T = Record<string, any>>(props: RecordCreatorProps<T> & {
89
- children: JSX.Element;
89
+ children: React.JSX.Element;
90
90
  }) => React.FunctionComponentElement<any>;
91
91
  }
92
92
  export default FieldEditableTable;
@@ -71,7 +71,7 @@ function handlePaginationInsert(baseData, defaultValue, pageConfig) {
71
71
  result.splice(insertIndex, 0, defaultValue);
72
72
  return result;
73
73
  }
74
- function useEditableDataSource({
74
+ function _useEditableDataSource({
75
75
  actionDataSource,
76
76
  editableUtils,
77
77
  pagination,
@@ -233,15 +233,15 @@ function EditableTable(props) {
233
233
  const {
234
234
  onTableChange,
235
235
  maxLength,
236
- formItemProps,
236
+ formItemProps: _formItemProps,
237
237
  recordCreatorProps,
238
238
  rowKey,
239
- controlled,
239
+ controlled: _controlled,
240
240
  defaultValue,
241
- onChange,
241
+ onChange: _onChange,
242
242
  editableFormRef,
243
243
  // @ts-ignore
244
- autoFocus,
244
+ autoFocus: _autoFocus,
245
245
  ...rest
246
246
  } = props;
247
247
  const preData = useRef(undefined);
@@ -533,7 +533,6 @@ function EditableTable(props) {
533
533
  } = recordCreatorProps || {};
534
534
  const isTop = position === 'top';
535
535
  const {
536
- creatorButtonDom,
537
536
  buttonRenderProps
538
537
  } = useCreatorButton({
539
538
  recordCreatorProps,
@@ -682,7 +681,7 @@ function FieldEditableTable(props) {
682
681
  const name = [props.name].flat(1);
683
682
  try {
684
683
  return JSON.stringify(get(prev, name)) !== JSON.stringify(get(next, name));
685
- } catch (error) {
684
+ } catch (_error) {
686
685
  return true;
687
686
  }
688
687
  },
@@ -11,6 +11,7 @@ export type ListToolBarHeaderMenuProps = {
11
11
  items?: ListToolBarMenuItem[];
12
12
  onChange?: (activeKey?: React.Key) => void;
13
13
  prefixCls?: string;
14
+ hashId?: string;
14
15
  };
15
16
  declare const HeaderMenu: React.FC<ListToolBarHeaderMenuProps>;
16
17
  export default HeaderMenu;
@@ -8,8 +8,9 @@ import { jsx as _jsx } from "react/jsx-runtime";
8
8
  import { jsxs as _jsxs } from "react/jsx-runtime";
9
9
  const HeaderMenu = props => {
10
10
  const {
11
- hashId
11
+ hashId: contextHashId
12
12
  } = useContext(ProProvider);
13
+ const hashId = props.hashId ?? contextHashId;
13
14
  const {
14
15
  items = [],
15
16
  type = 'inline',
@@ -54,7 +55,7 @@ const HeaderMenu = props => {
54
55
  });
55
56
  }
56
57
  return /*#__PURE__*/_jsx("div", {
57
- className: clsx(`${prefixCls}-menu`, `${prefixCls}-dropdownmenu`),
58
+ className: clsx(`${prefixCls}-menu`, `${prefixCls}-dropdownmenu`, hashId),
58
59
  children: /*#__PURE__*/_jsx(Dropdown, {
59
60
  trigger: ['click'],
60
61
  menu: {
@@ -69,7 +70,7 @@ const HeaderMenu = props => {
69
70
  }))
70
71
  },
71
72
  children: /*#__PURE__*/_jsxs(Space, {
72
- className: `${prefixCls}-dropdownmenu-label`,
73
+ className: clsx(`${prefixCls}-dropdownmenu-label`, hashId),
73
74
  children: [activeItem.label, /*#__PURE__*/_jsx(DownOutlined, {})]
74
75
  })
75
76
  })
@@ -53,13 +53,14 @@ function getSettingItem(setting) {
53
53
  }
54
54
  const ListToolBarTabBar = ({
55
55
  prefixCls,
56
+ hashId,
56
57
  tabs,
57
58
  multipleLine,
58
59
  filtersNode
59
60
  }) => {
60
61
  if (!multipleLine) return null;
61
62
  return /*#__PURE__*/_jsx("div", {
62
- className: `${prefixCls}-extra-line`,
63
+ className: clsx(`${prefixCls}-extra-line`, hashId),
63
64
  children: tabs?.items && tabs?.items.length ? /*#__PURE__*/_jsx(Tabs, {
64
65
  style: {
65
66
  width: '100%'
@@ -137,7 +138,7 @@ const ListToolBar = ({
137
138
  /** 轻量筛选组件 */
138
139
  const filtersNode = useMemo(() => {
139
140
  if (filter) return /*#__PURE__*/_jsx("div", {
140
- className: `${prefixCls}-filter ${hashId}`.trim(),
141
+ className: clsx(`${prefixCls}-filter`, hashId),
141
142
  children: filter
142
143
  });
143
144
  return null;
@@ -181,16 +182,16 @@ const ListToolBar = ({
181
182
  // 保留dom是为了占位,不然 right 就变到左边了
182
183
  if (!hasLeft && hasRight) {
183
184
  return /*#__PURE__*/_jsx("div", {
184
- className: `${prefixCls}-left ${hashId}`.trim()
185
+ className: clsx(`${prefixCls}-left`, hashId)
185
186
  });
186
187
  }
187
188
 
188
189
  // 减少 space 的dom,渲染的时候能节省点性能
189
190
  if (!menu && (hasTitle || !searchNode)) {
190
191
  return /*#__PURE__*/_jsx("div", {
191
- className: `${prefixCls}-left ${hashId}`.trim(),
192
+ className: clsx(`${prefixCls}-left`, hashId),
192
193
  children: /*#__PURE__*/_jsx("div", {
193
- className: `${prefixCls}-title ${hashId}`.trim(),
194
+ className: clsx(`${prefixCls}-title`, hashId),
194
195
  children: /*#__PURE__*/_jsx(LabelIconTip, {
195
196
  tooltip: tooltip,
196
197
  label: title,
@@ -206,7 +207,7 @@ const ListToolBar = ({
206
207
  [`${prefixCls}-left-has-inline-menu`]: menu?.type === 'inline'
207
208
  }),
208
209
  children: [hasTitle && !menu && /*#__PURE__*/_jsx("div", {
209
- className: `${prefixCls}-title ${hashId}`.trim(),
210
+ className: clsx(`${prefixCls}-title`, hashId),
210
211
  children: /*#__PURE__*/_jsx(LabelIconTip, {
211
212
  tooltip: tooltip,
212
213
  label: title,
@@ -217,9 +218,10 @@ const ListToolBar = ({
217
218
  // 这里面实现了 tabs 的逻辑
218
219
  _jsx(HeaderMenu, {
219
220
  ...menu,
220
- prefixCls: prefixCls
221
+ prefixCls: prefixCls,
222
+ hashId: hashId
221
223
  }), !hasTitle && searchNode ? /*#__PURE__*/_jsx("div", {
222
- className: `${prefixCls}-search ${hashId}`.trim(),
224
+ className: clsx(`${prefixCls}-search`, hashId),
223
225
  children: searchNode
224
226
  }) : null]
225
227
  });
@@ -227,19 +229,19 @@ const ListToolBar = ({
227
229
  const rightTitleDom = useMemo(() => {
228
230
  if (!hasRight) return null;
229
231
  return /*#__PURE__*/_jsxs("div", {
230
- className: `${prefixCls}-right ${hashId}`.trim(),
232
+ className: clsx(`${prefixCls}-right`, hashId),
231
233
  style: isMobile ? {} : {
232
234
  alignItems: 'center'
233
235
  },
234
236
  children: [!multipleLine ? filtersNode : null, hasTitle && searchNode ? /*#__PURE__*/_jsx("div", {
235
- className: `${prefixCls}-search ${hashId}`.trim(),
237
+ className: clsx(`${prefixCls}-search`, hashId),
236
238
  children: searchNode
237
239
  }) : null, actionDom, settings?.length ? /*#__PURE__*/_jsx("div", {
238
- className: `${prefixCls}-setting-items ${hashId}`.trim(),
240
+ className: clsx(`${prefixCls}-setting-items`, hashId),
239
241
  children: settings.map((setting, index) => {
240
242
  const settingItem = getSettingItem(setting);
241
243
  return /*#__PURE__*/_jsx("div", {
242
- className: `${prefixCls}-setting-item ${hashId}`.trim(),
244
+ className: clsx(`${prefixCls}-setting-item`, hashId),
243
245
  children: settingItem
244
246
  }, index);
245
247
  })
@@ -268,6 +270,7 @@ const ListToolBar = ({
268
270
  className: clsx(prefixCls, hashId, className),
269
271
  children: [titleNode, /*#__PURE__*/_jsx(ListToolBarTabBar, {
270
272
  filtersNode: filtersNode,
273
+ hashId: hashId,
271
274
  prefixCls: prefixCls,
272
275
  tabs: tabs,
273
276
  multipleLine: multipleLine
@@ -18,7 +18,7 @@ const genProListStyle = token => {
18
18
  alignItems: 'center',
19
19
  justifyContent: 'flex-start',
20
20
  color: token.colorTextHeading,
21
- fontWeight: '500',
21
+ fontWeight: token.fontWeightStrong,
22
22
  fontSize: token.fontSizeLG
23
23
  },
24
24
  '&-search:not(:last-child)': {
@@ -101,7 +101,7 @@ const genProListStyle = token => {
101
101
  },
102
102
  [`${token.antCls}-tabs-nav-list`]: {
103
103
  marginBlockStart: 0,
104
- '${token.antCls}-tabs-tab': {
104
+ [`${token.antCls}-tabs-tab`]: {
105
105
  paddingBlockStart: 0
106
106
  }
107
107
  }
@@ -51,7 +51,10 @@ const useFetchData = (getData, defaultData, options) => {
51
51
  const setTableDataList = useCallback(updater => {
52
52
  setTableDataListInner(prev => {
53
53
  const next = typeof updater === 'function' ? updater(prev) : updater;
54
- options?.onDataSourceChange?.(next);
54
+ // 使用 queueMicrotask 延迟回调,避免在渲染期间更新其他组件状态
55
+ queueMicrotask(() => {
56
+ options?.onDataSourceChange?.(next);
57
+ });
55
58
  return next;
56
59
  });
57
60
  }, [options?.onDataSourceChange]);
@@ -119,7 +119,7 @@ const CellRenderFromItem = props => {
119
119
  const shouldName = [rowName].flat(1);
120
120
  try {
121
121
  return JSON.stringify(get(pre, shouldName)) !== JSON.stringify(get(next, shouldName));
122
- } catch (error) {
122
+ } catch (_error) {
123
123
  return true;
124
124
  }
125
125
  },
@@ -77,7 +77,7 @@ const SortableRow = props => {
77
77
  */
78
78
  const SortableItemCell = /*#__PURE__*/React.memo(props => {
79
79
  const {
80
- dragSortKey,
80
+ dragSortKey: _dragSortKey,
81
81
  ...rest
82
82
  } = props;
83
83
  const {
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- type LightFilterFooterRender = ((onConfirm?: (e?: React.MouseEvent) => void, onClear?: (e?: React.MouseEvent) => void) => JSX.Element | false) | false;
2
+ type LightFilterFooterRender = ((onConfirm?: (e?: React.MouseEvent) => void, onClear?: (e?: React.MouseEvent) => void) => React.JSX.Element | false) | false;
3
3
  type OnClick = (e?: React.MouseEvent) => void;
4
4
  export type DropdownFooterProps = {
5
5
  onClear?: OnClick;
@@ -72,7 +72,7 @@ const FieldLabelFunction = (props, ref) => {
72
72
  onClick: () => {
73
73
  onLabelClick?.();
74
74
  },
75
- className: `${prefixCls}-text`,
75
+ className: clsx(`${prefixCls}-text`, hashId),
76
76
  children: [aLabel, ': ']
77
77
  }) : '';
78
78
  const str = formatterText(aValue);
@@ -2,7 +2,7 @@ import type { PopoverProps } from 'antd';
2
2
  import type { TooltipPlacement } from 'antd/lib/tooltip';
3
3
  import React from 'react';
4
4
  import type { DropdownFooterProps } from '../DropdownFooter';
5
- export type FooterRender = ((onConfirm?: (e?: React.MouseEvent) => void, onClear?: (e?: React.MouseEvent) => void) => JSX.Element | false) | false;
5
+ export type FooterRender = ((onConfirm?: (e?: React.MouseEvent) => void, onClear?: (e?: React.MouseEvent) => void) => React.JSX.Element | false) | false;
6
6
  export type DropdownProps = {
7
7
  label?: React.ReactNode;
8
8
  footer?: DropdownFooterProps;
@@ -51,7 +51,7 @@ const FilterDropdown = props => {
51
51
  return htmlRef.current || document.body;
52
52
  },
53
53
  children: /*#__PURE__*/_jsx("div", {
54
- className: `${prefixCls}-content ${hashId}`.trim(),
54
+ className: clsx(`${prefixCls}-content`, hashId),
55
55
  children: children
56
56
  })
57
57
  }), footer && /*#__PURE__*/_jsx(DropdownFooter, {