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