cloud-b2b 1.1.45 → 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 +227 -102
- 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 +241 -102
- 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
|
@@ -1,59 +1,105 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
var _typeof3 = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
|
+
|
|
4
5
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
6
|
+
|
|
5
7
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
8
|
+
|
|
6
9
|
var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
|
|
10
|
+
|
|
7
11
|
var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
|
|
12
|
+
|
|
8
13
|
var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
|
|
14
|
+
|
|
9
15
|
var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
|
|
16
|
+
|
|
10
17
|
var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
|
|
18
|
+
|
|
11
19
|
var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
|
|
20
|
+
|
|
12
21
|
var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
|
|
22
|
+
|
|
13
23
|
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
24
|
+
|
|
14
25
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
26
|
+
|
|
15
27
|
_Object$defineProperty(exports, "__esModule", {
|
|
16
28
|
value: true
|
|
17
29
|
});
|
|
30
|
+
|
|
18
31
|
exports["default"] = void 0;
|
|
32
|
+
|
|
19
33
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
34
|
+
|
|
20
35
|
var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
|
|
36
|
+
|
|
21
37
|
var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
|
|
38
|
+
|
|
22
39
|
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
40
|
+
|
|
23
41
|
var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
|
|
42
|
+
|
|
24
43
|
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
44
|
+
|
|
25
45
|
var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
|
|
46
|
+
|
|
26
47
|
var _row = _interopRequireDefault(require("antd/lib/row"));
|
|
48
|
+
|
|
27
49
|
var _col = _interopRequireDefault(require("antd/lib/col"));
|
|
50
|
+
|
|
28
51
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
52
|
+
|
|
29
53
|
var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
|
|
54
|
+
|
|
30
55
|
var _icon = _interopRequireDefault(require("antd/lib/icon"));
|
|
56
|
+
|
|
31
57
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
58
|
+
|
|
32
59
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
60
|
+
|
|
33
61
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
62
|
+
|
|
34
63
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
|
|
64
|
+
|
|
35
65
|
var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
|
|
66
|
+
|
|
36
67
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
|
|
68
|
+
|
|
37
69
|
var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
|
|
70
|
+
|
|
38
71
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
72
|
+
|
|
39
73
|
var _form = _interopRequireDefault(require("antd/lib/form"));
|
|
74
|
+
|
|
40
75
|
var _react = _interopRequireDefault(require("react"));
|
|
76
|
+
|
|
41
77
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
78
|
+
|
|
42
79
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
80
|
+
|
|
43
81
|
var _helper = _interopRequireDefault(require("../helper"));
|
|
82
|
+
|
|
44
83
|
var _Control = _interopRequireWildcard(require("../Control"));
|
|
84
|
+
|
|
45
85
|
var _variables = _interopRequireDefault(require("../variables"));
|
|
86
|
+
|
|
46
87
|
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); }
|
|
88
|
+
|
|
47
89
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof3(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; }
|
|
90
|
+
|
|
48
91
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
92
|
+
|
|
49
93
|
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) { (0, _defineProperty2["default"])(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; }
|
|
94
|
+
|
|
50
95
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
96
|
+
|
|
51
97
|
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; } }
|
|
98
|
+
|
|
52
99
|
var FormItem = _form["default"].Item;
|
|
53
100
|
var defaultSize = 'small';
|
|
54
101
|
var defaultColNum = 4;
|
|
55
|
-
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg', 'cascader'];
|
|
56
|
-
|
|
102
|
+
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'area', 'uploadImg', 'cascader', 'treeSelect'];
|
|
57
103
|
/**
|
|
58
104
|
* key:[必须],用于唯一标识该Form下的一个表单元素
|
|
59
105
|
* title:[必须],表单元素的标签
|
|
@@ -65,6 +111,7 @@ var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText',
|
|
|
65
111
|
* rule: [可选],用于设置校验规则
|
|
66
112
|
* highLightKeys: [可选],用于设置高亮样式,仅只读字段生效
|
|
67
113
|
*/
|
|
114
|
+
|
|
68
115
|
var ControlType = {
|
|
69
116
|
key: _propTypes["default"].string.isRequired,
|
|
70
117
|
title: _propTypes["default"].string,
|
|
@@ -77,18 +124,24 @@ var ControlType = {
|
|
|
77
124
|
rule: _propTypes["default"].object,
|
|
78
125
|
props: _propTypes["default"].object
|
|
79
126
|
};
|
|
127
|
+
|
|
80
128
|
var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
81
129
|
(0, _inherits2["default"])(Controlled, _React$Component);
|
|
130
|
+
|
|
82
131
|
var _super = _createSuper(Controlled);
|
|
132
|
+
|
|
83
133
|
function Controlled(props) {
|
|
84
134
|
var _this;
|
|
135
|
+
|
|
85
136
|
(0, _classCallCheck2["default"])(this, Controlled);
|
|
86
137
|
_this = _super.call(this, props);
|
|
87
138
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (value) {
|
|
88
139
|
var onChange = _this.props.onChange;
|
|
140
|
+
|
|
89
141
|
_this.setState({
|
|
90
142
|
value: value
|
|
91
143
|
});
|
|
144
|
+
|
|
92
145
|
onChange && onChange(value);
|
|
93
146
|
});
|
|
94
147
|
_this.state = {
|
|
@@ -96,6 +149,7 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
96
149
|
};
|
|
97
150
|
return _this;
|
|
98
151
|
}
|
|
152
|
+
|
|
99
153
|
(0, _createClass2["default"])(Controlled, [{
|
|
100
154
|
key: "componentWillReceiveProps",
|
|
101
155
|
value: function componentWillReceiveProps(nextProps) {
|
|
@@ -112,6 +166,7 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
112
166
|
value: this.state.value,
|
|
113
167
|
onChange: this.onChange
|
|
114
168
|
});
|
|
169
|
+
|
|
115
170
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
116
171
|
}
|
|
117
172
|
}]);
|
|
@@ -130,16 +185,24 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
130
185
|
* onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
|
|
131
186
|
* OnFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
|
|
132
187
|
*/
|
|
188
|
+
|
|
189
|
+
|
|
133
190
|
var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
134
191
|
(0, _inherits2["default"])(SuperForm, _React$Component2);
|
|
192
|
+
|
|
135
193
|
var _super2 = _createSuper(SuperForm);
|
|
194
|
+
|
|
136
195
|
function SuperForm() {
|
|
137
196
|
var _context;
|
|
197
|
+
|
|
138
198
|
var _this2;
|
|
199
|
+
|
|
139
200
|
(0, _classCallCheck2["default"])(this, SuperForm);
|
|
201
|
+
|
|
140
202
|
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
141
203
|
args[_key] = arguments[_key];
|
|
142
204
|
}
|
|
205
|
+
|
|
143
206
|
_this2 = _super2.call.apply(_super2, (0, _concat["default"])(_context = [this]).call(_context, args));
|
|
144
207
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onAdd", function (key, title) {
|
|
145
208
|
var onAdd = _this2.props.onAdd;
|
|
@@ -147,36 +210,45 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
147
210
|
});
|
|
148
211
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onChange", function (key, value) {
|
|
149
212
|
var onChange = _this2.props.onChange;
|
|
213
|
+
|
|
150
214
|
if (onChange) {
|
|
151
215
|
_this2.onExitValid(key);
|
|
216
|
+
|
|
152
217
|
onChange(key, value);
|
|
153
218
|
}
|
|
154
219
|
});
|
|
155
220
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onBlur", function (key, value) {
|
|
156
221
|
var onChange = _this2.props.onChange;
|
|
222
|
+
|
|
157
223
|
if (onChange) {
|
|
158
224
|
_this2.onExitValid(key);
|
|
225
|
+
|
|
159
226
|
onChange(key, value);
|
|
160
227
|
}
|
|
161
228
|
});
|
|
162
229
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onExitValid", function (key, value) {
|
|
163
230
|
if (key === _this2.validKey) {
|
|
164
231
|
_this2.validKey = '';
|
|
232
|
+
|
|
165
233
|
_this2.props.onExitValid();
|
|
166
234
|
}
|
|
235
|
+
|
|
167
236
|
_this2.props.onChangeOperate && _this2.props.onChangeOperate(key, value);
|
|
168
237
|
});
|
|
169
238
|
// 动态生成getValidState方法
|
|
170
239
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "initValidState", function () {
|
|
171
240
|
var _this2$props = _this2.props,
|
|
172
|
-
|
|
173
|
-
|
|
241
|
+
value = _this2$props.value,
|
|
242
|
+
valid = _this2$props.valid;
|
|
243
|
+
|
|
174
244
|
var invalid = function invalid() {
|
|
175
245
|
return null;
|
|
176
246
|
};
|
|
247
|
+
|
|
177
248
|
var _valid = function _valid(_ref) {
|
|
178
249
|
var key = _ref.key,
|
|
179
|
-
|
|
250
|
+
required = _ref.required;
|
|
251
|
+
|
|
180
252
|
if (required) {
|
|
181
253
|
if (!value || _helper["default"].isEmpty2(value[key]) || !(0, _isArray["default"])(value[key]) && (0, _typeof2["default"])(value[key]) === 'object' && _helper["default"].isEmpty(value[key].value)) {
|
|
182
254
|
_this2.getValidState = invalid;
|
|
@@ -184,16 +256,19 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
184
256
|
return 'error';
|
|
185
257
|
}
|
|
186
258
|
}
|
|
259
|
+
|
|
187
260
|
return null;
|
|
188
261
|
};
|
|
262
|
+
|
|
189
263
|
_this2.getValidState = valid ? _valid : invalid;
|
|
190
264
|
});
|
|
191
265
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "validDate", function (_ref2) {
|
|
192
266
|
var key = _ref2.key,
|
|
193
|
-
|
|
267
|
+
type = _ref2.type;
|
|
194
268
|
return function (date) {
|
|
195
269
|
var _this2$props$value = _this2.props.value,
|
|
196
|
-
|
|
270
|
+
value = _this2$props$value === void 0 ? {} : _this2$props$value;
|
|
271
|
+
|
|
197
272
|
if (!date || !value[key]) {
|
|
198
273
|
return false;
|
|
199
274
|
} else {
|
|
@@ -209,6 +284,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
209
284
|
});
|
|
210
285
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getPopupContainer", function () {
|
|
211
286
|
var container = _this2.props.container;
|
|
287
|
+
|
|
212
288
|
if (typeof container === 'undefined') {
|
|
213
289
|
return _reactDom["default"].findDOMNode((0, _assertThisInitialized2["default"])(_this2));
|
|
214
290
|
} else if (typeof container === 'boolean') {
|
|
@@ -219,7 +295,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
219
295
|
});
|
|
220
296
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getMaxWidth", function () {
|
|
221
297
|
var _this2$props$colNum = _this2.props.colNum,
|
|
222
|
-
|
|
298
|
+
colNum = _this2$props$colNum === void 0 ? defaultColNum : _this2$props$colNum;
|
|
223
299
|
return colNum * 250;
|
|
224
300
|
});
|
|
225
301
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getContainer", function () {
|
|
@@ -227,8 +303,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
227
303
|
});
|
|
228
304
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getControls", function () {
|
|
229
305
|
var _this2$props2 = _this2.props,
|
|
230
|
-
|
|
231
|
-
|
|
306
|
+
hideControls = _this2$props2.hideControls,
|
|
307
|
+
controls = _this2$props2.controls;
|
|
308
|
+
|
|
232
309
|
if (!hideControls) {
|
|
233
310
|
return controls;
|
|
234
311
|
} else {
|
|
@@ -241,9 +318,11 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
241
318
|
});
|
|
242
319
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getType", function (_ref3) {
|
|
243
320
|
var _context2;
|
|
321
|
+
|
|
244
322
|
var key = _ref3.key,
|
|
245
|
-
|
|
323
|
+
type = _ref3.type;
|
|
246
324
|
var readonly = _this2.props.readonly;
|
|
325
|
+
|
|
247
326
|
if ((0, _includes["default"])(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
|
|
248
327
|
return type;
|
|
249
328
|
} else if (!readonly) {
|
|
@@ -260,20 +339,23 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
260
339
|
});
|
|
261
340
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "specialProps", function (type, _ref4) {
|
|
262
341
|
var key = _ref4.key,
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
342
|
+
_ref4$props = _ref4.props,
|
|
343
|
+
props = _ref4$props === void 0 ? {} : _ref4$props,
|
|
344
|
+
originType = _ref4.type;
|
|
345
|
+
|
|
266
346
|
if (type === 'readonly') {
|
|
267
347
|
var _this2$props$highLigh = _this2.props.highLightKeys,
|
|
268
|
-
|
|
348
|
+
highLightKeys = _this2$props$highLigh === void 0 ? [] : _this2$props$highLigh;
|
|
269
349
|
var style = (0, _includes["default"])(highLightKeys).call(highLightKeys, key) ? {
|
|
270
350
|
backgroundColor: 'red',
|
|
271
351
|
color: 'white'
|
|
272
352
|
} : {
|
|
273
353
|
backgroundColor: '#f0f0f0'
|
|
274
354
|
};
|
|
355
|
+
|
|
275
356
|
if (originType === 'textArea') {
|
|
276
357
|
var _context3;
|
|
358
|
+
|
|
277
359
|
return {
|
|
278
360
|
type: 'textArea',
|
|
279
361
|
readonly: true,
|
|
@@ -282,6 +364,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
282
364
|
};
|
|
283
365
|
} else {
|
|
284
366
|
var _context4;
|
|
367
|
+
|
|
285
368
|
return {
|
|
286
369
|
style: style,
|
|
287
370
|
onBlur: (0, _bind["default"])(_context4 = _this2.onExitValid).call(_context4, (0, _assertThisInitialized2["default"])(_this2), key)
|
|
@@ -289,23 +372,29 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
289
372
|
}
|
|
290
373
|
} else if (type === 'text' || type === 'textArea') {
|
|
291
374
|
var _context5, _context6;
|
|
375
|
+
|
|
292
376
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
293
377
|
onChange: (0, _bind["default"])(_context5 = _this2.onExitValid).call(_context5, (0, _assertThisInitialized2["default"])(_this2), key),
|
|
294
378
|
onBlur: (0, _bind["default"])(_context6 = _this2.onChange).call(_context6, (0, _assertThisInitialized2["default"])(_this2), key)
|
|
295
379
|
});
|
|
296
380
|
} else if (type === 'date') {
|
|
297
381
|
var _context7, _context8;
|
|
382
|
+
|
|
298
383
|
var propsObj = _objectSpread(_objectSpread({}, props), {}, {
|
|
299
384
|
onChange: (0, _bind["default"])(_context7 = _this2.onBlur).call(_context7, (0, _assertThisInitialized2["default"])(_this2), key),
|
|
300
385
|
onBlur: (0, _bind["default"])(_context8 = _this2.onExitValid).call(_context8, (0, _assertThisInitialized2["default"])(_this2), key)
|
|
301
386
|
});
|
|
387
|
+
|
|
302
388
|
if (_this2.props.onOpenChange && typeof _this2.props.onOpenChange === 'function') {
|
|
303
389
|
var _context9;
|
|
390
|
+
|
|
304
391
|
propsObj.onOpenChange = (0, _bind["default"])(_context9 = _this2.props.onOpenChange).call(_context9, (0, _assertThisInitialized2["default"])(_this2), key);
|
|
305
392
|
}
|
|
393
|
+
|
|
306
394
|
return propsObj;
|
|
307
395
|
} else if (type === 'area') {
|
|
308
396
|
var _context10, _context11;
|
|
397
|
+
|
|
309
398
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
310
399
|
onChange: (0, _bind["default"])(_context10 = _this2.onBlur).call(_context10, (0, _assertThisInitialized2["default"])(_this2), key),
|
|
311
400
|
onBlur: (0, _bind["default"])(_context11 = _this2.onExitValid).call(_context11, (0, _assertThisInitialized2["default"])(_this2), key),
|
|
@@ -313,6 +402,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
313
402
|
});
|
|
314
403
|
} else {
|
|
315
404
|
var _context12, _context13;
|
|
405
|
+
|
|
316
406
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
317
407
|
onChange: (0, _bind["default"])(_context12 = _this2.onBlur).call(_context12, (0, _assertThisInitialized2["default"])(_this2), key),
|
|
318
408
|
onBlur: (0, _bind["default"])(_context13 = _this2.onExitValid).call(_context13, (0, _assertThisInitialized2["default"])(_this2), key)
|
|
@@ -321,9 +411,12 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
321
411
|
});
|
|
322
412
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getControlProps", function (control, status) {
|
|
323
413
|
var _this2$props$value2 = _this2.props.value,
|
|
324
|
-
|
|
414
|
+
value = _this2$props$value2 === void 0 ? {} : _this2$props$value2;
|
|
415
|
+
|
|
325
416
|
var type = _this2.getType(control);
|
|
417
|
+
|
|
326
418
|
var props = _this2.specialProps(type, control);
|
|
419
|
+
|
|
327
420
|
return _objectSpread(_objectSpread({
|
|
328
421
|
autoFocus: !!status,
|
|
329
422
|
type: type
|
|
@@ -363,6 +456,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
363
456
|
maxRows: 5
|
|
364
457
|
};
|
|
365
458
|
}
|
|
459
|
+
|
|
366
460
|
return /*#__PURE__*/_react["default"].createElement(Controlled, props);
|
|
367
461
|
});
|
|
368
462
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toNumber", function (props) {
|
|
@@ -372,7 +466,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
372
466
|
});
|
|
373
467
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toSelect", function (props, _ref5) {
|
|
374
468
|
var options = _ref5.options,
|
|
375
|
-
|
|
469
|
+
key = _ref5.key;
|
|
376
470
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
377
471
|
props.options = _this2.getOptions(key, options);
|
|
378
472
|
props.dropdownMatchSelectWidth = false;
|
|
@@ -405,13 +499,13 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
405
499
|
});
|
|
406
500
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toRadioGroup", function (props, _ref7) {
|
|
407
501
|
var key = _ref7.key,
|
|
408
|
-
|
|
502
|
+
options = _ref7.options;
|
|
409
503
|
props.options = _this2.getOptions(key, options);
|
|
410
504
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
411
505
|
});
|
|
412
506
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toReadonly", function (props, _ref8) {
|
|
413
507
|
var options = _ref8.options,
|
|
414
|
-
|
|
508
|
+
key = _ref8.key;
|
|
415
509
|
props.value = (0, _Control.getTitle)(props.value, _this2.getOptions(key, options));
|
|
416
510
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
417
511
|
});
|
|
@@ -424,7 +518,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
424
518
|
});
|
|
425
519
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "area", function (props, _ref9) {
|
|
426
520
|
var key = _ref9.key,
|
|
427
|
-
|
|
521
|
+
options = _ref9.options;
|
|
428
522
|
var readonly = _this2.props.readonly;
|
|
429
523
|
props.parentKey = key;
|
|
430
524
|
props.options = _this2.getOptions(key, options);
|
|
@@ -436,6 +530,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
436
530
|
});
|
|
437
531
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "uploadImg", function (props, control) {
|
|
438
532
|
var _context14;
|
|
533
|
+
|
|
439
534
|
var readonly = _this2.props.readonly;
|
|
440
535
|
props.required = control.required || false;
|
|
441
536
|
props.onFileChange = (0, _bind["default"])(_context14 = _this2.onFileChange).call(_context14, (0, _assertThisInitialized2["default"])(_this2), control);
|
|
@@ -446,6 +541,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
446
541
|
});
|
|
447
542
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCascader", function (props, control) {
|
|
448
543
|
var container = _this2.getContainer();
|
|
544
|
+
|
|
449
545
|
container && (props.getPopupContainer = container);
|
|
450
546
|
props.options = control.options || [];
|
|
451
547
|
props.onSearch = _this2.createSearchEvent(control);
|
|
@@ -453,52 +549,82 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
453
549
|
props.loadData = _this2.createSearchEvent(control);
|
|
454
550
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
455
551
|
});
|
|
552
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toTreeSelect", function (props, filter) {
|
|
553
|
+
var container = _this2.getContainer();
|
|
554
|
+
|
|
555
|
+
container && (props.getPopupContainer = container);
|
|
556
|
+
props.options = _this2.getOptions(filter);
|
|
557
|
+
props.onSearch = _this2.createSearchEvent(filter);
|
|
558
|
+
props.placeholder = filter.placeholder || '';
|
|
559
|
+
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
560
|
+
});
|
|
456
561
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toControl", function (props, control) {
|
|
457
562
|
switch (props.type) {
|
|
458
563
|
case 'readonly':
|
|
459
564
|
return _this2.toReadonly(props, control);
|
|
565
|
+
|
|
460
566
|
case 'text':
|
|
461
567
|
return _this2.toText(props, control);
|
|
568
|
+
|
|
462
569
|
case 'number':
|
|
463
570
|
return _this2.toNumber(props, control);
|
|
571
|
+
|
|
464
572
|
case 'select':
|
|
465
573
|
case 'selectText':
|
|
466
574
|
return _this2.toSelect(props, control);
|
|
575
|
+
|
|
467
576
|
case 'search':
|
|
468
577
|
case 'searchText':
|
|
469
578
|
return _this2.toSearch(props, control);
|
|
579
|
+
|
|
470
580
|
case 'date':
|
|
471
581
|
return _this2.toDate(props, control);
|
|
582
|
+
|
|
472
583
|
case 'radioGroup':
|
|
473
584
|
return _this2.toRadioGroup(props, control);
|
|
585
|
+
|
|
474
586
|
case 'textArea':
|
|
475
587
|
return _this2.toTextArea(props, control);
|
|
588
|
+
|
|
476
589
|
case 'password':
|
|
477
590
|
return _this2.toPassword(props, control);
|
|
591
|
+
|
|
478
592
|
case 'editor':
|
|
479
593
|
return _this2.toEditor(props, control);
|
|
594
|
+
|
|
480
595
|
case 'selectWriting':
|
|
481
596
|
return _this2.toSelectWriting(props, control);
|
|
597
|
+
|
|
482
598
|
case 'selectSearch':
|
|
483
599
|
return _this2.selectSearch(props, control);
|
|
600
|
+
|
|
484
601
|
case 'empty':
|
|
485
602
|
return _this2.toEmpty(props, control);
|
|
603
|
+
|
|
486
604
|
case 'area':
|
|
487
605
|
return _this2.area(props, control);
|
|
606
|
+
|
|
488
607
|
case 'uploadImg':
|
|
489
608
|
return _this2.uploadImg(props, control);
|
|
609
|
+
|
|
490
610
|
case 'cascader':
|
|
491
611
|
return _this2.toCascader(props, control);
|
|
612
|
+
|
|
613
|
+
case 'treeSelect':
|
|
614
|
+
return _this2.toTreeSelect(props, control);
|
|
615
|
+
|
|
492
616
|
default:
|
|
493
617
|
return 'type error';
|
|
494
618
|
}
|
|
495
619
|
});
|
|
496
620
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toLabel", function (_ref10, type) {
|
|
497
621
|
var title = _ref10.title,
|
|
498
|
-
|
|
499
|
-
|
|
622
|
+
showAdd = _ref10.showAdd,
|
|
623
|
+
key = _ref10.key;
|
|
624
|
+
|
|
500
625
|
if (showAdd && type !== 'readonly') {
|
|
501
626
|
var _context15;
|
|
627
|
+
|
|
502
628
|
var onClick = (0, _bind["default"])(_context15 = _this2.onAdd).call(_context15, (0, _assertThisInitialized2["default"])(_this2), key, title);
|
|
503
629
|
return /*#__PURE__*/_react["default"].createElement("span", null, title, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
504
630
|
role: "add",
|
|
@@ -511,16 +637,19 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
511
637
|
});
|
|
512
638
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCol", function (span, control) {
|
|
513
639
|
var factor = control.span || 1;
|
|
640
|
+
|
|
514
641
|
var status = _this2.getValidState(control);
|
|
642
|
+
|
|
515
643
|
var controlProps = _this2.getControlProps(control, status);
|
|
644
|
+
|
|
516
645
|
var itemProps = {
|
|
517
646
|
label: _this2.toLabel(control, controlProps.type),
|
|
518
647
|
required: control.required,
|
|
519
648
|
validateStatus: status
|
|
520
649
|
};
|
|
521
650
|
var _this2$props3 = _this2.props,
|
|
522
|
-
|
|
523
|
-
|
|
651
|
+
checkable = _this2$props3.checkable,
|
|
652
|
+
onCheckItem = _this2$props3.onCheckItem;
|
|
524
653
|
return control.type !== 'empty' ? /*#__PURE__*/_react["default"].createElement(_col["default"], {
|
|
525
654
|
span: span * factor,
|
|
526
655
|
key: control.key
|
|
@@ -540,23 +669,28 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
540
669
|
});
|
|
541
670
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCols", function () {
|
|
542
671
|
var _context16;
|
|
672
|
+
|
|
543
673
|
var _this2$props4 = _this2.props,
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
674
|
+
_this2$props4$colNum = _this2$props4.colNum,
|
|
675
|
+
colNum = _this2$props4$colNum === void 0 ? defaultColNum : _this2$props4$colNum,
|
|
676
|
+
allFullFather = _this2$props4.allFullFather;
|
|
677
|
+
|
|
547
678
|
if (allFullFather) {
|
|
548
679
|
colNum = 1;
|
|
549
680
|
}
|
|
681
|
+
|
|
550
682
|
var span = 24 / colNum;
|
|
551
683
|
return (0, _map["default"])(_context16 = _this2.getControls()).call(_context16, function (control) {
|
|
552
684
|
if (allFullFather) {
|
|
553
685
|
control.allFullFather = allFullFather;
|
|
554
686
|
}
|
|
687
|
+
|
|
555
688
|
return _this2.toCol(span, control);
|
|
556
689
|
});
|
|
557
690
|
});
|
|
558
691
|
return _this2;
|
|
559
692
|
}
|
|
693
|
+
|
|
560
694
|
(0, _createClass2["default"])(SuperForm, [{
|
|
561
695
|
key: "render",
|
|
562
696
|
value: function render() {
|
|
@@ -575,6 +709,7 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
575
709
|
}]);
|
|
576
710
|
return SuperForm;
|
|
577
711
|
}(_react["default"].Component);
|
|
712
|
+
|
|
578
713
|
(0, _defineProperty2["default"])(SuperForm, "propTypes", {
|
|
579
714
|
controls: _propTypes["default"].arrayOf(_propTypes["default"].shape(ControlType)).isRequired,
|
|
580
715
|
value: _propTypes["default"].object,
|