@zat-design/sisyphus-react 4.5.8-beta.1 → 4.5.8-beta.4

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 (87) hide show
  1. package/dist/index.esm.css +1 -1
  2. package/dist/less.esm.css +1 -1
  3. package/es/ProAction/components/CheckModalContent/index.d.ts +2 -1
  4. package/es/ProDownload/index.d.ts +2 -1
  5. package/es/ProDrawerForm/hooks/useConfirmClose.d.ts +1 -0
  6. package/es/ProEditTable/components/ActionButton/index.d.ts +2 -1
  7. package/es/ProEditTable/components/RcTable/BaseTable.d.ts +2 -1
  8. package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +1 -1
  9. package/es/ProEditTable/components/RenderField/index.d.ts +1 -1
  10. package/es/ProEditTable/components/RenderToolbar/index.d.ts +2 -1
  11. package/es/ProEditTable/components/Summary/index.d.ts +2 -1
  12. package/es/ProEditTable/components/Validator/index.d.ts +1 -0
  13. package/es/ProEditTable/utils/config.d.ts +2 -1
  14. package/es/ProEditTable/utils/tools.d.ts +1 -1
  15. package/es/ProEditTable/utils/transform.d.ts +2 -2
  16. package/es/ProEnum/components/Group.d.ts +2 -1
  17. package/es/ProEnum/components/Tag.d.ts +2 -1
  18. package/es/ProEnum/index.d.ts +3 -2
  19. package/es/ProEnum/utils/getEnumLabel.d.ts +2 -1
  20. package/es/ProForm/components/FormFooter/propsType.d.ts +1 -0
  21. package/es/ProForm/components/base/Input/index.d.ts +2 -1
  22. package/es/ProForm/components/combination/FormList/components/Empty.d.ts +2 -1
  23. package/es/ProForm/components/combination/Group/utils/index.d.ts +1 -0
  24. package/es/ProForm/components/combination/ProCascader/index.d.ts +2 -1
  25. package/es/ProForm/components/combination/ProNumberRange/index.d.ts +1 -0
  26. package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +2 -1
  27. package/es/ProForm/index.d.ts +1 -1
  28. package/es/ProForm/utils/index.d.ts +1 -1
  29. package/es/ProForm/utils/reactiveValues.d.ts +1 -0
  30. package/es/ProForm/utils/transformValue.d.ts +1 -1
  31. package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +2 -1
  32. package/es/ProLayout/components/Layout/Notice/index.d.ts +5 -2
  33. package/es/ProLayout/components/Layout/Notice/index.js +3 -1
  34. package/es/ProLayout/components/ProCollapse/index.d.ts +2 -1
  35. package/es/ProLayout/components/ProFooter/index.d.ts +2 -1
  36. package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +2 -1
  37. package/es/ProLayout/components/ProHeader/components/Describe/index.d.ts +4 -4
  38. package/es/ProLayout/components/ProHeader/index.d.ts +1 -1
  39. package/es/ProLayout/components/ProHeader/index.js +5 -2
  40. package/es/ProLayout/components/ProHeader/utils/index.d.ts +1 -1
  41. package/es/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +2 -1
  42. package/es/ProLayout/components/TabsManager/components/TabsContext.d.ts +1 -0
  43. package/es/ProLayout/components/TabsManager/components/TabsHeader.d.ts +2 -1
  44. package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +22 -2
  45. package/es/ProLayout/components/TabsManager/index.d.ts +1 -0
  46. package/es/ProLayout/components/TabsManager/index.js +16 -26
  47. package/es/ProLayout/components/TabsManager/utils/index.d.ts +6 -2
  48. package/es/ProLayout/components/TabsManager/utils/index.js +23 -0
  49. package/es/ProLayout/index.d.ts +6 -5
  50. package/es/ProLayout/index.js +47 -14
  51. package/es/ProLayout/propTypes.d.ts +4 -0
  52. package/es/ProLayout/style/index.less +25 -18
  53. package/es/ProSelect/components/AdaptiveTooltip.d.ts +2 -1
  54. package/es/ProSelect/index.d.ts +1 -1
  55. package/es/ProStep/components/Step/index.d.ts +3 -2
  56. package/es/ProStep/components/Step/index.js +6 -3
  57. package/es/ProStep/index.d.ts +2 -2
  58. package/es/ProStep/propsType.d.ts +2 -2
  59. package/es/ProTable/components/FormatColumn/index.d.ts +1 -1
  60. package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +1 -0
  61. package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +1 -1
  62. package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +1 -0
  63. package/es/ProTable/components/RenderFooter/index.d.ts +2 -1
  64. package/es/ProTable/components/RenderTableHeader/index.d.ts +2 -1
  65. package/es/ProTable/components/RenderTabs/index.d.ts +2 -1
  66. package/es/ProTable/components/TableResizable/index.d.ts +2 -1
  67. package/es/ProTable/index.d.ts +1 -1
  68. package/es/ProTabs/components/Card/index.d.ts +2 -1
  69. package/es/ProThemeTools/component/ProTools/index.d.ts +2 -1
  70. package/es/ProThemeTools/index.d.ts +2 -1
  71. package/es/ProTooltip/index.d.ts +2 -1
  72. package/es/ProTree/components/AdaptiveTooltip.d.ts +2 -1
  73. package/es/ProTree/components/CloseIcon.d.ts +2 -1
  74. package/es/ProTree/components/List.d.ts +1 -1
  75. package/es/ProTree/components/ProTree.d.ts +2 -1
  76. package/es/ProTree/components/ProTreeSelect/index.d.ts +1 -1
  77. package/es/ProTree/components/SearchTitle.d.ts +2 -1
  78. package/es/ProTree/components/Tree.d.ts +2 -2
  79. package/es/ProTree/index.d.ts +2 -1
  80. package/es/ProTreeModal/components/Cascader.d.ts +1 -1
  81. package/es/ProTreeModal/components/CloseIcon.d.ts +2 -1
  82. package/es/ProTreeModal/components/SearchTitle.d.ts +2 -1
  83. package/es/ProTreeModal/components/Trigger.d.ts +1 -1
  84. package/es/ProTreeModal/index.d.ts +2 -1
  85. package/es/ProUpload/components/DraggableUploadListItem.d.ts +2 -1
  86. package/es/hooks/useDraggableRow.d.ts +1 -1
  87. package/package.json +4 -19
