@zat-design/sisyphus-react 4.3.5-beta.3 → 4.3.6-beta.2
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/ProConfigProvider/propsType.d.ts +1 -0
- package/es/ProEditTable/style/index.less +1 -1
- package/es/ProEnum/index.js +2 -1
- package/es/ProEnum/utils/getEnumLabel.js +1 -1
- package/es/ProForm/components/Container.js +1 -1
- package/es/ProForm/components/base/Checkbox/index.js +1 -1
- package/es/ProForm/components/base/Radio/index.js +1 -1
- package/es/ProForm/components/combination/Group/utils/index.d.ts +14 -14
- package/es/ProForm/components/combination/ProCascader/index.js +3 -1
- package/es/ProForm/components/combination/ProModalSelect/index.js +1 -1
- package/es/ProForm/components/render/Render.js +1 -1
- package/es/ProForm/style/index.less +4 -1
- package/es/ProLayout/components/TabsManager/hooks/useTabsState.js +51 -0
- package/es/ProLayout/components/TabsManager/index.js +3 -1
- package/es/ProLayout/components/TabsManager/propTypes.d.ts +3 -1
- package/es/ProLayout/propTypes.d.ts +27 -0
- package/es/ProLayout/propTypes.js +4 -0
- package/es/ProTable/style/index.less +1 -1
- package/es/ProTree/components/ProTreeSelect/index.js +1 -1
- package/package.json +1 -1
|
@@ -11,6 +11,7 @@ export interface ProConfigProviderType {
|
|
|
11
11
|
ProSelect?: Partial<PropSelectType> & Record<string, any>;
|
|
12
12
|
ProModalSelect?: Partial<ProModalSelectType> & Record<string, any>;
|
|
13
13
|
ProAddressBar?: Partial<ProCascaderType> & Record<string, any>;
|
|
14
|
+
ProCascader?: Partial<ProCascaderType> & Record<string, any>;
|
|
14
15
|
forms?: Record<string, FormInstance | undefined>;
|
|
15
16
|
[key: string]: any;
|
|
16
17
|
}
|
package/es/ProEnum/index.js
CHANGED
|
@@ -260,7 +260,8 @@ const ProEnum = props => {
|
|
|
260
260
|
}, item))
|
|
261
261
|
});
|
|
262
262
|
};
|
|
263
|
-
|
|
263
|
+
const filteredLabelList = labelList?.filter(item => item != null && item !== '');
|
|
264
|
+
return _isFunction(props.optionRender) && record.length ? _optionRender() : filteredLabelList?.length ? filteredLabelList.join('、') : null;
|
|
264
265
|
};
|
|
265
266
|
if (_isView) {
|
|
266
267
|
const __value = value ?? _defaultValue;
|
|
@@ -15,7 +15,7 @@ const Container = props => {
|
|
|
15
15
|
const nullValue = children !== 0 && !children || isEmptyArray(children);
|
|
16
16
|
const _className = classNames({
|
|
17
17
|
'pro-form-view-container': true,
|
|
18
|
-
'pro-form-view-
|
|
18
|
+
'pro-form-view-container-nowrap': nowrap ?? tooltip
|
|
19
19
|
});
|
|
20
20
|
if (tooltip && !nullValue) {
|
|
21
21
|
return /*#__PURE__*/_jsx(Tooltip, {
|
|
@@ -75,43 +75,44 @@ 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
|
-
id?: string;
|
|
79
|
-
className?: string;
|
|
80
|
-
hidden?: boolean;
|
|
81
|
-
style?: React.CSSProperties;
|
|
82
78
|
children?: React.ReactNode | ((form: FormInstance<any>) => React.ReactNode);
|
|
83
|
-
|
|
79
|
+
trim?: boolean;
|
|
80
|
+
normalize?: (value: any, prevValue: any, allValues: import("@rc-component/form/lib/interface").Store) => any;
|
|
84
81
|
prefixCls?: string;
|
|
82
|
+
trigger?: string;
|
|
83
|
+
id?: string;
|
|
84
|
+
className?: string;
|
|
85
85
|
rootClassName?: string;
|
|
86
|
-
|
|
87
|
-
vertical?: boolean;
|
|
86
|
+
style?: React.CSSProperties;
|
|
88
87
|
isView?: boolean;
|
|
88
|
+
status?: "" | "success" | "warning" | "error" | "validating";
|
|
89
|
+
vertical?: boolean;
|
|
90
|
+
hidden?: boolean;
|
|
91
|
+
layout?: import("antd/es/form/Form").FormItemLayout;
|
|
92
|
+
help?: React.ReactNode;
|
|
93
|
+
preserve?: boolean;
|
|
89
94
|
colon?: boolean;
|
|
90
95
|
htmlFor?: string;
|
|
91
96
|
labelAlign?: import("antd/es/form/interface").FormLabelAlign;
|
|
92
97
|
labelCol?: import("antd").ColProps;
|
|
93
98
|
getValueFromEvent?: (...args: import("@rc-component/form/lib/interface").EventArgs) => any;
|
|
94
|
-
normalize?: (value: any, prevValue: any, allValues: import("@rc-component/form/lib/interface").Store) => any;
|
|
95
99
|
shouldUpdate?: import("@rc-component/form/lib/Field").ShouldUpdate<any>;
|
|
96
|
-
trigger?: string;
|
|
97
100
|
validateTrigger?: string | false | string[];
|
|
98
101
|
validateDebounce?: number;
|
|
99
102
|
valuePropName?: string;
|
|
100
103
|
getValueProps?: ((value: any) => Record<string, unknown>) & ((value: any) => Record<string, unknown>);
|
|
101
104
|
messageVariables?: Record<string, string>;
|
|
102
105
|
initialValue?: any;
|
|
106
|
+
onReset?: () => void;
|
|
103
107
|
onMetaChange?: (meta: import("@rc-component/form/lib/Field").MetaEvent) => void;
|
|
104
|
-
preserve?: boolean;
|
|
105
108
|
isListField?: boolean;
|
|
106
109
|
isList?: boolean;
|
|
107
110
|
noStyle?: boolean;
|
|
108
111
|
hasFeedback?: boolean | {
|
|
109
112
|
icons: import("antd/es/form/FormItem").FeedbackIcons;
|
|
110
113
|
};
|
|
111
|
-
validateStatus?: "" | "
|
|
112
|
-
layout?: import("antd/es/form/Form").FormItemLayout;
|
|
114
|
+
validateStatus?: "" | "success" | "warning" | "error" | "validating";
|
|
113
115
|
wrapperCol?: import("antd").ColProps;
|
|
114
|
-
help?: React.ReactNode;
|
|
115
116
|
fieldId?: string;
|
|
116
117
|
valueType?: import("../../../render/propsType").ProFormValueType;
|
|
117
118
|
switchValue?: [any, any];
|
|
@@ -121,7 +122,6 @@ export declare const useFormItemProps: (column: FlexibleGroupColumnType, context
|
|
|
121
122
|
index?: number;
|
|
122
123
|
}) => string | React.ReactElement<any, any>;
|
|
123
124
|
viewType?: import("../../../render/propsType").ViewType;
|
|
124
|
-
trim?: boolean;
|
|
125
125
|
upperCase?: boolean;
|
|
126
126
|
toISOString?: boolean;
|
|
127
127
|
toCSTString?: boolean;
|
|
@@ -43,11 +43,13 @@ const getViewLabel = ({
|
|
|
43
43
|
return viewLabel;
|
|
44
44
|
};
|
|
45
45
|
const ProCascader = props => {
|
|
46
|
+
const proCascaderConfig = useProConfig('ProCascader');
|
|
47
|
+
const proAddressBarConfig = useProConfig('ProAddressBar');
|
|
46
48
|
const {
|
|
47
49
|
detailMaxLength: configDetailMaxLength,
|
|
48
50
|
enumCode: configEnumCode,
|
|
49
51
|
code: configCode
|
|
50
|
-
} =
|
|
52
|
+
} = proCascaderConfig ?? proAddressBarConfig ?? {};
|
|
51
53
|
const isAddressMode = props?.mode === 'address' || props?.otherProps?.type === 'ProAddressBar';
|
|
52
54
|
const {
|
|
53
55
|
className = '',
|
|
@@ -158,7 +158,7 @@ const Render = props => {
|
|
|
158
158
|
Object.assign(otherFormItemProps, transforms, {
|
|
159
159
|
names: otherProps.names
|
|
160
160
|
}, internalRule, {
|
|
161
|
-
required:
|
|
161
|
+
required: _required || Array.isArray(rules) && rules?.some(item => item?.required) || (typeof labelRequired === 'boolean' ? labelRequired : false)
|
|
162
162
|
}, otherProps.isView && !requiredOnView ? {
|
|
163
163
|
required: false
|
|
164
164
|
} : null, {
|
|
@@ -329,7 +329,7 @@
|
|
|
329
329
|
word-break: break-all;
|
|
330
330
|
}
|
|
331
331
|
|
|
332
|
-
.pro-form-view-
|
|
332
|
+
.pro-form-view-container-nowrap {
|
|
333
333
|
overflow: hidden;
|
|
334
334
|
white-space: nowrap;
|
|
335
335
|
text-overflow: ellipsis;
|
|
@@ -530,6 +530,9 @@
|
|
|
530
530
|
border-radius: 4px;
|
|
531
531
|
}
|
|
532
532
|
}
|
|
533
|
+
&.pro-form-view .@{ant-prefix}-form-item .@{ant-prefix}-form-item-control-input-content {
|
|
534
|
+
display: flex;
|
|
535
|
+
}
|
|
533
536
|
}
|
|
534
537
|
|
|
535
538
|
.original-value-tooltip {
|
|
@@ -188,6 +188,56 @@ export const useTabsState = options => {
|
|
|
188
188
|
});
|
|
189
189
|
}, [finalConfig]);
|
|
190
190
|
|
|
191
|
+
/**
|
|
192
|
+
* 更新已存在标签页的展示信息(保持 tab.id 不变 → 子组件不会 unmount)
|
|
193
|
+
* - 仅允许更新 name / icon / extra / closable
|
|
194
|
+
* - extra 为替换语义(直接覆盖原 extra)
|
|
195
|
+
* - tabId 不存在时 no-op
|
|
196
|
+
*/
|
|
197
|
+
const updateTab = useCallback((tabId, updates) => {
|
|
198
|
+
setState(prevState => {
|
|
199
|
+
const targetIndex = prevState.tabsList.findIndex(tab => tab.id === tabId);
|
|
200
|
+
if (targetIndex === -1) return prevState;
|
|
201
|
+
const target = prevState.tabsList[targetIndex];
|
|
202
|
+
const nextMenuItem = target.menuItem ? {
|
|
203
|
+
...target.menuItem,
|
|
204
|
+
...(updates.name !== undefined && {
|
|
205
|
+
name: updates.name
|
|
206
|
+
}),
|
|
207
|
+
...(updates.icon !== undefined && {
|
|
208
|
+
icon: updates.icon
|
|
209
|
+
}),
|
|
210
|
+
...(updates.extra !== undefined && {
|
|
211
|
+
extra: updates.extra
|
|
212
|
+
}),
|
|
213
|
+
...(updates.closable !== undefined && {
|
|
214
|
+
closable: updates.closable
|
|
215
|
+
})
|
|
216
|
+
} : target.menuItem;
|
|
217
|
+
const nextTab = {
|
|
218
|
+
...target,
|
|
219
|
+
...(updates.name !== undefined && {
|
|
220
|
+
name: updates.name,
|
|
221
|
+
title: updates.name
|
|
222
|
+
}),
|
|
223
|
+
...(updates.icon !== undefined && {
|
|
224
|
+
icon: updates.icon
|
|
225
|
+
}),
|
|
226
|
+
...(updates.closable !== undefined && {
|
|
227
|
+
closable: updates.closable
|
|
228
|
+
}),
|
|
229
|
+
menuItem: nextMenuItem
|
|
230
|
+
};
|
|
231
|
+
const newTabsList = [...prevState.tabsList];
|
|
232
|
+
newTabsList[targetIndex] = nextTab;
|
|
233
|
+
return {
|
|
234
|
+
...prevState,
|
|
235
|
+
tabsList: newTabsList,
|
|
236
|
+
activeTabInfo: prevState.activeKey === tabId ? nextTab : prevState.activeTabInfo
|
|
237
|
+
};
|
|
238
|
+
});
|
|
239
|
+
}, []);
|
|
240
|
+
|
|
191
241
|
/**
|
|
192
242
|
* 移除标签页
|
|
193
243
|
*/
|
|
@@ -377,6 +427,7 @@ export const useTabsState = options => {
|
|
|
377
427
|
addTab,
|
|
378
428
|
canAddTab,
|
|
379
429
|
removeTab,
|
|
430
|
+
updateTab,
|
|
380
431
|
switchTab,
|
|
381
432
|
closeOtherTabs,
|
|
382
433
|
closeRightTabs,
|
|
@@ -24,6 +24,7 @@ const TabsManager = /*#__PURE__*/forwardRef(({
|
|
|
24
24
|
addTab,
|
|
25
25
|
canAddTab,
|
|
26
26
|
removeTab,
|
|
27
|
+
updateTab,
|
|
27
28
|
switchTab,
|
|
28
29
|
closeOtherTabs,
|
|
29
30
|
closeRightTabs,
|
|
@@ -113,12 +114,13 @@ const TabsManager = /*#__PURE__*/forwardRef(({
|
|
|
113
114
|
addTab(menuItem, options);
|
|
114
115
|
},
|
|
115
116
|
removeTab,
|
|
117
|
+
updateTab,
|
|
116
118
|
getTabInfo: () => ({
|
|
117
119
|
tabsList: state.tabsList,
|
|
118
120
|
activeTabInfo: state.tabsList.find(tab => tab.id === state.activeKey),
|
|
119
121
|
activeComponent: state.activeComponent
|
|
120
122
|
})
|
|
121
|
-
}), [addTab, removeTab, state.tabsList, state.activeKey, state.activeComponent, dataSource]);
|
|
123
|
+
}), [addTab, removeTab, updateTab, state.tabsList, state.activeKey, state.activeComponent, dataSource]);
|
|
122
124
|
const handleTabChange = useCallback(activeKey => {
|
|
123
125
|
switchTab(activeKey);
|
|
124
126
|
}, [switchTab]);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
2
|
import type { MenuProps } from 'antd';
|
|
3
|
-
import { TabsState, MenusType, DataSourceType, TabsConfig, AddTabOptions, TabItem } from '../../propTypes';
|
|
3
|
+
import { TabsState, MenusType, DataSourceType, TabsConfig, AddTabOptions, TabItem, UpdateTabParams } from '../../propTypes';
|
|
4
4
|
export interface TabsManagerProps {
|
|
5
5
|
/** 标签页配置 */
|
|
6
6
|
config: TabsConfig;
|
|
@@ -59,6 +59,8 @@ export interface UseTabsStateReturn {
|
|
|
59
59
|
canAddTab: (menuItem: MenusType, options?: AddTabOptions) => boolean;
|
|
60
60
|
/** 移除标签页 */
|
|
61
61
|
removeTab: (tabId: string) => void;
|
|
62
|
+
/** 更新指定 id 的标签页字段(替换语义;找不到时 no-op) */
|
|
63
|
+
updateTab: (tabId: string, updates: UpdateTabParams) => void;
|
|
62
64
|
/** 切换标签页 */
|
|
63
65
|
switchTab: (tabId: string) => void;
|
|
64
66
|
/** 关闭其他标签页 */
|
|
@@ -371,6 +371,27 @@ export interface AddTabOptions {
|
|
|
371
371
|
*/
|
|
372
372
|
forceNew?: boolean;
|
|
373
373
|
}
|
|
374
|
+
/**
|
|
375
|
+
* @description 更新标签页的字段(仅允许更新展示与扩展数据)
|
|
376
|
+
*/
|
|
377
|
+
export interface UpdateTabParams {
|
|
378
|
+
/**
|
|
379
|
+
* @description 标签名称(更新时同步刷新 title)
|
|
380
|
+
*/
|
|
381
|
+
name?: string;
|
|
382
|
+
/**
|
|
383
|
+
* @description 图标
|
|
384
|
+
*/
|
|
385
|
+
icon?: ReactNode | string;
|
|
386
|
+
/**
|
|
387
|
+
* @description 额外扩展数据(替换式覆盖,不做合并)
|
|
388
|
+
*/
|
|
389
|
+
extra?: Record<string, any>;
|
|
390
|
+
/**
|
|
391
|
+
* @description 是否可关闭
|
|
392
|
+
*/
|
|
393
|
+
closable?: boolean;
|
|
394
|
+
}
|
|
374
395
|
/**
|
|
375
396
|
* @description 获取标签页信息返回值
|
|
376
397
|
*/
|
|
@@ -394,6 +415,12 @@ export interface ProLayoutTabsInstance {
|
|
|
394
415
|
* @description 删除标签页
|
|
395
416
|
*/
|
|
396
417
|
removeTab: (tabId: string) => void;
|
|
418
|
+
/**
|
|
419
|
+
* @description 更新已存在标签页的展示信息(不会卸载/重挂渲染组件)
|
|
420
|
+
* @param tabId 目标标签页 id
|
|
421
|
+
* @param updates 仅更新传入的字段,extra 为替换式覆盖
|
|
422
|
+
*/
|
|
423
|
+
updateTab: (tabId: string, updates: UpdateTabParams) => void;
|
|
397
424
|
/**
|
|
398
425
|
* @description 获取标签页信息
|
|
399
426
|
*/
|