@lemon-fe/components 0.1.78 → 0.1.82

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 (115) hide show
  1. package/es/BaseTable/index.less +1 -1
  2. package/es/ColorPicker/index.less +47 -0
  3. package/es/MainFramework/components/Menu/index.less +0 -407
  4. package/es/Table/typings.d.ts +0 -1
  5. package/es/index.less +1 -0
  6. package/package.json +5 -2
  7. package/es/Actions/index.d.ts +0 -26
  8. package/es/Actions/index.js +0 -171
  9. package/es/BaseTable/Actions.d.ts +0 -8
  10. package/es/BaseTable/Actions.js +0 -136
  11. package/es/BaseTable/BaseTableContext.d.ts +0 -6
  12. package/es/BaseTable/BaseTableContext.js +0 -6
  13. package/es/BaseTable/ResizeHeaderCell.d.ts +0 -8
  14. package/es/BaseTable/ResizeHeaderCell.js +0 -126
  15. package/es/BaseTable/VirtualBody.d.ts +0 -8
  16. package/es/BaseTable/VirtualBody.js +0 -165
  17. package/es/BaseTable/index.d.ts +0 -7
  18. package/es/BaseTable/index.js +0 -465
  19. package/es/BaseTable/utils.d.ts +0 -4
  20. package/es/BaseTable/utils.js +0 -26
  21. package/es/Dropdown/index.d.ts +0 -14
  22. package/es/Dropdown/index.js +0 -53
  23. package/es/DurationPicker/index.d.ts +0 -25
  24. package/es/DurationPicker/index.js +0 -237
  25. package/es/EditableTable/EditableCell.d.ts +0 -11
  26. package/es/EditableTable/EditableCell.js +0 -37
  27. package/es/EditableTable/EditableTableFormItem.d.ts +0 -5
  28. package/es/EditableTable/EditableTableFormItem.js +0 -49
  29. package/es/EditableTable/Table.d.ts +0 -7
  30. package/es/EditableTable/Table.js +0 -363
  31. package/es/EditableTable/index.d.ts +0 -9
  32. package/es/EditableTable/index.js +0 -8
  33. package/es/EditableTable/util.d.ts +0 -25
  34. package/es/EditableTable/util.js +0 -387
  35. package/es/Filter/index.d.ts +0 -7
  36. package/es/Filter/index.js +0 -610
  37. package/es/FormHorizontal/index.d.ts +0 -6
  38. package/es/FormHorizontal/index.js +0 -35
  39. package/es/FormInline/index.d.ts +0 -15
  40. package/es/FormInline/index.js +0 -90
  41. package/es/FormLayout/index.d.ts +0 -32
  42. package/es/FormLayout/index.js +0 -41
  43. package/es/FormTable/index.d.ts +0 -6
  44. package/es/FormTable/index.js +0 -159
  45. package/es/Icons/BigTip/index.d.ts +0 -6
  46. package/es/Icons/BigTip/index.js +0 -50
  47. package/es/Icons/Calendar.d.ts +0 -5
  48. package/es/Icons/Calendar.js +0 -47
  49. package/es/Icons/CollapseUp.d.ts +0 -5
  50. package/es/Icons/CollapseUp.js +0 -31
  51. package/es/Icons/DarkSearch.d.ts +0 -5
  52. package/es/Icons/DarkSearch.js +0 -38
  53. package/es/Icons/Down.d.ts +0 -5
  54. package/es/Icons/Down.js +0 -35
  55. package/es/Icons/Empty.d.ts +0 -2
  56. package/es/Icons/Empty.js +0 -267
  57. package/es/Icons/LookUp.d.ts +0 -5
  58. package/es/Icons/LookUp.js +0 -74
  59. package/es/Icons/More.d.ts +0 -5
  60. package/es/Icons/More.js +0 -44
  61. package/es/Icons/Search.d.ts +0 -5
  62. package/es/Icons/Search.js +0 -35
  63. package/es/Icons/Tip.d.ts +0 -6
  64. package/es/Icons/Tip.js +0 -169
  65. package/es/Icons/index.d.ts +0 -22
  66. package/es/Icons/index.js +0 -23
  67. package/es/InputMaxLength/index.d.ts +0 -14
  68. package/es/InputMaxLength/index.js +0 -92
  69. package/es/Layout/index.d.ts +0 -41
  70. package/es/Layout/index.js +0 -175
  71. package/es/MainFramework/components/DropMenu/index.d.ts +0 -10
  72. package/es/MainFramework/components/DropMenu/index.js +0 -104
  73. package/es/MainFramework/components/Menu/index.d.ts +0 -9
  74. package/es/MainFramework/components/Menu/index.js +0 -656
  75. package/es/MainFramework/components/RefreshButton/index.d.ts +0 -5
  76. package/es/MainFramework/components/RefreshButton/index.js +0 -72
  77. package/es/MainFramework/components/RefreshButton/index.less +0 -30
  78. package/es/MainFramework/components/TabBar/index.d.ts +0 -9
  79. package/es/MainFramework/components/TabBar/index.js +0 -116
  80. package/es/MainFramework/index.d.ts +0 -24
  81. package/es/MainFramework/index.js +0 -66
  82. package/es/PageLoading/index.d.ts +0 -5
  83. package/es/PageLoading/index.js +0 -15
  84. package/es/Popup/index.d.ts +0 -37
  85. package/es/Popup/index.js +0 -198
  86. package/es/Portal/index.d.ts +0 -12
  87. package/es/Portal/index.js +0 -72
  88. package/es/Section/TabBar.d.ts +0 -12
  89. package/es/Section/TabBar.js +0 -48
  90. package/es/Section/index.d.ts +0 -54
  91. package/es/Section/index.js +0 -96
  92. package/es/SelectView/index.d.ts +0 -53
  93. package/es/SelectView/index.js +0 -257
  94. package/es/SiderTree/TreeNodeTitle.d.ts +0 -8
  95. package/es/SiderTree/TreeNodeTitle.js +0 -107
  96. package/es/SiderTree/index.d.ts +0 -37
  97. package/es/SiderTree/index.js +0 -221
  98. package/es/SymbolIcon/index.d.ts +0 -8
  99. package/es/SymbolIcon/index.js +0 -32
  100. package/es/TabBar/index.d.ts +0 -14
  101. package/es/TabBar/index.js +0 -52
  102. package/es/Table/index.d.ts +0 -2
  103. package/es/Table/index.js +0 -236
  104. package/es/Table/utils.d.ts +0 -2
  105. package/es/Table/utils.js +0 -3
  106. package/es/TipMark/index.d.ts +0 -10
  107. package/es/TipMark/index.js +0 -45
  108. package/es/constants.d.ts +0 -1
  109. package/es/constants.js +0 -1
  110. package/es/index.d.ts +0 -31
  111. package/es/index.js +0 -26
  112. package/es/init.d.ts +0 -3
  113. package/es/init.js +0 -135
  114. package/es/utils.d.ts +0 -2
  115. package/es/utils.js +0 -14
