@zat-design/sisyphus-react 3.3.3-beta.5 → 3.3.3-beta.7
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 +7 -2
- package/es/ProConfigProvider/index.d.ts +1 -1
- package/es/ProConfigProvider/index.js +1 -1
- package/es/ProForm/components/base/TextArea/index.js +1 -3
- package/es/ProForm/components/base/TextArea/index.less +7 -0
- package/es/ProForm/components/combination/Group/index.js +6 -1
- package/es/ProForm/components/combination/Group/style/index.less +2 -1
- package/es/ProForm/index.js +2 -2
- package/es/ProForm/utils/useRules.js +4 -1
- package/lib/ProConfigProvider/index.d.ts +1 -1
- package/lib/ProConfigProvider/index.js +2 -2
- package/lib/ProForm/components/base/TextArea/index.js +1 -3
- package/lib/ProForm/components/base/TextArea/index.less +7 -0
- package/lib/ProForm/components/combination/Group/index.js +6 -1
- package/lib/ProForm/components/combination/Group/style/index.less +2 -1
- package/lib/ProForm/index.js +1 -1
- package/lib/ProForm/utils/useRules.js +4 -1
- package/package.json +1 -1
package/dist/index.esm.css
CHANGED
|
@@ -1941,6 +1941,9 @@ div.pro-textarea-view::after {
|
|
|
1941
1941
|
display: none;
|
|
1942
1942
|
padding-bottom: 12px;
|
|
1943
1943
|
}
|
|
1944
|
+
.pro-textarea .ant-input {
|
|
1945
|
+
resize: auto !important;
|
|
1946
|
+
}
|
|
1944
1947
|
.pro-form-list-block-title {
|
|
1945
1948
|
height: 14px;
|
|
1946
1949
|
margin: calc(var(--zaui-space-size-xs, 4px) * var(--zaui-size, 1)) 0;
|
|
@@ -2233,10 +2236,12 @@ span.ant-input-group-compact.pro-range-limit .forever-checkbox {
|
|
|
2233
2236
|
.pro-group {
|
|
2234
2237
|
width: unset !important;
|
|
2235
2238
|
}
|
|
2236
|
-
.pro-group.pro-group-diy-width .ant-space .ant-space-item
|
|
2239
|
+
.pro-group.pro-group-diy-width .ant-space .ant-space-item,
|
|
2240
|
+
.pro-group.pro-group-width-auto .ant-space .ant-space-item {
|
|
2237
2241
|
width: auto;
|
|
2238
2242
|
}
|
|
2239
|
-
.pro-group.pro-group-diy-width .ant-space .ant-space-item .ant-space-item
|
|
2243
|
+
.pro-group.pro-group-diy-width .ant-space .ant-space-item .ant-space-item,
|
|
2244
|
+
.pro-group.pro-group-width-auto .ant-space .ant-space-item .ant-space-item {
|
|
2240
2245
|
width: auto;
|
|
2241
2246
|
}
|
|
2242
2247
|
.pro-group .ant-space {
|
|
@@ -20,7 +20,7 @@ interface ConfigContext {
|
|
|
20
20
|
export declare const ProConfigContext: React.Context<ConfigContext>;
|
|
21
21
|
export declare function useProConfig(): ConfigContext;
|
|
22
22
|
export declare function useProConfig(name: keyof ConfigContext['state']): ConfigContext['state'][keyof ConfigContext['state']];
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function useContextForms(): Record<string, FormInstance<any>>;
|
|
24
24
|
type ActionsType = 'set' | 'setProEnum' | 'setProEnumDic';
|
|
25
25
|
interface Actions {
|
|
26
26
|
type: ActionsType;
|
|
@@ -24,7 +24,7 @@ export function useProConfig(name) {
|
|
|
24
24
|
var config = useContext(ProConfigContext);
|
|
25
25
|
return name ? config.state[name] : config;
|
|
26
26
|
}
|
|
27
|
-
export function
|
|
27
|
+
export function useContextForms() {
|
|
28
28
|
var _config$state;
|
|
29
29
|
var config = useContext(ProConfigContext);
|
|
30
30
|
return (_config$state = config.state) === null || _config$state === void 0 ? void 0 : _config$state.forms;
|
|
@@ -40,9 +40,7 @@ var TextAreaDef = function TextAreaDef(props) {
|
|
|
40
40
|
showCount: true,
|
|
41
41
|
autoComplete: "off",
|
|
42
42
|
placeholder: placeholder || "".concat(locale.ProForm.inputPlaceholder).concat(label || ''),
|
|
43
|
-
autoSize:
|
|
44
|
-
minRows: 4
|
|
45
|
-
}
|
|
43
|
+
autoSize: true
|
|
46
44
|
}, omit(initialConfig, ['trim'])), rest), {}, {
|
|
47
45
|
className: _className
|
|
48
46
|
}));
|
|
@@ -51,6 +51,9 @@ var Group = function Group(props) {
|
|
|
51
51
|
'pro-group-diy-width': columns.some(function (item) {
|
|
52
52
|
var _item$fieldProps, _item$fieldProps$styl;
|
|
53
53
|
return item === null || item === void 0 ? void 0 : (_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 ? void 0 : (_item$fieldProps$styl = _item$fieldProps.style) === null || _item$fieldProps$styl === void 0 ? void 0 : _item$fieldProps$styl.width;
|
|
54
|
+
}),
|
|
55
|
+
'pro-group-width-auto': columns.some(function (item) {
|
|
56
|
+
return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
|
|
54
57
|
})
|
|
55
58
|
}, "".concat(className), className));
|
|
56
59
|
return _jsx("div", {
|
|
@@ -60,7 +63,9 @@ var Group = function Group(props) {
|
|
|
60
63
|
columns: data.columns,
|
|
61
64
|
form: form
|
|
62
65
|
}, omit(otherProps, ['colProps'])))
|
|
63
|
-
}) : _jsx(_Space, _objectSpread(_objectSpread({
|
|
66
|
+
}) : _jsx(_Space, _objectSpread(_objectSpread({
|
|
67
|
+
align: "start"
|
|
68
|
+
}, omit(space, ['separator', 'compact'])), {}, {
|
|
64
69
|
children: data.columns.map(function (column, index) {
|
|
65
70
|
return _jsx(RenderFields, _objectSpread({
|
|
66
71
|
columns: [column],
|
package/es/ProForm/index.js
CHANGED
|
@@ -20,7 +20,7 @@ import React, { forwardRef, useImperativeHandle, useMemo } from 'react';
|
|
|
20
20
|
import { isObject, isString, merge } from 'lodash';
|
|
21
21
|
import { FormFooter, InputRange, ProAddress, ProAddressBar, ProCertNo, ProCertValidity, ProCombination, ProModalSelect, ProNumberRange, ProRangeBox, ProTimeLimit, transferAddressInfoToRegion, ProUpload, ProTreeSelect, ProTreeModal, ProTree, EnumSelect } from './components';
|
|
22
22
|
import RenderFields from './components/render/RenderFields';
|
|
23
|
-
import { useProConfig,
|
|
23
|
+
import { useProConfig, useContextForms } from '../ProConfigProvider';
|
|
24
24
|
import { getLayout, splitNameStr, useControlled, initialValuesToNames } from './utils/index';
|
|
25
25
|
import { useForm } from './utils/useForm';
|
|
26
26
|
import { useFieldProps } from './utils/useFieldProps';
|
|
@@ -310,7 +310,7 @@ var ProFormProvider = function ProFormProvider(props) {
|
|
|
310
310
|
};
|
|
311
311
|
ProFormForward.Provider = ProFormProvider; // 包装Provider
|
|
312
312
|
ProFormForward.useFieldProps = useFieldProps; // 获取每个字段的其他参数 -otherProps
|
|
313
|
-
ProFormForward.
|
|
313
|
+
ProFormForward.useContextForms = useContextForms; // 获取 ProConfigProvider中的表单实例map
|
|
314
314
|
// 内置组合
|
|
315
315
|
ProFormForward.ProAddressBar = ProAddressBar;
|
|
316
316
|
ProFormForward.ProCombination = ProCombination;
|
|
@@ -46,7 +46,7 @@ var useRules = function useRules(props) {
|
|
|
46
46
|
internalRule.rules = internalRule.rules && rulesCreator(internalRule.rules, _label, isSelect);
|
|
47
47
|
useEffect(function () {
|
|
48
48
|
// 添加完整性校验
|
|
49
|
-
if (names && !isBoolean(labelRequired)
|
|
49
|
+
if (names && !isBoolean(labelRequired)) {
|
|
50
50
|
var customRequired = {
|
|
51
51
|
validator: function validator(rules, value) {
|
|
52
52
|
// 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
|
|
@@ -56,6 +56,9 @@ var useRules = function useRules(props) {
|
|
|
56
56
|
return Promise.resolve();
|
|
57
57
|
}
|
|
58
58
|
};
|
|
59
|
+
if (type === 'Group' && Array.isArray(names) && !required) {
|
|
60
|
+
customRequired = null;
|
|
61
|
+
}
|
|
59
62
|
internalRule.rules.push(customRequired);
|
|
60
63
|
}
|
|
61
64
|
}, [internalRule]);
|
|
@@ -20,7 +20,7 @@ interface ConfigContext {
|
|
|
20
20
|
export declare const ProConfigContext: React.Context<ConfigContext>;
|
|
21
21
|
export declare function useProConfig(): ConfigContext;
|
|
22
22
|
export declare function useProConfig(name: keyof ConfigContext['state']): ConfigContext['state'][keyof ConfigContext['state']];
|
|
23
|
-
export declare function
|
|
23
|
+
export declare function useContextForms(): Record<string, FormInstance<any>>;
|
|
24
24
|
type ActionsType = 'set' | 'setProEnum' | 'setProEnumDic';
|
|
25
25
|
interface Actions {
|
|
26
26
|
type: ActionsType;
|
|
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
8
|
exports.default = exports.ProConfigProvider = exports.ProConfigContext = void 0;
|
|
9
|
-
exports.
|
|
9
|
+
exports.useContextForms = useContextForms;
|
|
10
10
|
exports.useProConfig = useProConfig;
|
|
11
11
|
var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
|
|
12
12
|
var _objectSpread2 = _interopRequireDefault(require("@babel/runtime/helpers/objectSpread2"));
|
|
@@ -33,7 +33,7 @@ function useProConfig(name) {
|
|
|
33
33
|
var config = (0, _react.useContext)(ProConfigContext);
|
|
34
34
|
return name ? config.state[name] : config;
|
|
35
35
|
}
|
|
36
|
-
function
|
|
36
|
+
function useContextForms() {
|
|
37
37
|
var _config$state;
|
|
38
38
|
var config = (0, _react.useContext)(ProConfigContext);
|
|
39
39
|
return (_config$state = config.state) === null || _config$state === void 0 ? void 0 : _config$state.forms;
|
|
@@ -46,9 +46,7 @@ var TextAreaDef = function TextAreaDef(props) {
|
|
|
46
46
|
showCount: true,
|
|
47
47
|
autoComplete: "off",
|
|
48
48
|
placeholder: placeholder || "".concat(_locale.default.ProForm.inputPlaceholder).concat(label || ''),
|
|
49
|
-
autoSize:
|
|
50
|
-
minRows: 4
|
|
51
|
-
}
|
|
49
|
+
autoSize: true
|
|
52
50
|
}, (0, _lodash.omit)(initialConfig, ['trim'])), rest), {}, {
|
|
53
51
|
className: _className
|
|
54
52
|
}));
|
|
@@ -55,6 +55,9 @@ var Group = function Group(props) {
|
|
|
55
55
|
'pro-group-diy-width': columns.some(function (item) {
|
|
56
56
|
var _item$fieldProps, _item$fieldProps$styl;
|
|
57
57
|
return item === null || item === void 0 ? void 0 : (_item$fieldProps = item.fieldProps) === null || _item$fieldProps === void 0 ? void 0 : (_item$fieldProps$styl = _item$fieldProps.style) === null || _item$fieldProps$styl === void 0 ? void 0 : _item$fieldProps$styl.width;
|
|
58
|
+
}),
|
|
59
|
+
'pro-group-width-auto': columns.some(function (item) {
|
|
60
|
+
return ['Radio', 'Checkbox', 'Switch'].includes(item.type);
|
|
58
61
|
})
|
|
59
62
|
}, "".concat(className), className));
|
|
60
63
|
return (0, _jsxRuntime.jsx)("div", {
|
|
@@ -64,7 +67,9 @@ var Group = function Group(props) {
|
|
|
64
67
|
columns: data.columns,
|
|
65
68
|
form: form
|
|
66
69
|
}, (0, _lodash.omit)(otherProps, ['colProps'])))
|
|
67
|
-
}) : (0, _jsxRuntime.jsx)(_antd.Space, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
70
|
+
}) : (0, _jsxRuntime.jsx)(_antd.Space, (0, _objectSpread2.default)((0, _objectSpread2.default)({
|
|
71
|
+
align: "start"
|
|
72
|
+
}, (0, _lodash.omit)(space, ['separator', 'compact'])), {}, {
|
|
68
73
|
children: data.columns.map(function (column, index) {
|
|
69
74
|
return (0, _jsxRuntime.jsx)(_RenderFields.default, (0, _objectSpread2.default)({
|
|
70
75
|
columns: [column],
|
package/lib/ProForm/index.js
CHANGED
|
@@ -311,7 +311,7 @@ var ProFormProvider = function ProFormProvider(props) {
|
|
|
311
311
|
};
|
|
312
312
|
ProFormForward.Provider = ProFormProvider; // 包装Provider
|
|
313
313
|
ProFormForward.useFieldProps = _useFieldProps.useFieldProps; // 获取每个字段的其他参数 -otherProps
|
|
314
|
-
ProFormForward.
|
|
314
|
+
ProFormForward.useContextForms = _ProConfigProvider.useContextForms; // 获取 ProConfigProvider中的表单实例map
|
|
315
315
|
// 内置组合
|
|
316
316
|
ProFormForward.ProAddressBar = _components.ProAddressBar;
|
|
317
317
|
ProFormForward.ProCombination = _components.ProCombination;
|
|
@@ -53,7 +53,7 @@ var useRules = function useRules(props) {
|
|
|
53
53
|
internalRule.rules = internalRule.rules && (0, _rulesCreator.rulesCreator)(internalRule.rules, _label, isSelect);
|
|
54
54
|
(0, _react.useEffect)(function () {
|
|
55
55
|
// 添加完整性校验
|
|
56
|
-
if (names && !(0, _lodash.isBoolean)(labelRequired)
|
|
56
|
+
if (names && !(0, _lodash.isBoolean)(labelRequired)) {
|
|
57
57
|
var customRequired = {
|
|
58
58
|
validator: function validator(rules, value) {
|
|
59
59
|
// 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
|
|
@@ -63,6 +63,9 @@ var useRules = function useRules(props) {
|
|
|
63
63
|
return Promise.resolve();
|
|
64
64
|
}
|
|
65
65
|
};
|
|
66
|
+
if (type === 'Group' && Array.isArray(names) && !required) {
|
|
67
|
+
customRequired = null;
|
|
68
|
+
}
|
|
66
69
|
internalRule.rules.push(customRequired);
|
|
67
70
|
}
|
|
68
71
|
}, [internalRule]);
|