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
|
@@ -4,87 +4,63 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.default = void 0;
|
|
7
|
-
|
|
8
7
|
require("antd/es/row/style");
|
|
9
|
-
|
|
10
8
|
var _row = _interopRequireDefault(require("antd/es/row"));
|
|
11
|
-
|
|
12
9
|
require("antd/es/tooltip/style");
|
|
13
|
-
|
|
14
10
|
var _tooltip = _interopRequireDefault(require("antd/es/tooltip"));
|
|
15
|
-
|
|
16
11
|
require("antd/es/col/style");
|
|
17
|
-
|
|
18
12
|
var _col = _interopRequireDefault(require("antd/es/col"));
|
|
19
|
-
|
|
20
13
|
require("antd/es/form/style");
|
|
21
|
-
|
|
22
14
|
var _form = _interopRequireDefault(require("antd/es/form"));
|
|
23
|
-
|
|
24
15
|
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
16
|
var _data = require("../../data");
|
|
27
|
-
|
|
28
17
|
var _FieldComponent = _interopRequireDefault(require("../FieldComponent"));
|
|
29
|
-
|
|
30
18
|
var _SpecIcon = _interopRequireDefault(require("../../SpecIcon"));
|
|
31
|
-
|
|
32
19
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
33
|
-
|
|
34
|
-
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); }
|
|
35
|
-
|
|
20
|
+
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); }
|
|
36
21
|
var FormItem = _form.default.Item;
|
|
37
|
-
|
|
38
22
|
var RenderItemGroup = function RenderItemGroup(props) {
|
|
39
23
|
var itemGroup = props.itemGroup,
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
24
|
+
_props$size = props.size,
|
|
25
|
+
size = _props$size === void 0 ? 'md' : _props$size,
|
|
26
|
+
_props$fieldStatus = props.fieldStatus,
|
|
27
|
+
fieldStatus = _props$fieldStatus === void 0 ? 'default' : _props$fieldStatus,
|
|
28
|
+
_props$fieldSize = props.fieldSize,
|
|
29
|
+
fieldSize = _props$fieldSize === void 0 ? 'middle' : _props$fieldSize,
|
|
30
|
+
displayLayout = props.displayLayout,
|
|
31
|
+
form = props.form,
|
|
32
|
+
doUpdateFormFields = props.doUpdateFormFields,
|
|
33
|
+
_props$layout = props.layout,
|
|
34
|
+
layout = _props$layout === void 0 ? "horizontal" : _props$layout;
|
|
52
35
|
var setColSpan = function setColSpan(display, modalSize) {
|
|
53
36
|
if (_typeof(display) === 'object' || display === 'block' || modalSize === 'xs' || modalSize === 'sm') {
|
|
54
37
|
return 24;
|
|
55
38
|
}
|
|
56
|
-
|
|
57
39
|
if (modalSize === 'lg' || modalSize === 'xlg') {
|
|
58
40
|
return 8;
|
|
59
41
|
}
|
|
60
|
-
|
|
61
42
|
return 12;
|
|
62
43
|
};
|
|
63
|
-
|
|
64
44
|
var updateFormFields = function updateFormFields() {
|
|
65
45
|
// if (newVal) form && form.setFieldsValue({ ...newVal })
|
|
66
46
|
if (doUpdateFormFields) doUpdateFormFields(); // 用于触发更新表单实例赋值
|
|
67
|
-
};
|
|
47
|
+
};
|
|
48
|
+
// useEffect(() => {
|
|
68
49
|
// // updateFormFields()
|
|
69
50
|
// }, [form])
|
|
70
51
|
// 渲染隐藏指定控件
|
|
71
|
-
|
|
72
|
-
|
|
73
52
|
var itemIsHide = function itemIsHide(isHide, getFieldsValue, FormInstance) {
|
|
74
53
|
if (typeof isHide === 'function') {
|
|
75
54
|
return isHide(getFieldsValue, FormInstance, fieldStatus);
|
|
76
55
|
}
|
|
77
|
-
|
|
78
56
|
return isHide || false;
|
|
79
|
-
};
|
|
80
|
-
|
|
81
|
-
|
|
57
|
+
};
|
|
58
|
+
// 渲染表单控件
|
|
82
59
|
var renderFormField = function renderFormField(field) {
|
|
83
60
|
var componentStyle = field.componentStyle,
|
|
84
|
-
|
|
85
|
-
|
|
61
|
+
extra = field.extra,
|
|
62
|
+
preExtra = field.preExtra; // 当前可传参的配置值
|
|
86
63
|
// 带前缀或后缀控件渲染
|
|
87
|
-
|
|
88
64
|
if (preExtra || extra) {
|
|
89
65
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, preExtra ? preExtra(field, form) : '', /*#__PURE__*/_react.default.createElement(FormItem, {
|
|
90
66
|
noStyle: true,
|
|
@@ -93,11 +69,9 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
93
69
|
}, /*#__PURE__*/_react.default.createElement(_FieldComponent.default, Object.assign({}, field, {
|
|
94
70
|
onChange: function onChange(eOrValue) {
|
|
95
71
|
updateFormFields();
|
|
96
|
-
|
|
97
72
|
for (var _len = arguments.length, otherParams = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
|
|
98
73
|
otherParams[_key - 1] = arguments[_key];
|
|
99
74
|
}
|
|
100
|
-
|
|
101
75
|
if (field.onChange) field.onChange.apply(field, [eOrValue].concat(otherParams));
|
|
102
76
|
},
|
|
103
77
|
fieldStatus: field.fieldStatus || fieldStatus,
|
|
@@ -112,12 +86,11 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
112
86
|
// updateValue = val.target.value
|
|
113
87
|
// }
|
|
114
88
|
// updateFormFields({ [field.filedName]: updateValue })
|
|
115
|
-
updateFormFields();
|
|
116
|
-
|
|
89
|
+
updateFormFields();
|
|
90
|
+
// if (field.onChange) field.onChange(val, form)
|
|
117
91
|
for (var _len2 = arguments.length, otherParams = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
|
|
118
92
|
otherParams[_key2 - 1] = arguments[_key2];
|
|
119
93
|
}
|
|
120
|
-
|
|
121
94
|
if (field.onChange) field.onChange.apply(field, [eOrValue].concat(otherParams));
|
|
122
95
|
},
|
|
123
96
|
fieldStatus: field.fieldStatus || fieldStatus,
|
|
@@ -126,14 +99,12 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
126
99
|
}));
|
|
127
100
|
}
|
|
128
101
|
};
|
|
129
|
-
|
|
130
102
|
var renderColFormItem = function renderColFormItem(item, index, formLayout) {
|
|
131
103
|
var label = item.label,
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
104
|
+
description = item.description,
|
|
105
|
+
type = item.type,
|
|
106
|
+
customRender = item.customRender,
|
|
107
|
+
filedName = item.filedName; // 当前可传参的配置值
|
|
137
108
|
if (layout === "horizontal") {
|
|
138
109
|
return /*#__PURE__*/_react.default.createElement(_col.default, {
|
|
139
110
|
key: index,
|
|
@@ -164,62 +135,56 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
164
135
|
rules: item.rules || (item.fieldOptions ? item.fieldOptions.rules : [])
|
|
165
136
|
}, formLayout, item.protoFormItem), type === 'custom' && customRender ? customRender(form, Object.assign({}, item), fieldStatus) : renderFormField(Object.assign({}, item)));
|
|
166
137
|
}
|
|
167
|
-
};
|
|
168
|
-
|
|
169
|
-
|
|
138
|
+
};
|
|
139
|
+
// 渲染表单控件列表
|
|
170
140
|
var renderItemGroupNode = function renderItemGroupNode() {
|
|
171
141
|
return itemGroup.map(function (item, index) {
|
|
172
142
|
var label = item.label,
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
143
|
+
isHide = item.isHide,
|
|
144
|
+
type = item.type,
|
|
145
|
+
_item$display = item.display,
|
|
146
|
+
display = _item$display === void 0 ? 'side' : _item$display; // 当前可传参的配置值
|
|
147
|
+
var formLayout = {};
|
|
148
|
+
// if (displayLayout) {
|
|
179
149
|
// // 如果未配置,则使用以下配置值
|
|
180
150
|
// formLayout = { ...displayLayout }
|
|
181
151
|
// }
|
|
182
152
|
// 优先级 displayLayout.side > displayLayout > general
|
|
183
153
|
// 优先级:若有displayLayout.block 则直接使用 general > displayLayout
|
|
184
|
-
|
|
185
154
|
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.side) || ((displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) ? _data.general.modalSize[size].formLayout : !displayLayout || JSON.stringify(displayLayout) === '{}' ? _data.general.modalSize[size].formLayout : displayLayout);
|
|
186
|
-
|
|
187
155
|
if (item.hasOwnProperty('display')) {
|
|
188
156
|
if (typeof display === 'string') {
|
|
189
157
|
if (display === 'block') {
|
|
190
158
|
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) || _data.general.modalSize[size].formBlockLayout;
|
|
191
|
-
} else {
|
|
159
|
+
} else {
|
|
160
|
+
// 使用默认
|
|
192
161
|
// formLayout = displayLayout?.side || (displayLayout?.block ? general.modalSize[size].formLayout : displayLayout) || general.modalSize[size].formLayout
|
|
193
162
|
}
|
|
194
163
|
} else {
|
|
195
164
|
formLayout = item.display; // 对象类型传值如: {labelCol: {span: 3},wrapperCol: {span: 8}} 优先级最高
|
|
196
165
|
}
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
|
|
166
|
+
}
|
|
167
|
+
// 当布局为 'vertical'或'inline'时,不配置栅格结构
|
|
200
168
|
if (layout !== 'horizontal') {
|
|
201
169
|
formLayout = {};
|
|
202
|
-
}
|
|
203
|
-
|
|
204
|
-
|
|
170
|
+
}
|
|
171
|
+
// title标题或html渲染
|
|
205
172
|
if (type === 'title' || type === 'html') {
|
|
206
173
|
return /*#__PURE__*/_react.default.createElement(FormItem, {
|
|
207
174
|
key: index,
|
|
208
175
|
noStyle: true,
|
|
209
176
|
shouldUpdate: true
|
|
210
177
|
}, function (FormInstance) {
|
|
211
|
-
var _a;
|
|
212
|
-
|
|
213
|
-
|
|
178
|
+
var _a;
|
|
179
|
+
// isHide 返回为true则隐藏当前控件
|
|
214
180
|
return !itemIsHide(isHide, FormInstance.getFieldValue(), FormInstance) ? /*#__PURE__*/_react.default.createElement(_col.default, {
|
|
215
181
|
span: item.colSpan || 24
|
|
216
182
|
}, type === 'title' ? /*#__PURE__*/_react.default.createElement("h3", Object.assign({}, item.protoConfig, {
|
|
217
183
|
className: "modalPanelTitle ".concat(((_a = item === null || item === void 0 ? void 0 : item.protoConfig) === null || _a === void 0 ? void 0 : _a.className) || '')
|
|
218
184
|
}), label) : label) : /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, null);
|
|
219
185
|
});
|
|
220
|
-
}
|
|
221
|
-
|
|
222
|
-
|
|
186
|
+
}
|
|
187
|
+
// 判断是否强制重新渲染表单
|
|
223
188
|
if (item.protoFormItem && item.protoFormItem.shouldUpdate) {
|
|
224
189
|
return /*#__PURE__*/_react.default.createElement(FormItem, {
|
|
225
190
|
key: index,
|
|
@@ -230,26 +195,20 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
230
195
|
return !itemIsHide(isHide, FormInstance.getFieldValue(), FormInstance) ? renderColFormItem(item, index, formLayout) : null;
|
|
231
196
|
});
|
|
232
197
|
}
|
|
233
|
-
|
|
234
198
|
return renderColFormItem(item, index, formLayout);
|
|
235
199
|
});
|
|
236
|
-
};
|
|
237
|
-
|
|
238
|
-
|
|
200
|
+
};
|
|
201
|
+
// itemGroup = Array 则按以下结构渲染
|
|
239
202
|
if (itemGroup && Array.isArray(itemGroup)) {
|
|
240
203
|
// 布局配置为'vertical或inline'
|
|
241
204
|
if (layout !== 'horizontal') {
|
|
242
205
|
return renderItemGroupNode();
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
|
|
206
|
+
}
|
|
207
|
+
// 布局配置为horizontal
|
|
246
208
|
return /*#__PURE__*/_react.default.createElement(_row.default, null, renderItemGroupNode());
|
|
247
209
|
}
|
|
248
210
|
/* itemGroup = ReactNode则直接返回 */
|
|
249
|
-
|
|
250
|
-
|
|
251
211
|
return itemGroup;
|
|
252
212
|
};
|
|
253
|
-
|
|
254
213
|
var _default = RenderItemGroup;
|
|
255
214
|
exports.default = _default;
|
|
@@ -1,103 +1,71 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
-
function _typeof(
|
|
4
|
-
|
|
3
|
+
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); }
|
|
5
4
|
Object.defineProperty(exports, "__esModule", {
|
|
6
5
|
value: true
|
|
7
6
|
});
|
|
8
7
|
exports.default = void 0;
|
|
9
|
-
|
|
10
8
|
require("antd/es/upload/style");
|
|
11
|
-
|
|
12
9
|
var _upload = _interopRequireDefault(require("antd/es/upload"));
|
|
13
|
-
|
|
14
10
|
require("antd/es/button/style");
|
|
15
|
-
|
|
16
11
|
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
17
|
-
|
|
18
12
|
require("antd/es/message/style");
|
|
19
|
-
|
|
20
13
|
var _message2 = _interopRequireDefault(require("antd/es/message"));
|
|
21
|
-
|
|
22
14
|
var _tslib = require("tslib");
|
|
23
|
-
|
|
24
15
|
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
-
|
|
26
16
|
var _icons = require("@ant-design/icons");
|
|
27
|
-
|
|
28
17
|
var _util = require("./util");
|
|
29
|
-
|
|
30
18
|
var _StandardModal = _interopRequireDefault(require("../../StandardModal"));
|
|
31
|
-
|
|
32
|
-
function
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
19
|
+
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
20
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
36
21
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
|
37
|
-
|
|
38
22
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
39
|
-
|
|
40
23
|
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
41
|
-
|
|
42
|
-
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); }
|
|
43
|
-
|
|
24
|
+
function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
|
|
44
25
|
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
|
|
45
|
-
|
|
46
26
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
47
|
-
|
|
48
27
|
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."); }
|
|
49
|
-
|
|
50
28
|
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); }
|
|
51
|
-
|
|
52
29
|
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; }
|
|
53
|
-
|
|
54
|
-
function
|
|
55
|
-
|
|
56
|
-
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
57
|
-
|
|
30
|
+
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; } }
|
|
31
|
+
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } // import RcUpload from 'rc-upload';
|
|
58
32
|
var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
59
33
|
var accept = props.accept,
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
34
|
+
extraExt = props.extraExt,
|
|
35
|
+
fileType = props.fileType,
|
|
36
|
+
className = props.className,
|
|
37
|
+
isOnly = props.isOnly,
|
|
38
|
+
children = props.children,
|
|
39
|
+
onChange = props.onChange,
|
|
40
|
+
value = props.value,
|
|
41
|
+
_props$size = props.size,
|
|
42
|
+
size = _props$size === void 0 ? 2 * 1024 * 1024 : _props$size,
|
|
43
|
+
_props$modalSize = props.modalSize,
|
|
44
|
+
modalSize = _props$modalSize === void 0 ? 'md' : _props$modalSize,
|
|
45
|
+
_props$modalConfig = props.modalConfig,
|
|
46
|
+
modalConfig = _props$modalConfig === void 0 ? {} : _props$modalConfig,
|
|
47
|
+
onPreview = props.onPreview,
|
|
48
|
+
beforeUpload = props.beforeUpload,
|
|
49
|
+
limit = props.limit; // 图片预览数据
|
|
77
50
|
var _useState = (0, _react.useState)({
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
51
|
+
visible: false,
|
|
52
|
+
url: ''
|
|
53
|
+
}),
|
|
54
|
+
_useState2 = _slicedToArray(_useState, 2),
|
|
55
|
+
showConfig = _useState2[0],
|
|
56
|
+
setShowConfig = _useState2[1]; // 用于展示的缩略图
|
|
86
57
|
var _useState3 = (0, _react.useState)([]),
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
58
|
+
_useState4 = _slicedToArray(_useState3, 2),
|
|
59
|
+
fileList = _useState4[0],
|
|
60
|
+
setFileList = _useState4[1];
|
|
91
61
|
(0, _react.useEffect)(function () {
|
|
92
62
|
if (!value) {
|
|
93
63
|
setFileList([]);
|
|
94
64
|
return;
|
|
95
65
|
}
|
|
96
|
-
|
|
97
66
|
var S4 = function S4() {
|
|
98
67
|
return ((1 + Math.random()) * 0x10000 | 0).toString(16).substring(1);
|
|
99
68
|
};
|
|
100
|
-
|
|
101
69
|
if (Object.prototype.toString.call(value) === '[object Array]') {
|
|
102
70
|
setFileList(value.map(function (file, index) {
|
|
103
71
|
file.uid = file.uid || "".concat(S4(), "-").concat(S4());
|
|
@@ -107,7 +75,6 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
107
75
|
}));
|
|
108
76
|
return;
|
|
109
77
|
}
|
|
110
|
-
|
|
111
78
|
if (Object.prototype.toString.call(value) === '[object Object]') {
|
|
112
79
|
setFileList([Object.assign({
|
|
113
80
|
uid: "".concat(S4(), "-").concat(S4()),
|
|
@@ -116,7 +83,6 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
116
83
|
}, value)]);
|
|
117
84
|
return;
|
|
118
85
|
}
|
|
119
|
-
|
|
120
86
|
if (Object.prototype.toString.call(value) === '[object String]') {
|
|
121
87
|
setFileList([{
|
|
122
88
|
uid: "".concat(S4(), "-").concat(S4()),
|
|
@@ -129,18 +95,15 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
129
95
|
}, [value]);
|
|
130
96
|
var splitAccept = (0, _react.useMemo)(function () {
|
|
131
97
|
var res = (0, _util.getAccept)(fileType);
|
|
132
|
-
|
|
133
98
|
if (extraExt) {
|
|
134
99
|
res = res + ',' + extraExt;
|
|
135
100
|
}
|
|
136
|
-
|
|
137
101
|
if (accept) {
|
|
138
102
|
res = res + ',' + accept;
|
|
139
103
|
}
|
|
140
|
-
|
|
141
104
|
return res;
|
|
142
|
-
}, [fileType, extraExt]);
|
|
143
|
-
|
|
105
|
+
}, [fileType, extraExt]);
|
|
106
|
+
// 点击文件链接或预览图标时的回调
|
|
144
107
|
var handlePreview = (0, _react.useCallback)(function (file) {
|
|
145
108
|
return (0, _tslib.__awaiter)(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
146
109
|
var res;
|
|
@@ -152,23 +115,18 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
152
115
|
_context.next = 5;
|
|
153
116
|
break;
|
|
154
117
|
}
|
|
155
|
-
|
|
156
118
|
_context.next = 3;
|
|
157
119
|
return (0, _util.getBase64)(file.originFileObj);
|
|
158
|
-
|
|
159
120
|
case 3:
|
|
160
121
|
res = _context.sent;
|
|
161
|
-
|
|
162
122
|
if (res && res.status === 'success') {
|
|
163
123
|
file.preview = res.url;
|
|
164
124
|
}
|
|
165
|
-
|
|
166
125
|
case 5:
|
|
167
126
|
setShowConfig({
|
|
168
127
|
visible: true,
|
|
169
128
|
url: file.url || file.preview
|
|
170
129
|
});
|
|
171
|
-
|
|
172
130
|
case 6:
|
|
173
131
|
case "end":
|
|
174
132
|
return _context.stop();
|
|
@@ -176,17 +134,14 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
176
134
|
}
|
|
177
135
|
}, _callee);
|
|
178
136
|
}));
|
|
179
|
-
}, [setShowConfig]);
|
|
180
|
-
|
|
137
|
+
}, [setShowConfig]);
|
|
138
|
+
// 检查文件是否规范
|
|
181
139
|
var handleCheck = (0, _react.useCallback)(function (file) {
|
|
182
140
|
var isLtSize = file.size < size;
|
|
183
|
-
|
|
184
141
|
if (!isLtSize) {
|
|
185
142
|
_message2.default.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(Math.round(size / 1024 / 1024 * 100) / 100, "MB!"));
|
|
186
|
-
|
|
187
143
|
return false;
|
|
188
144
|
}
|
|
189
|
-
|
|
190
145
|
return true;
|
|
191
146
|
}, [fileType, size]);
|
|
192
147
|
var handleChange = (0, _react.useCallback)(function (res) {
|
|
@@ -200,27 +155,22 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
200
155
|
_context2.next = 4;
|
|
201
156
|
break;
|
|
202
157
|
}
|
|
203
|
-
|
|
204
158
|
setFileList(res.fileList);
|
|
205
159
|
onChange && onChange(isOnly ? res.fileList[0] && res.fileList[0].originFileObj : res.fileList);
|
|
206
160
|
return _context2.abrupt("return");
|
|
207
|
-
|
|
208
161
|
case 4:
|
|
209
162
|
isOk = handleCheck(res.file);
|
|
210
|
-
|
|
211
163
|
if (isOk) {
|
|
212
164
|
list = res.fileList.map(function (file) {
|
|
213
165
|
if (!file.url) {
|
|
214
166
|
file.url = file.thumbUrl;
|
|
215
167
|
}
|
|
216
|
-
|
|
217
168
|
return file;
|
|
218
169
|
});
|
|
219
170
|
result = _toConsumableArray(list);
|
|
220
171
|
setFileList(list);
|
|
221
172
|
onChange && onChange(isOnly ? result[0] && result[0].originFileObj : result);
|
|
222
173
|
}
|
|
223
|
-
|
|
224
174
|
case 6:
|
|
225
175
|
case "end":
|
|
226
176
|
return _context2.stop();
|
|
@@ -228,12 +178,12 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
228
178
|
}
|
|
229
179
|
}, _callee2);
|
|
230
180
|
}));
|
|
231
|
-
}, [isOnly, handleCheck]);
|
|
232
|
-
|
|
181
|
+
}, [isOnly, handleCheck]);
|
|
182
|
+
// 渲染预览窗口
|
|
233
183
|
var renderPreviewComponent = (0, _react.useMemo)(function () {
|
|
234
184
|
if (fileType === 'image' || fileType === 'svg') {
|
|
235
185
|
var visible = showConfig.visible,
|
|
236
|
-
|
|
186
|
+
url = showConfig.url;
|
|
237
187
|
return /*#__PURE__*/_react.default.createElement(_StandardModal.default, Object.assign({
|
|
238
188
|
visible: visible,
|
|
239
189
|
hideFooter: true,
|
|
@@ -257,7 +207,6 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
257
207
|
alt: ""
|
|
258
208
|
})));
|
|
259
209
|
}
|
|
260
|
-
|
|
261
210
|
return null;
|
|
262
211
|
}, [fileType, showConfig]);
|
|
263
212
|
var renderChildrenComponent = (0, _react.useMemo)(function () {
|
|
@@ -269,20 +218,16 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
269
218
|
className: "ant-upload-text"
|
|
270
219
|
}, "\u70B9\u51FB\u9009\u62E9"));
|
|
271
220
|
}
|
|
272
|
-
|
|
273
221
|
return /*#__PURE__*/_react.default.createElement(_button.default, {
|
|
274
222
|
className: 'spec-uploader-button'
|
|
275
223
|
}, /*#__PURE__*/_react.default.createElement(_icons.PlusOutlined, null), "\u70B9\u51FB\u9009\u62E9");
|
|
276
224
|
};
|
|
277
|
-
|
|
278
225
|
if (children) {
|
|
279
226
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, " ", children, " ");
|
|
280
227
|
}
|
|
281
|
-
|
|
282
228
|
if (isOnly && fileList.length === 1 || limit && fileList.length === limit) {
|
|
283
229
|
return null;
|
|
284
230
|
}
|
|
285
|
-
|
|
286
231
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, renderButton());
|
|
287
232
|
}, [fileType, isOnly, children, fileList, limit]);
|
|
288
233
|
return /*#__PURE__*/_react.default.createElement(_react.default.Fragment, null, /*#__PURE__*/_react.default.createElement(_upload.default, Object.assign({}, props, {
|
|
@@ -298,7 +243,5 @@ var Uploader = /*#__PURE__*/_react.default.forwardRef(function (props, ref) {
|
|
|
298
243
|
onChange: handleChange
|
|
299
244
|
}), renderChildrenComponent), renderPreviewComponent);
|
|
300
245
|
}); // as IUploader
|
|
301
|
-
|
|
302
|
-
|
|
303
246
|
var _default = Uploader;
|
|
304
247
|
exports.default = _default;
|
|
@@ -3,21 +3,18 @@
|
|
|
3
3
|
Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
|
-
exports.getBase64 = getBase64;
|
|
7
6
|
exports.getAccept = getAccept;
|
|
8
|
-
|
|
7
|
+
exports.getBase64 = getBase64;
|
|
9
8
|
function getBase64(file) {
|
|
10
9
|
return new Promise(function (resolve) {
|
|
11
10
|
var reader = new FileReader();
|
|
12
11
|
reader.readAsDataURL(file);
|
|
13
|
-
|
|
14
12
|
reader.onload = function () {
|
|
15
13
|
return resolve({
|
|
16
14
|
status: 'success',
|
|
17
15
|
url: reader.result
|
|
18
16
|
});
|
|
19
17
|
};
|
|
20
|
-
|
|
21
18
|
reader.onerror = function (error) {
|
|
22
19
|
return resolve({
|
|
23
20
|
status: 'error',
|
|
@@ -26,21 +23,16 @@ function getBase64(file) {
|
|
|
26
23
|
};
|
|
27
24
|
});
|
|
28
25
|
}
|
|
29
|
-
|
|
30
26
|
function getAccept(fileType) {
|
|
31
27
|
switch (fileType) {
|
|
32
28
|
case 'image':
|
|
33
29
|
return '.jpg,.png';
|
|
34
|
-
|
|
35
30
|
case 'svg':
|
|
36
31
|
return '.svg';
|
|
37
|
-
|
|
38
32
|
case 'office':
|
|
39
33
|
return '.doc,.docx,.pdf,.xls,.xlsx';
|
|
40
|
-
|
|
41
34
|
case 'zip':
|
|
42
35
|
return '.rar,.zip';
|
|
43
|
-
|
|
44
36
|
default:
|
|
45
37
|
return '.rar,.zip,.doc,.docx,.pdf,.jpg,.png';
|
|
46
38
|
}
|