cloud-b2b 1.1.53 → 1.1.54
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/SuperForm/SuperForm.js +37 -32
- package/lib/SuperForm/SuperForm.js +37 -32
- package/package.json +1 -1
|
@@ -147,6 +147,11 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
147
147
|
onChange(key, value);
|
|
148
148
|
}
|
|
149
149
|
});
|
|
150
|
+
_defineProperty(_assertThisInitialized(_this2), "onFileChange", function (_ref, file) {
|
|
151
|
+
var key = _ref.key;
|
|
152
|
+
var onFileChange = _this2.props.onFileChange;
|
|
153
|
+
onFileChange && onFileChange(key, file);
|
|
154
|
+
});
|
|
150
155
|
_defineProperty(_assertThisInitialized(_this2), "onExitValid", function (key, value) {
|
|
151
156
|
if (key === _this2.validKey) {
|
|
152
157
|
_this2.validKey = '';
|
|
@@ -162,9 +167,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
162
167
|
var invalid = function invalid() {
|
|
163
168
|
return null;
|
|
164
169
|
};
|
|
165
|
-
var _valid = function _valid(
|
|
166
|
-
var key =
|
|
167
|
-
required =
|
|
170
|
+
var _valid = function _valid(_ref2) {
|
|
171
|
+
var key = _ref2.key,
|
|
172
|
+
required = _ref2.required;
|
|
168
173
|
if (required) {
|
|
169
174
|
if (!value || helper.isEmpty2(value[key]) || !_Array$isArray(value[key]) && _typeof(value[key]) === 'object' && helper.isEmpty(value[key].value)) {
|
|
170
175
|
_this2.getValidState = invalid;
|
|
@@ -176,9 +181,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
176
181
|
};
|
|
177
182
|
_this2.getValidState = valid ? _valid : invalid;
|
|
178
183
|
});
|
|
179
|
-
_defineProperty(_assertThisInitialized(_this2), "validDate", function (
|
|
180
|
-
var key =
|
|
181
|
-
type =
|
|
184
|
+
_defineProperty(_assertThisInitialized(_this2), "validDate", function (_ref3) {
|
|
185
|
+
var key = _ref3.key,
|
|
186
|
+
type = _ref3.type;
|
|
182
187
|
return function (date) {
|
|
183
188
|
var _this2$props$value = _this2.props.value,
|
|
184
189
|
value = _this2$props$value === void 0 ? {} : _this2$props$value;
|
|
@@ -227,10 +232,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
227
232
|
});
|
|
228
233
|
}
|
|
229
234
|
});
|
|
230
|
-
_defineProperty(_assertThisInitialized(_this2), "getType", function (
|
|
235
|
+
_defineProperty(_assertThisInitialized(_this2), "getType", function (_ref4) {
|
|
231
236
|
var _context2;
|
|
232
|
-
var key =
|
|
233
|
-
type =
|
|
237
|
+
var key = _ref4.key,
|
|
238
|
+
type = _ref4.type;
|
|
234
239
|
var readonly = _this2.props.readonly;
|
|
235
240
|
if (_includesInstanceProperty(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
|
|
236
241
|
return type;
|
|
@@ -246,11 +251,11 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
246
251
|
return type;
|
|
247
252
|
}
|
|
248
253
|
});
|
|
249
|
-
_defineProperty(_assertThisInitialized(_this2), "specialProps", function (type,
|
|
250
|
-
var key =
|
|
251
|
-
|
|
252
|
-
props =
|
|
253
|
-
originType =
|
|
254
|
+
_defineProperty(_assertThisInitialized(_this2), "specialProps", function (type, _ref5) {
|
|
255
|
+
var key = _ref5.key,
|
|
256
|
+
_ref5$props = _ref5.props,
|
|
257
|
+
props = _ref5$props === void 0 ? {} : _ref5$props,
|
|
258
|
+
originType = _ref5.type;
|
|
254
259
|
if (type === 'readonly') {
|
|
255
260
|
var _this2$props$highLigh = _this2.props.highLightKeys,
|
|
256
261
|
highLightKeys = _this2$props$highLigh === void 0 ? [] : _this2$props$highLigh;
|
|
@@ -358,9 +363,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
358
363
|
delete props.value;
|
|
359
364
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
360
365
|
});
|
|
361
|
-
_defineProperty(_assertThisInitialized(_this2), "toSelect", function (props,
|
|
362
|
-
var options =
|
|
363
|
-
key =
|
|
366
|
+
_defineProperty(_assertThisInitialized(_this2), "toSelect", function (props, _ref6) {
|
|
367
|
+
var options = _ref6.options,
|
|
368
|
+
key = _ref6.key;
|
|
364
369
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
365
370
|
props.options = _this2.getOptions(key, options);
|
|
366
371
|
props.dropdownMatchSelectWidth = false;
|
|
@@ -382,8 +387,8 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
382
387
|
props.dropdownMatchSelectWidth = false;
|
|
383
388
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
384
389
|
});
|
|
385
|
-
_defineProperty(_assertThisInitialized(_this2), "toDate", function (props,
|
|
386
|
-
var rule =
|
|
390
|
+
_defineProperty(_assertThisInitialized(_this2), "toDate", function (props, _ref7) {
|
|
391
|
+
var rule = _ref7.rule;
|
|
387
392
|
props.getCalendarContainer = _this2.getPopupContainer;
|
|
388
393
|
props.style = {
|
|
389
394
|
width: '100%'
|
|
@@ -391,15 +396,15 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
391
396
|
rule && (props.disabledDate = _this2.validDate(rule));
|
|
392
397
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
393
398
|
});
|
|
394
|
-
_defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props,
|
|
395
|
-
var key =
|
|
396
|
-
options =
|
|
399
|
+
_defineProperty(_assertThisInitialized(_this2), "toRadioGroup", function (props, _ref8) {
|
|
400
|
+
var key = _ref8.key,
|
|
401
|
+
options = _ref8.options;
|
|
397
402
|
props.options = _this2.getOptions(key, options);
|
|
398
403
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
399
404
|
});
|
|
400
|
-
_defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props,
|
|
401
|
-
var options =
|
|
402
|
-
key =
|
|
405
|
+
_defineProperty(_assertThisInitialized(_this2), "toReadonly", function (props, _ref9) {
|
|
406
|
+
var options = _ref9.options,
|
|
407
|
+
key = _ref9.key;
|
|
403
408
|
props.value = getTitle(props.value, _this2.getOptions(key, options));
|
|
404
409
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
405
410
|
});
|
|
@@ -410,9 +415,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
410
415
|
props.dropdownMatchSelectWidth = false;
|
|
411
416
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
412
417
|
});
|
|
413
|
-
_defineProperty(_assertThisInitialized(_this2), "area", function (props,
|
|
414
|
-
var key =
|
|
415
|
-
options =
|
|
418
|
+
_defineProperty(_assertThisInitialized(_this2), "area", function (props, _ref10) {
|
|
419
|
+
var key = _ref10.key,
|
|
420
|
+
options = _ref10.options;
|
|
416
421
|
var readonly = _this2.props.readonly;
|
|
417
422
|
props.parentKey = key;
|
|
418
423
|
props.options = _this2.getOptions(key, options);
|
|
@@ -491,10 +496,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
491
496
|
return 'type error';
|
|
492
497
|
}
|
|
493
498
|
});
|
|
494
|
-
_defineProperty(_assertThisInitialized(_this2), "toLabel", function (
|
|
495
|
-
var title =
|
|
496
|
-
showAdd =
|
|
497
|
-
key =
|
|
499
|
+
_defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref11, type) {
|
|
500
|
+
var title = _ref11.title,
|
|
501
|
+
showAdd = _ref11.showAdd,
|
|
502
|
+
key = _ref11.key;
|
|
498
503
|
if (showAdd && type !== 'readonly') {
|
|
499
504
|
var _context15;
|
|
500
505
|
var onClick = _bindInstanceProperty(_context15 = _this2.onAdd).call(_context15, _assertThisInitialized(_this2), key, title);
|
|
@@ -159,6 +159,11 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
159
159
|
onChange(key, value);
|
|
160
160
|
}
|
|
161
161
|
});
|
|
162
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onFileChange", function (_ref, file) {
|
|
163
|
+
var key = _ref.key;
|
|
164
|
+
var onFileChange = _this2.props.onFileChange;
|
|
165
|
+
onFileChange && onFileChange(key, file);
|
|
166
|
+
});
|
|
162
167
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "onExitValid", function (key, value) {
|
|
163
168
|
if (key === _this2.validKey) {
|
|
164
169
|
_this2.validKey = '';
|
|
@@ -174,9 +179,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
174
179
|
var invalid = function invalid() {
|
|
175
180
|
return null;
|
|
176
181
|
};
|
|
177
|
-
var _valid = function _valid(
|
|
178
|
-
var key =
|
|
179
|
-
required =
|
|
182
|
+
var _valid = function _valid(_ref2) {
|
|
183
|
+
var key = _ref2.key,
|
|
184
|
+
required = _ref2.required;
|
|
180
185
|
if (required) {
|
|
181
186
|
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
187
|
_this2.getValidState = invalid;
|
|
@@ -188,9 +193,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
188
193
|
};
|
|
189
194
|
_this2.getValidState = valid ? _valid : invalid;
|
|
190
195
|
});
|
|
191
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "validDate", function (
|
|
192
|
-
var key =
|
|
193
|
-
type =
|
|
196
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "validDate", function (_ref3) {
|
|
197
|
+
var key = _ref3.key,
|
|
198
|
+
type = _ref3.type;
|
|
194
199
|
return function (date) {
|
|
195
200
|
var _this2$props$value = _this2.props.value,
|
|
196
201
|
value = _this2$props$value === void 0 ? {} : _this2$props$value;
|
|
@@ -239,10 +244,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
239
244
|
});
|
|
240
245
|
}
|
|
241
246
|
});
|
|
242
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getType", function (
|
|
247
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "getType", function (_ref4) {
|
|
243
248
|
var _context2;
|
|
244
|
-
var key =
|
|
245
|
-
type =
|
|
249
|
+
var key = _ref4.key,
|
|
250
|
+
type = _ref4.type;
|
|
246
251
|
var readonly = _this2.props.readonly;
|
|
247
252
|
if ((0, _includes["default"])(_context2 = ['area', 'uploadImg']).call(_context2, type)) {
|
|
248
253
|
return type;
|
|
@@ -258,11 +263,11 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
258
263
|
return type;
|
|
259
264
|
}
|
|
260
265
|
});
|
|
261
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "specialProps", function (type,
|
|
262
|
-
var key =
|
|
263
|
-
|
|
264
|
-
props =
|
|
265
|
-
originType =
|
|
266
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "specialProps", function (type, _ref5) {
|
|
267
|
+
var key = _ref5.key,
|
|
268
|
+
_ref5$props = _ref5.props,
|
|
269
|
+
props = _ref5$props === void 0 ? {} : _ref5$props,
|
|
270
|
+
originType = _ref5.type;
|
|
266
271
|
if (type === 'readonly') {
|
|
267
272
|
var _this2$props$highLigh = _this2.props.highLightKeys,
|
|
268
273
|
highLightKeys = _this2$props$highLigh === void 0 ? [] : _this2$props$highLigh;
|
|
@@ -370,9 +375,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
370
375
|
delete props.value;
|
|
371
376
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
372
377
|
});
|
|
373
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toSelect", function (props,
|
|
374
|
-
var options =
|
|
375
|
-
key =
|
|
378
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toSelect", function (props, _ref6) {
|
|
379
|
+
var options = _ref6.options,
|
|
380
|
+
key = _ref6.key;
|
|
376
381
|
props.getPopupContainer = _this2.getPopupContainer;
|
|
377
382
|
props.options = _this2.getOptions(key, options);
|
|
378
383
|
props.dropdownMatchSelectWidth = false;
|
|
@@ -394,8 +399,8 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
394
399
|
props.dropdownMatchSelectWidth = false;
|
|
395
400
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
396
401
|
});
|
|
397
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toDate", function (props,
|
|
398
|
-
var rule =
|
|
402
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toDate", function (props, _ref7) {
|
|
403
|
+
var rule = _ref7.rule;
|
|
399
404
|
props.getCalendarContainer = _this2.getPopupContainer;
|
|
400
405
|
props.style = {
|
|
401
406
|
width: '100%'
|
|
@@ -403,15 +408,15 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
403
408
|
rule && (props.disabledDate = _this2.validDate(rule));
|
|
404
409
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
405
410
|
});
|
|
406
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toRadioGroup", function (props,
|
|
407
|
-
var key =
|
|
408
|
-
options =
|
|
411
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toRadioGroup", function (props, _ref8) {
|
|
412
|
+
var key = _ref8.key,
|
|
413
|
+
options = _ref8.options;
|
|
409
414
|
props.options = _this2.getOptions(key, options);
|
|
410
415
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
411
416
|
});
|
|
412
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toReadonly", function (props,
|
|
413
|
-
var options =
|
|
414
|
-
key =
|
|
417
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toReadonly", function (props, _ref9) {
|
|
418
|
+
var options = _ref9.options,
|
|
419
|
+
key = _ref9.key;
|
|
415
420
|
props.value = (0, _Control.getTitle)(props.value, _this2.getOptions(key, options));
|
|
416
421
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
417
422
|
});
|
|
@@ -422,9 +427,9 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
422
427
|
props.dropdownMatchSelectWidth = false;
|
|
423
428
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
424
429
|
});
|
|
425
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "area", function (props,
|
|
426
|
-
var key =
|
|
427
|
-
options =
|
|
430
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "area", function (props, _ref10) {
|
|
431
|
+
var key = _ref10.key,
|
|
432
|
+
options = _ref10.options;
|
|
428
433
|
var readonly = _this2.props.readonly;
|
|
429
434
|
props.parentKey = key;
|
|
430
435
|
props.options = _this2.getOptions(key, options);
|
|
@@ -503,10 +508,10 @@ var SuperForm = /*#__PURE__*/function (_React$Component2) {
|
|
|
503
508
|
return 'type error';
|
|
504
509
|
}
|
|
505
510
|
});
|
|
506
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toLabel", function (
|
|
507
|
-
var title =
|
|
508
|
-
showAdd =
|
|
509
|
-
key =
|
|
511
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toLabel", function (_ref11, type) {
|
|
512
|
+
var title = _ref11.title,
|
|
513
|
+
showAdd = _ref11.showAdd,
|
|
514
|
+
key = _ref11.key;
|
|
510
515
|
if (showAdd && type !== 'readonly') {
|
|
511
516
|
var _context15;
|
|
512
517
|
var onClick = (0, _bind["default"])(_context15 = _this2.onAdd).call(_context15, (0, _assertThisInitialized2["default"])(_this2), key, title);
|