cloud-b2b 1.1.52 → 1.1.53
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/es/Area/Area.js +141 -0
- package/es/Card/Card.js +19 -0
- package/es/CodeInput/CodeInput.js +123 -0
- package/es/Control/Control.js +444 -0
- package/es/Control/event.js +43 -0
- package/es/Enhance/Dialogs.js +52 -0
- package/es/Enhance/Loading.js +131 -0
- package/{src → es}/Enhance/index.js +6 -8
- package/es/Header/Header.js +162 -0
- package/es/Header/Vertical.js +106 -0
- package/es/ImageView/ImageView.js +100 -0
- package/es/Indent/Indent.js +19 -0
- package/es/InpurCascader/InputCascader.js +108 -0
- package/es/InputEditor/InputEditor.js +173 -0
- package/es/InputSearch/InputSearch.js +266 -0
- package/es/InputSelect/InputSelect.js +160 -0
- package/es/InputTreeSelect/InputTreeSelect.js +121 -0
- package/es/InputWriting/InputWriting.js +85 -0
- package/es/Layout/Layout.js +201 -0
- package/es/LayoutLink/LayoutLink.js +73 -0
- package/es/Link/Link.js +85 -0
- package/es/Loading/Loading.js +13 -0
- package/es/Loading2/Loading2.js +9 -0
- package/es/ModalWithDrag/ModalWithDrag.js +29 -0
- package/{src → es}/ModalWithDrag/drag.js +116 -128
- package/es/NumberInput/NumberInput.js +200 -0
- package/es/Search/Search.js +497 -0
- package/es/Sidebar/Sidebar.js +144 -0
- package/es/Sidebar2/Sidebar.js +165 -0
- package/es/SuperForm/SuperForm.js +593 -0
- package/es/SuperForm2/SuperForm.js +687 -0
- package/es/SuperIcon/SuperIcon.js +27 -0
- package/es/SuperPagination/SuperPagination.js +109 -0
- package/es/SuperTab/SuperTab.js +107 -0
- package/es/SuperTab2/SuperTab2.js +145 -0
- package/es/SuperTable/DragSortRow.js +97 -0
- package/es/SuperTable/FilterDropDown.js +164 -0
- package/es/SuperTable/SuperTable.js +808 -0
- package/es/SuperTable/fixed.js +34 -0
- package/es/SuperTable2/SuperTable2.js +894 -0
- package/es/SuperTable2/SuperTableCell.js +198 -0
- package/es/SuperTable3/FilterDropDown.js +164 -0
- package/es/SuperTable3/SuperTable.js +665 -0
- package/es/SuperTable3/fixed.js +34 -0
- package/es/SuperToolbar/SuperToolbar.js +195 -0
- package/es/SuperUpload/SuperUpload.js +356 -0
- package/es/Title/Title.js +33 -0
- package/es/Viewer/ImageViews.js +258 -0
- package/es/Viewer/Viewer.js +122 -0
- package/es/WingBlank/WingBlank.js +16 -0
- package/es/helper.js +240 -0
- package/{src → es}/history.js +6 -6
- package/es/index.js +37 -0
- package/es/variables.js +6 -0
- package/lib/Area/Area.js +149 -0
- package/lib/Area/package.json +6 -0
- package/lib/Card/Card.js +27 -0
- package/lib/Card/package.json +6 -0
- package/lib/CodeInput/CodeInput.js +131 -0
- package/lib/CodeInput/package.json +6 -0
- package/lib/Control/Control.js +450 -0
- package/lib/Control/event.js +51 -0
- package/lib/Control/package.json +6 -0
- package/lib/Enhance/Dialogs.js +60 -0
- package/lib/Enhance/Loading.js +138 -0
- package/lib/Enhance/index.js +25 -0
- package/lib/Enhance/package.json +6 -0
- package/lib/Header/Header.js +169 -0
- package/lib/Header/Header.less +95 -0
- package/lib/Header/Vertical.js +114 -0
- package/lib/Header/Vertical.less +60 -0
- package/lib/Header/package.json +6 -0
- package/lib/ImageView/ImageView.js +108 -0
- package/lib/ImageView/ImageView.less +14 -0
- package/lib/ImageView/package.json +6 -0
- package/lib/Indent/Indent.js +27 -0
- package/lib/Indent/package.json +6 -0
- package/lib/InpurCascader/InputCascader.js +115 -0
- package/lib/InpurCascader/package.json +6 -0
- package/lib/InputEditor/InputEditor.js +181 -0
- package/lib/InputEditor/inputEditor.less +8 -0
- package/lib/InputEditor/package.json +6 -0
- package/lib/InputSearch/InputSearch.js +274 -0
- package/lib/InputSearch/package.json +6 -0
- package/lib/InputSelect/InputSelect.js +168 -0
- package/lib/InputSelect/package.json +6 -0
- package/lib/InputTreeSelect/InputTreeSelect.js +128 -0
- package/lib/InputTreeSelect/package.json +6 -0
- package/lib/InputWriting/InputWriting.js +93 -0
- package/lib/InputWriting/package.json +6 -0
- package/lib/Layout/Layout.js +209 -0
- package/lib/Layout/Layout.less +28 -0
- package/lib/Layout/package.json +6 -0
- package/lib/LayoutLink/LayoutLink.js +86 -0
- package/lib/LayoutLink/LayoutLink.less +53 -0
- package/lib/LayoutLink/package.json +6 -0
- package/lib/Link/Link.js +93 -0
- package/lib/Link/package.json +6 -0
- package/lib/Loading/Loading.js +21 -0
- package/lib/Loading/Loading.less +13 -0
- package/lib/Loading/package.json +6 -0
- package/lib/Loading2/Loading2.js +17 -0
- package/lib/Loading2/Loading2.less +19 -0
- package/lib/Loading2/package.json +6 -0
- package/lib/ModalWithDrag/ModalWithDrag.js +37 -0
- package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
- package/lib/ModalWithDrag/drag.js +124 -0
- package/lib/ModalWithDrag/package.json +6 -0
- package/lib/NumberInput/NumberInput.js +208 -0
- package/lib/NumberInput/package.json +6 -0
- package/lib/Search/Search.js +510 -0
- package/lib/Search/Search.less +63 -0
- package/lib/Search/package.json +6 -0
- package/lib/Sidebar/Sidebar.js +152 -0
- package/lib/Sidebar/Sidebar.less +78 -0
- package/lib/Sidebar/package.json +6 -0
- package/lib/Sidebar2/Sidebar.js +173 -0
- package/lib/Sidebar2/Sidebar.less +153 -0
- package/lib/Sidebar2/package.json +6 -0
- package/lib/SuperForm/SuperForm.js +605 -0
- package/lib/SuperForm/SuperForm.less +52 -0
- package/lib/SuperForm/package.json +6 -0
- package/lib/SuperForm2/SuperForm.js +699 -0
- package/lib/SuperForm2/SuperForm.less +52 -0
- package/lib/SuperForm2/package.json +6 -0
- package/lib/SuperIcon/SuperIcon.js +35 -0
- package/lib/SuperIcon/package.json +6 -0
- package/lib/SuperPagination/SuperPagination.js +117 -0
- package/lib/SuperPagination/package.json +6 -0
- package/lib/SuperTab/SuperTab.js +115 -0
- package/lib/SuperTab/SuperTab.less +43 -0
- package/lib/SuperTab/package.json +6 -0
- package/lib/SuperTab2/SuperTab2.js +153 -0
- package/lib/SuperTab2/SuperTab2.less +18 -0
- package/lib/SuperTab2/package.json +6 -0
- package/lib/SuperTable/DragSortRow.js +105 -0
- package/lib/SuperTable/DragSortRow.less +17 -0
- package/lib/SuperTable/FilterDropDown.js +172 -0
- package/lib/SuperTable/FilterDropDown.less +30 -0
- package/lib/SuperTable/SuperTable.js +816 -0
- package/lib/SuperTable/SuperTable.less +132 -0
- package/lib/SuperTable/fixed.js +42 -0
- package/lib/SuperTable/package.json +6 -0
- package/lib/SuperTable2/SuperTable2.js +907 -0
- package/lib/SuperTable2/SuperTable2.less +118 -0
- package/lib/SuperTable2/SuperTableCell.js +203 -0
- package/lib/SuperTable2/package.json +6 -0
- package/lib/SuperTable3/FilterDropDown.js +172 -0
- package/lib/SuperTable3/FilterDropDown.less +29 -0
- package/lib/SuperTable3/SuperTable.js +673 -0
- package/lib/SuperTable3/SuperTable.less +99 -0
- package/lib/SuperTable3/fixed.js +42 -0
- package/lib/SuperTable3/package.json +6 -0
- package/lib/SuperToolbar/SuperToolbar.js +203 -0
- package/lib/SuperToolbar/SuperToolbar.less +17 -0
- package/lib/SuperToolbar/package.json +6 -0
- package/lib/SuperUpload/SuperUpload.js +368 -0
- package/lib/SuperUpload/SuperUpload.less +28 -0
- package/lib/SuperUpload/package.json +6 -0
- package/lib/Title/Title.js +41 -0
- package/lib/Title/Title.less +35 -0
- package/lib/Title/package.json +6 -0
- package/lib/Viewer/ImageViews.js +266 -0
- package/lib/Viewer/Viewer.js +130 -0
- package/lib/Viewer/Viewer.less +67 -0
- package/lib/Viewer/imgView.less +59 -0
- package/lib/Viewer/package.json +7 -0
- package/lib/WingBlank/WingBlank.js +24 -0
- package/lib/WingBlank/WingBlank.less +12 -0
- package/lib/WingBlank/package.json +6 -0
- package/lib/adjust.less +89 -0
- package/lib/helper.js +246 -0
- package/lib/history.js +12 -0
- package/lib/index.js +271 -0
- package/lib/index.less +31 -0
- package/lib/style.less +30 -0
- package/lib/variables.js +14 -0
- package/lib/variables.less +73 -0
- package/package.json +22 -44
- package/src/Area/Area.js +0 -94
- package/src/Card/Card.js +0 -16
- package/src/CodeInput/CodeInput.js +0 -76
- package/src/Control/Control.js +0 -338
- package/src/Control/event.js +0 -45
- package/src/Enhance/Dialogs.js +0 -24
- package/src/Enhance/Loading.js +0 -83
- package/src/Header/Header.js +0 -149
- package/src/Header/Vertical.js +0 -74
- package/src/ImageView/ImageView.js +0 -62
- package/src/Indent/Indent.js +0 -12
- package/src/InpurCascader/InputCascader.js +0 -83
- package/src/InputEditor/InputEditor.js +0 -93
- package/src/InputSearch/InputSearch.js +0 -186
- package/src/InputSelect/InputSelect.js +0 -103
- package/src/InputTreeSelect/InputTreeSelect.js +0 -87
- package/src/InputWriting/InputWriting.js +0 -65
- package/src/Layout/Layout.js +0 -121
- package/src/LayoutLink/LayoutLink.js +0 -59
- package/src/Link/Link.js +0 -57
- package/src/Loading/Loading.js +0 -15
- package/src/Loading2/Loading2.js +0 -15
- package/src/ModalWithDrag/ModalWithDrag.js +0 -17
- package/src/NumberInput/NumberInput.js +0 -137
- package/src/Search/Search.js +0 -368
- package/src/Sidebar/Sidebar.js +0 -111
- package/src/Sidebar2/Sidebar.js +0 -143
- package/src/SuperForm/SuperForm.js +0 -516
- package/src/SuperForm2/SuperForm.js +0 -588
- package/src/SuperIcon/SuperIcon.js +0 -14
- package/src/SuperPagination/SuperPagination.js +0 -65
- package/src/SuperTab/SuperTab.js +0 -84
- package/src/SuperTab2/SuperTab2.js +0 -94
- package/src/SuperTable/DragSortRow.js +0 -62
- package/src/SuperTable/FilterDropDown.js +0 -111
- package/src/SuperTable/SuperTable.js +0 -590
- package/src/SuperTable/fixed.js +0 -34
- package/src/SuperTable2/SuperTable2.js +0 -600
- package/src/SuperTable2/SuperTableCell.js +0 -144
- package/src/SuperTable3/FilterDropDown.js +0 -111
- package/src/SuperTable3/SuperTable.js +0 -498
- package/src/SuperTable3/fixed.js +0 -34
- package/src/SuperToolbar/SuperToolbar.js +0 -128
- package/src/SuperUpload/SuperUpload.js +0 -137
- package/src/Title/Title.js +0 -18
- package/src/Viewer/ImageViews.js +0 -220
- package/src/Viewer/Viewer.js +0 -97
- package/src/WingBlank/WingBlank.js +0 -14
- package/src/helper.js +0 -185
- package/src/index.js +0 -38
- package/src/variables.js +0 -5
- package/test/index.html +0 -10
- package/test/test.js +0 -16
- package/test/test.less +0 -12
- package/test/webpack.config.js +0 -71
- package/tools/babel.config.js +0 -14
- package/tools/build.js +0 -70
- package/tools/publish.js +0 -9
- package/tools/util.js +0 -53
- /package/{src → es}/Area/package.json +0 -0
- /package/{src → es}/Card/package.json +0 -0
- /package/{src → es}/CodeInput/package.json +0 -0
- /package/{src → es}/Control/package.json +0 -0
- /package/{src → es}/Enhance/package.json +0 -0
- /package/{src → es}/Header/Header.less +0 -0
- /package/{src → es}/Header/Vertical.less +0 -0
- /package/{src → es}/Header/package.json +0 -0
- /package/{src → es}/ImageView/ImageView.less +0 -0
- /package/{src → es}/ImageView/package.json +0 -0
- /package/{src → es}/Indent/package.json +0 -0
- /package/{src → es}/InpurCascader/package.json +0 -0
- /package/{src → es}/InputEditor/inputEditor.less +0 -0
- /package/{src → es}/InputEditor/package.json +0 -0
- /package/{src → es}/InputSearch/package.json +0 -0
- /package/{src → es}/InputSelect/package.json +0 -0
- /package/{src → es}/InputTreeSelect/package.json +0 -0
- /package/{src → es}/InputWriting/package.json +0 -0
- /package/{src → es}/Layout/Layout.less +0 -0
- /package/{src → es}/Layout/package.json +0 -0
- /package/{src → es}/LayoutLink/LayoutLink.less +0 -0
- /package/{src → es}/LayoutLink/package.json +0 -0
- /package/{src → es}/Link/package.json +0 -0
- /package/{src → es}/Loading/Loading.less +0 -0
- /package/{src → es}/Loading/package.json +0 -0
- /package/{src → es}/Loading2/Loading2.less +0 -0
- /package/{src → es}/Loading2/package.json +0 -0
- /package/{src → es}/ModalWithDrag/ModalWithDrag.less +0 -0
- /package/{src → es}/ModalWithDrag/package.json +0 -0
- /package/{src → es}/NumberInput/package.json +0 -0
- /package/{src → es}/Search/Search.less +0 -0
- /package/{src → es}/Search/package.json +0 -0
- /package/{src → es}/Sidebar/Sidebar.less +0 -0
- /package/{src → es}/Sidebar/package.json +0 -0
- /package/{src → es}/Sidebar2/Sidebar.less +0 -0
- /package/{src → es}/Sidebar2/package.json +0 -0
- /package/{src → es}/SuperForm/SuperForm.less +0 -0
- /package/{src → es}/SuperForm/package.json +0 -0
- /package/{src → es}/SuperForm2/SuperForm.less +0 -0
- /package/{src → es}/SuperForm2/package.json +0 -0
- /package/{src → es}/SuperIcon/package.json +0 -0
- /package/{src → es}/SuperPagination/package.json +0 -0
- /package/{src → es}/SuperTab/SuperTab.less +0 -0
- /package/{src → es}/SuperTab/package.json +0 -0
- /package/{src → es}/SuperTab2/SuperTab2.less +0 -0
- /package/{src → es}/SuperTab2/package.json +0 -0
- /package/{src → es}/SuperTable/DragSortRow.less +0 -0
- /package/{src → es}/SuperTable/FilterDropDown.less +0 -0
- /package/{src → es}/SuperTable/SuperTable.less +0 -0
- /package/{src → es}/SuperTable/package.json +0 -0
- /package/{src → es}/SuperTable2/SuperTable2.less +0 -0
- /package/{src → es}/SuperTable2/package.json +0 -0
- /package/{src → es}/SuperTable3/FilterDropDown.less +0 -0
- /package/{src → es}/SuperTable3/SuperTable.less +0 -0
- /package/{src → es}/SuperTable3/package.json +0 -0
- /package/{src → es}/SuperToolbar/SuperToolbar.less +0 -0
- /package/{src → es}/SuperToolbar/package.json +0 -0
- /package/{src → es}/SuperUpload/SuperUpload.less +0 -0
- /package/{src → es}/SuperUpload/package.json +0 -0
- /package/{src → es}/Title/Title.less +0 -0
- /package/{src → es}/Title/package.json +0 -0
- /package/{src → es}/Viewer/Viewer.less +0 -0
- /package/{src → es}/Viewer/imgView.less +0 -0
- /package/{src → es}/Viewer/package.json +0 -0
- /package/{src → es}/WingBlank/WingBlank.less +0 -0
- /package/{src → es}/WingBlank/package.json +0 -0
- /package/{src → es}/adjust.less +0 -0
- /package/{src → es}/style.less +0 -0
- /package/{src → es}/variables.less +0 -0
|
@@ -0,0 +1,808 @@
|
|
|
1
|
+
import _Reflect$construct from "@babel/runtime-corejs3/core-js-stable/reflect/construct";
|
|
2
|
+
import _Object$keys from "@babel/runtime-corejs3/core-js-stable/object/keys";
|
|
3
|
+
import _Object$getOwnPropertySymbols from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols";
|
|
4
|
+
import _Object$getOwnPropertyDescriptor from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor";
|
|
5
|
+
import _Object$getOwnPropertyDescriptors from "@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors";
|
|
6
|
+
import _Object$defineProperties from "@babel/runtime-corejs3/core-js-stable/object/define-properties";
|
|
7
|
+
import _Object$defineProperty from "@babel/runtime-corejs3/core-js-stable/object/define-property";
|
|
8
|
+
import _Table from "antd/es/table";
|
|
9
|
+
import _objectWithoutProperties from "@babel/runtime-corejs3/helpers/objectWithoutProperties";
|
|
10
|
+
import _Tooltip from "antd/es/tooltip";
|
|
11
|
+
import _objectDestructuringEmpty from "@babel/runtime-corejs3/helpers/objectDestructuringEmpty";
|
|
12
|
+
import _extends from "@babel/runtime-corejs3/helpers/extends";
|
|
13
|
+
import _classCallCheck from "@babel/runtime-corejs3/helpers/classCallCheck";
|
|
14
|
+
import _createClass from "@babel/runtime-corejs3/helpers/createClass";
|
|
15
|
+
import _assertThisInitialized from "@babel/runtime-corejs3/helpers/assertThisInitialized";
|
|
16
|
+
import _inherits from "@babel/runtime-corejs3/helpers/inherits";
|
|
17
|
+
import _possibleConstructorReturn from "@babel/runtime-corejs3/helpers/possibleConstructorReturn";
|
|
18
|
+
import _getPrototypeOf from "@babel/runtime-corejs3/helpers/getPrototypeOf";
|
|
19
|
+
import _defineProperty from "@babel/runtime-corejs3/helpers/defineProperty";
|
|
20
|
+
var _excluded = ["onRowClick"];
|
|
21
|
+
function ownKeys(e, r) { var t = _Object$keys(e); if (_Object$getOwnPropertySymbols) { var o = _Object$getOwnPropertySymbols(e); r && (o = _filterInstanceProperty(o).call(o, function (r) { return _Object$getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
|
|
22
|
+
function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var _context9, _context10; var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? _forEachInstanceProperty(_context9 = ownKeys(Object(t), !0)).call(_context9, function (r) { _defineProperty(e, r, t[r]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(e, _Object$getOwnPropertyDescriptors(t)) : _forEachInstanceProperty(_context10 = ownKeys(Object(t))).call(_context10, function (r) { _Object$defineProperty(e, r, _Object$getOwnPropertyDescriptor(t, r)); }); } return e; }
|
|
23
|
+
import _concatInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/concat";
|
|
24
|
+
import _sliceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/slice";
|
|
25
|
+
import _filterInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/filter";
|
|
26
|
+
import _everyInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/every";
|
|
27
|
+
import _findIndexInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/find-index";
|
|
28
|
+
import _someInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/some";
|
|
29
|
+
import _setTimeout from "@babel/runtime-corejs3/core-js-stable/set-timeout";
|
|
30
|
+
import _includesInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/includes";
|
|
31
|
+
import _reduceInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/reduce";
|
|
32
|
+
import _Object$assign from "@babel/runtime-corejs3/core-js-stable/object/assign";
|
|
33
|
+
import _Array$isArray from "@babel/runtime-corejs3/core-js-stable/array/is-array";
|
|
34
|
+
import _mapInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/map";
|
|
35
|
+
import _bindInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/bind";
|
|
36
|
+
import _forEachInstanceProperty from "@babel/runtime-corejs3/core-js-stable/instance/for-each";
|
|
37
|
+
import _parseFloat from "@babel/runtime-corejs3/core-js-stable/parse-float";
|
|
38
|
+
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); }; }
|
|
39
|
+
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; } }
|
|
40
|
+
import React from 'react';
|
|
41
|
+
import PropTypes from 'prop-types';
|
|
42
|
+
import ReactDOM from 'react-dom';
|
|
43
|
+
import { getTitle } from '../Control';
|
|
44
|
+
import FilterDropDown from './FilterDropDown';
|
|
45
|
+
import fixed from './fixed';
|
|
46
|
+
import DragSortRow from './DragSortRow';
|
|
47
|
+
import variables from '../variables';
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* sorter: [可选],不传表示该列不支持排序;为string表示按字符串排序;为number表示按数字大小排序
|
|
51
|
+
* filter: [可选],是否支持过滤,默认为false
|
|
52
|
+
* link: [可选],为true表示超链接,内容来至items;为字符串表示超链接,内容就是该字符串;为字符串‘list’表示超链接数组,内容就是该items对应key对象数组的linkTitleKey属性拼接
|
|
53
|
+
* linkTitleKey: [可选],当link为'list'表示超链接组时,该值表示要拼接展示的属性key值
|
|
54
|
+
* isDateFilterByStartAndEnd: [可选],为true时做过滤操作会显示时间段搜索,默认为false
|
|
55
|
+
*
|
|
56
|
+
*/
|
|
57
|
+
var ColType = {
|
|
58
|
+
key: PropTypes.string.isRequired,
|
|
59
|
+
title: PropTypes.string,
|
|
60
|
+
align: PropTypes.oneOf(['left', 'center', 'right']),
|
|
61
|
+
sorter: PropTypes.oneOf(['string', 'number']),
|
|
62
|
+
filter: PropTypes.bool,
|
|
63
|
+
hide: PropTypes.bool,
|
|
64
|
+
options: PropTypes.array,
|
|
65
|
+
link: PropTypes.oneOfType([PropTypes.bool, PropTypes.string]),
|
|
66
|
+
linkTitleKey: PropTypes.string,
|
|
67
|
+
noWrap: PropTypes.bool,
|
|
68
|
+
isDateFilterByStartAndEnd: PropTypes.bool
|
|
69
|
+
};
|
|
70
|
+
var ItemType = {
|
|
71
|
+
checked: PropTypes.bool
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* onCheck:点击复选框时触发,原型func(isAll, checked, rowIndex);isolation为true时,原型为onCheck(checkedRows)
|
|
76
|
+
* onRadio: 点击单选按钮时触发,原型为func(checkedRows)
|
|
77
|
+
* onDoubleClick: 行双击时触发,原型func(rowIndex)
|
|
78
|
+
* onLink: 点击超链接时触发,原型为func(key, rowIndex, item)
|
|
79
|
+
* onTableChange: 排序信息改变时触发,原型为func(sortInfo, filterInfo)
|
|
80
|
+
* onMoveRow:行拖曳排序时触发,原型为func(dragIndex, targetIndex)
|
|
81
|
+
*/
|
|
82
|
+
var CallbackType = {
|
|
83
|
+
onCheck: PropTypes.func,
|
|
84
|
+
onRadio: PropTypes.func,
|
|
85
|
+
onDoubleClick: PropTypes.func,
|
|
86
|
+
onLink: PropTypes.func,
|
|
87
|
+
onTableChange: PropTypes.func,
|
|
88
|
+
onMoveRow: PropTypes.func
|
|
89
|
+
};
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* checkbox: [可选],是否有复选框,默认为true
|
|
93
|
+
* isPaging: [可选],是否分页,默认为false
|
|
94
|
+
* radio: [可选],是否为单选按钮,当checkbox为true时生效,默认值为false
|
|
95
|
+
* isolation: [可选],为true时,复选框的选中行采用checkedRows存储
|
|
96
|
+
* checkedRows: [可选],选中的行数,radio为true时生效
|
|
97
|
+
* index: [可选],是否有序号,默认值为true
|
|
98
|
+
* indexTitle:[可选],序号标题,默认为'序号'
|
|
99
|
+
* sortInfo: [可选],排序信息,默认为null
|
|
100
|
+
* filterInfo: [可选],过滤信息,默认为null
|
|
101
|
+
* maxHeight: [可选],设置表格的最大高度
|
|
102
|
+
* dragSort: [可选], 为true表示支持行拖曳排序,且不支持行单击选中复选或单选按钮和双击事件,默认为false
|
|
103
|
+
* isEmphasized: [可选],是否强调,行字体加粗显示;要实现字体加粗显示除了isEmphasized设置为true之外,加粗行数据里要设置__isEmphasized为true
|
|
104
|
+
* isWeaken: [可选],是否弱化行字体置灰显示,除了isWeaken设置为true之外,置灰行数据里要设置__isWeaken为true
|
|
105
|
+
* pageTotal: [可选], 为true表示开启表格末行自动汇总表格列数据,默认为false || searchTotal,当开启时,需要汇总的列需设置属性total为true,当dragSort为true时,该选项失效
|
|
106
|
+
* searchTotal: [可选], 表格汇总数据对象,该属性不为空时pageTotal默认开启,当dragSort为true时,该选项失效
|
|
107
|
+
*/
|
|
108
|
+
var SuperTable = /*#__PURE__*/function (_React$Component) {
|
|
109
|
+
_inherits(SuperTable, _React$Component);
|
|
110
|
+
var _super = _createSuper(SuperTable);
|
|
111
|
+
function SuperTable() {
|
|
112
|
+
var _context;
|
|
113
|
+
var _this;
|
|
114
|
+
_classCallCheck(this, SuperTable);
|
|
115
|
+
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
|
|
116
|
+
args[_key] = arguments[_key];
|
|
117
|
+
}
|
|
118
|
+
_this = _super.call.apply(_super, _concatInstanceProperty(_context = [this]).call(_context, args));
|
|
119
|
+
_defineProperty(_assertThisInitialized(_this), "state", {
|
|
120
|
+
filterVisibleKey: ''
|
|
121
|
+
});
|
|
122
|
+
_defineProperty(_assertThisInitialized(_this), "onTableChange", function (pagination, filters, sorter) {
|
|
123
|
+
var _ref = _this.props.callback || {},
|
|
124
|
+
onTableChange = _ref.onTableChange;
|
|
125
|
+
var _this$props$filterInf = _this.props.filterInfo,
|
|
126
|
+
filterInfo = _this$props$filterInf === void 0 ? null : _this$props$filterInf;
|
|
127
|
+
onTableChange && onTableChange(sorter, filterInfo);
|
|
128
|
+
});
|
|
129
|
+
_defineProperty(_assertThisInitialized(_this), "onChange", function () {
|
|
130
|
+
var selectedKeyArr = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
131
|
+
var _ref2 = _this.props.callback || {},
|
|
132
|
+
onCheck = _ref2.onCheck;
|
|
133
|
+
if (onCheck) {
|
|
134
|
+
var _this$props = _this.props,
|
|
135
|
+
_this$props$items = _this$props.items,
|
|
136
|
+
items = _this$props$items === void 0 ? [] : _this$props$items,
|
|
137
|
+
_this$props$isWeaken = _this$props.isWeaken,
|
|
138
|
+
isWeaken = _this$props$isWeaken === void 0 ? false : _this$props$isWeaken,
|
|
139
|
+
pageTotal = _this$props.pageTotal,
|
|
140
|
+
searchTotal = _this$props.searchTotal;
|
|
141
|
+
var offset = 0;
|
|
142
|
+
pageTotal && offset--;
|
|
143
|
+
searchTotal && offset--;
|
|
144
|
+
var realSlectedList = selectedKeyArr.length > items.length ? _sliceInstanceProperty(selectedKeyArr).call(selectedKeyArr, 0, selectedKeyArr.length + offset) : selectedKeyArr;
|
|
145
|
+
var selectedKeys = isWeaken ? _filterInstanceProperty(realSlectedList).call(realSlectedList, function (o) {
|
|
146
|
+
return !items[o].__isWeaken;
|
|
147
|
+
}) : realSlectedList;
|
|
148
|
+
var newItems = isWeaken ? _filterInstanceProperty(items).call(items, function (o) {
|
|
149
|
+
return !o.__isWeaken;
|
|
150
|
+
}) : items;
|
|
151
|
+
if (selectedKeys.length === 0) {
|
|
152
|
+
onCheck(true, false, -1);
|
|
153
|
+
} else if (selectedKeys.length === newItems.length) {
|
|
154
|
+
var checked = _everyInstanceProperty(newItems).call(newItems, function (o) {
|
|
155
|
+
return o.checked;
|
|
156
|
+
});
|
|
157
|
+
onCheck(true, !checked, -1);
|
|
158
|
+
} else {
|
|
159
|
+
var defaultSelectedKeys = _this.getSelectedRowKeys(newItems);
|
|
160
|
+
if (selectedKeys.length > defaultSelectedKeys.length) {
|
|
161
|
+
if (_this.props.isPaging && selectedKeys.length - defaultSelectedKeys.length > 1) {
|
|
162
|
+
return onCheck(true, true, -1);
|
|
163
|
+
}
|
|
164
|
+
onCheck(false, true, selectedKeys[selectedKeys.length - 1]);
|
|
165
|
+
} else {
|
|
166
|
+
var index = _findIndexInstanceProperty(defaultSelectedKeys).call(defaultSelectedKeys, function (key) {
|
|
167
|
+
return !_someInstanceProperty(selectedKeys).call(selectedKeys, function (select) {
|
|
168
|
+
return select === key;
|
|
169
|
+
});
|
|
170
|
+
});
|
|
171
|
+
onCheck(false, false, defaultSelectedKeys[index]);
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
_defineProperty(_assertThisInitialized(_this), "onCheckChange", function (selectedKeys) {
|
|
177
|
+
var _ref3 = _this.props.callback || {},
|
|
178
|
+
onCheck = _ref3.onCheck;
|
|
179
|
+
onCheck && onCheck(selectedKeys);
|
|
180
|
+
});
|
|
181
|
+
_defineProperty(_assertThisInitialized(_this), "onRadioChange", function (selectedKeys) {
|
|
182
|
+
var _ref4 = _this.props.callback || {},
|
|
183
|
+
onRadio = _ref4.onRadio;
|
|
184
|
+
onRadio && onRadio(selectedKeys);
|
|
185
|
+
});
|
|
186
|
+
_defineProperty(_assertThisInitialized(_this), "onRadioRowClick", function (record) {
|
|
187
|
+
var _ref5 = _this.props.callback || {},
|
|
188
|
+
onRadio = _ref5.onRadio;
|
|
189
|
+
onRadio && onRadio([record.key]);
|
|
190
|
+
});
|
|
191
|
+
_defineProperty(_assertThisInitialized(_this), "onRowClick", function (record) {
|
|
192
|
+
var _this$props2 = _this.props,
|
|
193
|
+
_this$props2$isWeaken = _this$props2.isWeaken,
|
|
194
|
+
isWeaken = _this$props2$isWeaken === void 0 ? false : _this$props2$isWeaken,
|
|
195
|
+
items = _this$props2.items;
|
|
196
|
+
if (items.length <= record.key) return;
|
|
197
|
+
clearTimeout(_this.timer);
|
|
198
|
+
_this.timer = _setTimeout(function () {
|
|
199
|
+
var _ref6 = _this.props.callback || {},
|
|
200
|
+
onCheck = _ref6.onCheck;
|
|
201
|
+
if (onCheck) {
|
|
202
|
+
var _this$props3 = _this.props,
|
|
203
|
+
isolation = _this$props3.isolation,
|
|
204
|
+
_this$props3$checkedR = _this$props3.checkedRows,
|
|
205
|
+
checkedRows = _this$props3$checkedR === void 0 ? [] : _this$props3$checkedR;
|
|
206
|
+
if (isolation) {
|
|
207
|
+
if (_includesInstanceProperty(checkedRows).call(checkedRows, record.key)) {
|
|
208
|
+
onCheck(_filterInstanceProperty(checkedRows).call(checkedRows, function (key) {
|
|
209
|
+
return record.key !== key;
|
|
210
|
+
}));
|
|
211
|
+
} else {
|
|
212
|
+
onCheck(_concatInstanceProperty(checkedRows).call(checkedRows, record.key));
|
|
213
|
+
}
|
|
214
|
+
} else {
|
|
215
|
+
var checked = isWeaken && items[record.key].__isWeaken ? false : !record.checked;
|
|
216
|
+
onCheck(false, checked, record.key);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
}, 250);
|
|
220
|
+
});
|
|
221
|
+
_defineProperty(_assertThisInitialized(_this), "onDoubleClick", function (record) {
|
|
222
|
+
clearTimeout(_this.timer);
|
|
223
|
+
var _ref7 = _this.props.callback || {},
|
|
224
|
+
onDoubleClick = _ref7.onDoubleClick;
|
|
225
|
+
onDoubleClick && onDoubleClick(record.key);
|
|
226
|
+
});
|
|
227
|
+
_defineProperty(_assertThisInitialized(_this), "onLink", function (key, index, item, e) {
|
|
228
|
+
var _ref8 = _this.props.callback || {},
|
|
229
|
+
onLink = _ref8.onLink;
|
|
230
|
+
onLink && onLink(key, index, item);
|
|
231
|
+
e.stopPropagation();
|
|
232
|
+
});
|
|
233
|
+
_defineProperty(_assertThisInitialized(_this), "onLinkDouble", function (e) {
|
|
234
|
+
e.stopPropagation();
|
|
235
|
+
});
|
|
236
|
+
_defineProperty(_assertThisInitialized(_this), "onMoveRow", function (dragIndex, targetIndex) {
|
|
237
|
+
var _ref9 = _this.props.callback || {},
|
|
238
|
+
onMoveRow = _ref9.onMoveRow;
|
|
239
|
+
onMoveRow && onMoveRow(dragIndex, targetIndex);
|
|
240
|
+
});
|
|
241
|
+
_defineProperty(_assertThisInitialized(_this), "getSelectedRowKeys", function (items) {
|
|
242
|
+
return _reduceInstanceProperty(items).call(items, function (result, item, index) {
|
|
243
|
+
item.checked && result.push(index);
|
|
244
|
+
return result;
|
|
245
|
+
}, []);
|
|
246
|
+
});
|
|
247
|
+
_defineProperty(_assertThisInitialized(_this), "getIndexInfo", function () {
|
|
248
|
+
var items = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];
|
|
249
|
+
var _this$props4 = _this.props,
|
|
250
|
+
_this$props4$index = _this$props4.index,
|
|
251
|
+
index = _this$props4$index === void 0 ? true : _this$props4$index,
|
|
252
|
+
_this$props4$indexTit = _this$props4.indexTitle,
|
|
253
|
+
indexTitle = _this$props4$indexTit === void 0 ? '序号' : _this$props4$indexTit;
|
|
254
|
+
return index ? [{
|
|
255
|
+
key: 'index',
|
|
256
|
+
title: indexTitle,
|
|
257
|
+
render: function render(text, record, index) {
|
|
258
|
+
return items[record.key].__totalIndexTitle || index + 1;
|
|
259
|
+
}
|
|
260
|
+
}] : [];
|
|
261
|
+
});
|
|
262
|
+
_defineProperty(_assertThisInitialized(_this), "setSortInfo", function (col, sortInfo) {
|
|
263
|
+
if (col.sorter === 'string') {
|
|
264
|
+
col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
|
|
265
|
+
col.sorter = function (row1, row2) {
|
|
266
|
+
var a = !col.link ? row1[col.key] : row1[col.key].props.children;
|
|
267
|
+
var b = !col.link ? row2[col.key] : row2[col.key].props.children;
|
|
268
|
+
if (a > b) {
|
|
269
|
+
return 1;
|
|
270
|
+
} else if (a === b) {
|
|
271
|
+
return 0;
|
|
272
|
+
} else {
|
|
273
|
+
return -1;
|
|
274
|
+
}
|
|
275
|
+
};
|
|
276
|
+
} else if (col.sorter === 'number') {
|
|
277
|
+
col.sortOrder = sortInfo.columnKey === col.key && sortInfo.order;
|
|
278
|
+
col.sorter = function (a, b) {
|
|
279
|
+
return a[col.key] - b[col.key];
|
|
280
|
+
};
|
|
281
|
+
} else {
|
|
282
|
+
delete col.sorter;
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
_defineProperty(_assertThisInitialized(_this), "setFilterInfo", function (col, filterInfo, visibleKey) {
|
|
286
|
+
if (_filterInstanceProperty(col)) {
|
|
287
|
+
var _col$isDateFilterBySt = col.isDateFilterByStartAndEnd,
|
|
288
|
+
isDateFilterByStartAndEnd = _col$isDateFilterBySt === void 0 ? false : _col$isDateFilterBySt;
|
|
289
|
+
var onSearch = function onSearch(value) {
|
|
290
|
+
var _ref10 = _this.props.callback || {},
|
|
291
|
+
onTableChange = _ref10.onTableChange;
|
|
292
|
+
var _this$props$sortInfo = _this.props.sortInfo,
|
|
293
|
+
sortInfo = _this$props$sortInfo === void 0 ? null : _this$props$sortInfo;
|
|
294
|
+
var newFilterInfo = _Object$assign({}, filterInfo, _defineProperty({}, col.key, value));
|
|
295
|
+
_this.setState({
|
|
296
|
+
filterVisibleKey: ''
|
|
297
|
+
});
|
|
298
|
+
onTableChange && onTableChange(sortInfo, newFilterInfo);
|
|
299
|
+
};
|
|
300
|
+
var value = filterInfo[col.key];
|
|
301
|
+
col.filteredValue = value ? [value] : null;
|
|
302
|
+
col.filterDropdownVisible = visibleKey === col.key;
|
|
303
|
+
var onClose = function onClose() {
|
|
304
|
+
_this.setState({
|
|
305
|
+
filterVisibleKey: ''
|
|
306
|
+
});
|
|
307
|
+
};
|
|
308
|
+
col.filterDropdown = /*#__PURE__*/React.createElement(FilterDropDown, {
|
|
309
|
+
value: value,
|
|
310
|
+
onSearch: onSearch,
|
|
311
|
+
onClose: onClose,
|
|
312
|
+
isDateFilterByStartAndEnd: isDateFilterByStartAndEnd
|
|
313
|
+
});
|
|
314
|
+
col.onFilterDropdownVisibleChange = function (visible) {
|
|
315
|
+
if (isDateFilterByStartAndEnd) {
|
|
316
|
+
visible && _this.setState({
|
|
317
|
+
filterVisibleKey: col.key
|
|
318
|
+
});
|
|
319
|
+
} else {
|
|
320
|
+
_this.setState({
|
|
321
|
+
filterVisibleKey: visible ? col.key : ''
|
|
322
|
+
});
|
|
323
|
+
}
|
|
324
|
+
};
|
|
325
|
+
col.onFilter = function (value, record) {
|
|
326
|
+
var items = _this.getItems();
|
|
327
|
+
if (items[record.key].__total) return true;
|
|
328
|
+
var content = !col.link ? record[col.key] : record[col.key].props.children;
|
|
329
|
+
if (!col.isDateFilterByStartAndEnd) {
|
|
330
|
+
var con = _Array$isArray(content) ? content : String(content);
|
|
331
|
+
return _includesInstanceProperty(con).call(con, value);
|
|
332
|
+
} else {
|
|
333
|
+
return !(value.start && new Date(value.start) > new Date(content) || value.end && value.end < content);
|
|
334
|
+
}
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
delete col.filter;
|
|
338
|
+
});
|
|
339
|
+
_defineProperty(_assertThisInitialized(_this), "linkList", function (key, index, item) {
|
|
340
|
+
var linkTitleKey = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'fileName';
|
|
341
|
+
var list = item[key] || [];
|
|
342
|
+
return /*#__PURE__*/React.createElement("div", null, _mapInstanceProperty(list).call(list, function (item2, index2) {
|
|
343
|
+
var _context2, _context3;
|
|
344
|
+
var split = index2 === list.length - 1 ? '' : ',';
|
|
345
|
+
var onClick = _bindInstanceProperty(_context2 = _this.onLink).call(_context2, null, key, index, item2);
|
|
346
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
347
|
+
key: index2,
|
|
348
|
+
onClick: onClick,
|
|
349
|
+
onDoubleClick: _this.onLinkDouble
|
|
350
|
+
}, _concatInstanceProperty(_context3 = "".concat(item2[linkTitleKey])).call(_context3, split));
|
|
351
|
+
}));
|
|
352
|
+
});
|
|
353
|
+
_defineProperty(_assertThisInitialized(_this), "waring", function (key, index, item, warningKey) {
|
|
354
|
+
var text = item[key] ? item[key] : '';
|
|
355
|
+
var color = item[warningKey] == 1 ? 'red' : 'rgba(0, 0, 0, 0.65)';
|
|
356
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", {
|
|
357
|
+
style: {
|
|
358
|
+
color: color
|
|
359
|
+
}
|
|
360
|
+
}, text.title ? text.title : text));
|
|
361
|
+
});
|
|
362
|
+
_defineProperty(_assertThisInitialized(_this), "defaultList", function (key, index, item, text, link) {
|
|
363
|
+
var _context4;
|
|
364
|
+
var onClick = _bindInstanceProperty(_context4 = _this.onLink).call(_context4, null, key, index, item);
|
|
365
|
+
if (link && typeof link === 'string') {
|
|
366
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
367
|
+
onClick: onClick,
|
|
368
|
+
onDoubleClick: _this.onLinkDouble
|
|
369
|
+
}, text);
|
|
370
|
+
}
|
|
371
|
+
return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("p", null, text));
|
|
372
|
+
});
|
|
373
|
+
_defineProperty(_assertThisInitialized(_this), "getColumns", function (cols, items) {
|
|
374
|
+
var _context5, _context6;
|
|
375
|
+
var _this$props5 = _this.props,
|
|
376
|
+
sortInfo = _this$props5.sortInfo,
|
|
377
|
+
filterInfo = _this$props5.filterInfo;
|
|
378
|
+
var filterVisibleKey = _this.state.filterVisibleKey;
|
|
379
|
+
return _mapInstanceProperty(_context5 = _concatInstanceProperty(_context6 = _this.getIndexInfo(items)).call(_context6, _filterInstanceProperty(cols).call(cols, function (col) {
|
|
380
|
+
return !col.hide;
|
|
381
|
+
}))).call(_context5, function (_ref11) {
|
|
382
|
+
var col = _extends({}, (_objectDestructuringEmpty(_ref11), _ref11));
|
|
383
|
+
col.dataIndex = col.key;
|
|
384
|
+
col.className = col.key === 'index' ? 'ant-table-selection-column' : col.align ? variables('SuperTable')[col.align] : '';
|
|
385
|
+
col.noWrap && (col.className = variables('SuperTable').noWrap);
|
|
386
|
+
_this.setSortInfo(col, sortInfo || {});
|
|
387
|
+
_this.setFilterInfo(col, filterInfo || {}, filterVisibleKey);
|
|
388
|
+
if (col.defaultValue) {
|
|
389
|
+
col.render = function (text, record, index) {
|
|
390
|
+
return _this.defaultList(col.key, index, items[index], col.defaultValue, col.link);
|
|
391
|
+
};
|
|
392
|
+
} else if (col.link === 'list') {
|
|
393
|
+
col.render = function (text, record, index) {
|
|
394
|
+
return _this.linkList(col.key, index, items[index], col.linkTitleKey);
|
|
395
|
+
};
|
|
396
|
+
} else if (col.link && typeof col.link === 'string') {
|
|
397
|
+
col.render = function (text, record, index) {
|
|
398
|
+
return _this.link(col.key, index, items[index], col.link);
|
|
399
|
+
};
|
|
400
|
+
} else if (col.isWarning) {
|
|
401
|
+
col.render = function (text, record, index) {
|
|
402
|
+
return _this.waring(col.key, index, items[index], col.warningKey);
|
|
403
|
+
};
|
|
404
|
+
} else if (col.tooltip) {
|
|
405
|
+
col.render = function (text, record, index) {
|
|
406
|
+
return _this.tooltip(col.key, index, items[index], col);
|
|
407
|
+
};
|
|
408
|
+
}
|
|
409
|
+
return col;
|
|
410
|
+
});
|
|
411
|
+
});
|
|
412
|
+
_defineProperty(_assertThisInitialized(_this), "getText", function (value, options) {
|
|
413
|
+
if (_Array$isArray(value)) {
|
|
414
|
+
return _mapInstanceProperty(value).call(value, function (v) {
|
|
415
|
+
return getTitle(v, options);
|
|
416
|
+
}).toString();
|
|
417
|
+
} else {
|
|
418
|
+
return getTitle(value, options);
|
|
419
|
+
}
|
|
420
|
+
});
|
|
421
|
+
_defineProperty(_assertThisInitialized(_this), "link", function (key, index, item, text) {
|
|
422
|
+
var _context7;
|
|
423
|
+
var onClick = _bindInstanceProperty(_context7 = _this.onLink).call(_context7, null, key, index, item);
|
|
424
|
+
return /*#__PURE__*/React.createElement("a", {
|
|
425
|
+
onClick: onClick,
|
|
426
|
+
onDoubleClick: _this.onLinkDouble
|
|
427
|
+
}, text);
|
|
428
|
+
});
|
|
429
|
+
_defineProperty(_assertThisInitialized(_this), "tooltip", function (key, index, item, _ref12) {
|
|
430
|
+
var tipLen = _ref12.tooltip,
|
|
431
|
+
options = _ref12.options;
|
|
432
|
+
var text = _this.getText(item[key], options);
|
|
433
|
+
var needTip = tipLen > 1 && text && typeof text === 'string' && text.length > tipLen;
|
|
434
|
+
return needTip ? /*#__PURE__*/React.createElement(_Tooltip, {
|
|
435
|
+
title: text
|
|
436
|
+
}, /*#__PURE__*/React.createElement("span", null, _sliceInstanceProperty(text).call(text, 0, tipLen) + '...')) : /*#__PURE__*/React.createElement("span", null, _Array$isArray(text) ? text.join(',') : text);
|
|
437
|
+
});
|
|
438
|
+
_defineProperty(_assertThisInitialized(_this), "getImgSrc", function (value, options) {
|
|
439
|
+
var index = _findIndexInstanceProperty(options).call(options, function (obj) {
|
|
440
|
+
return obj.value == value;
|
|
441
|
+
});
|
|
442
|
+
return index === -1 ? null : options[index].img;
|
|
443
|
+
});
|
|
444
|
+
/**
|
|
445
|
+
*
|
|
446
|
+
* @param item{array}:列数据
|
|
447
|
+
* @param key{string}:字段key
|
|
448
|
+
* @param options{array}:字段options
|
|
449
|
+
* @param dataSource{string,array}:数据源,如果列数据有多层则用此决定
|
|
450
|
+
*/
|
|
451
|
+
_defineProperty(_assertThisInitialized(_this), "getSourceText", function (item, key, options, dataSource) {
|
|
452
|
+
var value = {};
|
|
453
|
+
if (typeof dataSource === 'string') {
|
|
454
|
+
value = item[dataSource] || {};
|
|
455
|
+
} else if (_Array$isArray(dataSource)) {
|
|
456
|
+
_forEachInstanceProperty(dataSource).call(dataSource, function (source, index) {
|
|
457
|
+
/*如果字段重复则用dataSource取到结果,key不作为取字段的标准*/
|
|
458
|
+
if (index === 0) {
|
|
459
|
+
value = item[source] || {};
|
|
460
|
+
} else {
|
|
461
|
+
value = value[source] || {};
|
|
462
|
+
}
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
/*如果上面已经取到结果则不进入*/
|
|
466
|
+
if (typeof value !== 'string') {
|
|
467
|
+
value = value[key];
|
|
468
|
+
}
|
|
469
|
+
return _this.getText(value, options);
|
|
470
|
+
});
|
|
471
|
+
_defineProperty(_assertThisInitialized(_this), "getDataSource", function (items, cols) {
|
|
472
|
+
return _mapInstanceProperty(items).call(items, function (item, index) {
|
|
473
|
+
return _reduceInstanceProperty(cols).call(cols, function (result, _ref13) {
|
|
474
|
+
var key = _ref13.key,
|
|
475
|
+
options = _ref13.options,
|
|
476
|
+
link = _ref13.link,
|
|
477
|
+
icon = _ref13.icon,
|
|
478
|
+
dataSource = _ref13.dataSource;
|
|
479
|
+
if (link) {
|
|
480
|
+
if (typeof link === 'boolean') {
|
|
481
|
+
result[key] = _this.link(key, index, item, _this.getText(item[key], options));
|
|
482
|
+
}
|
|
483
|
+
} else if (icon) {
|
|
484
|
+
var _context8;
|
|
485
|
+
//单独的icon列,icon=true数据值根据options获得显示的图片url
|
|
486
|
+
var src = _this.getImgSrc(item[key], options);
|
|
487
|
+
var onClick = _bindInstanceProperty(_context8 = _this.onLink).call(_context8, null, key, index, item);
|
|
488
|
+
result[key] = src ? /*#__PURE__*/React.createElement("img", {
|
|
489
|
+
src: src,
|
|
490
|
+
onClick: onClick
|
|
491
|
+
}) : '';
|
|
492
|
+
} else if (dataSource) {
|
|
493
|
+
result[key] = _this.getSourceText(item, key, options, dataSource);
|
|
494
|
+
} else {
|
|
495
|
+
result[key] = _this.getText(item[key], options);
|
|
496
|
+
}
|
|
497
|
+
return result;
|
|
498
|
+
}, {
|
|
499
|
+
key: index,
|
|
500
|
+
checked: !!item.checked
|
|
501
|
+
});
|
|
502
|
+
});
|
|
503
|
+
});
|
|
504
|
+
_defineProperty(_assertThisInitialized(_this), "getPropsByCheckbox", function (items) {
|
|
505
|
+
var _this$props6 = _this.props,
|
|
506
|
+
_this$props6$checkbox = _this$props6.checkbox,
|
|
507
|
+
checkbox = _this$props6$checkbox === void 0 ? true : _this$props6$checkbox,
|
|
508
|
+
_this$props6$radio = _this$props6.radio,
|
|
509
|
+
radio = _this$props6$radio === void 0 ? false : _this$props6$radio,
|
|
510
|
+
isolation = _this$props6.isolation,
|
|
511
|
+
_this$props6$checkedR = _this$props6.checkedRows,
|
|
512
|
+
checkedRows = _this$props6$checkedR === void 0 ? [] : _this$props6$checkedR,
|
|
513
|
+
_this$props6$isEmphas = _this$props6.isEmphasized,
|
|
514
|
+
isEmphasized = _this$props6$isEmphas === void 0 ? false : _this$props6$isEmphas,
|
|
515
|
+
_this$props6$isWeaken = _this$props6.isWeaken,
|
|
516
|
+
isWeaken = _this$props6$isWeaken === void 0 ? true : _this$props6$isWeaken;
|
|
517
|
+
var rowClassName1 = function rowClassName1(record) {
|
|
518
|
+
if (items[record.key].__total) return variables('SuperTable').totalRow;
|
|
519
|
+
if (items[record.key].__warningRow) return variables('SuperTable').warningRow;
|
|
520
|
+
return _includesInstanceProperty(checkedRows).call(checkedRows, record.key) ? variables('SuperTable').select : '';
|
|
521
|
+
};
|
|
522
|
+
var rowClassName2 = function rowClassName2(record) {
|
|
523
|
+
if (items[record.key].__total) return variables('SuperTable').totalRow;
|
|
524
|
+
if (items[record.key].__warningRow) return variables('SuperTable').warningRow;
|
|
525
|
+
if (isEmphasized && items[record.key].__isEmphasized) {
|
|
526
|
+
return items[record.key].checked ? variables('SuperTable').emphasizedSelectRow : variables('SuperTable').emphasizedUnselectRow;
|
|
527
|
+
}
|
|
528
|
+
if (isWeaken && items[record.key].__isWeaken) {
|
|
529
|
+
return items[record.key].checked ? variables('SuperTable').weakenedSelectRow : variables('SuperTable').weakenedUnselectRow;
|
|
530
|
+
}
|
|
531
|
+
return items[record.key].checked ? variables('SuperTable').select : '';
|
|
532
|
+
};
|
|
533
|
+
if (checkbox) {
|
|
534
|
+
if (radio) {
|
|
535
|
+
return {
|
|
536
|
+
rowClassName: rowClassName1,
|
|
537
|
+
onRowClick: _this.onRadioRowClick,
|
|
538
|
+
rowSelection: {
|
|
539
|
+
type: 'radio',
|
|
540
|
+
selectedRowKeys: checkedRows,
|
|
541
|
+
onChange: _this.onRadioChange
|
|
542
|
+
}
|
|
543
|
+
};
|
|
544
|
+
} else if (isolation) {
|
|
545
|
+
return {
|
|
546
|
+
rowClassName: rowClassName1,
|
|
547
|
+
onRowClick: _this.onRowClick,
|
|
548
|
+
rowSelection: {
|
|
549
|
+
selectedRowKeys: checkedRows,
|
|
550
|
+
onChange: _this.onCheckChange,
|
|
551
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
552
|
+
var checked = _includesInstanceProperty(checkedRows).call(checkedRows, record.key);
|
|
553
|
+
return {
|
|
554
|
+
checked: checked,
|
|
555
|
+
disabled: items[record.key].__isWeaken,
|
|
556
|
+
style: items[record.key].__total ? {
|
|
557
|
+
display: 'none'
|
|
558
|
+
} : {}
|
|
559
|
+
};
|
|
560
|
+
}
|
|
561
|
+
}
|
|
562
|
+
};
|
|
563
|
+
} else {
|
|
564
|
+
return {
|
|
565
|
+
rowClassName: rowClassName2,
|
|
566
|
+
onRowClick: _this.onRowClick,
|
|
567
|
+
rowSelection: {
|
|
568
|
+
selectedRowKeys: _this.getSelectedRowKeys(items),
|
|
569
|
+
onChange: _this.onChange,
|
|
570
|
+
getCheckboxProps: function getCheckboxProps(record) {
|
|
571
|
+
var checked = isWeaken && items[record.key].__isWeaken ? false : !!record.checked;
|
|
572
|
+
return {
|
|
573
|
+
checked: checked,
|
|
574
|
+
disabled: items[record.key].__isWeaken,
|
|
575
|
+
style: items[record.key].__total ? {
|
|
576
|
+
display: 'none'
|
|
577
|
+
} : {}
|
|
578
|
+
};
|
|
579
|
+
}
|
|
580
|
+
}
|
|
581
|
+
};
|
|
582
|
+
}
|
|
583
|
+
} else {
|
|
584
|
+
return {
|
|
585
|
+
rowClassName: rowClassName2
|
|
586
|
+
};
|
|
587
|
+
}
|
|
588
|
+
});
|
|
589
|
+
_defineProperty(_assertThisInitialized(_this), "getRowProps", function (onRowClick) {
|
|
590
|
+
return function (record) {
|
|
591
|
+
return {
|
|
592
|
+
onClick: function onClick() {
|
|
593
|
+
return onRowClick && onRowClick(record);
|
|
594
|
+
},
|
|
595
|
+
onDoubleClick: function onDoubleClick() {
|
|
596
|
+
return _this.onDoubleClick(record);
|
|
597
|
+
}
|
|
598
|
+
};
|
|
599
|
+
};
|
|
600
|
+
});
|
|
601
|
+
_defineProperty(_assertThisInitialized(_this), "getRowPropsForDrag", function () {
|
|
602
|
+
return function (record, index) {
|
|
603
|
+
return {
|
|
604
|
+
index: index,
|
|
605
|
+
onMoveRow: _this.onMoveRow
|
|
606
|
+
};
|
|
607
|
+
};
|
|
608
|
+
});
|
|
609
|
+
_defineProperty(_assertThisInitialized(_this), "getItems", function () {
|
|
610
|
+
var _this$props7 = _this.props,
|
|
611
|
+
items = _this$props7.items,
|
|
612
|
+
cols = _this$props7.cols,
|
|
613
|
+
_this$props7$dragSort = _this$props7.dragSort,
|
|
614
|
+
dragSort = _this$props7$dragSort === void 0 ? false : _this$props7$dragSort,
|
|
615
|
+
_this$props7$pageTota = _this$props7.pageTotal,
|
|
616
|
+
pageTotal = _this$props7$pageTota === void 0 ? false : _this$props7$pageTota,
|
|
617
|
+
searchTotal = _this$props7.searchTotal;
|
|
618
|
+
var resItems = items;
|
|
619
|
+
if (!dragSort && items.length > 1) {
|
|
620
|
+
if (pageTotal || searchTotal) {
|
|
621
|
+
var totalItem = _reduceInstanceProperty(cols).call(cols, function (result, _ref14) {
|
|
622
|
+
var key = _ref14.key,
|
|
623
|
+
_ref14$total = _ref14.total,
|
|
624
|
+
total = _ref14$total === void 0 ? false : _ref14$total;
|
|
625
|
+
if (total) {
|
|
626
|
+
result[key] = _parseFloat(Number(_reduceInstanceProperty(items).call(items, function (result, item) {
|
|
627
|
+
return _parseFloat(String(item[key] || 0)) + result;
|
|
628
|
+
}, 0)).toFixed(4));
|
|
629
|
+
}
|
|
630
|
+
return result;
|
|
631
|
+
}, {
|
|
632
|
+
__total: true,
|
|
633
|
+
__totalIndexTitle: '本页汇总'
|
|
634
|
+
});
|
|
635
|
+
resItems = _concatInstanceProperty(resItems).call(resItems, [totalItem]);
|
|
636
|
+
}
|
|
637
|
+
if (searchTotal) {
|
|
638
|
+
resItems = _concatInstanceProperty(resItems).call(resItems, [_objectSpread(_objectSpread({}, searchTotal), {}, {
|
|
639
|
+
__total: true,
|
|
640
|
+
__totalIndexTitle: '查询汇总'
|
|
641
|
+
})]);
|
|
642
|
+
}
|
|
643
|
+
}
|
|
644
|
+
return resItems;
|
|
645
|
+
});
|
|
646
|
+
_defineProperty(_assertThisInitialized(_this), "toTotalFooter", function () {
|
|
647
|
+
var _this$props8 = _this.props,
|
|
648
|
+
cols = _this$props8.cols,
|
|
649
|
+
items = _this$props8.items,
|
|
650
|
+
isolation = _this$props8.isolation,
|
|
651
|
+
checkedRows = _this$props8.checkedRows;
|
|
652
|
+
var totalCols = _filterInstanceProperty(cols).call(cols, function (item) {
|
|
653
|
+
return item.total;
|
|
654
|
+
});
|
|
655
|
+
if (totalCols.length > 0) {
|
|
656
|
+
var checkedItems = isolation ? _filterInstanceProperty(items).call(items, function (item, index) {
|
|
657
|
+
return _includesInstanceProperty(checkedRows).call(checkedRows, index);
|
|
658
|
+
}) : _filterInstanceProperty(items).call(items, function (item) {
|
|
659
|
+
return item.checked;
|
|
660
|
+
});
|
|
661
|
+
var countItems = checkedItems.length ? checkedItems : items;
|
|
662
|
+
var totalItems = _mapInstanceProperty(totalCols).call(totalCols, function (_ref15) {
|
|
663
|
+
var title = _ref15.title,
|
|
664
|
+
key = _ref15.key,
|
|
665
|
+
_ref15$props = _ref15.props,
|
|
666
|
+
props = _ref15$props === void 0 ? {} : _ref15$props;
|
|
667
|
+
var value = _reduceInstanceProperty(countItems).call(countItems, function (result, item) {
|
|
668
|
+
return _parseFloat((result + Number(item[key] || 0)).toFixed(props.precision || 6));
|
|
669
|
+
}, 0);
|
|
670
|
+
return {
|
|
671
|
+
title: title,
|
|
672
|
+
value: value
|
|
673
|
+
};
|
|
674
|
+
});
|
|
675
|
+
return /*#__PURE__*/React.createElement("div", {
|
|
676
|
+
style: {
|
|
677
|
+
height: '36px',
|
|
678
|
+
lineHeight: '36px'
|
|
679
|
+
}
|
|
680
|
+
}, /*#__PURE__*/React.createElement("span", {
|
|
681
|
+
style: {
|
|
682
|
+
marginRight: "15px"
|
|
683
|
+
}
|
|
684
|
+
}, checkedItems.length ? '【当页勾选汇总】' : '【当页汇总】'), _mapInstanceProperty(totalItems).call(totalItems, function (_ref16, index) {
|
|
685
|
+
var title = _ref16.title,
|
|
686
|
+
value = _ref16.value;
|
|
687
|
+
return /*#__PURE__*/React.createElement("span", {
|
|
688
|
+
key: index,
|
|
689
|
+
style: {
|
|
690
|
+
marginRight: "10px"
|
|
691
|
+
}
|
|
692
|
+
}, /*#__PURE__*/React.createElement("span", null, title, ": "), /*#__PURE__*/React.createElement("span", {
|
|
693
|
+
style: {
|
|
694
|
+
color: '#01a4ff'
|
|
695
|
+
}
|
|
696
|
+
}, value));
|
|
697
|
+
}));
|
|
698
|
+
} else {
|
|
699
|
+
return null;
|
|
700
|
+
}
|
|
701
|
+
});
|
|
702
|
+
_defineProperty(_assertThisInitialized(_this), "getProps", function () {
|
|
703
|
+
var _this$props9 = _this.props,
|
|
704
|
+
cols = _this$props9.cols,
|
|
705
|
+
_this$props9$isPaging = _this$props9.isPaging,
|
|
706
|
+
isPaging = _this$props9$isPaging === void 0 ? false : _this$props9$isPaging,
|
|
707
|
+
_this$props9$isEmphas = _this$props9.isEmphasized,
|
|
708
|
+
isEmphasized = _this$props9$isEmphas === void 0 ? false : _this$props9$isEmphas,
|
|
709
|
+
_this$props9$isWeaken = _this$props9.isWeaken,
|
|
710
|
+
isWeaken = _this$props9$isWeaken === void 0 ? false : _this$props9$isWeaken,
|
|
711
|
+
dragSort = _this$props9.dragSort,
|
|
712
|
+
_this$props9$footer = _this$props9.footer,
|
|
713
|
+
footer = _this$props9$footer === void 0 ? null : _this$props9$footer;
|
|
714
|
+
var items = _this.getItems();
|
|
715
|
+
var _this$getPropsByCheck = _this.getPropsByCheckbox(items),
|
|
716
|
+
onRowClick = _this$getPropsByCheck.onRowClick,
|
|
717
|
+
extraProps = _objectWithoutProperties(_this$getPropsByCheck, _excluded);
|
|
718
|
+
var renderProps = _objectSpread({
|
|
719
|
+
className: !isEmphasized || !isWeaken ? variables('SuperTable') : variables('SuperTable').noTransition,
|
|
720
|
+
columns: _this.getColumns(cols, items),
|
|
721
|
+
dataSource: _this.getDataSource(items, cols),
|
|
722
|
+
size: 'small',
|
|
723
|
+
pagination: isPaging,
|
|
724
|
+
scroll: {
|
|
725
|
+
x: true
|
|
726
|
+
},
|
|
727
|
+
onChange: _this.onTableChange,
|
|
728
|
+
onRow: dragSort ? _this.getRowPropsForDrag() : _this.getRowProps(onRowClick),
|
|
729
|
+
components: dragSort ? {
|
|
730
|
+
body: {
|
|
731
|
+
row: DragSortRow
|
|
732
|
+
}
|
|
733
|
+
} : {},
|
|
734
|
+
footer: footer ? footer : _this.toTotalFooter
|
|
735
|
+
}, extraProps);
|
|
736
|
+
return renderProps;
|
|
737
|
+
});
|
|
738
|
+
_defineProperty(_assertThisInitialized(_this), "setScroll", function () {
|
|
739
|
+
var _this$props10 = _this.props,
|
|
740
|
+
maxHeight = _this$props10.maxHeight,
|
|
741
|
+
pageTotal = _this$props10.pageTotal,
|
|
742
|
+
searchTotal = _this$props10.searchTotal;
|
|
743
|
+
if (maxHeight && _this.getItems().length) {
|
|
744
|
+
var root = ReactDOM.findDOMNode(_assertThisInitialized(_this));
|
|
745
|
+
var container = root.getElementsByClassName('ant-table-body')[0];
|
|
746
|
+
var header = root.getElementsByClassName('ant-table-thead')[0];
|
|
747
|
+
var tbody = root.getElementsByClassName('ant-table-tbody')[0];
|
|
748
|
+
var pageTotalOffset = searchTotal ? 2 : 1;
|
|
749
|
+
var pageTotalElement = pageTotal && tbody && tbody.children ? tbody.children[tbody.children.length - pageTotalOffset] : null;
|
|
750
|
+
var searchTotalElement = searchTotal && tbody && tbody.children ? tbody.children[tbody.children.length - 1] : null;
|
|
751
|
+
fixed(container, header, maxHeight, {
|
|
752
|
+
pageTotalElement: pageTotalElement,
|
|
753
|
+
searchTotalElement: searchTotalElement
|
|
754
|
+
});
|
|
755
|
+
}
|
|
756
|
+
});
|
|
757
|
+
return _this;
|
|
758
|
+
}
|
|
759
|
+
_createClass(SuperTable, [{
|
|
760
|
+
key: "shouldComponentUpdate",
|
|
761
|
+
value: function shouldComponentUpdate(props, state) {
|
|
762
|
+
var _this2 = this;
|
|
763
|
+
var keys = ['cols', 'items', 'maxHeight', 'checkedRows', 'sortInfo', 'filterInfo'];
|
|
764
|
+
return _someInstanceProperty(keys).call(keys, function (key) {
|
|
765
|
+
return props[key] !== _this2.props[key];
|
|
766
|
+
}) || state.filterVisibleKey !== this.state.filterVisibleKey;
|
|
767
|
+
}
|
|
768
|
+
}, {
|
|
769
|
+
key: "componentDidMount",
|
|
770
|
+
value: function componentDidMount() {
|
|
771
|
+
this.setScroll();
|
|
772
|
+
}
|
|
773
|
+
}, {
|
|
774
|
+
key: "componentDidUpdate",
|
|
775
|
+
value: function componentDidUpdate() {
|
|
776
|
+
this.setScroll();
|
|
777
|
+
}
|
|
778
|
+
}, {
|
|
779
|
+
key: "render",
|
|
780
|
+
value: function render() {
|
|
781
|
+
return /*#__PURE__*/React.createElement(_Table, _extends({}, this.getProps(), {
|
|
782
|
+
key: this.props.items.length
|
|
783
|
+
}));
|
|
784
|
+
}
|
|
785
|
+
}]);
|
|
786
|
+
return SuperTable;
|
|
787
|
+
}(React.Component);
|
|
788
|
+
_defineProperty(SuperTable, "propTypes", {
|
|
789
|
+
cols: PropTypes.arrayOf(PropTypes.shape(ColType)).isRequired,
|
|
790
|
+
items: PropTypes.arrayOf(PropTypes.shape(ItemType)).isRequired,
|
|
791
|
+
isPaging: PropTypes.bool,
|
|
792
|
+
checkbox: PropTypes.bool,
|
|
793
|
+
radio: PropTypes.bool,
|
|
794
|
+
isolation: PropTypes.bool,
|
|
795
|
+
checkedRows: PropTypes.array,
|
|
796
|
+
index: PropTypes.bool,
|
|
797
|
+
indexTitle: PropTypes.string,
|
|
798
|
+
sortInfo: PropTypes.object,
|
|
799
|
+
filterInfo: PropTypes.object,
|
|
800
|
+
maxHeight: PropTypes.string,
|
|
801
|
+
callback: PropTypes.shape(CallbackType),
|
|
802
|
+
isEmphasized: PropTypes.bool,
|
|
803
|
+
isWeaken: PropTypes.bool,
|
|
804
|
+
dragSort: PropTypes.bool,
|
|
805
|
+
pageTotal: PropTypes.bool,
|
|
806
|
+
searchTotal: PropTypes.object
|
|
807
|
+
});
|
|
808
|
+
export default SuperTable;
|