cloud-b2b 1.1.46 → 1.1.50
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/es/Area/Area.js +45 -16
- package/es/Card/Card.js +4 -3
- package/es/CodeInput/CodeInput.js +59 -30
- package/es/Control/Control.js +117 -58
- package/es/Control/event.js +14 -0
- package/es/Enhance/Dialogs.js +21 -6
- package/es/Enhance/Loading.js +46 -26
- package/es/Enhance/index.js +2 -0
- package/es/Header/Header.js +35 -3
- package/es/Header/Vertical.js +24 -1
- package/es/ImageView/ImageView.js +22 -5
- package/es/Indent/Indent.js +7 -3
- package/es/InpurCascader/InputCascader.js +36 -10
- package/es/InputEditor/InputEditor.js +52 -53
- package/es/InputSearch/InputSearch.js +71 -26
- package/es/InputSelect/InputSelect.js +48 -17
- package/es/InputTreeSelect/InputTreeSelect.js +147 -0
- package/es/InputTreeSelect/package.json +6 -0
- package/es/InputWriting/InputWriting.js +28 -6
- package/es/Layout/Layout.js +59 -28
- package/es/LayoutLink/LayoutLink.js +20 -11
- package/es/Link/Link.js +27 -4
- package/es/Loading/Loading.js +3 -1
- package/es/Loading2/Loading2.js +2 -0
- package/es/ModalWithDrag/ModalWithDrag.js +8 -3
- package/es/ModalWithDrag/drag.js +29 -12
- package/es/NumberInput/NumberInput.js +64 -24
- package/es/Search/Search.js +164 -54
- package/es/Sidebar/Sidebar.js +34 -13
- package/es/Sidebar2/Sidebar.js +30 -3
- package/es/SuperForm/SuperForm.js +164 -27
- package/es/SuperForm2/SuperForm.js +182 -31
- package/es/SuperIcon/SuperIcon.js +6 -3
- package/es/SuperPagination/SuperPagination.js +32 -15
- package/es/SuperTab/SuperTab.js +27 -4
- package/es/SuperTab2/SuperTab2.js +33 -11
- package/es/SuperTable/DragSortRow.js +34 -6
- package/es/SuperTable/FilterDropDown.js +34 -10
- package/es/SuperTable/SuperTable.js +216 -84
- package/es/SuperTable/fixed.js +9 -1
- package/es/SuperTable2/SuperTable2.js +226 -101
- package/es/SuperTable2/SuperTableCell.js +60 -16
- package/es/SuperTable3/FilterDropDown.js +34 -10
- package/es/SuperTable3/SuperTable.js +175 -50
- package/es/SuperTable3/fixed.js +9 -1
- package/es/SuperToolbar/SuperToolbar.js +49 -21
- package/es/SuperUpload/SuperUpload.js +233 -156
- package/es/Title/Title.js +15 -12
- package/es/Viewer/ImageViews.js +60 -7
- package/es/Viewer/Viewer.js +32 -5
- package/es/WingBlank/WingBlank.js +6 -2
- package/es/helper.js +29 -7
- package/es/history.js +2 -3
- package/lib/Area/Area.js +64 -16
- package/lib/Card/Card.js +13 -3
- package/lib/CodeInput/CodeInput.js +77 -30
- package/lib/Control/Control.js +160 -58
- package/lib/Control/event.js +16 -0
- package/lib/Enhance/Dialogs.js +32 -6
- package/lib/Enhance/Loading.js +62 -26
- package/lib/Enhance/index.js +9 -0
- package/lib/Header/Header.js +48 -3
- package/lib/Header/Vertical.js +36 -1
- package/lib/ImageView/ImageView.js +30 -5
- package/lib/Indent/Indent.js +13 -3
- package/lib/InpurCascader/InputCascader.js +50 -11
- package/lib/InputEditor/InputEditor.js +61 -53
- package/lib/InputSearch/InputSearch.js +78 -26
- package/lib/InputSelect/InputSelect.js +62 -17
- package/lib/InputTreeSelect/InputTreeSelect.js +169 -0
- package/lib/InputTreeSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +35 -6
- package/lib/Layout/Layout.js +76 -28
- package/lib/LayoutLink/LayoutLink.js +38 -11
- package/lib/Link/Link.js +40 -4
- package/lib/Loading/Loading.js +9 -1
- package/lib/Loading2/Loading2.js +8 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +18 -3
- package/lib/ModalWithDrag/drag.js +34 -12
- package/lib/NumberInput/NumberInput.js +77 -24
- package/lib/Search/Search.js +171 -54
- package/lib/Sidebar/Sidebar.js +46 -13
- package/lib/Sidebar2/Sidebar.js +42 -3
- package/lib/SuperForm/SuperForm.js +162 -27
- package/lib/SuperForm2/SuperForm.js +175 -31
- package/lib/SuperIcon/SuperIcon.js +14 -3
- package/lib/SuperPagination/SuperPagination.js +42 -15
- package/lib/SuperTab/SuperTab.js +34 -4
- package/lib/SuperTab2/SuperTab2.js +48 -11
- package/lib/SuperTable/DragSortRow.js +42 -6
- package/lib/SuperTable/FilterDropDown.js +42 -10
- package/lib/SuperTable/SuperTable.js +211 -83
- package/lib/SuperTable/fixed.js +13 -1
- package/lib/SuperTable2/SuperTable2.js +240 -101
- package/lib/SuperTable2/SuperTableCell.js +67 -13
- package/lib/SuperTable3/FilterDropDown.js +42 -10
- package/lib/SuperTable3/SuperTable.js +170 -49
- package/lib/SuperTable3/fixed.js +13 -1
- package/lib/SuperToolbar/SuperToolbar.js +64 -20
- package/lib/SuperUpload/SuperUpload.js +267 -156
- package/lib/Title/Title.js +24 -12
- package/lib/Viewer/ImageViews.js +63 -7
- package/lib/Viewer/Viewer.js +41 -5
- package/lib/WingBlank/WingBlank.js +14 -2
- package/lib/helper.js +47 -6
- package/lib/history.js +5 -0
- package/lib/index.js +76 -0
- package/lib/variables.js +4 -0
- package/package.json +2 -2
|
@@ -27,10 +27,15 @@ import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instanc
|
|
|
27
27
|
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
28
28
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
29
29
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
30
|
+
|
|
30
31
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
32
|
+
|
|
31
33
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context17, _context18; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context17 = ownKeys(Object(source), !0)).call(_context17, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context18 = ownKeys(Object(source))).call(_context18, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
|
+
|
|
32
35
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
36
|
+
|
|
33
37
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
38
|
+
|
|
34
39
|
import React from 'react';
|
|
35
40
|
import PropTypes from 'prop-types';
|
|
36
41
|
import ReactDOM from 'react-dom';
|
|
@@ -40,8 +45,7 @@ import variables from '../variables';
|
|
|
40
45
|
var FormItem = _Form.Item;
|
|
41
46
|
var defaultSize = 'small';
|
|
42
47
|
var defaultColNum = 4;
|
|
43
|
-
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg', 'cascader'];
|
|
44
|
-
|
|
48
|
+
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg', 'cascader', 'treeSelect'];
|
|
45
49
|
/**
|
|
46
50
|
* key:[必须],用于唯一标识该Form下的一个表单元素
|
|
47
51
|
* title:[必须],表单元素的标签
|
|
@@ -53,6 +57,7 @@ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText',
|
|
|
53
57
|
* rule: [可选],用于设置校验规则
|
|
54
58
|
* highLightKeys: [可选],用于设置高亮样式,仅只读字段生效
|
|
55
59
|
*/
|
|
60
|
+
|
|
56
61
|
var ControlType = {
|
|
57
62
|
key: PropTypes.string.isRequired,
|
|
58
63
|
title: PropTypes.string,
|
|
@@ -65,25 +70,35 @@ var ControlType = {
|
|
|
65
70
|
rule: PropTypes.object,
|
|
66
71
|
props: PropTypes.object
|
|
67
72
|
};
|
|
73
|
+
|
|
68
74
|
var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
69
75
|
_inherits(Controlled, _React$Component);
|
|
76
|
+
|
|
70
77
|
var _super = _createSuper(Controlled);
|
|
78
|
+
|
|
71
79
|
function Controlled(props) {
|
|
72
80
|
var _this;
|
|
81
|
+
|
|
73
82
|
_classCallCheck(this, Controlled);
|
|
83
|
+
|
|
74
84
|
_this = _super.call(this, props);
|
|
85
|
+
|
|
75
86
|
_defineProperty(_assertThisInitialized(_this), "onChange", function (value) {
|
|
76
87
|
var onChange = _this.props.onChange;
|
|
88
|
+
|
|
77
89
|
_this.setState({
|
|
78
90
|
value: value
|
|
79
91
|
});
|
|
92
|
+
|
|
80
93
|
onChange && onChange(value);
|
|
81
94
|
});
|
|
95
|
+
|
|
82
96
|
_this.state = {
|
|
83
97
|
value: props.value
|
|
84
98
|
};
|
|
85
99
|
return _this;
|
|
86
100
|
}
|
|
101
|
+
|
|
87
102
|
_createClass(Controlled, [{
|
|
88
103
|
key: "componentWillReceiveProps",
|
|
89
104
|
value: function componentWillReceiveProps(nextProps) {
|
|
@@ -100,9 +115,11 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
100
115
|
value: this.state.value,
|
|
101
116
|
onChange: this.onChange
|
|
102
117
|
});
|
|
118
|
+
|
|
103
119
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
104
120
|
}
|
|
105
121
|
}]);
|
|
122
|
+
|
|
106
123
|
return Controlled;
|
|
107
124
|
}(React.Component);
|
|
108
125
|
/**
|
|
@@ -118,53 +135,75 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
118
135
|
* onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
|
|
119
136
|
* OnFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
|
|
120
137
|
*/
|
|
138
|
+
|
|
139
|
+
|
|
121
140
|
var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
122
141
|
_inherits(SuperForm, _React$Component2);
|
|
142
|
+
|
|
123
143
|
var _super2 = _createSuper(SuperForm);
|
|
144
|
+
|
|
124
145
|
function SuperForm() {
|
|
125
146
|
var _context;
|
|
147
|
+
|
|
126
148
|
var _this2;
|
|
149
|
+
|
|
127
150
|
_classCallCheck(this, SuperForm);
|
|
151
|
+
|
|
128
152
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
129
153
|
args[_key] = arguments[_key];
|
|
130
154
|
}
|
|
155
|
+
|
|
131
156
|
_this2 = _super2.call.apply(_super2, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
157
|
+
|
|
132
158
|
_defineProperty(_assertThisInitialized(_this2), "onAdd", function (key, title) {
|
|
133
159
|
var onAdd = _this2.props.onAdd;
|
|
134
160
|
onAdd && onAdd(key, title);
|
|
135
161
|
});
|
|
162
|
+
|
|
136
163
|
_defineProperty(_assertThisInitialized(_this2), "onChange", function (key, value) {
|
|
137
164
|
var onChange = _this2.props.onChange;
|
|
165
|
+
|
|
138
166
|
if (onChange) {
|
|
139
167
|
_this2.onExitValid(key);
|
|
168
|
+
|
|
140
169
|
onChange(key, value);
|
|
141
170
|
}
|
|
142
171
|
});
|
|
172
|
+
|
|
143
173
|
_defineProperty(_assertThisInitialized(_this2), "onBlur", function (key, value) {
|
|
144
174
|
var onChange = _this2.props.onChange;
|
|
175
|
+
|
|
145
176
|
if (onChange) {
|
|
146
177
|
_this2.onExitValid(key);
|
|
178
|
+
|
|
147
179
|
onChange(key, value);
|
|
148
180
|
}
|
|
149
181
|
});
|
|
182
|
+
|
|
150
183
|
_defineProperty(_assertThisInitialized(_this2), "onExitValid", function (key, value) {
|
|
151
184
|
if (key === _this2.validKey) {
|
|
152
185
|
_this2.validKey = '';
|
|
186
|
+
|
|
153
187
|
_this2.props.onExitValid();
|
|
154
188
|
}
|
|
189
|
+
|
|
155
190
|
_this2.props.onChangeOperate && _this2.props.onChangeOperate(key, value);
|
|
156
191
|
});
|
|
192
|
+
|
|
157
193
|
// 动态生成getValidState方法
|
|
158
194
|
_defineProperty(_assertThisInitialized(_this2), "initValidState", function () {
|
|
159
195
|
var _this2$props = _this2.props,
|
|
160
|
-
|
|
161
|
-
|
|
196
|
+
value = _this2$props.value,
|
|
197
|
+
valid = _this2$props.valid;
|
|
198
|
+
|
|
162
199
|
var invalid = function invalid() {
|
|
163
200
|
return null;
|
|
164
201
|
};
|
|
202
|
+
|
|
165
203
|
var _valid = function _valid(_ref) {
|
|
166
204
|
var key = _ref.key,
|
|
167
|
-
|
|
205
|
+
required = _ref.required;
|
|
206
|
+
|
|
168
207
|
if (required) {
|
|
169
208
|
if (!value || helper.isEmpty2(value[key]) || !_Array$isArray(value[key]) && _typeof(value[key]) === 'object' && helper.isEmpty(value[key].value)) {
|
|
170
209
|
_this2.getValidState = invalid;
|
|
@@ -172,16 +211,20 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
172
211
|
return 'error';
|
|
173
212
|
}
|
|
174
213
|
}
|
|
214
|
+
|
|
175
215
|
return null;
|
|
176
216
|
};
|
|
217
|
+
|
|
177
218
|
_this2.getValidState = valid ? _valid : invalid;
|
|
178
219
|
});
|
|
220
|
+
|
|
179
221
|
_defineProperty(_assertThisInitialized(_this2), "validDate", function (_ref2) {
|
|
180
222
|
var key = _ref2.key,
|
|
181
|
-
|
|
223
|
+
type = _ref2.type;
|
|
182
224
|
return function (date) {
|
|
183
225
|
var _this2$props$value = _this2.props.value,
|
|
184
|
-
|
|
226
|
+
value = _this2$props$value === void 0 ? {} : _this2$props$value;
|
|
227
|
+
|
|
185
228
|
if (!date || !value[key]) {
|
|
186
229
|
return false;
|
|
187
230
|
} else {
|
|
@@ -195,8 +238,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
195
238
|
}
|
|
196
239
|
};
|
|
197
240
|
});
|
|
241
|
+
|
|
198
242
|
_defineProperty(_assertThisInitialized(_this2), "getPopupContainer", function () {
|
|
199
243
|
var container = _this2.props.container;
|
|
244
|
+
|
|
200
245
|
if (typeof container === 'undefined') {
|
|
201
246
|
return ReactDOM.findDOMNode(_assertThisInitialized(_this2));
|
|
202
247
|
} else if (typeof container === 'boolean') {
|
|
@@ -205,18 +250,22 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
205
250
|
return ReactDOM.findDOMNode(container);
|
|
206
251
|
}
|
|
207
252
|
});
|
|
253
|
+
|
|
208
254
|
_defineProperty(_assertThisInitialized(_this2), "getMaxWidth", function () {
|
|
209
255
|
var _this2$props$colNum = _this2.props.colNum,
|
|
210
|
-
|
|
256
|
+
colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
|
|
211
257
|
return colNum * 250;
|
|
212
258
|
});
|
|
259
|
+
|
|
213
260
|
_defineProperty(_assertThisInitialized(_this2), "getContainer", function () {
|
|
214
261
|
return _this2.props.getContainer;
|
|
215
262
|
});
|
|
263
|
+
|
|
216
264
|
_defineProperty(_assertThisInitialized(_this2), "getControls", function () {
|
|
217
265
|
var _this2$props2 = _this2.props,
|
|
218
|
-
|
|
219
|
-
|
|
266
|
+
hideControls = _this2$props2.hideControls,
|
|
267
|
+
controls = _this2$props2.controls;
|
|
268
|
+
|
|
220
269
|
if (!hideControls) {
|
|
221
270
|
return controls;
|
|
222
271
|
} else {
|
|
@@ -227,11 +276,14 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
227
276
|
});
|
|
228
277
|
}
|
|
229
278
|
});
|
|
279
|
+
|
|
230
280
|
_defineProperty(_assertThisInitialized(_this2), "getType", function (_ref3) {
|
|
231
281
|
var _context2;
|
|
282
|
+
|
|
232
283
|
var key = _ref3.key,
|
|
233
|
-
|
|
284
|
+
type = _ref3.type;
|
|
234
285
|
var readonly = _this2.props.readonly;
|
|
286
|
+
|
|
235
287
|
if (_includesInstanceProperty(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
|
|
236
288
|
return type;
|
|
237
289
|
} else if (!readonly) {
|
|
@@ -246,22 +298,26 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
246
298
|
return type;
|
|
247
299
|
}
|
|
248
300
|
});
|
|
301
|
+
|
|
249
302
|
_defineProperty(_assertThisInitialized(_this2), "specialProps", function (type, _ref4) {
|
|
250
303
|
var key = _ref4.key,
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
304
|
+
_ref4$props = _ref4.props,
|
|
305
|
+
props = _ref4$props === void 0 ? {} : _ref4$props,
|
|
306
|
+
originType = _ref4.type;
|
|
307
|
+
|
|
254
308
|
if (type === 'readonly') {
|
|
255
309
|
var _this2$props$highLigh = _this2.props.highLightKeys,
|
|
256
|
-
|
|
310
|
+
highLightKeys = _this2$props$highLigh === void 0 ? [] : _this2$props$highLigh;
|
|
257
311
|
var style = _includesInstanceProperty(highLightKeys).call(highLightKeys, key) ? {
|
|
258
312
|
backgroundColor: 'red',
|
|
259
313
|
color: 'white'
|
|
260
314
|
} : {
|
|
261
315
|
backgroundColor: '#f0f0f0'
|
|
262
316
|
};
|
|
317
|
+
|
|
263
318
|
if (originType === 'textArea') {
|
|
264
319
|
var _context3;
|
|
320
|
+
|
|
265
321
|
return {
|
|
266
322
|
type: 'textArea',
|
|
267
323
|
readonly: true,
|
|
@@ -270,6 +326,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
270
326
|
};
|
|
271
327
|
} else {
|
|
272
328
|
var _context4;
|
|
329
|
+
|
|
273
330
|
return {
|
|
274
331
|
style: style,
|
|
275
332
|
onBlur: _bindInstanceProperty(_context4 = _this2.onExitValid).call(_context4, _assertThisInitialized(_this2), key)
|
|
@@ -277,23 +334,29 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
277
334
|
}
|
|
278
335
|
} else if (type === 'text' || type === 'textArea') {
|
|
279
336
|
var _context5, _context6;
|
|
337
|
+
|
|
280
338
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
281
339
|
onChange: _bindInstanceProperty(_context5 = _this2.onExitValid).call(_context5, _assertThisInitialized(_this2), key),
|
|
282
340
|
onBlur: _bindInstanceProperty(_context6 = _this2.onChange).call(_context6, _assertThisInitialized(_this2), key)
|
|
283
341
|
});
|
|
284
342
|
} else if (type === 'date') {
|
|
285
343
|
var _context7, _context8;
|
|
344
|
+
|
|
286
345
|
var propsObj = _objectSpread(_objectSpread({}, props), {}, {
|
|
287
346
|
onChange: _bindInstanceProperty(_context7 = _this2.onBlur).call(_context7, _assertThisInitialized(_this2), key),
|
|
288
347
|
onBlur: _bindInstanceProperty(_context8 = _this2.onExitValid).call(_context8, _assertThisInitialized(_this2), key)
|
|
289
348
|
});
|
|
349
|
+
|
|
290
350
|
if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
|
|
291
351
|
var _context9;
|
|
352
|
+
|
|
292
353
|
propsObj.onOpenChange = _bindInstanceProperty(_context9 = _this2.props.onOpenChange).call(_context9, _assertThisInitialized(_this2), key);
|
|
293
354
|
}
|
|
355
|
+
|
|
294
356
|
return propsObj;
|
|
295
357
|
} else if (type === 'area') {
|
|
296
358
|
var _context10, _context11;
|
|
359
|
+
|
|
297
360
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
298
361
|
onChange: _bindInstanceProperty(_context10 = _this2.onBlur).call(_context10, _assertThisInitialized(_this2), key),
|
|
299
362
|
onBlur: _bindInstanceProperty(_context11 = _this2.onExitValid).call(_context11, _assertThisInitialized(_this2), key),
|
|
@@ -301,17 +364,22 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
301
364
|
});
|
|
302
365
|
} else {
|
|
303
366
|
var _context12, _context13;
|
|
367
|
+
|
|
304
368
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
305
369
|
onChange: _bindInstanceProperty(_context12 = _this2.onBlur).call(_context12, _assertThisInitialized(_this2), key),
|
|
306
370
|
onBlur: _bindInstanceProperty(_context13 = _this2.onExitValid).call(_context13, _assertThisInitialized(_this2), key)
|
|
307
371
|
});
|
|
308
372
|
}
|
|
309
373
|
});
|
|
374
|
+
|
|
310
375
|
_defineProperty(_assertThisInitialized(_this2), "getControlProps", function (control, status) {
|
|
311
376
|
var _this2$props$value2 = _this2.props.value,
|
|
312
|
-
|
|
377
|
+
value = _this2$props$value2 === void 0 ? {} : _this2$props$value2;
|
|
378
|
+
|
|
313
379
|
var type = _this2.getType(control);
|
|
380
|
+
|
|
314
381
|
var props = _this2.specialProps(type, control);
|
|
382
|
+
|
|
315
383
|
return _objectSpread(_objectSpread({
|
|
316
384
|
autoFocus: !!status,
|
|
317
385
|
type: type
|
|
@@ -320,24 +388,31 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
320
388
|
value: makeString(value[control.key])
|
|
321
389
|
});
|
|
322
390
|
});
|
|
391
|
+
|
|
323
392
|
_defineProperty(_assertThisInitialized(_this2), "getOptions", function (key, options) {
|
|
324
393
|
var higher = _this2.props.options || {};
|
|
325
394
|
return higher[key] || options;
|
|
326
395
|
});
|
|
396
|
+
|
|
327
397
|
_defineProperty(_assertThisInitialized(_this2), "toEmpty", function (props) {});
|
|
398
|
+
|
|
328
399
|
_defineProperty(_assertThisInitialized(_this2), "toText", function (props) {
|
|
329
400
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
330
401
|
});
|
|
402
|
+
|
|
331
403
|
_defineProperty(_assertThisInitialized(_this2), "toPassword", function (props) {
|
|
332
404
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
333
405
|
});
|
|
406
|
+
|
|
334
407
|
_defineProperty(_assertThisInitialized(_this2), "toEditor", function (props, control) {
|
|
335
408
|
props.inputKey = control.key;
|
|
336
409
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
337
410
|
});
|
|
411
|
+
|
|
338
412
|
_defineProperty(_assertThisInitialized(_this2), "toSelectWriting", function (props, control) {
|
|
339
413
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
340
414
|
});
|
|
415
|
+
|
|
341
416
|
_defineProperty(_assertThisInitialized(_this2), "toTextArea", function (props, control) {
|
|
342
417
|
if (control.allFullFather) {
|
|
343
418
|
props.rows = control.rows;
|
|
@@ -351,21 +426,25 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
351
426
|
maxRows: 5
|
|
352
427
|
};
|
|
353
428
|
}
|
|
429
|
+
|
|
354
430
|
return /*#__PURE__*/React.createElement(Controlled, props);
|
|
355
431
|
});
|
|
432
|
+
|
|
356
433
|
_defineProperty(_assertThisInitialized(_this2), "toNumber", function (props) {
|
|
357
434
|
props.defaultValue = props.value;
|
|
358
435
|
delete props.value;
|
|
359
436
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
360
437
|
});
|
|
438
|
+
|
|
361
439
|
_defineProperty(_assertThisInitialized(_this2), "toSelect", function (props, _ref5) {
|
|
362
440
|
var options = _ref5.options,
|
|
363
|
-
|
|
441
|
+
key = _ref5.key;
|
|
364
442
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
365
443
|
props.options = _this2.getOptions(key, options);
|
|
366
444
|
props.dropdownMatchSelectWidth = false;
|
|
367
445
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
368
446
|
});
|
|
447
|
+
|
|
369
448
|
_defineProperty(_assertThisInitialized(_this2), "createSearchEvent", function (control) {
|
|
370
449
|
if (_this2.props.onSearch) {
|
|
371
450
|
return function (value) {
|
|
@@ -375,6 +454,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
375
454
|
return null;
|
|
376
455
|
}
|
|
377
456
|
});
|
|
457
|
+
|
|
378
458
|
_defineProperty(_assertThisInitialized(_this2), "toSearch", function (props, control) {
|
|
379
459
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
380
460
|
props.options = _this2.getOptions(control.key, control.options);
|
|
@@ -382,6 +462,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
382
462
|
props.dropdownMatchSelectWidth = false;
|
|
383
463
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
384
464
|
});
|
|
465
|
+
|
|
385
466
|
_defineProperty(_assertThisInitialized(_this2), "toDate", function (props, _ref6) {
|
|
386
467
|
var rule = _ref6.rule;
|
|
387
468
|
props.getCalendarContainer = _this2.getPopupContainer;
|
|
@@ -391,18 +472,21 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
391
472
|
rule && (props.disabledDate = _this2.validDate(rule));
|
|
392
473
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
393
474
|
});
|
|
475
|
+
|
|
394
476
|
_defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref7) {
|
|
395
477
|
var key = _ref7.key,
|
|
396
|
-
|
|
478
|
+
options = _ref7.options;
|
|
397
479
|
props.options = _this2.getOptions(key, options);
|
|
398
480
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
399
481
|
});
|
|
482
|
+
|
|
400
483
|
_defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref8) {
|
|
401
484
|
var options = _ref8.options,
|
|
402
|
-
|
|
485
|
+
key = _ref8.key;
|
|
403
486
|
props.value = getTitle(props.value, _this2.getOptions(key, options));
|
|
404
487
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
405
488
|
});
|
|
489
|
+
|
|
406
490
|
_defineProperty(_assertThisInitialized(_this2), "selectSearch", function (props, control) {
|
|
407
491
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
408
492
|
props.options = _this2.getOptions(control.key, control.options);
|
|
@@ -410,9 +494,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
410
494
|
props.dropdownMatchSelectWidth = false;
|
|
411
495
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
412
496
|
});
|
|
497
|
+
|
|
413
498
|
_defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref9) {
|
|
414
499
|
var key = _ref9.key,
|
|
415
|
-
|
|
500
|
+
options = _ref9.options;
|
|
416
501
|
var readonly = _this2.props.readonly;
|
|
417
502
|
props.parentKey = key;
|
|
418
503
|
props.options = _this2.getOptions(key, options);
|
|
@@ -422,8 +507,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
422
507
|
}) ? true : false;
|
|
423
508
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
424
509
|
});
|
|
510
|
+
|
|
425
511
|
_defineProperty(_assertThisInitialized(_this2), "uploadImg", function (props, control) {
|
|
426
512
|
var _context14;
|
|
513
|
+
|
|
427
514
|
var readonly = _this2.props.readonly;
|
|
428
515
|
props.required = control.required || false;
|
|
429
516
|
props.onFileChange = _bindInstanceProperty(_context14 = _this2.onFileChange).call(_context14, _assertThisInitialized(_this2), control);
|
|
@@ -432,8 +519,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
432
519
|
}) ? true : false;
|
|
433
520
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
434
521
|
});
|
|
522
|
+
|
|
435
523
|
_defineProperty(_assertThisInitialized(_this2), "toCascader", function (props, control) {
|
|
436
524
|
var container = _this2.getContainer();
|
|
525
|
+
|
|
437
526
|
container && (props.getPopupContainer = container);
|
|
438
527
|
props.options = control.options || [];
|
|
439
528
|
props.onSearch = _this2.createSearchEvent(control);
|
|
@@ -441,53 +530,87 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
441
530
|
props.loadData = _this2.createSearchEvent(control);
|
|
442
531
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
443
532
|
});
|
|
533
|
+
|
|
534
|
+
_defineProperty(_assertThisInitialized(_this2), "toTreeSelect", function (props, filter) {
|
|
535
|
+
var container = _this2.getContainer();
|
|
536
|
+
|
|
537
|
+
container && (props.getPopupContainer = container);
|
|
538
|
+
props.options = _this2.getOptions(filter);
|
|
539
|
+
props.onSearch = _this2.createSearchEvent(filter);
|
|
540
|
+
props.placeholder = filter.placeholder || '';
|
|
541
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
542
|
+
});
|
|
543
|
+
|
|
444
544
|
_defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
|
|
445
545
|
switch (props.type) {
|
|
446
546
|
case 'readonly':
|
|
447
547
|
return _this2.toReadonly(props, control);
|
|
548
|
+
|
|
448
549
|
case 'text':
|
|
449
550
|
return _this2.toText(props, control);
|
|
551
|
+
|
|
450
552
|
case 'number':
|
|
451
553
|
return _this2.toNumber(props, control);
|
|
554
|
+
|
|
452
555
|
case 'select':
|
|
453
556
|
case 'selectText':
|
|
454
557
|
return _this2.toSelect(props, control);
|
|
558
|
+
|
|
455
559
|
case 'search':
|
|
456
560
|
case 'searchText':
|
|
457
561
|
return _this2.toSearch(props, control);
|
|
562
|
+
|
|
458
563
|
case 'date':
|
|
459
564
|
return _this2.toDate(props, control);
|
|
565
|
+
|
|
460
566
|
case 'radioGroup':
|
|
461
567
|
return _this2.toRadioGroup(props, control);
|
|
568
|
+
|
|
462
569
|
case 'textArea':
|
|
463
570
|
return _this2.toTextArea(props, control);
|
|
571
|
+
|
|
464
572
|
case 'password':
|
|
465
573
|
return _this2.toPassword(props, control);
|
|
574
|
+
|
|
466
575
|
case 'editor':
|
|
467
576
|
return _this2.toEditor(props, control);
|
|
577
|
+
|
|
468
578
|
case 'selectWriting':
|
|
469
579
|
return _this2.toSelectWriting(props, control);
|
|
580
|
+
|
|
470
581
|
case 'selectSearch':
|
|
471
582
|
return _this2.selectSearch(props, control);
|
|
583
|
+
|
|
472
584
|
case 'empty':
|
|
473
585
|
return _this2.toEmpty(props, control);
|
|
586
|
+
|
|
474
587
|
case 'area':
|
|
475
588
|
return _this2.area(props, control);
|
|
589
|
+
|
|
476
590
|
case 'uploadImg':
|
|
477
591
|
return _this2.uploadImg(props, control);
|
|
592
|
+
|
|
478
593
|
case 'cascader':
|
|
479
594
|
return _this2.toCascader(props, control);
|
|
595
|
+
|
|
596
|
+
case 'treeSelect':
|
|
597
|
+
return _this2.toTreeSelect(props, control);
|
|
598
|
+
|
|
480
599
|
default:
|
|
481
600
|
return 'type error';
|
|
482
601
|
}
|
|
483
602
|
});
|
|
603
|
+
|
|
484
604
|
_defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref10, type) {
|
|
485
605
|
var title = _ref10.title,
|
|
486
|
-
|
|
487
|
-
|
|
606
|
+
showAdd = _ref10.showAdd,
|
|
607
|
+
key = _ref10.key;
|
|
608
|
+
|
|
488
609
|
if (showAdd && type !== 'readonly') {
|
|
489
610
|
var _context15;
|
|
611
|
+
|
|
490
612
|
var onClick = _bindInstanceProperty(_context15 = _this2.onAdd).call(_context15, _assertThisInitialized(_this2), key, title);
|
|
613
|
+
|
|
491
614
|
return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
|
|
492
615
|
role: "add",
|
|
493
616
|
type: "plus-circle-o",
|
|
@@ -497,18 +620,22 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
497
620
|
return title;
|
|
498
621
|
}
|
|
499
622
|
});
|
|
623
|
+
|
|
500
624
|
_defineProperty(_assertThisInitialized(_this2), "toCol", function (span, control) {
|
|
501
625
|
var factor = control.span || 1;
|
|
626
|
+
|
|
502
627
|
var status = _this2.getValidState(control);
|
|
628
|
+
|
|
503
629
|
var controlProps = _this2.getControlProps(control, status);
|
|
630
|
+
|
|
504
631
|
var itemProps = {
|
|
505
632
|
label: _this2.toLabel(control, controlProps.type),
|
|
506
633
|
required: control.required,
|
|
507
634
|
validateStatus: status
|
|
508
635
|
};
|
|
509
636
|
var _this2$props3 = _this2.props,
|
|
510
|
-
|
|
511
|
-
|
|
637
|
+
checkable = _this2$props3.checkable,
|
|
638
|
+
onCheckItem = _this2$props3.onCheckItem;
|
|
512
639
|
return control.type !== 'empty' ? /*#__PURE__*/React.createElement(_Col, {
|
|
513
640
|
span: span * factor,
|
|
514
641
|
key: control.key
|
|
@@ -526,25 +653,32 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
526
653
|
}
|
|
527
654
|
});
|
|
528
655
|
});
|
|
656
|
+
|
|
529
657
|
_defineProperty(_assertThisInitialized(_this2), "toCols", function () {
|
|
530
658
|
var _context16;
|
|
659
|
+
|
|
531
660
|
var _this2$props4 = _this2.props,
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
661
|
+
_this2$props4$colNum = _this2$props4.colNum,
|
|
662
|
+
colNum = _this2$props4$colNum === void 0 ? defaultColNum : _this2$props4$colNum,
|
|
663
|
+
allFullFather = _this2$props4.allFullFather;
|
|
664
|
+
|
|
535
665
|
if (allFullFather) {
|
|
536
666
|
colNum = 1;
|
|
537
667
|
}
|
|
668
|
+
|
|
538
669
|
var span = 24 / colNum;
|
|
539
670
|
return _mapInstanceProperty(_context16 = _this2.getControls()).call(_context16, function (control) {
|
|
540
671
|
if (allFullFather) {
|
|
541
672
|
control.allFullFather = allFullFather;
|
|
542
673
|
}
|
|
674
|
+
|
|
543
675
|
return _this2.toCol(span, control);
|
|
544
676
|
});
|
|
545
677
|
});
|
|
678
|
+
|
|
546
679
|
return _this2;
|
|
547
680
|
}
|
|
681
|
+
|
|
548
682
|
_createClass(SuperForm, [{
|
|
549
683
|
key: "render",
|
|
550
684
|
value: function render() {
|
|
@@ -561,8 +695,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
561
695
|
}, this.toCols())));
|
|
562
696
|
}
|
|
563
697
|
}]);
|
|
698
|
+
|
|
564
699
|
return SuperForm;
|
|
565
700
|
}(React.Component);
|
|
701
|
+
|
|
566
702
|
_defineProperty(SuperForm, "propTypes", {
|
|
567
703
|
controls: PropTypes.arrayOf(PropTypes.shape(ControlType)).isRequired,
|
|
568
704
|
value: PropTypes.object,
|
|
@@ -580,4 +716,5 @@ _defineProperty(SuperForm, "propTypes", {
|
|
|
580
716
|
onAreaSearch: PropTypes.func,
|
|
581
717
|
OnFileChange: PropTypes.func
|
|
582
718
|
});
|
|
719
|
+
|
|
583
720
|
export default SuperForm;
|