@lemon-fe/components 0.1.118 → 0.1.122

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 (67) hide show
  1. package/es/Actions/index.js +17 -45
  2. package/es/BaseTable/Actions.d.ts +1 -0
  3. package/es/BaseTable/Actions.js +8 -30
  4. package/es/BaseTable/ResizeHeaderCell.js +12 -39
  5. package/es/BaseTable/VirtualBody.js +11 -50
  6. package/es/BaseTable/index.d.ts +1 -0
  7. package/es/BaseTable/index.js +109 -196
  8. package/es/BaseTable/utils.js +0 -4
  9. package/es/ColorPicker/index.js +13 -31
  10. package/es/Dropdown/index.js +9 -19
  11. package/es/DurationPicker/index.d.ts +1 -0
  12. package/es/DurationPicker/index.js +12 -40
  13. package/es/EditableTable/EditableCell.d.ts +1 -0
  14. package/es/EditableTable/EditableCell.js +18 -12
  15. package/es/EditableTable/EditableTableFormItem.d.ts +1 -0
  16. package/es/EditableTable/EditableTableFormItem.js +8 -16
  17. package/es/EditableTable/Table.js +28 -103
  18. package/es/EditableTable/index.less +6 -0
  19. package/es/EditableTable/util.d.ts +1 -1
  20. package/es/EditableTable/util.js +23 -99
  21. package/es/Filter/index.d.ts +8 -1
  22. package/es/Filter/index.js +118 -196
  23. package/es/Filter/typings.d.ts +1 -0
  24. package/es/FormHorizontal/index.js +0 -5
  25. package/es/FormInline/index.js +5 -21
  26. package/es/FormLayout/index.js +6 -11
  27. package/es/FormTable/index.js +12 -46
  28. package/es/Icons/BigTip/index.js +2 -14
  29. package/es/Icons/Calendar.js +0 -5
  30. package/es/Icons/Close.js +0 -5
  31. package/es/Icons/CollapseUp.js +0 -5
  32. package/es/Icons/DarkSearch.js +0 -5
  33. package/es/Icons/Down.js +0 -5
  34. package/es/Icons/Empty.js +0 -2
  35. package/es/Icons/LookUp.js +0 -5
  36. package/es/Icons/More.js +0 -5
  37. package/es/Icons/Search.js +0 -5
  38. package/es/Icons/Tip.js +2 -19
  39. package/es/InputMaxLength/index.js +9 -29
  40. package/es/Layout/index.js +23 -45
  41. package/es/MainFramework/components/DropMenu/index.d.ts +1 -0
  42. package/es/MainFramework/components/DropMenu/index.js +8 -19
  43. package/es/MainFramework/components/Menu/index.d.ts +1 -0
  44. package/es/MainFramework/components/Menu/index.js +22 -88
  45. package/es/MainFramework/components/RefreshButton/index.d.ts +1 -0
  46. package/es/MainFramework/components/RefreshButton/index.js +5 -14
  47. package/es/MainFramework/components/TabBar/index.d.ts +1 -0
  48. package/es/MainFramework/components/TabBar/index.js +6 -21
  49. package/es/MainFramework/index.js +18 -18
  50. package/es/PageLoading/index.js +0 -2
  51. package/es/Popup/index.js +30 -73
  52. package/es/Portal/index.js +13 -31
  53. package/es/Section/TabBar.js +6 -16
  54. package/es/Section/index.js +14 -22
  55. package/es/SelectView/index.d.ts +1 -1
  56. package/es/SelectView/index.js +25 -62
  57. package/es/SiderTree/TreeNodeTitle.d.ts +1 -0
  58. package/es/SiderTree/TreeNodeTitle.js +8 -24
  59. package/es/SiderTree/index.js +15 -50
  60. package/es/SymbolIcon/index.js +4 -9
  61. package/es/TabBar/index.js +7 -17
  62. package/es/Table/index.d.ts +2 -1
  63. package/es/Table/index.js +90 -124
  64. package/es/TipMark/index.js +7 -17
  65. package/es/init.js +11 -27
  66. package/es/utils.js +0 -2
  67. package/package.json +4 -4
