@ant-design/pro-components 3.1.11-0 → 3.1.12-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 (44) hide show
  1. package/dist/pro-components.min.js +1 -1
  2. package/es/field/components/ColorPicker/index.d.ts +1 -1
  3. package/es/field/components/Percent/util.d.ts +1 -1
  4. package/es/form/components/Digit/DigitRange.d.ts +1 -1
  5. package/es/form/layouts/ProForm/index.d.ts +1 -1
  6. package/es/layout/ProLayout.js +1 -0
  7. package/es/layout/WrapContent.js +2 -0
  8. package/es/layout/components/Footer.js +1 -0
  9. package/es/layout/components/GlobalFooter/index.js +1 -0
  10. package/es/layout/components/GlobalHeader/index.js +1 -0
  11. package/es/layout/components/GridContent/index.js +1 -0
  12. package/es/layout/components/Header/index.js +1 -0
  13. package/es/layout/components/PageContainer/index.js +1 -0
  14. package/es/layout/components/PageHeader/index.js +1 -0
  15. package/es/layout/components/SiderMenu/SiderMenu.js +1 -0
  16. package/es/layout/components/SiderMenu/index.js +1 -0
  17. package/es/layout/components/SiderMenu/style/menu.js +12 -0
  18. package/es/layout/components/TopNavHeader/index.js +1 -0
  19. package/es/list/ProListBase.js +1 -0
  20. package/es/provider/useStyle/index.js +33 -4
  21. package/es/table/Table.js +1 -0
  22. package/es/table/utils/columnRender.d.ts +1 -1
  23. package/lib/field/components/ColorPicker/index.d.ts +1 -1
  24. package/lib/field/components/Percent/util.d.ts +1 -1
  25. package/lib/form/components/Digit/DigitRange.d.ts +1 -1
  26. package/lib/form/layouts/ProForm/index.d.ts +1 -1
  27. package/lib/layout/ProLayout.js +1 -0
  28. package/lib/layout/WrapContent.js +2 -0
  29. package/lib/layout/components/Footer.js +1 -0
  30. package/lib/layout/components/GlobalFooter/index.js +1 -0
  31. package/lib/layout/components/GlobalHeader/index.js +1 -0
  32. package/lib/layout/components/GridContent/index.js +1 -0
  33. package/lib/layout/components/Header/index.js +1 -0
  34. package/lib/layout/components/PageContainer/index.js +1 -0
  35. package/lib/layout/components/PageHeader/index.js +1 -0
  36. package/lib/layout/components/SiderMenu/SiderMenu.js +1 -0
  37. package/lib/layout/components/SiderMenu/index.js +1 -0
  38. package/lib/layout/components/SiderMenu/style/menu.js +12 -0
  39. package/lib/layout/components/TopNavHeader/index.js +1 -0
  40. package/lib/list/ProListBase.js +1 -0
  41. package/lib/provider/useStyle/index.js +33 -4
  42. package/lib/table/Table.js +1 -0
  43. package/lib/table/utils/columnRender.d.ts +1 -1
  44. package/package.json +1 -1
@@ -3,5 +3,5 @@ import React from 'react';
3
3
  declare const _default: React.ForwardRefExoticComponent<import("src/provider").BaseProFieldFC & import("src/provider").ProRenderFieldPropsType & {
4
4
  text: string;
5
5
  mode?: "update" | "read" | "edit" | undefined;
6
- } & Partial<Omit<ColorPickerProps, "mode" | "value">> & React.RefAttributes<any>>;
6
+ } & Partial<Omit<ColorPickerProps, "value" | "mode">> & React.RefAttributes<any>>;
7
7
  export default _default;
@@ -1,7 +1,7 @@
1
1
  /** 获取展示符号 */
2
2
  export declare function getSymbolByRealValue(realValue: number): "-" | "+" | null;
3
3
  /** 获取颜色 */
4
- export declare function getColorByRealValue(realValue: number /** ,color: string */): "#52c41a" | "#ff4d4f" | "#595959";
4
+ export declare function getColorByRealValue(realValue: number /** ,color: string */): "#52c41a" | "#595959" | "#ff4d4f";
5
5
  /** 获取到最后展示的数字 */
6
6
  export declare function getRealTextWithPrecision(realValue: number, precision?: number): string | number;
