cloud-b2b 1.1.39 → 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/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/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
|
}
|
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;
|
package/lib/Control/Control.js
CHANGED
|
@@ -26,6 +26,7 @@ var _find = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stabl
|
|
|
26
26
|
var _findIndex = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/find-index"));
|
|
27
27
|
var _datePicker = _interopRequireDefault(require("antd/lib/date-picker"));
|
|
28
28
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
29
|
+
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
29
30
|
var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
|
|
30
31
|
var _radio = _interopRequireDefault(require("antd/lib/radio"));
|
|
31
32
|
var _input = _interopRequireDefault(require("antd/lib/input"));
|
|
@@ -130,6 +131,33 @@ var textArea = function textArea(props) {
|
|
|
130
131
|
return /*#__PURE__*/_react["default"].createElement(TextArea, props);
|
|
131
132
|
};
|
|
132
133
|
|
|
134
|
+
//双选输入框
|
|
135
|
+
var _double = function _double(props) {
|
|
136
|
+
if (props.ref) {
|
|
137
|
+
props.inputRef = props.ref;
|
|
138
|
+
delete props.ref;
|
|
139
|
+
}
|
|
140
|
+
var doubleKey = props.doubleKey,
|
|
141
|
+
onChange = props.onChange;
|
|
142
|
+
var props1 = _objectSpread(_objectSpread({}, props), {}, {
|
|
143
|
+
defaultValue: props.doubleValue[props.doubleKey[0]],
|
|
144
|
+
onChange: props.onChange1
|
|
145
|
+
});
|
|
146
|
+
var props2 = _objectSpread(_objectSpread({}, props), {}, {
|
|
147
|
+
defaultValue: props.doubleValue[props.doubleKey[1]],
|
|
148
|
+
onChange: props.onChange2
|
|
149
|
+
});
|
|
150
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
151
|
+
style: {
|
|
152
|
+
display: 'flex'
|
|
153
|
+
}
|
|
154
|
+
}, /*#__PURE__*/_react["default"].createElement(_NumberInput["default"], (0, _extends2["default"])({
|
|
155
|
+
key: 'linePrice'
|
|
156
|
+
}, props1)), "~", /*#__PURE__*/_react["default"].createElement(_NumberInput["default"], (0, _extends2["default"])({
|
|
157
|
+
key: 'linePrice2'
|
|
158
|
+
}, props2)));
|
|
159
|
+
};
|
|
160
|
+
|
|
133
161
|
// 只读框
|
|
134
162
|
var readonly = function readonly(props) {
|
|
135
163
|
props.readOnly = true;
|
|
@@ -333,7 +361,8 @@ var controls = {
|
|
|
333
361
|
cascader: cascader,
|
|
334
362
|
captcha: captcha,
|
|
335
363
|
area: area,
|
|
336
|
-
uploadImg: uploadImg
|
|
364
|
+
uploadImg: uploadImg,
|
|
365
|
+
"double": _double
|
|
337
366
|
};
|
|
338
367
|
var Control = function Control(_ref4) {
|
|
339
368
|
var type = _ref4.type,
|
|
@@ -342,7 +371,21 @@ var Control = function Control(_ref4) {
|
|
|
342
371
|
var ref = autoFocus ? function (e) {
|
|
343
372
|
return setFocus(e, type);
|
|
344
373
|
} : null;
|
|
345
|
-
|
|
374
|
+
var _props$doubleKey = props.doubleKey,
|
|
375
|
+
doubleKey = _props$doubleKey === void 0 ? undefined : _props$doubleKey,
|
|
376
|
+
_props$onChange = props.onChange1,
|
|
377
|
+
onChange1 = _props$onChange === void 0 ? undefined : _props$onChange,
|
|
378
|
+
_props$onChange2 = props.onChange2,
|
|
379
|
+
onChange2 = _props$onChange2 === void 0 ? undefined : _props$onChange2,
|
|
380
|
+
_props$doubleValue = props.doubleValue,
|
|
381
|
+
doubleValue = _props$doubleValue === void 0 ? {} : _props$doubleValue;
|
|
382
|
+
return controls[type]((0, _assign["default"])((0, _event["default"])(props), type === 'double' ? {
|
|
383
|
+
ref: ref,
|
|
384
|
+
doubleKey: doubleKey,
|
|
385
|
+
onChange1: onChange1,
|
|
386
|
+
onChange2: onChange2,
|
|
387
|
+
doubleValue: doubleValue
|
|
388
|
+
} : {
|
|
346
389
|
ref: ref
|
|
347
390
|
}));
|
|
348
391
|
};
|
|
@@ -47,7 +47,7 @@ var _variables = _interopRequireDefault(require("../variables"));
|
|
|
47
47
|
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); }
|
|
48
48
|
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; }
|
|
49
49
|
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; }
|
|
50
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
50
|
+
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) { (0, _defineProperty2["default"])(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; }
|
|
51
51
|
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); }; }
|
|
52
52
|
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; } }
|
|
53
53
|
var FormItem = _form["default"].Item;
|
|
@@ -332,6 +332,8 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
332
332
|
onChange: (0, _bind["default"])(_context16 = _this2.onBlur).call(_context16, (0, _assertThisInitialized2["default"])(_this2), key),
|
|
333
333
|
onBlur: (0, _bind["default"])(_context17 = _this2.onExitValid).call(_context17, (0, _assertThisInitialized2["default"])(_this2), key)
|
|
334
334
|
});
|
|
335
|
+
} else if (type === 'double') {
|
|
336
|
+
return props;
|
|
335
337
|
} else {
|
|
336
338
|
var _context18, _context19;
|
|
337
339
|
return _objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -393,6 +395,16 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
393
395
|
delete props.value;
|
|
394
396
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
395
397
|
});
|
|
398
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toDoubleInput", function (props, control, cc) {
|
|
399
|
+
var _context20, _context21;
|
|
400
|
+
props.defaultValue = props.value;
|
|
401
|
+
props.doubleKey = props.key;
|
|
402
|
+
props.doubleValue = _helper["default"].getObject(cc, props.key);
|
|
403
|
+
props.onChange1 = (0, _bind["default"])(_context20 = _this2.onChange).call(_context20, (0, _assertThisInitialized2["default"])(_this2), props.key[0]);
|
|
404
|
+
props.onChange2 = (0, _bind["default"])(_context21 = _this2.onChange).call(_context21, (0, _assertThisInitialized2["default"])(_this2), props.key[1]);
|
|
405
|
+
delete props.value;
|
|
406
|
+
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
407
|
+
});
|
|
396
408
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toSelect", function (props, _ref6) {
|
|
397
409
|
var options = _ref6.options,
|
|
398
410
|
key = _ref6.key;
|
|
@@ -472,10 +484,10 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
472
484
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
473
485
|
});
|
|
474
486
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "uploadImg", function (props, control) {
|
|
475
|
-
var
|
|
487
|
+
var _context22;
|
|
476
488
|
var readonly = _this2.props.readonly;
|
|
477
489
|
props.required = control.required || false;
|
|
478
|
-
props.onFileChange = (0, _bind["default"])(
|
|
490
|
+
props.onFileChange = (0, _bind["default"])(_context22 = _this2.onFileChange).call(_context22, (0, _assertThisInitialized2["default"])(_this2), control);
|
|
479
491
|
props.readonly = readonly === true || (0, _isArray["default"])(readonly) && (0, _some["default"])(readonly).call(readonly, function (readonlyKey) {
|
|
480
492
|
return readonlyKey === control.key;
|
|
481
493
|
}) ? true : false;
|
|
@@ -491,11 +503,11 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
491
503
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
492
504
|
});
|
|
493
505
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCheckbox", function (props, control) {
|
|
494
|
-
var
|
|
506
|
+
var _context23;
|
|
495
507
|
var options = control.options || [];
|
|
496
508
|
return /*#__PURE__*/_react["default"].createElement(_checkbox["default"].Group, {
|
|
497
509
|
options: options,
|
|
498
|
-
onChange: (0, _bind["default"])(
|
|
510
|
+
onChange: (0, _bind["default"])(_context23 = _this2.onBlur).call(_context23, (0, _assertThisInitialized2["default"])(_this2), control.key),
|
|
499
511
|
value: _this2.props.value[control.key]
|
|
500
512
|
});
|
|
501
513
|
});
|
|
@@ -503,6 +515,8 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
503
515
|
switch (props.type) {
|
|
504
516
|
case 'readonly':
|
|
505
517
|
return _this2.toReadonly(props, control);
|
|
518
|
+
case 'double':
|
|
519
|
+
return _this2.toDoubleInput(props, control, _this2.props.value);
|
|
506
520
|
case 'text':
|
|
507
521
|
return _this2.toText(props, control);
|
|
508
522
|
case 'number':
|
|
@@ -550,8 +564,8 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
550
564
|
showInfo = _ref11.showInfo,
|
|
551
565
|
showInfoTitle = _ref11.showInfoTitle;
|
|
552
566
|
if (showAdd && type !== 'readonly') {
|
|
553
|
-
var
|
|
554
|
-
var onClick = (0, _bind["default"])(
|
|
567
|
+
var _context24;
|
|
568
|
+
var onClick = (0, _bind["default"])(_context24 = _this2.onAdd).call(_context24, (0, _assertThisInitialized2["default"])(_this2), key, title);
|
|
555
569
|
return /*#__PURE__*/_react["default"].createElement("span", null, title, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
556
570
|
role: "add",
|
|
557
571
|
type: "plus-circle-o",
|
|
@@ -613,7 +627,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
613
627
|
});
|
|
614
628
|
});
|
|
615
629
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCols", function () {
|
|
616
|
-
var
|
|
630
|
+
var _context25;
|
|
617
631
|
var _this2$props5 = _this2.props,
|
|
618
632
|
_this2$props5$colNum = _this2$props5.colNum,
|
|
619
633
|
colNum = _this2$props5$colNum === void 0 ? defaultColNum : _this2$props5$colNum,
|
|
@@ -622,7 +636,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
622
636
|
colNum = 1;
|
|
623
637
|
}
|
|
624
638
|
var span = 24 / colNum;
|
|
625
|
-
return (0, _map["default"])(
|
|
639
|
+
return (0, _map["default"])(_context25 = _this2.getControls()).call(_context25, function (control) {
|
|
626
640
|
if (allFullFather) {
|
|
627
641
|
control.allFullFather = allFullFather;
|
|
628
642
|
}
|
|
@@ -75,7 +75,7 @@ var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select',
|
|
|
75
75
|
//按钮组
|
|
76
76
|
'img',
|
|
77
77
|
//图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
78
|
-
'uploadImg'];
|
|
78
|
+
'uploadImg', 'double'];
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* key:标识所在列,在一个表格中必须唯一
|
|
@@ -169,52 +169,60 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
169
169
|
onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
|
|
170
170
|
};
|
|
171
171
|
});
|
|
172
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange1", function (key, rowIndex) {
|
|
173
|
+
return function (doublekey, value) {
|
|
174
|
+
var _ref4 = _this.props.callback || {},
|
|
175
|
+
onContentChange = _ref4.onContentChange;
|
|
176
|
+
_this.closeValid();
|
|
177
|
+
onContentChange && onContentChange(_this.getIndex(rowIndex), doublekey, value);
|
|
178
|
+
};
|
|
179
|
+
});
|
|
172
180
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSearch", function (key, rowIndex, config) {
|
|
173
181
|
return function (value) {
|
|
174
|
-
var
|
|
175
|
-
onSearch =
|
|
182
|
+
var _ref5 = _this.props.callback || {},
|
|
183
|
+
onSearch = _ref5.onSearch;
|
|
176
184
|
onSearch && onSearch(_this.getIndex(rowIndex), key, value, config);
|
|
177
185
|
};
|
|
178
186
|
});
|
|
179
187
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAdd", function (key) {
|
|
180
188
|
return function () {
|
|
181
|
-
var
|
|
182
|
-
onAdd =
|
|
189
|
+
var _ref6 = _this.props.callback || {},
|
|
190
|
+
onAdd = _ref6.onAdd;
|
|
183
191
|
onAdd && onAdd(key);
|
|
184
192
|
};
|
|
185
193
|
});
|
|
186
194
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRowAdd", function (key, index) {
|
|
187
195
|
return function () {
|
|
188
|
-
var
|
|
189
|
-
onLink =
|
|
196
|
+
var _ref7 = _this.props.callback || {},
|
|
197
|
+
onLink = _ref7.onLink;
|
|
190
198
|
onLink && onLink(key, index, _this.props.items[index]);
|
|
191
199
|
};
|
|
192
200
|
});
|
|
193
201
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (key, rowIndex) {
|
|
194
202
|
return function (value) {
|
|
195
|
-
var
|
|
196
|
-
onBlur =
|
|
203
|
+
var _ref8 = _this.props.callback || {},
|
|
204
|
+
onBlur = _ref8.onBlur;
|
|
197
205
|
_this.closeValid();
|
|
198
206
|
onBlur && onBlur(_this.getIndex(rowIndex), key, value);
|
|
199
207
|
};
|
|
200
208
|
});
|
|
201
209
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleClick", function (key, value) {
|
|
202
210
|
return function () {
|
|
203
|
-
var
|
|
204
|
-
onDoubleClick =
|
|
211
|
+
var _ref9 = _this.props.callback || {},
|
|
212
|
+
onDoubleClick = _ref9.onDoubleClick;
|
|
205
213
|
onDoubleClick && onDoubleClick(key, value);
|
|
206
214
|
};
|
|
207
215
|
});
|
|
208
216
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onImgTileClick", function (col, value, rowIndex) {
|
|
209
217
|
return function () {
|
|
210
|
-
var
|
|
211
|
-
onImgTileClick =
|
|
218
|
+
var _ref10 = _this.props.callback || {},
|
|
219
|
+
onImgTileClick = _ref10.onImgTileClick;
|
|
212
220
|
onImgTileClick && onImgTileClick(col, value, rowIndex);
|
|
213
221
|
};
|
|
214
222
|
});
|
|
215
223
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onMoveRow", function (dragIndex, targetIndex) {
|
|
216
|
-
var
|
|
217
|
-
onMoveRow =
|
|
224
|
+
var _ref11 = _this.props.callback || {},
|
|
225
|
+
onMoveRow = _ref11.onMoveRow;
|
|
218
226
|
onMoveRow && onMoveRow(dragIndex, targetIndex);
|
|
219
227
|
});
|
|
220
228
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
|
|
@@ -264,6 +272,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
264
272
|
var cellProps = {
|
|
265
273
|
value: value,
|
|
266
274
|
width: width,
|
|
275
|
+
items: _this.props.items[index],
|
|
267
276
|
type: readonly || (0, _isArray["default"])(isReadonly) && (0, _includes["default"])(isReadonly).call(isReadonly, key) || _this.props.readonly ? 'readonly' : type,
|
|
268
277
|
props: readonly ? {} : props,
|
|
269
278
|
error: _this.validField(required, value),
|
|
@@ -336,6 +345,36 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
336
345
|
}
|
|
337
346
|
return /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps);
|
|
338
347
|
});
|
|
348
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderDoubleEditableCell", function (config, value, index) {
|
|
349
|
+
var key = config.key,
|
|
350
|
+
type = config.type,
|
|
351
|
+
options = config.options,
|
|
352
|
+
props = config.props,
|
|
353
|
+
required = config.required,
|
|
354
|
+
width = config.width,
|
|
355
|
+
showRowAdd = config.showRowAdd;
|
|
356
|
+
var _this$props$items$ind5 = _this.props.items[index],
|
|
357
|
+
readonly = _this$props$items$ind5.readonly,
|
|
358
|
+
_this$props$items$ind6 = _this$props$items$ind5.isReadonly,
|
|
359
|
+
isReadonly = _this$props$items$ind6 === void 0 ? [] : _this$props$items$ind6,
|
|
360
|
+
_this$props$items$ind7 = _this$props$items$ind5.isRequired,
|
|
361
|
+
isRequired = _this$props$items$ind7 === void 0 ? [] : _this$props$items$ind7,
|
|
362
|
+
_this$props$items$ind8 = _this$props$items$ind5._extraProps,
|
|
363
|
+
_extraProps = _this$props$items$ind8 === void 0 ? {} : _this$props$items$ind8;
|
|
364
|
+
var cellProps = {
|
|
365
|
+
value: value,
|
|
366
|
+
width: width,
|
|
367
|
+
items: _this.props.items[index],
|
|
368
|
+
type: readonly || (0, _isArray["default"])(isReadonly) && (0, _includes["default"])(isReadonly).call(isReadonly, key) || _this.props.readonly ? 'readonly' : type,
|
|
369
|
+
props: readonly ? {} : props,
|
|
370
|
+
error: _this.validField(required, value),
|
|
371
|
+
options: _this.getOptions(key, options, index),
|
|
372
|
+
onChange: _this.onChange1(key, index),
|
|
373
|
+
onSearch: _this.onSearch(key, index, config),
|
|
374
|
+
onBlur: _this.onBlur(key, index)
|
|
375
|
+
};
|
|
376
|
+
return /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps);
|
|
377
|
+
});
|
|
339
378
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderLinkCell", function (col, value, record, index) {
|
|
340
379
|
if (col.link === 'list') {
|
|
341
380
|
var list = value && (0, _isArray["default"])(value) ? value : [];
|
|
@@ -347,8 +386,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
347
386
|
var _context2;
|
|
348
387
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
349
388
|
var onClick = function onClick() {
|
|
350
|
-
var
|
|
351
|
-
onLink =
|
|
389
|
+
var _ref12 = _this.props.callback || {},
|
|
390
|
+
onLink = _ref12.onLink;
|
|
352
391
|
onLink && onLink(col.key, index, item2);
|
|
353
392
|
};
|
|
354
393
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
@@ -359,8 +398,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
359
398
|
} else {
|
|
360
399
|
var title = typeof col.link === 'string' ? col.link : value;
|
|
361
400
|
var onClick = function onClick() {
|
|
362
|
-
var
|
|
363
|
-
onLink =
|
|
401
|
+
var _ref13 = _this.props.callback || {},
|
|
402
|
+
onLink = _ref13.onLink;
|
|
364
403
|
onLink && onLink(col.key, index, record);
|
|
365
404
|
};
|
|
366
405
|
return /*#__PURE__*/_react["default"].createElement("a", {
|
|
@@ -501,6 +540,10 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
501
540
|
value: _this.props.items[index][col.key]
|
|
502
541
|
});
|
|
503
542
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], uploadProps);
|
|
543
|
+
case 'double':
|
|
544
|
+
return _this.renderDoubleEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
545
|
+
type: realType
|
|
546
|
+
}), value, record.key);
|
|
504
547
|
default:
|
|
505
548
|
return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
506
549
|
type: realType
|
|
@@ -541,12 +584,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
541
584
|
return null;
|
|
542
585
|
}
|
|
543
586
|
});
|
|
544
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (
|
|
545
|
-
var required =
|
|
546
|
-
title =
|
|
547
|
-
type =
|
|
548
|
-
key =
|
|
549
|
-
showAdd =
|
|
587
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (_ref14) {
|
|
588
|
+
var required = _ref14.required,
|
|
589
|
+
title = _ref14.title,
|
|
590
|
+
type = _ref14.type,
|
|
591
|
+
key = _ref14.key,
|
|
592
|
+
showAdd = _ref14.showAdd;
|
|
550
593
|
if (type === 'checkbox') {
|
|
551
594
|
var status = _this.getCheckedStatus(key);
|
|
552
595
|
return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], (0, _extends2["default"])({
|
|
@@ -559,9 +602,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
559
602
|
}, title, _this.toAdd(key, showAdd));
|
|
560
603
|
}
|
|
561
604
|
});
|
|
562
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (
|
|
563
|
-
var type =
|
|
564
|
-
align =
|
|
605
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref15) {
|
|
606
|
+
var type = _ref15.type,
|
|
607
|
+
align = _ref15.align;
|
|
565
608
|
if (type === 'index' || type === 'checkbox') {
|
|
566
609
|
return 'ant-table-selection-column';
|
|
567
610
|
} else {
|
|
@@ -570,16 +613,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
570
613
|
});
|
|
571
614
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
|
|
572
615
|
var _context11;
|
|
573
|
-
return !(0, _includes["default"])(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context11, type);
|
|
616
|
+
return !(0, _includes["default"])(_context11 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg', 'double']).call(_context11, type);
|
|
574
617
|
});
|
|
575
618
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
|
|
576
619
|
var _context12;
|
|
577
620
|
var readonly = _this.props.readonly;
|
|
578
621
|
return (0, _map["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
|
|
579
622
|
return !col.hide;
|
|
580
|
-
})).call(_context12, function (
|
|
623
|
+
})).call(_context12, function (_ref16, index) {
|
|
581
624
|
var _context13;
|
|
582
|
-
var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(
|
|
625
|
+
var col = (0, _extends2["default"])({}, ((0, _objectDestructuringEmpty2["default"])(_ref16), _ref16));
|
|
583
626
|
col.className = _this.getColumnClassName(col);
|
|
584
627
|
col.title = _this.getColumnTitle(col);
|
|
585
628
|
col.dataIndex = col.key;
|
|
@@ -611,11 +654,11 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
611
654
|
});
|
|
612
655
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
|
|
613
656
|
return (0, _map["default"])(items).call(items, function (item, index) {
|
|
614
|
-
return (0, _reduce["default"])(cols).call(cols, function (result,
|
|
657
|
+
return (0, _reduce["default"])(cols).call(cols, function (result, _ref17) {
|
|
615
658
|
var _context14, _context15;
|
|
616
|
-
var key =
|
|
617
|
-
type =
|
|
618
|
-
options =
|
|
659
|
+
var key = _ref17.key,
|
|
660
|
+
type = _ref17.type,
|
|
661
|
+
options = _ref17.options;
|
|
619
662
|
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context14 = item.isReadonly).call(_context14, key)) || (0, _includes["default"])(_context15 = ['img', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context15, type)) {
|
|
620
663
|
result[key] = item[key];
|
|
621
664
|
} else {
|
|
@@ -15,6 +15,7 @@ _Object$defineProperty(exports, "__esModule", {
|
|
|
15
15
|
});
|
|
16
16
|
exports.isInRegion = exports["default"] = void 0;
|
|
17
17
|
var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
|
|
18
|
+
var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
|
|
18
19
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
19
20
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
|
|
20
21
|
var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
|
|
@@ -26,8 +27,9 @@ var _react = _interopRequireDefault(require("react"));
|
|
|
26
27
|
var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
27
28
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
28
29
|
var _Control = _interopRequireDefault(require("../Control"));
|
|
30
|
+
var _helper = _interopRequireDefault(require("../helper"));
|
|
29
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; }
|
|
30
|
-
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 _context4, _context5; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context4 = ownKeys(Object(source), !0)).call(_context4, function (key) { (0, _defineProperty2["default"])(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; }
|
|
31
33
|
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); }; }
|
|
32
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; } }
|
|
33
35
|
// 单元格的type只能取如下值:
|
|
@@ -59,6 +61,12 @@ var SuperTableCell = /*#__PURE__*/function (_React$Component) {
|
|
|
59
61
|
_this.props.onBlur();
|
|
60
62
|
}
|
|
61
63
|
});
|
|
64
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (key, value) {
|
|
65
|
+
var onChange = _this.props.onChange;
|
|
66
|
+
if (onChange) {
|
|
67
|
+
onChange(key, value);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
62
70
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onOpenChange", function (open) {
|
|
63
71
|
if (!open) {
|
|
64
72
|
var targets = document.getElementsByClassName('ant-calendar-picker-container');
|
|
@@ -87,6 +95,16 @@ var SuperTableCell = /*#__PURE__*/function (_React$Component) {
|
|
|
87
95
|
delete props.value;
|
|
88
96
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
89
97
|
});
|
|
98
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toDoubleNumberComponent", function (props, cc) {
|
|
99
|
+
var _context2, _context3;
|
|
100
|
+
props.defaultValue = props.value;
|
|
101
|
+
props.doubleKey = props.key;
|
|
102
|
+
props.doubleValue = _helper["default"].getObject(cc, props.key);
|
|
103
|
+
props.onChange1 = (0, _bind["default"])(_context2 = _this.onChange).call(_context2, (0, _assertThisInitialized2["default"])(_this), props.key[0]);
|
|
104
|
+
props.onChange2 = (0, _bind["default"])(_context3 = _this.onChange).call(_context3, (0, _assertThisInitialized2["default"])(_this), props.key[1]);
|
|
105
|
+
delete props.value;
|
|
106
|
+
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
107
|
+
});
|
|
90
108
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toDateComponent", function (props) {
|
|
91
109
|
//props.getCalendarContainer = this.getPopupContainer;
|
|
92
110
|
props.onBlur = _this.onDateBlur;
|
|
@@ -162,6 +180,10 @@ var SuperTableCell = /*#__PURE__*/function (_React$Component) {
|
|
|
162
180
|
}, this.toDateComponent(props));
|
|
163
181
|
case 'readonly':
|
|
164
182
|
return this.toReadonlyComponent(props);
|
|
183
|
+
case 'double':
|
|
184
|
+
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
185
|
+
className: className
|
|
186
|
+
}, this.toDoubleNumberComponent(props, this.props.items));
|
|
165
187
|
default:
|
|
166
188
|
return /*#__PURE__*/_react["default"].createElement("div", null, "\"error type\"");
|
|
167
189
|
}
|
package/lib/helper.js
CHANGED
|
@@ -5,7 +5,7 @@ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequ
|
|
|
5
5
|
_Object$defineProperty(exports, "__esModule", {
|
|
6
6
|
value: true
|
|
7
7
|
});
|
|
8
|
-
exports.toThousands = exports.showSuccessMsg = exports.showError = exports.isEmpty2 = exports.isEmpty = exports.getUsername = exports.getPathValue = exports.getObjectExclude = exports["default"] = void 0;
|
|
8
|
+
exports.toThousands = exports.showSuccessMsg = exports.showError = exports.isEmpty2 = exports.isEmpty = exports.getUsername = exports.getPathValue = exports.getObjectExclude = exports.getObject = exports["default"] = void 0;
|
|
9
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
10
10
|
var _some = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/some"));
|
|
11
11
|
var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
|
|
@@ -141,6 +141,13 @@ var showSuccessMsg = function showSuccessMsg(msg) {
|
|
|
141
141
|
_message["default"].success(msg);
|
|
142
142
|
};
|
|
143
143
|
exports.showSuccessMsg = showSuccessMsg;
|
|
144
|
+
var getObject = function getObject(obj, keys) {
|
|
145
|
+
return (0, _reduce["default"])(keys).call(keys, function (newObj, key) {
|
|
146
|
+
newObj[key] = obj[key];
|
|
147
|
+
return newObj;
|
|
148
|
+
}, {});
|
|
149
|
+
};
|
|
150
|
+
exports.getObject = getObject;
|
|
144
151
|
var helper = {
|
|
145
152
|
getObjectExclude: getObjectExclude,
|
|
146
153
|
getUsername: getUsername,
|
|
@@ -149,7 +156,8 @@ var helper = {
|
|
|
149
156
|
isEmpty2: isEmpty2,
|
|
150
157
|
showError: showError,
|
|
151
158
|
showSuccessMsg: showSuccessMsg,
|
|
152
|
-
toThousands: toThousands
|
|
159
|
+
toThousands: toThousands,
|
|
160
|
+
getObject: getObject
|
|
153
161
|
};
|
|
154
162
|
var _default = helper;
|
|
155
163
|
exports["default"] = _default;
|