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,32 +1,25 @@
|
|
|
1
1
|
import "antd/es/image/style";
|
|
2
2
|
import _Image from "antd/es/image";
|
|
3
|
-
|
|
4
3
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
5
|
-
|
|
6
4
|
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."); }
|
|
7
|
-
|
|
8
5
|
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); }
|
|
9
|
-
|
|
10
6
|
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; }
|
|
11
|
-
|
|
12
|
-
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; }
|
|
13
|
-
|
|
7
|
+
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; } }
|
|
14
8
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
15
|
-
|
|
16
9
|
import React, { useEffect, useMemo, useState } from "react";
|
|
17
10
|
import moment from 'moment';
|
|
18
|
-
import { getBase64 } from "../Uploader/util";
|
|
11
|
+
import { getBase64 } from "../Uploader/util";
|
|
12
|
+
// 设置纯展示模式下的级联选择显示值
|
|
19
13
|
|
|
20
14
|
var setCascaderValue = function setCascaderValue(value, props) {
|
|
21
15
|
var selectOptions = props.selectOptions,
|
|
22
|
-
|
|
16
|
+
defaultProps = props.defaultProps;
|
|
23
17
|
if (!value || value.length === 0 || !selectOptions) return '-'; // 无值情况 下
|
|
24
|
-
|
|
25
18
|
var matchNode = undefined;
|
|
26
19
|
var matchValueItems = [];
|
|
27
20
|
value.forEach(function (valKey) {
|
|
28
|
-
var matchValue;
|
|
29
|
-
|
|
21
|
+
var matchValue;
|
|
22
|
+
// 第一个值使用 ‘selectOptions’查找,后面使用上一次匹配到的父节点查找 matchNode
|
|
30
23
|
if (matchNode && matchNode.children) {
|
|
31
24
|
matchValue = matchNode.children.filter(function (seItem) {
|
|
32
25
|
return seItem.value == valKey;
|
|
@@ -36,44 +29,39 @@ var setCascaderValue = function setCascaderValue(value, props) {
|
|
|
36
29
|
return seItem.value == valKey;
|
|
37
30
|
});
|
|
38
31
|
}
|
|
39
|
-
|
|
40
32
|
if (matchValue.length > 0) {
|
|
41
33
|
matchNode = matchValue[0];
|
|
42
34
|
matchValueItems.push(matchValue[0]);
|
|
43
35
|
}
|
|
44
|
-
});
|
|
45
|
-
|
|
36
|
+
});
|
|
37
|
+
// 如果自定义"选择后展示的渲染函数"则直接返回此选择方法
|
|
46
38
|
if (defaultProps.displayRender) return defaultProps.displayRender(matchValueItems.map(function (item) {
|
|
47
39
|
return item.label;
|
|
48
40
|
}), matchValueItems);
|
|
49
41
|
return matchValueItems.map(function (item) {
|
|
50
42
|
return item.label;
|
|
51
43
|
}).join('/');
|
|
52
|
-
};
|
|
53
|
-
|
|
54
|
-
|
|
44
|
+
};
|
|
45
|
+
// 设置纯展示模式下的下拉、单选、多选表单值
|
|
55
46
|
var setSelectValue = function setSelectValue(value, props) {
|
|
56
47
|
var selectOptions = props.selectOptions,
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
48
|
+
selectOptionRender = props.selectOptionRender,
|
|
49
|
+
defaultProps = props.defaultProps,
|
|
50
|
+
type = props.type,
|
|
51
|
+
separator = props.separator;
|
|
61
52
|
var labelInValue = defaultProps.labelInValue;
|
|
62
53
|
if (!value && value !== 0 || !selectOptions) return '-'; // 无值情况 下
|
|
63
54
|
// 数组情况
|
|
64
|
-
|
|
65
55
|
if (Array.isArray(value)) {
|
|
66
56
|
if (value.length == 0) {
|
|
67
57
|
return '-'; // 无值情况 下
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
|
|
58
|
+
}
|
|
59
|
+
// 返回是数组
|
|
71
60
|
var matchValues = [];
|
|
72
61
|
value.forEach(function (valKey, index) {
|
|
73
62
|
var matchValue = selectOptions.filter(function (seItem) {
|
|
74
63
|
return seItem.value == (labelInValue ? valKey.value : valKey);
|
|
75
64
|
});
|
|
76
|
-
|
|
77
65
|
if (matchValue.length > 0) {
|
|
78
66
|
// 如果 select 配置选项展示内容,则直接使用其配置值展示当前只读信息
|
|
79
67
|
if (selectOptionRender) {
|
|
@@ -85,94 +73,79 @@ var setSelectValue = function setSelectValue(value, props) {
|
|
|
85
73
|
matchValues.push(matchValue[0].label);
|
|
86
74
|
}
|
|
87
75
|
}
|
|
88
|
-
});
|
|
89
|
-
|
|
76
|
+
});
|
|
77
|
+
// 如果 select 配置选项展示内容,则直接使用其配置值展示当前只读信息
|
|
90
78
|
if (selectOptionRender) {
|
|
91
79
|
return /*#__PURE__*/React.createElement("div", {
|
|
92
80
|
className: "checkbox-viewonly-list"
|
|
93
81
|
}, matchValues);
|
|
94
82
|
}
|
|
95
|
-
|
|
96
83
|
return matchValues.join(separator ? separator : ',');
|
|
97
84
|
} else {
|
|
98
85
|
// 如select配置labelInValue则value返回数据是对象{key: 'xxx'}
|
|
99
86
|
var matchValue = selectOptions.filter(function (seItem) {
|
|
100
87
|
return seItem.value == (labelInValue ? value.value : value);
|
|
101
|
-
});
|
|
102
|
-
|
|
88
|
+
});
|
|
89
|
+
// 如果 select 配置选项展示内容,则直接使用其配置值展示当前只读信息
|
|
103
90
|
if (selectOptionRender) {
|
|
104
91
|
return matchValue.length > 0 ? selectOptionRender(matchValue[0]) : '-';
|
|
105
92
|
}
|
|
106
|
-
|
|
107
93
|
return matchValue.length > 0 ? matchValue[0].label : '-';
|
|
108
94
|
}
|
|
109
|
-
};
|
|
110
|
-
|
|
111
|
-
|
|
95
|
+
};
|
|
96
|
+
// 设置纯展示模式下的日期控件值
|
|
112
97
|
var setDatePickerValue = function setDatePickerValue(value, props) {
|
|
113
98
|
var type = props.type,
|
|
114
|
-
|
|
99
|
+
protoConfig = props.protoConfig;
|
|
115
100
|
if (!value && value !== 0) return '-'; // 无值情况 下
|
|
116
101
|
// 数组情况 'YYYY-MM-DD HH:mm:ss' : 'YYYY-MM-DD'
|
|
117
|
-
|
|
118
102
|
switch (type) {
|
|
119
103
|
case 'datePicker':
|
|
120
104
|
return moment(value).format(protoConfig && protoConfig.format || 'YYYY-MM-DD');
|
|
121
105
|
break;
|
|
122
|
-
|
|
123
106
|
case 'dateTimePicker':
|
|
124
107
|
return moment(value).format(protoConfig && protoConfig.format || 'YYYY-MM-DD HH:mm:ss');
|
|
125
108
|
break;
|
|
126
|
-
|
|
127
109
|
case 'rangePicker':
|
|
128
110
|
return "".concat(moment(value[0]).format(protoConfig && protoConfig.format || 'YYYY-MM-DD'), " - ").concat(moment(value[1]).format(protoConfig && protoConfig.format || 'YYYY-MM-DD'));
|
|
129
111
|
break;
|
|
130
|
-
|
|
131
112
|
case 'rangeTimePicker':
|
|
132
113
|
return "".concat(moment(value[0]).format(protoConfig && protoConfig.format || 'YYYY-MM-DD HH:mm:ss'), " - ").concat(moment(value[1]).format(protoConfig && protoConfig.format || 'YYYY-MM-DD HH:mm:ss'));
|
|
133
114
|
break;
|
|
134
|
-
|
|
135
115
|
case 'monthPicker':
|
|
136
116
|
return moment(value).format(protoConfig && protoConfig.format || 'MM月');
|
|
137
117
|
break;
|
|
138
|
-
|
|
139
118
|
default:
|
|
140
119
|
return '-';
|
|
141
120
|
break;
|
|
142
121
|
}
|
|
143
|
-
};
|
|
144
|
-
|
|
122
|
+
};
|
|
145
123
|
|
|
124
|
+
// 设置纯展示模式下的时间控件值
|
|
146
125
|
var setTimePickerValue = function setTimePickerValue(value, props) {
|
|
147
126
|
var type = props.type,
|
|
148
|
-
|
|
127
|
+
protoConfig = props.protoConfig;
|
|
149
128
|
if (!value && value !== 0) return '-'; // 无值情况 下
|
|
150
|
-
|
|
151
129
|
switch (type) {
|
|
152
130
|
case 'timePicker':
|
|
153
131
|
return moment(value).format(protoConfig && protoConfig.format || 'HH:mm:ss');
|
|
154
132
|
break;
|
|
155
|
-
|
|
156
133
|
case 'timePickerRange':
|
|
157
134
|
return "".concat(moment(value[0]).format(protoConfig && protoConfig.format || 'HH:mm:ss'), " - ").concat(moment(value[1]).format(protoConfig && protoConfig.format || 'HH:mm:ss'));
|
|
158
135
|
break;
|
|
159
|
-
|
|
160
136
|
default:
|
|
161
137
|
return '-';
|
|
162
138
|
break;
|
|
163
139
|
}
|
|
164
|
-
};
|
|
165
|
-
|
|
166
|
-
|
|
140
|
+
};
|
|
141
|
+
// 设置纯展示模式下上传控件显示值
|
|
167
142
|
var setUploaderValue = function setUploaderValue(value, props) {
|
|
168
143
|
if (!value && value !== 0) return '-'; // 无值情况 下
|
|
169
|
-
|
|
170
144
|
if (Array.isArray(value)) {
|
|
171
145
|
var _useState = useState(),
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
146
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
147
|
+
previews = _useState2[0],
|
|
148
|
+
setPreviews = _useState2[1];
|
|
176
149
|
useEffect(function () {
|
|
177
150
|
var previewsUlr = [];
|
|
178
151
|
value.forEach(function (vItem) {
|
|
@@ -212,10 +185,9 @@ var setUploaderValue = function setUploaderValue(value, props) {
|
|
|
212
185
|
}))));
|
|
213
186
|
} else {
|
|
214
187
|
var _useState3 = useState(),
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
188
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
189
|
+
preview = _useState4[0],
|
|
190
|
+
setPreview = _useState4[1];
|
|
219
191
|
useEffect(function () {
|
|
220
192
|
getBase64(value).then(function (result) {
|
|
221
193
|
setPreview(result);
|
|
@@ -232,5 +204,4 @@ var setUploaderValue = function setUploaderValue(value, props) {
|
|
|
232
204
|
}) : '暂无图片');
|
|
233
205
|
}
|
|
234
206
|
};
|
|
235
|
-
|
|
236
207
|
export { setCascaderValue, setSelectValue, setDatePickerValue, setTimePickerValue, setUploaderValue };
|
|
@@ -6,65 +6,54 @@ import "antd/es/col/style";
|
|
|
6
6
|
import _Col from "antd/es/col";
|
|
7
7
|
import "antd/es/form/style";
|
|
8
8
|
import _Form from "antd/es/form";
|
|
9
|
-
|
|
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); }
|
|
11
|
-
|
|
9
|
+
function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
|
|
12
10
|
import React from "react";
|
|
13
11
|
import { general } from '../../data';
|
|
14
12
|
import Field from '../FieldComponent';
|
|
15
13
|
import SpecIcon from '../../SpecIcon';
|
|
16
14
|
var FormItem = _Form.Item;
|
|
17
|
-
|
|
18
15
|
var RenderItemGroup = function RenderItemGroup(props) {
|
|
19
16
|
var itemGroup = props.itemGroup,
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
17
|
+
_props$size = props.size,
|
|
18
|
+
size = _props$size === void 0 ? 'md' : _props$size,
|
|
19
|
+
_props$fieldStatus = props.fieldStatus,
|
|
20
|
+
fieldStatus = _props$fieldStatus === void 0 ? 'default' : _props$fieldStatus,
|
|
21
|
+
_props$fieldSize = props.fieldSize,
|
|
22
|
+
fieldSize = _props$fieldSize === void 0 ? 'middle' : _props$fieldSize,
|
|
23
|
+
displayLayout = props.displayLayout,
|
|
24
|
+
form = props.form,
|
|
25
|
+
doUpdateFormFields = props.doUpdateFormFields,
|
|
26
|
+
_props$layout = props.layout,
|
|
27
|
+
layout = _props$layout === void 0 ? "horizontal" : _props$layout;
|
|
32
28
|
var setColSpan = function setColSpan(display, modalSize) {
|
|
33
29
|
if (_typeof(display) === 'object' || display === 'block' || modalSize === 'xs' || modalSize === 'sm') {
|
|
34
30
|
return 24;
|
|
35
31
|
}
|
|
36
|
-
|
|
37
32
|
if (modalSize === 'lg' || modalSize === 'xlg') {
|
|
38
33
|
return 8;
|
|
39
34
|
}
|
|
40
|
-
|
|
41
35
|
return 12;
|
|
42
36
|
};
|
|
43
|
-
|
|
44
37
|
var updateFormFields = function updateFormFields() {
|
|
45
38
|
// if (newVal) form && form.setFieldsValue({ ...newVal })
|
|
46
39
|
if (doUpdateFormFields) doUpdateFormFields(); // 用于触发更新表单实例赋值
|
|
47
|
-
};
|
|
40
|
+
};
|
|
41
|
+
// useEffect(() => {
|
|
48
42
|
// // updateFormFields()
|
|
49
43
|
// }, [form])
|
|
50
44
|
// 渲染隐藏指定控件
|
|
51
|
-
|
|
52
|
-
|
|
53
45
|
var itemIsHide = function itemIsHide(isHide, getFieldsValue, FormInstance) {
|
|
54
46
|
if (typeof isHide === 'function') {
|
|
55
47
|
return isHide(getFieldsValue, FormInstance, fieldStatus);
|
|
56
48
|
}
|
|
57
|
-
|
|
58
49
|
return isHide || false;
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
|
|
50
|
+
};
|
|
51
|
+
// 渲染表单控件
|
|
62
52
|
var renderFormField = function renderFormField(field) {
|
|
63
53
|
var componentStyle = field.componentStyle,
|
|
64
|
-
|
|
65
|
-
|
|
54
|
+
extra = field.extra,
|
|
55
|
+
preExtra = field.preExtra; // 当前可传参的配置值
|
|
66
56
|
// 带前缀或后缀控件渲染
|
|
67
|
-
|
|
68
57
|
if (preExtra || extra) {
|
|
69
58
|
return /*#__PURE__*/React.createElement(React.Fragment, null, preExtra ? preExtra(field, form) : '', /*#__PURE__*/React.createElement(FormItem, {
|
|
70
59
|
noStyle: true,
|
|
@@ -73,11 +62,9 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
73
62
|
}, /*#__PURE__*/React.createElement(Field, Object.assign({}, field, {
|
|
74
63
|
onChange: function onChange(eOrValue) {
|
|
75
64
|
updateFormFields();
|
|
76
|
-
|
|
77
65
|
for (var _len = arguments.length, otherParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
78
66
|
otherParams[_key - 1] = arguments[_key];
|
|
79
67
|
}
|
|
80
|
-
|
|
81
68
|
if (field.onChange) field.onChange.apply(field, [eOrValue].concat(otherParams));
|
|
82
69
|
},
|
|
83
70
|
fieldStatus: field.fieldStatus || fieldStatus,
|
|
@@ -92,12 +79,11 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
92
79
|
// updateValue = val.target.value
|
|
93
80
|
// }
|
|
94
81
|
// updateFormFields({ [field.filedName]: updateValue })
|
|
95
|
-
updateFormFields();
|
|
96
|
-
|
|
82
|
+
updateFormFields();
|
|
83
|
+
// if (field.onChange) field.onChange(val, form)
|
|
97
84
|
for (var _len2 = arguments.length, otherParams = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
98
85
|
otherParams[_key2 - 1] = arguments[_key2];
|
|
99
86
|
}
|
|
100
|
-
|
|
101
87
|
if (field.onChange) field.onChange.apply(field, [eOrValue].concat(otherParams));
|
|
102
88
|
},
|
|
103
89
|
fieldStatus: field.fieldStatus || fieldStatus,
|
|
@@ -106,14 +92,12 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
106
92
|
}));
|
|
107
93
|
}
|
|
108
94
|
};
|
|
109
|
-
|
|
110
95
|
var renderColFormItem = function renderColFormItem(item, index, formLayout) {
|
|
111
96
|
var label = item.label,
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
97
|
+
description = item.description,
|
|
98
|
+
type = item.type,
|
|
99
|
+
customRender = item.customRender,
|
|
100
|
+
filedName = item.filedName; // 当前可传参的配置值
|
|
117
101
|
if (layout === "horizontal") {
|
|
118
102
|
return /*#__PURE__*/React.createElement(_Col, {
|
|
119
103
|
key: index,
|
|
@@ -144,62 +128,56 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
144
128
|
rules: item.rules || (item.fieldOptions ? item.fieldOptions.rules : [])
|
|
145
129
|
}, formLayout, item.protoFormItem), type === 'custom' && customRender ? customRender(form, Object.assign({}, item), fieldStatus) : renderFormField(Object.assign({}, item)));
|
|
146
130
|
}
|
|
147
|
-
};
|
|
148
|
-
|
|
149
|
-
|
|
131
|
+
};
|
|
132
|
+
// 渲染表单控件列表
|
|
150
133
|
var renderItemGroupNode = function renderItemGroupNode() {
|
|
151
134
|
return itemGroup.map(function (item, index) {
|
|
152
135
|
var label = item.label,
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
136
|
+
isHide = item.isHide,
|
|
137
|
+
type = item.type,
|
|
138
|
+
_item$display = item.display,
|
|
139
|
+
display = _item$display === void 0 ? 'side' : _item$display; // 当前可传参的配置值
|
|
140
|
+
var formLayout = {};
|
|
141
|
+
// if (displayLayout) {
|
|
159
142
|
// // 如果未配置,则使用以下配置值
|
|
160
143
|
// formLayout = { ...displayLayout }
|
|
161
144
|
// }
|
|
162
145
|
// 优先级 displayLayout.side > displayLayout > general
|
|
163
146
|
// 优先级:若有displayLayout.block 则直接使用 general > displayLayout
|
|
164
|
-
|
|
165
147
|
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.side) || ((displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) ? general.modalSize[size].formLayout : !displayLayout || JSON.stringify(displayLayout) === '{}' ? general.modalSize[size].formLayout : displayLayout);
|
|
166
|
-
|
|
167
148
|
if (item.hasOwnProperty('display')) {
|
|
168
149
|
if (typeof display === 'string') {
|
|
169
150
|
if (display === 'block') {
|
|
170
151
|
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) || general.modalSize[size].formBlockLayout;
|
|
171
|
-
} else {
|
|
152
|
+
} else {
|
|
153
|
+
// 使用默认
|
|
172
154
|
// formLayout = displayLayout?.side || (displayLayout?.block ? general.modalSize[size].formLayout : displayLayout) || general.modalSize[size].formLayout
|
|
173
155
|
}
|
|
174
156
|
} else {
|
|
175
157
|
formLayout = item.display; // 对象类型传值如: {labelCol: {span: 3},wrapperCol: {span: 8}} 优先级最高
|
|
176
158
|
}
|
|
177
|
-
}
|
|
178
|
-
|
|
179
|
-
|
|
159
|
+
}
|
|
160
|
+
// 当布局为 'vertical'或'inline'时,不配置栅格结构
|
|
180
161
|
if (layout !== 'horizontal') {
|
|
181
162
|
formLayout = {};
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
|
|
163
|
+
}
|
|
164
|
+
// title标题或html渲染
|
|
185
165
|
if (type === 'title' || type === 'html') {
|
|
186
166
|
return /*#__PURE__*/React.createElement(FormItem, {
|
|
187
167
|
key: index,
|
|
188
168
|
noStyle: true,
|
|
189
169
|
shouldUpdate: true
|
|
190
170
|
}, function (FormInstance) {
|
|
191
|
-
var _a;
|
|
192
|
-
|
|
193
|
-
|
|
171
|
+
var _a;
|
|
172
|
+
// isHide 返回为true则隐藏当前控件
|
|
194
173
|
return !itemIsHide(isHide, FormInstance.getFieldValue(), FormInstance) ? /*#__PURE__*/React.createElement(_Col, {
|
|
195
174
|
span: item.colSpan || 24
|
|
196
175
|
}, type === 'title' ? /*#__PURE__*/React.createElement("h3", Object.assign({}, item.protoConfig, {
|
|
197
176
|
className: "modalPanelTitle ".concat(((_a = item === null || item === void 0 ? void 0 : item.protoConfig) === null || _a === void 0 ? void 0 : _a.className) || '')
|
|
198
177
|
}), label) : label) : /*#__PURE__*/React.createElement(React.Fragment, null, null);
|
|
199
178
|
});
|
|
200
|
-
}
|
|
201
|
-
|
|
202
|
-
|
|
179
|
+
}
|
|
180
|
+
// 判断是否强制重新渲染表单
|
|
203
181
|
if (item.protoFormItem && item.protoFormItem.shouldUpdate) {
|
|
204
182
|
return /*#__PURE__*/React.createElement(FormItem, {
|
|
205
183
|
key: index,
|
|
@@ -210,25 +188,19 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
210
188
|
return !itemIsHide(isHide, FormInstance.getFieldValue(), FormInstance) ? renderColFormItem(item, index, formLayout) : null;
|
|
211
189
|
});
|
|
212
190
|
}
|
|
213
|
-
|
|
214
191
|
return renderColFormItem(item, index, formLayout);
|
|
215
192
|
});
|
|
216
|
-
};
|
|
217
|
-
|
|
218
|
-
|
|
193
|
+
};
|
|
194
|
+
// itemGroup = Array 则按以下结构渲染
|
|
219
195
|
if (itemGroup && Array.isArray(itemGroup)) {
|
|
220
196
|
// 布局配置为'vertical或inline'
|
|
221
197
|
if (layout !== 'horizontal') {
|
|
222
198
|
return renderItemGroupNode();
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
|
|
199
|
+
}
|
|
200
|
+
// 布局配置为horizontal
|
|
226
201
|
return /*#__PURE__*/React.createElement(_Row, null, renderItemGroupNode());
|
|
227
202
|
}
|
|
228
203
|
/* itemGroup = ReactNode则直接返回 */
|
|
229
|
-
|
|
230
|
-
|
|
231
204
|
return itemGroup;
|
|
232
205
|
};
|
|
233
|
-
|
|
234
206
|
export default RenderItemGroup;
|