7
7
  /**
@@ -13,7 +13,7 @@ export type ProFormDigitRangeProps = ProFormFieldItemProps<RangeInputNumberProps
13
13
  separatorWidth?: number;
14
14
  };
15
15
  declare const ForwardRefProFormDigit: React.ForwardRefExoticComponent<{
16
- fieldProps?: Partial<import("../../typing").FieldProps<any> & Omit<InputNumberProps<number>, "defaultValue" | "onChange" | "value" | "placeholder"> & {
16
+ fieldProps?: Partial<import("../../typing").FieldProps<any> & Omit<InputNumberProps<number>, "value" | "defaultValue" | "onChange" | "placeholder"> & {
17
17
  value?: ValuePair | undefined;
18
18
  defaultValue?: ValuePair | undefined;
19
19
  onChange?: ((value?: ValuePair) => void) | undefined;
@@ -14,7 +14,7 @@ declare namespace ProForm {
14
14
  var Provider: React.FC<import("antd/es/form/context").FormProviderProps>;
15
15
  var useFormInstance: typeof import("antd/es/form/hooks/useFormInstance").default;
16
16
  var EditOrReadOnlyContext: React.Context<{
17
- mode: "read" | "edit" | "update";
17
+ mode: "update" | "read" | "edit";
18
18
  }>;
19
19
  }
20
20
  export { ProForm };
@@ -437,6 +437,7 @@ const BaseProLayout = props => {
437
437
  children: children
438
438
  }) : /*#__PURE__*/_jsxs("div", {
439
439
  className: className,
440
+ "data-testid": "pro-layout",
440
441
  children: [bgImgStyleList || token.layout?.bgLayout ? /*#__PURE__*/_jsx("div", {
441
442
  className: clsx(`${proLayoutClassName}-bg-list`, hashId),
442
443
  children: bgImgStyleList
@@ -22,11 +22,13 @@ const WrapContent = props => {
22
22
  return props.ErrorBoundary === false ? /*#__PURE__*/_jsx(Layout.Content, {
23
23
  className: contentClassName,
24
24
  style: style,
25
+ "data-testid": "pro-layout-content",
25
26
  children: children
26
27
  }) : /*#__PURE__*/_jsx(ErrorComponent, {
27
28
  children: /*#__PURE__*/_jsx(Layout.Content, {
28
29
  className: contentClassName,
29
30
  style: style,
31
+ "data-testid": "pro-layout-content",
30
32
  children: children
31
33
  })
32
34
  });
@@ -19,6 +19,7 @@ const DefaultFooter = ({
19
19
  padding: 0,
20
20
  ...style
21
21
  },
22
+ "data-testid": "pro-layout-footer",
22
23
  children: /*#__PURE__*/_jsx(GlobalFooter, {
23
24
  links: links,
24
25
  prefixCls: prefixCls,
@@ -23,6 +23,7 @@ const GlobalFooter = ({
23
23
  return wrapSSR( /*#__PURE__*/_jsxs("div", {
24
24
  className: clsx(baseClassName, hashId, className),
25
25
  style: style,
26
+ "data-testid": "pro-global-footer",
26
27
  children: [links && /*#__PURE__*/_jsx("div", {
27
28
  className: clsx(`${baseClassName}-list`, hashId),
28
29
  children: links.map(link => /*#__PURE__*/_jsx("a", {
@@ -76,6 +76,7 @@ const GlobalHeader = props => {
76
76
  style: {
77
77
  ...style
78
78
  },
79
+ "data-testid": "pro-layout-global-header",
79
80
  children: [isMobile && /*#__PURE__*/_jsx("span", {
80
81
  className: clsx(`${baseClassName}-collapsed-button`, hashId),
81
82
  onClick: () => {
@@ -34,6 +34,7 @@ const GridContent = props => {
34
34
  [`${className}-wide`]: isWide
35
35
  }),
36
36
  style: style,
37
+ "data-testid": "pro-grid-content",
37
38
  children: /*#__PURE__*/_jsx("div", {
38
39
  className: clsx(`${prefixCls}-grid-content-children`, hashId),
39
40
  children: children
@@ -118,6 +118,7 @@ const DefaultHeader = props => {
118
118
  }), /*#__PURE__*/_jsx(Header, {
119
119
  className: className,
120
120
  style: style,
121
+ "data-testid": "pro-layout-header",
121
122
  children: renderContent()
122
123
  })]
123
124
  })
@@ -270,6 +270,7 @@ const PageContainerBase = props => {
270
270
  children: [/*#__PURE__*/_jsxs("div", {
271
271
  style: style,
272
272
  className: containerClassName,
273
+ "data-testid": "pro-page-container",
273
274
  children: [fixedHeader && pageHeaderDom ?
274
275
  /*#__PURE__*/
275
276
  // 在 hasHeader 且 fixedHeader 的情况下,才需要设置高度
@@ -162,6 +162,7 @@ const PageHeader = props => {
162
162
  ref: ref,
163
163
  className: className,
164
164
  style: style,
165
+ "data-testid": "pro-page-header",
165
166
  children: [breadcrumbDom, title, childDom, footerDom]
166
167
  })
167
168
  }));
@@ -274,6 +274,7 @@ const SiderMenu = props => {
274
274
  onCollapse?.(collapse);
275
275
  },
276
276
  collapsedWidth: collapsedWidth,
277
+ "data-testid": "pro-layout-sider",
277
278
  style: style,
278
279
  theme: theme,
279
280
  width: siderWidth,
@@ -46,6 +46,7 @@ const SiderMenuWrapper = props => {
46
46
  return wrapSSR(isMobile ? /*#__PURE__*/_jsx(Drawer, {
47
47
  placement: direction === 'rtl' ? 'right' : 'left',
48
48
  className: clsx(`${prefixCls}-drawer-sider`, className),
49
+ "data-testid": "pro-layout-sider",
49
50
  open: !collapsed,
50
51
  afterOpenChange: open => {
51
52
  if (!open) {
@@ -27,6 +27,18 @@ const genProLayoutBaseMenuStyle = (token, mode) => {
27
27
  alignItems: 'center'
28
28
  },
29
29
  [`&&-collapsed`]: {
30
+ // antd ≥6.3.4 折叠 Menu 对 title-content 隐藏更彻底(如 #57360);Pro 图标在 label 内,需恢复可见(布局仍由 *-item-title-collapsed 控制)
31
+ [`&${token.antCls}-menu-inline-collapsed`]: {
32
+ [`> ${token.antCls}-menu-item > ${token.antCls}-menu-title-content,
33
+ > ${token.antCls}-menu-item-group > ${token.antCls}-menu-item-group-list > ${token.antCls}-menu-item > ${token.antCls}-menu-title-content,
34
+ > ${token.antCls}-menu-item-group > ${token.antCls}-menu-item-group-list > ${token.antCls}-menu-submenu > ${token.antCls}-menu-submenu-title > ${token.antCls}-menu-title-content,
35
+ > ${token.antCls}-menu-submenu > ${token.antCls}-menu-submenu-title > ${token.antCls}-menu-title-content`]: {
36
+ width: '100% !important',
37
+ maxWidth: '100%',
38
+ opacity: '1 !important',
39
+ overflow: 'visible !important'
40
+ }
41
+ },
30
42
  [`${token.antCls}-menu-item,
31
43
  ${token.antCls}-menu-item-group > ${token.antCls}-menu-item-group-list > ${token.antCls}-menu-item,
32
44
  ${token.antCls}-menu-item-group > ${token.antCls}-menu-item-group-list > ${token.antCls}-menu-submenu > ${token.antCls}-menu-submenu-title,
@@ -102,6 +102,7 @@ const TopNavHeader = props => {
102
102
  [`${prefixCls}-light`]: true
103
103
  }),
104
104
  style: style,
105
+ "data-testid": "pro-layout-top-nav-header",
105
106
  children: /*#__PURE__*/_jsxs("div", {
106
107
  ref: ref,
107
108
  className: clsx(`${prefixCls}-main`, hashId, {
@@ -325,6 +325,7 @@ const ProListContainerInner = /*#__PURE__*/React.forwardRef(function ProListCont
325
325
  ref: ref,
326
326
  style: style,
327
327
  className: classString,
328
+ "data-testid": "pro-list-view",
328
329
  ...rest,
329
330
  children: /*#__PURE__*/_jsxs(Spin, {
330
331
  spinning: isLoading,
@@ -1,7 +1,7 @@
1
1
  import { useStyleRegister } from '@ant-design/cssinjs';
2
2
  import { TinyColor } from '@ctrl/tinycolor';
3
3
  import { ConfigProvider as AntdConfigProvider, theme as antdTheme } from 'antd';
4
- import { useContext } from 'react';
4
+ import { useContext, useMemo, useRef } from 'react';
5
5
  import { ProProvider } from "../index";
6
6
  /**
7
7
  * 把一个颜色设置一下透明度
@@ -51,6 +51,22 @@ export const operationUnit = token => ({
51
51
  color: token.colorLinkActive
52
52
  }
53
53
  });
54
+ const hashString = input => {
55
+ let hash = 5381;
56
+ for (let i = 0; i < input.length; i += 1) {
57
+ hash = hash * 33 ^ input.charCodeAt(i);
58
+ }
59
+ return (hash >>> 0).toString(36);
60
+ };
61
+ const getProTokenKey = token => {
62
+ try {
63
+ // ProProvider exposes finalToken instead of useCacheToken token,
64
+ // so build a stable key from Pro token payload directly.
65
+ return hashString(JSON.stringify(token));
66
+ } catch {
67
+ return '';
68
+ }
69
+ };
54
70
 
55
71
  /**
56
72
  * 封装了一下 antd 的 useStyle
@@ -83,17 +99,30 @@ export function useStyle(componentName, styleFn) {
83
99
  token.antCls = `.${getPrefixCls()}`;
84
100
 
85
101
  // Register styles (side effect only in v2)
102
+ // Keep path sensitive to both antd theme and Pro token updates.
103
+ const proTokenKey = useMemo(() => {
104
+ return getProTokenKey(token);
105
+ }, [token]);
106
+
107
+ // Keep path monotonic across toggles to avoid style order issues
108
+ // when switching dark -> light (back to an old key).
109
+ const styleKey = [hashId, theme.id, token.themeId, proTokenKey].filter(Boolean).join('-');
110
+ const lastStyleKeyRef = useRef('');
111
+ const styleVersionRef = useRef(0);
112
+ if (lastStyleKeyRef.current !== styleKey) {
113
+ styleVersionRef.current += 1;
114
+ lastStyleKeyRef.current = styleKey;
115
+ }
116
+ const stylePath = [componentName, styleKey, styleVersionRef.current].filter(Boolean);
86
117
  useStyleRegister({
87
118
  theme: theme,
88
119
  token,
89
- path: [componentName],
120
+ path: stylePath,
90
121
  nonce: csp?.nonce,
91
122
  layer: {
92
123
  name: 'antd-pro'
93
124
  }
94
125
  }, () => styleFn(token));
95
-
96
- // Return identity wrapper and hashId
97
126
  return {
98
127
  wrapSSR: node => node,
99
128
  hashId: hashed ? hashId : ''
package/es/table/Table.js CHANGED
@@ -754,6 +754,7 @@ const ProTable = props => {
754
754
  }),
755
755
  style: style,
756
756
  ref: counter.rootDomRef,
757
+ "data-testid": "pro-table",
757
758
  children: [isLightFilter ? null : searchNode, type !== 'form' && props.tableExtraRender && /*#__PURE__*/_jsx("div", {
758
759
  className: clsx(className, `${defaultClassName}-extra`),
759
760
  children: props.tableExtraRender(props, action.dataSource || [])
@@ -22,7 +22,7 @@ type ColumnRenderInterface<T> = {
22
22
  *
23
23
  * @param item
24
24
  */
25
- export declare const renderColumnsTitle: (item: ProColumns<any>) => string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
25
+ export declare const renderColumnsTitle: (item: ProColumns<any>) => string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
26
26
  /**
27
27
  * 默认的 filter 方法
28
28
  *
@@ -3,5 +3,5 @@ import React from 'react';
3
3
  declare const _default: React.ForwardRefExoticComponent<import("src/provider").BaseProFieldFC & import("src/provider").ProRenderFieldPropsType & {
4
4
  text: string;
5
5
  mode?: "update" | "read" | "edit" | undefined;
6
- } & Partial<Omit<ColorPickerProps, "mode" | "value">> & React.RefAttributes<any>>;
6
+ } & Partial<Omit<ColorPickerProps, "value" | "mode">> & React.RefAttributes<any>>;
7
7
  export default _default;
@@ -1,7 +1,7 @@
1
1
  /** 获取展示符号 */
2
2
  export declare function getSymbolByRealValue(realValue: number): "-" | "+" | null;
3
3
  /** 获取颜色 */
4
- export declare function getColorByRealValue(realValue: number /** ,color: string */): "#52c41a" | "#ff4d4f" | "#595959";
4
+ export declare function getColorByRealValue(realValue: number /** ,color: string */): "#52c41a" | "#595959" | "#ff4d4f";
5
5
  /** 获取到最后展示的数字 */
6
6
  export declare function getRealTextWithPrecision(realValue: number, precision?: number): string | number;
7
7
  /**
@@ -13,7 +13,7 @@ export type ProFormDigitRangeProps = ProFormFieldItemProps<RangeInputNumberProps
13
13
  separatorWidth?: number;
14
14
  };
15
15
  declare const ForwardRefProFormDigit: React.ForwardRefExoticComponent<{
16
- fieldProps?: Partial<import("../../typing").FieldProps<any> & Omit<InputNumberProps<number>, "defaultValue" | "onChange" | "value" | "placeholder"> & {
16
+ fieldProps?: Partial<import("../../typing").FieldProps<any> & Omit<InputNumberProps<number>, "value" | "defaultValue" | "onChange" | "placeholder"> & {
17
17
  value?: ValuePair | undefined;
18
18
  defaultValue?: ValuePair | undefined;
19
19
  onChange?: ((value?: ValuePair) => void) | undefined;
@@ -14,7 +14,7 @@ declare namespace ProForm {
14
14
  var Provider: React.FC<import("antd/es/form/context").FormProviderProps>;
15
15
  var useFormInstance: typeof import("antd/es/form/hooks/useFormInstance").default;
16
16
  var EditOrReadOnlyContext: React.Context<{
17
- mode: "read" | "edit" | "update";
17
+ mode: "update" | "read" | "edit";
18
18
  }>;
19
19
  }
20
20
  export { ProForm };
@@ -442,6 +442,7 @@ const BaseProLayout = props => {
442
442
  children: children
443
443
  }) : /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
444
444
  className: className,
445
+ "data-testid": "pro-layout",
445
446
  children: [bgImgStyleList || token.layout?.bgLayout ? /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
446
447
  className: (0, _clsx.clsx)(`${proLayoutClassName}-bg-list`, hashId),
447
448
  children: bgImgStyleList
@@ -29,11 +29,13 @@ const WrapContent = props => {
29
29
  return props.ErrorBoundary === false ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Layout.Content, {
30
30
  className: contentClassName,
31
31
  style: style,
32
+ "data-testid": "pro-layout-content",
32
33
  children: children
33
34
  }) : /*#__PURE__*/(0, _jsxRuntime.jsx)(ErrorComponent, {
34
35
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Layout.Content, {
35
36
  className: contentClassName,
36
37
  style: style,
38
+ "data-testid": "pro-layout-content",
37
39
  children: children
38
40
  })
39
41
  });
@@ -25,6 +25,7 @@ const DefaultFooter = ({
25
25
  padding: 0,
26
26
  ...style
27
27
  },
28
+ "data-testid": "pro-layout-footer",
28
29
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_GlobalFooter.GlobalFooter, {
29
30
  links: links,
30
31
  prefixCls: prefixCls,
@@ -29,6 +29,7 @@ const GlobalFooter = ({
29
29
  return wrapSSR( /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
30
30
  className: (0, _clsx.clsx)(baseClassName, hashId, className),
31
31
  style: style,
32
+ "data-testid": "pro-global-footer",
32
33
  children: [links && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
33
34
  className: (0, _clsx.clsx)(`${baseClassName}-list`, hashId),
34
35
  children: links.map(link => /*#__PURE__*/(0, _jsxRuntime.jsx)("a", {
@@ -81,6 +81,7 @@ const GlobalHeader = props => {
81
81
  style: {
82
82
  ...style
83
83
  },
84
+ "data-testid": "pro-layout-global-header",
84
85
  children: [isMobile && /*#__PURE__*/(0, _jsxRuntime.jsx)("span", {
85
86
  className: (0, _clsx.clsx)(`${baseClassName}-collapsed-button`, hashId),
86
87
  onClick: () => {
@@ -41,6 +41,7 @@ const GridContent = props => {
41
41
  [`${className}-wide`]: isWide
42
42
  }),
43
43
  style: style,
44
+ "data-testid": "pro-grid-content",
44
45
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
45
46
  className: (0, _clsx.clsx)(`${prefixCls}-grid-content-children`, hashId),
46
47
  children: children
@@ -123,6 +123,7 @@ const DefaultHeader = props => {
123
123
  }), /*#__PURE__*/(0, _jsxRuntime.jsx)(Header, {
124
124
  className: className,
125
125
  style: style,
126
+ "data-testid": "pro-layout-header",
126
127
  children: renderContent()
127
128
  })]
128
129
  })
@@ -276,6 +276,7 @@ const PageContainerBase = props => {
276
276
  children: [/*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
277
277
  style: style,
278
278
  className: containerClassName,
279
+ "data-testid": "pro-page-container",
279
280
  children: [fixedHeader && pageHeaderDom ?
280
281
  /*#__PURE__*/
281
282
  // 在 hasHeader 且 fixedHeader 的情况下,才需要设置高度
@@ -168,6 +168,7 @@ const PageHeader = props => {
168
168
  ref: ref,
169
169
  className: className,
170
170
  style: style,
171
+ "data-testid": "pro-page-header",
171
172
  children: [breadcrumbDom, title, childDom, footerDom]
172
173
  })
173
174
  }));
@@ -279,6 +279,7 @@ const SiderMenu = props => {
279
279
  onCollapse?.(collapse);
280
280
  },
281
281
  collapsedWidth: collapsedWidth,
282
+ "data-testid": "pro-layout-sider",
282
283
  style: style,
283
284
  theme: theme,
284
285
  width: siderWidth,
@@ -53,6 +53,7 @@ const SiderMenuWrapper = props => {
53
53
  return wrapSSR(isMobile ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_antd.Drawer, {
54
54
  placement: direction === 'rtl' ? 'right' : 'left',
55
55
  className: (0, _clsx.clsx)(`${prefixCls}-drawer-sider`, className),
56
+ "data-testid": "pro-layout-sider",
56
57
  open: !collapsed,
57
58
  afterOpenChange: open => {
58
59
  if (!open) {
@@ -33,6 +33,18 @@ const genProLayoutBaseMenuStyle = (token, mode) => {
33
33
  alignItems: 'center'
34
34
  },
35
35
  [`&&-collapsed`]: {
36
+ // antd ≥6.3.4 折叠 Menu 对 title-content 隐藏更彻底(如 #57360);Pro 图标在 label 内,需恢复可见(布局仍由 *-item-title-collapsed 控制)
37
+ [`&${token.antCls}-menu-inline-collapsed`]: {
38
+ [`> ${token.antCls}-menu-item > ${token.antCls}-menu-title-content,
39
+ > ${token.antCls}-menu-item-group > ${token.antCls}-menu-item-group-list > ${token.antCls}-menu-item > ${token.antCls}-menu-title-content,
40
+ > ${token.antCls}-menu-item-group > ${token.antCls}-menu-item-group-list > ${token.antCls}-menu-submenu > ${token.antCls}-menu-submenu-title > ${token.antCls}-menu-title-content,
41
+ > ${token.antCls}-menu-submenu > ${token.antCls}-menu-submenu-title > ${token.antCls}-menu-title-content`]: {
42
+ width: '100% !important',
43
+ maxWidth: '100%',
44
+ opacity: '1 !important',
45
+ overflow: 'visible !important'
46
+ }
47
+ },
36
48
  [`${token.antCls}-menu-item,
37
49
  ${token.antCls}-menu-item-group > ${token.antCls}-menu-item-group-list > ${token.antCls}-menu-item,
38
50
  ${token.antCls}-menu-item-group > ${token.antCls}-menu-item-group-list > ${token.antCls}-menu-submenu > ${token.antCls}-menu-submenu-title,
@@ -108,6 +108,7 @@ const TopNavHeader = props => {
108
108
  [`${prefixCls}-light`]: true
109
109
  }),
110
110
  style: style,
111
+ "data-testid": "pro-layout-top-nav-header",
111
112
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)("div", {
112
113
  ref: ref,
113
114
  className: (0, _clsx.clsx)(`${prefixCls}-main`, hashId, {
@@ -333,6 +333,7 @@ const ProListContainerInner = /*#__PURE__*/_react.default.forwardRef(function Pr
333
333
  ref: ref,
334
334
  style: style,
335
335
  className: classString,
336
+ "data-testid": "pro-list-view",
336
337
  ...rest,
337
338
  children: /*#__PURE__*/(0, _jsxRuntime.jsxs)(_antd.Spin, {
338
339
  spinning: isLoading,
@@ -61,6 +61,23 @@ const operationUnit = token => ({
61
61
  color: token.colorLinkActive
62
62
  }
63
63
  });
64
+ exports.operationUnit = operationUnit;
65
+ const hashString = input => {
66
+ let hash = 5381;
67
+ for (let i = 0; i < input.length; i += 1) {
68
+ hash = hash * 33 ^ input.charCodeAt(i);
69
+ }
70
+ return (hash >>> 0).toString(36);
71
+ };
72
+ const getProTokenKey = token => {
73
+ try {
74
+ // ProProvider exposes finalToken instead of useCacheToken token,
75
+ // so build a stable key from Pro token payload directly.
76
+ return hashString(JSON.stringify(token));
77
+ } catch {
78
+ return '';
79
+ }
80
+ };
64
81
 
65
82
  /**
66
83
  * 封装了一下 antd 的 useStyle
@@ -68,7 +85,6 @@ const operationUnit = token => ({
68
85
  * @param styleFn {GenerateStyle} 生成样式的函数
69
86
  * @returns UseStyleResult
70
87
  */
71
- exports.operationUnit = operationUnit;
72
88
  function useStyle(componentName, styleFn) {
73
89
  let {
74
90
  token = {},
@@ -94,17 +110,30 @@ function useStyle(componentName, styleFn) {
94
110
  token.antCls = `.${getPrefixCls()}`;
95
111
 
96
112
  // Register styles (side effect only in v2)
113
+ // Keep path sensitive to both antd theme and Pro token updates.
114
+ const proTokenKey = (0, _react.useMemo)(() => {
115
+ return getProTokenKey(token);
116
+ }, [token]);
117
+
118
+ // Keep path monotonic across toggles to avoid style order issues
119
+ // when switching dark -> light (back to an old key).
120
+ const styleKey = [hashId, theme.id, token.themeId, proTokenKey].filter(Boolean).join('-');
121
+ const lastStyleKeyRef = (0, _react.useRef)('');
122
+ const styleVersionRef = (0, _react.useRef)(0);
123
+ if (lastStyleKeyRef.current !== styleKey) {
124
+ styleVersionRef.current += 1;
125
+ lastStyleKeyRef.current = styleKey;
126
+ }
127
+ const stylePath = [componentName, styleKey, styleVersionRef.current].filter(Boolean);
97
128
  (0, _cssinjs.useStyleRegister)({
98
129
  theme: theme,
99
130
  token,
100
- path: [componentName],
131
+ path: stylePath,
101
132
  nonce: csp?.nonce,
102
133
  layer: {
103
134
  name: 'antd-pro'
104
135
  }
105
136
  }, () => styleFn(token));
106
-
107
- // Return identity wrapper and hashId
108
137
  return {
109
138
  wrapSSR: node => node,
110
139
  hashId: hashed ? hashId : ''
@@ -759,6 +759,7 @@ const ProTable = props => {
759
759
  }),
760
760
  style: style,
761
761
  ref: counter.rootDomRef,
762
+ "data-testid": "pro-table",
762
763
  children: [isLightFilter ? null : searchNode, type !== 'form' && props.tableExtraRender && /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {
763
764
  className: (0, _clsx.clsx)(className, `${defaultClassName}-extra`),
764
765
  children: props.tableExtraRender(props, action.dataSource || [])
@@ -22,7 +22,7 @@ type ColumnRenderInterface<T> = {
22
22
  *
23
23
  * @param item
24
24
  */
25
- export declare const renderColumnsTitle: (item: ProColumns<any>) => string | number | boolean | import("react/jsx-runtime").JSX.Element | Iterable<React.ReactNode> | null | undefined;
25
+ export declare const renderColumnsTitle: (item: ProColumns<any>) => string | number | boolean | Iterable<React.ReactNode> | import("react/jsx-runtime").JSX.Element | null | undefined;
26
26
  /**
27
27
  * 默认的 filter 方法
28
28
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ant-design/pro-components",
3
- "version": "3.1.11-0",
3
+ "version": "3.1.12-0",
4
4
  "type": "module",
5
5
  "description": "All-in-one package of @ant-design/pro-components",
6
6
  "keywords": [