@dtjoy/dt-design 1.1.0 → 1.1.2

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 (152) hide show
  1. package/README.md +141 -141
  2. package/esm/blockHeader/index.js +17 -7
  3. package/esm/index.js +9 -1
  4. package/lib/blockHeader/index.js +15 -6
  5. package/lib/index.js +1 -9
  6. package/package.json +2 -4
  7. package/esm/_util/easings.d.ts +0 -1
  8. package/esm/_util/extendsObject.d.ts +0 -4
  9. package/esm/_util/gapSize.d.ts +0 -3
  10. package/esm/_util/getScroll.d.ts +0 -3
  11. package/esm/_util/hooks/index.d.ts +0 -4
  12. package/esm/_util/hooks/useForceUpdate.d.ts +0 -2
  13. package/esm/_util/hooks/useOrientation.d.ts +0 -2
  14. package/esm/_util/hooks/useProxyImperativeHandle.d.ts +0 -4
  15. package/esm/_util/hooks/useSyncState.d.ts +0 -3
  16. package/esm/_util/index.d.ts +0 -3
  17. package/esm/_util/isNonNullable.d.ts +0 -2
  18. package/esm/_util/scrollTo.d.ts +0 -10
  19. package/esm/_util/type.d.ts +0 -52
  20. package/esm/_util/warning.d.ts +0 -31
  21. package/esm/blockHeader/index.d.ts +0 -55
  22. package/esm/blockHeader/style/index.d.ts +0 -2
  23. package/esm/button/index.d.ts +0 -10
  24. package/esm/button/style/index.d.ts +0 -2
  25. package/esm/collapsible/index.d.ts +0 -102
  26. package/esm/collapsible/style/index.d.ts +0 -1
  27. package/esm/collapsibleActionItems/index.d.ts +0 -24
  28. package/esm/collapsibleActionItems/style/index.d.ts +0 -2
  29. package/esm/flex/index.d.ts +0 -7
  30. package/esm/flex/interface.d.ts +0 -16
  31. package/esm/flex/style/index.d.ts +0 -2
  32. package/esm/flex/utils.d.ts +0 -7
  33. package/esm/formList/index.d.ts +0 -78
  34. package/esm/formList/style/index.d.ts +0 -2
  35. package/esm/index.d.ts +0 -17
  36. package/esm/overflowList/index.d.ts +0 -40
  37. package/esm/overflowList/style/index.d.ts +0 -2
  38. package/esm/resize/index.d.ts +0 -9
  39. package/esm/resizeObserver/index.d.ts +0 -45
  40. package/esm/splitter/Panel.d.ts +0 -7
  41. package/esm/splitter/SplitBar.d.ts +0 -24
  42. package/esm/splitter/Splitter.d.ts +0 -5
  43. package/esm/splitter/hooks/sizeUtil.d.ts +0 -3
  44. package/esm/splitter/hooks/useItems.d.ts +0 -14
  45. package/esm/splitter/hooks/useResizable.d.ts +0 -10
  46. package/esm/splitter/hooks/useResize.d.ts +0 -6
  47. package/esm/splitter/hooks/useSizes.d.ts +0 -4
  48. package/esm/splitter/index.d.ts +0 -8
  49. package/esm/splitter/interface.d.ts +0 -69
  50. package/esm/splitter/style/index.d.ts +0 -2
  51. package/esm/statusTag/index.d.ts +0 -29
  52. package/esm/statusTag/style/index.d.ts +0 -2
  53. package/esm/style/index.d.ts +0 -1
  54. package/esm/table/InternalTable.d.ts +0 -32
  55. package/esm/table/InternalTable.js +0 -429
  56. package/esm/table/RcTable/VirtualTable.d.ts +0 -2
  57. package/esm/table/RcTable/VirtualTable.js +0 -9
  58. package/esm/table/RcTable/index.d.ts +0 -2
  59. package/esm/table/RcTable/index.js +0 -9
  60. package/esm/table/Table.d.ts +0 -17
  61. package/esm/table/Table.js +0 -28
  62. package/esm/table/TableMeasureRowContext.d.ts +0 -3
  63. package/esm/table/TableMeasureRowContext.js +0 -3
  64. package/esm/table/hooks/useContainerWidth.d.ts +0 -1
  65. package/esm/table/hooks/useContainerWidth.js +0 -14
  66. package/esm/table/index.d.ts +0 -7
  67. package/esm/table/index.js +0 -2
  68. package/esm/table/interface.d.ts +0 -196
  69. package/esm/table/interface.js +0 -4
  70. package/esm/table/style/bordered.less +0 -141
  71. package/esm/table/style/fixed.less +0 -88
  72. package/esm/table/style/index.d.ts +0 -2
  73. package/esm/table/style/index.js +0 -2
  74. package/esm/table/style/index.less +0 -150
  75. package/esm/table/style/selection.less +0 -90
  76. package/esm/table/style/sticky.less +0 -55
  77. package/esm/table/style/virtual.less +0 -65
  78. package/esm/table/util.d.ts +0 -14
  79. package/esm/table/util.js +0 -33
  80. package/lib/_util/easings.d.ts +0 -1
  81. package/lib/_util/extendsObject.d.ts +0 -4
  82. package/lib/_util/gapSize.d.ts +0 -3
  83. package/lib/_util/getScroll.d.ts +0 -3
  84. package/lib/_util/hooks/index.d.ts +0 -4
  85. package/lib/_util/hooks/useForceUpdate.d.ts +0 -2
  86. package/lib/_util/hooks/useOrientation.d.ts +0 -2
  87. package/lib/_util/hooks/useProxyImperativeHandle.d.ts +0 -4
  88. package/lib/_util/hooks/useSyncState.d.ts +0 -3
  89. package/lib/_util/index.d.ts +0 -3
  90. package/lib/_util/isNonNullable.d.ts +0 -2
  91. package/lib/_util/scrollTo.d.ts +0 -10
  92. package/lib/_util/type.d.ts +0 -52
  93. package/lib/_util/warning.d.ts +0 -31
  94. package/lib/blockHeader/index.d.ts +0 -55
  95. package/lib/blockHeader/style/index.d.ts +0 -2
  96. package/lib/button/index.d.ts +0 -10
  97. package/lib/button/style/index.d.ts +0 -2
  98. package/lib/collapsible/index.d.ts +0 -102
  99. package/lib/collapsible/style/index.d.ts +0 -1
  100. package/lib/collapsibleActionItems/index.d.ts +0 -24
  101. package/lib/collapsibleActionItems/style/index.d.ts +0 -2
  102. package/lib/flex/index.d.ts +0 -7
  103. package/lib/flex/interface.d.ts +0 -16
  104. package/lib/flex/style/index.d.ts +0 -2
  105. package/lib/flex/utils.d.ts +0 -7
  106. package/lib/formList/index.d.ts +0 -78
  107. package/lib/formList/style/index.d.ts +0 -2
  108. package/lib/index.d.ts +0 -17
  109. package/lib/overflowList/index.d.ts +0 -40
  110. package/lib/overflowList/style/index.d.ts +0 -2
  111. package/lib/resize/index.d.ts +0 -9
  112. package/lib/resizeObserver/index.d.ts +0 -45
  113. package/lib/splitter/Panel.d.ts +0 -7
  114. package/lib/splitter/SplitBar.d.ts +0 -24
  115. package/lib/splitter/Splitter.d.ts +0 -5
  116. package/lib/splitter/hooks/sizeUtil.d.ts +0 -3
  117. package/lib/splitter/hooks/useItems.d.ts +0 -14
  118. package/lib/splitter/hooks/useResizable.d.ts +0 -10
  119. package/lib/splitter/hooks/useResize.d.ts +0 -6
  120. package/lib/splitter/hooks/useSizes.d.ts +0 -4
  121. package/lib/splitter/index.d.ts +0 -8
  122. package/lib/splitter/interface.d.ts +0 -69
  123. package/lib/splitter/style/index.d.ts +0 -2
  124. package/lib/statusTag/index.d.ts +0 -29
  125. package/lib/statusTag/style/index.d.ts +0 -2
  126. package/lib/style/index.d.ts +0 -1
  127. package/lib/table/InternalTable.d.ts +0 -32
  128. package/lib/table/InternalTable.js +0 -395
  129. package/lib/table/RcTable/VirtualTable.d.ts +0 -2
  130. package/lib/table/RcTable/VirtualTable.js +0 -17
  131. package/lib/table/RcTable/index.d.ts +0 -2
  132. package/lib/table/RcTable/index.js +0 -17
  133. package/lib/table/Table.d.ts +0 -17
  134. package/lib/table/Table.js +0 -37
  135. package/lib/table/TableMeasureRowContext.d.ts +0 -3
  136. package/lib/table/TableMeasureRowContext.js +0 -10
  137. package/lib/table/hooks/useContainerWidth.d.ts +0 -1
  138. package/lib/table/hooks/useContainerWidth.js +0 -20
  139. package/lib/table/index.d.ts +0 -7
  140. package/lib/table/index.js +0 -9
  141. package/lib/table/interface.d.ts +0 -196
  142. package/lib/table/interface.js +0 -8
  143. package/lib/table/style/bordered.less +0 -141
  144. package/lib/table/style/fixed.less +0 -88
  145. package/lib/table/style/index.d.ts +0 -2
  146. package/lib/table/style/index.js +0 -4
  147. package/lib/table/style/index.less +0 -150
  148. package/lib/table/style/selection.less +0 -90
  149. package/lib/table/style/sticky.less +0 -55
  150. package/lib/table/style/virtual.less +0 -65
  151. package/lib/table/util.d.ts +0 -14
  152. package/lib/table/util.js +0 -44
