cloud-b2b 1.0.0 → 1.0.3

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.
Files changed (208) hide show
  1. package/es/Area/Area.js +166 -0
  2. package/es/Area/package.json +6 -0
  3. package/es/Card/Card.js +20 -0
  4. package/es/Card/package.json +6 -0
  5. package/es/Control/Control.js +428 -0
  6. package/es/Control/event.js +57 -0
  7. package/es/Control/package.json +6 -0
  8. package/es/Enhance/Dialogs.js +67 -0
  9. package/es/Enhance/Loading.js +151 -0
  10. package/es/Enhance/index.js +8 -0
  11. package/es/Enhance/package.json +6 -0
  12. package/es/Header/Header.js +194 -0
  13. package/es/Header/Header.less +95 -0
  14. package/es/Header/Vertical.js +129 -0
  15. package/es/Header/Vertical.less +60 -0
  16. package/es/Header/package.json +6 -0
  17. package/es/HomeHeader/Header.js +75 -0
  18. package/es/HomeHeader/Header.less +73 -0
  19. package/es/HomeHeader/package.json +6 -0
  20. package/es/ImageView/ImageView.js +117 -0
  21. package/es/ImageView/ImageView.less +14 -0
  22. package/es/ImageView/package.json +6 -0
  23. package/es/InpurCascader/InputCascader.js +135 -0
  24. package/es/InpurCascader/package.json +6 -0
  25. package/es/InputEditor/InputEditor.js +118 -0
  26. package/es/InputEditor/inputEditor.less +8 -0
  27. package/es/InputEditor/package.json +6 -0
  28. package/es/InputSearch/InputSearch.js +306 -0
  29. package/es/InputSearch/package.json +6 -0
  30. package/es/InputSelect/InputSelect.js +185 -0
  31. package/es/InputSelect/package.json +6 -0
  32. package/es/InputWriting/InputWriting.js +107 -0
  33. package/es/InputWriting/package.json +6 -0
  34. package/es/Layout/Layout.js +232 -0
  35. package/es/Layout/Layout.less +28 -0
  36. package/es/Layout/package.json +6 -0
  37. package/es/LayoutLink/LayoutLink.js +82 -0
  38. package/es/LayoutLink/LayoutLink.less +53 -0
  39. package/es/LayoutLink/package.json +6 -0
  40. package/es/Link/Link.js +108 -0
  41. package/es/Link/package.json +6 -0
  42. package/es/Loading/Loading.js +15 -0
  43. package/es/Loading/Loading.less +13 -0
  44. package/es/Loading/package.json +6 -0
  45. package/es/Loading2/Loading2.js +11 -0
  46. package/es/Loading2/Loading2.less +19 -0
  47. package/es/Loading2/package.json +6 -0
  48. package/es/ModalWithDrag/ModalWithDrag.js +34 -0
  49. package/es/ModalWithDrag/ModalWithDrag.less +6 -0
  50. package/es/ModalWithDrag/drag.js +133 -0
  51. package/es/ModalWithDrag/package.json +6 -0
  52. package/es/NumberInput/NumberInput.js +237 -0
  53. package/es/NumberInput/package.json +6 -0
  54. package/es/Search/Search.js +581 -0
  55. package/es/Search/Search.less +63 -0
  56. package/es/Search/package.json +6 -0
  57. package/es/Sidebar/Sidebar.js +165 -0
  58. package/es/Sidebar/Sidebar.less +78 -0
  59. package/es/Sidebar/package.json +6 -0
  60. package/es/Sidebar2/Sidebar.js +192 -0
  61. package/es/Sidebar2/Sidebar.less +153 -0
  62. package/es/Sidebar2/package.json +6 -0
  63. package/es/SuperForm/SuperForm.js +688 -0
  64. package/es/SuperForm/SuperForm.less +52 -0
  65. package/es/SuperForm/package.json +6 -0
  66. package/es/SuperIcon/SuperIcon.js +30 -0
  67. package/es/SuperIcon/package.json +6 -0
  68. package/es/SuperPagination/SuperPagination.js +126 -0
  69. package/es/SuperPagination/package.json +6 -0
  70. package/es/SuperTable/DragSortRow.js +125 -0
  71. package/es/SuperTable/DragSortRow.less +17 -0
  72. package/es/SuperTable/FilterDropDown.js +188 -0
  73. package/es/SuperTable/FilterDropDown.less +30 -0
  74. package/es/SuperTable/SuperTable.js +933 -0
  75. package/es/SuperTable/SuperTable.less +135 -0
  76. package/es/SuperTable/fixed.js +42 -0
  77. package/es/SuperTable/package.json +6 -0
  78. package/es/SuperTable2/SuperTable2.js +700 -0
  79. package/es/SuperTable2/SuperTable2.less +100 -0
  80. package/es/SuperTable2/SuperTableCell.js +215 -0
  81. package/es/SuperTable2/package.json +6 -0
  82. package/es/SuperToolbar/SuperToolbar.js +223 -0
  83. package/es/SuperToolbar/SuperToolbar.less +17 -0
  84. package/es/SuperToolbar/package.json +6 -0
  85. package/es/SuperUpload/SuperUpload.js +282 -0
  86. package/es/SuperUpload/SuperUpload.less +27 -0
  87. package/es/SuperUpload/package.json +6 -0
  88. package/es/Title/Title.less +35 -35
  89. package/es/Title/package.json +6 -6
  90. package/es/Viewer/ImageViews.js +311 -0
  91. package/es/Viewer/Viewer.js +149 -0
  92. package/es/Viewer/Viewer.less +67 -0
  93. package/es/Viewer/imgView.less +59 -0
  94. package/es/Viewer/package.json +7 -0
  95. package/es/WingBlank/WingBlank.js +20 -0
  96. package/es/WingBlank/WingBlank.less +12 -0
  97. package/es/WingBlank/package.json +6 -0
  98. package/es/adjust.less +89 -0
  99. package/es/helper.js +118 -0
  100. package/es/history.js +5 -0
  101. package/es/index.js +27 -1
  102. package/es/style.less +20 -1
  103. package/es/variables.less +73 -73
  104. package/lib/Area/Area.js +194 -0
  105. package/lib/Area/package.json +6 -0
  106. package/lib/Card/Card.js +38 -0
  107. package/lib/Card/package.json +6 -0
  108. package/lib/Control/Control.js +477 -0
  109. package/lib/Control/event.js +68 -0
  110. package/lib/Control/package.json +6 -0
  111. package/lib/Enhance/Dialogs.js +87 -0
  112. package/lib/Enhance/Loading.js +175 -0
  113. package/lib/Enhance/index.js +35 -0
  114. package/lib/Enhance/package.json +6 -0
  115. package/lib/Header/Header.js +215 -0
  116. package/lib/Header/Header.less +95 -0
  117. package/lib/Header/Vertical.js +150 -0
  118. package/lib/Header/Vertical.less +60 -0
  119. package/lib/Header/package.json +6 -0
  120. package/lib/HomeHeader/Header.js +95 -0
  121. package/lib/HomeHeader/Header.less +73 -0
  122. package/lib/HomeHeader/package.json +6 -0
  123. package/lib/ImageView/ImageView.js +134 -0
  124. package/lib/ImageView/ImageView.less +14 -0
  125. package/lib/ImageView/package.json +6 -0
  126. package/lib/InpurCascader/InputCascader.js +156 -0
  127. package/lib/InpurCascader/package.json +6 -0
  128. package/lib/InputEditor/InputEditor.js +136 -0
  129. package/lib/InputEditor/inputEditor.less +8 -0
  130. package/lib/InputEditor/package.json +6 -0
  131. package/lib/InputSearch/InputSearch.js +322 -0
  132. package/lib/InputSearch/package.json +6 -0
  133. package/lib/InputSelect/InputSelect.js +208 -0
  134. package/lib/InputSelect/package.json +6 -0
  135. package/lib/InputWriting/InputWriting.js +123 -0
  136. package/lib/InputWriting/package.json +6 -0
  137. package/lib/Layout/Layout.js +258 -0
  138. package/lib/Layout/Layout.less +28 -0
  139. package/lib/Layout/package.json +6 -0
  140. package/lib/LayoutLink/LayoutLink.js +114 -0
  141. package/lib/LayoutLink/LayoutLink.less +53 -0
  142. package/lib/LayoutLink/package.json +6 -0
  143. package/lib/Link/Link.js +130 -0
  144. package/lib/Link/package.json +6 -0
  145. package/lib/Loading/Loading.js +30 -0
  146. package/lib/Loading/Loading.less +13 -0
  147. package/lib/Loading/package.json +6 -0
  148. package/lib/Loading2/Loading2.js +26 -0
  149. package/lib/Loading2/Loading2.less +19 -0
  150. package/lib/Loading2/package.json +6 -0
  151. package/lib/ModalWithDrag/ModalWithDrag.js +53 -0
  152. package/lib/ModalWithDrag/ModalWithDrag.less +6 -0
  153. package/lib/ModalWithDrag/drag.js +147 -0
  154. package/lib/ModalWithDrag/package.json +6 -0
  155. package/lib/NumberInput/NumberInput.js +259 -0
  156. package/lib/NumberInput/package.json +6 -0
  157. package/lib/Search/Search.js +603 -0
  158. package/lib/Search/Search.less +63 -0
  159. package/lib/Search/package.json +6 -0
  160. package/lib/Sidebar/Sidebar.js +186 -0
  161. package/lib/Sidebar/Sidebar.less +78 -0
  162. package/lib/Sidebar/package.json +6 -0
  163. package/lib/Sidebar2/Sidebar.js +213 -0
  164. package/lib/Sidebar2/Sidebar.less +153 -0
  165. package/lib/Sidebar2/package.json +6 -0
  166. package/lib/SuperForm/SuperForm.js +702 -0
  167. package/lib/SuperForm/SuperForm.less +52 -0
  168. package/lib/SuperForm/package.json +6 -0
  169. package/lib/SuperIcon/SuperIcon.js +47 -0
  170. package/lib/SuperIcon/package.json +6 -0
  171. package/lib/SuperPagination/SuperPagination.js +145 -0
  172. package/lib/SuperPagination/package.json +6 -0
  173. package/lib/SuperTable/DragSortRow.js +142 -0
  174. package/lib/SuperTable/DragSortRow.less +17 -0
  175. package/lib/SuperTable/FilterDropDown.js +205 -0
  176. package/lib/SuperTable/FilterDropDown.less +30 -0
  177. package/lib/SuperTable/SuperTable.js +937 -0
  178. package/lib/SuperTable/SuperTable.less +135 -0
  179. package/lib/SuperTable/fixed.js +55 -0
  180. package/lib/SuperTable/package.json +6 -0
  181. package/lib/SuperTable2/SuperTable2.js +725 -0
  182. package/lib/SuperTable2/SuperTable2.less +100 -0
  183. package/lib/SuperTable2/SuperTableCell.js +231 -0
  184. package/lib/SuperTable2/package.json +6 -0
  185. package/lib/SuperToolbar/SuperToolbar.js +248 -0
  186. package/lib/SuperToolbar/SuperToolbar.less +17 -0
  187. package/lib/SuperToolbar/package.json +6 -0
  188. package/lib/SuperUpload/SuperUpload.js +324 -0
  189. package/lib/SuperUpload/SuperUpload.less +27 -0
  190. package/lib/SuperUpload/package.json +6 -0
  191. package/lib/Title/Title.less +35 -35
  192. package/lib/Title/package.json +6 -6
  193. package/lib/Viewer/ImageViews.js +323 -0
  194. package/lib/Viewer/Viewer.js +167 -0
  195. package/lib/Viewer/Viewer.less +67 -0
  196. package/lib/Viewer/imgView.less +59 -0
  197. package/lib/Viewer/package.json +7 -0
  198. package/lib/WingBlank/WingBlank.js +37 -0
  199. package/lib/WingBlank/WingBlank.less +12 -0
  200. package/lib/WingBlank/package.json +6 -0
  201. package/lib/adjust.less +89 -0
  202. package/lib/helper.js +147 -0
  203. package/lib/history.js +18 -0
  204. package/lib/index.js +235 -1
  205. package/lib/index.less +25 -1
  206. package/lib/style.less +20 -1
  207. package/lib/variables.less +73 -73
  208. package/package.json +3 -2
