fan-standard-comp 3.1.2 → 3.1.4
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/package.json +1 -1
- package/dist/f26952c118ab6cdcd23dc0028ee98c11.svg +0 -173
- package/dist/fan-standard-comp.umd.js +0 -597
- package/dist/fonts/iconfont.eot +0 -0
- package/dist/fonts/iconfont.ttf +0 -0
- package/dist/fonts/iconfont.woff +0 -0
- package/es/ButtonGroup/ButtonList.d.ts +0 -2
- package/es/ButtonGroup/ButtonList.js +0 -37
- package/es/ButtonGroup/ButtonMenu.d.ts +0 -2
- package/es/ButtonGroup/ButtonMenu.js +0 -38
- package/es/ButtonGroup/PopConfirmTitle.d.ts +0 -9
- package/es/ButtonGroup/PopConfirmTitle.js +0 -37
- package/es/ButtonGroup/index.d.ts +0 -30
- package/es/ButtonGroup/index.js +0 -374
- package/es/ButtonGroup/style/index.less +0 -36
- package/es/DragContent/DragBar.js +0 -21
- package/es/DragContent/index.d.ts +0 -14
- package/es/DragContent/index.js +0 -173
- package/es/DragContent/index.less +0 -44
- package/es/FormComp/ChunkUploader/api.js +0 -76
- package/es/FormComp/ChunkUploader/index.js +0 -391
- package/es/FormComp/ChunkUploader/lib.js +0 -96
- package/es/FormComp/ChunkUploader/style/style.less +0 -3
- package/es/FormComp/ChunkUploader/upload-queue.class.js +0 -167
- package/es/FormComp/ChunkUploader/worker.js +0 -23
- package/es/FormComp/EditButton/index.d.ts +0 -26
- package/es/FormComp/EditButton/index.js +0 -140
- package/es/FormComp/FieldComponent/ReUpload.d.ts +0 -3
- package/es/FormComp/FieldComponent/ReUpload.js +0 -131
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +0 -245
- package/es/FormComp/FieldComponent/TitleNode.d.ts +0 -6
- package/es/FormComp/FieldComponent/TitleNode.js +0 -9
- package/es/FormComp/FieldComponent/index.d.ts +0 -38
- package/es/FormComp/FieldComponent/index.js +0 -413
- package/es/FormComp/FieldComponent/setReadonlyValues.js +0 -236
- package/es/FormComp/FieldComponent/style/index.less +0 -116
- package/es/FormComp/RenderItemGroup/index.d.ts +0 -37
- package/es/FormComp/RenderItemGroup/index.js +0 -234
- package/es/FormComp/Uploader/index.d.ts +0 -19
- package/es/FormComp/Uploader/index.js +0 -275
- package/es/FormComp/Uploader/style/index.less +0 -14
- package/es/FormComp/Uploader/util.d.ts +0 -8
- package/es/FormComp/Uploader/util.js +0 -38
- package/es/FormComp/VarTemplate/index.js +0 -293
- package/es/FormComp/index.d.ts +0 -1
- package/es/FormComp/index.js +0 -1
- package/es/NavLeafScroll/index.js +0 -379
- package/es/NavLeafScroll/style/index.less +0 -119
- package/es/RefactorTree/data.d.ts +0 -7
- package/es/RefactorTree/index.d.ts +0 -40
- package/es/RefactorTree/index.js +0 -167
- package/es/RefactorTree/indexTreeNode.d.ts +0 -39
- package/es/RefactorTree/indexTreeNode.js +0 -237
- package/es/RefactorTree/style/index.d.ts +0 -1
- package/es/RefactorTree/style/index.js +0 -1
- package/es/RefactorTree/style/index.less +0 -22
- package/es/RefactorTree/util.d.ts +0 -42
- package/es/RefactorTree/util.js +0 -187
- package/es/SpecIcon/fonts/demo.css +0 -539
- package/es/SpecIcon/fonts/demo_index.html +0 -1315
- package/es/SpecIcon/fonts/iconfont.css +0 -211
- package/es/SpecIcon/fonts/iconfont.eot +0 -0
- package/es/SpecIcon/fonts/iconfont.js +0 -41
- package/es/SpecIcon/fonts/iconfont.json +0 -352
- package/es/SpecIcon/fonts/iconfont.svg +0 -173
- package/es/SpecIcon/fonts/iconfont.ttf +0 -0
- package/es/SpecIcon/fonts/iconfont.woff +0 -0
- package/es/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/es/SpecIcon/index.d.ts +0 -17
- package/es/SpecIcon/index.js +0 -77
- package/es/SpecIcon/style/iconfont.less +0 -213
- package/es/SpecIcon/style/index.less +0 -98
- package/es/SplitterLayout/Pane.d.ts +0 -13
- package/es/SplitterLayout/Pane.js +0 -36
- package/es/SplitterLayout/index.js +0 -375
- package/es/SplitterLayout/index.less +0 -58
- package/es/StandardContent/SplitterLayout/Pane.js +0 -50
- package/es/StandardContent/SplitterLayout/index.js +0 -374
- package/es/StandardContent/SplitterLayout/index.less +0 -58
- package/es/StandardContent/SubfieldContent.d.ts +0 -17
- package/es/StandardContent/SubfieldContent.js +0 -41
- package/es/StandardContent/WrapperContent.d.ts +0 -13
- package/es/StandardContent/WrapperContent.js +0 -29
- package/es/StandardContent/data.d.ts +0 -101
- package/es/StandardContent/style/index.less +0 -80
- package/es/StandardDragModal/index.d.ts +0 -11
- package/es/StandardDragModal/index.js +0 -30
- package/es/StandardFilter/index.d.ts +0 -35
- package/es/StandardFilter/index.js +0 -253
- package/es/StandardFilter/style/index.less +0 -62
- package/es/StandardForm/ActionList.js +0 -44
- package/es/StandardForm/StepForm.d.ts +0 -19
- package/es/StandardForm/StepForm.js +0 -267
- package/es/StandardForm/TabForm.d.ts +0 -19
- package/es/StandardForm/TabForm.js +0 -122
- package/es/StandardForm/index.d.ts +0 -32
- package/es/StandardForm/index.js +0 -170
- package/es/StandardForm/style/index.less +0 -58
- package/es/StandardModal/UpdateFormRef.js +0 -18
- package/es/StandardModal/index.d.ts +0 -44
- package/es/StandardModal/index.js +0 -495
- package/es/StandardModal/style/index.less +0 -50
- package/es/StandardPanel/index.d.ts +0 -28
- package/es/StandardPanel/index.js +0 -134
- package/es/StandardPanel/style/index.less +0 -135
- package/es/StandardTable/index.d.ts +0 -22
- package/es/StandardTable/index.js +0 -126
- package/es/StandardTable/style/index.d.ts +0 -1
- package/es/StandardTable/style/index.js +0 -1
- package/es/StandardTable/style/index.less +0 -206
- package/es/components/IconNode/index.d.ts +0 -16
- package/es/components/IconNode/index.js +0 -28
- package/es/components/index.d.ts +0 -2
- package/es/components/index.js +0 -2
- package/es/data/func.code.js +0 -112
- package/es/data/general.config.js +0 -172
- package/es/data/index.js +0 -3
- package/es/index.d.ts +0 -24
- package/es/index.js +0 -31
- package/es/styles/index.less +0 -0
- package/es/theme/spec-variable.less +0 -48
- package/es/utils/ValueFormat.js +0 -50
- package/es/utils/filterPermission.js +0 -111
- package/es/utils/getParentNodes.js +0 -215
- package/es/utils/index.js +0 -3
- package/lib/ButtonGroup/ButtonList.d.ts +0 -2
- package/lib/ButtonGroup/ButtonList.js +0 -55
- package/lib/ButtonGroup/ButtonMenu.d.ts +0 -2
- package/lib/ButtonGroup/ButtonMenu.js +0 -51
- package/lib/ButtonGroup/PopConfirmTitle.d.ts +0 -9
- package/lib/ButtonGroup/PopConfirmTitle.js +0 -48
- package/lib/ButtonGroup/index.d.ts +0 -30
- package/lib/ButtonGroup/index.js +0 -405
- package/lib/ButtonGroup/style/index.less +0 -36
- package/lib/DragContent/DragBar.js +0 -33
- package/lib/DragContent/index.d.ts +0 -14
- package/lib/DragContent/index.js +0 -191
- package/lib/DragContent/index.less +0 -44
- package/lib/FormComp/ChunkUploader/api.js +0 -89
- package/lib/FormComp/ChunkUploader/index.js +0 -410
- package/lib/FormComp/ChunkUploader/lib.js +0 -113
- package/lib/FormComp/ChunkUploader/style/style.less +0 -3
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +0 -174
- package/lib/FormComp/ChunkUploader/worker.js +0 -28
- package/lib/FormComp/EditButton/index.d.ts +0 -26
- package/lib/FormComp/EditButton/index.js +0 -159
- package/lib/FormComp/FieldComponent/ReUpload.d.ts +0 -3
- package/lib/FormComp/FieldComponent/ReUpload.js +0 -151
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +0 -268
- package/lib/FormComp/FieldComponent/TitleNode.d.ts +0 -6
- package/lib/FormComp/FieldComponent/TitleNode.js +0 -19
- package/lib/FormComp/FieldComponent/index.d.ts +0 -38
- package/lib/FormComp/FieldComponent/index.js +0 -457
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +0 -263
- package/lib/FormComp/FieldComponent/style/index.less +0 -116
- package/lib/FormComp/RenderItemGroup/index.d.ts +0 -37
- package/lib/FormComp/RenderItemGroup/index.js +0 -255
- package/lib/FormComp/Uploader/index.d.ts +0 -19
- package/lib/FormComp/Uploader/index.js +0 -301
- package/lib/FormComp/Uploader/style/index.less +0 -14
- package/lib/FormComp/Uploader/util.d.ts +0 -8
- package/lib/FormComp/Uploader/util.js +0 -47
- package/lib/FormComp/VarTemplate/index.js +0 -308
- package/lib/FormComp/index.d.ts +0 -1
- package/lib/FormComp/index.js +0 -15
- package/lib/NavLeafScroll/index.js +0 -397
- package/lib/NavLeafScroll/style/index.less +0 -119
- package/lib/RefactorTree/data.d.ts +0 -7
- package/lib/RefactorTree/index.d.ts +0 -40
- package/lib/RefactorTree/index.js +0 -190
- package/lib/RefactorTree/indexTreeNode.d.ts +0 -39
- package/lib/RefactorTree/indexTreeNode.js +0 -260
- package/lib/RefactorTree/style/index.d.ts +0 -1
- package/lib/RefactorTree/style/index.js +0 -3
- package/lib/RefactorTree/style/index.less +0 -22
- package/lib/RefactorTree/util.d.ts +0 -42
- package/lib/RefactorTree/util.js +0 -195
- package/lib/SpecIcon/fonts/demo.css +0 -539
- package/lib/SpecIcon/fonts/demo_index.html +0 -1315
- package/lib/SpecIcon/fonts/iconfont.css +0 -211
- package/lib/SpecIcon/fonts/iconfont.eot +0 -0
- package/lib/SpecIcon/fonts/iconfont.js +0 -43
- package/lib/SpecIcon/fonts/iconfont.json +0 -352
- package/lib/SpecIcon/fonts/iconfont.svg +0 -173
- package/lib/SpecIcon/fonts/iconfont.ttf +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff +0 -0
- package/lib/SpecIcon/fonts/iconfont.woff2 +0 -0
- package/lib/SpecIcon/index.d.ts +0 -17
- package/lib/SpecIcon/index.js +0 -90
- package/lib/SpecIcon/style/iconfont.less +0 -213
- package/lib/SpecIcon/style/index.less +0 -98
- package/lib/SplitterLayout/Pane.d.ts +0 -13
- package/lib/SplitterLayout/Pane.js +0 -48
- package/lib/SplitterLayout/index.js +0 -386
- package/lib/SplitterLayout/index.less +0 -58
- package/lib/StandardContent/SplitterLayout/Pane.js +0 -62
- package/lib/StandardContent/SplitterLayout/index.js +0 -387
- package/lib/StandardContent/SplitterLayout/index.less +0 -58
- package/lib/StandardContent/SubfieldContent.d.ts +0 -17
- package/lib/StandardContent/SubfieldContent.js +0 -56
- package/lib/StandardContent/WrapperContent.d.ts +0 -13
- package/lib/StandardContent/WrapperContent.js +0 -43
- package/lib/StandardContent/data.d.ts +0 -101
- package/lib/StandardContent/style/index.less +0 -80
- package/lib/StandardDragModal/index.d.ts +0 -11
- package/lib/StandardDragModal/index.js +0 -43
- package/lib/StandardFilter/index.d.ts +0 -35
- package/lib/StandardFilter/index.js +0 -272
- package/lib/StandardFilter/style/index.less +0 -62
- package/lib/StandardForm/ActionList.js +0 -57
- package/lib/StandardForm/StepForm.d.ts +0 -19
- package/lib/StandardForm/StepForm.js +0 -295
- package/lib/StandardForm/TabForm.d.ts +0 -19
- package/lib/StandardForm/TabForm.js +0 -148
- package/lib/StandardForm/index.d.ts +0 -32
- package/lib/StandardForm/index.js +0 -197
- package/lib/StandardForm/style/index.less +0 -58
- package/lib/StandardModal/UpdateFormRef.js +0 -32
- package/lib/StandardModal/index.d.ts +0 -44
- package/lib/StandardModal/index.js +0 -525
- package/lib/StandardModal/style/index.less +0 -50
- package/lib/StandardPanel/index.d.ts +0 -28
- package/lib/StandardPanel/index.js +0 -155
- package/lib/StandardPanel/style/index.less +0 -135
- package/lib/StandardTable/index.d.ts +0 -22
- package/lib/StandardTable/index.js +0 -143
- package/lib/StandardTable/style/index.d.ts +0 -1
- package/lib/StandardTable/style/index.js +0 -3
- package/lib/StandardTable/style/index.less +0 -206
- package/lib/components/IconNode/index.d.ts +0 -16
- package/lib/components/IconNode/index.js +0 -39
- package/lib/components/index.d.ts +0 -2
- package/lib/components/index.js +0 -15
- package/lib/data/func.code.js +0 -119
- package/lib/data/general.config.js +0 -179
- package/lib/data/index.js +0 -23
- package/lib/index.d.ts +0 -24
- package/lib/index.js +0 -236
- package/lib/styles/index.less +0 -0
- package/lib/theme/spec-variable.less +0 -48
- package/lib/utils/ValueFormat.js +0 -58
- package/lib/utils/filterPermission.js +0 -127
- package/lib/utils/getParentNodes.js +0 -226
- package/lib/utils/index.js +0 -35
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
import "antd/es/col/style";
|
|
2
|
-
import _Col from "antd/es/col";
|
|
3
|
-
import "antd/es/button/style";
|
|
4
|
-
import _Button from "antd/es/button";
|
|
5
|
-
import "antd/es/steps/style";
|
|
6
|
-
import _Steps from "antd/es/steps";
|
|
7
|
-
|
|
8
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
9
|
-
|
|
10
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
11
|
-
|
|
12
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
13
|
-
|
|
14
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
15
|
-
|
|
16
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
17
|
-
|
|
18
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
19
|
-
|
|
20
|
-
import React, { useEffect, useState, useMemo } from 'react';
|
|
21
|
-
import StandardForm from './index';
|
|
22
|
-
import RenderItemGroup from '../FormComp/RenderItemGroup';
|
|
23
|
-
import ActionList from "./ActionList";
|
|
24
|
-
import './style/index.less'; // import { BreadcrumbProps as AntdBreadcrumbProps } from 'antd/es/form';
|
|
25
|
-
|
|
26
|
-
var Step = _Steps.Step;
|
|
27
|
-
var StepForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
28
|
-
var getFormFields = props.getFormFields,
|
|
29
|
-
_props$formItemGroup = props.formItemGroup,
|
|
30
|
-
formItemGroup = _props$formItemGroup === void 0 ? [] : _props$formItemGroup,
|
|
31
|
-
grid = props.grid,
|
|
32
|
-
layout = props.layout,
|
|
33
|
-
onSubmit = props.onSubmit,
|
|
34
|
-
_props$actionAlign = props.actionAlign,
|
|
35
|
-
actionAlign = _props$actionAlign === void 0 ? 'center' : _props$actionAlign,
|
|
36
|
-
fieldStatus = props.fieldStatus,
|
|
37
|
-
_props$fieldSize = props.fieldSize,
|
|
38
|
-
fieldSize = _props$fieldSize === void 0 ? "middle" : _props$fieldSize,
|
|
39
|
-
initialValues = props.initialValues,
|
|
40
|
-
actionHide = props.actionHide,
|
|
41
|
-
_props$stepsConfig = props.stepsConfig,
|
|
42
|
-
stepsConfig = _props$stepsConfig === void 0 ? {
|
|
43
|
-
current: 0
|
|
44
|
-
} : _props$stepsConfig,
|
|
45
|
-
stepClick = props.stepClick,
|
|
46
|
-
displayLayout = props.displayLayout;
|
|
47
|
-
|
|
48
|
-
var _useState = useState(),
|
|
49
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
50
|
-
formChildFields = _useState2[0],
|
|
51
|
-
setFormChildFields = _useState2[1];
|
|
52
|
-
|
|
53
|
-
var _useState3 = useState(),
|
|
54
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
55
|
-
formChild = _useState4[0],
|
|
56
|
-
setFormChild = _useState4[1];
|
|
57
|
-
|
|
58
|
-
var _useState5 = useState(0),
|
|
59
|
-
_useState6 = _slicedToArray(_useState5, 2),
|
|
60
|
-
currentStep = _useState6[0],
|
|
61
|
-
setCurrentStep = _useState6[1]; // const [fieldFailed, setFieldFailed] = useState(false)
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
useEffect(function () {
|
|
65
|
-
if (stepsConfig && (stepsConfig.current || stepsConfig.current === 0)) {
|
|
66
|
-
setCurrentStep(stepsConfig.current); // 判断是否有设置当前选中的步骤数
|
|
67
|
-
}
|
|
68
|
-
}, [stepsConfig]);
|
|
69
|
-
if (formItemGroup.length === 0) return null;
|
|
70
|
-
var formGridSize = useMemo(function () {
|
|
71
|
-
if (typeof grid === 'string') return grid; // 数据格式为字符串,包括 xs,md,lg,xlg
|
|
72
|
-
|
|
73
|
-
var sizeName = 'xs';
|
|
74
|
-
if (grid <= 1) sizeName = 'xs';
|
|
75
|
-
if (grid === 2) sizeName = 'md';
|
|
76
|
-
if (grid === 3) sizeName = 'lg';
|
|
77
|
-
if (grid > 3) sizeName = 'xlg';
|
|
78
|
-
return sizeName;
|
|
79
|
-
}, [grid]);
|
|
80
|
-
useEffect(function () {
|
|
81
|
-
forceUpdateForm();
|
|
82
|
-
}, [formChildFields, formChild]);
|
|
83
|
-
|
|
84
|
-
var forceUpdateForm = function forceUpdateForm() {
|
|
85
|
-
getFormFields && getFormFields(formChildFields, formChild);
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
var handleStepType = function handleStepType(type, extraFunc) {
|
|
89
|
-
switch (type) {
|
|
90
|
-
case 'submit':
|
|
91
|
-
case 'next':
|
|
92
|
-
// 获取当前步骤的表单配置下有 rules 的控件进行校验(自定义的控件则自己有业务层面处理添加校验)
|
|
93
|
-
var curentFields = formItemGroup[currentStep].fields;
|
|
94
|
-
var valitorGroup = curentFields && Array.isArray(curentFields) ? curentFields.filter(function (fItem) {
|
|
95
|
-
return fItem.rules;
|
|
96
|
-
}).map(function (matchItem) {
|
|
97
|
-
return matchItem.filedName;
|
|
98
|
-
}) : [];
|
|
99
|
-
formChild && formChild.validateFields(valitorGroup).then(function (values) {
|
|
100
|
-
if (stepClick) stepClick(type, formChild, values);
|
|
101
|
-
extraFunc && extraFunc();
|
|
102
|
-
}).catch(function (_ref) {// console.log('表单校验不通过 ', errorFields.map(err => err))
|
|
103
|
-
|
|
104
|
-
var errorFields = _ref.errorFields;
|
|
105
|
-
});
|
|
106
|
-
break;
|
|
107
|
-
|
|
108
|
-
case 'prev':
|
|
109
|
-
if (stepClick) stepClick(type, formChild);
|
|
110
|
-
extraFunc && extraFunc();
|
|
111
|
-
break;
|
|
112
|
-
|
|
113
|
-
case 'cancel':
|
|
114
|
-
if (stepClick) stepClick(type, formChild);
|
|
115
|
-
extraFunc && extraFunc();
|
|
116
|
-
break;
|
|
117
|
-
|
|
118
|
-
default:
|
|
119
|
-
break;
|
|
120
|
-
}
|
|
121
|
-
};
|
|
122
|
-
/* const handleStepChange = (cur:any) => {
|
|
123
|
-
// 自行判断是否校验通过
|
|
124
|
-
/!* if (cur > current) {
|
|
125
|
-
formChild.validateFields()
|
|
126
|
-
.then(values => {
|
|
127
|
-
if (stepsConfig && stepsConfig.onChange) stepsConfig.onChange(cur, formChild);
|
|
128
|
-
})
|
|
129
|
-
.catch(errorInfo => {
|
|
130
|
-
});
|
|
131
|
-
} else {
|
|
132
|
-
if (stepsConfig && stepsConfig.onChange) stepsConfig.onChange(cur, formChild);
|
|
133
|
-
}*!/
|
|
134
|
-
if (stepsConfig && stepsConfig.onChange) stepsConfig.onChange(cur, formChild);
|
|
135
|
-
}*/
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
var renderStepActions = function renderStepActions(item, index) {
|
|
139
|
-
if (formItemGroup.length === 1) {
|
|
140
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
141
|
-
className: "standardForm-actions",
|
|
142
|
-
key: index
|
|
143
|
-
}, /*#__PURE__*/React.createElement(_Button, {
|
|
144
|
-
type: "primary",
|
|
145
|
-
htmlType: "submit",
|
|
146
|
-
onClick: function onClick() {
|
|
147
|
-
return handleStepType('submit');
|
|
148
|
-
}
|
|
149
|
-
}, "\u786E\u8BA4"), /*#__PURE__*/React.createElement(_Button, {
|
|
150
|
-
onClick: function onClick() {
|
|
151
|
-
return handleStepType('cancel');
|
|
152
|
-
}
|
|
153
|
-
}, "\u53D6\u6D88"));
|
|
154
|
-
}
|
|
155
|
-
|
|
156
|
-
var buttonList = function buttonList(itemIndex) {
|
|
157
|
-
if (itemIndex === 0) {
|
|
158
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
|
159
|
-
type: "primary",
|
|
160
|
-
onClick: function onClick() {
|
|
161
|
-
return handleStepType('next');
|
|
162
|
-
}
|
|
163
|
-
}, "\u4E0B\u4E00\u6B65"), /*#__PURE__*/React.createElement(_Button, {
|
|
164
|
-
onClick: function onClick() {
|
|
165
|
-
return handleStepType('cancel');
|
|
166
|
-
}
|
|
167
|
-
}, "\u53D6\u6D88"));
|
|
168
|
-
} else if (itemIndex === formItemGroup.length - 1) {
|
|
169
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
|
170
|
-
type: "primary",
|
|
171
|
-
onClick: function onClick() {
|
|
172
|
-
return handleStepType('prev');
|
|
173
|
-
}
|
|
174
|
-
}, "\u4E0A\u4E00\u6B65"), /*#__PURE__*/React.createElement(_Button, {
|
|
175
|
-
type: "primary",
|
|
176
|
-
htmlType: "submit",
|
|
177
|
-
onClick: function onClick() {
|
|
178
|
-
return handleStepType('submit');
|
|
179
|
-
}
|
|
180
|
-
}, "\u786E\u8BA4"), /*#__PURE__*/React.createElement(_Button, {
|
|
181
|
-
onClick: function onClick() {
|
|
182
|
-
return handleStepType('cancel');
|
|
183
|
-
}
|
|
184
|
-
}, "\u53D6\u6D88"));
|
|
185
|
-
} else {
|
|
186
|
-
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Button, {
|
|
187
|
-
type: "primary",
|
|
188
|
-
onClick: function onClick() {
|
|
189
|
-
return handleStepType('prev');
|
|
190
|
-
}
|
|
191
|
-
}, "\u4E0A\u4E00\u6B65"), /*#__PURE__*/React.createElement(_Button, {
|
|
192
|
-
type: "primary",
|
|
193
|
-
onClick: function onClick() {
|
|
194
|
-
return handleStepType('next');
|
|
195
|
-
}
|
|
196
|
-
}, "\u4E0B\u4E00\u6B65"), /*#__PURE__*/React.createElement(_Button, {
|
|
197
|
-
onClick: function onClick() {
|
|
198
|
-
return handleStepType('cancel');
|
|
199
|
-
}
|
|
200
|
-
}, "\u53D6\u6D88"));
|
|
201
|
-
}
|
|
202
|
-
};
|
|
203
|
-
|
|
204
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
205
|
-
className: "standardForm-actions",
|
|
206
|
-
key: index,
|
|
207
|
-
style: {
|
|
208
|
-
textAlign: actionAlign
|
|
209
|
-
}
|
|
210
|
-
}, buttonList(index));
|
|
211
|
-
};
|
|
212
|
-
|
|
213
|
-
return /*#__PURE__*/React.createElement(StandardForm, {
|
|
214
|
-
className: layout === 'inline' ? '' : '',
|
|
215
|
-
actionGroup: [],
|
|
216
|
-
ref: ref,
|
|
217
|
-
fieldSize: fieldSize,
|
|
218
|
-
initialValues: initialValues,
|
|
219
|
-
// @ts-ignore
|
|
220
|
-
getFormFields: function getFormFields(fields, form) {
|
|
221
|
-
setFormChildFields(fields);
|
|
222
|
-
setFormChild(form);
|
|
223
|
-
},
|
|
224
|
-
onSubmit: onSubmit,
|
|
225
|
-
layout: layout,
|
|
226
|
-
onFinishFailed: function onFinishFailed() {// setFieldFailed(true)
|
|
227
|
-
}
|
|
228
|
-
}, /*#__PURE__*/React.createElement(_Steps, Object.assign({}, stepsConfig), formItemGroup.map(function (item, index) {
|
|
229
|
-
return !item.hideStep ? /*#__PURE__*/React.createElement(Step, {
|
|
230
|
-
key: "".concat(item.title).concat(index),
|
|
231
|
-
description: item.description,
|
|
232
|
-
icon: item.icon,
|
|
233
|
-
status: item.status,
|
|
234
|
-
title: item.title,
|
|
235
|
-
subTitle: item.subTitle,
|
|
236
|
-
disabled: item.disabled
|
|
237
|
-
}) : null;
|
|
238
|
-
})), formItemGroup.map(function (item, index) {
|
|
239
|
-
return /*#__PURE__*/React.createElement("div", {
|
|
240
|
-
key: index,
|
|
241
|
-
className: "stepForm-content ".concat(layout === 'inline' ? 'stepForm-content-inline' : ''),
|
|
242
|
-
style: stepsConfig && stepsConfig.current !== index ? {
|
|
243
|
-
display: 'none'
|
|
244
|
-
} : {}
|
|
245
|
-
}, item.fields && Array.isArray(item.fields) ? /*#__PURE__*/React.createElement(RenderItemGroup, {
|
|
246
|
-
layout: layout,
|
|
247
|
-
form: formChild,
|
|
248
|
-
fieldStatus: fieldStatus,
|
|
249
|
-
size: formGridSize,
|
|
250
|
-
displayLayout: displayLayout,
|
|
251
|
-
doUpdateFormFields: function doUpdateFormFields() {
|
|
252
|
-
return forceUpdateForm();
|
|
253
|
-
},
|
|
254
|
-
// doUpdateFormFields={() => console.log('强制渲染表单')}
|
|
255
|
-
itemGroup: item.fields
|
|
256
|
-
}) : item.fields, !actionHide && /*#__PURE__*/React.createElement(_Col, {
|
|
257
|
-
span: 24
|
|
258
|
-
}, item.actions ? /*#__PURE__*/React.createElement(ActionList, {
|
|
259
|
-
list: item.actions,
|
|
260
|
-
onStep: handleStepType,
|
|
261
|
-
form: formChild,
|
|
262
|
-
align: actionAlign,
|
|
263
|
-
other: props
|
|
264
|
-
}) : renderStepActions(item, index)));
|
|
265
|
-
}));
|
|
266
|
-
});
|
|
267
|
-
export default StepForm;
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import './style/index.less';
|
|
3
|
-
import { ItemGroupProps, StandardFormProps } from './index';
|
|
4
|
-
export interface TabItemGroupProps extends ItemGroupProps {
|
|
5
|
-
icon?: any;
|
|
6
|
-
hideStep?: boolean;
|
|
7
|
-
title?: any;
|
|
8
|
-
status?: any;
|
|
9
|
-
subTitle?: any;
|
|
10
|
-
disabled?: any;
|
|
11
|
-
key?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface TabFormProp extends StandardFormProps {
|
|
14
|
-
tabsConfig?: any;
|
|
15
|
-
actionHide?: boolean;
|
|
16
|
-
formItemGroup?: TabItemGroupProps[];
|
|
17
|
-
}
|
|
18
|
-
declare const TabForm: React.ForwardRefExoticComponent<Pick<TabFormProp, string | number> & React.RefAttributes<unknown>>;
|
|
19
|
-
export default TabForm;
|
|
@@ -1,122 +0,0 @@
|
|
|
1
|
-
import "antd/es/col/style";
|
|
2
|
-
import _Col from "antd/es/col";
|
|
3
|
-
import "antd/es/tabs/style";
|
|
4
|
-
import _Tabs from "antd/es/tabs";
|
|
5
|
-
|
|
6
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
-
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
|
|
10
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
-
|
|
12
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13
|
-
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
15
|
-
|
|
16
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
|
|
18
|
-
import { __rest } from "tslib";
|
|
19
|
-
import React, { useEffect, useState, useMemo } from 'react';
|
|
20
|
-
import './style/index.less';
|
|
21
|
-
import StandardForm from './index';
|
|
22
|
-
import RenderItemGroup from '../FormComp/RenderItemGroup';
|
|
23
|
-
import ActionList from "./ActionList";
|
|
24
|
-
var TabPane = _Tabs.TabPane;
|
|
25
|
-
var TabForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
26
|
-
var getFormFields = props.getFormFields,
|
|
27
|
-
_props$formItemGroup = props.formItemGroup,
|
|
28
|
-
formItemGroup = _props$formItemGroup === void 0 ? [] : _props$formItemGroup,
|
|
29
|
-
grid = props.grid,
|
|
30
|
-
layout = props.layout,
|
|
31
|
-
_props$actionAlign = props.actionAlign,
|
|
32
|
-
actionAlign = _props$actionAlign === void 0 ? 'center' : _props$actionAlign,
|
|
33
|
-
actionHide = props.actionHide,
|
|
34
|
-
fieldStatus = props.fieldStatus,
|
|
35
|
-
_props$fieldSize = props.fieldSize,
|
|
36
|
-
fieldSize = _props$fieldSize === void 0 ? "middle" : _props$fieldSize,
|
|
37
|
-
onSubmit = props.onSubmit,
|
|
38
|
-
initialValues = props.initialValues,
|
|
39
|
-
tabsConfig = props.tabsConfig,
|
|
40
|
-
displayLayout = props.displayLayout;
|
|
41
|
-
|
|
42
|
-
var _useState = useState(),
|
|
43
|
-
_useState2 = _slicedToArray(_useState, 2),
|
|
44
|
-
formChildFields = _useState2[0],
|
|
45
|
-
setFormChildFields = _useState2[1];
|
|
46
|
-
|
|
47
|
-
var _useState3 = useState(),
|
|
48
|
-
_useState4 = _slicedToArray(_useState3, 2),
|
|
49
|
-
formChild = _useState4[0],
|
|
50
|
-
setFormChild = _useState4[1]; // const [fieldFailed, setFieldFailed] = useState(false)
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
var formGridSize = useMemo(function () {
|
|
54
|
-
if (typeof grid === 'string') return grid; // 数据格式为字符串,包括 xs,md,lg,xlg
|
|
55
|
-
|
|
56
|
-
var sizeName = 'xs';
|
|
57
|
-
if (grid <= 1) sizeName = 'xs';
|
|
58
|
-
if (grid === 2) sizeName = 'md';
|
|
59
|
-
if (grid === 3) sizeName = 'lg';
|
|
60
|
-
if (grid > 3) sizeName = 'xlg';
|
|
61
|
-
return sizeName;
|
|
62
|
-
}, [grid]);
|
|
63
|
-
useEffect(function () {
|
|
64
|
-
forceUpdateForm();
|
|
65
|
-
}, [formChildFields, formChild]);
|
|
66
|
-
|
|
67
|
-
var forceUpdateForm = function forceUpdateForm() {
|
|
68
|
-
// console.log('TabForm强制更新表单控件')
|
|
69
|
-
getFormFields && getFormFields(formChildFields, formChild);
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
if (formItemGroup.length === 0) return null;
|
|
73
|
-
return /*#__PURE__*/React.createElement(StandardForm, {
|
|
74
|
-
actionGroup: [],
|
|
75
|
-
ref: ref,
|
|
76
|
-
fieldSize: fieldSize,
|
|
77
|
-
// @ts-ignore
|
|
78
|
-
getFormFields: function getFormFields(fields, form) {
|
|
79
|
-
setFormChildFields(fields);
|
|
80
|
-
setFormChild(form);
|
|
81
|
-
},
|
|
82
|
-
layout: layout,
|
|
83
|
-
onSubmit: onSubmit,
|
|
84
|
-
initialValues: initialValues
|
|
85
|
-
}, /*#__PURE__*/React.createElement(_Tabs, Object.assign({
|
|
86
|
-
type: "card",
|
|
87
|
-
animated: false
|
|
88
|
-
}, tabsConfig), formItemGroup.map(function (item, index) {
|
|
89
|
-
var title = item.title,
|
|
90
|
-
fields = item.fields,
|
|
91
|
-
actions = item.actions,
|
|
92
|
-
tabConfig = __rest(item, ["title", "fields", "actions"]);
|
|
93
|
-
|
|
94
|
-
return /*#__PURE__*/React.createElement(TabPane, Object.assign({
|
|
95
|
-
key: "".concat(item.key || index),
|
|
96
|
-
tab: title
|
|
97
|
-
}, tabConfig, {
|
|
98
|
-
forceRender: true
|
|
99
|
-
}), /*#__PURE__*/React.createElement("div", {
|
|
100
|
-
className: "tabForm-content ".concat(layout === 'inline' ? 'tabForm-content-inline' : '')
|
|
101
|
-
}, fields && Array.isArray(fields) ? /*#__PURE__*/React.createElement(RenderItemGroup, {
|
|
102
|
-
layout: layout,
|
|
103
|
-
form: formChild,
|
|
104
|
-
fieldStatus: fieldStatus,
|
|
105
|
-
size: formGridSize,
|
|
106
|
-
displayLayout: displayLayout,
|
|
107
|
-
doUpdateFormFields: function doUpdateFormFields() {
|
|
108
|
-
return forceUpdateForm();
|
|
109
|
-
},
|
|
110
|
-
// doUpdateFormFields={() => forceUpdateForm()}
|
|
111
|
-
itemGroup: fields
|
|
112
|
-
}) : fields, !actionHide && actions && /*#__PURE__*/React.createElement(_Col, {
|
|
113
|
-
span: 24
|
|
114
|
-
}, /*#__PURE__*/React.createElement(ActionList, {
|
|
115
|
-
list: item.actions,
|
|
116
|
-
form: formChild,
|
|
117
|
-
other: props,
|
|
118
|
-
align: actionAlign
|
|
119
|
-
}))));
|
|
120
|
-
})));
|
|
121
|
-
});
|
|
122
|
-
export default TabForm;
|
|
@@ -1,32 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { FieldsItemProps } from '../FormComp/RenderItemGroup';
|
|
3
|
-
import './style/index.less';
|
|
4
|
-
export interface ItemGroupProps extends FieldsItemProps {
|
|
5
|
-
fields?: any;
|
|
6
|
-
actions?: any;
|
|
7
|
-
[k: string]: any;
|
|
8
|
-
}
|
|
9
|
-
export interface StandardFormProps {
|
|
10
|
-
formItemGroup?: ItemGroupProps[];
|
|
11
|
-
className?: string;
|
|
12
|
-
initialValues?: any;
|
|
13
|
-
layout?: 'horizontal' | 'vertical' | 'inline';
|
|
14
|
-
grid?: number;
|
|
15
|
-
fieldSize?: 'middle' | 'large' | 'small' | any;
|
|
16
|
-
getFormFields?: (fields?: any, form?: any) => void;
|
|
17
|
-
fieldStatus?: 'default' | 'viewOnly' | 'disabled' | any;
|
|
18
|
-
onSubmit?: (values?: any) => void;
|
|
19
|
-
confirmText?: string;
|
|
20
|
-
onCancel?: () => void;
|
|
21
|
-
cancelText?: string;
|
|
22
|
-
actionAlign?: any;
|
|
23
|
-
actionGroup?: any;
|
|
24
|
-
onFinishFailed?: any;
|
|
25
|
-
children?: React.ReactNode;
|
|
26
|
-
postfix?: React.ReactNode;
|
|
27
|
-
prefix?: React.ReactNode;
|
|
28
|
-
displayLayout?: any;
|
|
29
|
-
[k: string]: any;
|
|
30
|
-
}
|
|
31
|
-
declare const StandardForm: React.ForwardRefExoticComponent<Pick<StandardFormProps, string | number> & React.RefAttributes<unknown>>;
|
|
32
|
-
export default StandardForm;
|
package/es/StandardForm/index.js
DELETED
|
@@ -1,170 +0,0 @@
|
|
|
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";
|
|
5
|
-
|
|
6
|
-
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
-
|
|
8
|
-
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
9
|
-
|
|
10
|
-
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
11
|
-
|
|
12
|
-
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
13
|
-
|
|
14
|
-
function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
15
|
-
|
|
16
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
|
|
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) {
|
|
26
|
-
var _props$formItemGroup = props.formItemGroup,
|
|
27
|
-
formItemGroup = _props$formItemGroup === void 0 ? [] : _props$formItemGroup,
|
|
28
|
-
className = props.className,
|
|
29
|
-
initialValues = props.initialValues,
|
|
30
|
-
_props$layout = props.layout,
|
|
31
|
-
layout = _props$layout === void 0 ? 'horizontal' : _props$layout,
|
|
32
|
-
_props$grid = props.grid,
|
|
33
|
-
grid = _props$grid === void 0 ? 1 : _props$grid,
|
|
34
|
-
getFormFields = props.getFormFields,
|
|
35
|
-
fieldStatus = props.fieldStatus,
|
|
36
|
-
onSubmit = props.onSubmit,
|
|
37
|
-
_props$confirmText = props.confirmText,
|
|
38
|
-
confirmText = _props$confirmText === void 0 ? '确认' : _props$confirmText,
|
|
39
|
-
onCancel = props.onCancel,
|
|
40
|
-
_props$cancelText = props.cancelText,
|
|
41
|
-
cancelText = _props$cancelText === void 0 ? '取消' : _props$cancelText,
|
|
42
|
-
actionAlign = props.actionAlign,
|
|
43
|
-
actionGroup = props.actionGroup,
|
|
44
|
-
onFinishFailed = props.onFinishFailed,
|
|
45
|
-
children = props.children,
|
|
46
|
-
prefix = props.prefix,
|
|
47
|
-
postfix = props.postfix,
|
|
48
|
-
fieldSize = props.fieldSize,
|
|
49
|
-
displayLayout = props.displayLayout,
|
|
50
|
-
baseProps = __rest(props, ["formItemGroup", "className", "initialValues", "layout", "grid", "getFormFields", "fieldStatus", "onSubmit", "confirmText", "onCancel", "cancelText", "actionAlign", "actionGroup", "onFinishFailed", "children", "prefix", "postfix", "fieldSize", "displayLayout"]);
|
|
51
|
-
|
|
52
|
-
var _Form$useForm = _Form.useForm(),
|
|
53
|
-
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
54
|
-
initForm = _Form$useForm2[0];
|
|
55
|
-
|
|
56
|
-
useEffect(function () {
|
|
57
|
-
if (initForm) {
|
|
58
|
-
// <---- check ref before use the form instance
|
|
59
|
-
forceUpdateForm();
|
|
60
|
-
}
|
|
61
|
-
}, [initForm]); // 栅格尺寸
|
|
62
|
-
|
|
63
|
-
var gridSize = useMemo(function () {
|
|
64
|
-
var sizeName = 'xs';
|
|
65
|
-
if (grid <= 1) sizeName = 'xs';
|
|
66
|
-
if (grid === 2) sizeName = 'md';
|
|
67
|
-
if (grid === 3) sizeName = 'lg';
|
|
68
|
-
if (grid > 3) sizeName = 'xlg';
|
|
69
|
-
return sizeName;
|
|
70
|
-
}, [grid]); // 按钮组对齐位置
|
|
71
|
-
|
|
72
|
-
var actionAlignCol = useMemo(function () {
|
|
73
|
-
if (layout !== 'horizontal' || gridSize !== 'xs' || actionAlign && actionAlign !== 'default') {
|
|
74
|
-
return {};
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
return Object.assign(Object.assign({}, general.modalSize[gridSize].formBlockLayout.wrapperCol), {
|
|
78
|
-
offset: general.modalSize[gridSize].formBlockLayout.labelCol.span
|
|
79
|
-
});
|
|
80
|
-
}, [layout, gridSize, actionAlign]); // 强制更新表单值,用于赋初始化实例值
|
|
81
|
-
|
|
82
|
-
var forceUpdateForm = function forceUpdateForm() {
|
|
83
|
-
// @ts-ignore
|
|
84
|
-
getFormFields && getFormFields(initForm && initForm.getFieldsValue() || {}, initForm);
|
|
85
|
-
};
|
|
86
|
-
|
|
87
|
-
var onFormFinish = function onFormFinish(values) {
|
|
88
|
-
if (onSubmit) onSubmit(values);
|
|
89
|
-
};
|
|
90
|
-
|
|
91
|
-
var onFormFinishFailed = function onFormFinishFailed(_ref) {
|
|
92
|
-
var values = _ref.values,
|
|
93
|
-
errorFields = _ref.errorFields,
|
|
94
|
-
outOfDate = _ref.outOfDate;
|
|
95
|
-
// 定位到第一条表单异常的焦点
|
|
96
|
-
var errorCollection = Array.prototype.slice.call(document.getElementsByClassName('ant-form-item-has-error'));
|
|
97
|
-
|
|
98
|
-
if (errorCollection[0] && errorCollection[0].getElementsByTagName('input')) {
|
|
99
|
-
Array.prototype.slice.call(errorCollection[0].getElementsByTagName('input'))[0].focus();
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
if (onFinishFailed) onFinishFailed({
|
|
103
|
-
values: values,
|
|
104
|
-
errorFields: errorFields,
|
|
105
|
-
outOfDate: outOfDate
|
|
106
|
-
});
|
|
107
|
-
};
|
|
108
|
-
|
|
109
|
-
var onFormCancel = function onFormCancel() {
|
|
110
|
-
if (onCancel) onCancel();
|
|
111
|
-
}; // 按钮组
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
var renderActionGroup = function renderActionGroup() {
|
|
115
|
-
var groupNode = function groupNode() {
|
|
116
|
-
if (Array.isArray(actionGroup)) {
|
|
117
|
-
return actionGroup.length === 0 ? null : /*#__PURE__*/React.createElement(_Form.Item, {
|
|
118
|
-
wrapperCol: actionAlignCol
|
|
119
|
-
}, /*#__PURE__*/React.createElement(ActionList, {
|
|
120
|
-
list: actionGroup,
|
|
121
|
-
form: initForm,
|
|
122
|
-
align: actionAlign,
|
|
123
|
-
other: props
|
|
124
|
-
}));
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
return actionGroup;
|
|
128
|
-
};
|
|
129
|
-
|
|
130
|
-
if (Array.isArray(actionGroup) && actionGroup.length === 0) return null;
|
|
131
|
-
if (actionGroup) return groupNode();
|
|
132
|
-
return /*#__PURE__*/React.createElement(_Form.Item, {
|
|
133
|
-
className: "standardForm-actions",
|
|
134
|
-
style: {
|
|
135
|
-
'textAlign': !actionAlign || actionAlign === 'default' ? 'inherit' : actionAlign
|
|
136
|
-
},
|
|
137
|
-
wrapperCol: actionAlignCol
|
|
138
|
-
}, confirmText && /*#__PURE__*/React.createElement(_Button, {
|
|
139
|
-
type: "primary",
|
|
140
|
-
htmlType: "submit",
|
|
141
|
-
size: fieldSize
|
|
142
|
-
}, confirmText), cancelText && /*#__PURE__*/React.createElement(_Button, {
|
|
143
|
-
onClick: function onClick() {
|
|
144
|
-
return onFormCancel();
|
|
145
|
-
},
|
|
146
|
-
size: fieldSize
|
|
147
|
-
}, cancelText));
|
|
148
|
-
};
|
|
149
|
-
|
|
150
|
-
return /*#__PURE__*/React.createElement(_Form, Object.assign({
|
|
151
|
-
className: classNames(className, 'standardForm'),
|
|
152
|
-
ref: ref,
|
|
153
|
-
form: initForm,
|
|
154
|
-
initialValues: initialValues,
|
|
155
|
-
layout: layout
|
|
156
|
-
}, baseProps, {
|
|
157
|
-
onFinish: onFormFinish,
|
|
158
|
-
onFinishFailed: onFormFinishFailed,
|
|
159
|
-
scrollToFirstError: true
|
|
160
|
-
}), prefix, children, /*#__PURE__*/React.createElement(React.Fragment, null, formItemGroup.length > 0 ? /*#__PURE__*/React.createElement(RenderItemGroup, {
|
|
161
|
-
itemGroup: formItemGroup,
|
|
162
|
-
fieldSize: fieldSize,
|
|
163
|
-
displayLayout: displayLayout,
|
|
164
|
-
// doUpdateFormFields={() => forceUpdateForm()}
|
|
165
|
-
size: gridSize,
|
|
166
|
-
layout: layout,
|
|
167
|
-
fieldStatus: fieldStatus
|
|
168
|
-
}) : null, renderActionGroup()), postfix);
|
|
169
|
-
});
|
|
170
|
-
export default StandardForm;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
@root-entry-name: default;
|
|
2
|
-
@import (reference) '~antd/es/style/themes/index';
|
|
3
|
-
|
|
4
|
-
.standardForm {
|
|
5
|
-
&.ant-form-inline {
|
|
6
|
-
.ant-form-item {
|
|
7
|
-
margin-bottom: @padding-md;
|
|
8
|
-
}
|
|
9
|
-
.ant-form-item-explain, .ant-form-item-extra{
|
|
10
|
-
position: absolute;
|
|
11
|
-
}
|
|
12
|
-
.ant-slider {
|
|
13
|
-
min-width: 100px;
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
&.ant-form-horizontal {
|
|
17
|
-
&.ant-form-small {
|
|
18
|
-
.ant-form-item-label> label {
|
|
19
|
-
min-height: @input-height-sm;}
|
|
20
|
-
}
|
|
21
|
-
&.ant-form-large {
|
|
22
|
-
.ant-form-item-label> label {
|
|
23
|
-
min-height: @input-height-lg;}
|
|
24
|
-
}
|
|
25
|
-
.ant-form-item-label {
|
|
26
|
-
white-space: inherit;
|
|
27
|
-
> label {
|
|
28
|
-
min-height: @input-height-base;
|
|
29
|
-
height: auto;
|
|
30
|
-
&.ant-form-item-required{
|
|
31
|
-
padding-left: 8px;
|
|
32
|
-
&:before {
|
|
33
|
-
position: absolute;
|
|
34
|
-
left:1px;
|
|
35
|
-
margin-right: 0;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
.standardForm-actions {
|
|
43
|
-
.ant-btn + .ant-btn {
|
|
44
|
-
margin-left: 8px;
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
.stepForm-content {
|
|
48
|
-
margin: @padding-md 0;
|
|
49
|
-
}
|
|
50
|
-
.tabForm-content-inline,
|
|
51
|
-
.stepForm-content-inline {
|
|
52
|
-
display: flex;
|
|
53
|
-
flex-wrap: wrap;
|
|
54
|
-
.ant-select {
|
|
55
|
-
min-width: 100px;
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
}
|