@zat-design/sisyphus-react 4.5.7 → 4.5.8-beta.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.esm.css +1 -1
- package/dist/less.esm.css +1 -1
- package/es/ProAction/components/CheckModalContent/index.d.ts +2 -1
- package/es/ProDownload/index.d.ts +2 -1
- package/es/ProDrawerForm/hooks/useConfirmClose.d.ts +1 -0
- package/es/ProEditTable/components/ActionButton/index.d.ts +2 -1
- package/es/ProEditTable/components/RcTable/BaseTable.d.ts +2 -1
- package/es/ProEditTable/components/RcTable/DraggableTable.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/index.d.ts +1 -1
- package/es/ProEditTable/components/RenderToolbar/index.d.ts +2 -1
- package/es/ProEditTable/components/Summary/index.d.ts +2 -1
- package/es/ProEditTable/components/Validator/index.d.ts +1 -0
- package/es/ProEditTable/utils/config.d.ts +2 -1
- package/es/ProEditTable/utils/tools.d.ts +1 -1
- package/es/ProEditTable/utils/transform.d.ts +2 -2
- package/es/ProEnum/components/Group.d.ts +2 -1
- package/es/ProEnum/components/Tag.d.ts +2 -1
- package/es/ProEnum/index.d.ts +3 -2
- package/es/ProEnum/utils/getEnumLabel.d.ts +2 -1
- package/es/ProForm/components/FormFooter/propsType.d.ts +1 -0
- package/es/ProForm/components/base/Input/index.d.ts +2 -1
- package/es/ProForm/components/combination/FormList/components/Empty.d.ts +2 -1
- package/es/ProForm/components/combination/Group/utils/index.d.ts +1 -0
- package/es/ProForm/components/combination/ProCascader/index.d.ts +2 -1
- package/es/ProForm/components/combination/ProNumberRange/index.d.ts +1 -0
- package/es/ProForm/components/combination/ProTimeLimit/hooks/useControlled.d.ts +2 -1
- package/es/ProForm/index.d.ts +1 -1
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/reactiveValues.d.ts +1 -0
- package/es/ProForm/utils/transformValue.d.ts +1 -1
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.d.ts +2 -1
- package/es/ProLayout/components/Layout/Notice/index.d.ts +5 -2
- package/es/ProLayout/components/Layout/Notice/index.js +3 -1
- package/es/ProLayout/components/ProCollapse/index.d.ts +2 -1
- package/es/ProLayout/components/ProFooter/index.d.ts +2 -1
- package/es/ProLayout/components/ProHeader/components/Copy/index.d.ts +2 -1
- package/es/ProLayout/components/ProHeader/components/Describe/index.d.ts +4 -4
- package/es/ProLayout/components/ProHeader/index.d.ts +1 -1
- package/es/ProLayout/components/ProHeader/index.js +5 -2
- package/es/ProLayout/components/ProHeader/utils/index.d.ts +1 -1
- package/es/ProLayout/components/TabsManager/components/TabContextMenu.d.ts +2 -1
- package/es/ProLayout/components/TabsManager/components/TabItem.js +0 -1
- package/es/ProLayout/components/TabsManager/components/TabsContext.d.ts +1 -0
- package/es/ProLayout/components/TabsManager/components/TabsHeader.d.ts +2 -1
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +30 -7
- package/es/ProLayout/components/TabsManager/index.d.ts +1 -0
- package/es/ProLayout/components/TabsManager/index.js +16 -26
- package/es/ProLayout/components/TabsManager/utils/index.d.ts +6 -2
- package/es/ProLayout/components/TabsManager/utils/index.js +23 -0
- package/es/ProLayout/index.d.ts +6 -5
- package/es/ProLayout/index.js +45 -7
- package/es/ProLayout/propTypes.d.ts +4 -0
- package/es/ProLayout/style/index.less +15 -2
- package/es/ProSelect/components/AdaptiveTooltip.d.ts +2 -1
- package/es/ProSelect/index.d.ts +1 -1
- package/es/ProStep/components/Step/index.d.ts +3 -2
- package/es/ProStep/components/Step/index.js +6 -3
- package/es/ProStep/index.d.ts +2 -2
- package/es/ProStep/propsType.d.ts +2 -2
- package/es/ProTable/components/FormatColumn/index.d.ts +1 -1
- package/es/ProTable/components/RcTable/components/BaseTable/index.d.ts +1 -0
- package/es/ProTable/components/RcTable/components/DraggableTable/components/DndWrapper/index.d.ts +1 -1
- package/es/ProTable/components/RcTable/components/DraggableTable/index.d.ts +1 -0
- package/es/ProTable/components/RenderFooter/index.d.ts +2 -1
- package/es/ProTable/components/RenderTableHeader/index.d.ts +2 -1
- package/es/ProTable/components/RenderTabs/index.d.ts +2 -1
- package/es/ProTable/components/TableResizable/index.d.ts +2 -1
- package/es/ProTable/index.d.ts +1 -1
- package/es/ProTabs/components/Card/index.d.ts +2 -1
- package/es/ProThemeTools/component/ProTools/index.d.ts +2 -1
- package/es/ProThemeTools/index.d.ts +2 -1
- package/es/ProTooltip/index.d.ts +2 -1
- package/es/ProTree/components/AdaptiveTooltip.d.ts +2 -1
- package/es/ProTree/components/CloseIcon.d.ts +2 -1
- package/es/ProTree/components/List.d.ts +1 -1
- package/es/ProTree/components/ProTree.d.ts +2 -1
- package/es/ProTree/components/ProTreeSelect/index.d.ts +1 -1
- package/es/ProTree/components/SearchTitle.d.ts +2 -1
- package/es/ProTree/components/Tree.d.ts +2 -2
- package/es/ProTree/index.d.ts +2 -1
- package/es/ProTreeModal/components/Cascader.d.ts +1 -1
- package/es/ProTreeModal/components/CloseIcon.d.ts +2 -1
- package/es/ProTreeModal/components/SearchTitle.d.ts +2 -1
- package/es/ProTreeModal/components/Trigger.d.ts +1 -1
- package/es/ProTreeModal/index.d.ts +2 -1
- package/es/ProUpload/components/DraggableUploadListItem.d.ts +2 -1
- package/es/hooks/useDraggableRow.d.ts +1 -1
- 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
|
|
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
|
|
4
|
+
(props: ProDownloadType): import("react").JSX.Element;
|
|
4
5
|
downLoadRequest: import("./utils").DownloadRequestProps;
|
|
5
6
|
};
|
|
6
7
|
export default ProDownload;
|
|
@@ -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
|
|
5
|
+
}) => import("react").JSX.Element>;
|
|
5
6
|
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) =>
|
|
2
|
+
declare const _default: React.MemoExoticComponent<({ text: value, record, index, column, config }: any) => React.JSX.Element>;
|
|
3
3
|
export default _default;
|
|
@@ -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
|
|
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
|
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
|
|
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)) => (
|
|
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[
|
|
6
|
+
picker?: DatePickerProps['picker'];
|
|
7
7
|
}) => {
|
|
8
8
|
normalize: (value: any, prevValue?: any, allValues?: any) => any;
|
|
9
|
-
getValueProps?: (value:
|
|
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
|
|
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
|
|
7
|
+
declare const ProEnumTag: (props: Props) => import("react").JSX.Element;
|
|
7
8
|
export default ProEnumTag;
|
package/es/ProEnum/index.d.ts
CHANGED
|
@@ -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):
|
|
6
|
-
getEnumLabel: (code: string | string[], value: any, compose?: boolean, fieldNameLabel?: string, fieldNameValue?: string) =>
|
|
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
|
-
|
|
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 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
|
|
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="react" />
|
|
1
2
|
import type { ProCascaderType } from './propsType';
|
|
2
|
-
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderType) => import("react
|
|
3
|
+
declare const _default: import("react").MemoExoticComponent<(props: ProCascaderType) => import("react").JSX.Element>;
|
|
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
|
|
8
|
+
declare const useControlled: (props: Props) => [dayjs.Dayjs, (value: Dayjs | undefined) => void];
|
|
8
9
|
export default useControlled;
|
package/es/ProForm/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -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[
|
|
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
|
|
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
|
-
|
|
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) =>
|
|
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
|
|
3
|
+
declare const _default: import("react").MemoExoticComponent<(props: ProFooterType) => import("react").JSX.Element>;
|
|
3
4
|
export default _default;
|
|
@@ -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[
|
|
9
|
+
tag?: DescribeColumnType['tag'];
|
|
10
10
|
parentKey: string;
|
|
11
|
-
}) =>
|
|
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
|
-
}) =>
|
|
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
|
-
}) =>
|
|
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) =>
|
|
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':
|
|
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
|
-
|
|
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,
|
|
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
|
|
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
|
+
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):
|
|
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
|
|
@@ -59,18 +59,22 @@ export const useTabsState = options => {
|
|
|
59
59
|
delete restoredState.activeTab;
|
|
60
60
|
}
|
|
61
61
|
|
|
62
|
-
//
|
|
63
|
-
//
|
|
64
|
-
restoredState.tabsList = restoredState.tabsList.map(tab =>
|
|
62
|
+
// 兼容旧缓存:Ant Tabs 的 onChange 始终返回字符串 key;旧版本可能保存数字 id,
|
|
63
|
+
// 若不归一化,严格比较会导致恢复后的标签无法切换。
|
|
64
|
+
restoredState.tabsList = restoredState.tabsList.map(tab => ({
|
|
65
65
|
...tab,
|
|
66
|
-
|
|
67
|
-
|
|
66
|
+
id: String(tab.id),
|
|
67
|
+
pinned: tab.pinned === undefined ? derivePinned(tab) : tab.pinned
|
|
68
|
+
}));
|
|
69
|
+
restoredState.activeKey = restoredState.activeKey === undefined || restoredState.activeKey === null ? '' : String(restoredState.activeKey);
|
|
70
|
+
restoredState.activeTabInfo = restoredState.tabsList.find(tab => tab.id === restoredState.activeKey);
|
|
68
71
|
setState(restoredState);
|
|
69
72
|
}
|
|
70
73
|
setIsInitialized(true);
|
|
71
74
|
}, [restoreFromCache]);
|
|
72
75
|
const lastActiveKeyRef = useRef('');
|
|
73
76
|
const shouldSkipSaveRef = useRef(false);
|
|
77
|
+
const initialTabsAppliedRef = useRef(false);
|
|
74
78
|
|
|
75
79
|
// 保存状态到缓存
|
|
76
80
|
useEffect(() => {
|
|
@@ -183,12 +187,14 @@ export const useTabsState = options => {
|
|
|
183
187
|
const tabId = generateTabId(menuItem, existingIds);
|
|
184
188
|
const newTab = createTabFromMenu(menuItem, prevState.newTabIndex);
|
|
185
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];
|
|
186
192
|
|
|
187
193
|
// silent=true 时,若已有 active 则保留;无 active(首次进入)仍激活以保留默认行为
|
|
188
194
|
const shouldActivate = !silent || prevState.activeKey === '';
|
|
189
195
|
return {
|
|
190
196
|
...prevState,
|
|
191
|
-
tabsList:
|
|
197
|
+
tabsList: nextTabsList,
|
|
192
198
|
activeKey: shouldActivate ? tabId : prevState.activeKey,
|
|
193
199
|
activeTabInfo: shouldActivate ? newTab : prevState.activeTabInfo,
|
|
194
200
|
newTabIndex: prevState.newTabIndex + 1,
|
|
@@ -197,6 +203,23 @@ export const useTabsState = options => {
|
|
|
197
203
|
});
|
|
198
204
|
}, [finalConfig]);
|
|
199
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
|
+
|
|
200
223
|
/**
|
|
201
224
|
* 更新已存在标签页的展示信息(保持 tab.id 不变 → 子组件不会 unmount)
|
|
202
225
|
* - 仅允许更新 name / icon / extra / closable
|
|
@@ -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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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[
|
|
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
|
* 只有当菜单项没有子菜单或子菜单为空时,才认为是叶子节点
|