@@ -1,8 +1,9 @@
1
+ /// <reference types="react" />
1
2
  import './index.less';
2
3
  interface propsWithCheckModal {
3
4
  errorTitle?: string;
4
5
  list?: string[];
5
6
  [key: string]: any;
6
7
  }
7
- declare const CheckModalContent: (props: propsWithCheckModal) => import("react/jsx-runtime").JSX.Element;
8
+ declare const CheckModalContent: (props: propsWithCheckModal) => import("react").JSX.Element;
8
9
  export default CheckModalContent;
@@ -1,6 +1,7 @@
1
+ /// <reference types="react" />
1
2
  import type { ProDownloadType } from './propsType';
2
3
  declare const ProDownload: {
3
- (props: ProDownloadType): import("react/jsx-runtime").JSX.Element;
4
+ (props: ProDownloadType): import("react").JSX.Element;
4
5
  downLoadRequest: import("./utils").DownloadRequestProps;
5
6
  };
6
7
  export default ProDownload;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ProDrawerFormType } from '../propsType';
2
3
  interface UseConfirmCloseParams {
3
4
  open?: boolean;
@@ -1,2 +1,3 @@
1
- declare const ActionButton: ({ record, index, config, btnConfig }: any) => import("react/jsx-runtime").JSX.Element;
1
+ import React from 'react';
2
+ declare const ActionButton: ({ record, index, config, btnConfig }: any) => React.JSX.Element;
2
3
  export default ActionButton;
@@ -1,5 +1,6 @@
1
+ /// <reference types="react" />
1
2
  declare const _default: import("react").MemoExoticComponent<({ tableProps, ...resetProps }: {
2
3
  [x: string]: any;
3
4
  tableProps: any;
4
- }) => import("react/jsx-runtime").JSX.Element>;
5
+ }) => import("react").JSX.Element>;
5
6
  export default _default;
@@ -3,5 +3,5 @@ declare const _default: React.MemoExoticComponent<({ tableProps, draggableProps,
3
3
  [x: string]: any;
4
4
  tableProps: any;
5
5
  draggableProps: any;
6
- }) => import("react/jsx-runtime").JSX.Element>;
6
+ }) => React.JSX.Element>;
7
7
  export default _default;
@@ -1,3 +1,3 @@
1
1
  import React from 'react';
2
- declare const _default: React.MemoExoticComponent<({ text: value, record, index, column, config }: any) => import("react/jsx-runtime").JSX.Element>;
2
+ declare const _default: React.MemoExoticComponent<({ text: value, record, index, column, config }: any) => React.JSX.Element>;
3
3
  export default _default;
@@ -1,2 +1,3 @@
1
- declare const RenderToolbar: (config: any) => import("react/jsx-runtime").JSX.Element;
1
+ import React from 'react';
2
+ declare const RenderToolbar: (config: any) => React.JSX.Element;
2
3
  export default RenderToolbar;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ProEditTableSummaryColumnType } from '../../propsType';
