fan-standard-comp 3.1.9 → 3.2.0
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 +35 -0
- package/dist/fan-standard-comp.umd.js +15 -10
- package/es/ButtonGroup/ButtonList.js +0 -3
- package/es/ButtonGroup/ButtonMenu.js +0 -3
- package/es/ButtonGroup/PopConfirmTitle.js +5 -15
- package/es/ButtonGroup/index.d.ts +2 -0
- package/es/ButtonGroup/index.js +223 -193
- package/es/ButtonGroup/style/index.less +1 -1
- package/es/DragContent/DragBar.js +2 -6
- package/es/DragContent/index.js +44 -75
- package/es/FormComp/ChunkUploader/api.js +6 -10
- package/es/FormComp/ChunkUploader/index.js +105 -171
- package/es/FormComp/ChunkUploader/lib.js +4 -17
- package/es/FormComp/ChunkUploader/upload-queue.class.js +10 -45
- package/es/FormComp/ChunkUploader/worker.js +0 -3
- package/es/FormComp/EditButton/index.js +24 -49
- package/es/FormComp/FieldComponent/ReUpload.js +18 -38
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +37 -75
- package/es/FormComp/FieldComponent/TitleNode.js +1 -3
- package/es/FormComp/FieldComponent/index.js +38 -74
- package/es/FormComp/FieldComponent/setReadonlyValues.js +34 -63
- package/es/FormComp/FieldComponent/style/index.less +6 -0
- package/es/FormComp/RenderItemGroup/index.js +46 -74
- package/es/FormComp/Uploader/index.js +36 -77
- package/es/FormComp/Uploader/util.js +0 -6
- package/es/FormComp/VarTemplate/index.js +58 -96
- package/es/NavLeafScroll/index.js +172 -154
- package/es/NavLeafScroll/style/index.less +33 -1
- package/es/RefactorTree/index.js +36 -53
- package/es/RefactorTree/indexTreeNode.js +35 -68
- package/es/RefactorTree/util.js +9 -43
- package/es/SpecIcon/fonts/iconfont.js +7 -12
- package/es/SpecIcon/index.js +16 -25
- package/es/SplitterLayout/Pane.js +2 -5
- package/es/SplitterLayout/index.js +20 -70
- package/es/StandardContent/SplitterLayout/Pane.js +6 -10
- package/es/StandardContent/SplitterLayout/index.js +12 -63
- package/es/StandardContent/SubfieldContent.js +12 -14
- package/es/StandardContent/WrapperContent.js +8 -10
- package/es/StandardDragModal/ChangeStandardModal.d.ts +44 -0
- package/es/StandardDragModal/ChangeStandardModal.js +493 -0
- package/es/StandardDragModal/DraggableModal.d.ts +7 -0
- package/es/StandardDragModal/DraggableModal.js +31 -0
- package/es/StandardDragModal/DraggableModalContext.d.ts +9 -0
- package/es/StandardDragModal/DraggableModalContext.js +5 -0
- package/es/StandardDragModal/DraggableModalInner.d.ts +16 -0
- package/es/StandardDragModal/DraggableModalInner.js +114 -0
- package/es/StandardDragModal/DraggableModalProvider.d.ts +4 -0
- package/es/StandardDragModal/DraggableModalProvider.js +40 -0
- package/es/StandardDragModal/Modal.d.ts +11 -0
- package/es/StandardDragModal/Modal.js +24 -0
- package/es/StandardDragModal/ResizeHandle.d.ts +2 -0
- package/es/StandardDragModal/ResizeHandle.js +8 -0
- package/es/StandardDragModal/clamp.d.ts +1 -0
- package/es/StandardDragModal/clamp.js +3 -0
- package/es/StandardDragModal/draggableModalReducer.d.ts +66 -0
- package/es/StandardDragModal/draggableModalReducer.js +157 -0
- package/es/StandardDragModal/getWindowSize.d.ts +4 -0
- package/es/StandardDragModal/getWindowSize.js +6 -0
- package/es/StandardDragModal/index.d.ts +3 -11
- package/es/StandardDragModal/index.js +3 -30
- package/es/StandardDragModal/index.less +65 -0
- package/es/StandardDragModal/useDrag.d.ts +5 -0
- package/es/StandardDragModal/useDrag.js +66 -0
- package/es/StandardDragModal/usePrevious.d.ts +1 -0
- package/es/StandardDragModal/usePrevious.js +8 -0
- package/es/StandardDragModal/useResize.d.ts +7 -0
- package/es/StandardDragModal/useResize.js +74 -0
- package/es/StandardFilter/index.d.ts +1 -0
- package/es/StandardFilter/index.js +32 -70
- package/es/StandardForm/ActionList.js +5 -7
- package/es/StandardForm/StepForm.js +50 -71
- package/es/StandardForm/TabForm.js +58 -70
- package/es/StandardForm/index.js +37 -56
- package/es/StandardModal/UpdateFormRef.js +1 -4
- package/es/StandardModal/index.d.ts +0 -1
- package/es/StandardModal/index.js +115 -159
- package/es/StandardPanel/index.js +19 -35
- package/es/StandardTable/index.js +20 -30
- package/es/components/IconNode/index.js +0 -4
- package/es/index.d.ts +1 -0
- package/es/index.js +15 -14
- package/es/utils/ValueFormat.js +0 -9
- package/es/utils/dictSelectUtil.js +153 -0
- package/es/utils/filterPermission.js +16 -34
- package/es/utils/getParentNodes.js +24 -47
- package/es/utils/index.js +2 -1
- package/lib/ButtonGroup/ButtonList.js +1 -13
- package/lib/ButtonGroup/ButtonMenu.js +1 -8
- package/lib/ButtonGroup/PopConfirmTitle.js +3 -16
- package/lib/ButtonGroup/index.d.ts +2 -0
- package/lib/ButtonGroup/index.js +226 -216
- package/lib/ButtonGroup/style/index.less +1 -1
- package/lib/DragContent/DragBar.js +2 -10
- package/lib/DragContent/index.js +47 -85
- package/lib/FormComp/ChunkUploader/api.js +6 -15
- package/lib/FormComp/ChunkUploader/index.js +107 -185
- package/lib/FormComp/ChunkUploader/lib.js +8 -27
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +10 -46
- package/lib/FormComp/ChunkUploader/worker.js +1 -5
- package/lib/FormComp/EditButton/index.js +26 -60
- package/lib/FormComp/FieldComponent/ReUpload.js +21 -50
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +39 -90
- package/lib/FormComp/FieldComponent/TitleNode.js +1 -5
- package/lib/FormComp/FieldComponent/index.js +38 -110
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +37 -79
- package/lib/FormComp/FieldComponent/style/index.less +6 -0
- package/lib/FormComp/RenderItemGroup/index.js +46 -87
- package/lib/FormComp/Uploader/index.js +38 -95
- package/lib/FormComp/Uploader/util.js +1 -9
- package/lib/FormComp/VarTemplate/index.js +62 -106
- package/lib/FormComp/index.js +0 -2
- package/lib/NavLeafScroll/index.js +174 -165
- package/lib/NavLeafScroll/style/index.less +33 -1
- package/lib/RefactorTree/index.js +36 -67
- package/lib/RefactorTree/indexTreeNode.js +37 -83
- package/lib/RefactorTree/util.js +11 -45
- package/lib/SpecIcon/fonts/iconfont.js +7 -12
- package/lib/SpecIcon/index.js +16 -30
- package/lib/SplitterLayout/Pane.js +0 -7
- package/lib/SplitterLayout/index.js +18 -72
- package/lib/StandardContent/SplitterLayout/Pane.js +6 -14
- package/lib/StandardContent/SplitterLayout/index.js +12 -68
- package/lib/StandardContent/SubfieldContent.js +12 -21
- package/lib/StandardContent/WrapperContent.js +8 -16
- package/lib/StandardDragModal/ChangeStandardModal.d.ts +44 -0
- package/lib/StandardDragModal/ChangeStandardModal.js +502 -0
- package/lib/StandardDragModal/DraggableModal.d.ts +7 -0
- package/lib/StandardDragModal/DraggableModal.js +40 -0
- package/lib/StandardDragModal/DraggableModalContext.d.ts +9 -0
- package/lib/StandardDragModal/DraggableModalContext.js +15 -0
- package/lib/StandardDragModal/DraggableModalInner.d.ts +16 -0
- package/lib/StandardDragModal/DraggableModalInner.js +124 -0
- package/lib/StandardDragModal/DraggableModalProvider.d.ts +4 -0
- package/lib/StandardDragModal/DraggableModalProvider.js +48 -0
- package/lib/StandardDragModal/Modal.d.ts +11 -0
- package/lib/StandardDragModal/Modal.js +32 -0
- package/lib/StandardDragModal/ResizeHandle.d.ts +2 -0
- package/lib/StandardDragModal/ResizeHandle.js +18 -0
- package/lib/StandardDragModal/clamp.d.ts +1 -0
- package/lib/StandardDragModal/clamp.js +10 -0
- package/lib/StandardDragModal/draggableModalReducer.d.ts +66 -0
- package/lib/StandardDragModal/draggableModalReducer.js +167 -0
- package/lib/StandardDragModal/getWindowSize.d.ts +4 -0
- package/lib/StandardDragModal/getWindowSize.js +13 -0
- package/lib/StandardDragModal/index.d.ts +3 -11
- package/lib/StandardDragModal/index.js +33 -38
- package/lib/StandardDragModal/index.less +65 -0
- package/lib/StandardDragModal/useDrag.d.ts +5 -0
- package/lib/StandardDragModal/useDrag.js +73 -0
- package/lib/StandardDragModal/usePrevious.d.ts +1 -0
- package/lib/StandardDragModal/usePrevious.js +15 -0
- package/lib/StandardDragModal/useResize.d.ts +7 -0
- package/lib/StandardDragModal/useResize.js +81 -0
- package/lib/StandardFilter/index.d.ts +1 -0
- package/lib/StandardFilter/index.js +30 -78
- package/lib/StandardForm/ActionList.js +5 -12
- package/lib/StandardForm/StepForm.js +52 -90
- package/lib/StandardForm/TabForm.js +61 -88
- package/lib/StandardForm/index.js +40 -75
- package/lib/StandardModal/UpdateFormRef.js +4 -12
- package/lib/StandardModal/index.d.ts +0 -1
- package/lib/StandardModal/index.js +117 -184
- package/lib/StandardPanel/index.js +22 -48
- package/lib/StandardTable/index.js +20 -39
- package/lib/components/IconNode/index.js +0 -7
- package/lib/components/index.js +0 -2
- package/lib/data/index.js +4 -7
- package/lib/index.d.ts +1 -0
- package/lib/index.js +50 -68
- package/lib/utils/ValueFormat.js +0 -10
- package/lib/utils/dictSelectUtil.js +161 -0
- package/lib/utils/filterPermission.js +15 -39
- package/lib/utils/getParentNodes.js +25 -52
- package/lib/utils/index.js +24 -9
- package/package.json +6 -5
|
@@ -1,58 +1,45 @@
|
|
|
1
|
-
import "antd/es/col/style";
|
|
2
|
-
import _Col from "antd/es/col";
|
|
3
1
|
import "antd/es/tabs/style";
|
|
4
2
|
import _Tabs from "antd/es/tabs";
|
|
5
|
-
|
|
3
|
+
import "antd/es/col/style";
|
|
4
|
+
import _Col from "antd/es/col";
|
|
6
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
-
|
|
8
6
|
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
7
|
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
8
|
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
|
-
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
|
|
18
11
|
import { __rest } from "tslib";
|
|
19
12
|
import React, { useEffect, useState, useMemo } from 'react';
|
|
20
13
|
import './style/index.less';
|
|
21
14
|
import StandardForm from './index';
|
|
22
15
|
import RenderItemGroup from '../FormComp/RenderItemGroup';
|
|
23
16
|
import ActionList from "./ActionList";
|
|
24
|
-
var TabPane = _Tabs.TabPane;
|
|
25
17
|
var TabForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
26
18
|
var getFormFields = props.getFormFields,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
19
|
+
_props$formItemGroup = props.formItemGroup,
|
|
20
|
+
formItemGroup = _props$formItemGroup === void 0 ? [] : _props$formItemGroup,
|
|
21
|
+
grid = props.grid,
|
|
22
|
+
layout = props.layout,
|
|
23
|
+
_props$actionAlign = props.actionAlign,
|
|
24
|
+
actionAlign = _props$actionAlign === void 0 ? 'center' : _props$actionAlign,
|
|
25
|
+
actionHide = props.actionHide,
|
|
26
|
+
fieldStatus = props.fieldStatus,
|
|
27
|
+
_props$fieldSize = props.fieldSize,
|
|
28
|
+
fieldSize = _props$fieldSize === void 0 ? "middle" : _props$fieldSize,
|
|
29
|
+
onSubmit = props.onSubmit,
|
|
30
|
+
initialValues = props.initialValues,
|
|
31
|
+
tabsConfig = props.tabsConfig,
|
|
32
|
+
displayLayout = props.displayLayout;
|
|
42
33
|
var _useState = useState(),
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
34
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
35
|
+
formChildFields = _useState2[0],
|
|
36
|
+
setFormChildFields = _useState2[1];
|
|
47
37
|
var _useState3 = useState(),
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
38
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
39
|
+
formChild = _useState4[0],
|
|
40
|
+
setFormChild = _useState4[1]; // const [fieldFailed, setFieldFailed] = useState(false)
|
|
53
41
|
var formGridSize = useMemo(function () {
|
|
54
42
|
if (typeof grid === 'string') return grid; // 数据格式为字符串,包括 xs,md,lg,xlg
|
|
55
|
-
|
|
56
43
|
var sizeName = 'xs';
|
|
57
44
|
if (grid <= 1) sizeName = 'xs';
|
|
58
45
|
if (grid === 2) sizeName = 'md';
|
|
@@ -63,13 +50,44 @@ var TabForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
63
50
|
useEffect(function () {
|
|
64
51
|
forceUpdateForm();
|
|
65
52
|
}, [formChildFields, formChild]);
|
|
66
|
-
|
|
67
53
|
var forceUpdateForm = function forceUpdateForm() {
|
|
68
54
|
// console.log('TabForm强制更新表单控件')
|
|
69
55
|
getFormFields && getFormFields(formChildFields, formChild);
|
|
70
56
|
};
|
|
71
|
-
|
|
72
57
|
if (formItemGroup.length === 0) return null;
|
|
58
|
+
var items = useMemo(function () {
|
|
59
|
+
return formItemGroup.map(function (item, index) {
|
|
60
|
+
var title = item.title,
|
|
61
|
+
fields = item.fields,
|
|
62
|
+
actions = item.actions,
|
|
63
|
+
tabConfig = __rest(item, ["title", "fields", "actions"]);
|
|
64
|
+
return Object.assign({
|
|
65
|
+
key: item.key || index,
|
|
66
|
+
label: title || item.label,
|
|
67
|
+
children: /*#__PURE__*/React.createElement("div", {
|
|
68
|
+
className: "tabForm-content ".concat(layout === 'inline' ? 'tabForm-content-inline' : '')
|
|
69
|
+
}, fields && Array.isArray(fields) ? /*#__PURE__*/React.createElement(RenderItemGroup, {
|
|
70
|
+
layout: layout,
|
|
71
|
+
form: formChild,
|
|
72
|
+
fieldStatus: fieldStatus,
|
|
73
|
+
size: formGridSize,
|
|
74
|
+
displayLayout: displayLayout,
|
|
75
|
+
doUpdateFormFields: function doUpdateFormFields() {
|
|
76
|
+
return forceUpdateForm();
|
|
77
|
+
},
|
|
78
|
+
// doUpdateFormFields={() => forceUpdateForm()}
|
|
79
|
+
itemGroup: fields
|
|
80
|
+
}) : fields, !actionHide && actions && /*#__PURE__*/React.createElement(_Col, {
|
|
81
|
+
span: 24
|
|
82
|
+
}, /*#__PURE__*/React.createElement(ActionList, {
|
|
83
|
+
list: item.actions,
|
|
84
|
+
form: formChild,
|
|
85
|
+
other: props,
|
|
86
|
+
align: actionAlign
|
|
87
|
+
})))
|
|
88
|
+
}, tabConfig);
|
|
89
|
+
});
|
|
90
|
+
}, [formItemGroup]);
|
|
73
91
|
return /*#__PURE__*/React.createElement(StandardForm, {
|
|
74
92
|
actionGroup: [],
|
|
75
93
|
ref: ref,
|
|
@@ -85,38 +103,8 @@ var TabForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
85
103
|
}, /*#__PURE__*/React.createElement(_Tabs, Object.assign({
|
|
86
104
|
type: "card",
|
|
87
105
|
animated: false
|
|
88
|
-
}, tabsConfig
|
|
89
|
-
|
|
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
|
-
}))));
|
|
106
|
+
}, tabsConfig, {
|
|
107
|
+
items: items
|
|
120
108
|
})));
|
|
121
109
|
});
|
|
122
110
|
export default TabForm;
|
package/es/StandardForm/index.js
CHANGED
|
@@ -2,19 +2,12 @@ import "antd/es/button/style";
|
|
|
2
2
|
import _Button from "antd/es/button";
|
|
3
3
|
import "antd/es/form/style";
|
|
4
4
|
import _Form from "antd/es/form";
|
|
5
|
-
|
|
6
5
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
7
|
-
|
|
8
6
|
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
7
|
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
8
|
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
|
-
|
|
9
|
+
function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0) { ; } } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
|
|
16
10
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
17
|
-
|
|
18
11
|
import { __rest } from "tslib";
|
|
19
12
|
import React, { useEffect, useMemo } from 'react';
|
|
20
13
|
import classNames from 'classnames';
|
|
@@ -24,42 +17,40 @@ import './style/index.less';
|
|
|
24
17
|
import ActionList from "./ActionList";
|
|
25
18
|
var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
26
19
|
var _props$formItemGroup = props.formItemGroup,
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
20
|
+
formItemGroup = _props$formItemGroup === void 0 ? [] : _props$formItemGroup,
|
|
21
|
+
className = props.className,
|
|
22
|
+
initialValues = props.initialValues,
|
|
23
|
+
_props$layout = props.layout,
|
|
24
|
+
layout = _props$layout === void 0 ? 'horizontal' : _props$layout,
|
|
25
|
+
_props$grid = props.grid,
|
|
26
|
+
grid = _props$grid === void 0 ? 1 : _props$grid,
|
|
27
|
+
getFormFields = props.getFormFields,
|
|
28
|
+
fieldStatus = props.fieldStatus,
|
|
29
|
+
onSubmit = props.onSubmit,
|
|
30
|
+
_props$confirmText = props.confirmText,
|
|
31
|
+
confirmText = _props$confirmText === void 0 ? '确认' : _props$confirmText,
|
|
32
|
+
onCancel = props.onCancel,
|
|
33
|
+
_props$cancelText = props.cancelText,
|
|
34
|
+
cancelText = _props$cancelText === void 0 ? '取消' : _props$cancelText,
|
|
35
|
+
actionAlign = props.actionAlign,
|
|
36
|
+
actionGroup = props.actionGroup,
|
|
37
|
+
onFinishFailed = props.onFinishFailed,
|
|
38
|
+
children = props.children,
|
|
39
|
+
prefix = props.prefix,
|
|
40
|
+
postfix = props.postfix,
|
|
41
|
+
fieldSize = props.fieldSize,
|
|
42
|
+
displayLayout = props.displayLayout,
|
|
43
|
+
baseProps = __rest(props, ["formItemGroup", "className", "initialValues", "layout", "grid", "getFormFields", "fieldStatus", "onSubmit", "confirmText", "onCancel", "cancelText", "actionAlign", "actionGroup", "onFinishFailed", "children", "prefix", "postfix", "fieldSize", "displayLayout"]);
|
|
52
44
|
var _Form$useForm = _Form.useForm(),
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
45
|
+
_Form$useForm2 = _slicedToArray(_Form$useForm, 1),
|
|
46
|
+
initForm = _Form$useForm2[0];
|
|
56
47
|
useEffect(function () {
|
|
57
48
|
if (initForm) {
|
|
58
49
|
// <---- check ref before use the form instance
|
|
59
50
|
forceUpdateForm();
|
|
60
51
|
}
|
|
61
|
-
}, [initForm]);
|
|
62
|
-
|
|
52
|
+
}, [initForm]);
|
|
53
|
+
// 栅格尺寸
|
|
63
54
|
var gridSize = useMemo(function () {
|
|
64
55
|
var sizeName = 'xs';
|
|
65
56
|
if (grid <= 1) sizeName = 'xs';
|
|
@@ -67,50 +58,43 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
67
58
|
if (grid === 3) sizeName = 'lg';
|
|
68
59
|
if (grid > 3) sizeName = 'xlg';
|
|
69
60
|
return sizeName;
|
|
70
|
-
}, [grid]);
|
|
71
|
-
|
|
61
|
+
}, [grid]);
|
|
62
|
+
// 按钮组对齐位置
|
|
72
63
|
var actionAlignCol = useMemo(function () {
|
|
73
64
|
if (layout !== 'horizontal' || gridSize !== 'xs' || actionAlign && actionAlign !== 'default') {
|
|
74
65
|
return {};
|
|
75
66
|
}
|
|
76
|
-
|
|
77
67
|
return Object.assign(Object.assign({}, general.modalSize[gridSize].formBlockLayout.wrapperCol), {
|
|
78
68
|
offset: general.modalSize[gridSize].formBlockLayout.labelCol.span
|
|
79
69
|
});
|
|
80
|
-
}, [layout, gridSize, actionAlign]);
|
|
81
|
-
|
|
70
|
+
}, [layout, gridSize, actionAlign]);
|
|
71
|
+
// 强制更新表单值,用于赋初始化实例值
|
|
82
72
|
var forceUpdateForm = function forceUpdateForm() {
|
|
83
73
|
// @ts-ignore
|
|
84
74
|
getFormFields && getFormFields(initForm && initForm.getFieldsValue() || {}, initForm);
|
|
85
75
|
};
|
|
86
|
-
|
|
87
76
|
var onFormFinish = function onFormFinish(values) {
|
|
88
77
|
if (onSubmit) onSubmit(values);
|
|
89
78
|
};
|
|
90
|
-
|
|
91
79
|
var onFormFinishFailed = function onFormFinishFailed(_ref) {
|
|
92
80
|
var values = _ref.values,
|
|
93
|
-
|
|
94
|
-
|
|
81
|
+
errorFields = _ref.errorFields,
|
|
82
|
+
outOfDate = _ref.outOfDate;
|
|
95
83
|
// 定位到第一条表单异常的焦点
|
|
96
84
|
var errorCollection = Array.prototype.slice.call(document.getElementsByClassName('ant-form-item-has-error'));
|
|
97
|
-
|
|
98
85
|
if (errorCollection[0] && errorCollection[0].getElementsByTagName('input')) {
|
|
99
86
|
Array.prototype.slice.call(errorCollection[0].getElementsByTagName('input'))[0].focus();
|
|
100
87
|
}
|
|
101
|
-
|
|
102
88
|
if (onFinishFailed) onFinishFailed({
|
|
103
89
|
values: values,
|
|
104
90
|
errorFields: errorFields,
|
|
105
91
|
outOfDate: outOfDate
|
|
106
92
|
});
|
|
107
93
|
};
|
|
108
|
-
|
|
109
94
|
var onFormCancel = function onFormCancel() {
|
|
110
95
|
if (onCancel) onCancel();
|
|
111
|
-
};
|
|
112
|
-
|
|
113
|
-
|
|
96
|
+
};
|
|
97
|
+
// 按钮组
|
|
114
98
|
var renderActionGroup = function renderActionGroup() {
|
|
115
99
|
var groupNode = function groupNode() {
|
|
116
100
|
if (Array.isArray(actionGroup)) {
|
|
@@ -123,10 +107,8 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
123
107
|
other: props
|
|
124
108
|
}));
|
|
125
109
|
}
|
|
126
|
-
|
|
127
110
|
return actionGroup;
|
|
128
111
|
};
|
|
129
|
-
|
|
130
112
|
if (Array.isArray(actionGroup) && actionGroup.length === 0) return null;
|
|
131
113
|
if (actionGroup) return groupNode();
|
|
132
114
|
return /*#__PURE__*/React.createElement(_Form.Item, {
|
|
@@ -146,7 +128,6 @@ var StandardForm = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
|
146
128
|
size: fieldSize
|
|
147
129
|
}, cancelText));
|
|
148
130
|
};
|
|
149
|
-
|
|
150
131
|
return /*#__PURE__*/React.createElement(_Form, Object.assign({
|
|
151
132
|
className: classNames(className, 'standardForm'),
|
|
152
133
|
ref: ref,
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import React, { useEffect } from "react";
|
|
2
|
-
|
|
3
2
|
var updateModalForm = function updateModalForm(props) {
|
|
4
3
|
var getFormAndFields = props.getFormAndFields,
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
form = props.form;
|
|
7
5
|
var updateFormFields = function updateFormFields() {
|
|
8
6
|
if (getFormAndFields) getFormAndFields(form.current.getFieldsValue() || {}, form.current);
|
|
9
7
|
};
|
|
10
|
-
|
|
11
8
|
useEffect(function () {
|
|
12
9
|
updateFormFields();
|
|
13
10
|
}, [form]);
|
|
@@ -3,7 +3,6 @@ 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';
|
|
7
6
|
export interface StandardModalProps extends ModalProps {
|
|
8
7
|
children?: React.ReactNode;
|
|
9
8
|
title?: String;
|