@zat-design/sisyphus-react 4.0.9 → 4.0.11

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 (34) hide show
  1. package/es/ProConfigProvider/index.d.ts +3 -45
  2. package/es/ProConfigProvider/index.js +23 -40
  3. package/es/ProConfigProvider/propsType.d.ts +55 -0
  4. package/es/ProConfigProvider/propsType.js +1 -0
  5. package/es/ProEnum/propsType.d.ts +0 -1
  6. package/es/ProForm/components/combination/Group/utils/index.d.ts +10 -10
  7. package/es/ProForm/components/render/propsType.d.ts +2 -2
  8. package/es/ProForm/index.d.ts +2 -12
  9. package/es/ProForm/index.js +0 -2
  10. package/es/ProForm/propsType.d.ts +11 -0
  11. package/es/ProForm/propsType.js +6 -0
  12. package/es/ProThemeTools/context/ThemeContext.d.ts +2 -0
  13. package/es/ProThemeTools/context/ThemeContext.js +124 -11
  14. package/es/ProThemeTools/utils/index.d.ts +2 -0
  15. package/es/ProThemeTools/utils/index.js +40 -4
  16. package/es/index.d.ts +7 -6
  17. package/es/index.js +0 -1
  18. package/lib/ProConfigProvider/index.d.ts +3 -45
  19. package/lib/ProConfigProvider/index.js +23 -40
  20. package/lib/ProConfigProvider/propsType.d.ts +55 -0
  21. package/lib/ProConfigProvider/propsType.js +5 -0
  22. package/lib/ProEnum/propsType.d.ts +0 -1
  23. package/lib/ProForm/components/combination/Group/utils/index.d.ts +10 -10
  24. package/lib/ProForm/components/render/propsType.d.ts +2 -2
  25. package/lib/ProForm/index.d.ts +2 -12
  26. package/lib/ProForm/index.js +0 -2
  27. package/lib/ProForm/propsType.d.ts +11 -0
  28. package/lib/ProForm/propsType.js +6 -0
  29. package/lib/ProThemeTools/context/ThemeContext.d.ts +2 -0
  30. package/lib/ProThemeTools/context/ThemeContext.js +123 -10
  31. package/lib/ProThemeTools/utils/index.d.ts +2 -0
  32. package/lib/ProThemeTools/utils/index.js +44 -6
  33. package/lib/index.d.ts +7 -6
  34. package/package.json +1 -1
@@ -9,14 +9,45 @@ function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t =
9
9
  function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
10
10
  function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == typeof i ? i : String(i); }
