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

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/README.md CHANGED
@@ -86,6 +86,12 @@ createRoot(document.getElementById('root')!).render(<App />);
86
86
 
87
87
  ### 本地开发
88
88
 
89
+ 本项目当前依赖链包含旧版 Umi/Dumi 与 React 19 的 peer dependency 冲突,使用 npm 安装时会自动启用 legacy peer 解析:
90
+
91
+ ```bash
92
+ npm install --legacy-peer-deps
93
+ ```
94
+
89
95
  ```bash
90
96
  yarn install
91
97
  yarn start
@@ -144,7 +144,7 @@ const ProModal = ({
144
144
  title: title,
145
145
  width: width,
146
146
  open: open,
147
- mask: typeof modalMask === 'object' ? {
147
+ mask: typeof modalMask === 'object' && modalMask !== null ? {
148
148
  closable: maskClosable,
149
149
  ...modalMask
150
150
  } : modalMask ?? {
@@ -6,6 +6,7 @@ import _get from "lodash/get";
6
6
  import React, { forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef } from 'react';
7
7
  import { useLocalStorageState, useSetState } from 'ahooks';
8
8
  import { ConfigProvider, Form, Affix } from 'antd';
9
+ import { ConfigContext } from 'antd/es/config-provider';
9
10
  import classnames from 'classnames';
10
11
  import { transformColumns } from "./utils";
11
12
  import { createErrorStore } from "./utils/validateAll";
@@ -87,7 +88,7 @@ const ProEditTable = ({
87
88
 
88
89
  const {
89
90
  getPrefixCls
90
- } = React.useContext(ConfigProvider.ConfigContext);
91
+ } = React.useContext(ConfigContext);
91
92
  const prefixCls = getPrefixCls();
92
93
  const [themeConfig] = useLocalStorageState('themeConfig');
93
94
  const requiredAlign = useMemo(() => {
@@ -40,7 +40,6 @@ const ToolbarButton = props => {
40
40
  const _toolbarProps = props.toolbarProps?.map(item => {
41
41
  return {
42
42
  ...item,
43
- // @ts-ignore
44
43
  type: item.actionType || item.type
45
44
  };
46
45
  });
@@ -26,6 +26,8 @@ export interface ActionType extends Omit<ButtonProps, 'onClick' | 'type'> {
26
26
  addIndex?: number | ((record: any, option: Pick<Option, 'index' | 'form' | 'namePath' | 'operation'>) => number);
27
27
  }
28
28
  export interface ToolbarActionType extends Omit<ActionType, 'actionType' | 'onHandle' | 'onClick' | 'show' | 'type'> {
29
+ /** @deprecated 使用 type,保留旧配置兼容 */
30
+ actionType?: 'add';
29
31
  type?: 'add';
30
32
  onHandle?: ToolbarCallback;
31
33
  onClick?: ToolbarCallback;
@@ -1,5 +1,5 @@
1
1
  import { InternalNamePath, NamePath } from 'antd/lib/form/interface';
2
- import { FormInstance } from 'antd';
2
+ import { FormInstance, type FormItemProps } from 'antd';
3
3
  import React from 'react';
4
4
  import type { GroupColumnType, SpaceType, FlexibleGroupColumnType } from '../propsType';
5
5
  import type { ProFormColumnType, ReactiveFunction } from '../../../render/propsType';
@@ -62,80 +62,13 @@ interface GroupProps {
62
62
  disabled?: boolean;
63
63
  formDisabled?: boolean;
64
64
  }
65
+ type GroupFormItemProps = FormItemProps & {
66
+ disabled?: boolean;
67
+ };
65
68
  /**
66
69
  * 创建FormItem属性(Hook版本)
67
70
  */
68
- export declare const useFormItemProps: (column: FlexibleGroupColumnType, contextProps: ContextProps, groupProps: GroupProps) => {
69
- rules: any[];
70
- required: boolean;
71
- label: string;
72
- before?: React.ReactNode;
73
- after?: React.ReactNode;
74
- confirm?: boolean | import("antd").ModalFuncProps | import("../../../render/propsType").FunctionArgs<any, boolean | import("antd").ModalFuncProps>;
75
- show?: boolean | ReactiveFunction<any, boolean>;
76
- component?: React.ReactNode | ReactiveFunction<any, React.ReactNode>;
77
- className?: string;
78
- hidden?: boolean;
79
- id?: string;
80
- style?: React.CSSProperties;
81
- children?: React.ReactNode | ((form: FormInstance<any>) => React.ReactNode);
82
- onReset?: () => void;
83
- prefixCls?: string;
84
- isView?: boolean;
85
- desensitization?: [number, number] | ReactiveFunction<any, [number, number]>;
86
- rootClassName?: string;
87
- status?: import("antd/es/form/FormItem").ValidateStatus;
88
- vertical?: boolean;
89
- getValueProps?: ((value: any) => Record<string, unknown>) & ((value: import("@rc-component/form/lib/interface").StoreValue) => Record<string, unknown>);
90
- colon?: boolean;
91
- htmlFor?: string;
92
- labelAlign?: import("antd/es/form/interface").FormLabelAlign;
93
- labelCol?: import("antd").ColProps;
94
- getValueFromEvent?: (...args: import("@rc-component/form/lib/interface").EventArgs) => import("@rc-component/form/lib/interface").StoreValue;
95
- normalize?: (value: import("@rc-component/form/lib/interface").StoreValue, prevValue: import("@rc-component/form/lib/interface").StoreValue, allValues: import("@rc-component/form/lib/interface").Store) => import("@rc-component/form/lib/interface").StoreValue;
96
- shouldUpdate?: import("@rc-component/form/lib/Field").ShouldUpdate<any>;
97
- trigger?: string;
98
- validateTrigger?: string | string[] | false;
99
- validateDebounce?: number;
100
- valuePropName?: string;
101
- messageVariables?: Record<string, string>;
102
- initialValue?: any;
103
- onMetaChange?: (meta: import("@rc-component/form/lib/Field").MetaEvent) => void;
104
- preserve?: boolean;
105
- isListField?: boolean;
106
- isList?: boolean;
107
- noStyle?: boolean;
108
- hasFeedback?: boolean | {
109
- icons: import("antd/es/form/FormItem").FeedbackIcons;
110
- };
111
- validateStatus?: import("antd/es/form/FormItem").ValidateStatus;
112
- layout?: import("antd/es/form/Form").FormItemLayout;
113
- wrapperCol?: import("antd").ColProps;
114
- help?: React.ReactNode;
115
- fieldId?: string;
116
- valueType?: import("../../../render/propsType").ProFormValueType;
117
- toISOString?: boolean;
118
- toCSTString?: boolean;
119
- switchValue?: [any, any];
120
- clearNotShow?: boolean;
121
- trim?: boolean;
122
- upperCase?: boolean;
123
- viewRender?: (value: any, record: any, { form, index, namePath, }: {
124
- [key: string]: any;
125
- form: FormInstance<any>;
126
- index?: number | undefined;
127
- }) => React.ReactElement<any, any> | string | undefined | null;
128
- viewType?: import("../../../render/propsType").ViewType;
129
- name: any;
130
- dependencies: any[];
131
- tooltip: string | {
132
- title: string;
133
- icon?: React.ReactNode;
134
- };
135
- extra: React.ReactNode;
136
- validateFirst: boolean | "parallel";
137
- disabled: any;
138
- };
71
+ export declare const useFormItemProps: (column: FlexibleGroupColumnType, contextProps: ContextProps, groupProps: GroupProps) => GroupFormItemProps;
139
72
  /**
140
73
  * 创建组件属性
141
74
  */
@@ -1,6 +1,7 @@
1
1
  import { ReactNode } from 'react';
2
- import { DefaultOptionType } from '@rc-component/select/es/Select';
2
+ import type { CascaderProps } from 'antd';
3
3
  import { Service, Options } from 'ahooks/lib/useRequest/src/types';
4
+ export type CascaderOptionType = NonNullable<CascaderProps['options']>[number];
4
5
  export interface FieldNamesType {
5
6
  label: string;
6
7
  value: string;
@@ -17,7 +18,7 @@ export interface ProCascaderType {
17
18
  tooltip?: boolean | ReactNode;
18
19
  detailMaxLength?: number;
19
20
  fieldNames?: FieldNamesType;
20
- dataSource?: DefaultOptionType[];
21
+ dataSource?: CascaderOptionType[];
21
22
  useRequest?: {
22
23
  /**
23
24
  * @description 请求服务函数
@@ -42,10 +42,12 @@ export interface ProRule extends Omit<RuleObject, 'type'> {
42
42
  */
43
43
  export type ViewType = 'percent' | 'permillage' | 'amount' | 'thousandth';
44
44
  export type PartialOf<T, K extends keyof T> = Omit<T, K> & Partial<Pick<T, K>>;
45
- interface ControlProps {
46
- value?: unknown;
47
- onChange?: (...args: any[]) => void;
48
- }
45
+ type ControlValue<T> = T extends {
46
+ value?: infer Value;
47
+ } ? Value : unknown;
48
+ type ControlChangeArgs<T> = T extends {
49
+ onChange?: (...args: infer Args) => any;
50
+ } ? Args : any[];
49
51
  /**
50
52
  * 扩展函数的参数
51
53
  */
@@ -55,9 +57,9 @@ export type FunctionArgs<Values, R = any> = (value: any, record: any, { form, in
55
57
  namePath?: NamePath;
56
58
  [key: string]: any;
57
59
  }) => R;
58
- type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T, 'onChange' | 'value' | 'role'> & {
59
- value?: T['value'];
60
- onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], form: FormInstance<Values>) => void;
60
+ type TransformToFormField<T, Values> = DistributiveOmit<T, 'onChange' | 'value' | 'role'> & {
61
+ value?: ControlValue<T>;
62
+ onChange?: (value: ControlChangeArgs<T>[0], options: ControlChangeArgs<T>[1], form: FormInstance<Values>) => void;
61
63
  onFieldChange?: FunctionArgs<Values>;
62
64
  dataSource?: any[];
63
65
  /** ProForm disable时,是否完全受控 */
@@ -66,9 +68,9 @@ type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T,
66
68
  type ProEnumFormType<Values> = TransformToFormField<ProEnumType, Values> | TransformToFormField<ProEnumType & PropProSelectsMapType, Values> | TransformToFormField<ProEnumType & PropRadioPropsMapType, Values> | TransformToFormField<ProEnumType & CheckboxPropsMapType, Values>;
67
69
  type ProEnumTableType<Values> = TransformToTableField<ProEnumType, Values> | TransformToTableField<ProEnumType & PropProSelectsMapType, Values> | TransformToTableField<ProEnumType & PropRadioPropsMapType, Values> | TransformToTableField<ProEnumType & CheckboxPropsMapType, Values>;
68
70
  type ProEnumFieldType<Values, TT> = TT extends 'ProForm' ? ProEnumFormType<Values> | ReactiveFunction<Values, ProEnumFormType<Values>> : ProEnumTableType<Values> | ((text: any, values: Values, index: number) => ProEnumTableType<Values>);
69
- type TransformToTableField<T extends ControlProps, Values> = Omit<T, 'onChange' | 'value' | 'onBlur' | 'role'> & {
70
- value?: T['value'];
71
- onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], record: any, index: number, form: FormInstance<Values>) => void;
71
+ type TransformToTableField<T, Values> = Omit<T, 'onChange' | 'value' | 'onBlur' | 'role'> & {
72
+ value?: ControlValue<T>;
73
+ onChange?: (value: ControlChangeArgs<T>[0], options: ControlChangeArgs<T>[1], record: any, index: number, form: FormInstance<Values>) => void;
72
74
  onFieldChange?: FunctionArgs<Values>;
73
75
  onBlur?: FunctionArgs<Values>;
74
76
  };
@@ -78,7 +80,7 @@ export type ReactiveFunction<Values, R> = (values: Values, { form, index, namePa
78
80
  namePath?: NamePath;
79
81
  [key: string]: any;
80
82
  }) => R;
81
- type FieldType<T extends ControlProps, Values, TT> = TT extends 'ProForm' ? TransformToFormField<T, Values> | ReactiveFunction<Values, TransformToFormField<T, Values>> : TransformToTableField<T, Values> | ((text: any, values: Values, index: number) => TransformToTableField<T, Values>);
83
+ type FieldType<T, Values, TT> = TT extends 'ProForm' ? TransformToFormField<T, Values> | ReactiveFunction<Values, TransformToFormField<T, Values>> : TransformToTableField<T, Values> | ((text: any, values: Values, index: number) => TransformToTableField<T, Values>);
82
84
  /**
83
85
  * 值转换
84
86
  */
@@ -272,7 +274,7 @@ export interface RenderType<Values = any> {
272
274
  export type ProEnumFormProps<Values> = ProEnumFormType<Values>;
273
275
  export type ProEnumTableProps<Values> = ProEnumTableType<Values>;
274
276
  export type ProEnumFieldProps<Values, TT> = ProEnumFieldType<Values, TT>;
275
- export type FieldProps<T extends ControlProps, Values, TT> = FieldType<T, Values, TT>;
277
+ export type FieldProps<T, Values, TT> = FieldType<T, Values, TT>;
276
278
  export type ColumnPropsMap<Values = any, T = 'ProForm'> = ColumnTypeMap<Values, T>;
277
279
  export type ProColumnProps<Values = any> = ProFormColumnType<Values>;
278
280
  export type RenderProps<Values = any> = RenderType<Values>;
@@ -74,7 +74,6 @@ const TabItemComponent = ({
74
74
  text: displayTitle,
75
75
  title: tabTitle,
76
76
  line: 1,
77
- width: "12em",
78
77
  placement: "top",
79
78
  scrollFollowParent: false
80
79
  }) : tabTitle
@@ -59,12 +59,15 @@ export const useTabsState = options => {
59
59
  delete restoredState.activeTab;
60
60
  }
61
61
 
62
- // 兼容旧缓存:无 pinned 字段的标签用 closable===false 推导出 pinned
63
- // 保证刷新后固定标签仍落在左侧固定区
64
- restoredState.tabsList = restoredState.tabsList.map(tab => tab.pinned === undefined ? {
62
+ // 兼容旧缓存:Ant Tabs onChange 始终返回字符串 key;旧版本可能保存数字 id
63
+ // 若不归一化,严格比较会导致恢复后的标签无法切换。
64
+ restoredState.tabsList = restoredState.tabsList.map(tab => ({
65
65
  ...tab,
66
- pinned: derivePinned(tab)
67
- } : tab);
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);
Binary file
@@ -1,6 +1,5 @@
1
1
  import _isNumber from "lodash/isNumber";
2
2
  import _omit from "lodash/omit";
3
- import _isObject from "lodash/isObject";
4
3
  import _isFunction from "lodash/isFunction";
5
4
  import { useDeepCompareEffect, useRequest as useRequestFunc } from 'ahooks';
6
5
  import { message, Select, Space, Tooltip } from 'antd';
@@ -224,7 +223,7 @@ export const ProSelect = (props, ref) => {
224
223
  if (customShowSearch === true || customShowSearch == null) {
225
224
  return defaultConfig;
226
225
  }
227
- if (_isObject(customShowSearch)) {
226
+ if (typeof customShowSearch === 'object' && customShowSearch !== null) {
228
227
  return {
229
228
  ...defaultConfig,
230
229
  ...customShowSearch,
@@ -2,6 +2,11 @@ import { ReactNode } from 'react';
2
2
  import type { SelectProps } from 'antd';
3
3
  import { Service, Options, Result } from 'ahooks/lib/useRequest/src/types';
4
4
  import type { ProFormOtherType } from '../ProForm/propsType';
5
+ export interface ProSelectShowSearchConfig {
6
+ filterOption?: SelectProps['filterOption'];
7
+ optionFilterProp?: SelectProps['optionFilterProp'];
8
+ onSearch?: SelectProps['onSearch'];
9
+ }
5
10
  /**
6
11
  * @description 数据选项类型
7
12
  */
@@ -24,7 +29,8 @@ export interface DataOptionType {
24
29
  /**
25
30
  * @description 选择框属性类型
26
31
  */
27
- export interface PropSelectType extends Omit<SelectProps, 'onSearch'> {
32
+ export interface PropSelectType extends Omit<SelectProps, 'onSearch' | 'showSearch'> {
33
+ showSearch?: boolean | ProSelectShowSearchConfig;
28
34
  /**
29
35
  * @description 是否查看模式
30
36
  * @default false
@@ -710,6 +710,8 @@ export const ProTreeSelect = (props, ref) => {
710
710
  [`${innerClass}`]: true,
711
711
  [`${popupClassName}`]: popupClassName
712
712
  });
713
+ const selectClassNames = selectProps?.classNames;
714
+ const selectStyles = selectProps?.styles;
713
715
  const treeProps = {
714
716
  disabled,
715
717
  showSearch,
@@ -736,22 +738,22 @@ export const ProTreeSelect = (props, ref) => {
736
738
  ...selectProps,
737
739
  // 使用新的 API 替代弃用的 popupClassName 和 dropdownStyle
738
740
  classNames: {
739
- ...selectProps?.classNames,
741
+ ...selectClassNames,
740
742
  popup: {
741
- ...selectProps?.classNames?.popup,
742
- root: [selectProps?.classNames?.popup?.root, dropDownClassName].filter(Boolean).join(' ')
743
+ ...selectClassNames?.popup,
744
+ root: [selectClassNames?.popup?.root, dropDownClassName].filter(Boolean).join(' ')
743
745
  }
744
746
  },
745
747
  styles: {
746
- ...selectProps?.styles,
748
+ ...selectStyles,
747
749
  popup: {
748
- ...selectProps?.styles?.popup,
750
+ ...selectStyles?.popup,
749
751
  root: {
750
752
  maxHeight: 320,
751
753
  paddingTop: '0px',
752
754
  maxWidth: '580px',
753
755
  ...dropdownStyle,
754
- ...selectProps?.styles?.popup?.root
756
+ ...selectStyles?.popup?.root
755
757
  }
756
758
  }
757
759
  }
@@ -1,6 +1,6 @@
1
1
  import React from 'react';
2
- import { UploadFile } from 'antd/es/upload/interface';
3
- import type { UploadRequestOption } from '@rc-component/upload/es/interface';
2
+ import type { UploadFile, UploadProps } from 'antd';
3
+ type UploadRequestOption = Parameters<NonNullable<UploadProps['customRequest']>>[0];
4
4
  export type UploadType = 'drag' | 'button' | 'image';
5
5
  export interface UploadFileResType {
6
6
  /**
@@ -262,3 +262,4 @@ export interface DraggableUploadListItemType {
262
262
  */
263
263
  children: React.ReactNode;
264
264
  }
265
+ export {};
@@ -1,5 +1,5 @@
1
1
  import { useSetState } from 'ahooks';
2
- import { Button, Image, Modal } from 'antd';
2
+ import { Button, Image as AntdImage, Modal } from 'antd';
3
3
  import React, { useEffect, useRef } from 'react';
4
4
  import locale from "../locale";
5
5
 
@@ -14,6 +14,7 @@ const MIMEType = {
14
14
  word: 'application/msword',
15
15
  excel: 'application/vnd.ms-excel'
16
16
  };
17
+ const Image = AntdImage;
17
18
  const ProViewer = /*#__PURE__*/React.forwardRef(({
18
19
  disabled = false,
19
20
  mode = 'page',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zat-design/sisyphus-react",
3
- "version": "4.5.7-beta.2",
3
+ "version": "4.5.8-beta.1",
4
4
  "license": "MIT",
5
5
  "publishConfig": {
6
6
  "access": "public",
@@ -121,6 +121,7 @@
121
121
  "@dnd-kit/core": "^6.0.8",
122
122
  "@dnd-kit/sortable": "^7.0.2",
123
123
  "@dnd-kit/utilities": "^3.2.1",
124
+ "@rc-component/form": "~1.8.5",
124
125
  "@zat-design/utils": "^4.0.0",
125
126
  "big.js": "^6.2.1",
126
127
  "classnames": "^2.3.1",
@@ -140,6 +141,7 @@
140
141
  "react-router-dom": "^6.0.0"
141
142
  },
142
143
  "devDependencies": {
144
+ "@ant-design/icons": "^6.1.0",
143
145
  "@babel/core": "^7.26.0",
144
146
  "@babel/runtime": "^7.28.4",
145
147
  "@commitlint/cli": "^12.1.1",
@@ -157,8 +159,9 @@
157
159
  "@typescript-eslint/parser": "^7.18.0",
158
160
  "@umijs/fabric": "^2.8.1",
159
161
  "@umijs/test": "^3.0.5",
160
- "@zat-design/sisyphus-login": "4.0.2",
162
+ "@zat-design/sisyphus-login": "4.0.3",
161
163
  "ahooks": "3.9.5",
164
+ "antd": "^6.1.3",
162
165
  "babel-plugin-import": "^1.13.8",
163
166
  "babel-plugin-lodash": "^3.3.4",
164
167
  "cross-env": "^7.0.3",