cloud-b2b 1.1.38 → 1.1.40
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/Control/Control.js +45 -2
- package/es/SuperForm2/SuperForm.js +23 -9
- package/es/SuperTable2/SuperTable2.js +78 -35
- package/es/SuperTable2/SuperTableCell.js +23 -1
- package/es/SuperUpload/SuperUpload.js +74 -13
- package/es/helper.js +9 -2
- package/lib/Control/Control.js +45 -2
- package/lib/SuperForm2/SuperForm.js +23 -9
- package/lib/SuperTable2/SuperTable2.js +78 -35
- package/lib/SuperTable2/SuperTableCell.js +23 -1
- package/lib/SuperUpload/SuperUpload.js +74 -13
- package/lib/helper.js +10 -2
- package/package.json +1 -1
package/es/Control/Control.js
CHANGED
|
@@ -9,6 +9,7 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
|
9
9
|
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
10
10
|
import _DatePicker from "antd/es/date-picker";
|
|
11
11
|
import _typeof from "@babel/runtime-corejs3/helpers/typeof";
|
|
12
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
12
13
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
13
14
|
import _Radio from "antd/es/radio";
|
|
14
15
|
import _Input from "antd/es/input";
|
|
@@ -123,6 +124,33 @@ var textArea = function textArea(props) {
|
|
|
123
124
|
return /*#__PURE__*/React.createElement(TextArea, props);
|
|
124
125
|
};
|
|
125
126
|
|
|
127
|
+
//双选输入框
|
|
128
|
+
var _double = function _double(props) {
|
|
129
|
+
if (props.ref) {
|
|
130
|
+
props.inputRef = props.ref;
|
|
131
|
+
delete props.ref;
|
|
132
|
+
}
|
|
133
|
+
var doubleKey = props.doubleKey,
|
|
134
|
+
onChange = props.onChange;
|
|
135
|
+
var props1 = _objectSpread(_objectSpread({}, props), {}, {
|
|
136
|
+
defaultValue: props.doubleValue[props.doubleKey[0]],
|
|
137
|
+
onChange: props.onChange1
|
|
138
|
+
});
|
|
139
|
+
var props2 = _objectSpread(_objectSpread({}, props), {}, {
|
|
140
|
+
defaultValue: props.doubleValue[props.doubleKey[1]],
|
|
141
|
+
onChange: props.onChange2
|
|
142
|
+
});
|
|
143
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
144
|
+
style: {
|
|
145
|
+
display: 'flex'
|
|
146
|
+
}
|
|
147
|
+
}, /*#__PURE__*/React.createElement(NumberInput, _extends({
|
|
148
|
+
key: 'linePrice'
|
|
149
|
+
}, props1)), "~", /*#__PURE__*/React.createElement(NumberInput, _extends({
|
|
150
|
+
key: 'linePrice2'
|
|
151
|
+
}, props2)));
|
|
152
|
+
};
|
|
153
|
+
|
|
126
154
|
// 只读框
|
|
127
155
|
var readonly = function readonly(props) {
|
|
128
156
|
props.readOnly = true;
|
|
@@ -326,7 +354,8 @@ var controls = {
|
|
|
326
354
|
cascader: cascader,
|
|
327
355
|
captcha: captcha,
|
|
328
356
|
area: area,
|
|
329
|
-
uploadImg: uploadImg
|
|
357
|
+
uploadImg: uploadImg,
|
|
358
|
+
"double": _double
|
|
330
359
|
};
|
|
331
360
|
var Control = function Control(_ref4) {
|
|
332
361
|
var type = _ref4.type,
|
|
@@ -335,7 +364,21 @@ var Control = function Control(_ref4) {
|
|
|
335
364
|
var ref = autoFocus ? function (e) {
|
|
336
365
|
return setFocus(e, type);
|
|
337
366
|
} : null;
|
|
338
|
-
|
|
367
|
+
var _props$doubleKey = props.doubleKey,
|
|
368
|
+
doubleKey = _props$doubleKey === void 0 ? undefined : _props$doubleKey,
|
|
369
|
+
_props$onChange = props.onChange1,
|
|
370
|
+
onChange1 = _props$onChange === void 0 ? undefined : _props$onChange,
|
|
371
|
+
_props$onChange2 = props.onChange2,
|
|
372
|
+
onChange2 = _props$onChange2 === void 0 ? undefined : _props$onChange2,
|
|
373
|
+
_props$doubleValue = props.doubleValue,
|
|
374
|
+
doubleValue = _props$doubleValue === void 0 ? {} : _props$doubleValue;
|
|
375
|
+
return controls[type](_Object$assign(eventWrapper(props), type === 'double' ? {
|
|
376
|
+
ref: ref,
|
|
377
|
+
doubleKey: doubleKey,
|
|
378
|
+
onChange1: onChange1,
|
|
379
|
+
onChange2: onChange2,
|
|
380
|
+
doubleValue: doubleValue
|
|
381
|
+
} : {
|
|
339
382
|
ref: ref
|
|
340
383
|
}));
|
|
341
384
|
};
|
|
@@ -29,7 +29,7 @@ import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/ins
|
|
|
29
29
|
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
30
30
|
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
31
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
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
32
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context26, _context27; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context26 = ownKeys(Object(source), !0)).call(_context26, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context27 = ownKeys(Object(source))).call(_context27, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
33
33
|
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); }; }
|
|
34
34
|
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; } }
|
|
35
35
|
import React from 'react';
|
|
@@ -320,6 +320,8 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
320
320
|
onChange: _bindInstanceProperty(_context16 = _this2.onBlur).call(_context16, _assertThisInitialized(_this2), key),
|
|
321
321
|
onBlur: _bindInstanceProperty(_context17 = _this2.onExitValid).call(_context17, _assertThisInitialized(_this2), key)
|
|
322
322
|
});
|
|
323
|
+
} else if (type === 'double') {
|
|
324
|
+
return props;
|
|
323
325
|
} else {
|
|
324
326
|
var _context18, _context19;
|
|
325
327
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -381,6 +383,16 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
381
383
|
delete props.value;
|
|
382
384
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
383
385
|
});
|
|
386
|
+
_defineProperty(_assertThisInitialized(_this2), "toDoubleInput", function (props, control, cc) {
|
|
387
|
+
var _context20, _context21;
|
|
388
|
+
props.defaultValue = props.value;
|
|
389
|
+
props.doubleKey = props.key;
|
|
390
|
+
props.doubleValue = helper.getObject(cc, props.key);
|
|
391
|
+
props.onChange1 = _bindInstanceProperty(_context20 = _this2.onChange).call(_context20, _assertThisInitialized(_this2), props.key[0]);
|
|
392
|
+
props.onChange2 = _bindInstanceProperty(_context21 = _this2.onChange).call(_context21, _assertThisInitialized(_this2), props.key[1]);
|
|
393
|
+
delete props.value;
|
|
394
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
395
|
+
});
|
|
384
396
|
_defineProperty(_assertThisInitialized(_this2), "toSelect", function (props, _ref6) {
|
|
385
397
|
var options = _ref6.options,
|
|
386
398
|
key = _ref6.key;
|
|
@@ -460,10 +472,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
460
472
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
461
473
|
});
|
|
462
474
|
_defineProperty(_assertThisInitialized(_this2), "uploadImg", function (props, control) {
|
|
463
|
-
var
|
|
475
|
+
var _context22;
|
|
464
476
|
var readonly = _this2.props.readonly;
|
|
465
477
|
props.required = control.required || false;
|
|
466
|
-
props.onFileChange = _bindInstanceProperty(
|
|
478
|
+
props.onFileChange = _bindInstanceProperty(_context22 = _this2.onFileChange).call(_context22, _assertThisInitialized(_this2), control);
|
|
467
479
|
props.readonly = readonly === true || _Array$isArray(readonly) && _someInstanceProperty(readonly).call(readonly, function (readonlyKey) {
|
|
468
480
|
return readonlyKey === control.key;
|
|
469
481
|
}) ? true : false;
|
|
@@ -479,11 +491,11 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
479
491
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
480
492
|
});
|
|
481
493
|
_defineProperty(_assertThisInitialized(_this2), "toCheckbox", function (props, control) {
|
|
482
|
-
var
|
|
494
|
+
var _context23;
|
|
483
495
|
var options = control.options || [];
|
|
484
496
|
return /*#__PURE__*/React.createElement(_Checkbox.Group, {
|
|
485
497
|
options: options,
|
|
486
|
-
onChange: _bindInstanceProperty(
|
|
498
|
+
onChange: _bindInstanceProperty(_context23 = _this2.onBlur).call(_context23, _assertThisInitialized(_this2), control.key),
|
|
487
499
|
value: _this2.props.value[control.key]
|
|
488
500
|
});
|
|
489
501
|
});
|
|
@@ -491,6 +503,8 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
491
503
|
switch (props.type) {
|
|
492
504
|
case 'readonly':
|
|
493
505
|
return _this2.toReadonly(props, control);
|
|
506
|
+
case 'double':
|
|
507
|
+
return _this2.toDoubleInput(props, control, _this2.props.value);
|
|
494
508
|
case 'text':
|
|
495
509
|
return _this2.toText(props, control);
|
|
496
510
|
case 'number':
|
|
@@ -538,8 +552,8 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
538
552
|
showInfo = _ref11.showInfo,
|
|
539
553
|
showInfoTitle = _ref11.showInfoTitle;
|
|
540
554
|
if (showAdd && type !== 'readonly') {
|
|
541
|
-
var
|
|
542
|
-
var onClick = _bindInstanceProperty(
|
|
555
|
+
var _context24;
|
|
556
|
+
var onClick = _bindInstanceProperty(_context24 = _this2.onAdd).call(_context24, _assertThisInitialized(_this2), key, title);
|
|
543
557
|
return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
|
|
544
558
|
role: "add",
|
|
545
559
|
type: "plus-circle-o",
|
|
@@ -601,7 +615,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
601
615
|
});
|
|
602
616
|
});
|
|
603
617
|
_defineProperty(_assertThisInitialized(_this2), "toCols", function () {
|
|
604
|
-
var
|
|
618
|
+
var _context25;
|
|
605
619
|
var _this2$props5 = _this2.props,
|
|
606
620
|
_this2$props5$colNum = _this2$props5.colNum,
|
|
607
621
|
colNum = _this2$props5$colNum === void 0 ? defaultColNum : _this2$props5$colNum,
|
|
@@ -610,7 +624,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
610
624
|
colNum = 1;
|
|
611
625
|
}
|
|
612
626
|
var span = 24 / colNum;
|
|
613
|
-
return _mapInstanceProperty(
|
|
627
|
+
return _mapInstanceProperty(_context25 = _this2.getControls()).call(_context25, function (control) {
|
|
614
628
|
if (allFullFather) {
|
|
615
629
|
control.allFullFather = allFullFather;
|
|
616
630
|
}
|
|
@@ -62,7 +62,7 @@ var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select',
|
|
|
62
62
|
//按钮组
|
|
63
63
|
'img',
|
|
64
64
|
//图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
65
|
-
'uploadImg'];
|
|
65
|
+
'uploadImg', 'double'];
|
|
66
66
|
|
|
67
67
|
/**
|
|
68
68
|
* key:标识所在列,在一个表格中必须唯一
|
|
@@ -156,52 +156,60 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
156
156
|
onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
|
|
157
157
|
};
|
|
158
158
|
});
|
|
159
|
+
_defineProperty(_assertThisInitialized(_this), "onChange1", function (key, rowIndex) {
|
|
160
|
+
return function (doublekey, value) {
|
|
161
|
+
var _ref4 = _this.props.callback || {},
|
|
162
|
+
onContentChange = _ref4.onContentChange;
|
|
163
|
+
_this.closeValid();
|
|
164
|
+
onContentChange && onContentChange(_this.getIndex(rowIndex), doublekey, value);
|
|
165
|
+
};
|
|
166
|
+
});
|
|
159
167
|
_defineProperty(_assertThisInitialized(_this), "onSearch", function (key, rowIndex, config) {
|
|
160
168
|
return function (value) {
|
|
161
|
-
var
|
|
162
|
-
onSearch =
|
|
169
|
+
var _ref5 = _this.props.callback || {},
|
|
170
|
+
onSearch = _ref5.onSearch;
|
|
163
171
|
onSearch && onSearch(_this.getIndex(rowIndex), key, value, config);
|
|
164
172
|
};
|
|
165
173
|
});
|
|
166
174
|
_defineProperty(_assertThisInitialized(_this), "onAdd", function (key) {
|
|
167
175
|
return function () {
|
|
168
|
-
var
|
|
169
|
-
onAdd =
|
|
176
|
+
var _ref6 = _this.props.callback || {},
|
|
177
|
+
onAdd = _ref6.onAdd;
|
|
170
178
|
onAdd && onAdd(key);
|
|
171
179
|
};
|
|
172
180
|
});
|
|
173
181
|
_defineProperty(_assertThisInitialized(_this), "onRowAdd", function (key, index) {
|
|
174
182
|
return function () {
|
|
175
|
-
var
|
|
176
|
-
onLink =
|
|
183
|
+
var _ref7 = _this.props.callback || {},
|
|
184
|
+
onLink = _ref7.onLink;
|
|
177
185
|
onLink && onLink(key, index, _this.props.items[index]);
|
|
178
186
|
};
|
|
179
187
|
});
|
|
180
188
|
_defineProperty(_assertThisInitialized(_this), "onBlur", function (key, rowIndex) {
|
|
181
189
|
return function (value) {
|
|
182
|
-
var
|
|
183
|
-
onBlur =
|
|
190
|
+
var _ref8 = _this.props.callback || {},
|
|
191
|
+
onBlur = _ref8.onBlur;
|
|
184
192
|
_this.closeValid();
|
|
185
193
|
onBlur && onBlur(_this.getIndex(rowIndex), key, value);
|
|
186
194
|
};
|
|
187
195
|
});
|
|
188
196
|
_defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (key, value) {
|
|
189
197
|
return function () {
|
|
190
|
-
var
|
|
191
|
-
onDoubleClick =
|
|
198
|
+
var _ref9 = _this.props.callback || {},
|
|
199
|
+
onDoubleClick = _ref9.onDoubleClick;
|
|
192
200
|
onDoubleClick && onDoubleClick(key, value);
|
|
193
201
|
};
|
|
194
202
|
});
|
|
195
203
|
_defineProperty(_assertThisInitialized(_this), "onImgTileClick", function (col, value, rowIndex) {
|
|
196
204
|
return function () {
|
|
197
|
-
var
|
|
198
|
-
onImgTileClick =
|
|
205
|
+
var _ref10 = _this.props.callback || {},
|
|
206
|
+
onImgTileClick = _ref10.onImgTileClick;
|
|
199
207
|
onImgTileClick && onImgTileClick(col, value, rowIndex);
|
|
200
208
|
};
|
|
201
209
|
});
|
|
202
210
|
_defineProperty(_assertThisInitialized(_this), "onMoveRow", function (dragIndex, targetIndex) {
|
|
203
|
-
var
|
|
204
|
-
onMoveRow =
|
|
211
|
+
var _ref11 = _this.props.callback || {},
|
|
212
|
+
onMoveRow = _ref11.onMoveRow;
|
|
205
213
|
onMoveRow && onMoveRow(dragIndex, targetIndex);
|
|
206
214
|
});
|
|
207
215
|
_defineProperty(_assertThisInitialized(_this), "closeValid", function () {
|
|
@@ -251,6 +259,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
251
259
|
var cellProps = {
|
|
252
260
|
value: value,
|
|
253
261
|
width: width,
|
|
262
|
+
items: _this.props.items[index],
|
|
254
263
|
type: readonly || _Array$isArray(isReadonly) && _includesInstanceProperty(isReadonly).call(isReadonly, key) || _this.props.readonly ? 'readonly' : type,
|
|
255
264
|
props: readonly ? {} : props,
|
|
256
265
|
error: _this.validField(required, value),
|
|
@@ -323,6 +332,36 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
323
332
|
}
|
|
324
333
|
return /*#__PURE__*/React.createElement(SuperTableCell, cellProps);
|
|
325
334
|
});
|
|
335
|
+
_defineProperty(_assertThisInitialized(_this), "renderDoubleEditableCell", function (config, value, index) {
|
|
336
|
+
var key = config.key,
|
|
337
|
+
type = config.type,
|
|
338
|
+
options = config.options,
|
|
339
|
+
props = config.props,
|
|
340
|
+
required = config.required,
|
|
341
|
+
width = config.width,
|
|
342
|
+
showRowAdd = config.showRowAdd;
|
|
343
|
+
var _this$props$items$ind5 = _this.props.items[index],
|
|
344
|
+
readonly = _this$props$items$ind5.readonly,
|
|
345
|
+
_this$props$items$ind6 = _this$props$items$ind5.isReadonly,
|
|
346
|
+
isReadonly = _this$props$items$ind6 === void 0 ? [] : _this$props$items$ind6,
|
|
347
|
+
_this$props$items$ind7 = _this$props$items$ind5.isRequired,
|
|
348
|
+
isRequired = _this$props$items$ind7 === void 0 ? [] : _this$props$items$ind7,
|
|
349
|
+
_this$props$items$ind8 = _this$props$items$ind5._extraProps,
|
|
350
|
+
_extraProps = _this$props$items$ind8 === void 0 ? {} : _this$props$items$ind8;
|
|
351
|
+
var cellProps = {
|
|
352
|
+
value: value,
|
|
353
|
+
width: width,
|
|
354
|
+
items: _this.props.items[index],
|
|
355
|
+
type: readonly || _Array$isArray(isReadonly) && _includesInstanceProperty(isReadonly).call(isReadonly, key) || _this.props.readonly ? 'readonly' : type,
|
|
356
|
+
props: readonly ? {} : props,
|
|
357
|
+
error: _this.validField(required, value),
|
|
358
|
+
options: _this.getOptions(key, options, index),
|
|
359
|
+
onChange: _this.onChange1(key, index),
|
|
360
|
+
onSearch: _this.onSearch(key, index, config),
|
|
361
|
+
onBlur: _this.onBlur(key, index)
|
|
362
|
+
};
|
|
363
|
+
return /*#__PURE__*/React.createElement(SuperTableCell, cellProps);
|
|
364
|
+
});
|
|
326
365
|
_defineProperty(_assertThisInitialized(_this), "renderLinkCell", function (col, value, record, index) {
|
|
327
366
|
if (col.link === 'list') {
|
|
328
367
|
var list = value && _Array$isArray(value) ? value : [];
|
|
@@ -334,8 +373,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
334
373
|
var _context2;
|
|
335
374
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
336
375
|
var onClick = function onClick() {
|
|
337
|
-
var
|
|
338
|
-
onLink =
|
|
376
|
+
var _ref12 = _this.props.callback || {},
|
|
377
|
+
onLink = _ref12.onLink;
|
|
339
378
|
onLink && onLink(col.key, index, item2);
|
|
340
379
|
};
|
|
341
380
|
return /*#__PURE__*/React.createElement("a", {
|
|
@@ -346,8 +385,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
346
385
|
} else {
|
|
347
386
|
var title = typeof col.link === 'string' ? col.link : value;
|
|
348
387
|
var onClick = function onClick() {
|
|
349
|
-
var
|
|
350
|
-
onLink =
|
|
388
|
+
var _ref13 = _this.props.callback || {},
|
|
389
|
+
onLink = _ref13.onLink;
|
|
351
390
|
onLink && onLink(col.key, index, record);
|
|
352
391
|
};
|
|
353
392
|
return /*#__PURE__*/React.createElement("a", {
|
|
@@ -488,6 +527,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
488
527
|
value: _this.props.items[index][col.key]
|
|
489
528
|
});
|
|
490
529
|
return /*#__PURE__*/React.createElement(Control, uploadProps);
|
|
530
|
+
case 'double':
|
|
531
|
+
return _this.renderDoubleEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
532
|
+
type: realType
|
|
533
|
+
}), value, record.key);
|
|
491
534
|
default:
|
|
492
535
|
return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
493
536
|
type: realType
|
|
@@ -528,12 +571,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
528
571
|
return null;
|
|
529
572
|
}
|
|
530
573
|
});
|
|
531
|
-
_defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (
|
|
532
|
-
var required =
|
|
533
|
-
title =
|
|
534
|
-
type =
|
|
535
|
-
key =
|
|
536
|
-
showAdd =
|
|
574
|
+
_defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref14) {
|
|
575
|
+
var required = _ref14.required,
|
|
576
|
+
title = _ref14.title,
|
|
577
|
+
type = _ref14.type,
|
|
578
|
+
key = _ref14.key,
|
|
579
|
+
showAdd = _ref14.showAdd;
|
|
537
580
|
if (type === 'checkbox') {
|
|
538
581
|
var status = _this.getCheckedStatus(key);
|
|
539
582
|
return /*#__PURE__*/React.createElement(_Checkbox, _extends({
|
|
@@ -546,9 +589,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
546
589
|
}, title, _this.toAdd(key, showAdd));
|
|
547
590
|
}
|
|
548
591
|
});
|
|
549
|
-
_defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (
|
|
550
|
-
var type =
|
|
551
|
-
align =
|
|
592
|
+
_defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref15) {
|
|
593
|
+
var type = _ref15.type,
|
|
594
|
+
align = _ref15.align;
|
|
552
595
|
if (type === 'index' || type === 'checkbox') {
|
|
553
596
|
return 'ant-table-selection-column';
|
|
554
597
|
} else {
|
|
@@ -557,16 +600,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
557
600
|
});
|
|
558
601
|
_defineProperty(_assertThisInitialized(_this), "canReadonly", function (type) {
|
|
559
602
|
var _context11;
|
|
560
|
-
return !_includesInstanceProperty(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context11, type);
|
|
603
|
+
return !_includesInstanceProperty(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg', 'double']).call(_context11, type);
|
|
561
604
|
});
|
|
562
605
|
_defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
|
|
563
606
|
var _context12;
|
|
564
607
|
var readonly = _this.props.readonly;
|
|
565
608
|
return _mapInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
|
|
566
609
|
return !col.hide;
|
|
567
|
-
})).call(_context12, function (
|
|
610
|
+
})).call(_context12, function (_ref16, index) {
|
|
568
611
|
var _context13;
|
|
569
|
-
var col = _extends({}, (_objectDestructuringEmpty(
|
|
612
|
+
var col = _extends({}, (_objectDestructuringEmpty(_ref16), _ref16));
|
|
570
613
|
col.className = _this.getColumnClassName(col);
|
|
571
614
|
col.title = _this.getColumnTitle(col);
|
|
572
615
|
col.dataIndex = col.key;
|
|
@@ -598,11 +641,11 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
598
641
|
});
|
|
599
642
|
_defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
|
|
600
643
|
return _mapInstanceProperty(items).call(items, function (item, index) {
|
|
601
|
-
return _reduceInstanceProperty(cols).call(cols, function (result,
|
|
644
|
+
return _reduceInstanceProperty(cols).call(cols, function (result, _ref17) {
|
|
602
645
|
var _context14, _context15;
|
|
603
|
-
var key =
|
|
604
|
-
type =
|
|
605
|
-
options =
|
|
646
|
+
var key = _ref17.key,
|
|
647
|
+
type = _ref17.type,
|
|
648
|
+
options = _ref17.options;
|
|
606
649
|
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context14 = item.isReadonly).call(_context14, key)) || _includesInstanceProperty(_context15 = ['img', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context15, type)) {
|
|
607
650
|
result[key] = item[key];
|
|
608
651
|
} else {
|
|
@@ -15,14 +15,16 @@ import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleC
|
|
|
15
15
|
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
16
16
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
17
17
|
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; }
|
|
18
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
18
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context5 = ownKeys(Object(source))).call(_context5, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
19
19
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
20
|
+
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
20
21
|
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); }; }
|
|
21
22
|
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; } }
|
|
22
23
|
import React from 'react';
|
|
23
24
|
import PropTypes from 'prop-types';
|
|
24
25
|
import ReactDOM from 'react-dom';
|
|
25
26
|
import Control from '../Control';
|
|
27
|
+
import helper from "../helper";
|
|
26
28
|
|
|
27
29
|
// 单元格的type只能取如下值:
|
|
28
30
|
// 'text', 'number', select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'
|
|
@@ -53,6 +55,12 @@ var SuperTableCell = /*#__PURE__*/function (_React$Component) {
|
|
|
53
55
|
_this.props.onBlur();
|
|
54
56
|
}
|
|
55
57
|
});
|
|
58
|
+
_defineProperty(_assertThisInitialized(_this), "onChange", function (key, value) {
|
|
59
|
+
var onChange = _this.props.onChange;
|
|
60
|
+
if (onChange) {
|
|
61
|
+
onChange(key, value);
|
|
62
|
+
}
|
|
63
|
+
});
|
|
56
64
|
_defineProperty(_assertThisInitialized(_this), "onOpenChange", function (open) {
|
|
57
65
|
if (!open) {
|
|
58
66
|
var targets = document.getElementsByClassName('ant-calendar-picker-container');
|
|
@@ -81,6 +89,16 @@ var SuperTableCell = /*#__PURE__*/function (_React$Component) {
|
|
|
81
89
|
delete props.value;
|
|
82
90
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
83
91
|
});
|
|
92
|
+
_defineProperty(_assertThisInitialized(_this), "toDoubleNumberComponent", function (props, cc) {
|
|
93
|
+
var _context2, _context3;
|
|
94
|
+
props.defaultValue = props.value;
|
|
95
|
+
props.doubleKey = props.key;
|
|
96
|
+
props.doubleValue = helper.getObject(cc, props.key);
|
|
97
|
+
props.onChange1 = _bindInstanceProperty(_context2 = _this.onChange).call(_context2, _assertThisInitialized(_this), props.key[0]);
|
|
98
|
+
props.onChange2 = _bindInstanceProperty(_context3 = _this.onChange).call(_context3, _assertThisInitialized(_this), props.key[1]);
|
|
99
|
+
delete props.value;
|
|
100
|
+
return /*#__PURE__*/React.createElement(Control, props);
|
|
101
|
+
});
|
|
84
102
|
_defineProperty(_assertThisInitialized(_this), "toDateComponent", function (props) {
|
|
85
103
|
//props.getCalendarContainer = this.getPopupContainer;
|
|
86
104
|
props.onBlur = _this.onDateBlur;
|
|
@@ -156,6 +174,10 @@ var SuperTableCell = /*#__PURE__*/function (_React$Component) {
|
|
|
156
174
|
}, this.toDateComponent(props));
|
|
157
175
|
case 'readonly':
|
|
158
176
|
return this.toReadonlyComponent(props);
|
|
177
|
+
case 'double':
|
|
178
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
179
|
+
className: className
|
|
180
|
+
}, this.toDoubleNumberComponent(props, this.props.items));
|
|
159
181
|
default:
|
|
160
182
|
return /*#__PURE__*/React.createElement("div", null, "\"error type\"");
|
|
161
183
|
}
|
|
@@ -4,6 +4,9 @@ import _Button from "antd/es/button";
|
|
|
4
4
|
import _Icon from "antd/es/icon";
|
|
5
5
|
import _asyncToGenerator from "@babel/runtime-corejs3/helpers/asyncToGenerator";
|
|
6
6
|
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
7
|
+
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = it.call(o); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it["return"] != null) it["return"](); } finally { if (didErr) throw err; } } }; }
|
|
8
|
+
function _unsupportedIterableToArray(o, minLen) { var _context7; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context7 = Object.prototype.toString.call(o)).call(_context7, 8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return _Array$from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
9
|
+
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) arr2[i] = arr[i]; return arr2; }
|
|
7
10
|
import _regeneratorRuntime from "@babel/runtime-corejs3/regenerator";
|
|
8
11
|
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; }
|
|
9
12
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context5, _context6; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context5 = ownKeys(Object(source), !0)).call(_context5, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context6 = ownKeys(Object(source))).call(_context6, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
@@ -17,6 +20,11 @@ import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/inst
|
|
|
17
20
|
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
18
21
|
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
19
22
|
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
23
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
24
|
+
import _Array$from from "@babel/runtime-corejs3/core-js-stable/array/from";
|
|
25
|
+
import _Symbol from "@babel/runtime-corejs3/core-js-stable/symbol";
|
|
26
|
+
import _getIteratorMethod from "@babel/runtime-corejs3/core-js/get-iterator-method";
|
|
27
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
20
28
|
import React, { useState, useEffect } from 'react';
|
|
21
29
|
import PropTypes from 'prop-types';
|
|
22
30
|
import helper from '../helper';
|
|
@@ -76,6 +84,8 @@ var getUploadProps = function getUploadProps(props, onPreview, fileList, setFile
|
|
|
76
84
|
var onChange = function onChange(_ref) {
|
|
77
85
|
var file = _ref.file,
|
|
78
86
|
fileList = _ref.fileList;
|
|
87
|
+
var limitNumber = props.limitNumber;
|
|
88
|
+
if (fileList.length > limitNumber) return helper.showError("\u6587\u4EF6\u6700\u591A\u53EF\u4E0A\u4F20".concat(limitNumber, "\u4E2A"));
|
|
79
89
|
if (!file) return; //过滤掉不符合条件的响应
|
|
80
90
|
var newList = [];
|
|
81
91
|
if (file.response && file.response.returnCode !== 0) {
|
|
@@ -184,37 +194,88 @@ function SuperUpload(props) {
|
|
|
184
194
|
_useState4 = _slicedToArray(_useState3, 2),
|
|
185
195
|
fileList = _useState4[0],
|
|
186
196
|
setFileList = _useState4[1];
|
|
197
|
+
var initFileList = [];
|
|
187
198
|
useEffect(function () {
|
|
188
199
|
function fetchImgData() {
|
|
189
200
|
return _fetchImgData.apply(this, arguments);
|
|
190
201
|
}
|
|
191
202
|
function _fetchImgData() {
|
|
192
203
|
_fetchImgData = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime.mark(function _callee2() {
|
|
193
|
-
var
|
|
204
|
+
var _iterator, _step, item;
|
|
194
205
|
return _regeneratorRuntime.wrap(function _callee2$(_context3) {
|
|
195
206
|
while (1) switch (_context3.prev = _context3.next) {
|
|
196
207
|
case 0:
|
|
208
|
+
if (!(props.fileList.length > 0)) {
|
|
209
|
+
_context3.next = 35;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
_iterator = _createForOfIteratorHelper(props.fileList);
|
|
213
|
+
_context3.prev = 2;
|
|
214
|
+
_iterator.s();
|
|
215
|
+
case 4:
|
|
216
|
+
if ((_step = _iterator.n()).done) {
|
|
217
|
+
_context3.next = 27;
|
|
218
|
+
break;
|
|
219
|
+
}
|
|
220
|
+
item = _step.value;
|
|
221
|
+
if (!(item.fileUrl == '')) {
|
|
222
|
+
_context3.next = 17;
|
|
223
|
+
break;
|
|
224
|
+
}
|
|
197
225
|
if (!props.getFileList) {
|
|
198
|
-
_context3.next =
|
|
226
|
+
_context3.next = 13;
|
|
199
227
|
break;
|
|
200
228
|
}
|
|
201
|
-
_context3.next =
|
|
202
|
-
return props.getFileList(
|
|
203
|
-
case
|
|
229
|
+
_context3.next = 10;
|
|
230
|
+
return props.getFileList(fileList);
|
|
231
|
+
case 10:
|
|
204
232
|
_context3.t0 = _context3.sent;
|
|
205
|
-
_context3.next =
|
|
233
|
+
_context3.next = 14;
|
|
206
234
|
break;
|
|
207
|
-
case
|
|
235
|
+
case 13:
|
|
208
236
|
_context3.t0 = [];
|
|
209
|
-
case
|
|
237
|
+
case 14:
|
|
210
238
|
initFileList = _context3.t0;
|
|
211
|
-
|
|
239
|
+
_context3.next = 25;
|
|
240
|
+
break;
|
|
241
|
+
case 17:
|
|
242
|
+
if (!props.getFileList) {
|
|
243
|
+
_context3.next = 23;
|
|
244
|
+
break;
|
|
245
|
+
}
|
|
246
|
+
_context3.next = 20;
|
|
247
|
+
return props.getFileList(props.fileList);
|
|
248
|
+
case 20:
|
|
249
|
+
_context3.t1 = _context3.sent;
|
|
250
|
+
_context3.next = 24;
|
|
251
|
+
break;
|
|
252
|
+
case 23:
|
|
253
|
+
_context3.t1 = [];
|
|
254
|
+
case 24:
|
|
255
|
+
initFileList = _context3.t1;
|
|
256
|
+
case 25:
|
|
257
|
+
_context3.next = 4;
|
|
258
|
+
break;
|
|
259
|
+
case 27:
|
|
260
|
+
_context3.next = 32;
|
|
261
|
+
break;
|
|
262
|
+
case 29:
|
|
263
|
+
_context3.prev = 29;
|
|
264
|
+
_context3.t2 = _context3["catch"](2);
|
|
265
|
+
_iterator.e(_context3.t2);
|
|
266
|
+
case 32:
|
|
267
|
+
_context3.prev = 32;
|
|
268
|
+
_iterator.f();
|
|
269
|
+
return _context3.finish(32);
|
|
270
|
+
case 35:
|
|
271
|
+
//const initFileList = props.getFileList ? await props.getFileList(props.fileList) : [];
|
|
272
|
+
setFileList(initFileList ? initFileList : []);
|
|
212
273
|
setLoading(false);
|
|
213
|
-
case
|
|
274
|
+
case 37:
|
|
214
275
|
case "end":
|
|
215
276
|
return _context3.stop();
|
|
216
277
|
}
|
|
217
|
-
}, _callee2);
|
|
278
|
+
}, _callee2, null, [[2, 29, 32, 35]]);
|
|
218
279
|
}));
|
|
219
280
|
return _fetchImgData.apply(this, arguments);
|
|
220
281
|
}
|
|
@@ -243,8 +304,8 @@ function SuperUpload(props) {
|
|
|
243
304
|
limitNumber = _props$limitNumber === void 0 ? 10 : _props$limitNumber,
|
|
244
305
|
readonly = props.readonly,
|
|
245
306
|
title = props.title;
|
|
246
|
-
var className = listType === 'picture-card' && fileList.length < limitNumber ? variables('SuperUpload') : variables('SuperUpload2');
|
|
247
|
-
var canUpload = fileList.length >= limitNumber;
|
|
307
|
+
var className = listType === 'picture-card' && (fileList === null || fileList === void 0 ? void 0 : fileList.length) < limitNumber ? variables('SuperUpload') : variables('SuperUpload2');
|
|
308
|
+
var canUpload = (fileList === null || fileList === void 0 ? void 0 : fileList.length) >= limitNumber;
|
|
248
309
|
return loading ? /*#__PURE__*/React.createElement("div", null, "loading...") : /*#__PURE__*/React.createElement("div", {
|
|
249
310
|
className: className
|
|
250
311
|
}, (listType === 'picture-card' || readonly) && title ? /*#__PURE__*/React.createElement(Title, {
|
package/es/helper.js
CHANGED
|
@@ -126,6 +126,12 @@ var showError = function showError(msg) {
|
|
|
126
126
|
var showSuccessMsg = function showSuccessMsg(msg) {
|
|
127
127
|
message.success(msg);
|
|
128
128
|
};
|
|
129
|
+
var getObject = function getObject(obj, keys) {
|
|
130
|
+
return _reduceInstanceProperty(keys).call(keys, function (newObj, key) {
|
|
131
|
+
newObj[key] = obj[key];
|
|
132
|
+
return newObj;
|
|
133
|
+
}, {});
|
|
134
|
+
};
|
|
129
135
|
var helper = {
|
|
130
136
|
getObjectExclude: getObjectExclude,
|
|
131
137
|
getUsername: getUsername,
|
|
@@ -134,7 +140,8 @@ var helper = {
|
|
|
134
140
|
isEmpty2: isEmpty2,
|
|
135
141
|
showError: showError,
|
|
136
142
|
showSuccessMsg: showSuccessMsg,
|
|
137
|
-
toThousands: toThousands
|
|
143
|
+
toThousands: toThousands,
|
|
144
|
+
getObject: getObject
|
|
138
145
|
};
|
|
139
|
-
export { getObjectExclude, getUsername, getPathValue, isEmpty, isEmpty2, showError, showSuccessMsg, toThousands };
|
|
146
|
+
export { getObject, getObjectExclude, getUsername, getPathValue, isEmpty, isEmpty2, showError, showSuccessMsg, toThousands };
|
|
140
147
|
export default helper;
|