11
11
  function _toPrimitive(t, r) { if ("object" != typeof t || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != typeof i) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
12
+ import { getThemeUpdaters as getThemeUpdatersFromContext } from "../context/ThemeContext";
12
13
  // 动态导入 getThemeUpdaters,避免循环依赖
14
+ // 保留向后兼容性,但优先使用 ThemeContext 中的 getThemeUpdaters
13
15
  var getThemeUpdaters = null;
14
16
 
15
- // 设置 getThemeUpdaters 函数(由 index.tsx 调用)
17
+ // 设置 getThemeUpdaters 函数(由 index.tsx 调用,用于向后兼容)
16
18
  export var setThemeUpdatersGetter = getter => {
17
19
  getThemeUpdaters = getter;
18
20
  };
19
21
 
22
+ // 保存待应用的主题配置(用于 ThemeProvider 初始化前设置的主题)
23
+ var pendingThemes = null;
24
+
25
+ // 获取待应用的主题配置
26
+ export var getPendingThemes = () => {
27
+ return pendingThemes;
28
+ };
29
+
30
+ // 清除待应用的主题配置
31
+ export var clearPendingThemes = () => {
32
+ pendingThemes = null;
33
+ };
34
+
35
+ // 获取主题更新函数的统一入口
36
+ // 优先使用 ThemeContext 中的 getThemeUpdaters,如果不可用则使用局部变量
37
+ var getThemeUpdatersWrapper = () => {
38
+ try {
39
+ // 优先使用 ThemeContext 中的 getThemeUpdaters(不依赖 ProThemeTools 组件)
40
+ var contextUpdaters = getThemeUpdatersFromContext();
41
+ if (contextUpdaters && (contextUpdaters.updateAntdConfig || contextUpdaters.updateCssVariables || contextUpdaters.updateLocalConfig)) {
42
+ return contextUpdaters;
43
+ }
44
+ } catch (e) {
45
+ // ThemeContext 可能还未初始化,继续使用局部变量
46
+ }
47
+ // 回退到局部变量(向后兼容)
48
+ return getThemeUpdaters ? getThemeUpdaters() : null;
49
+ };
50
+
20
51
  /** antd5 主题配置 mapping */
21
52
  var antd5ConfigMapping = {
22
53
  'zaui-brand': 'colorPrimary'
@@ -77,9 +108,9 @@ export var setThemes = themes => {
77
108
  });
78
109
 
79
110
  // 同步更新 Context(如果已注册)
80
- if (getThemeUpdaters) {
81
- var updaters = getThemeUpdaters();
82
-
111
+ // 使用统一的获取函数,优先使用 ThemeContext 中的更新函数
112
+ var updaters = getThemeUpdatersWrapper();
113
+ if (updaters) {
83
114
  // 更新 CSS 变量到 Context
84
115
  if (updaters.updateCssVariables) {
85
116
  updaters.updateCssVariables(filteredThemes.reduce((acc, _ref5) => {
@@ -121,6 +152,11 @@ export var setThemes = themes => {
121
152
  updaters.updateLocalConfig(localConfig);
122
153
  }
123
154
  }
155
+ // 清除待应用的主题配置(因为已经应用了)
156
+ pendingThemes = null;
157
+ } else {
158
+ // 如果更新函数不可用,保存主题配置,等待 ThemeProvider 初始化后应用
159
+ pendingThemes = _objectSpread({}, themes);
124
160
  }
125
161
  return true;
126
162
  };
package/es/index.d.ts CHANGED
@@ -27,20 +27,21 @@ export { default as ProAction } from './ProAction';
27
27
  export * from './ProConfigProvider';
28
28
  export * from './locale';
29
29
  export { default as ProBackBtn } from './ProLayout/components/ProHeader/components/ProBackBtn';
30
+ export type { ProConfigProviderType } from './ProConfigProvider';
30
31
  export type { ProFormType, ProColumnProps, ProFormColumnType } from './ProForm/propsType';
31
32
  export type { ProFormComponentType } from './ProForm/components';
32
- export type { ProTableType, ProTableColumnType, ProTableSummaryType, ProTableUseAntdTableType, ProTableProps, ProTableSummaryProps, ProTableColumn, UseAntdTableState } from './ProTable/propsType';
33
+ export type { ProTableType, ProTableColumnType, ProTableSummaryType, ProTableUseAntdTableType, ProTableProps, ProTableSummaryProps, ProTableColumn, UseAntdTableState, } from './ProTable/propsType';
33
34
  export type { ProUploadType, ProUploadProps } from './ProUpload/propsType';
34
35
  export type { ProTabsType, ProTabsItemType, ProTabsProps, ProTabsItemsProps } from './ProTabs/propType';
35
- export type { BreadcrumbColumnType, SubDescribeColumnType, DescribeColumnType, ProHeaderType, ProHeaderProps, BreadcrumbColumnsProps, SubDescribeColumnsProps, DescribeColumnsProps } from './ProLayout/components/ProHeader/PropTypes';
36
+ export type { BreadcrumbColumnType, SubDescribeColumnType, DescribeColumnType, ProHeaderType, ProHeaderProps, BreadcrumbColumnsProps, SubDescribeColumnsProps, DescribeColumnsProps, } from './ProLayout/components/ProHeader/PropTypes';
36
37
  export type { ProLayoutTabsInstance, AddTabParams, AddTabOptions } from './ProLayout/propTypes';
37
38
  export type { ProTooltipType, ProTooltipProps } from './ProTooltip/propsType';
38
39
  export type { ProIconType, ProIconProps } from './ProIcon/propsTypes';
39
40
  export type { ProTreeType, ProTreeSelectType, ProTreeProps, PropTreeSelectProps } from './ProTree/propsType';
40
- export type { ProTreeModalType, ProTreeModalActionType, ProTreeModalProps, ProTreeModalAction } from './ProTreeModal/propsType';
41
- export type { ProEditTableType, ProEditTableColumnType, ProEditTableSummaryColumnType, ProEditTableSummaryConfigType, ProEditTableActionType, ProEditTableProps, ProEditTableColumnsProps, SummaryProps, SummaryColumnProps, BaseActionProps } from './ProEditTable/propsType';
42
- export type { ProStepType, ProStepContextType, ProStepItemType, ProStepPropsType, ProStepItemPropsType } from './ProStep/propsType';
41
+ export type { ProTreeModalType, ProTreeModalActionType, ProTreeModalProps, ProTreeModalAction, } from './ProTreeModal/propsType';
42
+ export type { ProEditTableType, ProEditTableColumnType, ProEditTableSummaryColumnType, ProEditTableSummaryConfigType, ProEditTableActionType, ProEditTableProps, ProEditTableColumnsProps, SummaryProps, SummaryColumnProps, BaseActionProps, } from './ProEditTable/propsType';
43
+ export type { ProStepType, ProStepContextType, ProStepItemType, ProStepPropsType, ProStepItemPropsType, } from './ProStep/propsType';
43
44
  export type { ProDrawerFormType, ProDrawerFormPropsType } from './ProDrawerForm/propsType';
44
- export type { ProModalSelectType, ProModalSelectConfigType, ProModalSelectPropsType } from './ProForm/components/combination/ProModalSelect/propsType';
45
+ export type { ProModalSelectType, ProModalSelectConfigType, ProModalSelectPropsType, } from './ProForm/components/combination/ProModalSelect/propsType';
45
46
  export type { ProStepTabType, ProStepTabResultType } from './ProStepTab/propsType';
46
47
  export * from './tokens';
package/es/index.js CHANGED
@@ -39,7 +39,6 @@ export * from "./ProConfigProvider";
39
39
  export * from "./locale";
40
40
  export { default as ProBackBtn } from "./ProLayout/components/ProHeader/components/ProBackBtn";
41
41
 
42
- // TS类型导出
43
42
  // TS类型导出
44
43
 
45
44
  // token导出
@@ -1,51 +1,9 @@
1
1
  import React, { FC } from 'react';
2
- import { FormInstance } from 'antd';
3
2
  import 'dayjs/locale/zh-cn';
4
- import type { PropSelectType } from '../ProSelect/propsType';
5
- import type { ProModalSelectType } from '../ProForm/components/combination/ProModalSelect/propsType';
6
- import type { ProCascaderType } from '../ProForm/components/combination/ProCascader/propsType';
7
- import type { ProEnumConfig } from '../ProEnum/propsType';
8
- export interface ProConfigState {
9
- locale?: string;
10
- ProEnum?: Partial<ProEnumConfig>;
11
- ProSelect?: Partial<PropSelectType> & Record<string, any>;
12
- ProModalSelect?: Partial<ProModalSelectType> & Record<string, any>;
13
- ProAddressBar?: Partial<ProCascaderType> & Record<string, any>;
14
- forms: Record<string, FormInstance | undefined>;
15
- [key: string]: any;
16
- }
17
- interface ConfigContext {
18
- state: ProConfigState;
19
- dispatch: React.Dispatch<Actions>;
20
- }
3
+ import type { ProConfigProviderProps, ConfigContext } from './propsType';
21
4
  export declare const ProConfigContext: React.Context<ConfigContext>;
22
5
  export declare function useProConfig(): ConfigContext;
23
6
  export declare function useProConfig(name: keyof ConfigContext['state']): ConfigContext['state'][keyof ConfigContext['state']];
24
- type Actions = {
25
- type: 'setFormRef';
26
- name: string;
27
- value: FormInstance;
28
- } | {
29
- type: 'deleteFormRef';
30
- name: string;
31
- } | {
32
- type: 'set';
33
- payload: ProConfigState;
34
- } | {
35
- type: 'setProEnum';
36
- payload: Record<string, any>;
37
- } | {
38
- type: 'setProEnumDic';
39
- key: string;
40
- payload: any;
41
- } | {
42
- type: 'setWithLocal';
43
- payload: ProConfigState;
44
- };
45
- export declare const ProConfigProvider: FC<{
46
- value?: ProConfigState;
47
- locale?: string;
48
- onSuccess?: (data: any, params: any) => void;
49
- children?: React.ReactNode;
50
- }>;
7
+ export declare const ProConfigProvider: FC<ProConfigProviderProps>;
8
+ export type { ProConfigProviderType, ProConfigProviderProps } from './propsType';
51
9
  export default ProConfigProvider;
@@ -47,38 +47,36 @@ var initialState = {
47
47
  }]
48
48
  }
49
49
  };
50
+ var antdLangMap = {
51
+ 'zh-CN': _zh_CN.default,
52
+ 'en-US': _en_US.default
53
+ };
50
54
  var ProConfigContext = exports.ProConfigContext = /*#__PURE__*/_react.default.createContext({
51
55
  state: initialState,
52
56
  dispatch: () => {}
53
57
  });
54
-
55
- // eslint-disable-next-line no-redeclare
56
-
57
- // eslint-disable-next-line no-redeclare
58
58
  function useProConfig(name) {
59
59
  var _useContext = (0, _react.useContext)(ProConfigContext),
60
60
  state = _useContext.state,
61
61
  dispatch = _useContext.dispatch;
62
- if (name) {
63
- return state[name];
64
- }
62
+ if (name) return state[name];
65
63
  return {
66
64
  state,
67
65
  dispatch
68
66
  };
69
67
  }
70
- var reducer = (state, action) => {
71
- var _state$ProEnum;
68
+ function reducer(state, action) {
69
+ var _state$forms, _state$forms2, _state$ProEnum$dics, _state$ProEnum;
72
70
  switch (action.type) {
73
71
  case 'setFormRef':
74
72
  return _objectSpread(_objectSpread({}, state), {}, {
75
- forms: _objectSpread(_objectSpread({}, state.forms), {}, {
73
+ forms: _objectSpread(_objectSpread({}, (_state$forms = state.forms) !== null && _state$forms !== void 0 ? _state$forms : {}), {}, {
76
74
  [action.name]: action.value
77
75
  })
78
76
  });
79
77
  case 'deleteFormRef':
80
78
  return _objectSpread(_objectSpread({}, state), {}, {
81
- forms: _objectSpread(_objectSpread({}, state.forms), {}, {
79
+ forms: _objectSpread(_objectSpread({}, (_state$forms2 = state.forms) !== null && _state$forms2 !== void 0 ? _state$forms2 : {}), {}, {
82
80
  [action.name]: undefined
83
81
  })
84
82
  });
@@ -91,19 +89,16 @@ var reducer = (state, action) => {
91
89
  case 'setProEnumDic':
92
90
  return _objectSpread(_objectSpread({}, state), {}, {
93
91
  ProEnum: _objectSpread(_objectSpread({}, state.ProEnum), {}, {
94
- dics: _objectSpread(_objectSpread({}, ((_state$ProEnum = state.ProEnum) === null || _state$ProEnum === void 0 ? void 0 : _state$ProEnum.dataSource) || {}), action.payload)
92
+ dics: _objectSpread(_objectSpread({}, (_state$ProEnum$dics = (_state$ProEnum = state.ProEnum) === null || _state$ProEnum === void 0 ? void 0 : _state$ProEnum.dics) !== null && _state$ProEnum$dics !== void 0 ? _state$ProEnum$dics : {}), action.payload)
95
93
  })
96
94
  });
97
95
  case 'setWithLocal':
98
- // 本地配置合并
99
96
  localStorage.setItem('localConfig', JSON.stringify(action.payload));
100
97
  return _objectSpread({}, state);
101
98
  default:
102
- return _objectSpread({}, state);
99
+ return state;
103
100
  }
104
- };
105
-
106
- // 内部组件,用于监听主题变化并应用到 ConfigProvider
101
+ }
107
102
  var ThemeAwareConfigProvider = _ref => {
108
103
  var locale = _ref.locale,
109
104
  children = _ref.children;
@@ -118,45 +113,33 @@ var ThemeAwareConfigProvider = _ref => {
118
113
  });
119
114
  };
120
115
  var ProConfigProvider = props => {
121
- var _props$value, _props$value2, _props$value3, _props$value4;
116
+ var _props$value, _props$value2, _props$value3, _props$value4, _ref2, _ref3, _state$locale, _antdLangMap$lang;
122
117
  var _useReducer = (0, _react.useReducer)(reducer, initialState),
123
118
  _useReducer2 = _slicedToArray(_useReducer, 2),
124
119
  state = _useReducer2[0],
125
120
  dispatch = _useReducer2[1];
126
121
  var enumRes = (0, _useEnumRequest.default)(_objectSpread(_objectSpread(_objectSpread({}, state.ProEnum), props === null || props === void 0 || (_props$value = props.value) === null || _props$value === void 0 ? void 0 : _props$value.ProEnum), props === null || props === void 0 || (_props$value2 = props.value) === null || _props$value2 === void 0 ? void 0 : _props$value2.globalConfig), dispatch);
127
-
128
- // 处理频繁枚举请求
129
122
  var frequentEnumRes = (0, _useFrequentEnumRequest.default)(_objectSpread(_objectSpread(_objectSpread({}, state.ProEnum), props === null || props === void 0 || (_props$value3 = props.value) === null || _props$value3 === void 0 ? void 0 : _props$value3.ProEnum), props === null || props === void 0 || (_props$value4 = props.value) === null || _props$value4 === void 0 ? void 0 : _props$value4.globalConfig), dispatch);
123
+ var cacheLang = localStorage.getItem('locale');
124
+ var lang = (_ref2 = (_ref3 = (_state$locale = state === null || state === void 0 ? void 0 : state.locale) !== null && _state$locale !== void 0 ? _state$locale : cacheLang) !== null && _ref3 !== void 0 ? _ref3 : props === null || props === void 0 ? void 0 : props.locale) !== null && _ref2 !== void 0 ? _ref2 : 'zh-CN';
130
125
  (0, _react.useEffect)(() => {
131
- // 本地配置取出
132
- var localConfigStr = localStorage.getItem('localConfig');
133
- var localConfig = JSON.parse(localConfigStr || '{}');
126
+ var raw = localStorage.getItem('localConfig');
127
+ var localConfig = JSON.parse(raw || '{}');
134
128
  dispatch({
135
129
  type: 'set',
136
- payload: (0, _merge.default)(state, localConfig)
130
+ payload: (0, _merge.default)(initialState, localConfig)
137
131
  });
138
132
  }, []);
139
- var cacheLang = localStorage.getItem('locale');
140
- // 如果是用户切换了语言那么优先使用用户切换的,否则从缓存中取用户语言,在取默认值
141
- var lang = (state === null || state === void 0 ? void 0 : state.locale) || cacheLang || (props === null || props === void 0 ? void 0 : props.locale);
142
133
  (0, _react.useEffect)(() => {
143
134
  (0, _locale.setLanguage)(lang);
144
135
  }, [lang]);
145
136
  (0, _react.useEffect)(() => {
146
- if (enumRes !== null && enumRes !== void 0 && enumRes.data) {
147
- (props === null || props === void 0 ? void 0 : props.onSuccess) && (props === null || props === void 0 ? void 0 : props.onSuccess(enumRes === null || enumRes === void 0 ? void 0 : enumRes.data, enumRes === null || enumRes === void 0 ? void 0 : enumRes.params));
148
- }
137
+ var _props$onSuccess;
138
+ if (enumRes !== null && enumRes !== void 0 && enumRes.data) props === null || props === void 0 || (_props$onSuccess = props.onSuccess) === null || _props$onSuccess === void 0 || _props$onSuccess.call(props, enumRes.data, enumRes.params);
149
139
  }, [enumRes === null || enumRes === void 0 ? void 0 : enumRes.loading]);
150
- var antdLangMap = {
151
- 'zh-CN': _zh_CN.default,
152
- // zh-CN 中文
153
- 'en-US': _en_US.default // en-US
154
- };
155
- // 处理频繁枚举的成功回调
156
140
  (0, _react.useEffect)(() => {
157
- if (frequentEnumRes !== null && frequentEnumRes !== void 0 && frequentEnumRes.data) {
158
- (props === null || props === void 0 ? void 0 : props.onSuccess) && (props === null || props === void 0 ? void 0 : props.onSuccess(frequentEnumRes === null || frequentEnumRes === void 0 ? void 0 : frequentEnumRes.data, frequentEnumRes === null || frequentEnumRes === void 0 ? void 0 : frequentEnumRes.params));
159
- }
141
+ var _props$onSuccess2;
142
+ if (frequentEnumRes !== null && frequentEnumRes !== void 0 && frequentEnumRes.data) props === null || props === void 0 || (_props$onSuccess2 = props.onSuccess) === null || _props$onSuccess2 === void 0 || _props$onSuccess2.call(props, frequentEnumRes.data, frequentEnumRes.params);
160
143
  }, [frequentEnumRes === null || frequentEnumRes === void 0 ? void 0 : frequentEnumRes.loading]);
161
144
  return /*#__PURE__*/(0, _jsxRuntime.jsx)(_ThemeContext.ThemeProvider, {
162
145
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ProConfigContext.Provider, {
@@ -165,7 +148,7 @@ var ProConfigProvider = props => {
165
148
  dispatch
166
149
  },
167
150
  children: /*#__PURE__*/(0, _jsxRuntime.jsx)(ThemeAwareConfigProvider, {
168
- locale: antdLangMap[lang],
151
+ locale: (_antdLangMap$lang = antdLangMap[lang]) !== null && _antdLangMap$lang !== void 0 ? _antdLangMap$lang : _zh_CN.default,
169
152
  children: props.children
170
153
  })
171
154
  })
@@ -0,0 +1,55 @@
1
+ import type React from 'react';
2
+ import type { FormInstance } from 'antd';
3
+ import type { PropSelectType } from '../ProSelect/propsType';
4
+ import type { ProModalSelectType } from '../ProForm/components/combination/ProModalSelect/propsType';
5
+ import type { ProCascaderType } from '../ProForm/components/combination/ProCascader/propsType';
6
+ import type { ProEnumConfigType } from '../ProEnum/propsType';
7
+ /** 对外配置项类型(value、内部 state 均为此类型,字段均可选) */
8
+ export interface ProConfigProviderType {
9
+ locale?: string;
10
+ ProEnum?: Partial<ProEnumConfigType>;
11
+ ProSelect?: Partial<PropSelectType> & Record<string, any>;
12
+ ProModalSelect?: Partial<ProModalSelectType> & Record<string, any>;
13
+ ProAddressBar?: Partial<ProCascaderType> & Record<string, any>;
14
+ forms?: Record<string, FormInstance | undefined>;
15
+ [key: string]: any;
16
+ }
17
+ /** ProConfigProvider 组件 Props(内部使用) */
18
+ export interface ProConfigProviderProps {
19
+ value?: ProConfigProviderType;
20
+ locale?: string;
21
+ onSuccess?: (data: any, params: any) => void;
22
+ children?: React.ReactNode;
23
+ }
24
+ /** Config 上下文 */
25
+ export interface ConfigContext {
26
+ state: ProConfigProviderType;
27
+ dispatch: React.Dispatch<ProConfigActions>;
28
+ }
29
+ /** ThemeAwareConfigProvider 内部组件 Props */
30
+ export interface ThemeAwareConfigProviderProps {
31
+ locale: any;
32
+ children: React.ReactNode;
33
+ }
34
+ /** Reducer Actions */
35
+ export type ProConfigActions = {
36
+ type: 'setFormRef';
37
+ name: string;
38
+ value: FormInstance;
39
+ } | {
40
+ type: 'deleteFormRef';
41
+ name: string;
42
+ } | {
43
+ type: 'set';
44
+ payload: ProConfigProviderType;
45
+ } | {
46
+ type: 'setProEnum';
47
+ payload: Record<string, any>;
48
+ } | {
49
+ type: 'setProEnumDic';
50
+ key: string;
51
+ payload: any;
52
+ } | {
53
+ type: 'setWithLocal';
54
+ payload: ProConfigProviderType;
55
+ };
@@ -0,0 +1,5 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
@@ -303,7 +303,6 @@ export interface TagPropsMapType {
303
303
  */
304
304
  export type ProEnumType = Omit<ProEnumBaseType, 'type'> & (PropProSelectsMapType | PropRadioPropsMapType | CheckboxPropsMapType | TagPropsMapType);
305
305
  export type DataOption = DataOptionType;
306
- export type ProEnumConfig = ProEnumConfigType;
307
306
  export type ProEnum = ProEnumBaseType;
308
307
  export type PropProSelectsMap = PropProSelectsMapType;
309
308
  export type PropRadioPropsMap = PropRadioPropsMapType;
@@ -75,31 +75,32 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
75
75
  confirm?: boolean | import("antd").ModalFuncProps | import("../../../render/propsType").FunctionArgs<any, boolean | import("antd").ModalFuncProps>;
76
76
  show?: boolean | ReactiveFunction<any, boolean>;
77
77
  component?: React.ReactNode | ReactiveFunction<any, React.ReactNode>;
78
- style?: React.CSSProperties;
78
+ children?: React.ReactNode | ((form: FormInstance<any>) => React.ReactNode);
79
79
  trim?: boolean;
80
80
  normalize?: (value: any, prevValue: any, allValues: import("@rc-component/form/lib/interface").Store) => any;
81
- children?: React.ReactNode | ((form: FormInstance<any>) => React.ReactNode);
82
81
  className?: string;
83
- hidden?: boolean;
84
- layout?: import("antd/es/form/Form").FormItemLayout;
85
- help?: React.ReactNode;
86
- vertical?: boolean;
87
- preserve?: boolean;
88
82
  prefixCls?: string;
83
+ style?: React.CSSProperties;
89
84
  onReset?: () => void;
90
85
  status?: "" | "warning" | "error" | "success" | "validating";
86
+ hidden?: boolean;
91
87
  id?: string;
88
+ vertical?: boolean;
92
89
  rootClassName?: string;
93
90
  isView?: boolean;
94
91
  getValueProps?: ((value: any) => Record<string, unknown>) & ((value: any) => Record<string, unknown>);
95
92
  desensitization?: [number, number] | ReactiveFunction<any, [number, number]>;
96
93
  htmlFor?: string;
94
+ layout?: import("antd/es/form/Form").FormItemLayout;
95
+ help?: React.ReactNode;
96
+ preserve?: boolean;
97
+ trigger?: string;
97
98
  colon?: boolean;
99
+ clearNotShow?: boolean;
98
100
  labelAlign?: import("antd/es/form/interface").FormLabelAlign;
99
101
  labelCol?: import("antd").ColProps;
100
102
  getValueFromEvent?: (...args: import("@rc-component/form/lib/interface").EventArgs) => any;
101
103
  shouldUpdate?: import("@rc-component/form/lib/Field").ShouldUpdate<any>;
102
- trigger?: string;
103
104
  validateTrigger?: string | false | string[];
104
105
  validateDebounce?: number;
105
106
  valuePropName?: string;
@@ -126,7 +127,6 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
126
127
  upperCase?: boolean;
127
128
  toISOString?: boolean;
128
129
  toCSTString?: boolean;
129
- clearNotShow?: boolean;
130
130
  name: any;
131
131
  dependencies: any[];
132
132
  tooltip: string | {
@@ -141,7 +141,7 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
141
141
  * 创建组件属性
142
142
  */
143
143
  export declare const createComponentProps: (column: FlexibleGroupColumnType, formItemProps: any) => {
144
- componentProps: import("lodash").Omit<any, "format" | "valueType" | "switchValue" | "dependNames" | "toISOString" | "toCSTString" | "clearNotShow" | "precision">;
144
+ componentProps: import("lodash").Omit<any, "format" | "clearNotShow" | "valueType" | "switchValue" | "dependNames" | "toISOString" | "toCSTString" | "precision">;
145
145
  formItemTransform: {
146
146
  getValueProps: any;
147
147
  normalize: any;
@@ -55,7 +55,7 @@ export type FunctionArgs<Values, R = any> = (value: any, record: any, { form, in
55
55
  namePath?: NamePath;
56
56
  [key: string]: any;
57
57
  }) => R;
58
- type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T, 'onChange' | 'value'> & {
58
+ type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T, 'onChange' | 'value' | 'role'> & {
59
59
  value?: T['value'];
60
60
  onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], form: FormInstance<Values>) => void;
61
61
  onFieldChange?: FunctionArgs<Values>;
@@ -66,7 +66,7 @@ type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T,
66
66
  type ProEnumFormType<Values> = TransformToFormField<ProEnum, Values> | TransformToFormField<ProEnum & PropProSelectsMap, Values> | TransformToFormField<ProEnum & PropRadioPropsMap, Values> | TransformToFormField<ProEnum & CheckboxPropsMap, Values>;
67
67
  type ProEnumTableType<Values> = TransformToTableField<ProEnum, Values> | TransformToTableField<ProEnum & PropProSelectsMap, Values> | TransformToTableField<ProEnum & PropRadioPropsMap, Values> | TransformToTableField<ProEnum & CheckboxPropsMap, Values>;
68
68
  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'> & {
69
+ type TransformToTableField<T extends ControlProps, Values> = Omit<T, 'onChange' | 'value' | 'onBlur' | 'role'> & {
70
70
  value?: T['value'];
71
71
  onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], record: any, index: number, form: FormInstance<Values>) => void;
72
72
  onFieldChange?: FunctionArgs<Values>;
@@ -1,16 +1,6 @@
1
- import { FormInstance } from 'antd';
2
1
  import React from 'react';
3
2
  import { FormProviderProps } from 'antd/es/form/context';
4
- import type { ProFormType } from './propsType';
5
- import { useForm } from './utils/useForm';
6
- import useWatch from './utils/useWatch';
7
- import { useForms } from '../FormsProvider';
8
- interface IProForm<T = any> extends React.ForwardRefExoticComponent<ProFormType<T> & React.RefAttributes<FormInstance<T>>> {
9
- useForm: typeof useForm;
10
- useWatch: typeof useWatch;
11
- useFormInstances: typeof useForms;
12
- [key: string]: any;
13
- }
14
- declare const ProFormForward: IProForm;
3
+ import type { ProFormInstanceType } from './propsType';
4
+ declare const ProFormForward: ProFormInstanceType<any>;
15
5
  export declare const ProFormProvider: React.FC<FormProviderProps>;
16
6
  export default ProFormForward;
@@ -283,8 +283,6 @@ var ProForm = (props, ref) => {
283
283
  })), children]
284
284
  }));
285
285
  };
286
-
287
- // @ts-ignore
288
286
  var ProFormForward = /*#__PURE__*/(0, _react.forwardRef)(ProForm);
289
287
  ProFormForward.useForm = _useForm3.useForm;
290
288
  ProFormForward.useWatch = _useWatch.default;
@@ -117,6 +117,17 @@ export interface TransformType<T = any> {
117
117
  shouldUpdate?: ShouldUpdate<T>;
118
118
  }
119
119
  export type DistributiveOmit<T, K extends keyof any> = T extends any ? Omit<T, K> : never;
120
+ /**
121
+ * ProForm 组件接口类型
122
+ * 用于定义 ProForm 组件及其静态方法的类型
123
+ * 注意:此接口的具体实现方法类型在组件文件中定义,这里只提供基础结构
124
+ */
125
+ export interface ProFormInstanceType<T = any> extends React.ForwardRefExoticComponent<ProFormType<T> & React.RefAttributes<FormInstance<T>>> {
126
+ useForm: any;
127
+ useWatch: any;
128
+ useFormInstances: any;
129
+ [key: string]: any;
130
+ }
120
131
  /**
121
132
  * 兼容旧命名导出
122
133
  */
@@ -6,6 +6,12 @@ Object.defineProperty(exports, "__esModule", {
6
6
  exports.otherKeys = void 0;
7
7
  var otherKeys = exports.otherKeys = ['isView', 'viewEmpty', 'label', 'valueType', 'viewType', 'name', 'names', 'form', 'type', 'hiddenNames'];
8
8
 
9
+ /**
10
+ * ProForm 组件接口类型
11
+ * 用于定义 ProForm 组件及其静态方法的类型
12
+ * 注意:此接口的具体实现方法类型在组件文件中定义,这里只提供基础结构
13
+ */
14
+
9
15
  /**
10
16
  * 兼容旧命名导出
11
17
  */
@@ -35,6 +35,8 @@ export declare const getThemeUpdaters: () => {
35
35
  };
36
36
  interface ThemeProviderProps {
37
37
  children: ReactNode;
38
+ initialLocalConfig?: Partial<LocalThemeConfigType>;
39
+ initialAntdConfig?: AntdThemeConfigType;
38
40
  }
39
41
  export declare const ThemeProvider: React.FC<ThemeProviderProps>;
40
42
  export declare const useTheme: () => ThemeContextType;