fan-standard-comp 3.1.1 → 3.1.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/fan-standard-comp.umd.js +293 -285
- package/es/ButtonGroup/ButtonList.js +18 -36
- package/es/ButtonGroup/ButtonMenu.js +14 -27
- package/es/ButtonGroup/PopConfirmTitle.js +5 -16
- package/es/ButtonGroup/index.js +76 -107
- package/es/DragContent/DragBar.js +6 -18
- package/es/DragContent/index.js +12 -30
- package/es/FormComp/ChunkUploader/api.js +8 -21
- package/es/FormComp/ChunkUploader/index.js +27 -46
- package/es/FormComp/ChunkUploader/lib.js +9 -26
- package/es/FormComp/ChunkUploader/upload-queue.class.js +5 -12
- package/es/FormComp/ChunkUploader/worker.js +2 -7
- package/es/FormComp/EditButton/index.js +16 -35
- package/es/FormComp/FieldComponent/ReUpload.js +18 -38
- package/es/FormComp/FieldComponent/RefactorTreeSelect.js +26 -49
- package/es/FormComp/FieldComponent/TitleNode.js +3 -13
- package/es/FormComp/FieldComponent/index.js +81 -125
- package/es/FormComp/FieldComponent/setReadonlyValues.js +28 -55
- package/es/FormComp/RenderItemGroup/index.js +34 -55
- package/es/FormComp/Uploader/index.js +38 -64
- package/es/FormComp/Uploader/util.js +2 -11
- package/es/FormComp/VarTemplate/index.js +31 -44
- package/es/FormComp/index.js +1 -15
- package/es/NavLeafScroll/index.js +35 -53
- package/es/RefactorTree/index.js +29 -52
- package/es/RefactorTree/indexTreeNode.js +31 -54
- package/es/RefactorTree/style/index.js +1 -3
- package/es/RefactorTree/util.js +10 -18
- package/es/SpecIcon/fonts/iconfont.js +0 -2
- package/es/SpecIcon/index.js +17 -30
- package/es/SplitterLayout/Pane.js +5 -17
- package/es/SplitterLayout/index.js +13 -24
- package/es/StandardContent/SplitterLayout/Pane.js +13 -25
- package/es/StandardContent/SplitterLayout/index.js +30 -43
- package/es/StandardContent/SubfieldContent.js +13 -28
- package/es/StandardContent/WrapperContent.js +10 -24
- package/es/StandardDragModal/index.d.ts +11 -0
- package/es/StandardDragModal/index.js +30 -0
- package/es/StandardFilter/index.js +27 -46
- package/es/StandardForm/ActionList.js +8 -21
- package/es/StandardForm/StepForm.js +40 -68
- package/es/StandardForm/TabForm.js +26 -52
- package/es/StandardForm/index.js +28 -55
- package/es/StandardModal/UpdateFormRef.js +4 -18
- package/es/StandardModal/index.d.ts +3 -0
- package/es/StandardModal/index.js +118 -119
- package/es/StandardPanel/index.js +32 -53
- package/es/StandardTable/index.js +18 -36
- package/es/StandardTable/style/index.js +1 -3
- package/es/components/IconNode/index.js +6 -17
- package/es/components/index.js +2 -15
- package/es/data/func.code.js +2 -9
- package/es/data/general.config.js +2 -9
- package/es/data/index.js +3 -23
- package/es/index.js +24 -229
- package/es/utils/ValueFormat.js +1 -9
- package/es/utils/filterPermission.js +4 -20
- package/es/utils/getParentNodes.js +1 -12
- package/es/utils/index.js +3 -35
- package/lib/ButtonGroup/ButtonList.js +9 -9
- package/lib/ButtonGroup/ButtonMenu.js +11 -11
- package/lib/ButtonGroup/PopConfirmTitle.js +5 -5
- package/lib/ButtonGroup/index.js +47 -47
- package/lib/DragContent/DragBar.js +5 -5
- package/lib/DragContent/index.js +7 -7
- package/lib/FormComp/ChunkUploader/api.js +4 -4
- package/lib/FormComp/ChunkUploader/index.js +10 -10
- package/lib/FormComp/ChunkUploader/lib.js +2 -2
- package/lib/FormComp/ChunkUploader/upload-queue.class.js +2 -2
- package/lib/FormComp/ChunkUploader/worker.js +2 -2
- package/lib/FormComp/EditButton/index.js +10 -10
- package/lib/FormComp/FieldComponent/ReUpload.js +9 -9
- package/lib/FormComp/FieldComponent/RefactorTreeSelect.js +16 -16
- package/lib/FormComp/FieldComponent/TitleNode.js +4 -4
- package/lib/FormComp/FieldComponent/index.js +41 -41
- package/lib/FormComp/FieldComponent/setReadonlyValues.js +17 -17
- package/lib/FormComp/RenderItemGroup/index.js +20 -20
- package/lib/FormComp/Uploader/index.js +16 -16
- package/lib/FormComp/VarTemplate/index.js +25 -23
- package/lib/FormComp/index.js +2 -2
- package/lib/NavLeafScroll/index.js +28 -28
- package/lib/RefactorTree/index.js +14 -14
- package/lib/RefactorTree/indexTreeNode.js +19 -19
- package/lib/SpecIcon/index.js +13 -13
- package/lib/SplitterLayout/Pane.js +4 -4
- package/lib/SplitterLayout/index.js +10 -10
- package/lib/StandardContent/SplitterLayout/Pane.js +11 -11
- package/lib/StandardContent/SplitterLayout/index.js +27 -27
- package/lib/StandardContent/SubfieldContent.js +9 -9
- package/lib/StandardContent/WrapperContent.js +7 -7
- package/lib/StandardDragModal/index.d.ts +11 -0
- package/lib/StandardDragModal/index.js +43 -0
- package/lib/StandardFilter/index.js +18 -18
- package/lib/StandardForm/ActionList.js +6 -6
- package/lib/StandardForm/StepForm.js +26 -26
- package/lib/StandardForm/TabForm.js +13 -13
- package/lib/StandardForm/index.js +14 -14
- package/lib/StandardModal/UpdateFormRef.js +4 -4
- package/lib/StandardModal/index.d.ts +3 -0
- package/lib/StandardModal/index.js +99 -70
- package/lib/StandardPanel/index.js +23 -23
- package/lib/StandardTable/index.js +9 -10
- package/lib/components/IconNode/index.js +6 -6
- package/lib/components/index.js +2 -2
- package/lib/data/func.code.js +2 -2
- package/lib/data/general.config.js +2 -2
- package/lib/data/index.js +3 -3
- package/lib/index.js +22 -22
- package/lib/utils/ValueFormat.js +2 -2
- package/lib/utils/filterPermission.js +2 -2
- package/lib/utils/index.js +2 -2
- package/package.json +4 -3
- package/es/ConfigContext/index.d.ts +0 -7
- package/es/ConfigContext/index.js +0 -12
- package/es/locale/index.d.ts +0 -12
- package/es/locale/index.js +0 -5
- package/es/locale/zh_CN.d.ts +0 -4
- package/es/locale/zh_CN.js +0 -34
- package/lib/ConfigContext/index.d.ts +0 -7
- package/lib/ConfigContext/index.js +0 -12
- package/lib/locale/index.d.ts +0 -12
- package/lib/locale/index.js +0 -5
- package/lib/locale/zh_CN.d.ts +0 -4
- package/lib/locale/zh_CN.js +0 -34
|
@@ -1,39 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
var _row = _interopRequireDefault(require("antd/es/row"));
|
|
11
|
-
|
|
12
|
-
require("antd/es/tooltip/style");
|
|
13
|
-
|
|
14
|
-
var _tooltip = _interopRequireDefault(require("antd/es/tooltip"));
|
|
15
|
-
|
|
16
|
-
require("antd/es/col/style");
|
|
17
|
-
|
|
18
|
-
var _col = _interopRequireDefault(require("antd/es/col"));
|
|
19
|
-
|
|
20
|
-
require("antd/es/form/style");
|
|
21
|
-
|
|
22
|
-
var _form = _interopRequireDefault(require("antd/es/form"));
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireDefault(require("react"));
|
|
25
|
-
|
|
26
|
-
var _data = require("../../data");
|
|
27
|
-
|
|
28
|
-
var _FieldComponent = _interopRequireDefault(require("../FieldComponent"));
|
|
29
|
-
|
|
30
|
-
var _SpecIcon = _interopRequireDefault(require("../../SpecIcon"));
|
|
31
|
-
|
|
32
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
1
|
+
import "antd/es/row/style";
|
|
2
|
+
import _Row from "antd/es/row";
|
|
3
|
+
import "antd/es/tooltip/style";
|
|
4
|
+
import _Tooltip from "antd/es/tooltip";
|
|
5
|
+
import "antd/es/col/style";
|
|
6
|
+
import _Col from "antd/es/col";
|
|
7
|
+
import "antd/es/form/style";
|
|
8
|
+
import _Form from "antd/es/form";
|
|
33
9
|
|
|
34
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); }
|
|
35
11
|
|
|
36
|
-
|
|
12
|
+
import React from "react";
|
|
13
|
+
import { general } from '../../data';
|
|
14
|
+
import Field from '../FieldComponent';
|
|
15
|
+
import SpecIcon from '../../SpecIcon';
|
|
16
|
+
var FormItem = _Form.Item;
|
|
37
17
|
|
|
38
18
|
var RenderItemGroup = function RenderItemGroup(props) {
|
|
39
19
|
var itemGroup = props.itemGroup,
|
|
@@ -86,11 +66,11 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
86
66
|
// 带前缀或后缀控件渲染
|
|
87
67
|
|
|
88
68
|
if (preExtra || extra) {
|
|
89
|
-
return /*#__PURE__*/
|
|
69
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, preExtra ? preExtra(field, form) : '', /*#__PURE__*/React.createElement(FormItem, {
|
|
90
70
|
noStyle: true,
|
|
91
71
|
rules: field.rules || (field.fieldOptions ? field.fieldOptions.rules : []),
|
|
92
72
|
name: field.filedName
|
|
93
|
-
}, /*#__PURE__*/
|
|
73
|
+
}, /*#__PURE__*/React.createElement(Field, Object.assign({}, field, {
|
|
94
74
|
onChange: function onChange(eOrValue) {
|
|
95
75
|
updateFormFields();
|
|
96
76
|
|
|
@@ -102,10 +82,10 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
102
82
|
},
|
|
103
83
|
fieldStatus: field.fieldStatus || fieldStatus,
|
|
104
84
|
size: field.protoConfig && field.protoConfig.size || field.size || fieldSize,
|
|
105
|
-
style: componentStyle || Object.assign({},
|
|
85
|
+
style: componentStyle || Object.assign({}, general.formItemStyle.wide)
|
|
106
86
|
}))), extra ? extra(field, form) : '');
|
|
107
87
|
} else {
|
|
108
|
-
return /*#__PURE__*/
|
|
88
|
+
return /*#__PURE__*/React.createElement(Field, Object.assign({}, field, {
|
|
109
89
|
onChange: function onChange(eOrValue) {
|
|
110
90
|
// let updateValue = val
|
|
111
91
|
// if (field.type === 'input' || field.type === 'textarea' || field.type === 'radio' || field.type === 'password') {
|
|
@@ -122,7 +102,7 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
122
102
|
},
|
|
123
103
|
fieldStatus: field.fieldStatus || fieldStatus,
|
|
124
104
|
size: field.protoConfig && field.protoConfig.size || field.size || fieldSize,
|
|
125
|
-
style: componentStyle || Object.assign({},
|
|
105
|
+
style: componentStyle || Object.assign({}, general.formItemStyle.wide)
|
|
126
106
|
}));
|
|
127
107
|
}
|
|
128
108
|
};
|
|
@@ -135,15 +115,15 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
135
115
|
filedName = item.filedName; // 当前可传参的配置值
|
|
136
116
|
|
|
137
117
|
if (layout === "horizontal") {
|
|
138
|
-
return /*#__PURE__*/
|
|
118
|
+
return /*#__PURE__*/React.createElement(_Col, {
|
|
139
119
|
key: index,
|
|
140
120
|
span: item.colSpan || setColSpan(item.display, size)
|
|
141
|
-
}, /*#__PURE__*/
|
|
121
|
+
}, /*#__PURE__*/React.createElement(FormItem, Object.assign({
|
|
142
122
|
name: type !== 'custom' && filedName,
|
|
143
123
|
className: fieldStatus === 'viewOnly' ? 'form-item-view-only' : '',
|
|
144
|
-
label: description ? /*#__PURE__*/
|
|
124
|
+
label: description ? /*#__PURE__*/React.createElement("span", null, label, /*#__PURE__*/React.createElement(_Tooltip, {
|
|
145
125
|
title: description
|
|
146
|
-
}, /*#__PURE__*/
|
|
126
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
147
127
|
name: "info"
|
|
148
128
|
}))) : label,
|
|
149
129
|
rules: item.preExtra || item.extra ? [] : item.rules || (item.fieldOptions ? item.fieldOptions.rules : []),
|
|
@@ -152,13 +132,13 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
152
132
|
}).length > 0
|
|
153
133
|
}, formLayout, item.protoFormItem), type === 'custom' && customRender ? customRender(form, Object.assign({}, item), fieldStatus) : renderFormField(Object.assign({}, item))));
|
|
154
134
|
} else {
|
|
155
|
-
return /*#__PURE__*/
|
|
135
|
+
return /*#__PURE__*/React.createElement(FormItem, Object.assign({
|
|
156
136
|
key: index,
|
|
157
137
|
name: type !== 'custom' && filedName,
|
|
158
138
|
className: fieldStatus === 'viewOnly' ? 'form-item-view-only' : '',
|
|
159
|
-
label: description ? /*#__PURE__*/
|
|
139
|
+
label: description ? /*#__PURE__*/React.createElement("span", null, label, /*#__PURE__*/React.createElement(_Tooltip, {
|
|
160
140
|
title: description
|
|
161
|
-
}, /*#__PURE__*/
|
|
141
|
+
}, /*#__PURE__*/React.createElement(SpecIcon, {
|
|
162
142
|
name: "info"
|
|
163
143
|
}))) : label,
|
|
164
144
|
rules: item.rules || (item.fieldOptions ? item.fieldOptions.rules : [])
|
|
@@ -182,12 +162,12 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
182
162
|
// 优先级 displayLayout.side > displayLayout > general
|
|
183
163
|
// 优先级:若有displayLayout.block 则直接使用 general > displayLayout
|
|
184
164
|
|
|
185
|
-
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.side) || ((displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) ?
|
|
165
|
+
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);
|
|
186
166
|
|
|
187
167
|
if (item.hasOwnProperty('display')) {
|
|
188
168
|
if (typeof display === 'string') {
|
|
189
169
|
if (display === 'block') {
|
|
190
|
-
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) ||
|
|
170
|
+
formLayout = (displayLayout === null || displayLayout === void 0 ? void 0 : displayLayout.block) || general.modalSize[size].formBlockLayout;
|
|
191
171
|
} else {// 使用默认
|
|
192
172
|
// formLayout = displayLayout?.side || (displayLayout?.block ? general.modalSize[size].formLayout : displayLayout) || general.modalSize[size].formLayout
|
|
193
173
|
}
|
|
@@ -203,7 +183,7 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
203
183
|
|
|
204
184
|
|
|
205
185
|
if (type === 'title' || type === 'html') {
|
|
206
|
-
return /*#__PURE__*/
|
|
186
|
+
return /*#__PURE__*/React.createElement(FormItem, {
|
|
207
187
|
key: index,
|
|
208
188
|
noStyle: true,
|
|
209
189
|
shouldUpdate: true
|
|
@@ -211,17 +191,17 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
211
191
|
var _a; // isHide 返回为true则隐藏当前控件
|
|
212
192
|
|
|
213
193
|
|
|
214
|
-
return !itemIsHide(isHide, FormInstance.getFieldValue(), FormInstance) ? /*#__PURE__*/
|
|
194
|
+
return !itemIsHide(isHide, FormInstance.getFieldValue(), FormInstance) ? /*#__PURE__*/React.createElement(_Col, {
|
|
215
195
|
span: item.colSpan || 24
|
|
216
|
-
}, type === 'title' ? /*#__PURE__*/
|
|
196
|
+
}, type === 'title' ? /*#__PURE__*/React.createElement("h3", Object.assign({
|
|
217
197
|
className: "modalPanelTitle ".concat((_a = item === null || item === void 0 ? void 0 : item.protoConfig) === null || _a === void 0 ? void 0 : _a.className)
|
|
218
|
-
}, item.protoConfig), label) : label) : /*#__PURE__*/
|
|
198
|
+
}, item.protoConfig), label) : label) : /*#__PURE__*/React.createElement(React.Fragment, null, null);
|
|
219
199
|
});
|
|
220
200
|
} // 判断是否强制重新渲染表单
|
|
221
201
|
|
|
222
202
|
|
|
223
203
|
if (item.protoFormItem && item.protoFormItem.shouldUpdate) {
|
|
224
|
-
return /*#__PURE__*/
|
|
204
|
+
return /*#__PURE__*/React.createElement(FormItem, {
|
|
225
205
|
key: index,
|
|
226
206
|
noStyle: true,
|
|
227
207
|
shouldUpdate: item.protoFormItem.shouldUpdate
|
|
@@ -243,7 +223,7 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
243
223
|
} // 布局配置为horizontal
|
|
244
224
|
|
|
245
225
|
|
|
246
|
-
return /*#__PURE__*/
|
|
226
|
+
return /*#__PURE__*/React.createElement(_Row, null, renderItemGroupNode());
|
|
247
227
|
}
|
|
248
228
|
/* itemGroup = ReactNode则直接返回 */
|
|
249
229
|
|
|
@@ -251,5 +231,4 @@ var RenderItemGroup = function RenderItemGroup(props) {
|
|
|
251
231
|
return itemGroup;
|
|
252
232
|
};
|
|
253
233
|
|
|
254
|
-
|
|
255
|
-
exports["default"] = _default;
|
|
234
|
+
export default RenderItemGroup;
|
|
@@ -1,39 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
});
|
|
8
|
-
exports["default"] = void 0;
|
|
9
|
-
|
|
10
|
-
require("antd/es/upload/style");
|
|
11
|
-
|
|
12
|
-
var _upload = _interopRequireDefault(require("antd/es/upload"));
|
|
13
|
-
|
|
14
|
-
require("antd/es/button/style");
|
|
15
|
-
|
|
16
|
-
var _button = _interopRequireDefault(require("antd/es/button"));
|
|
17
|
-
|
|
18
|
-
require("antd/es/message/style");
|
|
19
|
-
|
|
20
|
-
var _message2 = _interopRequireDefault(require("antd/es/message"));
|
|
21
|
-
|
|
22
|
-
var _tslib = require("tslib");
|
|
23
|
-
|
|
24
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
25
|
-
|
|
26
|
-
var _icons = require("@ant-design/icons");
|
|
27
|
-
|
|
28
|
-
var _util = require("./util");
|
|
29
|
-
|
|
30
|
-
var _StandardModal = _interopRequireDefault(require("../../StandardModal"));
|
|
31
|
-
|
|
32
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
33
|
-
|
|
34
|
-
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
35
|
-
|
|
36
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
1
|
+
import "antd/es/upload/style";
|
|
2
|
+
import _Upload from "antd/es/upload";
|
|
3
|
+
import "antd/es/button/style";
|
|
4
|
+
import _Button from "antd/es/button";
|
|
5
|
+
import "antd/es/message/style";
|
|
6
|
+
import _message from "antd/es/message";
|
|
37
7
|
|
|
38
8
|
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
|
|
39
9
|
|
|
@@ -55,7 +25,13 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
|
|
|
55
25
|
|
|
56
26
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
57
27
|
|
|
58
|
-
|
|
28
|
+
import { __awaiter } from "tslib";
|
|
29
|
+
import React, { useMemo, useState, useCallback, useEffect } from 'react';
|
|
30
|
+
import { PlusOutlined } from '@ant-design/icons';
|
|
31
|
+
import { getAccept, getBase64 } from "./util"; // import RcUpload from 'rc-upload';
|
|
32
|
+
|
|
33
|
+
import StandardModal from "../../StandardModal";
|
|
34
|
+
var Uploader = /*#__PURE__*/React.forwardRef(function (props, ref) {
|
|
59
35
|
var accept = props.accept,
|
|
60
36
|
extraExt = props.extraExt,
|
|
61
37
|
fileType = props.fileType,
|
|
@@ -72,7 +48,7 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
72
48
|
beforeUpload = props.beforeUpload,
|
|
73
49
|
limit = props.limit; // 图片预览数据
|
|
74
50
|
|
|
75
|
-
var _useState =
|
|
51
|
+
var _useState = useState({
|
|
76
52
|
visible: false,
|
|
77
53
|
url: ''
|
|
78
54
|
}),
|
|
@@ -81,12 +57,12 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
81
57
|
setShowConfig = _useState2[1]; // 用于展示的缩略图
|
|
82
58
|
|
|
83
59
|
|
|
84
|
-
var _useState3 =
|
|
60
|
+
var _useState3 = useState([]),
|
|
85
61
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
86
62
|
fileList = _useState4[0],
|
|
87
63
|
setFileList = _useState4[1];
|
|
88
64
|
|
|
89
|
-
|
|
65
|
+
useEffect(function () {
|
|
90
66
|
if (!value) {
|
|
91
67
|
setFileList([]);
|
|
92
68
|
return;
|
|
@@ -125,8 +101,8 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
125
101
|
return;
|
|
126
102
|
}
|
|
127
103
|
}, [value]);
|
|
128
|
-
var splitAccept =
|
|
129
|
-
var res =
|
|
104
|
+
var splitAccept = useMemo(function () {
|
|
105
|
+
var res = getAccept(fileType);
|
|
130
106
|
|
|
131
107
|
if (extraExt) {
|
|
132
108
|
res = res + ',' + extraExt;
|
|
@@ -139,8 +115,8 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
139
115
|
return res;
|
|
140
116
|
}, [fileType, extraExt]); // 点击文件链接或预览图标时的回调
|
|
141
117
|
|
|
142
|
-
var handlePreview =
|
|
143
|
-
return
|
|
118
|
+
var handlePreview = useCallback(function (file) {
|
|
119
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee() {
|
|
144
120
|
var res;
|
|
145
121
|
return regeneratorRuntime.wrap(function _callee$(_context) {
|
|
146
122
|
while (1) {
|
|
@@ -152,7 +128,7 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
152
128
|
}
|
|
153
129
|
|
|
154
130
|
_context.next = 3;
|
|
155
|
-
return
|
|
131
|
+
return getBase64(file.originFileObj);
|
|
156
132
|
|
|
157
133
|
case 3:
|
|
158
134
|
res = _context.sent;
|
|
@@ -176,19 +152,19 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
176
152
|
}));
|
|
177
153
|
}, [setShowConfig]); // 检查文件是否规范
|
|
178
154
|
|
|
179
|
-
var handleCheck =
|
|
155
|
+
var handleCheck = useCallback(function (file) {
|
|
180
156
|
var isLtSize = file.size < size;
|
|
181
157
|
|
|
182
158
|
if (!isLtSize) {
|
|
183
|
-
|
|
159
|
+
_message.error("\u6587\u4EF6\u5927\u5C0F\u4E0D\u80FD\u8D85\u8FC7".concat(Math.round(size / 1024 / 1024 * 100) / 100, "MB!"));
|
|
184
160
|
|
|
185
161
|
return false;
|
|
186
162
|
}
|
|
187
163
|
|
|
188
164
|
return true;
|
|
189
165
|
}, [fileType, size]);
|
|
190
|
-
var handleChange =
|
|
191
|
-
return
|
|
166
|
+
var handleChange = useCallback(function (res) {
|
|
167
|
+
return __awaiter(void 0, void 0, void 0, /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {
|
|
192
168
|
var isOk, result, list;
|
|
193
169
|
return regeneratorRuntime.wrap(function _callee2$(_context2) {
|
|
194
170
|
while (1) {
|
|
@@ -228,11 +204,11 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
228
204
|
}));
|
|
229
205
|
}, [isOnly, handleCheck]); // 渲染预览窗口
|
|
230
206
|
|
|
231
|
-
var renderPreviewComponent =
|
|
207
|
+
var renderPreviewComponent = useMemo(function () {
|
|
232
208
|
if (fileType === 'image' || fileType === 'svg') {
|
|
233
209
|
var visible = showConfig.visible,
|
|
234
210
|
url = showConfig.url;
|
|
235
|
-
return /*#__PURE__*/
|
|
211
|
+
return /*#__PURE__*/React.createElement(StandardModal, {
|
|
236
212
|
visible: visible,
|
|
237
213
|
hideFooter: true,
|
|
238
214
|
onCancel: function onCancel() {
|
|
@@ -242,11 +218,11 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
242
218
|
});
|
|
243
219
|
},
|
|
244
220
|
size: modalSize
|
|
245
|
-
}, /*#__PURE__*/
|
|
221
|
+
}, /*#__PURE__*/React.createElement("div", {
|
|
246
222
|
style: {
|
|
247
223
|
textAlign: 'center'
|
|
248
224
|
}
|
|
249
|
-
}, /*#__PURE__*/
|
|
225
|
+
}, /*#__PURE__*/React.createElement("img", {
|
|
250
226
|
style: {
|
|
251
227
|
maxWidth: '100%'
|
|
252
228
|
},
|
|
@@ -257,32 +233,32 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
257
233
|
|
|
258
234
|
return null;
|
|
259
235
|
}, [fileType, showConfig]);
|
|
260
|
-
var renderChildrenComponent =
|
|
236
|
+
var renderChildrenComponent = useMemo(function () {
|
|
261
237
|
var renderButton = function renderButton() {
|
|
262
238
|
if (fileType === 'image' || fileType === 'svg') {
|
|
263
|
-
return /*#__PURE__*/
|
|
239
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
264
240
|
className: 'spec-uploader-control'
|
|
265
|
-
}, /*#__PURE__*/
|
|
241
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), /*#__PURE__*/React.createElement("div", {
|
|
266
242
|
className: "ant-upload-text"
|
|
267
243
|
}, "\u70B9\u51FB\u9009\u62E9"));
|
|
268
244
|
}
|
|
269
245
|
|
|
270
|
-
return /*#__PURE__*/
|
|
246
|
+
return /*#__PURE__*/React.createElement(_Button, {
|
|
271
247
|
className: 'spec-uploader-button'
|
|
272
|
-
}, /*#__PURE__*/
|
|
248
|
+
}, /*#__PURE__*/React.createElement(PlusOutlined, null), "\u70B9\u51FB\u9009\u62E9");
|
|
273
249
|
};
|
|
274
250
|
|
|
275
251
|
if (children) {
|
|
276
|
-
return /*#__PURE__*/
|
|
252
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, " ", children, " ");
|
|
277
253
|
}
|
|
278
254
|
|
|
279
255
|
if (isOnly && fileList.length === 1 || limit && fileList.length === limit) {
|
|
280
256
|
return null;
|
|
281
257
|
}
|
|
282
258
|
|
|
283
|
-
return /*#__PURE__*/
|
|
259
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, renderButton());
|
|
284
260
|
}, [fileType, isOnly, children, fileList, limit]);
|
|
285
|
-
return /*#__PURE__*/
|
|
261
|
+
return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_Upload, Object.assign({}, props, {
|
|
286
262
|
ref: ref,
|
|
287
263
|
accept: splitAccept,
|
|
288
264
|
fileList: fileList,
|
|
@@ -296,6 +272,4 @@ var Uploader = /*#__PURE__*/_react["default"].forwardRef(function (props, ref) {
|
|
|
296
272
|
}), renderChildrenComponent), renderPreviewComponent);
|
|
297
273
|
}); // as IUploader
|
|
298
274
|
|
|
299
|
-
|
|
300
|
-
var _default = Uploader;
|
|
301
|
-
exports["default"] = _default;
|
|
275
|
+
export default Uploader;
|
|
@@ -1,12 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
exports.getBase64 = getBase64;
|
|
7
|
-
exports.getAccept = getAccept;
|
|
8
|
-
|
|
9
|
-
function getBase64(file) {
|
|
1
|
+
export function getBase64(file) {
|
|
10
2
|
return new Promise(function (resolve) {
|
|
11
3
|
var reader = new FileReader();
|
|
12
4
|
reader.readAsDataURL(file);
|
|
@@ -26,8 +18,7 @@ function getBase64(file) {
|
|
|
26
18
|
};
|
|
27
19
|
});
|
|
28
20
|
}
|
|
29
|
-
|
|
30
|
-
function getAccept(fileType) {
|
|
21
|
+
export function getAccept(fileType) {
|
|
31
22
|
switch (fileType) {
|
|
32
23
|
case 'image':
|
|
33
24
|
return '.jpg,.png';
|
|
@@ -1,27 +1,9 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
1
|
function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
|
4
2
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
require("antd/es/tag/style");
|
|
11
|
-
|
|
12
|
-
var _tag = _interopRequireDefault(require("antd/es/tag"));
|
|
13
|
-
|
|
14
|
-
require("antd/es/input/style");
|
|
15
|
-
|
|
16
|
-
var _input = _interopRequireDefault(require("antd/es/input"));
|
|
17
|
-
|
|
18
|
-
var _react = _interopRequireWildcard(require("react"));
|
|
19
|
-
|
|
20
|
-
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function _getRequireWildcardCache() { return cache; }; return cache; }
|
|
21
|
-
|
|
22
|
-
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; }
|
|
23
|
-
|
|
24
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
3
|
+
import "antd/es/tag/style";
|
|
4
|
+
import _Tag from "antd/es/tag";
|
|
5
|
+
import "antd/es/input/style";
|
|
6
|
+
import _Input from "antd/es/input";
|
|
25
7
|
|
|
26
8
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
|
|
27
9
|
|
|
@@ -43,13 +25,17 @@ function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) ===
|
|
|
43
25
|
|
|
44
26
|
function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; }
|
|
45
27
|
|
|
46
|
-
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try {
|
|
28
|
+
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }
|
|
47
29
|
|
|
48
30
|
function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }
|
|
49
31
|
|
|
50
32
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
51
33
|
|
|
52
|
-
|
|
34
|
+
/**
|
|
35
|
+
* Created by S.C. on 2019/11/16.
|
|
36
|
+
*/
|
|
37
|
+
import React, { Component } from 'react';
|
|
38
|
+
var TextArea = _Input.TextArea;
|
|
53
39
|
var isIE = !!document.all;
|
|
54
40
|
|
|
55
41
|
var VarTemplate = /*#__PURE__*/function (_Component) {
|
|
@@ -57,6 +43,19 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
|
|
|
57
43
|
|
|
58
44
|
var _super = _createSuper(VarTemplate);
|
|
59
45
|
|
|
46
|
+
_createClass(VarTemplate, null, [{
|
|
47
|
+
key: "getDerivedStateFromProps",
|
|
48
|
+
value: function getDerivedStateFromProps(nextProps) {
|
|
49
|
+
// console.log('执行getDerivedStateFromProps', nextProps)
|
|
50
|
+
// Should be a controlled component.
|
|
51
|
+
if ('value' in nextProps) {
|
|
52
|
+
return _objectSpread({}, nextProps.value || {});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
}]);
|
|
58
|
+
|
|
60
59
|
function VarTemplate(props) {
|
|
61
60
|
var _this;
|
|
62
61
|
|
|
@@ -239,7 +238,7 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
|
|
|
239
238
|
wordCount: _value.length // 输入框内的字符数总和(包含占位符所需要的长度)
|
|
240
239
|
|
|
241
240
|
};
|
|
242
|
-
_this.content = /*#__PURE__*/
|
|
241
|
+
_this.content = /*#__PURE__*/React.createRef();
|
|
243
242
|
return _this;
|
|
244
243
|
}
|
|
245
244
|
|
|
@@ -256,24 +255,24 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
|
|
|
256
255
|
var _this$state3 = this.state,
|
|
257
256
|
currentContent = _this$state3.currentContent,
|
|
258
257
|
wordCount = _this$state3.wordCount;
|
|
259
|
-
return /*#__PURE__*/
|
|
258
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
260
259
|
className: "vart-wrap",
|
|
261
260
|
style: style,
|
|
262
261
|
ref: function ref(cRef) {
|
|
263
262
|
_this2.content = cRef;
|
|
264
263
|
}
|
|
265
|
-
}, tags && Array.isArray(tags) && /*#__PURE__*/
|
|
264
|
+
}, tags && Array.isArray(tags) && /*#__PURE__*/React.createElement("div", {
|
|
266
265
|
className: "vart-header"
|
|
267
266
|
}, tags.map(function (item) {
|
|
268
|
-
return /*#__PURE__*/
|
|
267
|
+
return /*#__PURE__*/React.createElement(_Tag, {
|
|
269
268
|
key: item.id,
|
|
270
269
|
onClick: function onClick() {
|
|
271
270
|
return !disabled && _this2.setTagWords(item.variableNameFormatted);
|
|
272
271
|
}
|
|
273
272
|
}, item.variableName);
|
|
274
|
-
})), /*#__PURE__*/
|
|
273
|
+
})), /*#__PURE__*/React.createElement("div", {
|
|
275
274
|
className: "vart-input"
|
|
276
|
-
}, /*#__PURE__*/
|
|
275
|
+
}, /*#__PURE__*/React.createElement(TextArea, {
|
|
277
276
|
type: "text",
|
|
278
277
|
size: size,
|
|
279
278
|
value: currentContent,
|
|
@@ -286,21 +285,9 @@ var VarTemplate = /*#__PURE__*/function (_Component) {
|
|
|
286
285
|
disabled: disabled
|
|
287
286
|
})));
|
|
288
287
|
}
|
|
289
|
-
}], [{
|
|
290
|
-
key: "getDerivedStateFromProps",
|
|
291
|
-
value: function getDerivedStateFromProps(nextProps) {
|
|
292
|
-
// console.log('执行getDerivedStateFromProps', nextProps)
|
|
293
|
-
// Should be a controlled component.
|
|
294
|
-
if ('value' in nextProps) {
|
|
295
|
-
return _objectSpread({}, nextProps.value || {});
|
|
296
|
-
}
|
|
297
|
-
|
|
298
|
-
return null;
|
|
299
|
-
}
|
|
300
288
|
}]);
|
|
301
289
|
|
|
302
290
|
return VarTemplate;
|
|
303
|
-
}(
|
|
291
|
+
}(Component);
|
|
304
292
|
|
|
305
|
-
|
|
306
|
-
exports["default"] = _default;
|
|
293
|
+
export default VarTemplate;
|
package/es/FormComp/index.js
CHANGED
|
@@ -1,15 +1 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
Object.defineProperty(exports, "__esModule", {
|
|
4
|
-
value: true
|
|
5
|
-
});
|
|
6
|
-
Object.defineProperty(exports, "Uploader", {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: function get() {
|
|
9
|
-
return _Uploader["default"];
|
|
10
|
-
}
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
var _Uploader = _interopRequireDefault(require("./Uploader"));
|
|
14
|
-
|
|
15
|
-
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
1
|
+
export { default as Uploader } from './Uploader';
|