@zat-design/sisyphus-react 3.1.5 → 3.2.0-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/dist/index.esm.css +176 -251
- package/es/ProAction/index.js +7 -5
- package/es/ProAction/index.less +3 -2
- package/es/ProConfigProvider/index.d.ts +2 -0
- package/es/ProConfigProvider/index.js +23 -2
- package/es/ProDownload/utils.js +6 -3
- package/es/ProDrawerForm/components/ProDrawer/index.js +6 -4
- package/es/ProDrawerForm/index.js +5 -3
- package/es/ProDrawerForm/style/index.less +15 -11
- package/es/ProEditLabel/style/index.less +2 -2
- package/es/ProEditTable/components/ActionButton/index.js +3 -2
- package/es/ProEditTable/components/RenderField/index.js +2 -1
- package/es/ProEditTable/index.js +7 -6
- package/es/ProEditTable/style/index.less +15 -8
- package/es/ProEditTable/utils/config.d.ts +8 -8
- package/es/ProEditTable/utils/config.js +20 -12
- package/es/ProEditTable/utils/index.js +3 -2
- package/es/ProEnum/hooks/useEnumRequest.js +17 -10
- package/es/ProEnum/index.js +9 -4
- package/es/ProEnum/style/index.less +1 -1
- package/es/ProForm/components/FormFooter/index.js +16 -20
- package/es/ProForm/components/base/Input/index.js +4 -3
- package/es/ProForm/components/base/InputNumber/index.js +4 -3
- package/es/ProForm/components/base/RangePicker/index.js +0 -3
- package/es/ProForm/components/base/Select/index.js +2 -1
- package/es/ProForm/components/base/Switch/index.js +9 -5
- package/es/ProForm/components/base/SwitchCheckbox/index.js +2 -1
- package/es/ProForm/components/base/TextArea/index.js +4 -2
- package/es/ProForm/components/base/TextArea/index.less +1 -1
- package/es/ProForm/components/combination/Container/style/index.less +0 -1
- package/es/ProForm/components/combination/FormList/components/ActionButton.js +13 -17
- package/es/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -1
- package/es/ProForm/components/combination/FormList/style/index.less +20 -19
- package/es/ProForm/components/combination/Group/index.js +2 -2
- package/es/ProForm/components/combination/ProAddressBar/index.js +83 -63
- package/es/ProForm/components/combination/ProAddressBar/propsType.d.ts +3 -2
- package/es/ProForm/components/combination/ProModalSelect/index.js +76 -15
- package/es/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
- package/es/ProForm/components/combination/ProModalSelect/style/index.less +3 -3
- package/es/ProForm/components/combination/ProNumberRange/index.js +3 -2
- package/es/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -1
- package/es/ProForm/components/combination/ProRangeLimit/index.js +3 -7
- package/es/ProForm/components/combination/ProTimeLimit/index.d.ts +10 -5
- package/es/ProForm/components/combination/ProTimeLimit/index.js +4 -11
- package/es/ProForm/components/combination/ProTimeLimit/style/index.less +18 -1
- package/es/ProForm/components/old/EnumSelect/style/index.less +7 -8
- package/es/ProForm/components/render/Render.js +4 -2
- package/es/ProForm/components/render/RenderFields.js +10 -6
- package/es/ProForm/components/render/propsType.d.ts +5 -4
- package/es/ProForm/index.js +14 -2
- package/es/ProForm/style/index.less +77 -169
- package/es/ProForm/utils/index.d.ts +1 -1
- package/es/ProForm/utils/index.js +7 -2
- package/es/ProForm/utils/rulesCreator.js +2 -1
- package/es/ProForm/utils/useRules.js +4 -3
- package/es/ProForm/utils/useShouldUpdate.js +16 -16
- package/es/ProLayout/components/Layout/Menu/OpenMenu/index.js +6 -0
- package/es/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +7 -8
- package/es/ProLayout/components/Layout/Notice/index.js +3 -2
- package/es/ProLayout/components/ProCollapse/style/index.less +4 -4
- package/es/ProLayout/components/ProHeader/components/Copy/index.js +2 -1
- package/es/{old → ProLayout/components/ProHeader/components}/ProBackBtn/index.js +2 -1
- package/es/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +21 -0
- package/es/ProLayout/components/ProHeader/components/index.d.ts +1 -0
- package/es/ProLayout/components/ProHeader/components/index.js +2 -1
- package/es/ProLayout/components/ProHeader/index.js +9 -6
- package/es/ProLayout/components/ProHeader/style/index.less +16 -7
- package/es/ProLayout/utils/index.js +1 -1
- package/es/ProSelect/index.d.ts +3 -3
- package/es/ProSelect/index.js +4 -2
- package/es/ProStep/components/Step/index.js +3 -1
- package/es/ProStep/style/index.less +0 -1
- package/es/ProTable/components/RenderColumn/index.d.ts +5 -5
- package/es/ProTable/components/RenderColumn/index.js +41 -25
- package/es/ProTable/index.js +10 -8
- package/es/ProTable/propsType.d.ts +2 -0
- package/es/ProTable/style/index.less +14 -1
- package/es/ProTable/useAntdTable.d.ts +12 -4
- package/es/ProTable/useAntdTable.js +18 -6
- package/es/ProTable/utils.d.ts +1 -1
- package/es/ProTable/utils.js +258 -201
- package/es/ProTabs/style/index.less +1 -1
- package/es/ProThemeTools/component/PrdTools/index.js +1 -1
- package/es/ProThemeTools/component/PrdTools/style/index.less +3 -3
- package/es/ProThemeTools/index.d.ts +2 -2
- package/es/ProThemeTools/index.js +24 -17
- package/es/ProThemeTools/propsType.d.ts +8 -6
- package/es/ProThemeTools/style/index.less +2 -2
- package/es/ProThemeTools/utils/index.d.ts +7 -0
- package/es/ProThemeTools/utils/index.js +19 -1
- package/es/ProTree/components/ProTree.js +6 -5
- package/es/ProTree/components/SearchTitle.d.ts +2 -2
- package/es/ProTree/components/SearchTitle.js +11 -1
- package/es/ProTree/components/Tree.js +9 -2
- package/es/ProTree/style/index.less +193 -141
- package/es/ProTreeModal/components/List.js +0 -14
- package/es/ProTreeModal/components/Trigger.js +9 -3
- package/es/ProTreeModal/index.js +29 -13
- package/es/ProTreeModal/style/index.less +2 -6
- package/es/ProUpload/components/ButtonRender.js +5 -2
- package/es/ProUpload/components/DragRender.js +8 -8
- package/es/ProUpload/components/Example.js +3 -1
- package/es/ProUpload/components/ImageRender.js +8 -6
- package/es/ProUpload/index.js +8 -6
- package/es/ProUpload/style/index.less +41 -39
- package/es/index.d.ts +2 -1
- package/es/index.js +2 -1
- package/es/locale/en_US.d.ts +138 -0
- package/es/locale/en_US.js +137 -0
- package/es/locale/index.d.ts +13 -0
- package/es/locale/index.js +32 -0
- package/es/locale/zh_CN.d.ts +137 -0
- package/es/locale/zh_CN.js +136 -0
- package/es/old/ProEditableTable/style/index.less +1 -2
- package/es/style/components.less +0 -1
- package/es/style/core/normalize.less +1 -2
- package/es/style/theme/antd.less +3 -4
- package/es/style/theme/index.less +80 -79
- package/es/style/theme/tokens.less +1 -0
- package/lib/ProAction/index.js +7 -5
- package/lib/ProAction/index.less +3 -2
- package/lib/ProConfigProvider/index.d.ts +2 -0
- package/lib/ProConfigProvider/index.js +22 -2
- package/lib/ProDownload/utils.js +4 -3
- package/lib/ProDrawerForm/components/ProDrawer/index.js +6 -4
- package/lib/ProDrawerForm/index.js +5 -3
- package/lib/ProDrawerForm/style/index.less +15 -11
- package/lib/ProEditLabel/style/index.less +2 -2
- package/lib/ProEditTable/components/ActionButton/index.js +3 -2
- package/lib/ProEditTable/components/RenderField/index.js +4 -1
- package/lib/ProEditTable/index.js +7 -6
- package/lib/ProEditTable/style/index.less +15 -8
- package/lib/ProEditTable/utils/config.d.ts +8 -8
- package/lib/ProEditTable/utils/config.js +20 -12
- package/lib/ProEditTable/utils/index.js +3 -2
- package/lib/ProEnum/hooks/useEnumRequest.js +17 -10
- package/lib/ProEnum/index.js +9 -4
- package/lib/ProEnum/style/index.less +1 -1
- package/lib/ProForm/components/FormFooter/index.js +16 -19
- package/lib/ProForm/components/base/Input/index.js +4 -3
- package/lib/ProForm/components/base/InputNumber/index.js +4 -3
- package/lib/ProForm/components/base/RangePicker/index.js +1 -4
- package/lib/ProForm/components/base/Select/index.js +2 -1
- package/lib/ProForm/components/base/Switch/index.js +8 -5
- package/lib/ProForm/components/base/SwitchCheckbox/index.js +2 -1
- package/lib/ProForm/components/base/TextArea/index.js +4 -2
- package/lib/ProForm/components/base/TextArea/index.less +1 -1
- package/lib/ProForm/components/combination/Container/style/index.less +0 -1
- package/lib/ProForm/components/combination/FormList/components/ActionButton.js +13 -17
- package/lib/ProForm/components/combination/FormList/components/ToolbarButton.js +2 -1
- package/lib/ProForm/components/combination/FormList/style/index.less +20 -19
- package/lib/ProForm/components/combination/Group/index.js +2 -2
- package/lib/ProForm/components/combination/ProAddressBar/index.js +78 -60
- package/lib/ProForm/components/combination/ProAddressBar/propsType.d.ts +3 -2
- package/lib/ProForm/components/combination/ProModalSelect/index.js +76 -15
- package/lib/ProForm/components/combination/ProModalSelect/propsType.d.ts +1 -0
- package/lib/ProForm/components/combination/ProModalSelect/style/index.less +3 -3
- package/lib/ProForm/components/combination/ProNumberRange/index.js +3 -2
- package/lib/ProForm/components/combination/ProNumberRange/style/index.less +1 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.d.ts +1 -1
- package/lib/ProForm/components/combination/ProRangeLimit/index.js +3 -7
- package/lib/ProForm/components/combination/ProTimeLimit/index.d.ts +10 -5
- package/lib/ProForm/components/combination/ProTimeLimit/index.js +4 -11
- package/lib/ProForm/components/combination/ProTimeLimit/style/index.less +18 -1
- package/lib/ProForm/components/old/EnumSelect/style/index.less +7 -8
- package/lib/ProForm/components/old/InputRange/index.js +0 -1
- package/lib/ProForm/components/old/ProCertValidity/index.js +1 -1
- package/lib/ProForm/components/render/Render.js +5 -2
- package/lib/ProForm/components/render/RenderFields.js +9 -5
- package/lib/ProForm/components/render/propsType.d.ts +5 -4
- package/lib/ProForm/index.js +14 -2
- package/lib/ProForm/style/index.less +77 -169
- package/lib/ProForm/utils/index.d.ts +1 -1
- package/lib/ProForm/utils/index.js +7 -2
- package/lib/ProForm/utils/rulesCreator.js +2 -1
- package/lib/ProForm/utils/useRules.js +4 -3
- package/lib/ProForm/utils/useShouldUpdate.js +16 -16
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/index.js +6 -0
- package/lib/ProLayout/components/Layout/Menu/OpenMenu/style/index.less +7 -8
- package/lib/ProLayout/components/Layout/Notice/index.js +3 -2
- package/lib/ProLayout/components/ProCollapse/style/index.less +4 -4
- package/lib/ProLayout/components/ProHeader/components/Copy/index.js +2 -1
- package/lib/{old → ProLayout/components/ProHeader/components}/ProBackBtn/index.js +3 -1
- package/lib/ProLayout/components/ProHeader/components/ProBackBtn/style/index.less +21 -0
- package/lib/ProLayout/components/ProHeader/components/index.d.ts +1 -0
- package/lib/ProLayout/components/ProHeader/components/index.js +8 -1
- package/lib/ProLayout/components/ProHeader/index.js +9 -6
- package/lib/ProLayout/components/ProHeader/style/index.less +16 -7
- package/lib/ProLayout/utils/index.js +1 -1
- package/lib/ProSelect/index.d.ts +3 -3
- package/lib/ProSelect/index.js +4 -2
- package/lib/ProStep/components/Step/index.js +3 -1
- package/lib/ProStep/style/index.less +0 -1
- package/lib/ProTable/components/RenderColumn/index.d.ts +5 -5
- package/lib/ProTable/components/RenderColumn/index.js +38 -24
- package/lib/ProTable/components/TableResizable/index.js +8 -0
- package/lib/ProTable/index.js +10 -8
- package/lib/ProTable/propsType.d.ts +2 -0
- package/lib/ProTable/style/index.less +14 -1
- package/lib/ProTable/useAntdTable.d.ts +12 -4
- package/lib/ProTable/useAntdTable.js +19 -6
- package/lib/ProTable/utils.d.ts +1 -1
- package/lib/ProTable/utils.js +258 -201
- package/lib/ProTabs/index.js +1 -0
- package/lib/ProTabs/style/index.less +1 -1
- package/lib/ProThemeTools/component/PrdTools/index.js +1 -1
- package/lib/ProThemeTools/component/PrdTools/style/index.less +3 -3
- package/lib/ProThemeTools/index.d.ts +2 -2
- package/lib/ProThemeTools/index.js +24 -16
- package/lib/ProThemeTools/propsType.d.ts +8 -6
- package/lib/ProThemeTools/style/index.less +2 -2
- package/lib/ProThemeTools/utils/index.d.ts +7 -0
- package/lib/ProThemeTools/utils/index.js +20 -2
- package/lib/ProTree/components/ProTree.js +6 -5
- package/lib/ProTree/components/SearchTitle.d.ts +2 -2
- package/lib/ProTree/components/SearchTitle.js +11 -1
- package/lib/ProTree/components/Tree.js +16 -2
- package/lib/ProTree/index.js +0 -1
- package/lib/ProTree/style/index.less +193 -141
- package/lib/ProTreeModal/components/List.js +0 -14
- package/lib/ProTreeModal/components/Tree.js +1 -0
- package/lib/ProTreeModal/components/Trigger.js +10 -3
- package/lib/ProTreeModal/index.js +29 -13
- package/lib/ProTreeModal/style/index.less +2 -6
- package/lib/ProUpload/components/ButtonRender.js +5 -2
- package/lib/ProUpload/components/DragRender.js +8 -8
- package/lib/ProUpload/components/Example.js +3 -1
- package/lib/ProUpload/components/ImageRender.js +8 -6
- package/lib/ProUpload/index.js +14 -5
- package/lib/ProUpload/style/index.less +41 -39
- package/lib/index.d.ts +2 -1
- package/lib/index.js +13 -1
- package/lib/locale/en_US.d.ts +138 -0
- package/lib/locale/en_US.js +143 -0
- package/lib/locale/index.d.ts +13 -0
- package/lib/locale/index.js +41 -0
- package/lib/locale/zh_CN.d.ts +137 -0
- package/lib/locale/zh_CN.js +142 -0
- package/lib/old/ProCertValidity/index.js +1 -1
- package/lib/old/ProEditableTable/style/index.less +1 -2
- package/lib/style/components.less +0 -1
- package/lib/style/core/normalize.less +1 -2
- package/lib/style/theme/antd.less +3 -4
- package/lib/style/theme/index.less +80 -79
- package/lib/style/theme/tokens.less +1 -0
- package/package.json +1 -1
- package/typings.d.ts +2 -0
- package/es/old/ProBackBtn/style/index.less +0 -19
- package/lib/old/ProBackBtn/style/index.less +0 -19
- /package/es/{old → ProLayout/components/ProHeader/components}/ProBackBtn/index.d.ts +0 -0
- /package/es/{old → ProLayout/components/ProHeader/components}/ProBackBtn/propsType.d.ts +0 -0
- /package/es/{old → ProLayout/components/ProHeader/components}/ProBackBtn/propsType.js +0 -0
- /package/lib/{old → ProLayout/components/ProHeader/components}/ProBackBtn/index.d.ts +0 -0
- /package/lib/{old → ProLayout/components/ProHeader/components}/ProBackBtn/propsType.d.ts +0 -0
- /package/lib/{old → ProLayout/components/ProHeader/components}/ProBackBtn/propsType.js +0 -0
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
.pro-enum-select {
|
|
2
2
|
.close-icon {
|
|
3
3
|
position : relative;
|
|
4
|
-
margin-left : -
|
|
4
|
+
margin-left : calc(0px - @zaui-space-size-lg);
|
|
5
5
|
margin-right : var(--zaui-space-size-md, 14px);
|
|
6
6
|
color : #FFFFFF;
|
|
7
7
|
height: 12px;
|
|
@@ -16,7 +16,6 @@
|
|
|
16
16
|
|
|
17
17
|
> span {
|
|
18
18
|
position : relative;
|
|
19
|
-
font-size : 8px;
|
|
20
19
|
border : none;
|
|
21
20
|
border-radius : 50%;
|
|
22
21
|
|
|
@@ -45,7 +44,7 @@
|
|
|
45
44
|
.ant-table-thead>tr>th {
|
|
46
45
|
border : 0;
|
|
47
46
|
white-space : nowrap;
|
|
48
|
-
background-color:
|
|
47
|
+
background-color: @zaui-table-header-bg;
|
|
49
48
|
}
|
|
50
49
|
|
|
51
50
|
.ant-table-thead>tr>th:not(:last-child):not(.ant-table-selection-column):not(.ant-table-row-expand-icon-cell):not([colspan])::before {
|
|
@@ -69,7 +68,7 @@
|
|
|
69
68
|
}
|
|
70
69
|
|
|
71
70
|
.ant-table-tbody tr:nth-child(2n)>td {
|
|
72
|
-
background-color:
|
|
71
|
+
background-color: @zaui-table-strip-bg;
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
.ant-table-tbody>.ant-table-placeholder>td {
|
|
@@ -81,7 +80,7 @@
|
|
|
81
80
|
>tr:hover:not(.ant-table-expanded-row, .ant-table-placeholder)>td,
|
|
82
81
|
.ant-table-row-hover,
|
|
83
82
|
.ant-table-row-hover>td {
|
|
84
|
-
background:
|
|
83
|
+
background: @zaui-table-hover-bg;
|
|
85
84
|
}
|
|
86
85
|
}
|
|
87
86
|
|
|
@@ -89,13 +88,13 @@
|
|
|
89
88
|
|
|
90
89
|
.ant-table-row-hover,
|
|
91
90
|
.ant-table-row-hover>td {
|
|
92
|
-
background:
|
|
91
|
+
background: @zaui-table-hover-bg;
|
|
93
92
|
}
|
|
94
93
|
}
|
|
95
94
|
|
|
96
95
|
.ant-table-fixed-header {
|
|
97
96
|
.ant-table-tbody tr:nth-child(n)>td {
|
|
98
|
-
background-color:
|
|
97
|
+
background-color: @zaui-table-strip-bg;
|
|
99
98
|
}
|
|
100
99
|
|
|
101
100
|
.ant-table-tbody tr:nth-child(2n)>td {
|
|
@@ -108,7 +107,7 @@
|
|
|
108
107
|
}
|
|
109
108
|
|
|
110
109
|
.ant-modal-footer {
|
|
111
|
-
padding:
|
|
110
|
+
padding: @zaui-space-size-md;
|
|
112
111
|
}
|
|
113
112
|
|
|
114
113
|
}
|
|
@@ -22,6 +22,7 @@ import { ReactSVG } from 'react-svg';
|
|
|
22
22
|
import { isFunction, isString, omit } from 'lodash';
|
|
23
23
|
import useShouldUpdate from '../../utils/useShouldUpdate';
|
|
24
24
|
import { isTrim, isUpperCase, findOptionByValue } from '../../utils/index';
|
|
25
|
+
import { useProConfig } from '../../../ProConfigProvider';
|
|
25
26
|
import transformNames from '../../utils/transformNames';
|
|
26
27
|
import valueTypeMap from '../../utils/valueType';
|
|
27
28
|
import { useChanged } from '../../utils/useChanged';
|
|
@@ -138,7 +139,8 @@ var Render = function Render(props) {
|
|
|
138
139
|
required: labelRequired || _required
|
|
139
140
|
} : null, otherProps.isView && !requiredOnView ? {
|
|
140
141
|
required: false
|
|
141
|
-
} : null, _objectSpread({}, isTrim(type, trim
|
|
142
|
+
} : null, _objectSpread({}, isTrim(type, trim, useProConfig())), // 优先取传进来的,其次取ProConfigProvider配置的
|
|
143
|
+
_objectSpread({}, isUpperCase(type, upperCase)), {
|
|
142
144
|
validateFirst: true
|
|
143
145
|
});
|
|
144
146
|
// 添加label宽度
|
|
@@ -157,7 +159,7 @@ var Render = function Render(props) {
|
|
|
157
159
|
var lastComponentProps = _objectSpread(_objectSpread(_objectSpread({}, componentProps), _fieldProps), {}, {
|
|
158
160
|
disabled: lastDisabled
|
|
159
161
|
});
|
|
160
|
-
var _className = classNames((_classNames = {}, _defineProperty(_classNames, className, className), _defineProperty(_classNames, 'pro-form-item-changed', changed), _classNames));
|
|
162
|
+
var _className = classNames((_classNames = {}, _defineProperty(_classNames, className, className), _defineProperty(_classNames, 'pro-form-item-changed', changed), _defineProperty(_classNames, 'pro-form-item-width-auto', ['Switch'].includes(type)), _classNames));
|
|
161
163
|
if (formItemProps.hidden === true || _show === false) {
|
|
162
164
|
// 为了监听shouldUpdate 必须存在一个FormItem, 空Input解决 【[antd: Form.Item] `name` is only used for validate React element】
|
|
163
165
|
return _jsx(_Form.Item, {
|
|
@@ -3,11 +3,12 @@ import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutPr
|
|
|
3
3
|
var _excluded = ["show", "type", "viewRender", "viewType", "valueType", "formItemProps", "colProps", "formItemChildProps", "fieldProps", "disabled", "equalWith", "clearNotShow", "required"];
|
|
4
4
|
import { jsx as _jsx, Fragment as _Fragment } from "react/jsx-runtime";
|
|
5
5
|
import React from 'react';
|
|
6
|
-
import { isFunction, union } from 'lodash';
|
|
6
|
+
import { isBoolean, isFunction, union } from 'lodash';
|
|
7
7
|
import Render from './Render';
|
|
8
8
|
import * as componentMap from '../index';
|
|
9
9
|
import { isSelect } from '../../utils';
|
|
10
10
|
import { FieldProvider } from '../../utils/useFieldProps';
|
|
11
|
+
import locale from '../../../locale';
|
|
11
12
|
var RenderFields = function RenderFields(props) {
|
|
12
13
|
var isView = props.isView,
|
|
13
14
|
_props$columns = props.columns,
|
|
@@ -108,6 +109,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
108
109
|
}
|
|
109
110
|
if (component && /*#__PURE__*/React.isValidElement(component)) {
|
|
110
111
|
var _newComponent$props;
|
|
112
|
+
_type = null;
|
|
111
113
|
var newComponent = component;
|
|
112
114
|
var isProEditTable = (newComponent === null || newComponent === void 0 ? void 0 : (_newComponent$props = newComponent.props) === null || _newComponent$props === void 0 ? void 0 : _newComponent$props.onlyOneLineMsg) === '请先保存数据';
|
|
113
115
|
TargetComponent = _isView ? viewRenderHandle || '' : component;
|
|
@@ -127,16 +129,14 @@ var RenderFields = function RenderFields(props) {
|
|
|
127
129
|
dataSource: dataSource,
|
|
128
130
|
type: _type
|
|
129
131
|
});
|
|
130
|
-
var _placeholder = placeholder || "".concat(_isSelect ?
|
|
132
|
+
var _placeholder = placeholder || "".concat(_isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(label || formLabel || '');
|
|
131
133
|
// 表单组件Props 兼容2.0版本
|
|
132
134
|
var _fieldProps = _objectSpread(_objectSpread({
|
|
133
135
|
disabled: disabled
|
|
134
136
|
}, formItemChildProps), fieldProps);
|
|
135
|
-
if (formDisabled) {
|
|
137
|
+
if (isBoolean(formDisabled)) {
|
|
136
138
|
_fieldProps.disabled = formDisabled;
|
|
137
|
-
// _disabled = formDisabled;
|
|
138
139
|
}
|
|
139
|
-
|
|
140
140
|
var componentProps = _objectSpread({
|
|
141
141
|
disabled: _disabled,
|
|
142
142
|
placeholder: _placeholder,
|
|
@@ -146,6 +146,10 @@ var RenderFields = function RenderFields(props) {
|
|
|
146
146
|
if (['Switch', 'SwitchCheckbox'].includes(_type)) {
|
|
147
147
|
_formItemProps.valuePropName = 'checked';
|
|
148
148
|
}
|
|
149
|
+
// 时间范围placeholder处理
|
|
150
|
+
if (['RangePicker'].includes(_type) && !(fieldProps === null || fieldProps === void 0 ? void 0 : fieldProps.placeholder)) {
|
|
151
|
+
delete componentProps.placeholder;
|
|
152
|
+
}
|
|
149
153
|
// 没有找到对应组件 不渲染
|
|
150
154
|
if (!TargetComponent) {
|
|
151
155
|
return [];
|
|
@@ -176,7 +180,7 @@ var RenderFields = function RenderFields(props) {
|
|
|
176
180
|
value: otherProps,
|
|
177
181
|
children: _jsx(Render, {
|
|
178
182
|
show: show,
|
|
179
|
-
disabled: formDisabled,
|
|
183
|
+
disabled: Boolean(formDisabled),
|
|
180
184
|
form: form,
|
|
181
185
|
type: _type,
|
|
182
186
|
originComponent: component,
|
|
@@ -21,7 +21,8 @@ import { AddressProps } from '../combination/ProAddressBar/propsType';
|
|
|
21
21
|
import { ProCombinationProps } from '../combination/ProCombination/propsType';
|
|
22
22
|
import { ProModalSelectPropsType as ProModalSelectProps } from '../combination/ProModalSelect/propsType';
|
|
23
23
|
import { ProNumberRangeProps } from '../combination/ProNumberRange/propsType';
|
|
24
|
-
import {
|
|
24
|
+
import { ProLimitProps } from '../combination/ProTimeLimit';
|
|
25
|
+
import { Props as ProRangeLimitProps } from '../combination/ProRangeLimit';
|
|
25
26
|
import { CheckboxPropsMap, ProEnum, PropProSelectsMap, PropRadioPropsMap } from '../../../ProEnum/propsType';
|
|
26
27
|
import { PropSelectProps as ProSelectProps } from '../../../ProSelect/propsType';
|
|
27
28
|
import { ProEditTableProps } from '../../../ProEditTable/propsType';
|
|
@@ -57,7 +58,7 @@ type FunctionArgs<Values> = (value: any, record: any, { form, index, namePath, o
|
|
|
57
58
|
namePath?: NamePath;
|
|
58
59
|
[key: string]: any;
|
|
59
60
|
}) => any;
|
|
60
|
-
type TransformToFormField<T extends ControlProps, Values> =
|
|
61
|
+
type TransformToFormField<T extends ControlProps, Values> = DistributiveOmit<T, 'onChange' | 'value'> & {
|
|
61
62
|
value?: T['value'];
|
|
62
63
|
onChange?: (value: Parameters<T['onChange']>[0], options: Parameters<T['onChange']>[1], form: FormInstance<Values>) => void;
|
|
63
64
|
onFieldChange?: FunctionArgs<Values>;
|
|
@@ -135,10 +136,10 @@ export type ColumnPropsMap<Values = any, T = 'ProForm'> = {
|
|
|
135
136
|
fieldProps?: FieldProps<ProNumberRangeProps, Values, T>;
|
|
136
137
|
} | {
|
|
137
138
|
type?: 'ProRangeLimit';
|
|
138
|
-
fieldProps?: FieldProps<
|
|
139
|
+
fieldProps?: FieldProps<ProRangeLimitProps, Values, T>;
|
|
139
140
|
} | {
|
|
140
141
|
type?: 'ProTimeLimit';
|
|
141
|
-
fieldProps?: FieldProps<
|
|
142
|
+
fieldProps?: FieldProps<ProLimitProps, Values, T>;
|
|
142
143
|
} | {
|
|
143
144
|
type?: 'ProEnum';
|
|
144
145
|
fieldProps?: ProEnumFieldProps<Values, T>;
|
package/es/ProForm/index.js
CHANGED
|
@@ -24,7 +24,9 @@ import { useProConfig } 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';
|
|
27
|
+
import locale from '../locale';
|
|
27
28
|
var ProForm = function ProForm(props, ref) {
|
|
29
|
+
var _localStorage;
|
|
28
30
|
var _props$mode = props.mode,
|
|
29
31
|
mode = _props$mode === void 0 ? 'search' : _props$mode,
|
|
30
32
|
span = props.span,
|
|
@@ -98,12 +100,12 @@ var ProForm = function ProForm(props, ref) {
|
|
|
98
100
|
onClick: expandHandle,
|
|
99
101
|
children: !openState ? _jsxs(_Space, {
|
|
100
102
|
align: "center",
|
|
101
|
-
children: [
|
|
103
|
+
children: [locale.ProForm.unfold, _jsx(DoubleLeftOutlined, {
|
|
102
104
|
className: "rotate-to-bottom"
|
|
103
105
|
})]
|
|
104
106
|
}) : _jsxs(_Space, {
|
|
105
107
|
align: "center",
|
|
106
|
-
children: [
|
|
108
|
+
children: [locale.ProForm.packUp, _jsx(DoubleLeftOutlined, {
|
|
107
109
|
className: "rotate-to-top"
|
|
108
110
|
})]
|
|
109
111
|
})
|
|
@@ -179,6 +181,16 @@ var ProForm = function ProForm(props, ref) {
|
|
|
179
181
|
})
|
|
180
182
|
})) : null;
|
|
181
183
|
};
|
|
184
|
+
// 国际化,非中文时默认上下布局
|
|
185
|
+
if (((_localStorage = localStorage) === null || _localStorage === void 0 ? void 0 : _localStorage.locale) && localStorage.locale !== 'zh-CN') {
|
|
186
|
+
// 一行布局时,左右布局
|
|
187
|
+
if (span === 24) {
|
|
188
|
+
otherProps.layout = otherProps.layout || 'horizontal';
|
|
189
|
+
} else {
|
|
190
|
+
// 其他布局时,上下布局
|
|
191
|
+
otherProps.layout = otherProps.layout || 'vertical';
|
|
192
|
+
}
|
|
193
|
+
}
|
|
182
194
|
return _jsx(_Form, _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
183
195
|
onKeyPress: function onKeyPress(event) {
|
|
184
196
|
if (!submitOnEnter) return;
|
|
@@ -11,6 +11,28 @@
|
|
|
11
11
|
@import '../components/old/EnumSelect/style/index.less';
|
|
12
12
|
|
|
13
13
|
.pro-form {
|
|
14
|
+
&.ant-form-vertical {
|
|
15
|
+
.ant-form-item .ant-form-item-label {
|
|
16
|
+
flex: none !important;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
.pro-form-custom-footer {
|
|
20
|
+
display : flex;
|
|
21
|
+
align-items : center;
|
|
22
|
+
margin-bottom: 0;
|
|
23
|
+
height : auto;
|
|
24
|
+
padding-top : 6px;
|
|
25
|
+
|
|
26
|
+
.ant-space-align-center {
|
|
27
|
+
align-items: normal;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
&.ant-form {
|
|
33
|
+
margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1));
|
|
34
|
+
}
|
|
35
|
+
|
|
14
36
|
.pro-collapse-level2 {
|
|
15
37
|
.ant-collapse-item {
|
|
16
38
|
margin-bottom: 0 !important;
|
|
@@ -23,17 +45,17 @@
|
|
|
23
45
|
}
|
|
24
46
|
|
|
25
47
|
span.ant-input-clear-icon {
|
|
26
|
-
display: unset;
|
|
48
|
+
display : unset;
|
|
27
49
|
visibility: hidden;
|
|
28
50
|
}
|
|
29
51
|
|
|
30
52
|
.ant-input-affix-wrapper:hover span.ant-input-clear-icon {
|
|
31
|
-
display: unset;
|
|
53
|
+
display : unset;
|
|
32
54
|
visibility: unset;
|
|
33
55
|
}
|
|
34
56
|
|
|
35
57
|
.ant-input-affix-wrapper:hover span.ant-input-clear-icon[class~='ant-input-clear-icon-hidden'] {
|
|
36
|
-
display: unset;
|
|
58
|
+
display : unset;
|
|
37
59
|
visibility: hidden;
|
|
38
60
|
}
|
|
39
61
|
|
|
@@ -67,8 +89,8 @@
|
|
|
67
89
|
|
|
68
90
|
// 展开折叠按钮
|
|
69
91
|
.expand-button {
|
|
70
|
-
line-height:
|
|
71
|
-
cursor: pointer;
|
|
92
|
+
line-height: @zaui-space-card;
|
|
93
|
+
cursor : pointer;
|
|
72
94
|
|
|
73
95
|
.rotate-to-top {
|
|
74
96
|
transform: rotate(90deg);
|
|
@@ -80,40 +102,39 @@
|
|
|
80
102
|
}
|
|
81
103
|
|
|
82
104
|
.ant-form-item {
|
|
83
|
-
margin-bottom:
|
|
105
|
+
margin-bottom: calc(var(--zaui-space-size-md; 16px) * var(--zaui-size; 1)) !important;
|
|
106
|
+
|
|
107
|
+
&.pro-form-item-width-auto {
|
|
108
|
+
.ant-form-item-control-input {
|
|
109
|
+
flex-grow: inherit;
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
.ant-form-item-control-input-content {
|
|
113
|
+
flex: initial;
|
|
114
|
+
}
|
|
115
|
+
}
|
|
84
116
|
|
|
85
117
|
.ant-form-item-tooltip {
|
|
86
118
|
svg {
|
|
87
|
-
width: 14px;
|
|
88
|
-
height: 14px;
|
|
119
|
+
width : 14px;
|
|
120
|
+
height : 14px;
|
|
89
121
|
vertical-align: bottom;
|
|
90
|
-
fill:
|
|
122
|
+
fill : @zaui-aide-text;
|
|
91
123
|
}
|
|
92
124
|
}
|
|
93
125
|
|
|
94
126
|
// 比较原始值场景下 不同时候的样式
|
|
95
127
|
&.pro-form-item-changed {
|
|
128
|
+
|
|
96
129
|
span.ant-input-affix-wrapper,
|
|
97
130
|
.ant-select-selector,
|
|
98
131
|
.ant-picker {
|
|
99
|
-
background:
|
|
132
|
+
background: @zaui-contract-bg;
|
|
100
133
|
|
|
101
134
|
input {
|
|
102
|
-
background:
|
|
135
|
+
background: @zaui-contract-bg;
|
|
103
136
|
}
|
|
104
137
|
}
|
|
105
|
-
|
|
106
|
-
#switch {
|
|
107
|
-
background: #bfbfbf;
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
// 自定义label宽度场景
|
|
112
|
-
&.label-width {
|
|
113
|
-
.ant-form-item-label {
|
|
114
|
-
width: auto !important;
|
|
115
|
-
max-width: fit-content !important;
|
|
116
|
-
}
|
|
117
138
|
}
|
|
118
139
|
|
|
119
140
|
.ant-row {
|
|
@@ -147,9 +168,9 @@
|
|
|
147
168
|
}
|
|
148
169
|
|
|
149
170
|
.range-right {
|
|
150
|
-
width: 100%;
|
|
151
|
-
border: 1px solid
|
|
152
|
-
border-top-left-radius: 0;
|
|
171
|
+
width : 100%;
|
|
172
|
+
border : 1px solid @zaui-form-control-line;
|
|
173
|
+
border-top-left-radius : 0;
|
|
153
174
|
border-bottom-left-radius: 0;
|
|
154
175
|
}
|
|
155
176
|
}
|
|
@@ -160,149 +181,36 @@
|
|
|
160
181
|
display: none;
|
|
161
182
|
}
|
|
162
183
|
|
|
163
|
-
// 查看模式
|
|
164
|
-
&.mode-view {
|
|
165
|
-
// 查看模式样式覆盖
|
|
166
|
-
.ant-input[disabled] {
|
|
167
|
-
.noDisabled();
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
.ant-input-disabled {
|
|
171
|
-
.noDisabled();
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
.ant-picker.ant-picker-disabled {
|
|
175
|
-
.noDisabled();
|
|
176
|
-
}
|
|
177
|
-
|
|
178
|
-
.ant-picker-input > input[disabled] {
|
|
179
|
-
.noDisabled();
|
|
180
|
-
}
|
|
181
|
-
|
|
182
|
-
.ant-picker-suffix {
|
|
183
|
-
display: none;
|
|
184
|
-
}
|
|
185
|
-
|
|
186
|
-
.ant-input-textarea.ant-input-textarea-show-count::after {
|
|
187
|
-
display: none;
|
|
188
|
-
}
|
|
189
|
-
|
|
190
|
-
.ant-select-disabled.ant-select:not(.ant-select-customize-input) .ant-select-selector {
|
|
191
|
-
.noDisabled();
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
.ant-select-arrow {
|
|
195
|
-
display: none;
|
|
196
|
-
}
|
|
197
|
-
|
|
198
|
-
.ant-upload.ant-upload-disabled {
|
|
199
|
-
display: none;
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
.ant-switch-loading,
|
|
203
|
-
.ant-switch-disabled {
|
|
204
|
-
.ant-switch-inner {
|
|
205
|
-
.noDisabled();
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
.ant-switch-handle {
|
|
209
|
-
display: none;
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
background-color: #fff;
|
|
213
|
-
cursor: default;
|
|
214
|
-
opacity: 1;
|
|
215
|
-
}
|
|
216
|
-
|
|
217
|
-
.ant-radio-wrapper.ant-radio-wrapper-checked.ant-radio-wrapper-disabled {
|
|
218
|
-
display: block;
|
|
219
|
-
|
|
220
|
-
.ant-radio.ant-radio-checked.ant-radio-disabled {
|
|
221
|
-
display: none;
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
> span {
|
|
225
|
-
.noDisabled();
|
|
226
|
-
position: relative;
|
|
227
|
-
top: -3px;
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
.ant-radio-wrapper.ant-radio-wrapper-disabled {
|
|
232
|
-
display: none;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
.ant-checkbox-wrapper.ant-checkbox-wrapper-checked.ant-checkbox-wrapper-disabled {
|
|
236
|
-
display: block;
|
|
237
|
-
|
|
238
|
-
.ant-checkbox.ant-checkbox-checked.ant-checkbox-disabled {
|
|
239
|
-
display: none;
|
|
240
|
-
}
|
|
241
|
-
|
|
242
|
-
> span {
|
|
243
|
-
.noDisabled();
|
|
244
|
-
position: relative;
|
|
245
|
-
top: -3px;
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
|
|
249
|
-
.ant-checkbox-wrapper.ant-checkbox-wrapper-disabled {
|
|
250
|
-
display: none;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
.ant-form-item-has-error {
|
|
254
|
-
.ant-form-item-explain.ant-form-item-explain-error {
|
|
255
|
-
display: none;
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
::placeholder {
|
|
260
|
-
font-size: 0px;
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
.ant-input-affix-wrapper-disabled {
|
|
264
|
-
background-color: transparent;
|
|
265
|
-
border: none;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
.ant-select-selection-placeholder {
|
|
269
|
-
display: none;
|
|
270
|
-
}
|
|
271
|
-
|
|
272
|
-
.ant-input-suffix {
|
|
273
|
-
display: none;
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
|
|
277
184
|
.ant-form-item-label {
|
|
278
|
-
>
|
|
185
|
+
>label {
|
|
279
186
|
white-space: pre-wrap;
|
|
280
187
|
}
|
|
281
188
|
}
|
|
282
189
|
|
|
283
190
|
.suffix-value {
|
|
284
|
-
margin-left:
|
|
191
|
+
margin-left: @zaui-space-size-sm;
|
|
285
192
|
}
|
|
286
193
|
|
|
287
194
|
.ant-form-item-has-error {
|
|
288
195
|
.group-separator {
|
|
289
|
-
color: var(--ant-error-color);
|
|
196
|
+
color : var(--ant-error-color);
|
|
290
197
|
border-color: var(--ant-error-color);
|
|
291
198
|
}
|
|
292
199
|
|
|
293
200
|
.site-input-split {
|
|
294
|
-
border-color:
|
|
201
|
+
border-color: @zaui-danger;
|
|
295
202
|
}
|
|
296
203
|
}
|
|
297
204
|
|
|
298
205
|
.site-input-group-wrapper {
|
|
206
|
+
|
|
299
207
|
// 范围值表单样式
|
|
300
208
|
& .site-input-split {
|
|
301
|
-
text-align: center;
|
|
302
|
-
background-color:
|
|
209
|
+
text-align : center;
|
|
210
|
+
background-color: @zaui-table-strip-bg;
|
|
303
211
|
|
|
304
212
|
&.site-input-split-disabled {
|
|
305
|
-
background-color:
|
|
213
|
+
background-color: @zaui-disabled-bg;
|
|
306
214
|
}
|
|
307
215
|
}
|
|
308
216
|
|
|
@@ -344,33 +252,33 @@
|
|
|
344
252
|
}
|
|
345
253
|
}
|
|
346
254
|
|
|
347
|
-
&.ant-input-group.ant-input-group-compact
|
|
255
|
+
&.ant-input-group.ant-input-group-compact>*:not(:last-child) {
|
|
348
256
|
margin-right: 0;
|
|
349
257
|
}
|
|
350
258
|
|
|
351
|
-
|
|
352
|
-
border-top-right-radius: 0 !important;
|
|
259
|
+
>*:first-child {
|
|
260
|
+
border-top-right-radius : 0 !important;
|
|
353
261
|
border-bottom-right-radius: 0 !important;
|
|
354
262
|
|
|
355
|
-
|
|
356
|
-
border-top-right-radius: 0 !important;
|
|
263
|
+
>.ant-select-selector {
|
|
264
|
+
border-top-right-radius : 0 !important;
|
|
357
265
|
border-bottom-right-radius: 0 !important;
|
|
358
266
|
}
|
|
359
267
|
}
|
|
360
268
|
|
|
361
|
-
|
|
362
|
-
border-top-left-radius: 0 !important;
|
|
269
|
+
>*:last-child {
|
|
270
|
+
border-top-left-radius : 0 !important;
|
|
363
271
|
border-bottom-left-radius: 0 !important;
|
|
364
272
|
|
|
365
|
-
|
|
366
|
-
border-top-left-radius: 0 !important;
|
|
273
|
+
>.ant-select-selector {
|
|
274
|
+
border-top-left-radius : 0 !important;
|
|
367
275
|
border-bottom-left-radius: 0 !important;
|
|
368
276
|
}
|
|
369
277
|
}
|
|
370
278
|
}
|
|
371
279
|
|
|
372
|
-
.ant-input-group.ant-input-group-compact
|
|
373
|
-
float: none;
|
|
280
|
+
.ant-input-group.ant-input-group-compact>* {
|
|
281
|
+
float : none;
|
|
374
282
|
vertical-align: top;
|
|
375
283
|
}
|
|
376
284
|
|
|
@@ -379,17 +287,17 @@
|
|
|
379
287
|
}
|
|
380
288
|
|
|
381
289
|
.noDisabled {
|
|
382
|
-
color:
|
|
383
|
-
font-size: 14px;
|
|
290
|
+
color : @zaui-disabled-text;
|
|
291
|
+
font-size : var(--zaui-font-size, 14px);
|
|
384
292
|
background-color: transparent;
|
|
385
|
-
border: none;
|
|
386
|
-
cursor: default;
|
|
387
|
-
opacity: 1;
|
|
293
|
+
border : none;
|
|
294
|
+
cursor : default;
|
|
295
|
+
opacity : 1;
|
|
388
296
|
}
|
|
389
297
|
|
|
390
298
|
div.pro-form-custom-footer {
|
|
391
|
-
width: unset !important;
|
|
392
|
-
height:
|
|
299
|
+
width : unset !important;
|
|
300
|
+
height : @zaui-space-card;
|
|
393
301
|
margin-bottom: calc(var(--zaui-height-size-md, 16px) * var(--zaui-size, 1));
|
|
394
302
|
|
|
395
303
|
&.pro-form-custom-footer-hidden {
|
|
@@ -398,14 +306,14 @@
|
|
|
398
306
|
}
|
|
399
307
|
|
|
400
308
|
.pro-form-view-container {
|
|
401
|
-
display: inline-block;
|
|
402
|
-
color: var(--zaui-text, #343434);
|
|
309
|
+
display : inline-block;
|
|
310
|
+
color : var(--zaui-text, #343434);
|
|
403
311
|
word-break: break-all;
|
|
404
312
|
}
|
|
405
313
|
|
|
406
314
|
.pro-form-view-container_nowrap {
|
|
407
|
-
overflow: hidden;
|
|
408
|
-
white-space: nowrap;
|
|
315
|
+
overflow : hidden;
|
|
316
|
+
white-space : nowrap;
|
|
409
317
|
text-overflow: ellipsis;
|
|
410
318
|
}
|
|
411
319
|
|
|
@@ -17,7 +17,7 @@ export declare const isSelect: (props: any) => any;
|
|
|
17
17
|
* @param trim 是否移除前后空格
|
|
18
18
|
* @returns {}
|
|
19
19
|
*/
|
|
20
|
-
export declare const isTrim: (type: string, trim: boolean) => any;
|
|
20
|
+
export declare const isTrim: (type: string, trim: boolean, configData: any) => any;
|
|
21
21
|
/**
|
|
22
22
|
* Input TextArea 小写自动转大写
|
|
23
23
|
* @param type 组件类型
|
|
@@ -62,9 +62,14 @@ export var isSelect = function isSelect(props) {
|
|
|
62
62
|
* @param trim 是否移除前后空格
|
|
63
63
|
* @returns {}
|
|
64
64
|
*/
|
|
65
|
-
export var isTrim = function isTrim(type, trim) {
|
|
65
|
+
export var isTrim = function isTrim(type, trim, configData) {
|
|
66
|
+
var _state$type;
|
|
66
67
|
var result = {};
|
|
67
|
-
|
|
68
|
+
var _ref = configData || {},
|
|
69
|
+
_ref$state = _ref.state,
|
|
70
|
+
state = _ref$state === void 0 ? {} : _ref$state;
|
|
71
|
+
var _trim = trim || (state === null || state === void 0 ? void 0 : (_state$type = state[type]) === null || _state$type === void 0 ? void 0 : _state$type.trim);
|
|
72
|
+
if (['Input', 'TextArea', 'ProCombination'].includes(type) && _trim) {
|
|
68
73
|
result.getValueFromEvent = function (event) {
|
|
69
74
|
var _event$target$value;
|
|
70
75
|
if (Array.isArray(event)) {
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
|
2
2
|
import { validate, regExp } from '@zat-design/utils';
|
|
3
3
|
import { isNullValue } from './index';
|
|
4
|
+
import locale from '../../locale';
|
|
4
5
|
export var rulesCreator = function rulesCreator(rules, label, isSelect) {
|
|
5
6
|
var _result;
|
|
6
|
-
var message = "".concat(isSelect ?
|
|
7
|
+
var message = "".concat(isSelect ? "".concat(locale.ProForm.selectPlaceHolder) : "".concat(locale.ProForm.inputPlaceholder)).concat(locale.ProForm.ruleText).concat(label || '');
|
|
7
8
|
var result = [];
|
|
8
9
|
result = rules.map(function (ruleItem) {
|
|
9
10
|
var rule = _objectSpread({}, ruleItem);
|
|
@@ -3,6 +3,7 @@ import { useEffect, useMemo } from 'react';
|
|
|
3
3
|
import { isBoolean } from 'lodash';
|
|
4
4
|
import { rulesCreator } from './rulesCreator';
|
|
5
5
|
import { isNotFullArray, isNullArray } from './index';
|
|
6
|
+
import locale from '../../locale';
|
|
6
7
|
var useRules = function useRules(props) {
|
|
7
8
|
var rules = props.rules,
|
|
8
9
|
required = props.required,
|
|
@@ -21,7 +22,7 @@ var useRules = function useRules(props) {
|
|
|
21
22
|
return 'required' in rule;
|
|
22
23
|
}));
|
|
23
24
|
if (!requiredRule) {
|
|
24
|
-
var message = isSelect ? "
|
|
25
|
+
var message = isSelect ? "".concat(locale.ProForm.selectPlaceHolder).concat(label || '') : "".concat(locale.ProForm.inputPlaceholder).concat(label || '');
|
|
25
26
|
var rule = {
|
|
26
27
|
required: required,
|
|
27
28
|
message: message
|
|
@@ -30,7 +31,7 @@ var useRules = function useRules(props) {
|
|
|
30
31
|
if (names === null || names === void 0 ? void 0 : names.length) {
|
|
31
32
|
rule.validator = function (_, value) {
|
|
32
33
|
if (!value || isNullArray(value)) {
|
|
33
|
-
return Promise.reject(new Error("
|
|
34
|
+
return Promise.reject(new Error("".concat(locale.ProForm.inputPlaceholder).concat(label)));
|
|
34
35
|
}
|
|
35
36
|
return Promise.resolve();
|
|
36
37
|
};
|
|
@@ -49,7 +50,7 @@ var useRules = function useRules(props) {
|
|
|
49
50
|
validator: function validator(rules, value) {
|
|
50
51
|
// 完整性校验, 空数组不校验, 数组有值且值不完整则校验不通过
|
|
51
52
|
if (Array.isArray(value) && !isNullArray(value) && isNotFullArray(value, names.length)) {
|
|
52
|
-
return Promise.reject(new Error("
|
|
53
|
+
return Promise.reject(new Error("".concat(locale.ProForm.completeText).concat(label || '')));
|
|
53
54
|
}
|
|
54
55
|
return Promise.resolve();
|
|
55
56
|
}
|