@@ -1,38 +1,21 @@
1
1
  var _excluded = ["onWidthChange", "width", "fullTableRef", "children", "className"],
2
- _excluded2 = ["id", "columns", "defaultColumnProps", "rowKey", "children", "summaryTitle", "summaryRecord", "dataSource", "onSortChange", "sort", "scroll", "virtual", "components", "pagination", "rowHeight", "tableLayout", "rowActions", "style", "className", "locale"];
3
-
2
+ _excluded2 = ["id", "columns", "defaultColumnProps", "rowKey", "children", "summaryTitle", "summaryRecord", "dataSource", "onSortChange", "sort", "scroll", "virtual", "components", "pagination", "rowHeight", "tableLayout", "rowActions", "style", "className", "locale"];
4
3
  function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
-
6
4
  function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
7
-
8
5
  function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
-
10
6
  function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
-
12
7
  function _typeof(obj) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (obj) { return typeof obj; } : function (obj) { return obj && "function" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }, _typeof(obj); }
13
-
14
8
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
-
16
9
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
17
-
18
10
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(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); }
19
-
20
11
  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; }
21
-
22
12
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
23
-
24
13
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
-
26
14
  function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
27
-
28
15
  function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
29
-
30
16
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
31
-
32
17
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
33
-
34
18
  function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
35
-
36
19
  /// <reference path="../../typings.d.ts" />
37
20
  import React, { useMemo, useState, useEffect, useRef, forwardRef } from 'react';
38
21
  import { Table as AntdTable } from 'antd';
@@ -46,14 +29,11 @@ import VirtualList from './VirtualBody';
46
29
  import BaseTableContext from './BaseTableContext';
47
30
  import Actions from './Actions';
48
31
  import empty from './empty.png';
49
-
50
32
  function formatSummary(summary) {
51
33
  if (!summary) {
52
34
  return summary;
53
35
  }
54
-
55
36
  var obj = _objectSpread({}, summary);
56
-
57
37
  var pretty = new Intl.NumberFormat('en-US', {
58
38
  minimumFractionDigits: 2,
59
39
  maximumFractionDigits: 2
@@ -65,32 +45,27 @@ function formatSummary(summary) {
65
45
  });
66
46
  return obj;
67
47
  }
68
-
69
48
  function Th(props) {
70
49
  var onWidthChange = props.onWidthChange,
71
- width = props.width,
72
- fullTableRef = props.fullTableRef,
73
- children = props.children,
74
- className = props.className,
75
- restProps = _objectWithoutProperties(props, _excluded);
76
-
50
+ width = props.width,
51
+ fullTableRef = props.fullTableRef,
52
+ children = props.children,
53
+ className = props.className,
54
+ restProps = _objectWithoutProperties(props, _excluded);
77
55
  var reg = /\bant-table-cell-ellipsis\b/;
78
56
  var content = children;
79
57
  var mClassName = className;
80
-
81
58
  if (mClassName && reg.test(mClassName)) {
82
59
  mClassName = mClassName.replace(reg, '');
83
60
  content = /*#__PURE__*/React.createElement("div", {
84
61
  className: "ant-table-cell-ellipsis"
85
62
  }, content);
86
63
  }
87
-
88
64
  if (!width || !onWidthChange) {
89
65
  return /*#__PURE__*/React.createElement("th", _objectSpread(_objectSpread({}, restProps), {}, {
90
66
  className: mClassName
91
67
  }), content);
92
68
  }
93
-
94
69
  return /*#__PURE__*/React.createElement(ResizeHeaderCell, {
95
70
  width: width,
96
71
  onChange: onWidthChange,
@@ -100,85 +75,68 @@ function Th(props) {
100
75
  className: mClassName
101
76
  }), content));
102
77
  }