@@ -1,465 +0,0 @@
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
-
4
- function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); }
5
-
6
- 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
- function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter); }
9
-
10
- function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); }
11
-
12
- 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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
15
-
16
- 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
- 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
- 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
- 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
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
25
-
26
- 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
- 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
- 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
- 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
- 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
- /// <reference path="../../typings.d.ts" />
37
- import React, { useMemo, useState, useEffect, useRef } from 'react';
38
- import { Table as AntdTable } from 'antd';
39
- import classNames from 'classnames';
40
- import { get } from 'lodash';
41
- import ResizeObserver from 'rc-resize-observer';
42
- import { isColumnType, getColumnKey } from './utils';
43
- import ResizeHeaderCell from './ResizeHeaderCell';
44
- import { PREFIX_CLS } from '../constants';
45
- import VirtualList from './VirtualBody';
46
- import BaseTableContext from './BaseTableContext';
47
- import Actions from './Actions';
48
- import empty from './empty.png';
49
-
50
- function formatSummary(summary) {
51
- if (!summary) {
52
- return summary;
53
- }
54
-
55
- var obj = _objectSpread({}, summary);
56
-
57
- var pretty = new Intl.NumberFormat('en-US', {
58
- minimumFractionDigits: 2,
59
- maximumFractionDigits: 2
60
- });
61
- Object.keys(obj).forEach(function (key) {
62
- if (obj.hasOwnProperty(key) && typeof obj[key] === 'number') {
63
- obj[key] = pretty.format(obj[key]);
64
- }
65
- });
66
- return obj;
67
- }
68
-
69
- function Th(props) {
70
- 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
-
77
- var reg = /\bant-table-cell-ellipsis\b/;
78
- var content = children;
79
- var mClassName = className;
80
-
81
- if (mClassName && reg.test(mClassName)) {
82
- mClassName = mClassName.replace(reg, '');
83
- content = /*#__PURE__*/React.createElement("div", {
84
- className: "ant-table-cell-ellipsis"
85
- }, content);
86
- }
87
-
88
- if (!width || !onWidthChange) {
89
- return /*#__PURE__*/React.createElement("th", _objectSpread(_objectSpread({}, restProps), {}, {
90
- className: mClassName
91
- }), content);
92
- }
93
-
94
- return /*#__PURE__*/React.createElement(ResizeHeaderCell, {
95
- width: width,
96
- onChange: onWidthChange,
97
- fullTableRef: fullTableRef,
98
- prefixCls: "".concat(PREFIX_CLS, "-table")
99
- }, /*#__PURE__*/React.createElement("th", _objectSpread(_objectSpread({}, restProps), {}, {
100
- className: mClassName
101
- }), content));
102
- }
103
-
104
- function BaseTable(props) {
105
- 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
-
129
- var fullTableRef = useRef(null);
130
-
131
- var _useState = useState(new Map()),
132
- _useState2 = _slicedToArray(_useState, 2),
133
- colsState = _useState2[0],
134
- setColsState = _useState2[1];
135
-
136
- var scrollYProp = scroll === null || scroll === void 0 ? void 0 : scroll.y;
137
-
138
- var _useState3 = useState(scrollYProp === true ? 0 : scrollYProp),
139
- _useState4 = _slicedToArray(_useState3, 2),
140
- scrollY = _useState4[0],
141
- setScrollY = _useState4[1];
142
-
143
- var memoHeight = useRef(0);
144
- /** auto scroll y */
145
-
146
- var calcScrollY = function calcScrollY() {
147
- var wrapper = fullTableRef.current;
148
-
149
- if (wrapper === null) {
150
- return null;
151
- }
152
-
153
- var table = wrapper.querySelector('.ant-table');
154
- var tableBody = wrapper.querySelector('.ant-table-body');
155
-
156
- if (tableBody === null || table === null) {
157
- return null;
158
- }
159
-
160
- var parent = wrapper.parentElement;
161
-
162
- if (parent === null) {
163
- return null;
164
- }
165
-
166
- var style = getComputedStyle(parent);
167
- var contentHeight = parent.offsetHeight - (parseFloat(style.getPropertyValue('padding-top')) || 0) - (parseFloat(style.getPropertyValue('padding-bottom')) || 0);
168
- var nodes = [];
169
-
170
- if (tableBody.previousElementSibling !== null) {
171
- nodes.push(tableBody.previousElementSibling);
172
- }
173
-
174
- if (tableBody.nextElementSibling !== null) {
175
- nodes.push(tableBody.nextElementSibling);
176
- }
177
-
178
- if (table.nextElementSibling !== null) {
179
- nodes.push(table.nextElementSibling);
180
- }
181
-
182
- contentHeight -= nodes.reduce(function (prev, dom) {
183
- var cpStyle = window.getComputedStyle(dom);
184
- var height = dom.offsetHeight + (parseFloat(cpStyle.getPropertyValue('margin-top')) || 0) + (parseFloat(cpStyle.getPropertyValue('margin-bottom')) || 0);
185
- return prev + height;
186
- }, 0);
187
- return contentHeight;
188
- };
189
-
190
- var changeScrollY = function changeScrollY(height) {
191
- if (height === memoHeight.current) {
192
- return;
193
- }
194
-
195
- memoHeight.current = height;
196
-
197
- if (memoHeight.current === 0) {
198
- return;
199
- }
200
-
201
- setScrollY(calcScrollY() || undefined);
202
- };
203
-
204
- var hasPagination = false;
205
-
206
- if (paginationProp !== false) {
207
- hasPagination = paginationProp !== undefined && !!paginationProp.total || dataSource.length > 0;
208
- }
209
-
210
- useEffect(function () {
211
- if (scrollYProp === true) {
212
- setScrollY(calcScrollY() || 0);
213
- }
214
- }, [hasPagination]);
215
- useEffect(function () {
216
- if (scrollYProp !== true) {
217
- setScrollY(scrollYProp);
218
- }
219
- }, [scrollYProp]);
220
- useEffect(function () {
221
- if (scrollY !== undefined && fullTableRef.current !== null) {
222
- var body = fullTableRef.current.querySelector('.ant-table-body');
223
-
224
- if (body !== null) {
225
- var dataType = _typeof(scrollY);
226
-
227
- switch (dataType) {
228
- case 'string':
229
- body.style.height = scrollY;
230
- break;
231
-
232
- case 'number':
233
- body.style.height = scrollY + 'px';
234
- break;
235
-
236
- default:
237
- body.style.height = 'auto';
238
- }
239
- }
240
- }
241
- }, [scrollY]);
242
- /** resizable column */
243
-
244
- 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;
270
- }
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;
280
- }
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
296
- });
297
- var next = new Map(prev);
298
- next.set(colKey, prevItem);
299
- return next;
300
- });
301
- }
302
- };
303
- };
304
- }
305
-
306
- flattenCols.push(nextCol);
307
- return nextCol;
308
- }
309
-
310
- return _objectSpread(_objectSpread(_objectSpread({}, defaultColumnProps), col), {}, {
311
- children: traverse(col.children, currPath)
312
- });
313
- });
314
- };
315
-
316
- var newColumns = traverse(columns);
317
-
318
- if (isFixedLayout && !hasAutoWidthCol) {
319
- newColumns.push({
320
- title: ''
321
- });
322
- }
323
-
324
- return [newColumns, flattenCols];
325
- }, [columns, colsState, tableLayout]),
326
- _useMemo2 = _slicedToArray(_useMemo, 2),
327
- formatedColumns = _useMemo2[0],
328
- flattenColumns = _useMemo2[1];
329
- /** row actions */
330
-
331
-
332
- var _useMemo3 = useMemo(function () {
333
- if (rowActions !== undefined) {
334
- var actionCol = {
335
- title: '',
336
- className: "".concat(PREFIX_CLS, "-table-operator-column"),
337
- width: 1,
338
- fixed: 'right',
339
- render: function render(_, row, index) {
340
- return /*#__PURE__*/React.createElement(Actions, {
341
- actions: rowActions,
342
- row: row,
343
- index: index
344
- });
345
- }
346
- };
347
- return [[].concat(_toConsumableArray(formatedColumns), [actionCol]), [].concat(_toConsumableArray(flattenColumns), [actionCol])];
348
- }
349
-
350
- return [formatedColumns, flattenColumns];
351
- }, [rowActions, flattenColumns, formatedColumns]);
352
-
353
- var _useMemo4 = _slicedToArray(_useMemo3, 2);
354
-
355
- formatedColumns = _useMemo4[0];
356
- flattenColumns = _useMemo4[1];
357
-
358
- /** virtualize scroll */
359
- var _useMemo5 = useMemo(function () {
360
- return {
361
- components: _objectSpread({
362
- header: {
363
- cell: Th
364
- },
365
- body: virtual ? {
366
- wrapper: VirtualList
367
- } : undefined
368
- }, componentsProp)
369
- };
370
- }, [virtual]),
371
- components = _useMemo5.components;
372
- /** summary row */
373
-
374
-
375
- var summary = useMemo(function () {
376
- var Summary = AntdTable.Summary;
377
-
378
- if (!summaryRecord) {
379
- return undefined;
380
- }
381
-
382
- return function () {
383
- var _props$rowSelection;
384
-
385
- var data = formatSummary(summaryRecord);
386
- var offset = 0;
387
- return /*#__PURE__*/React.createElement(Summary, {
388
- fixed: true
389
- }, /*#__PURE__*/React.createElement(Summary.Row, null, ((_props$rowSelection = props.rowSelection) === null || _props$rowSelection === void 0 ? void 0 : _props$rowSelection.type) !== undefined && /*#__PURE__*/React.createElement(Summary.Cell, {
390
- index: offset++
391
- }), flattenColumns.map(function (item, index) {
392
- var value;
393
-
394
- if (index === 0) {
395
- value = summaryTitle;
396
- } else if (item.dataIndex) {
397
- value = get(data, item.dataIndex);
398
- }
399
-
400
- return /*#__PURE__*/React.createElement(Summary.Cell, {
401
- index: index + offset,
402
- key: getColumnKey(item) || index,
403
- align: item.align
404
- }, value);
405
- })));
406
- };
407
- }, [flattenColumns, summaryRecord, summaryTitle]);
408
- var ctx = useMemo(function () {
409
- return {
410
- scrollY: scrollY,
411
- rowHeight: rowHeight
412
- };
413
- }, [scrollY, rowHeight]);
414
- var tableNode = /*#__PURE__*/React.createElement(AntdTable, _objectSpread(_objectSpread({
415
- size: "small",
416
- ref: fullTableRef,
417
- className: classNames("".concat(PREFIX_CLS, "-table"), className),
418
- columns: formatedColumns,
419
- dataSource: dataSource,
420
- rowKey: rowKey,
421
- summary: summary,
422
- components: components,
423
- tableLayout: tableLayout,
424
- scroll: {
425
- x: (scroll === null || scroll === void 0 ? void 0 : scroll.x) || '100%',
426
- y: scrollY
427
- },
428
- style: scrollYProp === true ? _objectSpread(_objectSpread({}, style), {}, {
429
- height: '100%'
430
- }) : style,
431
- locale: _objectSpread({
432
- emptyText: /*#__PURE__*/React.createElement("div", {
433
- className: "".concat(PREFIX_CLS, "-table-empty")
434
- }, /*#__PURE__*/React.createElement("img", {
435
- src: empty
436
- }), /*#__PURE__*/React.createElement("div", null, "\u6682\u65E0\u6570\u636E"))
437
- }, localeProp)
438
- }, restProps), {}, {
439
- pagination: paginationProp !== false ? _objectSpread({
440
- size: 'small',
441
- pageSizeOptions: ['10', '20', '50', '100'],
442
- showSizeChanger: true,
443
- showQuickJumper: true,
444
- showTotal: function showTotal(val) {
445
- return "\u5171".concat(val, "\u6761");
446
- },
447
- defaultPageSize: 20
448
- }, paginationProp) : false
449
- }));
450
-
451
- if (scrollYProp === true) {
452
- tableNode = /*#__PURE__*/React.createElement(ResizeObserver, {
453
- onResize: function onResize(size) {
454
- changeScrollY(size.height);
455
- }
456
- }, tableNode);
457
- }
458
-
459
- return /*#__PURE__*/React.createElement(BaseTableContext.Provider, {
460
- value: ctx
461
- }, tableNode);
462
- }
463
-
464
- BaseTable.Summary = AntdTable.Summary;
465
- export default BaseTable;
@@ -1,4 +0,0 @@
1
- import { ColumnType, ColumnGroupType } from './typings';
2
- export declare function isColumnType<T>(col: ColumnGroupType<T> | ColumnType<T>): col is ColumnType<T>;
3
- export declare function getColumnKey(col: ColumnType<any>): string | number;
4
- export declare function randomStr(): string;
@@ -1,26 +0,0 @@
1
- export function isColumnType(col) {
2
- return col.children === undefined;
3
- }
4
- export function getColumnKey(col) {
5
- if (typeof col.dataIndex === 'string' || typeof col.dataIndex === 'number') {
6
- return col.dataIndex;
7
- }
8
-
9
- if (Array.isArray(col.dataIndex)) {
10
- return col.dataIndex.join('-');
11
- }
12
-
13
- return col.key;
14
- }
15
- export function randomStr() {
16
- var len = 8;
17
- var chars = 'ABCDEFGHJKMNPQRSTWXYZabcdefhijkmnprstwxyz';
18
- var maxPos = chars.length;
19
- var pwd = '';
20
-
21
- for (var i = 0; i < len; i += 1) {
22
- pwd += chars.charAt(Math.floor(Math.random() * maxPos));
23
- }
24
-
25
- return pwd;
26
- }
@@ -1,14 +0,0 @@
1
- import type { PopoverProps } from 'antd';
2
- import type { ReactElement } from 'react';
3
- interface Props {
4
- actions: ({
5
- text: string | ReactElement;
6
- onClick: () => void;
7
- disabled?: boolean;
8
- } | null)[];
9
- overlayClassName?: string;
10
- placement?: PopoverProps['placement'];
11
- children?: ReactElement | null;
12
- }
13
- export default function Dropdown(props: Props): JSX.Element;
14
- export {};
@@ -1,53 +0,0 @@
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
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
4
-
5
- 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
- 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
- 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
- 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
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
-
15
- import { Popover } from 'antd';
16
- import React, { useState } from 'react';
17
- import classNames from 'classnames';
18
- import { PREFIX_CLS } from '../constants';
19
- export default function Dropdown(props) {
20
- var actions = props.actions,
21
- overlayClassName = props.overlayClassName,
22
- _props$placement = props.placement,
23
- placement = _props$placement === void 0 ? 'bottomRight' : _props$placement,
24
- children = props.children;
25
-
26
- var _useState = useState(false),
27
- _useState2 = _slicedToArray(_useState, 2),
28
- visible = _useState2[0],
29
- setVisible = _useState2[1];
30
-
31
- var prefixCls = "".concat(PREFIX_CLS, "-dropdown");
32
- return /*#__PURE__*/React.createElement(Popover, {
33
- trigger: "click",
34
- placement: placement,
35
- visible: visible,
36
- onVisibleChange: setVisible,
37
- overlayClassName: classNames(prefixCls, overlayClassName),
38
- content: actions.map(function (item, index) {
39
- return item !== null && /*#__PURE__*/React.createElement("div", {
40
- className: classNames("".concat(prefixCls, "-item"), _defineProperty({}, "".concat(prefixCls, "-item-disabled"), item.disabled)),
41
- key: index,
42
- onClick: function onClick() {
43
- if (item.disabled) {
44
- return;
45
- }
46
-
47
- setVisible(false);
48
- item.onClick();
49
- }
50
- }, item.text);
51
- })
52
- }, children);
53
- }
@@ -1,25 +0,0 @@
1
- import type { Moment } from 'moment';
2
- import type { RangePickerProps } from 'antd/lib/date-picker';
3
- declare type Value = {
4
- type: string;
5
- option: string;
6
- dates?: [string, string];
7
- };
8
- declare type DateType = {
9
- label: string;
10
- value: string;
11
- };
12
- declare type Option = {
13
- label: string;
14
- value: (() => [Moment, Moment]) | null;
15
- };
16
- interface Props extends Omit<RangePickerProps, 'value' | 'onChange'> {
17
- prefixCls?: string;
18
- types: DateType[];
19
- options?: Option[];
20
- dateFormat?: string;
21
- value?: Value;
22
- onChange?: (value: Value) => void;
23
- }
24
- export default function DurationPicker(props: Props): JSX.Element;
25
- export {};