2
3
  interface SummaryProps<T = any> {
3
4
  data: T[];
@@ -8,5 +9,5 @@ interface SummaryProps<T = any> {
8
9
  };
9
10
  rowSelection: any;
10
11
  }
11
- declare const Summary: ({ data, summary, rowSelection }: SummaryProps) => import("react/jsx-runtime").JSX.Element;
12
+ declare const Summary: ({ data, summary, rowSelection }: SummaryProps) => import("react").JSX.Element;
12
13
  export default Summary;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { NamePath } from 'antd/es/form/interface';
2
3
  import { type ErrorStore } from '../../utils/validateAll';
3
4
  interface ValidatorProps {
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  export declare const defaultBtnNameMap: {
2
3
  add: any;
3
4
  edit: any;
@@ -9,7 +10,7 @@ export declare const defaultBtnNameMap: {
9
10
  custom: any;
10
11
  };
11
12
  export declare const iconMap: {
12
- add: import("react/jsx-runtime").JSX.Element;
13
+ add: import("react").JSX.Element;
13
14
  };
14
15
  export declare const defaultSingleActionKeys: string[];
15
16
  export declare const defaultMultipleActionKeys: string[];
@@ -12,7 +12,7 @@ export declare const getRandom: () => string;
12
12
  * @param rowKey 用户传入的 rowKey prop
13
13
  * @returns AntD Table 可用的 rowKey 字符串或函数
14
14
  */
15
- export declare const buildTableRowKey: (rowKey?: string | number | symbol | ((record: any) => any)) => ((record: any) => string);
15
+ export declare const buildTableRowKey: (rowKey?: string | number | symbol | ((record: any) => any)) => (record: any) => string;
16
16
  /**
17
17
  * 表格行数据的浅比较:仅比较第一层字段引用/值,避免虚拟滚动时整行深比较开销。
18
18
  * 行对象在本组件场景通常为扁平标量字段;同引用时由调用方另行处理。
@@ -3,10 +3,10 @@ declare const _default: {
3
3
  RangePicker: () => import("@zat-design/utils/dist/esm/transforms/propTypes").Transform<any>;
4
4
  DatePicker: (fieldProps?: {
5
5
  format?: string;
6
- picker?: DatePickerProps["picker"];
6
+ picker?: DatePickerProps['picker'];
7
7
  }) => {
8
8
  normalize: (value: any, prevValue?: any, allValues?: any) => any;
9
- getValueProps?: (value: import("rc-field-form/es/interface").StoreValue) => Record<string, unknown>;
9
+ getValueProps?: (value: any) => Record<string, unknown>;
10
10
  shouldUpdate?: import("rc-field-form/es/Field").ShouldUpdate<any>;
11
11
  };
12
12
  };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ProEnumType } from '../propsType';
2
3
  interface Props extends Pick<ProEnumType, 'id' | 'value' | 'onChange' | 'dataSource'> {
3
4
  fieldValue: string;
@@ -6,5 +7,5 @@ interface Props extends Pick<ProEnumType, 'id' | 'value' | 'onChange' | 'dataSou
6
7
  allowClear?: boolean;
7
8
  button?: boolean;
8
9
  }
9
- declare const Group: (props: Props) => import("react/jsx-runtime").JSX.Element;
10
+ declare const Group: (props: Props) => import("react").JSX.Element;
10
11
  export default Group;
@@ -1,7 +1,8 @@
1
+ /// <reference types="react" />
1
2
  import type { ProEnumType } from '../propsType';
2
3
  interface Props extends Pick<ProEnumType, 'id' | 'value' | 'onChange' | 'dataSource'> {
3
4
  fieldValue: string;
4
5
  fieldLabel: string;
5
6
  }
6
- declare const ProEnumTag: (props: Props) => import("react/jsx-runtime").JSX.Element;
7
+ declare const ProEnumTag: (props: Props) => import("react").JSX.Element;
7
8
  export default ProEnumTag;
@@ -1,9 +1,10 @@
1
+ import React from 'react';
1
2
  import useEnum from './hooks/useEnum';
2
3
  import getEnum from './utils/getEnum';
3
4
  import type { ProEnumType } from './propsType';
4
5
  declare const ProEnum: {
5
- (props: ProEnumType): import("react/jsx-runtime").JSX.Element;
6
- getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => import("react/jsx-runtime").JSX.Element;
6
+ (props: ProEnumType): React.JSX.Element;
7
+ getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => React.JSX.Element;
7
8
  useEnum: typeof useEnum;
8
9
  getEnum: typeof getEnum;
9
10
  };
@@ -1,2 +1,3 @@
1
- declare const getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => import("react/jsx-runtime").JSX.Element;
1
+ /// <reference types="react" />
2
+ declare const getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) => import("react").JSX.Element;
2
3
  export default getEnumLabel;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { ButtonProps, ColProps, FormInstance } from 'antd';
2
3
  import type { ModifiedFormInstanceType } from '../../propsType';
3
4
  export interface ButtonItem extends ButtonProps {
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import { Props } from './propsType';
2
- declare const Input: (props: Props) => import("react/jsx-runtime").JSX.Element;
3
+ declare const Input: (props: Props) => React.JSX.Element;
3
4
  export default Input;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { FormInstance, FormListOperation } from 'antd';
2
3
  import type { InternalNamePath } from 'antd/es/form/interface';
3
4
  import type { ToolbarActionType } from '../propsType';
@@ -9,5 +10,5 @@ interface EmptyProps {
9
10
  namePath?: InternalNamePath;
10
11
  emptyBtnText?: string;
11
12
  }
12
- declare const Empty: ({ disabled, toolbarProps, operation, form, namePath, emptyBtnText }: EmptyProps) => import("react/jsx-runtime").JSX.Element;
13
+ declare const Empty: ({ disabled, toolbarProps, operation, form, namePath, emptyBtnText }: EmptyProps) => import("react").JSX.Element;
13
14
  export default Empty;
@@ -1,3 +1,4 @@
1
+ /// <reference types="lodash" />
1
2
  import { InternalNamePath, NamePath } from 'antd/lib/form/interface';
2
3
  import { FormInstance, type FormItemProps } from 'antd';
3
4
  import React from 'react';
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ProCascaderType } from './propsType';
2
- declare const _default: import("react").MemoExoticComponent<(props: ProCascaderType) => import("react/jsx-runtime").JSX.Element>;
3
+ declare const _default: import("react").MemoExoticComponent<(props: ProCascaderType) => import("react").JSX.Element>;
3
4
  export default _default;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ProNumberRangeType } from './propsType';
2
3
  declare const _default: import("react").MemoExoticComponent<(props: ProNumberRangeType) => any>;
3
4
  export default _default;
@@ -1,8 +1,9 @@
1
+ import dayjs from 'dayjs';
1
2
  import type { Dayjs } from 'dayjs';
2
3
  interface Props<T = any> {
3
4
  value?: T;
4
5
  onChange?: (value: T, ...rest: any[]) => void;
5
6
  format?: string;
6
7
  }
7
- declare const useControlled: (props: Props) => [Dayjs | undefined, (value: Dayjs | undefined) => void];
8
+ declare const useControlled: (props: Props) => [dayjs.Dayjs, (value: Dayjs | undefined) => void];
8
9
  export default useControlled;
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
2
  import { FormProviderProps } from 'antd/es/form/context';
3
3
  import type { ProFormInstanceType } from './propsType';
4
- declare const ProFormForward: ProFormInstanceType;
4
+ declare const ProFormForward: ProFormInstanceType<any>;
5
5
  export declare const ProFormProvider: React.FC<FormProviderProps>;
6
6
  export default ProFormForward;
@@ -76,10 +76,10 @@ export declare const getDecimalDigits: (num: number) => number;
76
76
  * @returns {}
77
77
  */
78
78
  export declare const findOptionByValue: (treeData: any[], value: string | number, fieldNames: {
79
+ [key: string]: any;
79
80
  label?: string;
80
81
  value?: string;
81
82
  children?: string;
82
- [key: string]: any;
83
83
  }) => any;
84
84
  /** 解析namePath */
85
85
  export declare const parseNamePath: (input: string) => any;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  /** 列级响应式配置(可能为静态值或 ReactiveFunction) */
2
3
  export interface ReactiveProps {
3
4
  show?: any;
@@ -2,5 +2,5 @@ import { FormInstance, FormItemProps } from 'antd';
2
2
  import { NamePath } from 'antd/es/form/interface';
3
3
  import type { StoreValue, Store } from '@rc-component/form/es/interface';
4
4
  import type { TransformType } from '../propsType';
5
- export declare const transformValue: (names: NamePath[], form: FormInstance, fieldName: NamePath, normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue, getValueProps?: FormItemProps["getValueProps"]) => TransformType;
5
+ export declare const transformValue: (names: NamePath[], form: FormInstance, fieldName: NamePath, normalize?: (value: StoreValue, prevValue: StoreValue, allValues: Store) => StoreValue, getValueProps?: FormItemProps['getValueProps']) => TransformType;
6
6
  export default transformValue;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { OpenMenuPropsType } from './propsType';
2
- declare const OpenMenu: (props: OpenMenuPropsType) => import("react/jsx-runtime").JSX.Element;
3
+ declare const OpenMenu: (props: OpenMenuPropsType) => import("react").JSX.Element;
3
4
  export default OpenMenu;
@@ -1,4 +1,7 @@
1
- import type { FC } from 'react';
1
+ import type { FC, Ref } from 'react';
2
2
  import type { ProLayoutType } from '../../../propTypes';
3
- declare const Notice: FC<ProLayoutType>;
3
+ type NoticeProps = ProLayoutType & {
4
+ noticeRef?: Ref<HTMLDivElement>;
5
+ };
6
+ declare const Notice: FC<NoticeProps>;
4
7
  export default Notice;
@@ -6,12 +6,14 @@ const Notice = props => {
6
6
  const {
7
7
  headerHeight,
8
8
  notice,
9
- onCancel
9
+ onCancel,
10
+ noticeRef
10
11
  } = props;
11
12
  if (!notice) {
12
13
  return null;
13
14
  }
14
15
  return /*#__PURE__*/_jsxs("div", {
16
+ ref: noticeRef,
15
17
  className: "pro-layout-header-notice",
16
18
  style: {
17
19
  top: headerHeight
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { ProCollapseType } from './PropTypes';
2
- declare const ProCollapse: (props: ProCollapseType) => import("react/jsx-runtime").JSX.Element;
3
+ declare const ProCollapse: (props: ProCollapseType) => React.JSX.Element;
3
4
  export default ProCollapse;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ProFooterType } from './PropTypes';
2
- declare const _default: import("react").MemoExoticComponent<(props: ProFooterType) => import("react/jsx-runtime").JSX.Element>;
3
+ declare const _default: import("react").MemoExoticComponent<(props: ProFooterType) => import("react").JSX.Element>;
3
4
  export default _default;
@@ -1,4 +1,5 @@
1
+ /// <reference types="react" />
1
2
  declare const Copy: ({ text }: {
2
3
  text: any;
3
- }) => import("react/jsx-runtime").JSX.Element;
4
+ }) => import("react").JSX.Element;
4
5
  export default Copy;
@@ -6,15 +6,15 @@ type DescribeValueItem = Pick<DescribeColumnType, 'tag' | 'link' | 'value' | 'co
6
6
  * 标签渲染:数组 tag 逐个渲染,单值渲染一个,空则不渲染
7
7
  */
8
8
  export declare const DescribeTag: ({ tag, parentKey, }: {
9
- tag?: DescribeColumnType["tag"];
9
+ tag?: DescribeColumnType['tag'];
10
10
  parentKey: string;
11
- }) => import("react/jsx-runtime").JSX.Element;
11
+ }) => React.JSX.Element;
12
12
  /**
13
13
  * 单行值渲染:link → <a>,copyable+字符串 → 复制按钮,末尾追加 tag
14
14
  */
15
15
  export declare const DescribeValue: ({ value, link, copyable, tag, parentKey, }: DescribeValueItem & {
16
16
  parentKey: string;
17
- }) => import("react/jsx-runtime").JSX.Element;
17
+ }) => React.JSX.Element;
18
18
  /**
19
19
  * 多值渲染:以「、」连接;超 3 个显示「共N个,」前缀;内容溢出时显示「...」并用 Tooltip 展示全部
20
20
  */
