cloud-b2b 1.1.6 → 1.1.9
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/CodeInput/CodeInput.js +3 -5
- package/es/NumberInput/NumberInput.js +2 -2
- package/es/SuperForm2/SuperForm.js +33 -10
- package/es/SuperTable2/SuperTable2.js +121 -53
- package/es/SuperUpload/SuperUpload.js +2 -2
- package/es/Title/Title.less +35 -35
- package/es/Title/package.json +6 -6
- package/lib/CodeInput/CodeInput.js +3 -5
- package/lib/NumberInput/NumberInput.js +2 -2
- package/lib/SuperForm2/SuperForm.js +33 -10
- package/lib/SuperTable2/SuperTable2.js +129 -53
- package/lib/SuperUpload/SuperUpload.js +2 -2
- package/lib/Title/Title.less +35 -35
- package/lib/Title/package.json +6 -6
- package/package.json +1 -1
|
@@ -76,12 +76,10 @@ var CodeInput = /*#__PURE__*/function (_React$Component) {
|
|
|
76
76
|
|
|
77
77
|
case 3:
|
|
78
78
|
if (!_context.sent) {
|
|
79
|
-
_context.next =
|
|
79
|
+
_context.next = 7;
|
|
80
80
|
break;
|
|
81
81
|
}
|
|
82
82
|
|
|
83
|
-
debugger;
|
|
84
|
-
|
|
85
83
|
_this.setState({
|
|
86
84
|
time: _this.props.time || 60
|
|
87
85
|
});
|
|
@@ -97,10 +95,10 @@ var CodeInput = /*#__PURE__*/function (_React$Component) {
|
|
|
97
95
|
}
|
|
98
96
|
}, 1000);
|
|
99
97
|
|
|
100
|
-
case
|
|
98
|
+
case 7:
|
|
101
99
|
;
|
|
102
100
|
|
|
103
|
-
case
|
|
101
|
+
case 8:
|
|
104
102
|
case "end":
|
|
105
103
|
return _context.stop();
|
|
106
104
|
}
|
|
@@ -166,9 +166,9 @@ var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
|
166
166
|
if (!invalid) {
|
|
167
167
|
onChange && onChange(value);
|
|
168
168
|
}
|
|
169
|
-
}
|
|
170
169
|
|
|
171
|
-
|
|
170
|
+
onBlur && onBlur(event); //有输入才触发外部失去焦点事件,避免非必要请求
|
|
171
|
+
}
|
|
172
172
|
});
|
|
173
173
|
|
|
174
174
|
_defineProperty(_assertThisInitialized(_this), "hasSpecialChar", function (value) {
|
|
@@ -9,8 +9,9 @@ import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object
|
|
|
9
9
|
import _Row from "antd/es/row";
|
|
10
10
|
import _Col from "antd/es/col";
|
|
11
11
|
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
12
|
-
import
|
|
12
|
+
import _Tooltip from "antd/es/tooltip";
|
|
13
13
|
import _Icon from "antd/es/icon";
|
|
14
|
+
import _Checkbox from "antd/es/checkbox";
|
|
14
15
|
import _typeof from "@babel/runtime-corejs3/helpers/typeof";
|
|
15
16
|
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
16
17
|
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
@@ -30,7 +31,7 @@ import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance
|
|
|
30
31
|
|
|
31
32
|
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
33
|
|
|
33
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
34
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context24, _context25; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context24 = ownKeys(Object(source), !0)).call(_context24, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context25 = ownKeys(Object(source))).call(_context25, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
34
35
|
|
|
35
36
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }
|
|
36
37
|
|
|
@@ -43,9 +44,9 @@ import helper from '../helper';
|
|
|
43
44
|
import Control, { getTitle, makeString } from '../Control';
|
|
44
45
|
import variables from '../variables';
|
|
45
46
|
var FormItem = _Form.Item;
|
|
46
|
-
var defaultSize = '
|
|
47
|
+
var defaultSize = 'large';
|
|
47
48
|
var defaultColNum = 4;
|
|
48
|
-
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader'];
|
|
49
|
+
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox'];
|
|
49
50
|
/**
|
|
50
51
|
* key:[必须],用于唯一标识该Form下的一个表单元素
|
|
51
52
|
* title:[必须],表单元素的标签
|
|
@@ -133,7 +134,7 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
133
134
|
* checkable:是否显示checkbox选择框
|
|
134
135
|
* onOpenChange:控制日期框显示隐藏回调func(key, open)
|
|
135
136
|
* onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
|
|
136
|
-
*
|
|
137
|
+
* onFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
|
|
137
138
|
*/
|
|
138
139
|
|
|
139
140
|
|
|
@@ -571,6 +572,17 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
571
572
|
return /*#__PURE__*/React.createElement(Control, props);
|
|
572
573
|
});
|
|
573
574
|
|
|
575
|
+
_defineProperty(_assertThisInitialized(_this2), "toCheckbox", function (props, control) {
|
|
576
|
+
var _context21;
|
|
577
|
+
|
|
578
|
+
var options = control.options || [];
|
|
579
|
+
return /*#__PURE__*/React.createElement(_Checkbox.Group, {
|
|
580
|
+
options: options,
|
|
581
|
+
onChange: _bindInstanceProperty(_context21 = _this2.onBlur).call(_context21, _assertThisInitialized(_this2), control.key),
|
|
582
|
+
value: _this2.props.value[control.key]
|
|
583
|
+
});
|
|
584
|
+
});
|
|
585
|
+
|
|
574
586
|
_defineProperty(_assertThisInitialized(_this2), "toControl", function (props, control) {
|
|
575
587
|
switch (props.type) {
|
|
576
588
|
case 'readonly':
|
|
@@ -626,6 +638,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
626
638
|
case 'cascader':
|
|
627
639
|
return _this2.toCascader(props, control);
|
|
628
640
|
|
|
641
|
+
case 'checkbox':
|
|
642
|
+
return _this2.toCheckbox(props, control);
|
|
643
|
+
|
|
629
644
|
default:
|
|
630
645
|
return 'type error';
|
|
631
646
|
}
|
|
@@ -634,18 +649,26 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
634
649
|
_defineProperty(_assertThisInitialized(_this2), "toLabel", function (_ref11, type) {
|
|
635
650
|
var title = _ref11.title,
|
|
636
651
|
showAdd = _ref11.showAdd,
|
|
637
|
-
key = _ref11.key
|
|
652
|
+
key = _ref11.key,
|
|
653
|
+
showInfo = _ref11.showInfo,
|
|
654
|
+
showInfoTitle = _ref11.showInfoTitle;
|
|
638
655
|
|
|
639
656
|
if (showAdd && type !== 'readonly') {
|
|
640
|
-
var
|
|
657
|
+
var _context22;
|
|
641
658
|
|
|
642
|
-
var onClick = _bindInstanceProperty(
|
|
659
|
+
var onClick = _bindInstanceProperty(_context22 = _this2.onAdd).call(_context22, _assertThisInitialized(_this2), key, title);
|
|
643
660
|
|
|
644
661
|
return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Icon, {
|
|
645
662
|
role: "add",
|
|
646
663
|
type: "plus-circle-o",
|
|
647
664
|
onClick: onClick
|
|
648
665
|
}));
|
|
666
|
+
} else if (showInfo) {
|
|
667
|
+
return /*#__PURE__*/React.createElement("span", null, title, /*#__PURE__*/React.createElement(_Tooltip, {
|
|
668
|
+
title: showInfoTitle
|
|
669
|
+
}, /*#__PURE__*/React.createElement(_Icon, {
|
|
670
|
+
type: "info-circle"
|
|
671
|
+
})));
|
|
649
672
|
} else {
|
|
650
673
|
return title;
|
|
651
674
|
}
|
|
@@ -701,7 +724,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
701
724
|
});
|
|
702
725
|
|
|
703
726
|
_defineProperty(_assertThisInitialized(_this2), "toCols", function () {
|
|
704
|
-
var
|
|
727
|
+
var _context23;
|
|
705
728
|
|
|
706
729
|
var _this2$props4 = _this2.props,
|
|
707
730
|
_this2$props4$colNum = _this2$props4.colNum,
|
|
@@ -713,7 +736,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
713
736
|
}
|
|
714
737
|
|
|
715
738
|
var span = 24 / colNum;
|
|
716
|
-
return _mapInstanceProperty(
|
|
739
|
+
return _mapInstanceProperty(_context23 = _this2.getControls()).call(_context23, function (control) {
|
|
717
740
|
if (allFullFather) {
|
|
718
741
|
control.allFullFather = allFullFather;
|
|
719
742
|
}
|
|
@@ -26,13 +26,13 @@ import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
|
26
26
|
|
|
27
27
|
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; } } }; }
|
|
28
28
|
|
|
29
|
-
function _unsupportedIterableToArray(o, minLen) { var
|
|
29
|
+
function _unsupportedIterableToArray(o, minLen) { var _context16; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context16 = Object.prototype.toString.call(o)).call(_context16, 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); }
|
|
30
30
|
|
|
31
31
|
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; }
|
|
32
32
|
|
|
33
33
|
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; }
|
|
34
34
|
|
|
35
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
35
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context14, _context15; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context14 = ownKeys(Object(source), !0)).call(_context14, function (key) { _defineProperty(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
36
36
|
|
|
37
37
|
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
38
38
|
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
@@ -50,17 +50,18 @@ function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_R
|
|
|
50
50
|
import React from 'react';
|
|
51
51
|
import PropTypes from 'prop-types';
|
|
52
52
|
import ReactDOM from 'react-dom';
|
|
53
|
-
import { getTitle } from '../Control';
|
|
53
|
+
import Control, { getTitle } from '../Control';
|
|
54
54
|
import SuperTableCell from './SuperTableCell';
|
|
55
55
|
import fixed from '../SuperTable/fixed';
|
|
56
56
|
import SuperToolbar from '../SuperToolbar';
|
|
57
57
|
import variables from '../variables';
|
|
58
|
+
import helper, { getObjectExclude } from '../helper';
|
|
58
59
|
var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
|
|
59
60
|
'selectText', //存储title
|
|
60
61
|
'search', 'searchText', 'selectSearch', //多选下拉搜索
|
|
61
62
|
'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
|
|
62
|
-
'img' //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
63
|
-
];
|
|
63
|
+
'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
64
|
+
'uploadImg'];
|
|
64
65
|
/**
|
|
65
66
|
* key:标识所在列,在一个表格中必须唯一
|
|
66
67
|
* title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
|
|
@@ -89,22 +90,29 @@ var ColType = {
|
|
|
89
90
|
/**
|
|
90
91
|
* onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
|
|
91
92
|
* onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
|
|
92
|
-
*
|
|
93
|
+
* onBlur: 输入框失去焦点时触发,原型为function(rowIndex, keyName, value)
|
|
94
|
+
* onSearch:search组件输入内容时触发,原型为function(rowIndex, keyName, value, col)
|
|
93
95
|
* onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
|
|
94
96
|
* onAdd:点击+号时触发,原型为function(keyName)
|
|
95
97
|
* onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
|
|
96
|
-
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
|
|
98
|
+
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
|
|
99
|
+
* onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
|
|
97
100
|
*/
|
|
98
101
|
|
|
99
102
|
var CallbackType = {
|
|
100
103
|
onExitValid: PropTypes.func,
|
|
101
104
|
onCheck: PropTypes.func,
|
|
102
105
|
onContentChange: PropTypes.func,
|
|
106
|
+
onBlur: PropTypes.func,
|
|
103
107
|
onSearch: PropTypes.func,
|
|
104
108
|
onLink: PropTypes.func,
|
|
105
109
|
onAdd: PropTypes.func,
|
|
106
110
|
onRenderCustom: PropTypes.func,
|
|
107
|
-
onToolbar: PropTypes.func
|
|
111
|
+
onToolbar: PropTypes.func,
|
|
112
|
+
onDoubleClick: PropTypes.func,
|
|
113
|
+
onTableFileChange: PropTypes.func,
|
|
114
|
+
buildSuperUploadProps: PropTypes.func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
|
|
115
|
+
|
|
108
116
|
};
|
|
109
117
|
/**
|
|
110
118
|
* base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
|
|
@@ -185,8 +193,24 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
185
193
|
};
|
|
186
194
|
});
|
|
187
195
|
|
|
188
|
-
_defineProperty(_assertThisInitialized(_this), "onBlur", function () {
|
|
189
|
-
|
|
196
|
+
_defineProperty(_assertThisInitialized(_this), "onBlur", function (key, rowIndex) {
|
|
197
|
+
return function (value) {
|
|
198
|
+
var _ref7 = _this.props.callback || {},
|
|
199
|
+
onBlur = _ref7.onBlur;
|
|
200
|
+
|
|
201
|
+
_this.closeValid();
|
|
202
|
+
|
|
203
|
+
onBlur && onBlur(_this.getIndex(rowIndex), key, value);
|
|
204
|
+
};
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
_defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (key, value) {
|
|
208
|
+
return function () {
|
|
209
|
+
var _ref8 = _this.props.callback || {},
|
|
210
|
+
onDoubleClick = _ref8.onDoubleClick;
|
|
211
|
+
|
|
212
|
+
onDoubleClick && onDoubleClick(key, value);
|
|
213
|
+
};
|
|
190
214
|
});
|
|
191
215
|
|
|
192
216
|
_defineProperty(_assertThisInitialized(_this), "closeValid", function () {
|
|
@@ -248,7 +272,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
248
272
|
options: _this.getOptions(key, options, index),
|
|
249
273
|
onChange: _this.onChange(key, index),
|
|
250
274
|
onSearch: _this.onSearch(key, index, config),
|
|
251
|
-
onBlur: _this.onBlur
|
|
275
|
+
onBlur: _this.onBlur(key, index)
|
|
252
276
|
};
|
|
253
277
|
|
|
254
278
|
if (showRowAdd && _Array$isArray(isRequired) && _includesInstanceProperty(isRequired).call(isRequired, key)) {
|
|
@@ -328,8 +352,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
328
352
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
329
353
|
|
|
330
354
|
var onClick = function onClick() {
|
|
331
|
-
var
|
|
332
|
-
onLink =
|
|
355
|
+
var _ref9 = _this.props.callback || {},
|
|
356
|
+
onLink = _ref9.onLink;
|
|
333
357
|
|
|
334
358
|
onLink && onLink(col.key, index, item2);
|
|
335
359
|
};
|
|
@@ -343,8 +367,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
343
367
|
var title = typeof col.link === 'string' ? col.link : value;
|
|
344
368
|
|
|
345
369
|
var onClick = function onClick() {
|
|
346
|
-
var
|
|
347
|
-
onLink =
|
|
370
|
+
var _ref10 = _this.props.callback || {},
|
|
371
|
+
onLink = _ref10.onLink;
|
|
348
372
|
|
|
349
373
|
onLink && onLink(col.key, index, record);
|
|
350
374
|
};
|
|
@@ -361,13 +385,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
361
385
|
|
|
362
386
|
_defineProperty(_assertThisInitialized(_this), "getCellRender", function (col) {
|
|
363
387
|
return function (value, record, index) {
|
|
364
|
-
var _context3, _context4, _context5, _context6;
|
|
388
|
+
var _context3, _context4, _context5, _context6, _context7;
|
|
365
389
|
|
|
366
390
|
var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
|
|
367
391
|
|
|
368
392
|
if (!realType) {
|
|
369
393
|
return /*#__PURE__*/React.createElement("div", {
|
|
394
|
+
onDoubleClick: _this.onDoubleClick(col.key, record.key),
|
|
370
395
|
style: {
|
|
396
|
+
minHeight: '20px',
|
|
397
|
+
minWidth: '100px',
|
|
371
398
|
maxWidth: "".concat(col.width - 16, "px"),
|
|
372
399
|
overflow: 'hidden',
|
|
373
400
|
textOverflow: 'ellipsis'
|
|
@@ -411,12 +438,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
411
438
|
}
|
|
412
439
|
|
|
413
440
|
case 'switch':
|
|
414
|
-
return value === '
|
|
441
|
+
return typeof value === 'string' ? /*#__PURE__*/React.createElement("div", null, value) : /*#__PURE__*/React.createElement(_Switch, {
|
|
415
442
|
checkedChildren: col.props.checkedChildren || '',
|
|
416
443
|
unCheckedChildren: col.props.unCheckedChildren || '',
|
|
417
444
|
onChange: _this.onSwitch(col.key, record.key),
|
|
418
445
|
size: "default",
|
|
419
|
-
checked: value || false,
|
|
446
|
+
checked: typeof value === 'number' ? Boolean(value) : value || false,
|
|
420
447
|
disabled: !(record._isEdit === true)
|
|
421
448
|
});
|
|
422
449
|
|
|
@@ -443,14 +470,41 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
443
470
|
height: '80px'
|
|
444
471
|
}
|
|
445
472
|
}) : /*#__PURE__*/React.createElement("div", {
|
|
446
|
-
role: 'imgBox'
|
|
473
|
+
role: 'imgBox',
|
|
474
|
+
style: {
|
|
475
|
+
maxWidth: '120px'
|
|
476
|
+
}
|
|
447
477
|
}, /*#__PURE__*/React.createElement("img", {
|
|
448
478
|
src: value.img,
|
|
449
479
|
style: {
|
|
450
480
|
width: '80px',
|
|
451
481
|
height: '80px'
|
|
452
482
|
}
|
|
453
|
-
}), /*#__PURE__*/React.createElement("
|
|
483
|
+
}), /*#__PURE__*/React.createElement("div", {
|
|
484
|
+
style: {
|
|
485
|
+
display: 'inline-block'
|
|
486
|
+
}
|
|
487
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
488
|
+
style: {
|
|
489
|
+
display: 'block'
|
|
490
|
+
}
|
|
491
|
+
}, value.title), helper.isEmpty2(value.remark) ? null : /*#__PURE__*/React.createElement("span", {
|
|
492
|
+
style: {
|
|
493
|
+
color: '#333'
|
|
494
|
+
}
|
|
495
|
+
}, value.remark))) : /*#__PURE__*/React.createElement("div", null);
|
|
496
|
+
|
|
497
|
+
case 'uploadImg':
|
|
498
|
+
var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
|
|
499
|
+
|
|
500
|
+
var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
501
|
+
onFileChange: _this.props.callback.onTableFileChange ? _bindInstanceProperty(_context7 = _this.props.callback.onTableFileChange).call(_context7, null, col.key, index) : undefined,
|
|
502
|
+
type: col.type
|
|
503
|
+
}, col.props), _this.props), commonProps), {}, {
|
|
504
|
+
value: _this.props.items[index][col.key]
|
|
505
|
+
});
|
|
506
|
+
|
|
507
|
+
return /*#__PURE__*/React.createElement(Control, uploadProps);
|
|
454
508
|
|
|
455
509
|
default:
|
|
456
510
|
return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
@@ -499,12 +553,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
499
553
|
}
|
|
500
554
|
});
|
|
501
555
|
|
|
502
|
-
_defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (
|
|
503
|
-
var required =
|
|
504
|
-
title =
|
|
505
|
-
type =
|
|
506
|
-
key =
|
|
507
|
-
showAdd =
|
|
556
|
+
_defineProperty(_assertThisInitialized(_this), "getColumnTitle", function (_ref11) {
|
|
557
|
+
var required = _ref11.required,
|
|
558
|
+
title = _ref11.title,
|
|
559
|
+
type = _ref11.type,
|
|
560
|
+
key = _ref11.key,
|
|
561
|
+
showAdd = _ref11.showAdd;
|
|
508
562
|
|
|
509
563
|
if (type === 'checkbox') {
|
|
510
564
|
var status = _this.getCheckedStatus(key);
|
|
@@ -520,9 +574,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
520
574
|
}
|
|
521
575
|
});
|
|
522
576
|
|
|
523
|
-
_defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (
|
|
524
|
-
var type =
|
|
525
|
-
align =
|
|
577
|
+
_defineProperty(_assertThisInitialized(_this), "getColumnClassName", function (_ref12) {
|
|
578
|
+
var type = _ref12.type,
|
|
579
|
+
align = _ref12.align;
|
|
526
580
|
|
|
527
581
|
if (type === 'index' || type === 'checkbox') {
|
|
528
582
|
return 'ant-table-selection-column';
|
|
@@ -532,24 +586,26 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
532
586
|
});
|
|
533
587
|
|
|
534
588
|
_defineProperty(_assertThisInitialized(_this), "canReadonly", function (type) {
|
|
535
|
-
var
|
|
589
|
+
var _context8;
|
|
536
590
|
|
|
537
|
-
return !_includesInstanceProperty(
|
|
591
|
+
return !_includesInstanceProperty(_context8 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context8, type);
|
|
538
592
|
});
|
|
539
593
|
|
|
540
594
|
_defineProperty(_assertThisInitialized(_this), "getColumns", function (cols) {
|
|
541
|
-
var
|
|
595
|
+
var _context9;
|
|
542
596
|
|
|
543
597
|
var readonly = _this.props.readonly;
|
|
544
|
-
return _mapInstanceProperty(
|
|
598
|
+
return _mapInstanceProperty(_context9 = _filterInstanceProperty(cols).call(cols, function (col) {
|
|
545
599
|
return !col.hide;
|
|
546
|
-
})).call(
|
|
547
|
-
var
|
|
600
|
+
})).call(_context9, function (_ref13, index) {
|
|
601
|
+
var _context10;
|
|
602
|
+
|
|
603
|
+
var col = _extends({}, _ref13);
|
|
548
604
|
|
|
549
605
|
col.className = _this.getColumnClassName(col);
|
|
550
606
|
col.title = _this.getColumnTitle(col);
|
|
551
607
|
col.dataIndex = col.key;
|
|
552
|
-
col.width = col.width || 120; // const {props = {}} = col;
|
|
608
|
+
col.width = col.width || _includesInstanceProperty(_context10 = ['index', 'checked']).call(_context10, col.key) ? 70 : 120; // const {props = {}} = col;
|
|
553
609
|
// const {edit = false} = props
|
|
554
610
|
// if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
|
|
555
611
|
// if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
|
|
@@ -570,14 +626,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
570
626
|
|
|
571
627
|
_defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
|
|
572
628
|
return _mapInstanceProperty(items).call(items, function (item, index) {
|
|
573
|
-
return _reduceInstanceProperty(cols).call(cols, function (result,
|
|
574
|
-
var
|
|
629
|
+
return _reduceInstanceProperty(cols).call(cols, function (result, _ref14) {
|
|
630
|
+
var _context11;
|
|
575
631
|
|
|
576
|
-
var key =
|
|
577
|
-
type =
|
|
578
|
-
options =
|
|
632
|
+
var key = _ref14.key,
|
|
633
|
+
type = _ref14.type,
|
|
634
|
+
options = _ref14.options;
|
|
579
635
|
|
|
580
|
-
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(
|
|
636
|
+
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || _Array$isArray(item.isReadonly) && !_includesInstanceProperty(_context11 = item.isReadonly).call(_context11, key))) {
|
|
581
637
|
result[key] = item[key];
|
|
582
638
|
} else {
|
|
583
639
|
result[key] = getTitle(item[key], options);
|
|
@@ -611,7 +667,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
611
667
|
});
|
|
612
668
|
|
|
613
669
|
_defineProperty(_assertThisInitialized(_this), "getProps", function () {
|
|
614
|
-
var
|
|
670
|
+
var _context12;
|
|
615
671
|
|
|
616
672
|
var _this$props3 = _this.props,
|
|
617
673
|
cols = _this$props3.cols,
|
|
@@ -624,15 +680,29 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
624
680
|
pagination = _this$props3$paginati === void 0 ? false : _this$props3$paginati,
|
|
625
681
|
_this$props3$isEmphas = _this$props3.isEmphasized,
|
|
626
682
|
isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
|
|
627
|
-
maxHeight = _this$props3.maxHeight
|
|
683
|
+
maxHeight = _this$props3.maxHeight,
|
|
684
|
+
_this$props3$expanded = _this$props3.expandedRowRender,
|
|
685
|
+
expandedRowRender = _this$props3$expanded === void 0 ? undefined : _this$props3$expanded,
|
|
686
|
+
_this$props3$onExpand = _this$props3.onExpand,
|
|
687
|
+
onExpand = _this$props3$onExpand === void 0 ? undefined : _this$props3$onExpand;
|
|
628
688
|
|
|
629
|
-
var widthX = _reduceInstanceProperty(
|
|
689
|
+
var widthX = _reduceInstanceProperty(_context12 = _filterInstanceProperty(cols).call(cols, function (col) {
|
|
630
690
|
return !col.hide;
|
|
631
|
-
})).call(
|
|
632
|
-
|
|
691
|
+
})).call(_context12, function (width, item) {
|
|
692
|
+
var _context13;
|
|
693
|
+
|
|
694
|
+
return width += item.width ? item.width : _includesInstanceProperty(_context13 = ['index', 'checked']).call(_context13, item.key) ? 70 : 120;
|
|
633
695
|
}, 0);
|
|
634
696
|
|
|
635
|
-
|
|
697
|
+
var scrollProps = !helper.isEmpty2(expandedRowRender) ? {
|
|
698
|
+
expandedRowRender: expandedRowRender
|
|
699
|
+
} : {
|
|
700
|
+
scroll: {
|
|
701
|
+
x: widthX,
|
|
702
|
+
y: maxHeight
|
|
703
|
+
}
|
|
704
|
+
};
|
|
705
|
+
return _objectSpread(_objectSpread({
|
|
636
706
|
className: !isEmphasized ? variables('SuperTable2') : variables('SuperTable2').noTransition,
|
|
637
707
|
columns: _this.getColumns(cols),
|
|
638
708
|
dataSource: _this.getDataSource(items, cols),
|
|
@@ -640,16 +710,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
640
710
|
whiteSpace: 'nowrap'
|
|
641
711
|
}, style),
|
|
642
712
|
size: 'small',
|
|
643
|
-
scroll: {
|
|
644
|
-
x: widthX,
|
|
645
|
-
y: maxHeight
|
|
646
|
-
},
|
|
647
713
|
pagination: pagination,
|
|
648
714
|
footer: footer,
|
|
649
715
|
locale: _this.props.emptyText ? {
|
|
650
716
|
emptyText: _this.props.emptyText
|
|
651
717
|
} : null
|
|
652
|
-
}, _this.getPropsByCheckbox())
|
|
718
|
+
}, _this.getPropsByCheckbox()), {}, {
|
|
719
|
+
onExpand: onExpand
|
|
720
|
+
}, scrollProps);
|
|
653
721
|
});
|
|
654
722
|
|
|
655
723
|
_defineProperty(_assertThisInitialized(_this), "setScroll", function () {
|
|
@@ -25,7 +25,7 @@ import PropTypes from 'prop-types';
|
|
|
25
25
|
import helper from '../helper';
|
|
26
26
|
import Title from '../Title';
|
|
27
27
|
import variables from '../variables';
|
|
28
|
-
var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF'];
|
|
28
|
+
var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF', 'video/mp4'];
|
|
29
29
|
var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF']; //组件属性定义
|
|
30
30
|
|
|
31
31
|
var propTypes = {
|
|
@@ -38,7 +38,7 @@ var propTypes = {
|
|
|
38
38
|
required: PropTypes.bool,
|
|
39
39
|
//是否必须上传,默认false
|
|
40
40
|
listType: PropTypes.oneOf[('text', 'picture', 'picture-card')],
|
|
41
|
-
//上传列表的内建样式,支持三种,默认
|
|
41
|
+
//上传列表的内建样式,支持三种,默认picture-card
|
|
42
42
|
readonly: PropTypes.bool,
|
|
43
43
|
//所在页面是否只读,默认false
|
|
44
44
|
multiple: PropTypes.bool,
|
package/es/Title/Title.less
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
@import '../variables';
|
|
2
|
-
|
|
3
|
-
.@{cloudlink-prefix}-title {
|
|
4
|
-
> *:first-child {
|
|
5
|
-
display: inline-block;
|
|
6
|
-
color: @brand-primary;
|
|
7
|
-
line-height: 1.2;
|
|
8
|
-
|
|
9
|
-
&[data-border='true'] {
|
|
10
|
-
padding: 0 5px;
|
|
11
|
-
border-left: @brand-primary solid 3px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&[data-fold='true'] {
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
margin: 8px 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&[data-required='true'] {
|
|
20
|
-
&::after {
|
|
21
|
-
display: inline-block;
|
|
22
|
-
margin-left: 4px;
|
|
23
|
-
color: #f5222d;
|
|
24
|
-
font-size: 12px;
|
|
25
|
-
font-family: SimSun, sans-serif;
|
|
26
|
-
line-height: 1;
|
|
27
|
-
content: '*';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
> [role = 'toolbar'] {
|
|
33
|
-
display: inline-block;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
@import '../variables';
|
|
2
|
+
|
|
3
|
+
.@{cloudlink-prefix}-title {
|
|
4
|
+
> *:first-child {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
color: @brand-primary;
|
|
7
|
+
line-height: 1.2;
|
|
8
|
+
|
|
9
|
+
&[data-border='true'] {
|
|
10
|
+
padding: 0 5px;
|
|
11
|
+
border-left: @brand-primary solid 3px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&[data-fold='true'] {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
margin: 8px 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&[data-required='true'] {
|
|
20
|
+
&::after {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
margin-left: 4px;
|
|
23
|
+
color: #f5222d;
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
font-family: SimSun, sans-serif;
|
|
26
|
+
line-height: 1;
|
|
27
|
+
content: '*';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
> [role = 'toolbar'] {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
}
|
|
35
|
+
}
|
package/es/Title/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Title",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"main": "./Title.js"
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "Title",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": "./Title.js"
|
|
6
|
+
}
|
|
@@ -110,12 +110,10 @@ var CodeInput = /*#__PURE__*/function (_React$Component) {
|
|
|
110
110
|
|
|
111
111
|
case 3:
|
|
112
112
|
if (!_context.sent) {
|
|
113
|
-
_context.next =
|
|
113
|
+
_context.next = 7;
|
|
114
114
|
break;
|
|
115
115
|
}
|
|
116
116
|
|
|
117
|
-
debugger;
|
|
118
|
-
|
|
119
117
|
_this.setState({
|
|
120
118
|
time: _this.props.time || 60
|
|
121
119
|
});
|
|
@@ -131,10 +129,10 @@ var CodeInput = /*#__PURE__*/function (_React$Component) {
|
|
|
131
129
|
}
|
|
132
130
|
}, 1000);
|
|
133
131
|
|
|
134
|
-
case
|
|
132
|
+
case 7:
|
|
135
133
|
;
|
|
136
134
|
|
|
137
|
-
case
|
|
135
|
+
case 8:
|
|
138
136
|
case "end":
|
|
139
137
|
return _context.stop();
|
|
140
138
|
}
|
|
@@ -194,9 +194,9 @@ var NumberInput = /*#__PURE__*/function (_React$Component) {
|
|
|
194
194
|
if (!invalid) {
|
|
195
195
|
onChange && onChange(value);
|
|
196
196
|
}
|
|
197
|
-
}
|
|
198
197
|
|
|
199
|
-
|
|
198
|
+
onBlur && onBlur(event); //有输入才触发外部失去焦点事件,避免非必要请求
|
|
199
|
+
}
|
|
200
200
|
});
|
|
201
201
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "hasSpecialChar", function (value) {
|
|
202
202
|
if ((0, _includes["default"])(value).call(value, '+')) {
|
|
@@ -50,10 +50,12 @@ var _col = _interopRequireDefault(require("antd/lib/col"));
|
|
|
50
50
|
|
|
51
51
|
var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
|
|
52
52
|
|
|
53
|
-
var
|
|
53
|
+
var _tooltip = _interopRequireDefault(require("antd/lib/tooltip"));
|
|
54
54
|
|
|
55
55
|
var _icon = _interopRequireDefault(require("antd/lib/icon"));
|
|
56
56
|
|
|
57
|
+
var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
|
|
58
|
+
|
|
57
59
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/typeof"));
|
|
58
60
|
|
|
59
61
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
|
|
@@ -90,16 +92,16 @@ function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj &&
|
|
|
90
92
|
|
|
91
93
|
function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (_Object$getOwnPropertySymbols) { var symbols = _Object$getOwnPropertySymbols(object); enumerableOnly && (symbols = _filterInstanceProperty2(symbols).call(symbols, function (sym) { return _Object$getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
92
94
|
|
|
93
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
95
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context24, _context25; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context24 = ownKeys(Object(source), !0)).call(_context24, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context25 = ownKeys(Object(source))).call(_context25, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
94
96
|
|
|
95
97
|
function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2["default"])(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2["default"])(this).constructor; result = _Reflect$construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2["default"])(this, result); }; }
|
|
96
98
|
|
|
97
99
|
function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !_Reflect$construct) return false; if (_Reflect$construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(_Reflect$construct(Boolean, [], function () {})); return true; } catch (e) { return false; } }
|
|
98
100
|
|
|
99
101
|
var FormItem = _form["default"].Item;
|
|
100
|
-
var defaultSize = '
|
|
102
|
+
var defaultSize = 'large';
|
|
101
103
|
var defaultColNum = 4;
|
|
102
|
-
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader'];
|
|
104
|
+
var TYPE = ['readonly', 'text', 'search', 'searchText', 'select', 'selectText', 'radioGroup', 'number', 'date', 'textArea', 'password', 'editor', 'selectWriting', 'selectSearch', 'empty', 'captcha', 'area', 'uploadImg', 'cascader', 'checkbox'];
|
|
103
105
|
/**
|
|
104
106
|
* key:[必须],用于唯一标识该Form下的一个表单元素
|
|
105
107
|
* title:[必须],表单元素的标签
|
|
@@ -183,7 +185,7 @@ var Controlled = /*#__PURE__*/function (_React$Component) {
|
|
|
183
185
|
* checkable:是否显示checkbox选择框
|
|
184
186
|
* onOpenChange:控制日期框显示隐藏回调func(key, open)
|
|
185
187
|
* onAreaSearch:联级选择器触发,原型为func(key - 当前联级key, title - 输入值, parentKey - 主体联级key)
|
|
186
|
-
*
|
|
188
|
+
* onFileChange:上传组件触发,原型为func(key,{fileList, fileDeleteList})
|
|
187
189
|
*/
|
|
188
190
|
|
|
189
191
|
|
|
@@ -585,6 +587,16 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
585
587
|
props.loadData = _this2.createSearchEvent(control);
|
|
586
588
|
return /*#__PURE__*/_react["default"].createElement(_Control["default"], props);
|
|
587
589
|
});
|
|
590
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCheckbox", function (props, control) {
|
|
591
|
+
var _context21;
|
|
592
|
+
|
|
593
|
+
var options = control.options || [];
|
|
594
|
+
return /*#__PURE__*/_react["default"].createElement(_checkbox["default"].Group, {
|
|
595
|
+
options: options,
|
|
596
|
+
onChange: (0, _bind["default"])(_context21 = _this2.onBlur).call(_context21, (0, _assertThisInitialized2["default"])(_this2), control.key),
|
|
597
|
+
value: _this2.props.value[control.key]
|
|
598
|
+
});
|
|
599
|
+
});
|
|
588
600
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toControl", function (props, control) {
|
|
589
601
|
switch (props.type) {
|
|
590
602
|
case 'readonly':
|
|
@@ -640,6 +652,9 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
640
652
|
case 'cascader':
|
|
641
653
|
return _this2.toCascader(props, control);
|
|
642
654
|
|
|
655
|
+
case 'checkbox':
|
|
656
|
+
return _this2.toCheckbox(props, control);
|
|
657
|
+
|
|
643
658
|
default:
|
|
644
659
|
return 'type error';
|
|
645
660
|
}
|
|
@@ -647,17 +662,25 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
647
662
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toLabel", function (_ref11, type) {
|
|
648
663
|
var title = _ref11.title,
|
|
649
664
|
showAdd = _ref11.showAdd,
|
|
650
|
-
key = _ref11.key
|
|
665
|
+
key = _ref11.key,
|
|
666
|
+
showInfo = _ref11.showInfo,
|
|
667
|
+
showInfoTitle = _ref11.showInfoTitle;
|
|
651
668
|
|
|
652
669
|
if (showAdd && type !== 'readonly') {
|
|
653
|
-
var
|
|
670
|
+
var _context22;
|
|
654
671
|
|
|
655
|
-
var onClick = (0, _bind["default"])(
|
|
672
|
+
var onClick = (0, _bind["default"])(_context22 = _this2.onAdd).call(_context22, (0, _assertThisInitialized2["default"])(_this2), key, title);
|
|
656
673
|
return /*#__PURE__*/_react["default"].createElement("span", null, title, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
657
674
|
role: "add",
|
|
658
675
|
type: "plus-circle-o",
|
|
659
676
|
onClick: onClick
|
|
660
677
|
}));
|
|
678
|
+
} else if (showInfo) {
|
|
679
|
+
return /*#__PURE__*/_react["default"].createElement("span", null, title, /*#__PURE__*/_react["default"].createElement(_tooltip["default"], {
|
|
680
|
+
title: showInfoTitle
|
|
681
|
+
}, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
|
|
682
|
+
type: "info-circle"
|
|
683
|
+
})));
|
|
661
684
|
} else {
|
|
662
685
|
return title;
|
|
663
686
|
}
|
|
@@ -711,7 +734,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
711
734
|
});
|
|
712
735
|
});
|
|
713
736
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this2), "toCols", function () {
|
|
714
|
-
var
|
|
737
|
+
var _context23;
|
|
715
738
|
|
|
716
739
|
var _this2$props4 = _this2.props,
|
|
717
740
|
_this2$props4$colNum = _this2$props4.colNum,
|
|
@@ -723,7 +746,7 @@ var SuperForm2 = /*#__PURE__*/function (_React$Component2) {
|
|
|
723
746
|
}
|
|
724
747
|
|
|
725
748
|
var span = 24 / colNum;
|
|
726
|
-
return (0, _map["default"])(
|
|
749
|
+
return (0, _map["default"])(_context23 = _this2.getControls()).call(_context23, function (control) {
|
|
727
750
|
if (allFullFather) {
|
|
728
751
|
control.allFullFather = allFullFather;
|
|
729
752
|
}
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
|
+
var _typeof = require("@babel/runtime-corejs3/helpers/typeof");
|
|
4
|
+
|
|
3
5
|
var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
|
|
4
6
|
|
|
5
7
|
var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
|
|
@@ -28,6 +30,8 @@ var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-me
|
|
|
28
30
|
|
|
29
31
|
var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
|
|
30
32
|
|
|
33
|
+
var _WeakMap = require("@babel/runtime-corejs3/core-js-stable/weak-map");
|
|
34
|
+
|
|
31
35
|
var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
|
|
32
36
|
|
|
33
37
|
_Object$defineProperty(exports, "__esModule", {
|
|
@@ -84,7 +88,7 @@ var _propTypes = _interopRequireDefault(require("prop-types"));
|
|
|
84
88
|
|
|
85
89
|
var _reactDom = _interopRequireDefault(require("react-dom"));
|
|
86
90
|
|
|
87
|
-
var _Control = require("../Control");
|
|
91
|
+
var _Control = _interopRequireWildcard(require("../Control"));
|
|
88
92
|
|
|
89
93
|
var _SuperTableCell = _interopRequireDefault(require("./SuperTableCell"));
|
|
90
94
|
|
|
@@ -94,15 +98,21 @@ var _SuperToolbar = _interopRequireDefault(require("../SuperToolbar"));
|
|
|
94
98
|
|
|
95
99
|
var _variables = _interopRequireDefault(require("../variables"));
|
|
96
100
|
|
|
101
|
+
var _helper = _interopRequireWildcard(require("../helper"));
|
|
102
|
+
|
|
103
|
+
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); }
|
|
104
|
+
|
|
105
|
+
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(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; }
|
|
106
|
+
|
|
97
107
|
function _createForOfIteratorHelper(o, allowArrayLike) { var it = typeof _Symbol !== "undefined" && _getIteratorMethod(o) || o["@@iterator"]; if (!it) { if (_Array$isArray2(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; } } }; }
|
|
98
108
|
|
|
99
|
-
function _unsupportedIterableToArray(o, minLen) { var
|
|
109
|
+
function _unsupportedIterableToArray(o, minLen) { var _context16; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context16 = Object.prototype.toString.call(o)).call(_context16, 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); }
|
|
100
110
|
|
|
101
111
|
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; }
|
|
102
112
|
|
|
103
113
|
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; }
|
|
104
114
|
|
|
105
|
-
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var
|
|
115
|
+
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context14, _context15; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context14 = ownKeys(Object(source), !0)).call(_context14, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context15 = ownKeys(Object(source))).call(_context15, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
106
116
|
|
|
107
117
|
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); }; }
|
|
108
118
|
|
|
@@ -112,8 +122,8 @@ var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //
|
|
|
112
122
|
'selectText', //存储title
|
|
113
123
|
'search', 'searchText', 'selectSearch', //多选下拉搜索
|
|
114
124
|
'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
|
|
115
|
-
'img' //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
116
|
-
];
|
|
125
|
+
'img', //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
|
|
126
|
+
'uploadImg'];
|
|
117
127
|
/**
|
|
118
128
|
* key:标识所在列,在一个表格中必须唯一
|
|
119
129
|
* title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
|
|
@@ -142,22 +152,29 @@ var ColType = {
|
|
|
142
152
|
/**
|
|
143
153
|
* onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
|
|
144
154
|
* onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
|
|
145
|
-
*
|
|
155
|
+
* onBlur: 输入框失去焦点时触发,原型为function(rowIndex, keyName, value)
|
|
156
|
+
* onSearch:search组件输入内容时触发,原型为function(rowIndex, keyName, value, col)
|
|
146
157
|
* onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
|
|
147
158
|
* onAdd:点击+号时触发,原型为function(keyName)
|
|
148
159
|
* onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
|
|
149
|
-
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
|
|
160
|
+
* onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key);
|
|
161
|
+
* onDoubleClick: 双击单元格触发(只针对于type类型为空的情况下)
|
|
150
162
|
*/
|
|
151
163
|
|
|
152
164
|
var CallbackType = {
|
|
153
165
|
onExitValid: _propTypes["default"].func,
|
|
154
166
|
onCheck: _propTypes["default"].func,
|
|
155
167
|
onContentChange: _propTypes["default"].func,
|
|
168
|
+
onBlur: _propTypes["default"].func,
|
|
156
169
|
onSearch: _propTypes["default"].func,
|
|
157
170
|
onLink: _propTypes["default"].func,
|
|
158
171
|
onAdd: _propTypes["default"].func,
|
|
159
172
|
onRenderCustom: _propTypes["default"].func,
|
|
160
|
-
onToolbar: _propTypes["default"].func
|
|
173
|
+
onToolbar: _propTypes["default"].func,
|
|
174
|
+
onDoubleClick: _propTypes["default"].func,
|
|
175
|
+
onTableFileChange: _propTypes["default"].func,
|
|
176
|
+
buildSuperUploadProps: _propTypes["default"].func //构建type===uploadImg时,SuperUpload组件需要的公共属性函数,已在项目公共文件state.js中提供,可直接引用
|
|
177
|
+
|
|
161
178
|
};
|
|
162
179
|
/**
|
|
163
180
|
* base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
|
|
@@ -231,8 +248,23 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
231
248
|
onLink && onLink(key, index, _this.props.items[index]);
|
|
232
249
|
};
|
|
233
250
|
});
|
|
234
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function () {
|
|
235
|
-
|
|
251
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function (key, rowIndex) {
|
|
252
|
+
return function (value) {
|
|
253
|
+
var _ref7 = _this.props.callback || {},
|
|
254
|
+
onBlur = _ref7.onBlur;
|
|
255
|
+
|
|
256
|
+
_this.closeValid();
|
|
257
|
+
|
|
258
|
+
onBlur && onBlur(_this.getIndex(rowIndex), key, value);
|
|
259
|
+
};
|
|
260
|
+
});
|
|
261
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onDoubleClick", function (key, value) {
|
|
262
|
+
return function () {
|
|
263
|
+
var _ref8 = _this.props.callback || {},
|
|
264
|
+
onDoubleClick = _ref8.onDoubleClick;
|
|
265
|
+
|
|
266
|
+
onDoubleClick && onDoubleClick(key, value);
|
|
267
|
+
};
|
|
236
268
|
});
|
|
237
269
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
|
|
238
270
|
var _this$props = _this.props,
|
|
@@ -290,7 +322,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
290
322
|
options: _this.getOptions(key, options, index),
|
|
291
323
|
onChange: _this.onChange(key, index),
|
|
292
324
|
onSearch: _this.onSearch(key, index, config),
|
|
293
|
-
onBlur: _this.onBlur
|
|
325
|
+
onBlur: _this.onBlur(key, index)
|
|
294
326
|
};
|
|
295
327
|
|
|
296
328
|
if (showRowAdd && (0, _isArray["default"])(isRequired) && (0, _includes["default"])(isRequired).call(isRequired, key)) {
|
|
@@ -369,8 +401,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
369
401
|
var split = index2 === list.length - 1 ? '' : ',';
|
|
370
402
|
|
|
371
403
|
var onClick = function onClick() {
|
|
372
|
-
var
|
|
373
|
-
onLink =
|
|
404
|
+
var _ref9 = _this.props.callback || {},
|
|
405
|
+
onLink = _ref9.onLink;
|
|
374
406
|
|
|
375
407
|
onLink && onLink(col.key, index, item2);
|
|
376
408
|
};
|
|
@@ -384,8 +416,8 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
384
416
|
var title = typeof col.link === 'string' ? col.link : value;
|
|
385
417
|
|
|
386
418
|
var onClick = function onClick() {
|
|
387
|
-
var
|
|
388
|
-
onLink =
|
|
419
|
+
var _ref10 = _this.props.callback || {},
|
|
420
|
+
onLink = _ref10.onLink;
|
|
389
421
|
|
|
390
422
|
onLink && onLink(col.key, index, record);
|
|
391
423
|
};
|
|
@@ -400,13 +432,16 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
400
432
|
});
|
|
401
433
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCellRender", function (col) {
|
|
402
434
|
return function (value, record, index) {
|
|
403
|
-
var _context3, _context4, _context5, _context6;
|
|
435
|
+
var _context3, _context4, _context5, _context6, _context7;
|
|
404
436
|
|
|
405
437
|
var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
|
|
406
438
|
|
|
407
439
|
if (!realType) {
|
|
408
440
|
return /*#__PURE__*/_react["default"].createElement("div", {
|
|
441
|
+
onDoubleClick: _this.onDoubleClick(col.key, record.key),
|
|
409
442
|
style: {
|
|
443
|
+
minHeight: '20px',
|
|
444
|
+
minWidth: '100px',
|
|
410
445
|
maxWidth: "".concat(col.width - 16, "px"),
|
|
411
446
|
overflow: 'hidden',
|
|
412
447
|
textOverflow: 'ellipsis'
|
|
@@ -450,12 +485,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
450
485
|
}
|
|
451
486
|
|
|
452
487
|
case 'switch':
|
|
453
|
-
return value === '
|
|
488
|
+
return typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("div", null, value) : /*#__PURE__*/_react["default"].createElement(_switch["default"], {
|
|
454
489
|
checkedChildren: col.props.checkedChildren || '',
|
|
455
490
|
unCheckedChildren: col.props.unCheckedChildren || '',
|
|
456
491
|
onChange: _this.onSwitch(col.key, record.key),
|
|
457
492
|
size: "default",
|
|
458
|
-
checked: value || false,
|
|
493
|
+
checked: typeof value === 'number' ? Boolean(value) : value || false,
|
|
459
494
|
disabled: !(record._isEdit === true)
|
|
460
495
|
});
|
|
461
496
|
|
|
@@ -482,14 +517,41 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
482
517
|
height: '80px'
|
|
483
518
|
}
|
|
484
519
|
}) : /*#__PURE__*/_react["default"].createElement("div", {
|
|
485
|
-
role: 'imgBox'
|
|
520
|
+
role: 'imgBox',
|
|
521
|
+
style: {
|
|
522
|
+
maxWidth: '120px'
|
|
523
|
+
}
|
|
486
524
|
}, /*#__PURE__*/_react["default"].createElement("img", {
|
|
487
525
|
src: value.img,
|
|
488
526
|
style: {
|
|
489
527
|
width: '80px',
|
|
490
528
|
height: '80px'
|
|
491
529
|
}
|
|
492
|
-
}), /*#__PURE__*/_react["default"].createElement("
|
|
530
|
+
}), /*#__PURE__*/_react["default"].createElement("div", {
|
|
531
|
+
style: {
|
|
532
|
+
display: 'inline-block'
|
|
533
|
+
}
|
|
534
|
+
}, /*#__PURE__*/_react["default"].createElement("span", {
|
|
535
|
+
style: {
|
|
536
|
+
display: 'block'
|
|
537
|
+
}
|
|
538
|
+
}, value.title), _helper["default"].isEmpty2(value.remark) ? null : /*#__PURE__*/_react["default"].createElement("span", {
|
|
539
|
+
style: {
|
|
540
|
+
color: '#333'
|
|
541
|
+
}
|
|
542
|
+
}, value.remark))) : /*#__PURE__*/_react["default"].createElement("div", null);
|
|
543
|
+
|
|
544
|
+
case 'uploadImg':
|
|
545
|
+
var commonProps = _this.props.callback.buildSuperUploadProps ? _this.props.callback.buildSuperUploadProps() : {};
|
|
546
|
+
|
|
547
|
+
var uploadProps = _objectSpread(_objectSpread(_objectSpread(_objectSpread({
|
|
548
|
+
onFileChange: _this.props.callback.onTableFileChange ? (0, _bind["default"])(_context7 = _this.props.callback.onTableFileChange).call(_context7, null, col.key, index) : undefined,
|
|
549
|
+
type: col.type
|
|
550
|
+
}, col.props), _this.props), commonProps), {}, {
|
|
551
|
+
value: _this.props.items[index][col.key]
|
|
552
|
+
});
|
|
553
|
+
|
|
554
|
+
return /*#__PURE__*/_react["default"].createElement(_Control["default"], uploadProps);
|
|
493
555
|
|
|
494
556
|
default:
|
|
495
557
|
return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
|
|
@@ -535,12 +597,12 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
535
597
|
return null;
|
|
536
598
|
}
|
|
537
599
|
});
|
|
538
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (
|
|
539
|
-
var required =
|
|
540
|
-
title =
|
|
541
|
-
type =
|
|
542
|
-
key =
|
|
543
|
-
showAdd =
|
|
600
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (_ref11) {
|
|
601
|
+
var required = _ref11.required,
|
|
602
|
+
title = _ref11.title,
|
|
603
|
+
type = _ref11.type,
|
|
604
|
+
key = _ref11.key,
|
|
605
|
+
showAdd = _ref11.showAdd;
|
|
544
606
|
|
|
545
607
|
if (type === 'checkbox') {
|
|
546
608
|
var status = _this.getCheckedStatus(key);
|
|
@@ -555,9 +617,9 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
555
617
|
}, title, _this.toAdd(key, showAdd));
|
|
556
618
|
}
|
|
557
619
|
});
|
|
558
|
-
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (
|
|
559
|
-
var type =
|
|
560
|
-
align =
|
|
620
|
+
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref12) {
|
|
621
|
+
var type = _ref12.type,
|
|
622
|
+
align = _ref12.align;
|
|
561
623
|
|
|
562
624
|
if (type === 'index' || type === 'checkbox') {
|
|
563
625
|
return 'ant-table-selection-column';
|
|
@@ -566,22 +628,24 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
566
628
|
}
|
|
567
629
|
});
|
|
568
630
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
|
|
569
|
-
var
|
|
631
|
+
var _context8;
|
|
570
632
|
|
|
571
|
-
return !(0, _includes["default"])(
|
|
633
|
+
return !(0, _includes["default"])(_context8 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar', 'uploadImg']).call(_context8, type);
|
|
572
634
|
});
|
|
573
635
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
|
|
574
|
-
var
|
|
636
|
+
var _context9;
|
|
575
637
|
|
|
576
638
|
var readonly = _this.props.readonly;
|
|
577
|
-
return (0, _map["default"])(
|
|
639
|
+
return (0, _map["default"])(_context9 = (0, _filter["default"])(cols).call(cols, function (col) {
|
|
578
640
|
return !col.hide;
|
|
579
|
-
})).call(
|
|
580
|
-
var
|
|
641
|
+
})).call(_context9, function (_ref13, index) {
|
|
642
|
+
var _context10;
|
|
643
|
+
|
|
644
|
+
var col = (0, _extends2["default"])({}, _ref13);
|
|
581
645
|
col.className = _this.getColumnClassName(col);
|
|
582
646
|
col.title = _this.getColumnTitle(col);
|
|
583
647
|
col.dataIndex = col.key;
|
|
584
|
-
col.width = col.width || 120; // const {props = {}} = col;
|
|
648
|
+
col.width = col.width || (0, _includes["default"])(_context10 = ['index', 'checked']).call(_context10, col.key) ? 70 : 120; // const {props = {}} = col;
|
|
585
649
|
// const {edit = false} = props
|
|
586
650
|
// if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
|
|
587
651
|
// if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
|
|
@@ -601,14 +665,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
601
665
|
});
|
|
602
666
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
|
|
603
667
|
return (0, _map["default"])(items).call(items, function (item, index) {
|
|
604
|
-
return (0, _reduce["default"])(cols).call(cols, function (result,
|
|
605
|
-
var
|
|
668
|
+
return (0, _reduce["default"])(cols).call(cols, function (result, _ref14) {
|
|
669
|
+
var _context11;
|
|
606
670
|
|
|
607
|
-
var key =
|
|
608
|
-
type =
|
|
609
|
-
options =
|
|
671
|
+
var key = _ref14.key,
|
|
672
|
+
type = _ref14.type,
|
|
673
|
+
options = _ref14.options;
|
|
610
674
|
|
|
611
|
-
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(
|
|
675
|
+
if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context11 = item.isReadonly).call(_context11, key))) {
|
|
612
676
|
result[key] = item[key];
|
|
613
677
|
} else {
|
|
614
678
|
result[key] = (0, _Control.getTitle)(item[key], options);
|
|
@@ -640,7 +704,7 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
640
704
|
};
|
|
641
705
|
});
|
|
642
706
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
|
|
643
|
-
var
|
|
707
|
+
var _context12;
|
|
644
708
|
|
|
645
709
|
var _this$props3 = _this.props,
|
|
646
710
|
cols = _this$props3.cols,
|
|
@@ -653,13 +717,27 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
653
717
|
pagination = _this$props3$paginati === void 0 ? false : _this$props3$paginati,
|
|
654
718
|
_this$props3$isEmphas = _this$props3.isEmphasized,
|
|
655
719
|
isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
|
|
656
|
-
maxHeight = _this$props3.maxHeight
|
|
657
|
-
|
|
720
|
+
maxHeight = _this$props3.maxHeight,
|
|
721
|
+
_this$props3$expanded = _this$props3.expandedRowRender,
|
|
722
|
+
expandedRowRender = _this$props3$expanded === void 0 ? undefined : _this$props3$expanded,
|
|
723
|
+
_this$props3$onExpand = _this$props3.onExpand,
|
|
724
|
+
onExpand = _this$props3$onExpand === void 0 ? undefined : _this$props3$onExpand;
|
|
725
|
+
var widthX = (0, _reduce["default"])(_context12 = (0, _filter["default"])(cols).call(cols, function (col) {
|
|
658
726
|
return !col.hide;
|
|
659
|
-
})).call(
|
|
660
|
-
|
|
727
|
+
})).call(_context12, function (width, item) {
|
|
728
|
+
var _context13;
|
|
729
|
+
|
|
730
|
+
return width += item.width ? item.width : (0, _includes["default"])(_context13 = ['index', 'checked']).call(_context13, item.key) ? 70 : 120;
|
|
661
731
|
}, 0);
|
|
662
|
-
|
|
732
|
+
var scrollProps = !_helper["default"].isEmpty2(expandedRowRender) ? {
|
|
733
|
+
expandedRowRender: expandedRowRender
|
|
734
|
+
} : {
|
|
735
|
+
scroll: {
|
|
736
|
+
x: widthX,
|
|
737
|
+
y: maxHeight
|
|
738
|
+
}
|
|
739
|
+
};
|
|
740
|
+
return _objectSpread(_objectSpread({
|
|
663
741
|
className: !isEmphasized ? (0, _variables["default"])('SuperTable2') : (0, _variables["default"])('SuperTable2').noTransition,
|
|
664
742
|
columns: _this.getColumns(cols),
|
|
665
743
|
dataSource: _this.getDataSource(items, cols),
|
|
@@ -667,16 +745,14 @@ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
|
|
|
667
745
|
whiteSpace: 'nowrap'
|
|
668
746
|
}, style),
|
|
669
747
|
size: 'small',
|
|
670
|
-
scroll: {
|
|
671
|
-
x: widthX,
|
|
672
|
-
y: maxHeight
|
|
673
|
-
},
|
|
674
748
|
pagination: pagination,
|
|
675
749
|
footer: footer,
|
|
676
750
|
locale: _this.props.emptyText ? {
|
|
677
751
|
emptyText: _this.props.emptyText
|
|
678
752
|
} : null
|
|
679
|
-
}, _this.getPropsByCheckbox())
|
|
753
|
+
}, _this.getPropsByCheckbox()), {}, {
|
|
754
|
+
onExpand: onExpand
|
|
755
|
+
}, scrollProps);
|
|
680
756
|
});
|
|
681
757
|
(0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setScroll", function () {
|
|
682
758
|
if (_this.props.maxHeight && _this.props.items.length) {
|
|
@@ -66,7 +66,7 @@ function ownKeys(object, enumerableOnly) { var keys = _Object$keys(object); if (
|
|
|
66
66
|
|
|
67
67
|
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) { (0, _defineProperty2["default"])(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; }
|
|
68
68
|
|
|
69
|
-
var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF'];
|
|
69
|
+
var FORMATS = ['image/jpeg', 'image/gif', 'image/bmp', 'image/jpg', 'image/png', 'image/tiff', 'image/gif', 'image/pcx', 'image/tga', 'image/exif', 'image/fpx', 'image/svg', 'image/psd', 'image/cdr', 'image/pcd', 'image/dxf', 'image/ufo', 'image/eps', 'image/ai', 'image/raw', 'image/WMF', 'video/mp4'];
|
|
70
70
|
var FORMATS1 = ['.jpeg', '.gif', '.bmp', '.jpg', '.png', '.tiff', '.pcx', '.tga', '.exif', '.fpx', '.svg', '.psd', '.cdr', '.pcd', '.dxf', '.ufo', '.eps', '.ai', '.raw', '.WMF']; //组件属性定义
|
|
71
71
|
|
|
72
72
|
var propTypes = {
|
|
@@ -79,7 +79,7 @@ var propTypes = {
|
|
|
79
79
|
required: _propTypes["default"].bool,
|
|
80
80
|
//是否必须上传,默认false
|
|
81
81
|
listType: _propTypes["default"].oneOf[('text', 'picture', 'picture-card')],
|
|
82
|
-
//上传列表的内建样式,支持三种,默认
|
|
82
|
+
//上传列表的内建样式,支持三种,默认picture-card
|
|
83
83
|
readonly: _propTypes["default"].bool,
|
|
84
84
|
//所在页面是否只读,默认false
|
|
85
85
|
multiple: _propTypes["default"].bool,
|
package/lib/Title/Title.less
CHANGED
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
@import '../variables';
|
|
2
|
-
|
|
3
|
-
.@{cloudlink-prefix}-title {
|
|
4
|
-
> *:first-child {
|
|
5
|
-
display: inline-block;
|
|
6
|
-
color: @brand-primary;
|
|
7
|
-
line-height: 1.2;
|
|
8
|
-
|
|
9
|
-
&[data-border='true'] {
|
|
10
|
-
padding: 0 5px;
|
|
11
|
-
border-left: @brand-primary solid 3px;
|
|
12
|
-
}
|
|
13
|
-
|
|
14
|
-
&[data-fold='true'] {
|
|
15
|
-
cursor: pointer;
|
|
16
|
-
margin: 8px 0;
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
&[data-required='true'] {
|
|
20
|
-
&::after {
|
|
21
|
-
display: inline-block;
|
|
22
|
-
margin-left: 4px;
|
|
23
|
-
color: #f5222d;
|
|
24
|
-
font-size: 12px;
|
|
25
|
-
font-family: SimSun, sans-serif;
|
|
26
|
-
line-height: 1;
|
|
27
|
-
content: '*';
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
> [role = 'toolbar'] {
|
|
33
|
-
display: inline-block;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
1
|
+
@import '../variables';
|
|
2
|
+
|
|
3
|
+
.@{cloudlink-prefix}-title {
|
|
4
|
+
> *:first-child {
|
|
5
|
+
display: inline-block;
|
|
6
|
+
color: @brand-primary;
|
|
7
|
+
line-height: 1.2;
|
|
8
|
+
|
|
9
|
+
&[data-border='true'] {
|
|
10
|
+
padding: 0 5px;
|
|
11
|
+
border-left: @brand-primary solid 3px;
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
&[data-fold='true'] {
|
|
15
|
+
cursor: pointer;
|
|
16
|
+
margin: 8px 0;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
&[data-required='true'] {
|
|
20
|
+
&::after {
|
|
21
|
+
display: inline-block;
|
|
22
|
+
margin-left: 4px;
|
|
23
|
+
color: #f5222d;
|
|
24
|
+
font-size: 12px;
|
|
25
|
+
font-family: SimSun, sans-serif;
|
|
26
|
+
line-height: 1;
|
|
27
|
+
content: '*';
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
> [role = 'toolbar'] {
|
|
33
|
+
display: inline-block;
|
|
34
|
+
}
|
|
35
|
+
}
|
package/lib/Title/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "Title",
|
|
3
|
-
"version": "0.0.0",
|
|
4
|
-
"private": true,
|
|
5
|
-
"main": "./Title.js"
|
|
6
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "Title",
|
|
3
|
+
"version": "0.0.0",
|
|
4
|
+
"private": true,
|
|
5
|
+
"main": "./Title.js"
|
|
6
|
+
}
|