@@ -0,0 +1,725 @@
1
+ "use strict";
2
+
3
+ var _Reflect$construct = require("@babel/runtime-corejs3/core-js-stable/reflect/construct");
4
+
5
+ var _Object$keys = require("@babel/runtime-corejs3/core-js-stable/object/keys");
6
+
7
+ var _Object$getOwnPropertySymbols = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-symbols");
8
+
9
+ var _filterInstanceProperty2 = require("@babel/runtime-corejs3/core-js-stable/instance/filter");
10
+
11
+ var _Object$getOwnPropertyDescriptor = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptor");
12
+
13
+ var _forEachInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/for-each");
14
+
15
+ var _Object$getOwnPropertyDescriptors = require("@babel/runtime-corejs3/core-js-stable/object/get-own-property-descriptors");
16
+
17
+ var _Object$defineProperties = require("@babel/runtime-corejs3/core-js-stable/object/define-properties");
18
+
19
+ var _Object$defineProperty = require("@babel/runtime-corejs3/core-js-stable/object/define-property");
20
+
21
+ var _sliceInstanceProperty = require("@babel/runtime-corejs3/core-js-stable/instance/slice");
22
+
23
+ var _Array$from = require("@babel/runtime-corejs3/core-js-stable/array/from");
24
+
25
+ var _Symbol = require("@babel/runtime-corejs3/core-js-stable/symbol");
26
+
27
+ var _getIteratorMethod = require("@babel/runtime-corejs3/core-js/get-iterator-method");
28
+
29
+ var _Array$isArray2 = require("@babel/runtime-corejs3/core-js-stable/array/is-array");
30
+
31
+ var _interopRequireDefault = require("@babel/runtime-corejs3/helpers/interopRequireDefault");
32
+
33
+ _Object$defineProperty(exports, "__esModule", {
34
+ value: true
35
+ });
36
+
37
+ exports["default"] = void 0;
38
+
39
+ var _concat = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/concat"));
40
+
41
+ var _isArray = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/array/is-array"));
42
+
43
+ var _includes = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/includes"));
44
+
45
+ var _map = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/map"));
46
+
47
+ var _bind = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/bind"));
48
+
49
+ var _filter = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/filter"));
50
+
51
+ var _reduce = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/instance/reduce"));
52
+
53
+ var _assign = _interopRequireDefault(require("@babel/runtime-corejs3/core-js-stable/object/assign"));
54
+
55
+ var _table = _interopRequireDefault(require("antd/lib/table"));
56
+
57
+ var _extends2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/extends"));
58
+
59
+ var _switch = _interopRequireDefault(require("antd/lib/switch"));
60
+
61
+ var _button = _interopRequireDefault(require("antd/lib/button"));
62
+
63
+ var _checkbox = _interopRequireDefault(require("antd/lib/checkbox"));
64
+
65
+ var _icon = _interopRequireDefault(require("antd/lib/icon"));
66
+
67
+ var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/classCallCheck"));
68
+
69
+ var _createClass2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/createClass"));
70
+
71
+ var _assertThisInitialized2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/assertThisInitialized"));
72
+
73
+ var _inherits2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/inherits"));
74
+
75
+ var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/possibleConstructorReturn"));
76
+
77
+ var _getPrototypeOf2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/getPrototypeOf"));
78
+
79
+ var _defineProperty2 = _interopRequireDefault(require("@babel/runtime-corejs3/helpers/defineProperty"));
80
+
81
+ var _react = _interopRequireDefault(require("react"));
82
+
83
+ var _propTypes = _interopRequireDefault(require("prop-types"));
84
+
85
+ var _reactDom = _interopRequireDefault(require("react-dom"));
86
+
87
+ var _Control = require("../Control");
88
+
89
+ var _SuperTableCell = _interopRequireDefault(require("./SuperTableCell"));
90
+
91
+ var _fixed = _interopRequireDefault(require("../SuperTable/fixed"));
92
+
93
+ var _SuperToolbar = _interopRequireDefault(require("../SuperToolbar"));
94
+
95
+ var _variables = _interopRequireDefault(require("../variables"));
96
+
97
+ 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
+
99
+ function _unsupportedIterableToArray(o, minLen) { var _context12; if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = _sliceInstanceProperty(_context12 = Object.prototype.toString.call(o)).call(_context12, 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
+
101
+ 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
+
103
+ 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
+
105
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var _context10, _context11; var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? _forEachInstanceProperty(_context10 = ownKeys(Object(source), !0)).call(_context10, function (key) { (0, _defineProperty2["default"])(target, key, source[key]); }) : _Object$getOwnPropertyDescriptors ? _Object$defineProperties(target, _Object$getOwnPropertyDescriptors(source)) : _forEachInstanceProperty(_context11 = ownKeys(Object(source))).call(_context11, function (key) { _Object$defineProperty(target, key, _Object$getOwnPropertyDescriptor(source, key)); }); } return target; }
106
+
107
+ 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
+
109
+ 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; } }
110
+
111
+ var TypeEnum = ['readonly', 'index', 'checkbox', 'text', 'number', 'select', //存储value
112
+ 'selectText', //存储title
113
+ 'search', 'searchText', 'selectSearch', //多选下拉搜索
114
+ 'date', 'button', 'custom', 'switch', 'textArea', 'link', 'toolbar', //按钮组
115
+ 'img' //图片标题组 value为{src,title}时显示图片标题 为字符串时 只显示图片
116
+ ];
117
+ /**
118
+ * key:标识所在列,在一个表格中必须唯一
119
+ * title:列的标题,type为checkbox时,title为空字符串时,表头才会显示为复选框
120
+ * type:嵌入的表单元素类型
121
+ * link: 是否为超链接,type未设置时,该属性才生效。为true表示内容来至items,为字符串表示超链接内容就是该字符串
122
+ * options: 对象(包含value和title)数组
123
+ * props:传递参数给被嵌入的组件
124
+ * width: 嵌入的组件的宽度,默认值为100
125
+ * align:对齐方式,index默认center,其他类型默认为left
126
+ * showAdd: 表头是否显示+号,默认为false,加号会触发onAdd事件
127
+ * hide: 为true时隐藏该列
128
+ */
129
+
130
+ var ColType = {
131
+ key: _propTypes["default"].string.isRequired,
132
+ title: _propTypes["default"].string.isRequired,
133
+ type: _propTypes["default"].oneOf(TypeEnum),
134
+ link: _propTypes["default"].oneOfType([_propTypes["default"].bool, _propTypes["default"].string]),
135
+ align: _propTypes["default"].oneOf(['left', 'center', 'right']),
136
+ width: _propTypes["default"].number,
137
+ options: _propTypes["default"].array,
138
+ showAdd: _propTypes["default"].any,
139
+ hide: _propTypes["default"].bool,
140
+ props: _propTypes["default"].any
141
+ };
142
+ /**
143
+ * onCheck:点击复选框时触发,原型func(rowIndex, keyName, checked)
144
+ * onContentChange: 输入框内容改变时触发,原型为function(rowIndex, keyName, value)
145
+ * onSearch:search组件输入内容时触发,原型为function(rowIndex, keyName, value)
146
+ * onLink: 点击超链接时触发,原型为function(keyName, rowIndex, item)
147
+ * onAdd:点击+号时触发,原型为function(keyName)
148
+ * onRenderCustom:(废弃)用于渲染type为custom类型的单元格,原型为function(rowIndex, keyName, value,props)
149
+ * onToolbar:点击表格列按钮组时触发,原型为function(按钮组列的key,rowIndex,该行数据的值,按钮key)
150
+ */
151
+
152
+ var CallbackType = {
153
+ onExitValid: _propTypes["default"].func,
154
+ onCheck: _propTypes["default"].func,
155
+ onContentChange: _propTypes["default"].func,
156
+ onSearch: _propTypes["default"].func,
157
+ onLink: _propTypes["default"].func,
158
+ onAdd: _propTypes["default"].func,
159
+ onRenderCustom: _propTypes["default"].func,
160
+ onToolbar: _propTypes["default"].func
161
+ };
162
+ /**
163
+ * base[可选]:序号的开始数字,所有回调函数中的序号值都会加上这个值,默认值为0
164
+ * isEmphasized: [可选],是否强调,行字体加粗显示, 除了isEmphasized设置为true之外,加粗行数据里要设置__isEmphasized为true
165
+ */
166
+
167
+ var SuperTable2 = /*#__PURE__*/function (_React$Component) {
168
+ (0, _inherits2["default"])(SuperTable2, _React$Component);
169
+
170
+ var _super = _createSuper(SuperTable2);
171
+
172
+ function SuperTable2() {
173
+ var _context;
174
+
175
+ var _this;
176
+
177
+ (0, _classCallCheck2["default"])(this, SuperTable2);
178
+
179
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
180
+ args[_key] = arguments[_key];
181
+ }
182
+
183
+ _this = _super.call.apply(_super, (0, _concat["default"])(_context = [this]).call(_context, args));
184
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSwitch", function (key, rowIndex) {
185
+ return function (value) {
186
+ var _ref = _this.props.callback || {},
187
+ onContentChange = _ref.onContentChange;
188
+
189
+ onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
190
+ };
191
+ });
192
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onCheck", function (key, rowIndex) {
193
+ return function (e) {
194
+ var _ref2 = _this.props.callback || {},
195
+ onCheck = _ref2.onCheck;
196
+
197
+ onCheck && onCheck(_this.getIndex(rowIndex), key, e.target.checked);
198
+ };
199
+ });
200
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onChange", function (key, rowIndex) {
201
+ return function (value) {
202
+ var _ref3 = _this.props.callback || {},
203
+ onContentChange = _ref3.onContentChange;
204
+
205
+ _this.closeValid();
206
+
207
+ onContentChange && onContentChange(_this.getIndex(rowIndex), key, value);
208
+ };
209
+ });
210
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onSearch", function (key, rowIndex, config) {
211
+ return function (value) {
212
+ var _ref4 = _this.props.callback || {},
213
+ onSearch = _ref4.onSearch;
214
+
215
+ onSearch && onSearch(_this.getIndex(rowIndex), key, value, config);
216
+ };
217
+ });
218
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onAdd", function (key) {
219
+ return function () {
220
+ var _ref5 = _this.props.callback || {},
221
+ onAdd = _ref5.onAdd;
222
+
223
+ onAdd && onAdd(key);
224
+ };
225
+ });
226
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onRowAdd", function (key, index) {
227
+ return function () {
228
+ var _ref6 = _this.props.callback || {},
229
+ onLink = _ref6.onLink;
230
+
231
+ onLink && onLink(key, index, _this.props.items[index]);
232
+ };
233
+ });
234
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "onBlur", function () {
235
+ _this.closeValid();
236
+ });
237
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "closeValid", function () {
238
+ var _this$props = _this.props,
239
+ valid = _this$props.valid,
240
+ _this$props$callback = _this$props.callback,
241
+ callback = _this$props$callback === void 0 ? {} : _this$props$callback;
242
+ valid && callback.onExitValid();
243
+ });
244
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getOptions", function (key, colOptions, index) {
245
+ var options = _this.props.items[index].options;
246
+ var options2 = _this.props.options;
247
+
248
+ if (options && (0, _isArray["default"])(options[key])) {
249
+ return options[key];
250
+ } else if (options2 && (0, _isArray["default"])(options2[key])) {
251
+ return options2[key];
252
+ } else {
253
+ return colOptions;
254
+ }
255
+ });
256
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "validField", function (required, value) {
257
+ if (!_this.props.valid || _this.error || !required || value) {
258
+ return false;
259
+ } else if (typeof value === 'number') {
260
+ return false;
261
+ } else {
262
+ _this.error = true;
263
+ return true;
264
+ }
265
+ });
266
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderEditableCell", function (config, value, index) {
267
+ var key = config.key,
268
+ type = config.type,
269
+ options = config.options,
270
+ props = config.props,
271
+ required = config.required,
272
+ width = config.width,
273
+ showRowAdd = config.showRowAdd;
274
+
275
+ var _this$props$items$ind = _this.props.items[index],
276
+ readonly = _this$props$items$ind.readonly,
277
+ _this$props$items$ind2 = _this$props$items$ind.isReadonly,
278
+ isReadonly = _this$props$items$ind2 === void 0 ? [] : _this$props$items$ind2,
279
+ _this$props$items$ind3 = _this$props$items$ind.isRequired,
280
+ isRequired = _this$props$items$ind3 === void 0 ? [] : _this$props$items$ind3,
281
+ _this$props$items$ind4 = _this$props$items$ind._extraProps,
282
+ _extraProps = _this$props$items$ind4 === void 0 ? {} : _this$props$items$ind4;
283
+
284
+ var cellProps = {
285
+ value: value,
286
+ width: width,
287
+ type: readonly || (0, _isArray["default"])(isReadonly) && (0, _includes["default"])(isReadonly).call(isReadonly, key) ? 'readonly' : type,
288
+ props: readonly ? {} : props,
289
+ error: _this.validField(required, value),
290
+ options: _this.getOptions(key, options, index),
291
+ onChange: _this.onChange(key, index),
292
+ onSearch: _this.onSearch(key, index, config),
293
+ onBlur: _this.onBlur
294
+ };
295
+
296
+ if (showRowAdd && (0, _isArray["default"])(isRequired) && (0, _includes["default"])(isRequired).call(isRequired, key)) {
297
+ cellProps.error = _this.validField(true, value);
298
+ cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
299
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("span", {
300
+ style: {
301
+ color: 'red',
302
+ display: 'inline-block'
303
+ }
304
+ }, "*"), /*#__PURE__*/_react["default"].createElement("span", {
305
+ style: {
306
+ marginLeft: '5px',
307
+ display: 'inline-block',
308
+ width: 'calc(100% - 12px)'
309
+ }
310
+ }, /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps)), /*#__PURE__*/_react["default"].createElement("span", {
311
+ style: {
312
+ color: '#2196f3',
313
+ verticalAlign: 'super'
314
+ }
315
+ }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
316
+ type: "plus-circle-o",
317
+ role: "add",
318
+ onClick: _this.onRowAdd(key, index)
319
+ })));
320
+ }
321
+
322
+ if ((0, _isArray["default"])(isRequired) && (0, _includes["default"])(isRequired).call(isRequired, key)) {
323
+ cellProps.error = _this.validField(true, value);
324
+ cellProps.props = _objectSpread(_objectSpread({}, cellProps.props), _extraProps);
325
+ return /*#__PURE__*/_react["default"].createElement("div", null, /*#__PURE__*/_react["default"].createElement("span", {
326
+ style: {
327
+ color: 'red',
328
+ display: 'inline-block'
329
+ }
330
+ }, "*"), /*#__PURE__*/_react["default"].createElement("span", {
331
+ style: {
332
+ marginLeft: '5px',
333
+ display: 'inline-block',
334
+ width: 'calc(100% - 12px)'
335
+ }
336
+ }, /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps)));
337
+ }
338
+
339
+ if (showRowAdd) {
340
+ return /*#__PURE__*/_react["default"].createElement("div", {
341
+ style: {
342
+ clear: 'both'
343
+ }
344
+ }, /*#__PURE__*/_react["default"].createElement("span", {
345
+ style: {
346
+ marginRight: '5px',
347
+ "float": 'left'
348
+ }
349
+ }, /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps)), /*#__PURE__*/_react["default"].createElement("span", {
350
+ style: {
351
+ color: '#2196f3',
352
+ verticalAlign: 'middle'
353
+ }
354
+ }, /*#__PURE__*/_react["default"].createElement(_icon["default"], {
355
+ type: "plus-circle-o",
356
+ role: "add",
357
+ onClick: _this.onRowAdd(key, index)
358
+ })));
359
+ }
360
+
361
+ return /*#__PURE__*/_react["default"].createElement(_SuperTableCell["default"], cellProps);
362
+ });
363
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "renderLinkCell", function (col, value, record, index) {
364
+ if (col.link === 'list') {
365
+ var list = value && (0, _isArray["default"])(value) ? value : [];
366
+ return /*#__PURE__*/_react["default"].createElement("div", null, (0, _map["default"])(list).call(list, function (item2, index2) {
367
+ var _context2;
368
+
369
+ var split = index2 === list.length - 1 ? '' : ',';
370
+
371
+ var onClick = function onClick() {
372
+ var _ref7 = _this.props.callback || {},
373
+ onLink = _ref7.onLink;
374
+
375
+ onLink && onLink(col.key, index, item2);
376
+ };
377
+
378
+ return /*#__PURE__*/_react["default"].createElement("a", {
379
+ key: index2,
380
+ onClick: onClick
381
+ }, (0, _concat["default"])(_context2 = "".concat(item2[col.linkTitleKey])).call(_context2, split));
382
+ }));
383
+ } else {
384
+ var title = typeof col.link === 'string' ? col.link : value;
385
+
386
+ var onClick = function onClick() {
387
+ var _ref8 = _this.props.callback || {},
388
+ onLink = _ref8.onLink;
389
+
390
+ onLink && onLink(col.key, index, record);
391
+ };
392
+
393
+ return /*#__PURE__*/_react["default"].createElement("a", {
394
+ onClick: onClick
395
+ }, title);
396
+ }
397
+ });
398
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getIndex", function (index) {
399
+ return (_this.props.base || 0) + index;
400
+ });
401
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCellRender", function (col) {
402
+ return function (value, record, index) {
403
+ var _context3, _context4, _context5;
404
+
405
+ var realType = record._isEdit === true && _this.canReadonly(col.type) ? col.editType : col.type;
406
+
407
+ if (!realType) {
408
+ return /*#__PURE__*/_react["default"].createElement("div", {
409
+ style: {
410
+ maxWidth: "".concat(col.width - 16, "px"),
411
+ overflow: 'hidden',
412
+ textOverflow: 'ellipsis'
413
+ },
414
+ title: value
415
+ }, value);
416
+ }
417
+
418
+ switch (realType) {
419
+ case 'checkbox':
420
+ return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], {
421
+ onChange: _this.onCheck(col.key, record.key),
422
+ checked: value || false
423
+ });
424
+
425
+ case 'index':
426
+ return _this.getIndex(index) + 1;
427
+
428
+ case 'link':
429
+ return _this.renderLinkCell(col, value, record, record.key);
430
+
431
+ case 'button':
432
+ var onClick = _this.props.callback.onLink ? (0, _bind["default"])(_context3 = _this.props.callback.onLink).call(_context3, null, col.key, record.key, record) : undefined;
433
+
434
+ if (col.icon === 'add') {
435
+ return /*#__PURE__*/_react["default"].createElement(_button["default"], {
436
+ onClick: onClick,
437
+ type: "primary",
438
+ shape: "circle",
439
+ size: "small",
440
+ ghost: true,
441
+ icon: "plus"
442
+ });
443
+ } else {
444
+ return /*#__PURE__*/_react["default"].createElement(_button["default"], {
445
+ onClick: onClick,
446
+ size: "small",
447
+ ghost: true,
448
+ type: col.bsStyle
449
+ }, record[col.key] || col.typeRelated);
450
+ }
451
+
452
+ case 'switch':
453
+ return value === 'noneDisplay' ? /*#__PURE__*/_react["default"].createElement("div", null) : /*#__PURE__*/_react["default"].createElement(_switch["default"], {
454
+ checkedChildren: col.props.checkedChildren || '',
455
+ unCheckedChildren: col.props.unCheckedChildren || '',
456
+ onChange: _this.onSwitch(col.key, record.key),
457
+ size: "default",
458
+ checked: value || false,
459
+ disabled: !(record._isEdit === true)
460
+ });
461
+
462
+ case 'custom':
463
+ return _this.props.callback.onRenderCustom(record.key, col.key, value, col.props);
464
+
465
+ case 'toolbar':
466
+ var props = {
467
+ onClick: _this.props.callback.onToolbar ? (0, _bind["default"])(_context4 = _this.props.callback.onToolbar).call(_context4, null, col.key, record.key, record) : undefined,
468
+ buttons: (0, _filter["default"])(_context5 = col.props.buttons).call(_context5, function (item) {
469
+ return item.defaultShow === !record._isEdit;
470
+ })
471
+ };
472
+ return /*#__PURE__*/_react["default"].createElement(_SuperToolbar["default"], props);
473
+
474
+ case 'img':
475
+ return value ? typeof value === 'string' ? /*#__PURE__*/_react["default"].createElement("img", {
476
+ src: value,
477
+ style: {
478
+ maxWidth: '100px'
479
+ }
480
+ }) : /*#__PURE__*/_react["default"].createElement("div", {
481
+ role: 'imgBox'
482
+ }, /*#__PURE__*/_react["default"].createElement("img", {
483
+ src: value.img,
484
+ style: {
485
+ maxWidth: '100px'
486
+ }
487
+ }), /*#__PURE__*/_react["default"].createElement("span", null, value.title)) : /*#__PURE__*/_react["default"].createElement("div", null);
488
+
489
+ default:
490
+ return _this.renderEditableCell(_objectSpread(_objectSpread({}, col), {}, {
491
+ type: realType
492
+ }), value, record.key);
493
+ }
494
+ };
495
+ });
496
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getCheckedStatus", function (key) {
497
+ var has = false,
498
+ not = false;
499
+ var items = _this.props.items;
500
+
501
+ var _iterator = _createForOfIteratorHelper(items),
502
+ _step;
503
+
504
+ try {
505
+ for (_iterator.s(); !(_step = _iterator.n()).done;) {
506
+ var item = _step.value;
507
+ item[key] ? has = true : not = true;
508
+ }
509
+ } catch (err) {
510
+ _iterator.e(err);
511
+ } finally {
512
+ _iterator.f();
513
+ }
514
+
515
+ return {
516
+ checked: has && !not,
517
+ indeterminate: has && not
518
+ };
519
+ });
520
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "toAdd", function (key, showAdd) {
521
+ if (showAdd) {
522
+ var onClick = _this.onAdd(key);
523
+
524
+ return /*#__PURE__*/_react["default"].createElement(_icon["default"], {
525
+ type: "plus-circle-o",
526
+ role: "add",
527
+ onClick: onClick
528
+ });
529
+ } else {
530
+ return null;
531
+ }
532
+ });
533
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnTitle", function (_ref9) {
534
+ var required = _ref9.required,
535
+ title = _ref9.title,
536
+ type = _ref9.type,
537
+ key = _ref9.key,
538
+ showAdd = _ref9.showAdd;
539
+
540
+ if (type === 'checkbox') {
541
+ var status = _this.getCheckedStatus(key);
542
+
543
+ return /*#__PURE__*/_react["default"].createElement(_checkbox["default"], (0, _extends2["default"])({
544
+ onChange: _this.onCheck(key, -1)
545
+ }, status));
546
+ } else {
547
+ var className = required ? 'ant-form-item-required' : '';
548
+ return /*#__PURE__*/_react["default"].createElement("span", {
549
+ className: className
550
+ }, title, _this.toAdd(key, showAdd));
551
+ }
552
+ });
553
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumnClassName", function (_ref10) {
554
+ var type = _ref10.type,
555
+ align = _ref10.align;
556
+
557
+ if (type === 'index' || type === 'checkbox') {
558
+ return 'ant-table-selection-column';
559
+ } else {
560
+ return align ? (0, _variables["default"])('SuperTable2')[align] : '';
561
+ }
562
+ });
563
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "canReadonly", function (type) {
564
+ var _context6;
565
+
566
+ return !(0, _includes["default"])(_context6 = ['index', 'checkbox', 'link', 'button', 'switch', 'custom', 'img', 'toolbar']).call(_context6, type);
567
+ });
568
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getColumns", function (cols) {
569
+ var _context7;
570
+
571
+ var readonly = _this.props.readonly;
572
+ return (0, _map["default"])(_context7 = (0, _filter["default"])(cols).call(cols, function (col) {
573
+ return !col.hide;
574
+ })).call(_context7, function (_ref11, index) {
575
+ var col = (0, _extends2["default"])({}, _ref11);
576
+ col.className = _this.getColumnClassName(col);
577
+ col.title = _this.getColumnTitle(col);
578
+ col.dataIndex = col.key;
579
+ col.width = col.width || 120; // const {props = {}} = col;
580
+ // const {edit = false} = props
581
+ // if (!(readonly || col.type === 'readonly') || !this.canReadonly(col.type)) {
582
+ // if ( !edit && ['text', 'number', 'select', 'date', 'search', 'readonly', 'textArea', 'selectSearch'].includes(col.type)){
583
+ // return col
584
+ // }
585
+ // }
586
+
587
+ col.render = _this.getCellRender(col);
588
+
589
+ if (col.link) {
590
+ col.type = 'link';
591
+ col.render = _this.getCellRender(col);
592
+ }
593
+
594
+ return col;
595
+ });
596
+ });
597
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getDataSource", function (items, cols) {
598
+ return (0, _map["default"])(items).call(items, function (item, index) {
599
+ return (0, _reduce["default"])(cols).call(cols, function (result, _ref12) {
600
+ var _context8;
601
+
602
+ var key = _ref12.key,
603
+ type = _ref12.type,
604
+ options = _ref12.options;
605
+
606
+ if (!_this.props.readonly && type && type !== 'readonly' && (!item.isReadonly || (0, _isArray["default"])(item.isReadonly) && !(0, _includes["default"])(_context8 = item.isReadonly).call(_context8, key))) {
607
+ result[key] = item[key];
608
+ } else {
609
+ result[key] = (0, _Control.getTitle)(item[key], options);
610
+ }
611
+
612
+ return result;
613
+ }, _objectSpread(_objectSpread({}, item), {}, {
614
+ key: index,
615
+ disabled: item.isCanConfigHide
616
+ }));
617
+ });
618
+ });
619
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getPropsByCheckbox", function () {
620
+ var _this$props2 = _this.props,
621
+ items = _this$props2.items,
622
+ _this$props2$isEmphas = _this$props2.isEmphasized,
623
+ isEmphasized = _this$props2$isEmphas === void 0 ? false : _this$props2$isEmphas;
624
+
625
+ var rowClassName = function rowClassName(record) {
626
+ if (isEmphasized && items[record.key].__isEmphasized) {
627
+ return items[record.key].checked ? (0, _variables["default"])('SuperTable2').emphasizedSelectRow : (0, _variables["default"])('SuperTable2').emphasizedUnselectRow;
628
+ }
629
+
630
+ return items[record.key].checked ? (0, _variables["default"])('SuperTable2').select : '';
631
+ };
632
+
633
+ return {
634
+ rowClassName: rowClassName
635
+ };
636
+ });
637
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "getProps", function () {
638
+ var _context9;
639
+
640
+ var _this$props3 = _this.props,
641
+ cols = _this$props3.cols,
642
+ items = _this$props3.items,
643
+ _this$props3$style = _this$props3.style,
644
+ style = _this$props3$style === void 0 ? {} : _this$props3$style,
645
+ _this$props3$footer = _this$props3.footer,
646
+ footer = _this$props3$footer === void 0 ? null : _this$props3$footer,
647
+ _this$props3$paginati = _this$props3.pagination,
648
+ pagination = _this$props3$paginati === void 0 ? false : _this$props3$paginati,
649
+ _this$props3$isEmphas = _this$props3.isEmphasized,
650
+ isEmphasized = _this$props3$isEmphas === void 0 ? false : _this$props3$isEmphas,
651
+ maxHeight = _this$props3.maxHeight;
652
+ var widthX = (0, _reduce["default"])(_context9 = (0, _filter["default"])(cols).call(cols, function (col) {
653
+ return !col.hide;
654
+ })).call(_context9, function (width, item) {
655
+ return width += item.width ? item.width : 120;
656
+ }, 0);
657
+ return _objectSpread({
658
+ className: !isEmphasized ? (0, _variables["default"])('SuperTable2') : (0, _variables["default"])('SuperTable2').noTransition,
659
+ columns: _this.getColumns(cols),
660
+ dataSource: _this.getDataSource(items, cols),
661
+ style: (0, _assign["default"])({}, {
662
+ whiteSpace: 'nowrap'
663
+ }, style),
664
+ size: 'small',
665
+ scroll: {
666
+ x: widthX,
667
+ y: maxHeight
668
+ },
669
+ pagination: pagination,
670
+ footer: footer,
671
+ locale: _this.props.emptyText ? {
672
+ emptyText: _this.props.emptyText
673
+ } : null
674
+ }, _this.getPropsByCheckbox());
675
+ });
676
+ (0, _defineProperty2["default"])((0, _assertThisInitialized2["default"])(_this), "setScroll", function () {
677
+ if (_this.props.maxHeight && _this.props.items.length) {
678
+ var root = _reactDom["default"].findDOMNode((0, _assertThisInitialized2["default"])(_this));
679
+
680
+ var container = root.getElementsByClassName('ant-table-body')[0];
681
+ var header = root.getElementsByClassName('ant-table-thead')[0];
682
+ (0, _fixed["default"])(container, header, _this.props.maxHeight);
683
+ }
684
+ });
685
+ return _this;
686
+ }
687
+
688
+ (0, _createClass2["default"])(SuperTable2, [{
689
+ key: "componentDidMount",
690
+ value: function componentDidMount() {
691
+ this.setScroll();
692
+ }
693
+ }, {
694
+ key: "componentDidUpdate",
695
+ value: function componentDidUpdate() {
696
+ this.setScroll();
697
+ }
698
+ }, {
699
+ key: "render",
700
+ value: function render() {
701
+ this.error = false;
702
+ return /*#__PURE__*/_react["default"].createElement(_table["default"], (0, _extends2["default"])({}, this.getProps(), {
703
+ key: this.props.items.length
704
+ }));
705
+ }
706
+ }]);
707
+ return SuperTable2;
708
+ }(_react["default"].Component);
709
+
710
+ (0, _defineProperty2["default"])(SuperTable2, "propTypes", {
711
+ cols: _propTypes["default"].arrayOf(_propTypes["default"].shape(ColType)).isRequired,
712
+ items: _propTypes["default"].array.isRequired,
713
+ base: _propTypes["default"].number,
714
+ options: _propTypes["default"].object,
715
+ valid: _propTypes["default"].bool,
716
+ readonly: _propTypes["default"].bool,
717
+ style: _propTypes["default"].object,
718
+ maxHeight: _propTypes["default"].string,
719
+ emptyText: _propTypes["default"].string,
720
+ footer: _propTypes["default"].func,
721
+ callback: _propTypes["default"].shape(CallbackType),
722
+ isEmphasized: _propTypes["default"].bool
723
+ });
724
+ var _default = SuperTable2;
725
+ exports["default"] = _default;