@zat-design/sisyphus-react 4.4.2 → 4.4.3-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/FormsProvider/index.d.ts +1 -1
- package/es/ProEditTable/components/RenderField/index.js +8 -8
- package/es/ProEditTable/utils/config.js +5 -2
- package/es/ProEditTable/utils/index.js +11 -6
- package/es/ProEditTable/utils/tools.js +3 -2
- package/es/ProEnum/index.js +1 -1
- package/es/ProForm/components/FormFooter/propsType.d.ts +1 -1
- package/es/ProForm/components/base/DatePicker/index.js +3 -2
- package/es/ProForm/components/combination/Group/component/ComRender.js +1 -1
- package/es/ProForm/components/combination/Group/component/FlexibleGroup.js +4 -11
- package/es/ProForm/components/combination/Group/hooks/index.js +1 -2
- package/es/ProForm/components/combination/Group/utils/index.d.ts +20 -20
- package/es/ProForm/components/render/Render.js +149 -180
- package/es/ProForm/components/render/RenderFields.js +13 -38
- package/es/ProForm/components/render/propsType.d.ts +1 -18
- package/es/ProForm/components/render/propsType.js +0 -26
- package/es/ProForm/hooks/useControlled.d.ts +1 -0
- package/es/ProForm/hooks/useControlled.js +14 -0
- package/es/ProForm/hooks/useForm.d.ts +8 -0
- package/es/ProForm/{utils → hooks}/useForm.js +1 -1
- package/es/ProForm/{utils → hooks}/useRules.js +2 -2
- package/es/ProForm/{utils → hooks}/useShouldUpdate.d.ts +5 -1
- package/es/ProForm/{utils → hooks}/useShouldUpdate.js +30 -77
- package/es/ProForm/{utils → hooks}/useWatch.js +1 -1
- package/es/ProForm/index.js +5 -4
- package/es/ProForm/propsType.d.ts +13 -1
- package/es/ProForm/utils/buildFormItemProps.d.ts +25 -0
- package/es/ProForm/utils/buildFormItemProps.js +90 -0
- package/es/ProForm/utils/index.d.ts +2 -6
- package/es/ProForm/utils/index.js +3 -30
- package/es/ProForm/utils/reactiveValues.d.ts +34 -0
- package/es/ProForm/utils/reactiveValues.js +45 -0
- package/es/ProSelect/index.js +8 -7
- package/es/ProTreeModal/components/Trigger.js +13 -12
- package/es/ProTreeModal/style/index.less +12 -1
- package/package.json +1 -1
- package/es/ProForm/utils/useForm.d.ts +0 -22
- /package/es/ProForm/{utils → hooks}/useDeepCompareMemo.d.ts +0 -0
- /package/es/ProForm/{utils → hooks}/useDeepCompareMemo.js +0 -0
- /package/es/ProForm/{utils → hooks}/useFieldProps.d.ts +0 -0
- /package/es/ProForm/{utils → hooks}/useFieldProps.js +0 -0
- /package/es/ProForm/{utils → hooks}/useRules.d.ts +0 -0
- /package/es/ProForm/{utils → hooks}/useWatch.d.ts +0 -0
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/// <reference types="react" />
|
|
2
|
+
/** 列级响应式配置(可能为静态值或 ReactiveFunction) */
|
|
3
|
+
export interface ReactiveProps {
|
|
4
|
+
show?: any;
|
|
5
|
+
disabled?: any;
|
|
6
|
+
required?: any;
|
|
7
|
+
rules?: any;
|
|
8
|
+
fieldProps?: any;
|
|
9
|
+
desensitization?: any;
|
|
10
|
+
}
|
|
11
|
+
/** 解析后的列级响应式值 */
|
|
12
|
+
export interface ReactiveValues {
|
|
13
|
+
show: any;
|
|
14
|
+
disabled: any;
|
|
15
|
+
required: any;
|
|
16
|
+
rules: any;
|
|
17
|
+
fieldProps: any;
|
|
18
|
+
desensitization: any;
|
|
19
|
+
}
|
|
20
|
+
/** 持有解析值的 ref 集合 */
|
|
21
|
+
export interface ReactiveRefs {
|
|
22
|
+
showRef: React.MutableRefObject<any>;
|
|
23
|
+
disabledRef: React.MutableRefObject<any>;
|
|
24
|
+
requiredRef: React.MutableRefObject<any>;
|
|
25
|
+
rulesRef: React.MutableRefObject<any>;
|
|
26
|
+
fieldPropsRef: React.MutableRefObject<any>;
|
|
27
|
+
desensitizationRef: React.MutableRefObject<any>;
|
|
28
|
+
}
|
|
29
|
+
/** 按当前表单值解析 show/disabled/required/rules/fieldProps/desensitization(纯函数,无副作用) */
|
|
30
|
+
export declare const resolveReactiveValues: (reactiveProps: ReactiveProps, currentValues: any, ctx: any) => ReactiveValues;
|
|
31
|
+
/** 比较解析值与上一次 ref 值是否有变化(纯函数,无副作用) */
|
|
32
|
+
export declare const hasReactiveDiff: (refs: ReactiveRefs, next: ReactiveValues) => boolean;
|
|
33
|
+
/** 将解析值写回 ref 集合 */
|
|
34
|
+
export declare const commitReactiveValues: (refs: ReactiveRefs, next: ReactiveValues) => void;
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
import _isEqualWith from "lodash/isEqualWith";
|
|
2
|
+
import _isFunction from "lodash/isFunction";
|
|
3
|
+
import { customEqualForFunction } from "../../utils";
|
|
4
|
+
|
|
5
|
+
/** 列级响应式配置(可能为静态值或 ReactiveFunction) */
|
|
6
|
+
|
|
7
|
+
/** 解析后的列级响应式值 */
|
|
8
|
+
|
|
9
|
+
/** 持有解析值的 ref 集合 */
|
|
10
|
+
|
|
11
|
+
/** 按当前表单值解析 show/disabled/required/rules/fieldProps/desensitization(纯函数,无副作用) */
|
|
12
|
+
export const resolveReactiveValues = (reactiveProps, currentValues, ctx) => {
|
|
13
|
+
const {
|
|
14
|
+
show,
|
|
15
|
+
disabled,
|
|
16
|
+
required,
|
|
17
|
+
rules,
|
|
18
|
+
fieldProps,
|
|
19
|
+
desensitization
|
|
20
|
+
} = reactiveProps;
|
|
21
|
+
return {
|
|
22
|
+
show: _isFunction(show) ? Boolean(show(currentValues, ctx)) : show,
|
|
23
|
+
disabled: _isFunction(disabled) ? disabled(currentValues, ctx) : disabled,
|
|
24
|
+
required: _isFunction(required) ? required(currentValues, ctx) : required,
|
|
25
|
+
rules: _isFunction(rules) ? rules(currentValues, ctx) : rules,
|
|
26
|
+
fieldProps: _isFunction(fieldProps) ? fieldProps(currentValues, ctx) : fieldProps,
|
|
27
|
+
desensitization: _isFunction(desensitization) ? desensitization(currentValues, ctx) : desensitization
|
|
28
|
+
};
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
/** 比较解析值与上一次 ref 值是否有变化(纯函数,无副作用) */
|
|
32
|
+
export const hasReactiveDiff = (refs, next) => {
|
|
33
|
+
return next.show !== refs.showRef.current || !_isEqualWith(refs.disabledRef.current, next.disabled, customEqualForFunction) || next.required !== refs.requiredRef.current || !_isEqualWith(refs.rulesRef.current, next.rules, customEqualForFunction) || !_isEqualWith(refs.fieldPropsRef.current, next.fieldProps, customEqualForFunction) || !_isEqualWith(refs.desensitizationRef.current, next.desensitization) || Boolean(next.fieldProps?.transformResponse) // 防止fieldProps变更时,transformResponse根据fieldProps新值无法触发更新
|
|
34
|
+
;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
/** 将解析值写回 ref 集合 */
|
|
38
|
+
export const commitReactiveValues = (refs, next) => {
|
|
39
|
+
refs.showRef.current = next.show;
|
|
40
|
+
refs.disabledRef.current = next.disabled;
|
|
41
|
+
refs.requiredRef.current = next.required;
|
|
42
|
+
refs.rulesRef.current = next.rules;
|
|
43
|
+
refs.fieldPropsRef.current = next.fieldProps;
|
|
44
|
+
refs.desensitizationRef.current = next.desensitization;
|
|
45
|
+
};
|
package/es/ProSelect/index.js
CHANGED
|
@@ -254,6 +254,7 @@ export const ProSelect = (props, ref) => {
|
|
|
254
254
|
const defaultConfig = {
|
|
255
255
|
enabled: true,
|
|
256
256
|
filterOption: _isFunction(_onSearch) ? false : defaultFilterOption,
|
|
257
|
+
optionFilterProp: 'label',
|
|
257
258
|
onSearch: searchValue => {
|
|
258
259
|
_onSearch?.(searchValue, {
|
|
259
260
|
...fetchFunctionRef.current
|
|
@@ -276,6 +277,7 @@ export const ProSelect = (props, ref) => {
|
|
|
276
277
|
...customShowSearch,
|
|
277
278
|
enabled: true,
|
|
278
279
|
filterOption: customShowSearch.filterOption ?? defaultConfig.filterOption,
|
|
280
|
+
optionFilterProp: customShowSearch.optionFilterProp ?? defaultConfig.optionFilterProp,
|
|
279
281
|
onSearch: customShowSearch.onSearch ?? defaultConfig.onSearch
|
|
280
282
|
};
|
|
281
283
|
}
|
|
@@ -466,10 +468,6 @@ export const ProSelect = (props, ref) => {
|
|
|
466
468
|
}
|
|
467
469
|
return buildOptionItem(item, index);
|
|
468
470
|
}) : [];
|
|
469
|
-
const selectSearchProps = {
|
|
470
|
-
filterOption: mergedShowSearch.filterOption,
|
|
471
|
-
onSearch: mergedShowSearch.onSearch
|
|
472
|
-
};
|
|
473
471
|
return /*#__PURE__*/_jsx("div", {
|
|
474
472
|
style: props.style,
|
|
475
473
|
className: "pro-select",
|
|
@@ -478,14 +476,17 @@ export const ProSelect = (props, ref) => {
|
|
|
478
476
|
allowClear: true,
|
|
479
477
|
loading: fetchFunction?.loading,
|
|
480
478
|
onChange: handleChange,
|
|
481
|
-
showSearch: mergedShowSearch.enabled
|
|
482
|
-
|
|
479
|
+
showSearch: mergedShowSearch.enabled ? {
|
|
480
|
+
filterOption: mergedShowSearch.filterOption,
|
|
481
|
+
optionFilterProp: mergedShowSearch.optionFilterProp,
|
|
482
|
+
onSearch: mergedShowSearch.onSearch
|
|
483
|
+
} : false,
|
|
483
484
|
getPopupContainer: trigger => {
|
|
484
485
|
return scrollFollowParent ? trigger.parentElement : document.body;
|
|
485
486
|
},
|
|
486
487
|
..._omit({
|
|
487
488
|
...selectProps
|
|
488
|
-
}, ['isView', 'showCodeName', 'form', 'name', 'style', 'onFieldChange', 'getChangeValue', 'viewportReady', 'showSearch']),
|
|
489
|
+
}, ['isView', 'showCodeName', 'form', 'name', 'style', 'onFieldChange', 'getChangeValue', 'viewportReady', 'showSearch', 'filterOption', 'optionFilterProp', 'searchValue']),
|
|
489
490
|
// 如果是多选模式且用户没有自定义maxTagPlaceholder,使用我们的hover版本
|
|
490
491
|
maxTagPlaceholder: selectProps.mode === 'multiple' && !selectProps.maxTagPlaceholder ? maxTagPlaceholder : selectProps.maxTagPlaceholder,
|
|
491
492
|
optionRender: selectOptionRender,
|
|
@@ -59,15 +59,16 @@ function Trigger(props) {
|
|
|
59
59
|
'trigger-no-hover': afterDisabled
|
|
60
60
|
});
|
|
61
61
|
if (isView) {
|
|
62
|
+
const hasValue = checkedValues.length > 0;
|
|
62
63
|
return /*#__PURE__*/_jsxs("div", {
|
|
63
64
|
className: "pro-tree-modal-isView",
|
|
64
65
|
children: [/*#__PURE__*/_jsx("div", {
|
|
65
|
-
children:
|
|
66
|
+
children: !hasValue ? '-' : state.mode === 'all' ? formatMessage(locale?.ProTreeModal.checkAll1, {
|
|
66
67
|
all: label
|
|
67
68
|
}) : formatMessage(locale?.ProTreeModal?.checkNumber, {
|
|
68
69
|
num: checkedValues.length
|
|
69
70
|
})
|
|
70
|
-
}), /*#__PURE__*/_jsx("div", {
|
|
71
|
+
}), hasValue && /*#__PURE__*/_jsx("div", {
|
|
71
72
|
className: addonAfterClassName,
|
|
72
73
|
children: /*#__PURE__*/_jsx(ReactSVG, {
|
|
73
74
|
className: viewIconClassName,
|
|
@@ -94,7 +95,7 @@ function Trigger(props) {
|
|
|
94
95
|
style: {
|
|
95
96
|
...triggerStyle
|
|
96
97
|
},
|
|
97
|
-
children: [/*#__PURE__*/
|
|
98
|
+
children: [/*#__PURE__*/_jsx(Select, {
|
|
98
99
|
style: {
|
|
99
100
|
width: 'auto'
|
|
100
101
|
},
|
|
@@ -103,15 +104,15 @@ function Trigger(props) {
|
|
|
103
104
|
defaultValue: "appoint",
|
|
104
105
|
value: state.mode,
|
|
105
106
|
onChange: onAppointChange,
|
|
106
|
-
|
|
107
|
-
value:
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
value:
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
}
|
|
107
|
+
options: [{
|
|
108
|
+
value: 'all',
|
|
109
|
+
label: locale?.ProTreeModal.specifyMode[0],
|
|
110
|
+
disabled: !!allDisabled
|
|
111
|
+
}, {
|
|
112
|
+
value: 'appoint',
|
|
113
|
+
label: locale?.ProTreeModal.specifyMode[1],
|
|
114
|
+
disabled: !!specifyDisabled
|
|
115
|
+
}]
|
|
115
116
|
}), props.children]
|
|
116
117
|
});
|
|
117
118
|
}
|
|
@@ -67,7 +67,8 @@
|
|
|
67
67
|
}
|
|
68
68
|
|
|
69
69
|
.@{ant-prefix}-input-disabled {
|
|
70
|
-
border-radius: 0 !important;
|
|
70
|
+
border-top-right-radius: 0 !important;
|
|
71
|
+
border-bottom-right-radius: 0 !important;
|
|
71
72
|
}
|
|
72
73
|
|
|
73
74
|
.@{ant-prefix}-input-group-wrapper:hover {
|
|
@@ -266,6 +267,16 @@
|
|
|
266
267
|
.pro-tree-modal-view-svg {
|
|
267
268
|
margin-left: var(--zaui-space-size-sm, 8px);
|
|
268
269
|
}
|
|
270
|
+
|
|
271
|
+
.pro-enum-input-addonAfter {
|
|
272
|
+
padding: 0;
|
|
273
|
+
background: transparent;
|
|
274
|
+
border: none;
|
|
275
|
+
|
|
276
|
+
&:hover {
|
|
277
|
+
box-shadow: none !important;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
269
280
|
}
|
|
270
281
|
|
|
271
282
|
&-tree-content {
|
package/package.json
CHANGED
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { FormInstance } from 'antd';
|
|
2
|
-
import { NamePath } from 'antd/es/form/interface';
|
|
3
|
-
import type { ValuedNotifyInfo } from '@rc-component/form/es/interface';
|
|
4
|
-
export type ModifiedFormInstanceType<T> = FormInstance<T> & {
|
|
5
|
-
isModified?: boolean;
|
|
6
|
-
/** 默认清空设置值的报错状态 */
|
|
7
|
-
setFieldValue: (name: NamePath, value: any, info?: ValuedNotifyInfo) => void;
|
|
8
|
-
formKey?: string;
|
|
9
|
-
_init?: boolean;
|
|
10
|
-
__INTERNAL_CONFIG__?: {
|
|
11
|
-
fields?: any[];
|
|
12
|
-
stopOnFirstError?: boolean;
|
|
13
|
-
[key: string]: any;
|
|
14
|
-
};
|
|
15
|
-
};
|
|
16
|
-
export interface FormInstanceOption {
|
|
17
|
-
scrollToError?: boolean;
|
|
18
|
-
optimize?: boolean;
|
|
19
|
-
formKey?: string;
|
|
20
|
-
source?: string;
|
|
21
|
-
}
|
|
22
|
-
export declare const useForm: <T>(originForm?: ModifiedFormInstanceType<T> | FormInstanceOption, options?: FormInstanceOption) => [ModifiedFormInstanceType<T>];
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|