@@ -1,429 +0,0 @@
1
- function _typeof(o) { "@babel/helpers - typeof"; return _typeof = "function" == typeof Symbol && "symbol" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && "function" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? "symbol" : typeof o; }, _typeof(o); }
2
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
3
- function ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }
4
- function _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }
5
- function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
6
- function _toPropertyKey(t) { var i = _toPrimitive(t, "string"); return "symbol" == _typeof(i) ? i : String(i); }
7
- function _toPrimitive(t, r) { if ("object" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || "default"); if ("object" != _typeof(i)) return i; throw new TypeError("@@toPrimitive must return a primitive value."); } return ("string" === r ? String : Number)(t); }
8
- function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
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."); }
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); }
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; }
12
- function _iterableToArrayLimit(r, l) { var t = null == r ? null : "undefined" != typeof Symbol && r[Symbol.iterator] || r["@@iterator"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t.return && (u = t.return(), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }
13
- function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
14
- import React from 'react';
15
- import { INTERNAL_HOOKS } from '@rc-component/table';
16
- import { convertChildrenToColumns } from '@rc-component/table/lib/hooks/useColumns';
17
- import { Pagination, Spin } from 'antd';
18
- import { ConfigContext } from 'antd/lib/config-provider';
19
- import defaultRenderEmpty from 'antd/lib/config-provider/defaultRenderEmpty';
20
- import SizeContext from 'antd/lib/config-provider/SizeContext';
21
- import useBreakpoint from 'antd/lib/grid/hooks/useBreakpoint';
22
- import defaultLocale from 'antd/lib/locale/en_US';
23
- import renderExpandIcon from 'antd/lib/table/ExpandIcon';
24
- import useFilter, { getFilterData } from 'antd/lib/table/hooks/useFilter';
25
- import useLazyKVMap from 'antd/lib/table/hooks/useLazyKVMap';
26
- import usePagination, { DEFAULT_PAGE_SIZE, getPaginationParam } from 'antd/lib/table/hooks/usePagination';
27
- import useSelection from 'antd/lib/table/hooks/useSelection';
28
- import useSorter, { getSortData } from 'antd/lib/table/hooks/useSorter';
29
- import useTitleColumns from 'antd/lib/table/hooks/useTitleColumns';
30
- import clsx from 'clsx';
31
- import { omit } from 'lodash-es';
32
- import "./style";
33
- import { useProxyImperativeHandle } from "../_util/hooks";
34
- import scrollTo from "../_util/scrollTo";
35
- import { devUseWarning } from "../_util/warning";
36
- import useContainerWidth from "./hooks/useContainerWidth";
37
- import RcTable from "./RcTable";
38
- import RcVirtualTable from "./RcTable/VirtualTable";
39
- var EMPTY_LIST = [];
40
- var InternalTable = function InternalTable(props, ref) {
41
- var customizePrefixCls = props.prefixCls,
42
- className = props.className,
43
- style = props.style,
44
- customizeSize = props.size,
45
- bordered = props.bordered,
46
- customizeDropdownPrefixCls = props.dropdownPrefixCls,
47
- dataSource = props.dataSource,
48
- pagination = props.pagination,
49
- rowSelection = props.rowSelection,
50
- _props$rowKey = props.rowKey,
51
- rowKey = _props$rowKey === void 0 ? 'key' : _props$rowKey,
52
- rowClassName = props.rowClassName,
53
- columns = props.columns,
54
- children = props.children,
55
- legacyChildrenColumnName = props.childrenColumnName,
56
- onChange = props.onChange,
57
- getPopupContainer = props.getPopupContainer,
58
- loading = props.loading,
59
- expandIcon = props.expandIcon,
60
- expandable = props.expandable,
61
- expandedRowRender = props.expandedRowRender,
62
- expandIconColumnIndex = props.expandIconColumnIndex,
63
- indentSize = props.indentSize,
64
- scroll = props.scroll,
65
- sortDirections = props.sortDirections,
66
- locale = props.locale,
67
- _props$showSorterTool = props.showSorterTooltip,
68
- showSorterTooltip = _props$showSorterTool === void 0 ? true : _props$showSorterTool,
69
- virtual = props.virtual;
70
- var warning = devUseWarning('Table');
71
- warning(!(typeof rowKey === 'function' && rowKey.length > 1), 'usage', '`index` parameter of `rowKey` function is deprecated. There is no guarantee that it will work as expected.');
72
- [['filterDropdownVisible', 'filterDropdownOpen'], ['onFilterDropdownVisibleChange', 'onFilterDropdownOpenChange']].forEach(function (_ref) {
73
- var _ref2 = _slicedToArray(_ref, 2),
74
- deprecatedName = _ref2[0],
75
- newName = _ref2[1];
76
- warning(!(deprecatedName in props), 'usage', "`".concat(deprecatedName, "` is deprecated which will be removed in next major version.Please use `").concat(newName, "` instead. "));
77
- });
78
- var baseColumns = React.useMemo(function () {
79
- return columns || convertChildrenToColumns(children);
80
- }, [columns, children]);
81
- var needResponsive = React.useMemo(function () {
82
- return baseColumns.some(function (col) {
83
- return col.responsive;
84
- });
85
- }, [baseColumns]);
86
- var screens = useBreakpoint(needResponsive);
87
- var mergedColumns = React.useMemo(function () {
88
- var matched = new Set(Object.keys(screens).filter(function (m) {
89
- return screens[m];
90
- }));
91
- return baseColumns.filter(function (c) {
92
- return !c.responsive || c.responsive.some(function (r) {
93
- return matched.has(r);
94
- });
95
- });
96
- }, [baseColumns, screens]);
97
- var tableProps = omit(props, ['className', 'style', 'columns']);
98
- var size = React.useContext(SizeContext);
99
- var _React$useContext = React.useContext(ConfigContext),
100
- _React$useContext$loc = _React$useContext.locale,
101
- contextLocale = _React$useContext$loc === void 0 ? defaultLocale : _React$useContext$loc,
102
- renderEmpty = _React$useContext.renderEmpty,
103
- direction = _React$useContext.direction;
104
- var mergedSize = customizeSize || size;
105
- var tableLocale = _objectSpread(_objectSpread({}, contextLocale.Table), locale);
106
- var rawData = dataSource || EMPTY_LIST;
107
- var _React$useContext2 = React.useContext(ConfigContext),
108
- getPrefixCls = _React$useContext2.getPrefixCls;
109
- var prefixCls = getPrefixCls('table', customizePrefixCls);
110
- var dropdownPrefixCls = getPrefixCls('dropdown', customizeDropdownPrefixCls);
111
- var mergedExpandable = _objectSpread({
112
- childrenColumnName: legacyChildrenColumnName,
113
- expandIconColumnIndex: expandIconColumnIndex
114
- }, expandable);
115
- var _mergedExpandable$chi = mergedExpandable.childrenColumnName,
116
- childrenColumnName = _mergedExpandable$chi === void 0 ? 'children' : _mergedExpandable$chi;
117
- var expandType = React.useMemo(function () {
118
- if (rawData.some(function (item) {
119
- return item === null || item === void 0 ? void 0 : item[childrenColumnName];
120
- })) {
121
- return 'nest';
122
- }
123
- if (expandedRowRender || expandable && expandable.expandedRowRender) {
124
- return 'row';
125
- }
126
- return null;
127
- }, [rawData]);
128
- var internalRefs = {
129
- body: React.useRef(null)
130
- };
131
-
132
- // ============================ Width =============================
133
- var getContainerWidth = useContainerWidth(prefixCls);
134
-
135
- // ============================= Refs =============================
136
- var rootRef = React.useRef(null);
137
- var tblRef = React.useRef(null);
138
- useProxyImperativeHandle(ref, function () {
139
- return _objectSpread(_objectSpread({}, tblRef.current), {}, {
140
- nativeElement: rootRef.current
141
- });
142
- });
143
-
144
- // ========================== Render ==========================
145
- var TableComponent = virtual ? RcVirtualTable : RcTable;
146
-
147
- // ============================ RowKey ============================
148
- var getRowKey = React.useMemo(function () {
149
- if (typeof rowKey === 'function') {
150
- return rowKey;
151
- }
152
- return function (record) {
153
- return record === null || record === void 0 ? void 0 : record[rowKey];
154
- };
155
- }, [rowKey]);
156
- var _useLazyKVMap = useLazyKVMap(rawData, childrenColumnName, getRowKey),
157
- _useLazyKVMap2 = _slicedToArray(_useLazyKVMap, 1),
158
- getRecordByKey = _useLazyKVMap2[0];
159
-
160
- // ============================ Events =============================
161
- var changeEventInfo = {};
162
- var triggerOnChange = function triggerOnChange(info, action) {
163
- var reset = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
164
- var changeInfo = _objectSpread(_objectSpread({}, changeEventInfo), info);
165
- if (reset) {
166
- changeEventInfo.resetPagination();
167
-
168
- // Reset event param
169
- if (changeInfo.pagination.current) {
170
- changeInfo.pagination.current = 1;
171
- }
172
-
173
- // Trigger pagination events
174
- if (pagination && pagination.onChange) {
175
- pagination.onChange(1, changeInfo.pagination.pageSize);
176
- }
177
- }
178
- if (scroll && scroll.scrollToFirstRowOnChange !== false && internalRefs.body.current) {
179
- scrollTo(0, {
180
- getContainer: function getContainer() {
181
- return internalRefs.body.current;
182
- }
183
- });
184
- }
185
- onChange === null || onChange === void 0 || onChange(changeInfo.pagination, changeInfo.filters, changeInfo.sorter, {
186
- currentDataSource: getFilterData(getSortData(rawData, changeInfo.sorterStates, childrenColumnName), changeInfo.filterStates),
187
- action: action
188
- });
189
- };
190
-
191
- /**
192
- * Controlled state in `columns` is not a good idea that makes too many code (1000+ line?) to read
193
- * state out and then put it back to title render. Move these code into `hooks` but still too
194
- * complex. We should provides Table props like `sorter` & `filter` to handle control in next big
195
- * version.
196
- */
197
-
198
- // ============================ Sorter =============================
199
- var onSorterChange = function onSorterChange(sorter, sorterStates) {
200
- triggerOnChange({
201
- sorter: sorter,
202
- sorterStates: sorterStates
203
- }, 'sort', false);
204
- };
205
- var _useSorter = useSorter({
206
- prefixCls: prefixCls,
207
- mergedColumns: mergedColumns,
208
- onSorterChange: onSorterChange,
209
- sortDirections: sortDirections || ['ascend', 'descend'],
210
- tableLocale: tableLocale,
211
- showSorterTooltip: showSorterTooltip
212
- }),
213
- _useSorter2 = _slicedToArray(_useSorter, 4),
214
- transformSorterColumns = _useSorter2[0],
215
- sortStates = _useSorter2[1],
216
- sorterTitleProps = _useSorter2[2],
217
- getSorters = _useSorter2[3];
218
- var sortedData = React.useMemo(function () {
219
- return getSortData(rawData, sortStates, childrenColumnName);
220
- }, [rawData, sortStates]);
221
- changeEventInfo.sorter = getSorters();
222
- changeEventInfo.sorterStates = sortStates;
223
-
224
- // ============================ Filter ============================
225
- var onFilterChange = function onFilterChange(filters, filterStates) {
226
- triggerOnChange({
227
- filters: filters,
228
- filterStates: filterStates
229
- }, 'filter', true);
230
- };
231
- var _useFilter = useFilter({
232
- prefixCls: prefixCls,
233
- locale: tableLocale,
234
- dropdownPrefixCls: dropdownPrefixCls,
235
- mergedColumns: mergedColumns,
236
- onFilterChange: onFilterChange,
237
- getPopupContainer: getPopupContainer
238
- }),
239
- _useFilter2 = _slicedToArray(_useFilter, 3),
240
- transformFilterColumns = _useFilter2[0],
241
- filterStates = _useFilter2[1],
242
- filters = _useFilter2[2];
243
- var mergedData = getFilterData(sortedData, filterStates);
244
- changeEventInfo.filters = filters;
245
- changeEventInfo.filterStates = filterStates;
246
-
247
- // ============================ Column ============================
248
- var columnTitleProps = React.useMemo(function () {
249
- var mergedFilters = {};
250
- Object.keys(filters).forEach(function (filterKey) {
251
- if (filters[filterKey] !== null) {
252
- mergedFilters[filterKey] = filters[filterKey];
253
- }
254
- });
255
- return _objectSpread(_objectSpread({}, sorterTitleProps), {}, {
256
- filters: mergedFilters
257
- });
258
- }, [sorterTitleProps, filters]);
259
- var _useTitleColumns = useTitleColumns(columnTitleProps),
260
- _useTitleColumns2 = _slicedToArray(_useTitleColumns, 1),
261
- transformTitleColumns = _useTitleColumns2[0];
262
-
263
- // ========================== Pagination ==========================
264
- var onPaginationChange = function onPaginationChange(current, pageSize) {
265
- triggerOnChange({
266
- pagination: _objectSpread(_objectSpread({}, changeEventInfo.pagination), {}, {
267
- current: current,
268
- pageSize: pageSize
269
- })
270
- }, 'paginate');
271
- };
272
- var _usePagination = usePagination(mergedData.length, pagination, onPaginationChange),
273
- _usePagination2 = _slicedToArray(_usePagination, 2),
274
- mergedPagination = _usePagination2[0],
275
- resetPagination = _usePagination2[1];
276
- changeEventInfo.pagination = pagination === false ? {} : getPaginationParam(pagination, mergedPagination);
277
- changeEventInfo.resetPagination = resetPagination;
278
-
279
- // ============================= Data =============================
280
- var pageData = React.useMemo(function () {
281
- if (pagination === false || !mergedPagination.pageSize) {
282
- return mergedData;
283
- }
284
- var _mergedPagination$cur = mergedPagination.current,
285
- current = _mergedPagination$cur === void 0 ? 1 : _mergedPagination$cur,
286
- total = mergedPagination.total,
287
- _mergedPagination$pag = mergedPagination.pageSize,
288
- pageSize = _mergedPagination$pag === void 0 ? DEFAULT_PAGE_SIZE : _mergedPagination$pag;
289
- warning(current > 0, 'usage', '`current` should be positive number.');
290
-
291
- // Dynamic table data
292
- if (mergedData.length < total) {
293
- if (mergedData.length > pageSize) {
294
- warning(false, 'usage', '`dataSource` length is less than `pagination.total` but large than `pagination.pageSize`. Please make sure your config correct data with async mode.');
295
- return mergedData.slice((current - 1) * pageSize, current * pageSize);
296
- }
297
- return mergedData;
298
- }
299
- return mergedData.slice((current - 1) * pageSize, current * pageSize);
300
- }, [!!pagination, mergedData, mergedPagination && mergedPagination.current, mergedPagination && mergedPagination.pageSize, mergedPagination && mergedPagination.total]);
301
-
302
- // ========================== Selections ==========================
303
- var _useSelection = useSelection(rowSelection, {
304
- prefixCls: prefixCls,
305
- data: mergedData,
306
- pageData: pageData,
307
- getRowKey: getRowKey,
308
- getRecordByKey: getRecordByKey,
309
- expandType: expandType,
310
- childrenColumnName: childrenColumnName,
311
- locale: tableLocale,
312
- getPopupContainer: getPopupContainer
313
- }),
314
- _useSelection2 = _slicedToArray(_useSelection, 2),
315
- transformSelectionColumns = _useSelection2[0],
316
- selectedKeySet = _useSelection2[1];
317
- var internalRowClassName = function internalRowClassName(record, index, indent) {
318
- var mergedRowClassName;
319
- if (typeof rowClassName === 'function') {
320
- mergedRowClassName = clsx(rowClassName(record, index, indent));
321
- } else {
322
- mergedRowClassName = clsx(rowClassName);
323
- }
324
- return clsx(_defineProperty({}, "".concat(prefixCls, "-row-selected"), selectedKeySet.has(getRowKey(record, index))), mergedRowClassName);
325
- };
326
-
327
- // ========================== Expandable ==========================
328
-
329
- // Pass origin render status into `rc-table`, this can be removed when refactor with `rc-table`
330
- mergedExpandable.__PARENT_RENDER_ICON__ = mergedExpandable.expandIcon;
331
-
332
- // Customize expandable icon
333
- mergedExpandable.expandIcon = mergedExpandable.expandIcon || expandIcon || renderExpandIcon(tableLocale);
334
-
335
- // Adjust expand icon index, no overwrite expandIconColumnIndex if set.
336
- if (expandType === 'nest' && mergedExpandable.expandIconColumnIndex === undefined) {
337
- mergedExpandable.expandIconColumnIndex = rowSelection ? 1 : 0;
338
- } else if (mergedExpandable.expandIconColumnIndex > 0 && rowSelection) {
339
- mergedExpandable.expandIconColumnIndex -= 1;
340
- }
341
-
342
- // Indent size
343
- if (typeof mergedExpandable.indentSize !== 'number') {
344
- mergedExpandable.indentSize = typeof indentSize === 'number' ? indentSize : 15;
345
- }
346
-
347
- // ============================ Render ============================
348
- var transformColumns = React.useCallback(function (innerColumns) {
349
- return transformTitleColumns(transformSelectionColumns(transformFilterColumns(transformSorterColumns(innerColumns))));
350
- }, [transformSorterColumns, transformFilterColumns, transformSelectionColumns]);
351
- var topPaginationNode;
352
- var bottomPaginationNode;
353
- if (pagination !== false && mergedPagination !== null && mergedPagination !== void 0 && mergedPagination.total) {
354
- var paginationSize;
355
- if (mergedPagination.size) {
356
- paginationSize = mergedPagination.size;
357
- } else {
358
- paginationSize = mergedSize === 'small' || mergedSize === 'middle' ? 'small' : undefined;
359
- }
360
- var renderPagination = function renderPagination(position) {
361
- return /*#__PURE__*/React.createElement(Pagination, _extends({}, mergedPagination, {
362
- className: clsx("".concat(prefixCls, "-pagination ").concat(prefixCls, "-pagination-").concat(position), mergedPagination.className),
363
- size: paginationSize
364
- }));
365
- };
366
- var defaultPosition = direction === 'rtl' ? 'left' : 'right';
367
- var position = mergedPagination.position;
368
- if (position !== null && Array.isArray(position)) {
369
- var topPos = position.find(function (p) {
370
- return p.includes('top');
371
- });
372
- var bottomPos = position.find(function (p) {
373
- return p.includes('bottom');
374
- });
375
- var isDisable = position.every(function (p) {
376
- return "".concat(p) === 'none';
377
- });
378
- if (!topPos && !bottomPos && !isDisable) {
379
- bottomPaginationNode = renderPagination(defaultPosition);
380
- }
381
- if (topPos) {
382
- topPaginationNode = renderPagination(topPos.toLowerCase().replace('top', ''));
383
- }
384
- if (bottomPos) {
385
- bottomPaginationNode = renderPagination(bottomPos.toLowerCase().replace('bottom', ''));
386
- }
387
- } else {
388
- bottomPaginationNode = renderPagination(defaultPosition);
389
- }
390
- }
391
-
392
- // >>>>>>>>> Spinning
393
- var spinProps;
394
- if (typeof loading === 'boolean') {
395
- spinProps = {
396
- spinning: loading
397
- };
398
- } else if (_typeof(loading) === 'object') {
399
- spinProps = _objectSpread({
400
- spinning: true
401
- }, loading);
402
- }
403
- var wrapperClassNames = clsx("".concat(prefixCls, "-wrapper"), _defineProperty({}, "".concat(prefixCls, "-wrapper-rtl"), direction === 'rtl'), className);
404
- return /*#__PURE__*/React.createElement("div", {
405
- ref: rootRef,
406
- className: wrapperClassNames,
407
- style: style
408
- }, /*#__PURE__*/React.createElement(Spin, _extends({
409
- spinning: false
410
- }, spinProps), topPaginationNode, /*#__PURE__*/React.createElement(TableComponent, _extends({}, tableProps, {
411
- ref: tblRef,
412
- columns: mergedColumns,
413
- direction: direction,
414
- expandable: mergedExpandable,
415
- prefixCls: prefixCls,
416
- className: clsx(_defineProperty(_defineProperty(_defineProperty(_defineProperty({}, "".concat(prefixCls, "-middle"), mergedSize === 'middle'), "".concat(prefixCls, "-small"), mergedSize === 'small'), "".concat(prefixCls, "-bordered"), bordered), "".concat(prefixCls, "-empty"), rawData.length === 0)),
417
- data: pageData,
418
- rowKey: getRowKey,
419
- rowClassName: internalRowClassName,
420
- emptyText: locale && locale.emptyText || (renderEmpty || defaultRenderEmpty)('Table')
421
- // Internal
422
- ,
423
- internalHooks: INTERNAL_HOOKS,
424
- internalRefs: internalRefs,
425
- transformColumns: transformColumns,
426
- getContainerWidth: getContainerWidth
427
- })), bottomPaginationNode));
428
- };
429
- export default /*#__PURE__*/React.forwardRef(InternalTable);
@@ -1,2 +0,0 @@
1
- declare const RcVirtualTable: import("@rc-component/table/lib/VirtualTable").ForwardGenericVirtualTable;
2
- export default RcVirtualTable;
@@ -1,9 +0,0 @@
1
- import { genVirtualTable } from '@rc-component/table';
2
- var RcVirtualTable = genVirtualTable(function (prev, next) {
3
- var _ref = prev,
4
- prevRenderTimes = _ref._renderTimes;
5
- var _ref2 = next,
6
- nextRenderTimes = _ref2._renderTimes;
7
- return prevRenderTimes !== nextRenderTimes;
8
- });
9
- export default RcVirtualTable;
@@ -1,2 +0,0 @@
1
- declare const RcTable: import("@rc-component/table/lib/Table").ForwardGenericTable;
2
- export default RcTable;
@@ -1,9 +0,0 @@
1
- import { genTable } from '@rc-component/table';
2
- var RcTable = genTable(function (prev, next) {
3
- var _ref = prev,
4
- prevRenderTimes = _ref._renderTimes;
5
- var _ref2 = next,
6
- nextRenderTimes = _ref2._renderTimes;
7
- return prevRenderTimes !== nextRenderTimes;
8
- });
9
- export default RcTable;
@@ -1,17 +0,0 @@
1
- import { EXPAND_COLUMN, Summary } from '@rc-component/table';
2
- import Column from 'antd/lib/table/Column';
3
- import ColumnGroup from 'antd/lib/table/ColumnGroup';
4
- import { SELECTION_ALL, SELECTION_COLUMN, SELECTION_INVERT, SELECTION_NONE } from 'antd/lib/table/hooks/useSelection';
5
- import type { RefTable } from './interface';
6
- declare const ForwardTable: RefTable & {
7
- displayName?: string | undefined;
8
- SELECTION_COLUMN: typeof SELECTION_COLUMN;
9
- EXPAND_COLUMN: typeof EXPAND_COLUMN;
10
- SELECTION_ALL: typeof SELECTION_ALL;
11
- SELECTION_INVERT: typeof SELECTION_INVERT;
12
- SELECTION_NONE: typeof SELECTION_NONE;
13
- Column: typeof Column;
14
- ColumnGroup: typeof ColumnGroup;
15
- Summary: typeof Summary;
16
- };
17
- export default ForwardTable;
@@ -1,28 +0,0 @@
1
- function _extends() { _extends = Object.assign ? Object.assign.bind() : function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
- import * as React from 'react';
3
- import { EXPAND_COLUMN, Summary } from '@rc-component/table';
4
- import Column from 'antd/lib/table/Column';
5
- import ColumnGroup from 'antd/lib/table/ColumnGroup';
6
- import { SELECTION_ALL, SELECTION_COLUMN, SELECTION_INVERT, SELECTION_NONE } from 'antd/lib/table/hooks/useSelection';
7
- import InternalTable from "./InternalTable";
8
- var Table = function Table(props, ref) {
9
- var renderTimesRef = React.useRef(0);
10
- renderTimesRef.current += 1;
11
- return /*#__PURE__*/React.createElement(InternalTable, _extends({}, props, {
12
- ref: ref,
13
- _renderTimes: renderTimesRef.current
14
- }));
15
- };
16
- var ForwardTable = /*#__PURE__*/React.forwardRef(Table);
17
- ForwardTable.SELECTION_COLUMN = SELECTION_COLUMN;
18
- ForwardTable.EXPAND_COLUMN = EXPAND_COLUMN;
19
- ForwardTable.SELECTION_ALL = SELECTION_ALL;
20
- ForwardTable.SELECTION_INVERT = SELECTION_INVERT;
21
- ForwardTable.SELECTION_NONE = SELECTION_NONE;
22
- ForwardTable.Column = Column;
23
- ForwardTable.ColumnGroup = ColumnGroup;
24
- ForwardTable.Summary = Summary;
25
- if (process.env.NODE_ENV !== 'production') {
26
- ForwardTable.displayName = 'Table';
27
- }
28
- export default ForwardTable;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- declare const TableMeasureRowContext: React.Context<boolean>;
3
- export default TableMeasureRowContext;
@@ -1,3 +0,0 @@
1
- import React from 'react';
2
- var TableMeasureRowContext = /*#__PURE__*/React.createContext(false);
3
- export default TableMeasureRowContext;
@@ -1 +0,0 @@
1
- export default function useContainerWidth(prefixCls: string): (ele: HTMLElement, width: number) => number;
@@ -1,14 +0,0 @@
1
- export default function useContainerWidth(prefixCls) {
2
- var getContainerWidth = function getContainerWidth(ele, width) {
3
- var container = ele.querySelector(".".concat(prefixCls, "-container"));
4
- var returnWidth = width;
5
- if (container) {
6
- var style = getComputedStyle(container);
7
- var borderLeft = Number.parseInt(style.borderLeftWidth, 10);
8
- var borderRight = Number.parseInt(style.borderRightWidth, 10);
9
- returnWidth = width - borderLeft - borderRight;
10
- }
11
- return returnWidth;
12
- };
13
- return getContainerWidth;
14
- }
@@ -1,7 +0,0 @@
1
- import type { TablePaginationConfig, TableProps } from './InternalTable';
2
- import Table from './Table';
3
- export type { ColumnGroupType, ColumnsType, ColumnType } from './interface';
4
- export type { Reference as TableRef } from '@rc-component/table';
5
- export type { ColumnProps } from 'antd/lib/table/Column';
6
- export type { TablePaginationConfig, TableProps };
7
- export default Table;
@@ -1,2 +0,0 @@
1
- import Table from "./Table";
2
- export default Table;