fan-standard-comp 3.0.13 → 3.0.16
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/Readme.md +0 -2
- package/dist/{f26952c118ab6cdcd23dc0028ee98c11.svg → e8686421bcdc3738ee1c41da9fa770d7.svg} +0 -0
- package/dist/fan-standard-comp.umd.js +16 -16
- package/es/ButtonGroup/ButtonList.js +36 -18
- package/es/ButtonGroup/ButtonMenu.js +27 -14
- package/es/ButtonGroup/PopConfirmTitle.js +16 -5
- package/es/ButtonGroup/index.js +131 -82
- package/es/DragContent/DragBar.js +18 -6
- package/es/DragContent/index.js +30 -12
- package/es/FormComp/ChunkUploader/api.js +21 -8
- package/es/FormComp/ChunkUploader/index.js +46 -27
- package/es/FormComp/ChunkUploader/lib.js +26 -9
- package/es/FormComp/ChunkUploader/upload-queue.class.js +12 -5
- package/es/FormComp/ChunkUploader/worker.js +7 -2
- package/es/FormComp/EditButton/index.js +35 -16
- package/es/FormComp/FieldComponent/ReUpload.js +38 -18
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +49 -26
- package/es/FormComp/FieldComponent/TitleNode.js +13 -3
- package/es/FormComp/FieldComponent/index.js +112 -72
- package/es/FormComp/FieldComponent/setReadonlyValues.js +55 -28
- package/es/FormComp/RenderItemGroup/index.d.ts +9 -1
- package/es/FormComp/RenderItemGroup/index.js +63 -36
- package/es/FormComp/Uploader/index.js +64 -38
- package/es/FormComp/Uploader/util.js +11 -2
- package/es/FormComp/VarTemplate/index.js +44 -31
- package/es/FormComp/index.js +15 -1
- package/es/NavLeafScroll/index.js +53 -35
- package/es/RefactorTree/index.js +52 -29
- package/es/RefactorTree/indexTreeNode.js +54 -31
- package/es/RefactorTree/style/index.js +3 -1
- package/es/RefactorTree/util.js +18 -10
- package/es/SpecIcon/fonts/iconfont.js +2 -0
- package/es/SpecIcon/index.js +30 -17
- package/es/SplitterLayout/Pane.js +17 -5
- package/es/SplitterLayout/index.js +24 -13
- package/es/StandardContent/SplitterLayout/Pane.js +25 -13
- package/es/StandardContent/SplitterLayout/index.js +43 -30
- package/es/StandardContent/SubfieldContent.js +28 -13
- package/es/StandardContent/WrapperContent.js +24 -10
- package/es/StandardFilter/index.js +46 -27
- package/es/StandardForm/ActionList.js +21 -8
- package/es/StandardForm/StepForm.d.ts +1 -1
- package/es/StandardForm/StepForm.js +72 -41
- package/es/StandardForm/TabForm.d.ts +1 -1
- package/es/StandardForm/TabForm.js +56 -27
- package/es/StandardForm/index.d.ts +3 -1
- package/es/StandardForm/index.js +57 -28
- package/es/StandardModal/UpdateFormRef.js +18 -4
- package/es/StandardModal/index.d.ts +1 -1
- package/es/StandardModal/index.js +106 -62
- package/es/StandardPanel/index.js +53 -32
- package/es/StandardTable/index.js +34 -17
- package/es/StandardTable/style/index.js +3 -1
- package/es/components/IconNode/index.js +17 -6
- package/es/components/index.js +15 -2
- package/es/data/func.code.js +9 -2
- package/es/data/general.config.js +9 -2
- package/es/data/index.js +23 -3
- package/es/index.js +229 -24
- package/es/utils/ValueFormat.js +9 -1
- package/es/utils/filterPermission.js +20 -4
- package/es/utils/getParentNodes.js +12 -1
- package/es/utils/index.js +35 -3
- package/lib/ButtonGroup/ButtonList.js +9 -9
- package/lib/ButtonGroup/ButtonMenu.js +11 -11
- package/lib/ButtonGroup/PopConfirmTitle.js +5 -5
- package/lib/ButtonGroup/index.js +75 -56
- package/lib/DragContent/DragBar.js +5 -5
- package/lib/DragContent/index.js +7 -7
- package/lib/FormComp/ChunkUploader/api.js +4 -4
- package/lib/FormComp/ChunkUploader/index.js +10 -10
- package/lib/FormComp/ChunkUploader/lib.js +2 -2
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +2 -2
- package/lib/FormComp/ChunkUploader/worker.js +2 -2
- package/lib/FormComp/EditButton/index.js +10 -10
- package/lib/FormComp/FieldComponent/ReUpload.js +9 -9
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +16 -16
- package/lib/FormComp/FieldComponent/TitleNode.js +4 -4
- package/lib/FormComp/FieldComponent/index.js +36 -36
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +17 -17
- package/lib/FormComp/RenderItemGroup/index.d.ts +9 -1
- package/lib/FormComp/RenderItemGroup/index.js +30 -24
- package/lib/FormComp/Uploader/index.js +16 -16
- package/lib/FormComp/VarTemplate/index.js +23 -25
- package/lib/FormComp/index.js +2 -2
- package/lib/NavLeafScroll/index.js +28 -28
- package/lib/RefactorTree/index.js +14 -14
- package/lib/RefactorTree/indexTreeNode.js +19 -19
- package/lib/SpecIcon/index.js +13 -13
- package/lib/SplitterLayout/Pane.js +4 -4
- package/lib/SplitterLayout/index.js +10 -10
- package/lib/StandardContent/SplitterLayout/Pane.js +11 -11
- package/lib/StandardContent/SplitterLayout/index.js +27 -27
- package/lib/StandardContent/SubfieldContent.js +9 -9
- package/lib/StandardContent/WrapperContent.js +7 -7
- package/lib/StandardFilter/index.js +18 -18
- package/lib/StandardForm/ActionList.js +6 -6
- package/lib/StandardForm/StepForm.d.ts +1 -1
- package/lib/StandardForm/StepForm.js +30 -27
- package/lib/StandardForm/TabForm.d.ts +1 -1
- package/lib/StandardForm/TabForm.js +17 -14
- package/lib/StandardForm/index.d.ts +3 -1
- package/lib/StandardForm/index.js +17 -15
- package/lib/StandardModal/UpdateFormRef.js +4 -4
- package/lib/StandardModal/index.d.ts +1 -1
- package/lib/StandardModal/index.js +53 -39
- package/lib/StandardPanel/index.js +23 -23
- package/lib/StandardTable/index.js +8 -8
- package/lib/components/IconNode/index.js +6 -6
- package/lib/components/index.js +2 -2
- package/lib/data/func.code.js +2 -2
- package/lib/data/general.config.js +2 -2
- package/lib/data/index.js +3 -3
- package/lib/index.js +22 -22
- package/lib/utils/ValueFormat.js +2 -2
- package/lib/utils/filterPermission.js +2 -2
- package/lib/utils/index.js +2 -2
- package/package.json +1 -1
package/es/StandardForm/index.js
CHANGED
|
@@ -1,7 +1,39 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
require("antd/es/button/style");
|
|
11
|
+
|
|
12
|
+
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
13
|
+
|
|
14
|
+
require("antd/es/form/style");
|
|
15
|
+
|
|
16
|
+
var _form = _interopRequireDefault(require("antd/es/form"));
|
|
17
|
+
|
|
18
|
+
var _tslib = require("tslib");
|
|
19
|
+
|
|
20
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
21
|
+
|
|
22
|
+
var _classnames = _interopRequireDefault(require("classnames"));
|
|
23
|
+
|
|
24
|
+
var _RenderItemGroup = _interopRequireDefault(require("../FormComp/RenderItemGroup"));
|
|
25
|
+
|
|
26
|
+
var _data = require("../data");
|
|
27
|
+
|
|
28
|
+
require("./style/index.less");
|
|
29
|
+
|
|
30
|
+
var _ActionList = _interopRequireDefault(require("./ActionList"));
|
|
31
|
+
|
|
32
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
33
|
+
|
|
34
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
+
|
|
36
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
5
37
|
|
|
6
38
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
39
|
|
|
@@ -15,14 +47,7 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
15
47
|
|
|
16
48
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
49
|
|
|
18
|
-
|
|
19
|
-
import React, { useEffect, useMemo } from 'react';
|
|
20
|
-
import classNames from 'classnames';
|
|
21
|
-
import RenderItemGroup from '../FormComp/RenderItemGroup';
|
|
22
|
-
import { general } from '../data';
|
|
23
|
-
import './style/index.less';
|
|
24
|
-
import ActionList from "./ActionList";
|
|
25
|
-
var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
50
|
+
var StandardForm = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
26
51
|
var _props$formItemGroup = props.formItemGroup,
|
|
27
52
|
formItemGroup = _props$formItemGroup === void 0 ? [] : _props$formItemGroup,
|
|
28
53
|
className = props.className,
|
|
@@ -46,20 +71,21 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
46
71
|
prefix = props.prefix,
|
|
47
72
|
postfix = props.postfix,
|
|
48
73
|
fieldSize = props.fieldSize,
|
|
49
|
-
|
|
74
|
+
displayLayout = props.displayLayout,
|
|
75
|
+
baseProps = (0, _tslib.__rest)(props, ["formItemGroup", "className", "initialValues", "layout", "grid", "getFormFields", "fieldStatus", "onSubmit", "confirmText", "onCancel", "cancelText", "actionAlign", "actionGroup", "onFinishFailed", "children", "prefix", "postfix", "fieldSize", "displayLayout"]);
|
|
50
76
|
|
|
51
|
-
var _Form$useForm =
|
|
77
|
+
var _Form$useForm = _form["default"].useForm(),
|
|
52
78
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
53
79
|
initForm = _Form$useForm2[0];
|
|
54
80
|
|
|
55
|
-
useEffect(function () {
|
|
81
|
+
(0, _react.useEffect)(function () {
|
|
56
82
|
if (initForm) {
|
|
57
83
|
// <---- check ref before use the form instance
|
|
58
84
|
forceUpdateForm();
|
|
59
85
|
}
|
|
60
86
|
}, [initForm]); // 栅格尺寸
|
|
61
87
|
|
|
62
|
-
var gridSize = useMemo(function () {
|
|
88
|
+
var gridSize = (0, _react.useMemo)(function () {
|
|
63
89
|
var sizeName = 'xs';
|
|
64
90
|
if (grid <= 1) sizeName = 'xs';
|
|
65
91
|
if (grid === 2) sizeName = 'md';
|
|
@@ -68,13 +94,13 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
68
94
|
return sizeName;
|
|
69
95
|
}, [grid]); // 按钮组对齐位置
|
|
70
96
|
|
|
71
|
-
var actionAlignCol = useMemo(function () {
|
|
97
|
+
var actionAlignCol = (0, _react.useMemo)(function () {
|
|
72
98
|
if (layout !== 'horizontal' || gridSize !== 'xs' || actionAlign && actionAlign !== 'default') {
|
|
73
99
|
return {};
|
|
74
100
|
}
|
|
75
101
|
|
|
76
|
-
return Object.assign(Object.assign({}, general.modalSize[gridSize].formBlockLayout.wrapperCol), {
|
|
77
|
-
offset: general.modalSize[gridSize].formBlockLayout.labelCol.span
|
|
102
|
+
return Object.assign(Object.assign({}, _data.general.modalSize[gridSize].formBlockLayout.wrapperCol), {
|
|
103
|
+
offset: _data.general.modalSize[gridSize].formBlockLayout.labelCol.span
|
|
78
104
|
});
|
|
79
105
|
}, [layout, gridSize, actionAlign]); // 强制更新表单值,用于赋初始化实例值
|
|
80
106
|
|
|
@@ -113,9 +139,9 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
113
139
|
var renderActionGroup = function renderActionGroup() {
|
|
114
140
|
var groupNode = function groupNode() {
|
|
115
141
|
if (Array.isArray(actionGroup)) {
|
|
116
|
-
return actionGroup.length === 0 ? null : /*#__PURE__*/
|
|
142
|
+
return actionGroup.length === 0 ? null : /*#__PURE__*/_react["default"].createElement(_form["default"].Item, {
|
|
117
143
|
wrapperCol: actionAlignCol
|
|
118
|
-
}, /*#__PURE__*/
|
|
144
|
+
}, /*#__PURE__*/_react["default"].createElement(_ActionList["default"], {
|
|
119
145
|
list: actionGroup,
|
|
120
146
|
form: initForm,
|
|
121
147
|
align: actionAlign,
|
|
@@ -128,17 +154,17 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
128
154
|
|
|
129
155
|
if (Array.isArray(actionGroup) && actionGroup.length === 0) return null;
|
|
130
156
|
if (actionGroup) return groupNode();
|
|
131
|
-
return /*#__PURE__*/
|
|
157
|
+
return /*#__PURE__*/_react["default"].createElement(_form["default"].Item, {
|
|
132
158
|
className: "standardForm-actions",
|
|
133
159
|
style: {
|
|
134
160
|
'textAlign': !actionAlign || actionAlign === 'default' ? 'inherit' : actionAlign
|
|
135
161
|
},
|
|
136
162
|
wrapperCol: actionAlignCol
|
|
137
|
-
}, confirmText && /*#__PURE__*/
|
|
163
|
+
}, confirmText && /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
138
164
|
type: "primary",
|
|
139
165
|
htmlType: "submit",
|
|
140
166
|
size: fieldSize
|
|
141
|
-
}, confirmText), cancelText && /*#__PURE__*/
|
|
167
|
+
}, confirmText), cancelText && /*#__PURE__*/_react["default"].createElement(_button["default"], {
|
|
142
168
|
onClick: function onClick() {
|
|
143
169
|
return onFormCancel();
|
|
144
170
|
},
|
|
@@ -146,8 +172,8 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
146
172
|
}, cancelText));
|
|
147
173
|
};
|
|
148
174
|
|
|
149
|
-
return /*#__PURE__*/
|
|
150
|
-
className:
|
|
175
|
+
return /*#__PURE__*/_react["default"].createElement(_form["default"], Object.assign({
|
|
176
|
+
className: (0, _classnames["default"])(className, 'standardForm'),
|
|
151
177
|
ref: ref,
|
|
152
178
|
form: initForm,
|
|
153
179
|
initialValues: initialValues,
|
|
@@ -156,13 +182,16 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
156
182
|
onFinish: onFormFinish,
|
|
157
183
|
onFinishFailed: onFormFinishFailed,
|
|
158
184
|
scrollToFirstError: true
|
|
159
|
-
}), prefix, children, /*#__PURE__*/
|
|
185
|
+
}), prefix, children, /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, formItemGroup.length > 0 ? /*#__PURE__*/_react["default"].createElement(_RenderItemGroup["default"], {
|
|
160
186
|
itemGroup: formItemGroup,
|
|
161
187
|
fieldSize: fieldSize,
|
|
188
|
+
displayLayout: displayLayout,
|
|
162
189
|
// doUpdateFormFields={() => forceUpdateForm()}
|
|
163
190
|
size: gridSize,
|
|
164
191
|
layout: layout,
|
|
165
192
|
fieldStatus: fieldStatus
|
|
166
193
|
}) : null, renderActionGroup()), postfix);
|
|
167
194
|
});
|
|
168
|
-
|
|
195
|
+
|
|
196
|
+
var _default = StandardForm;
|
|
197
|
+
exports["default"] = _default;
|
|
@@ -1,4 +1,17 @@
|
|
|
1
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
|
+
|
|
5
|
+
Object.defineProperty(exports, "__esModule", {
|
|
6
|
+
value: true
|
|
7
|
+
});
|
|
8
|
+
exports["default"] = void 0;
|
|
9
|
+
|
|
10
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
11
|
+
|
|
12
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
13
|
+
|
|
14
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
2
15
|
|
|
3
16
|
var updateModalForm = function updateModalForm(props) {
|
|
4
17
|
var getFormAndFields = props.getFormAndFields,
|
|
@@ -8,11 +21,12 @@ var updateModalForm = function updateModalForm(props) {
|
|
|
8
21
|
if (getFormAndFields) getFormAndFields(form.current.getFieldsValue() || {}, form.current);
|
|
9
22
|
};
|
|
10
23
|
|
|
11
|
-
useEffect(function () {
|
|
24
|
+
(0, _react.useEffect)(function () {
|
|
12
25
|
updateFormFields();
|
|
13
26
|
}, [form]);
|
|
14
|
-
return /*#__PURE__*/
|
|
27
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null);
|
|
15
28
|
/* 如果是ReactNode则直接返回 */
|
|
16
29
|
};
|
|
17
30
|
|
|
18
|
-
|
|
31
|
+
var _default = updateModalForm;
|
|
32
|
+
exports["default"] = _default;
|
|
@@ -30,7 +30,7 @@ export interface StandardModalProps extends ModalProps {
|
|
|
30
30
|
hideFooter?: Boolean;
|
|
31
31
|
footerButtonGroup?: ((modalForm?: any, props?: StandardModalProps) => React.ReactNode | PropTypes.ReactNodeArray | any) | any;
|
|
32
32
|
footer?: any;
|
|
33
|
-
displayLayout?:
|
|
33
|
+
displayLayout?: any;
|
|
34
34
|
confirmLoading?: boolean;
|
|
35
35
|
okText?: string;
|
|
36
36
|
okButtonProps?: any;
|
|
@@ -1,11 +1,51 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
1
|
+
"use strict";
|
|
2
|
+
|
|
3
|
+
Object.defineProperty(exports, "__esModule", {
|
|
4
|
+
value: true
|
|
5
|
+
});
|
|
6
|
+
exports["default"] = void 0;
|
|
7
|
+
|
|
8
|
+
require("antd/es/row/style");
|
|
9
|
+
|
|
10
|
+
var _row = _interopRequireDefault(require("antd/es/row"));
|
|
11
|
+
|
|
12
|
+
require("antd/es/modal/style");
|
|
13
|
+
|
|
14
|
+
var _modal = _interopRequireDefault(require("antd/es/modal"));
|
|
15
|
+
|
|
16
|
+
require("antd/es/button/style");
|
|
17
|
+
|
|
18
|
+
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
19
|
+
|
|
20
|
+
require("antd/es/form/style");
|
|
21
|
+
|
|
22
|
+
var _form = _interopRequireDefault(require("antd/es/form"));
|
|
23
|
+
|
|
24
|
+
var _tslib = require("tslib");
|
|
25
|
+
|
|
26
|
+
var _react = _interopRequireWildcard(require("react"));
|
|
27
|
+
|
|
28
|
+
var _data = require("../data");
|
|
29
|
+
|
|
30
|
+
var _RenderItemGroup = _interopRequireDefault(require("../FormComp/RenderItemGroup"));
|
|
31
|
+
|
|
32
|
+
var _ValueFormat = _interopRequireDefault(require("../utils/ValueFormat.js"));
|
|
33
|
+
|
|
34
|
+
var _IconNode = _interopRequireDefault(require("../components/IconNode"));
|
|
35
|
+
|
|
36
|
+
var _TabForm = _interopRequireDefault(require("../StandardForm/TabForm"));
|
|
37
|
+
|
|
38
|
+
var _StepForm = _interopRequireDefault(require("../StandardForm/StepForm"));
|
|
39
|
+
|
|
40
|
+
var _ActionList = _interopRequireDefault(require("../StandardForm/ActionList.js"));
|
|
41
|
+
|
|
42
|
+
require("./style/index.less");
|
|
43
|
+
|
|
44
|
+
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
45
|
+
|
|
46
|
+
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
47
|
+
|
|
48
|
+
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
9
49
|
|
|
10
50
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
11
51
|
|
|
@@ -21,17 +61,6 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
21
61
|
|
|
22
62
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
23
63
|
|
|
24
|
-
import { __rest } from "tslib";
|
|
25
|
-
import React, { useEffect, useMemo, useState } from 'react';
|
|
26
|
-
import { general } from '../data';
|
|
27
|
-
import RenderItemGroup from '../FormComp/RenderItemGroup';
|
|
28
|
-
import UtilValueFormat from '../utils/ValueFormat.js';
|
|
29
|
-
import IconNode from "../components/IconNode";
|
|
30
|
-
import TabForm from '../StandardForm/TabForm';
|
|
31
|
-
import StepForm from '../StandardForm/StepForm';
|
|
32
|
-
import ActionList from '../StandardForm/ActionList.js';
|
|
33
|
-
import './style/index.less';
|
|
34
|
-
|
|
35
64
|
var StandardModal = function StandardModal(props) {
|
|
36
65
|
var children = props.children,
|
|
37
66
|
className = props.className,
|
|
@@ -57,32 +86,33 @@ var StandardModal = function StandardModal(props) {
|
|
|
57
86
|
formLayout = _props$formLayout === void 0 ? 'horizontal' : _props$formLayout,
|
|
58
87
|
tabsConfig = props.tabsConfig,
|
|
59
88
|
stepsConfig = props.stepsConfig,
|
|
60
|
-
|
|
89
|
+
displayLayout = props.displayLayout,
|
|
90
|
+
otherProps = (0, _tslib.__rest)(props, ["children", "className", "style", "size", "type", "formItemGroup", "title", "visible", "formPrefix", "formPostfix", "initialValues", "hideRequiredMark", "bodyStyle", "footer", "footerButtonGroup", "hideFooter", "getFormFields", "fieldStatus", "formLayout", "tabsConfig", "stepsConfig", "displayLayout"]);
|
|
61
91
|
|
|
62
|
-
var _Form$useForm =
|
|
92
|
+
var _Form$useForm = _form["default"].useForm(),
|
|
63
93
|
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
64
94
|
modalForm = _Form$useForm2[0];
|
|
65
95
|
|
|
66
|
-
var _useState = useState(),
|
|
96
|
+
var _useState = (0, _react.useState)(),
|
|
67
97
|
_useState2 = _slicedToArray(_useState, 2),
|
|
68
98
|
modalFormRef = _useState2[0],
|
|
69
99
|
setModalFormRef = _useState2[1]; // <---- set the ref when Form Rendered
|
|
70
100
|
|
|
71
101
|
|
|
72
|
-
var _useState3 = useState(0),
|
|
102
|
+
var _useState3 = (0, _react.useState)(0),
|
|
73
103
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
74
104
|
bodyMaxHeight = _useState4[0],
|
|
75
105
|
setBodyMaxHeight = _useState4[1]; // setTabFormChild
|
|
76
106
|
|
|
77
107
|
|
|
78
|
-
var _useState5 = useState(),
|
|
108
|
+
var _useState5 = (0, _react.useState)(),
|
|
79
109
|
_useState6 = _slicedToArray(_useState5, 2),
|
|
80
110
|
formChild = _useState6[0],
|
|
81
111
|
setFormChild = _useState6[1]; // <---- set the ref when Form Rendered
|
|
82
112
|
// 按钮栏是否有显示(默认显示)
|
|
83
113
|
|
|
84
114
|
|
|
85
|
-
var hasFooterBar = useMemo(function () {
|
|
115
|
+
var hasFooterBar = (0, _react.useMemo)(function () {
|
|
86
116
|
var _a, _b, _c, _d, _e;
|
|
87
117
|
|
|
88
118
|
var openLog = false;
|
|
@@ -154,7 +184,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
154
184
|
}; // fill Form when modal open 此处可解决获取 Form.useForm warning
|
|
155
185
|
|
|
156
186
|
|
|
157
|
-
useEffect(function () {
|
|
187
|
+
(0, _react.useEffect)(function () {
|
|
158
188
|
if (visible && modalFormRef) {
|
|
159
189
|
// <---- check ref before use the form instance
|
|
160
190
|
if (initialValues && _typeof(initialValues) === 'object') {
|
|
@@ -166,7 +196,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
166
196
|
// }
|
|
167
197
|
|
|
168
198
|
}, [modalFormRef, visible]);
|
|
169
|
-
useEffect(function () {
|
|
199
|
+
(0, _react.useEffect)(function () {
|
|
170
200
|
if (visible) {
|
|
171
201
|
initBodyMaxHeight(); // 让resize事件触发 initBodyMaxHeight
|
|
172
202
|
|
|
@@ -184,15 +214,15 @@ var StandardModal = function StandardModal(props) {
|
|
|
184
214
|
if (type === 'form') {
|
|
185
215
|
modalForm.validateFields().then(function (values) {
|
|
186
216
|
if (Object.prototype.hasOwnProperty.call(values, 'false')) {
|
|
187
|
-
delete values
|
|
217
|
+
delete values["false"]; // 自定义结构会莫名的出来一个false字段
|
|
188
218
|
}
|
|
189
219
|
|
|
190
|
-
var resultValues =
|
|
220
|
+
var resultValues = (0, _ValueFormat["default"])(values, formItemGroup);
|
|
191
221
|
|
|
192
222
|
if (onSubmit) {
|
|
193
223
|
onSubmit(Object.assign({}, resultValues));
|
|
194
224
|
}
|
|
195
|
-
})
|
|
225
|
+
})["catch"](function () {
|
|
196
226
|
// 定位到第一条表单异常的
|
|
197
227
|
var errorCollection = Array.prototype.slice.call(document.getElementsByClassName('ant-form-item-has-error'));
|
|
198
228
|
|
|
@@ -206,15 +236,15 @@ var StandardModal = function StandardModal(props) {
|
|
|
206
236
|
formChild.validateFields().then(function (values) {
|
|
207
237
|
// console.log(values)
|
|
208
238
|
if (Object.prototype.hasOwnProperty.call(values, 'false')) {
|
|
209
|
-
delete values
|
|
239
|
+
delete values["false"]; // 自定义结构会莫名的出来一个false字段
|
|
210
240
|
}
|
|
211
241
|
|
|
212
|
-
var resultValues =
|
|
242
|
+
var resultValues = (0, _ValueFormat["default"])(values, formItemGroup);
|
|
213
243
|
|
|
214
244
|
if (onSubmit) {
|
|
215
245
|
onSubmit(Object.assign({}, resultValues));
|
|
216
246
|
}
|
|
217
|
-
})
|
|
247
|
+
})["catch"](function () {
|
|
218
248
|
// 定位到第一条表单异常的
|
|
219
249
|
var errorCollection = Array.prototype.slice.call(document.getElementsByClassName('ant-form-item-has-error'));
|
|
220
250
|
|
|
@@ -257,11 +287,10 @@ var StandardModal = function StandardModal(props) {
|
|
|
257
287
|
var fieldStatus = props.fieldStatus,
|
|
258
288
|
formItemGroup = props.formItemGroup,
|
|
259
289
|
_props$size2 = props.size,
|
|
260
|
-
size = _props$size2 === void 0 ? 'md' : _props$size2
|
|
261
|
-
displayLayout = props.displayLayout;
|
|
290
|
+
size = _props$size2 === void 0 ? 'md' : _props$size2;
|
|
262
291
|
|
|
263
292
|
if (Array.isArray(formItemGroup)) {
|
|
264
|
-
return /*#__PURE__*/
|
|
293
|
+
return /*#__PURE__*/_react["default"].createElement(_RenderItemGroup["default"], {
|
|
265
294
|
size: size,
|
|
266
295
|
layout: formLayout,
|
|
267
296
|
doUpdateFormFields: function doUpdateFormFields() {
|
|
@@ -292,7 +321,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
292
321
|
formChild.validateFields(validatorGroup).then(function () {
|
|
293
322
|
// if (stepClick) stepClick(type, formChild, values);
|
|
294
323
|
extraFunc();
|
|
295
|
-
})
|
|
324
|
+
})["catch"](function () {// console.log('表单校验不通过 ', errorFields.map(err => err))
|
|
296
325
|
});
|
|
297
326
|
break;
|
|
298
327
|
|
|
@@ -324,22 +353,32 @@ var StandardModal = function StandardModal(props) {
|
|
|
324
353
|
|
|
325
354
|
if (footerButtonGroup) {
|
|
326
355
|
if (Array.isArray(footerButtonGroup)) {
|
|
327
|
-
if (footerButtonGroup.length === 0) return
|
|
328
|
-
|
|
356
|
+
if (footerButtonGroup.length === 0) return null; // <div>按钮组合配置为空</div>
|
|
357
|
+
|
|
358
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, footerButtonGroup.map(function (item) {
|
|
329
359
|
if (_typeof(item) === 'object') {
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
360
|
+
if (item.isHide) return null;
|
|
361
|
+
var name = item.name,
|
|
362
|
+
_type = item.type,
|
|
363
|
+
icon = item.icon,
|
|
364
|
+
ghost = item.ghost,
|
|
365
|
+
disabled = item.disabled,
|
|
366
|
+
loading = item.loading,
|
|
367
|
+
fn = item.fn,
|
|
368
|
+
others = (0, _tslib.__rest)(item, ["name", "type", "icon", "ghost", "disabled", "loading", "fn"]);
|
|
369
|
+
return /*#__PURE__*/_react["default"].createElement(_button["default"], Object.assign({
|
|
370
|
+
key: name,
|
|
371
|
+
type: _type || 'primary',
|
|
372
|
+
icon: /*#__PURE__*/_react["default"].createElement(_IconNode["default"], {
|
|
373
|
+
icon: icon
|
|
335
374
|
}),
|
|
336
|
-
ghost:
|
|
337
|
-
disabled:
|
|
338
|
-
loading:
|
|
339
|
-
onClick:
|
|
340
|
-
return
|
|
375
|
+
ghost: ghost,
|
|
376
|
+
disabled: disabled,
|
|
377
|
+
loading: loading,
|
|
378
|
+
onClick: fn ? function (e) {
|
|
379
|
+
return fn(item, modalForm, props, e);
|
|
341
380
|
} : null
|
|
342
|
-
},
|
|
381
|
+
}, others), name);
|
|
343
382
|
} else {
|
|
344
383
|
return item; // 如果是DOM,则直接渲染
|
|
345
384
|
}
|
|
@@ -354,12 +393,12 @@ var StandardModal = function StandardModal(props) {
|
|
|
354
393
|
}
|
|
355
394
|
|
|
356
395
|
if (footer) return footer;
|
|
357
|
-
return /*#__PURE__*/
|
|
396
|
+
return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, /*#__PURE__*/_react["default"].createElement(_button["default"], Object.assign({
|
|
358
397
|
key: "submit",
|
|
359
398
|
type: "primary",
|
|
360
399
|
loading: confirmLoading,
|
|
361
400
|
onClick: handleSubmit
|
|
362
|
-
}, confirmButtonProps, okButtonProps), confirmText || okText || '确定'), /*#__PURE__*/
|
|
401
|
+
}, confirmButtonProps, okButtonProps), confirmText || okText || '确定'), /*#__PURE__*/_react["default"].createElement(_button["default"], Object.assign({
|
|
363
402
|
key: "back",
|
|
364
403
|
onClick: handleCancel
|
|
365
404
|
}, cancelButtonProps), cancelText || '取消'));
|
|
@@ -370,7 +409,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
370
409
|
|
|
371
410
|
if (type === 'stepForm') {
|
|
372
411
|
var currentStepInfo = formItemGroup[stepsConfig.current];
|
|
373
|
-
return ((_a = currentStepInfo === null || currentStepInfo === void 0 ? void 0 : currentStepInfo.actions) === null || _a === void 0 ? void 0 : _a.length) > 0 ? /*#__PURE__*/
|
|
412
|
+
return ((_a = currentStepInfo === null || currentStepInfo === void 0 ? void 0 : currentStepInfo.actions) === null || _a === void 0 ? void 0 : _a.length) > 0 ? /*#__PURE__*/_react["default"].createElement(_ActionList["default"], {
|
|
374
413
|
list: currentStepInfo.actions || [],
|
|
375
414
|
onStep: handleStepType,
|
|
376
415
|
form: formChild,
|
|
@@ -382,7 +421,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
382
421
|
var activeTabInfo = formItemGroup.find(function (fItem) {
|
|
383
422
|
return fItem.key === (tabsConfig === null || tabsConfig === void 0 ? void 0 : tabsConfig.activeKey);
|
|
384
423
|
});
|
|
385
|
-
return ((_b = activeTabInfo.actions) === null || _b === void 0 ? void 0 : _b.length) > 0 ? /*#__PURE__*/
|
|
424
|
+
return ((_b = activeTabInfo.actions) === null || _b === void 0 ? void 0 : _b.length) > 0 ? /*#__PURE__*/_react["default"].createElement(_ActionList["default"], {
|
|
386
425
|
list: activeTabInfo.actions || [],
|
|
387
426
|
form: formChild,
|
|
388
427
|
other: props
|
|
@@ -392,13 +431,13 @@ var StandardModal = function StandardModal(props) {
|
|
|
392
431
|
return hasFooterBar ? renderButtonGroup() : null;
|
|
393
432
|
};
|
|
394
433
|
|
|
395
|
-
return /*#__PURE__*/
|
|
434
|
+
return /*#__PURE__*/_react["default"].createElement(_modal["default"], Object.assign({
|
|
396
435
|
destroyOnClose: true,
|
|
397
436
|
maskClosable: false
|
|
398
437
|
}, otherProps, {
|
|
399
438
|
visible: visible,
|
|
400
439
|
title: title,
|
|
401
|
-
width: general.modalSize[size].width,
|
|
440
|
+
width: _data.general.modalSize[size].width,
|
|
402
441
|
footer: renderFooter(),
|
|
403
442
|
className: "standardModal ".concat(className || '', " ").concat(fieldStatus === 'viewOnly' ? 'is-view' : ''),
|
|
404
443
|
style: Object.assign({
|
|
@@ -411,7 +450,7 @@ var StandardModal = function StandardModal(props) {
|
|
|
411
450
|
onCancel: handleCancel,
|
|
412
451
|
afterClose: onAfterClose,
|
|
413
452
|
onOk: handleSubmit
|
|
414
|
-
}), children, type === 'form' && /*#__PURE__*/
|
|
453
|
+
}), children, type === 'form' && /*#__PURE__*/_react["default"].createElement(_form["default"], {
|
|
415
454
|
layout: formLayout,
|
|
416
455
|
ref: setModalFormRef,
|
|
417
456
|
form: modalForm,
|
|
@@ -420,11 +459,12 @@ var StandardModal = function StandardModal(props) {
|
|
|
420
459
|
// initialValues={{ ...initialValues }}
|
|
421
460
|
scrollToFirstError: true,
|
|
422
461
|
className: "modalForm"
|
|
423
|
-
}, formPrefix && /*#__PURE__*/
|
|
462
|
+
}, formPrefix && /*#__PURE__*/_react["default"].createElement(_row["default"], null, formPrefix(modalForm, props, forceUpdateForm)), formItemGroup ? renderFormItemGroup() : null, formPostfix && /*#__PURE__*/_react["default"].createElement(_row["default"], null, formPostfix(modalForm, props, forceUpdateForm), " ")), type === 'tabForm' && /*#__PURE__*/_react["default"].createElement(_TabForm["default"], {
|
|
424
463
|
grid: size,
|
|
425
464
|
layout: formLayout,
|
|
426
465
|
fieldStatus: fieldStatus,
|
|
427
466
|
actionHide: true,
|
|
467
|
+
// @ts-ignore
|
|
428
468
|
getFormFields: function getFormFields(fields, form) {
|
|
429
469
|
setFormChild(form);
|
|
430
470
|
_getFormFields && _getFormFields(fields, form);
|
|
@@ -432,21 +472,25 @@ var StandardModal = function StandardModal(props) {
|
|
|
432
472
|
formItemGroup: formItemGroup,
|
|
433
473
|
tabsConfig: tabsConfig,
|
|
434
474
|
onSubmit: handleSubmit,
|
|
435
|
-
initialValues: Object.assign({}, initialValues)
|
|
436
|
-
|
|
475
|
+
initialValues: Object.assign({}, initialValues),
|
|
476
|
+
displayLayout: displayLayout
|
|
477
|
+
}), type === 'stepForm' && /*#__PURE__*/_react["default"].createElement(_StepForm["default"], {
|
|
437
478
|
grid: size,
|
|
438
479
|
layout: formLayout,
|
|
439
480
|
fieldStatus: fieldStatus,
|
|
440
481
|
actionHide: true,
|
|
482
|
+
// @ts-ignore
|
|
441
483
|
getFormFields: function getFormFields(fields, form) {
|
|
442
484
|
setFormChild(form);
|
|
443
485
|
_getFormFields && _getFormFields(fields, form);
|
|
444
486
|
},
|
|
445
487
|
formItemGroup: formItemGroup,
|
|
446
488
|
stepsConfig: stepsConfig,
|
|
489
|
+
onSubmit: handleSubmit,
|
|
447
490
|
initialValues: Object.assign({}, initialValues),
|
|
448
|
-
|
|
491
|
+
displayLayout: displayLayout
|
|
449
492
|
}));
|
|
450
493
|
};
|
|
451
494
|
|
|
452
|
-
|
|
495
|
+
var _default = StandardModal;
|
|
496
|
+
exports["default"] = _default;
|