@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,47 +1,32 @@
1
1
  var _excluded = ["disabled", "dropDown", "text", "onClick", "icon", "action"];
2
-
3
2
  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; }
4
-
5
3
  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; }
6
-
7
4
  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; }
8
-
9
5
  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; }
10
-
11
6
  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; }
12
-
13
7
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
14
-
15
8
  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."); }
16
-
17
9
  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); }
18
-
19
10
  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; }
20
-
21
11
  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; }
22
-
23
12
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
24
-
25
13
  import React, { Fragment, useState } from 'react';
26
14
  import { Space, Dropdown, Menu, Button, Popover } from 'antd';
27
15
  import classNames from 'classnames';
28
16
  import Icons from '../Icons';
29
17
  import { PREFIX_CLS } from '../constants';
30
-
31
18
  function Actions(props) {
32
19
  var actions = props.actions,
33
- className = props.className,
34
- style = props.style,
35
- _props$prefixCls = props.prefixCls,
36
- prefixCls = _props$prefixCls === void 0 ? PREFIX_CLS : _props$prefixCls,
37
- _props$maxShowCount = props.maxShowCount,
38
- maxShowCount = _props$maxShowCount === void 0 ? 3 : _props$maxShowCount;
39
-
20
+ className = props.className,
21
+ style = props.style,
22
+ _props$prefixCls = props.prefixCls,
23
+ prefixCls = _props$prefixCls === void 0 ? PREFIX_CLS : _props$prefixCls,
24
+ _props$maxShowCount = props.maxShowCount,
25
+ maxShowCount = _props$maxShowCount === void 0 ? 3 : _props$maxShowCount;
40
26
  var _useState = useState(false),
41
- _useState2 = _slicedToArray(_useState, 2),
42
- visible = _useState2[0],
43
- setVisible = _useState2[1];
44
-
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ visible = _useState2[0],
29
+ setVisible = _useState2[1];
45
30
  var visibleBtns = actions.slice(0, maxShowCount);
46
31
  var collapsedBtns = actions.slice(maxShowCount);
47
32
  return /*#__PURE__*/React.createElement("div", {
@@ -54,29 +39,24 @@ function Actions(props) {
54
39
  if (item === null) {
55
40
  return item;
56
41
  }
57
-
58
42
  if ( /*#__PURE__*/React.isValidElement(item)) {
59
43
  return /*#__PURE__*/React.createElement(Fragment, {
60
44
  key: index
61
45
  }, item);
62
46
  }
63
-
64
47
  var disabled = item.disabled,
65
- dropDown = item.dropDown,
66
- text = item.text,
67
- onClick = item.onClick,
68
- icon = item.icon,
69
- action = item.action,
70
- rest = _objectWithoutProperties(item, _excluded);
71
-
48
+ dropDown = item.dropDown,
49
+ text = item.text,
50
+ onClick = item.onClick,
51
+ icon = item.icon,
52
+ action = item.action,
53
+ rest = _objectWithoutProperties(item, _excluded);
72
54
  if ( /*#__PURE__*/React.isValidElement(text)) {
73
55
  return /*#__PURE__*/React.createElement(Fragment, {
74
56
  key: index
75
57
  }, text);
76
58
  }
77
-
78
59
  var handleClick = onClick || action;
79
-
80
60
  if (Array.isArray(dropDown)) {
81
61
  var overlay = /*#__PURE__*/React.createElement(Menu, null, dropDown.map(function (subItem) {
82
62
  if (subItem) {
@@ -89,7 +69,6 @@ function Actions(props) {
89
69
  }, subItem.text);
90
70
  }
91
71
  }));
92
-
93
72
  if (handleClick !== undefined) {
94
73
  return /*#__PURE__*/React.createElement(Dropdown.Button, {
95
74
  key: text,
@@ -98,16 +77,14 @@ function Actions(props) {
98
77
  onClick: handleClick,
99
78
  buttonsRender: function buttonsRender(_ref) {
100
79
  var _ref2 = _slicedToArray(_ref, 2),
101
- leftBtn = _ref2[0],
102
- _ = _ref2[1];
103
-
80
+ leftBtn = _ref2[0],
81
+ _ = _ref2[1];
104
82
  return [leftBtn, /*#__PURE__*/React.createElement(Button, {
105
83
  icon: /*#__PURE__*/React.createElement(Icons.More, null)
106
84
  })];
107
85
  }
108
86
  }, text);
109
87
  }
110
-
111
88
  return /*#__PURE__*/React.createElement(Dropdown, {
112
89
  key: text,
113
90
  disabled: disabled,
@@ -123,7 +100,6 @@ function Actions(props) {
123
100
  }
124
101
  })));
125
102
  }
126
-
127
103
  return /*#__PURE__*/React.createElement(Button, _objectSpread({
128
104
  key: text,
129
105
  disabled: disabled,
@@ -140,13 +116,11 @@ function Actions(props) {
140
116
  if (item === null) {
141
117
  return item;
142
118
  }
143
-
144
119
  if ( /*#__PURE__*/React.isValidElement(item)) {
145
120
  return /*#__PURE__*/React.createElement(Fragment, {
146
121
  key: index
147
122
  }, item);
148
123
  }
149
-
150
124
  var disabled = item.disabled;
151
125
  return /*#__PURE__*/React.createElement("div", {
152
126
  className: classNames("".concat(prefixCls, "-actions-popover-item"), _defineProperty({}, "".concat(prefixCls, "-actions-popover-item-disabled"), disabled)),
@@ -155,7 +129,6 @@ function Actions(props) {
155
129
  if (!disabled) {
156
130
  var handleClick = item.onClick || item.action;
157
131
  setVisible(false);
158
-
159
132
  if (handleClick) {
160
133
  handleClick();
161
134
  }
@@ -167,5 +140,4 @@ function Actions(props) {
167
140
  icon: /*#__PURE__*/React.createElement(Icons.More, null)
168
141
  })) : null));
169
142
  }
170
-
171
143
  export default Actions;
@@ -1,3 +1,4 @@
1
+ /// <reference types="react" />
1
2
  import type { RowAction } from './typings';
2
3
  interface Props<T> {
3
4
  actions: (RowAction<T> | null)[] | ((record: T, index: number) => (RowAction<T> | null)[]);
@@ -1,17 +1,10 @@
1
1
  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; }
2
-
3
2
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
3
  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."); }
6
-
7
4
  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); }
8
-
9
5
  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; }
10
-
11
6
  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; }
12
-
13
7
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
-
15
8
  import React, { useRef, useState } from 'react';
16
9
  import classNames from 'classnames';
17
10
  import { createPortal } from 'react-dom';
@@ -19,55 +12,44 @@ import { PREFIX_CLS } from '../constants';
19
12
  import Icons from '../Icons';
20
13
  export default function Actions(props) {
21
14
  var actionsProp = props.actions,
22
- row = props.row,
23
- index = props.index;
24
-
15
+ row = props.row,
16
+ index = props.index;
25
17
  var _useState = useState(null),
26
- _useState2 = _slicedToArray(_useState, 2),
27
- pop = _useState2[0],
28
- setPop = _useState2[1];
29
-
18
+ _useState2 = _slicedToArray(_useState, 2),
19
+ pop = _useState2[0],
20
+ setPop = _useState2[1];
30
21
  var _useState3 = useState(false),
31
- _useState4 = _slicedToArray(_useState3, 2),
32
- visible = _useState4[0],
33
- setVisible = _useState4[1];
34
-
22
+ _useState4 = _slicedToArray(_useState3, 2),
23
+ visible = _useState4[0],
24
+ setVisible = _useState4[1];
35
25
  var prefixCls = "".concat(PREFIX_CLS, "-table-operator");
36
26
  var ref = useRef(null);
37
-
38
27
  var openPop = function openPop(data) {
39
28
  setPop(data);
40
29
  setTimeout(function () {
41
30
  setVisible(true);
42
31
  }, 16);
43
32
  };
44
-
45
33
  var closePop = function closePop() {
46
34
  if (visible === false) {
47
35
  setPop(null);
48
36
  return;
49
37
  }
50
-
51
38
  if (ref.current !== null) {
52
39
  var node = ref.current;
53
40
  setVisible(false);
54
-
55
41
  var handler = function handler() {
56
42
  node.removeEventListener('transitionend', handler);
57
43
  setPop(null);
58
44
  };
59
-
60
45
  node.addEventListener('transitionend', handler);
61
46
  }
62
47
  };
63
-
64
48
  var actions = typeof actionsProp === 'function' ? actionsProp(row, index) : actionsProp;
65
-
66
49
  var getKey = function getKey(item, idx) {
67
50
  var key = item.key || (typeof item.text === 'string' ? item.text : idx);
68
51
  return key;
69
52
  };
70
-
71
53
  return /*#__PURE__*/React.createElement("div", {
72
54
  className: prefixCls,
73
55
  onMouseLeave: closePop
@@ -75,7 +57,6 @@ export default function Actions(props) {
75
57
  if (item === null) {
76
58
  return null;
77
59
  }
78
-
79
60
  var key = getKey(item, idx);
80
61
  var dropDown = item.dropDown ? item.dropDown.filter(function (item) {
81
62
  return item !== null;
@@ -92,7 +73,6 @@ export default function Actions(props) {
92
73
  if (item.disabled) {
93
74
  return;
94
75
  }
95
-
96
76
  if (dropDown.length > 0) {
97
77
  var rect = e.target.getBoundingClientRect();
98
78
  openPop({
@@ -103,7 +83,6 @@ export default function Actions(props) {
103
83
  });
104
84
  } else {
105
85
  var _item$onClick;
106
-
107
86
  (_item$onClick = item.onClick) === null || _item$onClick === void 0 ? void 0 : _item$onClick.call(item, row, index);
108
87
  }
109
88
  }
@@ -126,7 +105,6 @@ export default function Actions(props) {
126
105
  onClick: function onClick() {
127
106
  if (!item.disabled) {
128
107
  var _item$onClick2;
129
-
130
108
  closePop();
131
109
  (_item$onClick2 = item.onClick) === null || _item$onClick2 === void 0 ? void 0 : _item$onClick2.call(item, row, index);
132
110
  }
@@ -1,110 +1,83 @@
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 React, { useState, useRef, useEffect } from 'react';
14
8
  import { Resizable } from 'react-resizable';
15
9
  export default function ResizeHeaderCell(props) {
16
10
  var children = props.children,
17
- prefixCls = props.prefixCls,
18
- fullTableRef = props.fullTableRef,
19
- width = props.width,
20
- onChange = props.onChange;
21
-
11
+ prefixCls = props.prefixCls,
12
+ fullTableRef = props.fullTableRef,
13
+ width = props.width,
14
+ onChange = props.onChange;
22
15
  var _useState = useState(width),
23
- _useState2 = _slicedToArray(_useState, 2),
24
- size = _useState2[0],
25
- setSize = _useState2[1];
26
-
16
+ _useState2 = _slicedToArray(_useState, 2),
17
+ size = _useState2[0],
18
+ setSize = _useState2[1];
27
19
  var indicator = useRef();
28
20
  var handle = useRef(null);
29
-
30
21
  var _useState3 = useState(0),
31
- _useState4 = _slicedToArray(_useState3, 2),
32
- offset = _useState4[0],
33
- setOffset = _useState4[1];
34
-
22
+ _useState4 = _slicedToArray(_useState3, 2),
23
+ offset = _useState4[0],
24
+ setOffset = _useState4[1];
35
25
  useEffect(function () {
36
26
  setSize(width);
37
27
  }, [width]);
38
-
39
28
  var getTable = function getTable() {
40
29
  if (fullTableRef.current === null) {
41
30
  return null;
42
31
  }
43
-
44
32
  return fullTableRef.current.querySelector('.ant-table');
45
33
  };
46
-
47
34
  var handleResizeStart = function handleResizeStart() {
48
35
  var table = getTable();
49
-
50
36
  if (table === null) {
51
37
  return;
52
38
  }
53
-
54
39
  var elm = document.createElement('div');
55
40
  elm.style.height = "".concat(table.offsetHeight || 0, "px");
56
41
  elm.classList.add("".concat(prefixCls, "-resizable-indicator"));
57
-
58
42
  if (table) {
59
43
  table.appendChild(elm);
60
44
  table.classList.add("".concat(prefixCls, "-resizing-col"));
61
45
  indicator.current = elm;
62
-
63
46
  if (handle.current !== null) {
64
47
  var _handle$current = handle.current,
65
- parent = _handle$current.offsetParent,
66
- left = _handle$current.offsetLeft;
48
+ parent = _handle$current.offsetParent,
49
+ left = _handle$current.offsetLeft;
67
50
  var node = handle.current.parentNode;
68
-
69
51
  while (node !== null && node !== table) {
70
52
  left -= node.scrollLeft;
71
-
72
53
  if (node === parent) {
73
54
  left += node.offsetLeft;
74
55
  parent = node.offsetParent;
75
56
  }
76
-
77
57
  node = node.parentNode;
78
58
  }
79
-
80
59
  setOffset(left - size);
81
60
  indicator.current.style.left = "".concat(left, "px");
82
61
  }
83
62
  }
84
63
  };
85
-
86
64
  var handleResizeStop = function handleResizeStop() {
87
65
  var table = getTable();
88
-
89
66
  if (table !== null && indicator.current !== undefined) {
90
67
  table.removeChild(indicator.current);
91
68
  table.classList.remove("".concat(prefixCls, "-resizing-col"));
92
-
93
69
  if (onChange) {
94
70
  onChange(size);
95
71
  }
96
72
  }
97
73
  };
98
-
99
74
  var handleResize = function handleResize(e, data) {
100
75
  e.preventDefault();
101
-
102
76
  if (indicator.current) {
103
77
  setSize(data.size.width);
104
78
  indicator.current.style.left = "".concat(offset + data.size.width, "px");
105
79
  }
106
80
  };
107
-
108
81
  return /*#__PURE__*/React.createElement(Resizable, {
109
82
  width: size,
110
83
  height: 0,
@@ -1,27 +1,15 @@
1
1
  var _excluded = ["children"];
2
-
3
2
  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; }
4
-
5
3
  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; }
6
-
7
4
  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; }
8
-
9
5
  function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
10
-
11
6
  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."); }
12
-
13
7
  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); }
14
-
15
8
  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; }
16
-
17
9
  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; }
18
-
19
10
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
20
-
21
11
  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; }
22
-
23
12
  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; }
24
-
25
13
  import React, { useContext, useEffect, useMemo, useRef, useState } from 'react';
26
14
  import { useThrottle } from '@lemon-fe/hooks';
27
15
  import { get } from 'lodash';
@@ -29,47 +17,35 @@ import BaseTableContext from './BaseTableContext';
29
17
  import { PREFIX_CLS } from '../constants';
30
18
  export default function VirtualList(props) {
31
19
  var children = props.children,
32
- restProps = _objectWithoutProperties(props, _excluded);
33
-
20
+ restProps = _objectWithoutProperties(props, _excluded);
34
21
  var ref = useRef(null);
35
-
36
22
  var _useContext = useContext(BaseTableContext),
37
- scrollY = _useContext.scrollY,
38
- _useContext$rowHeight = _useContext.rowHeight,
39
- rowHeight = _useContext$rowHeight === void 0 ? 37 : _useContext$rowHeight;
40
-
23
+ scrollY = _useContext.scrollY,
24
+ _useContext$rowHeight = _useContext.rowHeight,
25
+ rowHeight = _useContext$rowHeight === void 0 ? 37 : _useContext$rowHeight;
41
26
  var _useState = useState(null),
42
- _useState2 = _slicedToArray(_useState, 2),
43
- range = _useState2[0],
44
- setRange = _useState2[1];
45
-
27
+ _useState2 = _slicedToArray(_useState, 2),
28
+ range = _useState2[0],
29
+ setRange = _useState2[1];
46
30
  var getRange = function getRange() {
47
31
  var height = Number(scrollY);
48
-
49
32
  if (isNaN(height)) {
50
33
  return null;
51
34
  }
52
-
53
35
  var body = ref.current;
54
-
55
36
  if (body === null) {
56
37
  return null;
57
38
  }
58
-
59
39
  var scroller = body.closest('.ant-table-body');
60
-
61
40
  if (scroller === null) {
62
41
  return null;
63
42
  }
64
-
65
43
  var pageSize = Math.ceil(height / rowHeight);
66
44
  var offset = Math.round(scroller.scrollTop / rowHeight);
67
45
  var start = offset - Math.floor(pageSize / 2);
68
-
69
46
  if (start < 0) {
70
47
  start = 0;
71
48
  }
72
-
73
49
  var end = offset + pageSize + Math.ceil(pageSize / 2) - 1;
74
50
  var bufferSpace = height * 0.3;
75
51
  return {
@@ -79,21 +55,16 @@ export default function VirtualList(props) {
79
55
  isBottom: body.offsetHeight + body.offsetTop - (scroller.scrollTop + height) <= bufferSpace
80
56
  };
81
57
  };
82
-
83
58
  var handleScroll = useThrottle(function () {
84
59
  var mRange = getRange();
85
-
86
60
  if (mRange === null) {
87
61
  return;
88
62
  }
89
-
90
63
  var isTop = mRange.isTop,
91
- isBottom = mRange.isBottom;
92
-
64
+ isBottom = mRange.isBottom;
93
65
  if (!isTop && !isBottom) {
94
66
  return;
95
67
  }
96
-
97
68
  setRange(mRange);
98
69
  }, 300, {
99
70
  trailing: true
@@ -103,45 +74,35 @@ export default function VirtualList(props) {
103
74
  }, [get(children, ['1', 'length']), rowHeight, scrollY]);
104
75
  var render = useMemo(function () {
105
76
  var _children = _slicedToArray(children, 2),
106
- measureRow = _children[0],
107
- rows = _children[1];
108
-
77
+ measureRow = _children[0],
78
+ rows = _children[1];
109
79
  if (!Array.isArray(rows)) {
110
80
  return [children, 0, 0];
111
81
  }
112
-
113
82
  if (range === null) {
114
83
  return [measureRow, 0, 0];
115
84
  }
116
-
117
85
  var list = [];
118
86
  var max = rows.length - 1;
119
87
  var start = range.start,
120
- end = range.end;
121
-
88
+ end = range.end;
122
89
  if (end > max) {
123
90
  end = max;
124
91
  }
125
-
126
92
  for (var i = start; i <= end; i += 1) {
127
93
  list.push(rows[i]);
128
94
  }
129
-
130
95
  return [[measureRow, list], start * rowHeight, (max - end) * rowHeight];
131
96
  }, [children, range]);
132
97
  useEffect(function () {
133
98
  var _ref$current;
134
-
135
99
  if (ref.current === null) {
136
100
  return;
137
101
  }
138
-
139
102
  var tableBody = (_ref$current = ref.current) === null || _ref$current === void 0 ? void 0 : _ref$current.closest('.ant-table-body');
140
-
141
103
  if (tableBody === null) {
142
104
  return;
143
105
  }
144
-
145
106
  tableBody.addEventListener('scroll', handleScroll);
146
107
  return function () {
147
108
  tableBody.removeEventListener('scroll', handleScroll);
@@ -1,4 +1,5 @@
1
1
  /// <reference path="../../typings.d.ts" />
2
+ /// <reference types="react" />
2
3
  import { Table as AntdTable } from 'antd';
3
4
  import type { BaseTableProps } from './typings';
4
5
  interface BaseTableType {