103
-
104
78
  function BaseTable(props, _ref) {
105
79
  var id = props.id,
106
- columns = props.columns,
107
- defaultColumnProps = props.defaultColumnProps,
108
- rowKey = props.rowKey,
109
- children = props.children,
110
- summaryTitle = props.summaryTitle,
111
- summaryRecord = props.summaryRecord,
112
- _props$dataSource = props.dataSource,
113
- dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
114
- onSortChange = props.onSortChange,
115
- defaultSort = props.sort,
116
- scroll = props.scroll,
117
- virtual = props.virtual,
118
- componentsProp = props.components,
119
- paginationProp = props.pagination,
120
- rowHeight = props.rowHeight,
121
- _props$tableLayout = props.tableLayout,
122
- tableLayout = _props$tableLayout === void 0 ? 'fixed' : _props$tableLayout,
123
- rowActions = props.rowActions,
124
- style = props.style,
125
- className = props.className,
126
- localeProp = props.locale,
127
- restProps = _objectWithoutProperties(props, _excluded2);
128
-
80
+ columns = props.columns,
81
+ defaultColumnProps = props.defaultColumnProps,
82
+ rowKey = props.rowKey,
83
+ children = props.children,
84
+ summaryTitle = props.summaryTitle,
85
+ summaryRecord = props.summaryRecord,
86
+ _props$dataSource = props.dataSource,
87
+ dataSource = _props$dataSource === void 0 ? [] : _props$dataSource,
88
+ onSortChange = props.onSortChange,
89
+ defaultSort = props.sort,
90
+ scroll = props.scroll,
91
+ virtual = props.virtual,
92
+ componentsProp = props.components,
93
+ paginationProp = props.pagination,
94
+ rowHeight = props.rowHeight,
95
+ _props$tableLayout = props.tableLayout,
96
+ tableLayout = _props$tableLayout === void 0 ? 'fixed' : _props$tableLayout,
97
+ rowActions = props.rowActions,
98
+ style = props.style,
99
+ className = props.className,
100
+ localeProp = props.locale,
101
+ restProps = _objectWithoutProperties(props, _excluded2);
129
102
  var fullTableRef = useRef(null);
130
-
131
103
  var _useState = useState(new Map()),
132
- _useState2 = _slicedToArray(_useState, 2),
133
- colsState = _useState2[0],
134
- setColsState = _useState2[1];
135
-
104
+ _useState2 = _slicedToArray(_useState, 2),
105
+ colsState = _useState2[0],
106
+ setColsState = _useState2[1];
136
107
  var scrollYProp = scroll === null || scroll === void 0 ? void 0 : scroll.y;
137
-
138
108
  var _useState3 = useState(scrollYProp === true ? 0 : scrollYProp),
139
- _useState4 = _slicedToArray(_useState3, 2),
140
- scrollY = _useState4[0],
141
- setScrollY = _useState4[1];
142
-
109
+ _useState4 = _slicedToArray(_useState3, 2),
110
+ scrollY = _useState4[0],
111
+ setScrollY = _useState4[1];
143
112
  var memoHeight = useRef(0);
144
113
  /** auto scroll y */
145
-
146
114
  var calcScrollY = function calcScrollY() {
147
115
  var wrapper = fullTableRef.current;
148
-
149
116
  if (wrapper === null) {
150
117
  return null;
151
118
  }
152
-
153
119
  var table = wrapper.querySelector('.ant-table');
154
120
  var tableBody = wrapper.querySelector('.ant-table-body');
155
-
156
121
  if (tableBody === null || table === null) {
157
122
  return null;
158
123
  }
159
-
160
124
  var parent = wrapper.parentElement;
161
-
162
125
  if (parent === null) {
163
126
  return null;
164
127
  }
165
-
166
128
  var style = getComputedStyle(parent);
167
129
  var contentHeight = parent.offsetHeight - (parseFloat(style.getPropertyValue('padding-top')) || 0) - (parseFloat(style.getPropertyValue('padding-bottom')) || 0);
168
130
  var nodes = [];
169
-
170
131
  if (tableBody.previousElementSibling !== null) {
171
132
  nodes.push(tableBody.previousElementSibling);
172
133
  }
173
-
174
134
  if (tableBody.nextElementSibling !== null) {
175
135
  nodes.push(tableBody.nextElementSibling);
176
136
  }
177
-
178
137
  if (table.nextElementSibling !== null) {
179
138
  nodes.push(table.nextElementSibling);
180
139
  }
181
-
182
140
  contentHeight -= nodes.reduce(function (prev, dom) {
183
141
  var cpStyle = window.getComputedStyle(dom);
184
142
  var height = dom.offsetHeight + (parseFloat(cpStyle.getPropertyValue('margin-top')) || 0) + (parseFloat(cpStyle.getPropertyValue('margin-bottom')) || 0);
@@ -186,27 +144,20 @@ function BaseTable(props, _ref) {
186
144
  }, 0);
187
145
  return contentHeight;
188
146
  };
189
-
190
147
  var changeScrollY = function changeScrollY(height) {
191
148
  if (height === memoHeight.current) {
192
149
  return;
193
150
  }
194
-
195
151
  memoHeight.current = height;
196
-
197
152
  if (memoHeight.current === 0) {
198
153
  return;
199
154
  }
200
-
201
155
  setScrollY(calcScrollY() || undefined);
202
156
  };
203
-
204
157
  var hasPagination = false;
205
-
206
158
  if (paginationProp !== false) {
207
159
  hasPagination = paginationProp !== undefined && !!paginationProp.total || dataSource.length > 0;
208
160
  }
209
-
210
161
  useEffect(function () {
211
162
  if (scrollYProp === true) {
212
163
  setScrollY(calcScrollY() || 0);
@@ -220,19 +171,15 @@ function BaseTable(props, _ref) {
220
171
  useEffect(function () {
221
172
  if (scrollY !== undefined && fullTableRef.current !== null) {
222
173
  var body = fullTableRef.current.querySelector('.ant-table-body');
223
-
224
174
  if (body !== null) {
225
175
  var dataType = _typeof(scrollY);
226
-
227
176
  switch (dataType) {
228
177
  case 'string':
229
178
  body.style.height = scrollY;
230
179
  break;
231
-
232
180
  case 'number':
233
181
  body.style.height = scrollY + 'px';
234
182
  break;
235
-
236
183
  default:
237
184
  body.style.height = 'auto';
238
185
  }
@@ -240,97 +187,78 @@ function BaseTable(props, _ref) {
240
187
  }
241
188
  }, [scrollY]);
242
189
  /** resizable column */
243
-
244
190
  var _useMemo = useMemo(function () {
245
- var flattenCols = [];
246
- var isFixedLayout = tableLayout === 'fixed';
247
- var hasAutoWidthCol = false;
248
-
249
- var traverse = function traverse(cols) {
250
- var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
251
- return cols.map(function (col, index) {
252
- var currPath = [].concat(_toConsumableArray(path), [index]);
253
-
254
- if (isColumnType(col)) {
255
- var colKey = getColumnKey(col);
256
-
257
- var nextCol = _objectSpread(_objectSpread({}, defaultColumnProps), col);
258
-
259
- var colState = colsState.get(colKey);
260
-
261
- if (colState && colState.width !== undefined) {
262
- nextCol.width = colState.width;
263
- }
264
-
265
- if (isFixedLayout && !!nextCol.title) {
266
- if (nextCol.width === undefined) {
267
- nextCol.width = 160;
268
- } else if (nextCol.width === 'auto') {
269
- nextCol.width = undefined;
191
+ var flattenCols = [];
192
+ var isFixedLayout = tableLayout === 'fixed';
193
+ var hasAutoWidthCol = false;
194
+ var traverse = function traverse(cols) {
195
+ var path = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : [];
196
+ return cols.map(function (col, index) {
197
+ var currPath = [].concat(_toConsumableArray(path), [index]);
198
+ if (isColumnType(col)) {
199
+ var colKey = getColumnKey(col);
200
+ var nextCol = _objectSpread(_objectSpread({}, defaultColumnProps), col);
201
+ var colState = colsState.get(colKey);
202
+ if (colState && colState.width !== undefined) {
203
+ nextCol.width = colState.width;
270
204
  }
271
- }
272
-
273
- if (!nextCol.width) {
274
- hasAutoWidthCol = true;
275
- }
276
-
277
- if (nextCol.width && !nextCol.fixed) {
278
- if (nextCol.ellipsis === undefined) {
279
- nextCol.ellipsis = true;
205
+ if (isFixedLayout && !!nextCol.title) {
206
+ if (nextCol.width === undefined) {
207
+ nextCol.width = 160;
208
+ } else if (nextCol.width === 'auto') {
209
+ nextCol.width = undefined;
210
+ }
211
+ }
212
+ if (!nextCol.width) {
213
+ hasAutoWidthCol = true;
280
214
  }
281
-
282
- nextCol.onHeaderCell = function () {
283
- return {
284
- width: nextCol.width,
285
- fullTableRef: fullTableRef,
286
- onWidthChange: function onWidthChange(size) {
287
- setColsState(function (prev) {
288
- var prevItem = prev.get(colKey);
289
-
290
- if (prevItem !== undefined && prevItem.width === size) {
291
- return prev;
292
- }
293
-
294
- prevItem = _objectSpread(_objectSpread({}, prevItem), {}, {
295
- width: size
215
+ if (nextCol.width && !nextCol.fixed) {
216
+ if (nextCol.ellipsis === undefined) {
217
+ nextCol.ellipsis = true;
218
+ }
219
+ nextCol.onHeaderCell = function () {
220
+ return {
221
+ width: nextCol.width,
222
+ fullTableRef: fullTableRef,
223
+ onWidthChange: function onWidthChange(size) {
224
+ setColsState(function (prev) {
225
+ var prevItem = prev.get(colKey);
226
+ if (prevItem !== undefined && prevItem.width === size) {
227
+ return prev;
228
+ }
229
+ prevItem = _objectSpread(_objectSpread({}, prevItem), {}, {
230
+ width: size
231
+ });
232
+ var next = new Map(prev);
233
+ next.set(colKey, prevItem);
234
+ return next;
296
235
  });
297
- var next = new Map(prev);
298
- next.set(colKey, prevItem);
299
- return next;
300
- });
301
- }
236
+ }
237
+ };
302
238
  };
303
- };
239
+ }
240
+ flattenCols.push(nextCol);
241
+ return nextCol;
304
242
  }
305
-
306
- flattenCols.push(nextCol);
307
- return nextCol;
308
- }
309
-
310
- return _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), col), {}, {
311
- children: traverse(col.children, currPath)
243
+ return _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), col), {}, {
244
+ children: traverse(col.children, currPath)
245
+ });
312
246
  });
313
- });
314
- };
315
-
316
- var newColumns = traverse(columns);
317
-
318
- if (isFixedLayout && !hasAutoWidthCol) {
319
- var emptyCol = {
320
- title: ''
321
247
  };
322
- newColumns.push(emptyCol);
323
- flattenCols.push(emptyCol);
324
- }
325
-
326
- return [newColumns, flattenCols];
327
- }, [columns, colsState, tableLayout]),
328
- _useMemo2 = _slicedToArray(_useMemo, 2),
329
- formatedColumns = _useMemo2[0],
330
- flattenColumns = _useMemo2[1];
248
+ var newColumns = traverse(columns);
249
+ if (isFixedLayout && !hasAutoWidthCol) {
250
+ var emptyCol = {
251
+ title: ''
252
+ };
253
+ newColumns.push(emptyCol);
254
+ flattenCols.push(emptyCol);
255
+ }
256
+ return [newColumns, flattenCols];
257
+ }, [columns, colsState, tableLayout]),
258
+ _useMemo2 = _slicedToArray(_useMemo, 2),
259
+ formatedColumns = _useMemo2[0],
260
+ flattenColumns = _useMemo2[1];
331
261
  /** row actions */
332
-
333
-
334
262
  var _useMemo3 = useMemo(function () {
335
263
  if (rowActions !== undefined) {
336
264
  var actionCol = {
@@ -348,42 +276,33 @@ function BaseTable(props, _ref) {
348
276
  };
349
277
  return [[].concat(_toConsumableArray(formatedColumns), [actionCol]), [].concat(_toConsumableArray(flattenColumns), [actionCol])];
350
278
  }
351
-
352
279
  return [formatedColumns, flattenColumns];
353
280
  }, [rowActions, flattenColumns, formatedColumns]);
354
-
355
281
  var _useMemo4 = _slicedToArray(_useMemo3, 2);
356
-
357
282
  formatedColumns = _useMemo4[0];
358
283
  flattenColumns = _useMemo4[1];
359
-
360
284
  /** virtualize scroll */
361
285
  var _useMemo5 = useMemo(function () {
362
- return {
363
- components: _objectSpread({
364
- header: {
365
- cell: Th
366
- },
367
- body: virtual ? {
368
- wrapper: VirtualList
369
- } : undefined
370
- }, componentsProp)
371
- };
372
- }, [virtual]),
373
- components = _useMemo5.components;
286
+ return {
287
+ components: _objectSpread({
288
+ header: {
289
+ cell: Th
290
+ },
291
+ body: virtual ? {
292
+ wrapper: VirtualList
293
+ } : undefined
294
+ }, componentsProp)
295
+ };
296
+ }, [virtual]),
297
+ components = _useMemo5.components;
374
298
  /** summary row */
375
-
376
-
377
299
  var summary = useMemo(function () {
378
300
  var Summary = AntdTable.Summary;
379
-
380
301
  if (!summaryRecord) {
381
302
  return undefined;
382
303
  }
383
-
384
304
  return function () {
385
305
  var _props$rowSelection;
386
-
387
306
  var data = formatSummary(summaryRecord);
388
307
  var offset = 0;
389
308
  return /*#__PURE__*/React.createElement(Summary, {
@@ -392,13 +311,11 @@ function BaseTable(props, _ref) {
392
311
  index: offset++
393
312
  }), flattenColumns.map(function (item, index) {
394
313
  var value;
395
-
396
314
  if (index === 0) {
397
315
  value = summaryTitle;
398
316
  } else if (item.dataIndex) {
399
317
  value = get(data, item.dataIndex);
400
318
  }
401
-
402
319
  return /*#__PURE__*/React.createElement(Summary.Cell, {
403
320
  index: index + offset,
404
321
  key: getColumnKey(item) || index,
@@ -417,7 +334,6 @@ function BaseTable(props, _ref) {
417
334
  size: "small",
418
335
  ref: function ref(elm) {
419
336
  fullTableRef.current = elm;
420
-
421
337
  if (typeof _ref === 'function') {
422
338
  _ref(elm);
423
339
  } else if (_ref !== null) {
@@ -457,7 +373,6 @@ function BaseTable(props, _ref) {
457
373
  defaultPageSize: 20
458
374
  }, paginationProp) : false
459
375
  }));
460
-
461
376
  if (scrollYProp === true) {
462
377
  tableNode = /*#__PURE__*/React.createElement(ResizeObserver, {
463
378
  onResize: function onResize(size) {
@@ -465,12 +380,10 @@ function BaseTable(props, _ref) {
465
380
  }
466
381
  }, tableNode);
467
382
  }
468
-
469
383
  return /*#__PURE__*/React.createElement(BaseTableContext.Provider, {
470
384
  value: ctx
471
385
  }, tableNode);
472
386
  }
473
-
474
387
  var ForwardTable = /*#__PURE__*/forwardRef(BaseTable);
475
388
  ForwardTable.Summary = AntdTable.Summary;
476
389
  export default ForwardTable;
@@ -5,11 +5,9 @@ export function getColumnKey(col) {
5
5
  if (typeof col.dataIndex === 'string' || typeof col.dataIndex === 'number') {
6
6
  return col.dataIndex;
7
7
  }
8
-
9
8
  if (Array.isArray(col.dataIndex)) {
10
9
  return col.dataIndex.join('-');
11
10
  }
12
-
13
11
  return col.key;
14
12
  }
15
13
  export function randomStr() {
@@ -17,10 +15,8 @@ export function randomStr() {
17
15
  var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz';
18
16
  var maxPos = chars.length;
19
17
  var pwd = '';
20
-
21
18
  for (var i = 0; i < len; i += 1) {
22
19
  pwd += chars.charAt(Math.floor(Math.random() * maxPos));
23
20
  }
24
-
25
21
  return pwd;
26
22
  }
@@ -1,15 +1,9 @@
1
1
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
2
-
3
2
  function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
4
-
5
3
  function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(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); }
6
-
7
4
  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; }
8
-
9
5
  function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
10
-
11
6
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
12
-
13
7
  import { Tooltip } from 'antd';
14
8
  import React, { useEffect, useState } from 'react';
15
9
  import colorString from 'color-string';
@@ -17,55 +11,44 @@ import ReactGPicker from 'react-gcolor-picker';
17
11
  import { SketchPicker } from 'react-color';
18
12
  var DEFAULT_COLORS = ['#FFD5B6', '#F5A623', '#F8E71C', '#8B572A', '#7ED321', '#417505', '#BD10E0', '#9013FE', '#456ad4', '#4A90E2', '#50E3C2', '#B8E986', '#000000', '#4A4A4A', '#9B9B9B', '#FFFFFF'];
19
13
  var DEFAULT_COLOR = 'rgba(255, 255, 255, 0)';
20
-
21
14
  var ColorPicker = function ColorPicker(_ref) {
22
15
  var _ref$value = _ref.value,
23
- value = _ref$value === void 0 ? DEFAULT_COLOR : _ref$value,
24
- disableAlpha = _ref.disableAlpha,
25
- gradientEnable = _ref.gradientEnable,
26
- _onChange = _ref.onChange;
27
-
16
+ value = _ref$value === void 0 ? DEFAULT_COLOR : _ref$value,
17
+ disableAlpha = _ref.disableAlpha,
18
+ gradientEnable = _ref.gradientEnable,
19
+ _onChange = _ref.onChange;
28
20
  var _useState = useState(false),
29
- _useState2 = _slicedToArray(_useState, 2),
30
- pickerShow = _useState2[0],
31
- setPickerShow = _useState2[1];
32
-
21
+ _useState2 = _slicedToArray(_useState, 2),
22
+ pickerShow = _useState2[0],
23
+ setPickerShow = _useState2[1];
33
24
  var _useState3 = useState(),
34
- _useState4 = _slicedToArray(_useState3, 2),
35
- hexColor = _useState4[0],
36
- setHexColor = _useState4[1];
37
-
25
+ _useState4 = _slicedToArray(_useState3, 2),
26
+ hexColor = _useState4[0],
27
+ setHexColor = _useState4[1];
38
28
  var _useState5 = useState(),
39
- _useState6 = _slicedToArray(_useState5, 2),
40
- alpha = _useState6[0],
41
- setAlpha = _useState6[1];
42
-
29
+ _useState6 = _slicedToArray(_useState5, 2),
30
+ alpha = _useState6[0],
31
+ setAlpha = _useState6[1];
43
32
  useEffect(function () {
44
33
  if (!gradientEnable) {
45
34
  var rgbaColorArr = colorString.get.rgb(value);
46
-
47
35
  if (!rgbaColorArr) {
48
36
  rgbaColorArr = colorString.get.rgb(DEFAULT_COLOR);
49
37
  }
50
-
51
38
  setHexColor(colorString.to.hex(rgbaColorArr));
52
39
  setAlpha(rgbaColorArr[3]);
53
40
  }
54
41
  }, [value]);
55
-
56
42
  var handlePickerShow = function handlePickerShow() {
57
43
  setPickerShow(function (val) {
58
44
  return !val;
59
45
  });
60
46
  };
61
-
62
47
  var handleColorChange = function handleColorChange(val, event) {
63
48
  var _val$rgb$a;
64
-
65
49
  event.stopPropagation();
66
50
  _onChange === null || _onChange === void 0 ? void 0 : _onChange("rgba(".concat(val.rgb.r, ", ").concat(val.rgb.g, ", ").concat(val.rgb.b, ", ").concat((_val$rgb$a = val.rgb.a) !== null && _val$rgb$a !== void 0 ? _val$rgb$a : 1, ")"));
67
51
  };
68
-
69
52
  return /*#__PURE__*/React.createElement("div", null, /*#__PURE__*/React.createElement("div", {
70
53
  style: {
71
54
  border: pickerShow ? '2px solid rgb(69, 143, 255)' : undefined
@@ -110,5 +93,4 @@ var ColorPicker = function ColorPicker(_ref) {
110
93
  className: "lemon-color-picker-mask"
111
94
  }))));
112
95
  };
113
-
114
96
  export default ColorPicker;