@@ -22,5 +22,5 @@ export declare const DescribeItems: ({ items, parentKey, containerRef, }: {
22
22
  items: DescribeValueItem[];
23
23
  parentKey: string;
24
24
  containerRef: React.RefObject<HTMLDivElement>;
25
- }) => import("react/jsx-runtime").JSX.Element;
25
+ }) => React.JSX.Element;
26
26
  export {};
@@ -1,4 +1,4 @@
1
1
  import React from 'react';
2
2
  import type { ProHeaderType } from './PropTypes';
3
- declare const _default: React.MemoExoticComponent<(props: ProHeaderType) => import("react/jsx-runtime").JSX.Element>;
3
+ declare const _default: React.MemoExoticComponent<(props: ProHeaderType) => React.JSX.Element>;
4
4
  export default _default;
@@ -372,9 +372,10 @@ const ProHeader = props => {
372
372
  // has = 有次级描述 或 有主级描述;no = 无主级描述。二者非严格互斥(原实现即如此,未改动其行为)。
373
373
  const noDescribe = _isEmpty(describeColumns);
374
374
  const hasDescribe = !_isEmpty(finalSubDescribeColumns) || !noDescribe;
375
+ const hasFixedTop = fixedTop !== undefined && fixedTop !== null;
375
376
  const cls = classnames({
376
377
  'pro-header': true,
377
- 'pro-header-fixed': fixedTop,
378
+ 'pro-header-fixed': hasFixedTop,
378
379
  'pro-header-shadow': showShadow,
379
380
  // 内部窗口滚动自带阴影场景
380
381
  'pro-header-no-back': !backState,
@@ -425,7 +426,9 @@ const ProHeader = props => {
425
426
  className: cls,
426
427
  style: {
427
428
  ...style,
428
- top: fixedTop,
429
+ ...(hasFixedTop ? {
430
+ top: fixedTop
431
+ } : {}),
429
432
  zIndex
430
433
  },
431
434
  children: finalTitle ? /*#__PURE__*/_jsx("div", {
@@ -13,7 +13,7 @@ export declare const toKeyPart: (value: unknown) => string | undefined;
13
13
  /** 主级描述项 key:label → value → describe-${index} */
14
14
  export declare const getDescribeColumnKey: (item: DescribeColumnType, index: number) => string;
15
15
  /** 描述值 key:link → value → ${parentKey}-value-${index} */
16
- export declare const getDescribeValueKey: (item: Pick<DescribeColumnType, "tag" | "link" | "value" | "copyable">, parentKey: string, index: number) => string;
16
+ export declare const getDescribeValueKey: (item: Pick<DescribeColumnType, 'tag' | 'link' | 'value' | 'copyable'>, parentKey: string, index: number) => string;
17
17
  /** 标签 key:tagItem → ${parentKey}-tag-${index} */
18
18
  export declare const getTagKey: (tagItem: string | React.ReactNode, parentKey: string, index: number) => string;
19
19
  /** 次级描述项 key:label → code → sub-describe-${index} */
@@ -1,7 +1,8 @@
1
+ /// <reference types="react" />
1
2
  import { TabContextMenuProps } from '../propTypes';
2
3
  /**
3
4
  * 右键菜单组件 - 兼容Antd 4.x和5.x
4
5
  */
5
- declare function TabContextMenu({ tabId, children, closable, onClose, onCloseOthers, onCloseRight, onCloseAll, pinned, pinDisabled, onTogglePin, menuItems: customMenuItems, tabMenuClick, tab, tabs, }: TabContextMenuProps): import("react/jsx-runtime").JSX.Element;
6
+ declare function TabContextMenu({ tabId, children, closable, onClose, onCloseOthers, onCloseRight, onCloseAll, pinned, pinDisabled, onTogglePin, menuItems: customMenuItems, tabMenuClick, tab, tabs, }: TabContextMenuProps): import("react").JSX.Element;
6
7
  export default TabContextMenu;
7
8
  export { TabContextMenu };
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { ProLayoutTabsInstance } from '../../../propTypes';
2
3
  /**
3
4
  * 标签页实例 Context,用于在 ProLayout children 中访问标签页 API
@@ -1,3 +1,4 @@
1
+ import React from 'react';
1
2
  import type { TabsProps } from 'antd';
2
3
  export interface TabsHeaderProps {
3
4
  activeKey: string | undefined;
@@ -7,4 +8,4 @@ export interface TabsHeaderProps {
7
8
  draggable?: boolean;
8
9
  onReorder?: (activeId: string, overId: string) => void;
9
10
  }
10
- export declare function TabsHeader({ activeKey, tabsItems, onTabChange, onTabEdit, draggable, onReorder, }: TabsHeaderProps): import("react/jsx-runtime").JSX.Element;
11
+ export declare function TabsHeader({ activeKey, tabsItems, onTabChange, onTabEdit, draggable, onReorder, }: TabsHeaderProps): React.JSX.Element;
@@ -3,7 +3,7 @@ import { message } from 'antd';
3
3
  import { DEFAULT_TABS_CONFIG } from "../propTypes";
4
4
  import { useTabsCache } from "./useTabsCache";
5
5
  import locale, { formatMessage } from "../../../../locale";
6
- import { createTabFromMenu, generateTabId, shouldOpenExternal, handleExternalOpen, checkTabLimit, getRightTabs, flattenMenuData, canOpenAsTab, getMenuRoute, findExistingTab, derivePinned, pinTab as pinTabInList, unpinTab as unpinTabInList, reorderWithPinConstraint } from "../utils";
6
+ import { createTabFromMenu, generateTabId, shouldOpenExternal, handleExternalOpen, checkTabLimit, getRightTabs, flattenMenuData, canOpenAsTab, getMenuRoute, findExistingTab, resolveTabMenuItem, derivePinned, getPinnedBoundary, pinTab as pinTabInList, unpinTab as unpinTabInList, reorderWithPinConstraint } from "../utils";
7
7
 
8
8
  /**
9
9
  * 标签页状态管理Hook
@@ -74,6 +74,7 @@ export const useTabsState = options => {
74
74
  }, [restoreFromCache]);
75
75
  const lastActiveKeyRef = useRef('');
76
76
  const shouldSkipSaveRef = useRef(false);
77
+ const initialTabsAppliedRef = useRef(false);
77
78
 
78
79
  // 保存状态到缓存
79
80
  useEffect(() => {
@@ -186,12 +187,14 @@ export const useTabsState = options => {
186
187
  const tabId = generateTabId(menuItem, existingIds);
187
188
  const newTab = createTabFromMenu(menuItem, prevState.newTabIndex);
188
189
  newTab.id = tabId;
190
+ const pinnedBoundary = getPinnedBoundary(prevState.tabsList);
191
+ const nextTabsList = derivePinned(newTab) ? [...prevState.tabsList.slice(0, pinnedBoundary), newTab, ...prevState.tabsList.slice(pinnedBoundary)] : [...prevState.tabsList, newTab];
189
192
 
190
193
  // silent=true 时,若已有 active 则保留;无 active(首次进入)仍激活以保留默认行为
191
194
  const shouldActivate = !silent || prevState.activeKey === '';
192
195
  return {
193
196
  ...prevState,
194
- tabsList: [...prevState.tabsList, newTab],
197
+ tabsList: nextTabsList,
195
198
  activeKey: shouldActivate ? tabId : prevState.activeKey,
196
199
  activeTabInfo: shouldActivate ? newTab : prevState.activeTabInfo,
197
200
  newTabIndex: prevState.newTabIndex + 1,
@@ -200,6 +203,23 @@ export const useTabsState = options => {
200
203
  });
201
204
  }, [finalConfig]);
202
205
 
206
+ // 普通初始标签只在当前 TabsManager 挂载周期应用一次。
207
+ // 缓存恢复已有标签时只消费默认值;closeAll 后 ref 保持 true,避免再次补签。
208
+ useEffect(() => {
209
+ const initialTabs = finalConfig.initialTabs;
210
+ if (!isInitialized || !cacheEnabled || initialTabsAppliedRef.current || !initialTabs || initialTabs.length === 0) {
211
+ return;
212
+ }
213
+ initialTabsAppliedRef.current = true;
214
+ if (state.tabsList.length > 0) return;
215
+ const sourceMenus = Array.isArray(dataSource?.menus) ? dataSource.menus : [];
216
+ initialTabs.forEach(params => {
217
+ addTab(resolveTabMenuItem(params, sourceMenus), {
218
+ silent: true
219
+ });
220
+ });
221
+ }, [isInitialized, cacheEnabled, finalConfig.initialTabs, dataSource, state.tabsList.length, addTab]);
222
+
203
223
  /**
204
224
  * 更新已存在标签页的展示信息(保持 tab.id 不变 → 子组件不会 unmount)
205
225
  * - 仅允许更新 name / icon / extra / closable
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import { TabsManagerProps } from './propTypes';
2
3
  /**
3
4
  * 标签页管理器主组件
@@ -1,8 +1,8 @@
1
- import { useCallback, useMemo, forwardRef, useImperativeHandle, useState, useEffect, useRef } from 'react';
1
+ import { useCallback, useMemo, forwardRef, useImperativeHandle, useState, useEffect, useLayoutEffect, useRef } from 'react';
2
2
  import { createPortal } from 'react-dom';
3
3
  import { useTabsState } from "./hooks/useTabsState";
4
4
  import { useIframeRoute } from "./hooks/useIframeRoute";
5
- import { flattenMenuData, derivePinned } from "./utils";
5
+ import { flattenMenuData, resolveTabMenuItem, derivePinned } from "./utils";
6
6
  import { TabItemComponent } from "./components/TabItem";
7
7
  import { TabsHeader } from "./components/TabsHeader";
8
8
  import { TabsContext } from "./components/TabsContext";
@@ -31,9 +31,14 @@ const TabsManager = /*#__PURE__*/forwardRef(({
31
31
  });
32
32
 
33
33
  // 通知父级(ProLayout)pure 状态变化
34
- useEffect(() => {
34
+ useLayoutEffect(() => {
35
35
  onIframePureChange?.(isIframePure);
36
36
  }, [isIframePure, onIframePureChange]);
37
+
38
+ // TabsManager 退出 tabs 模式或上报目标变更时,释放旧父级持有的 pure 状态。
39
+ useLayoutEffect(() => () => {
40
+ onIframePureChange?.(false);
41
+ }, [onIframePureChange]);
37
42
  const {
38
43
  state,
39
44
  isInitialized,
@@ -150,10 +155,15 @@ const TabsManager = /*#__PURE__*/forwardRef(({
150
155
  }, [state.tabsList]);
151
156
 
152
157
  // 通知父级(ProLayout)当前是否有 Tab
153
- useEffect(() => {
158
+ useLayoutEffect(() => {
154
159
  onTabsChange?.(state.tabsList.length > 0);
155
160
  }, [state.tabsList.length, onTabsChange]);
156
161
 
162
+ // 卸载时显式复位,避免 ProLayout 在动态退出 tabs 模式后保留偏移状态。
163
+ useLayoutEffect(() => () => {
164
+ onTabsChange?.(false);
165
+ }, [onTabsChange]);
166
+
157
167
  // 处理声明式固定标签页:config.fixed 中的 code 在初始化完成后自动添加,强制 closable=false
158
168
  // 用 ref 持有 addTab,避免 addTab 引用变化引起无限循环
159
169
  const addTabRef = useRef(addTab);
@@ -221,28 +231,8 @@ const TabsManager = /*#__PURE__*/forwardRef(({
221
231
  // 创建标签页实例 API
222
232
  const tabsInstance = useMemo(() => ({
223
233
  addTab: (params, options) => {
224
- const {
225
- code,
226
- name,
227
- extra,
228
- relationKey
229
- } = params;
230
- const sourceMenus = Array.isArray(dataSource?.menus) ? flattenMenuData(dataSource.menus) : [];
231
- const matchedMenu = sourceMenus.find(item => item.code === code);
232
- const menuItem = matchedMenu ? {
233
- ...matchedMenu,
234
- // 允许外部覆盖展示名称和附加数据,但保留菜单原始 closable/url 等配置
235
- name: name || matchedMenu.name,
236
- extra: extra ?? matchedMenu.extra,
237
- relationKey: relationKey ?? matchedMenu.relationKey
238
- } : {
239
- id: Date.now(),
240
- code,
241
- name,
242
- url: `/${code}`,
243
- extra,
244
- relationKey
245
- };
234
+ const sourceMenus = Array.isArray(dataSource?.menus) ? dataSource.menus : [];
235
+ const menuItem = resolveTabMenuItem(params, sourceMenus);
246
236
  addTab(menuItem, options);
247
237
  },
248
238
  removeTab,
@@ -1,10 +1,10 @@
1
- import { TabItem, MenusType } from '../../../propTypes';
1
+ import { AddTabParams, TabItem, MenusType } from '../../../propTypes';
2
2
  /**
3
3
  * 获取菜单实际用于路由/签页的路径
4
4
  * 约定优先使用 redirectUrl,其次回退 url
5
5
  */
6
6
  export declare const getMenuRoute: (menuItem: MenusType) => string;
7
- export declare const hasRelationKey: (relationKey: MenusType["relationKey"]) => relationKey is string | number;
7
+ export declare const hasRelationKey: (relationKey: MenusType['relationKey']) => relationKey is string | number;
8
8
  export declare const findExistingTab: (tabsList: TabItem[], menuItem: MenusType) => TabItem | undefined;
9
9
  /**
10
10
  * 根据菜单项生成TabItem
@@ -37,6 +37,10 @@ export declare const getRightTabs: (tabs: TabItem[], currentTabId: string) => Ta
37
37
  * 扁平化菜单数据
38
38
  */
39
39
  export declare const flattenMenuData: (menus?: MenusType[]) => MenusType[];
40
+ /**
41
+ * 将公开 addTab 参数解析为内部菜单项,统一 initialTabs 与实例 API 的匹配规则。
42
+ */
43
+ export declare const resolveTabMenuItem: (params: AddTabParams, menus?: MenusType[]) => MenusType;
40
44
  /**
41
45
  * 判断菜单项是否为最后一级(叶子节点)
42
46
  * 只有当菜单项没有子菜单或子菜单为空时,才认为是叶子节点
@@ -107,6 +107,29 @@ export const flattenMenuData = (menus = []) => {
107
107
  return flatMenus;
108
108
  };
109
109
 
110
+ /**
111
+ * 将公开 addTab 参数解析为内部菜单项,统一 initialTabs 与实例 API 的匹配规则。
112
+ */
113
+ export const resolveTabMenuItem = (params, menus = []) => {
114
+ const matchedMenu = flattenMenuData(menus).find(item => item.code === params.code);
115
+ if (matchedMenu) {
116
+ return {
117
+ ...matchedMenu,
118
+ name: params.name || matchedMenu.name,
119
+ extra: params.extra ?? matchedMenu.extra,
120
+ relationKey: params.relationKey ?? matchedMenu.relationKey
121
+ };
122
+ }
123
+ return {
124
+ id: Date.now(),
125
+ code: params.code,
126
+ name: params.name,
127
+ url: `/${params.code}`,
128
+ extra: params.extra,
129
+ relationKey: params.relationKey
130
+ };
131
+ };
132
+
110
133
  /**
111
134
  * 判断菜单项是否为最后一级(叶子节点)
112
135
  * 只有当菜单项没有子菜单或子菜单为空时,才认为是叶子节点