@propellerads/table 5.0.4 → 5.1.1
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.
- package/dist/index.d.ts +5 -4
- package/dist/propsGetter.d.ts +1 -1
- package/dist/table.cjs.development.js +213 -143
- package/dist/table.cjs.development.js.map +1 -1
- package/dist/table.cjs.production.min.js +1 -1
- package/dist/table.cjs.production.min.js.map +1 -1
- package/dist/table.esm.js +213 -143
- package/dist/table.esm.js.map +1 -1
- package/package.json +3 -3
- package/src/index.tsx +152 -128
- package/src/propsGetter.tsx +5 -7
- package/src/useTableShadow.tsx +0 -1
package/dist/table.esm.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import React, { useMemo, useEffect, useRef } from 'react';
|
|
2
|
-
import { useTable, useFlexLayout, useSortBy, useExpanded, usePagination, useRowSelect, useResizeColumns } from 'react-table';
|
|
3
1
|
import { ArrowUp, Size, Color, ArrowDown } from '@propellerads/icon';
|
|
4
2
|
import Checkbox from '@propellerads/input-checkbox';
|
|
3
|
+
import React, { useMemo, useEffect, useRef } from 'react';
|
|
4
|
+
import { useTable, useFlexLayout, useSortBy, useExpanded, usePagination, useRowSelect, useResizeColumns } from 'react-table';
|
|
5
5
|
import styled, { css, keyframes } from 'styled-components';
|
|
6
6
|
import { fontNormal, spacing, gray95, white, black, gray80 } from '@propellerads/stylevariables';
|
|
7
7
|
|
|
@@ -27,98 +27,6 @@ function _taggedTemplateLiteralLoose(e, t) {
|
|
|
27
27
|
return t || (t = e.slice(0)), e.raw = t, e;
|
|
28
28
|
}
|
|
29
29
|
|
|
30
|
-
var useLoadingState = function useLoadingState(showLoadingState, loading, pageSize, columns, LoadingCellComponent) {
|
|
31
|
-
var loadingColumns = useMemo(function () {
|
|
32
|
-
return showLoadingState && loading ? columns.map(function (column) {
|
|
33
|
-
var loadingColumn = _extends({}, column, {
|
|
34
|
-
Cell: function Cell() {
|
|
35
|
-
return React.createElement(LoadingCellComponent, null);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return loadingColumn;
|
|
39
|
-
}) : [];
|
|
40
|
-
}, [columns, loading, showLoadingState]);
|
|
41
|
-
var loadingData = useMemo(function () {
|
|
42
|
-
if (showLoadingState && loading && columns && columns.length > 0) {
|
|
43
|
-
var dataObject = {};
|
|
44
|
-
var dataArray = [];
|
|
45
|
-
for (var i = 0; i < columns.length; i += 1) {
|
|
46
|
-
dataObject["empty_" + i] = '';
|
|
47
|
-
}
|
|
48
|
-
for (var _i = 0; _i < pageSize; _i += 1) {
|
|
49
|
-
dataArray.push(dataObject);
|
|
50
|
-
}
|
|
51
|
-
return dataArray;
|
|
52
|
-
}
|
|
53
|
-
return [];
|
|
54
|
-
}, [columns, loading, pageSize, showLoadingState]);
|
|
55
|
-
return {
|
|
56
|
-
// @ts-ignore
|
|
57
|
-
loadingColumns: loadingColumns,
|
|
58
|
-
loadingData: loadingData
|
|
59
|
-
};
|
|
60
|
-
};
|
|
61
|
-
|
|
62
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
63
|
-
var TABLE_SHADOW_CLASS_NAME = {
|
|
64
|
-
LEFT: 'shadow_left',
|
|
65
|
-
RIGHT: 'shadow_right'
|
|
66
|
-
};
|
|
67
|
-
function changeClassName(tableWrapperNode, newClassNameList) {
|
|
68
|
-
var classList = tableWrapperNode.classList;
|
|
69
|
-
classList.remove(TABLE_SHADOW_CLASS_NAME.LEFT, TABLE_SHADOW_CLASS_NAME.RIGHT);
|
|
70
|
-
classList.add.apply(classList, newClassNameList);
|
|
71
|
-
}
|
|
72
|
-
function calculateNewClassNames(tableNode, tableWrapperNode) {
|
|
73
|
-
if (!tableNode || !tableWrapperNode) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
var tableRect = tableNode.getBoundingClientRect();
|
|
77
|
-
var tableWrapperRect = tableWrapperNode.getBoundingClientRect();
|
|
78
|
-
var newClassName = [];
|
|
79
|
-
var tableRectLeft = Math.floor(tableRect.left);
|
|
80
|
-
var tableRectRight = Math.floor(tableRect.right);
|
|
81
|
-
var tableWrapperRectLeft = Math.floor(tableWrapperRect.left);
|
|
82
|
-
var tableWrapperRectRight = Math.floor(tableWrapperRect.right);
|
|
83
|
-
if (tableRectLeft < tableWrapperRectLeft) {
|
|
84
|
-
newClassName.push(TABLE_SHADOW_CLASS_NAME.LEFT);
|
|
85
|
-
}
|
|
86
|
-
if (tableRectRight > tableWrapperRectRight) {
|
|
87
|
-
newClassName.push(TABLE_SHADOW_CLASS_NAME.RIGHT);
|
|
88
|
-
}
|
|
89
|
-
changeClassName(tableWrapperNode, newClassName);
|
|
90
|
-
}
|
|
91
|
-
var useTableShadow = (function (tableRef, tableWrapperRef) {
|
|
92
|
-
useEffect(function () {
|
|
93
|
-
var _tableRef$current;
|
|
94
|
-
var ticking = false;
|
|
95
|
-
function onMousewheel() {
|
|
96
|
-
if (ticking) {
|
|
97
|
-
return;
|
|
98
|
-
}
|
|
99
|
-
window.requestAnimationFrame(function () {
|
|
100
|
-
calculateNewClassNames(tableRef.current, tableWrapperRef.current);
|
|
101
|
-
ticking = false;
|
|
102
|
-
});
|
|
103
|
-
ticking = true;
|
|
104
|
-
}
|
|
105
|
-
calculateNewClassNames(tableRef.current, tableWrapperRef.current);
|
|
106
|
-
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.addEventListener('mousewheel', onMousewheel);
|
|
107
|
-
window.addEventListener('resize', onMousewheel);
|
|
108
|
-
return function () {
|
|
109
|
-
var _tableRef$current2;
|
|
110
|
-
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.removeEventListener('mousewheel', onMousewheel);
|
|
111
|
-
window.removeEventListener('resize', onMousewheel);
|
|
112
|
-
};
|
|
113
|
-
}, [tableRef.current, tableWrapperRef.current]);
|
|
114
|
-
});
|
|
115
|
-
|
|
116
|
-
var FOOTER_PLACEMENT;
|
|
117
|
-
(function (FOOTER_PLACEMENT) {
|
|
118
|
-
FOOTER_PLACEMENT["TOP"] = "top";
|
|
119
|
-
FOOTER_PLACEMENT["BOTTOM"] = "bottom";
|
|
120
|
-
})(FOOTER_PLACEMENT || (FOOTER_PLACEMENT = {}));
|
|
121
|
-
|
|
122
30
|
var defaultGetter = function defaultGetter(props) {
|
|
123
31
|
return props;
|
|
124
32
|
};
|
|
@@ -126,7 +34,6 @@ var cellGetter = function cellGetter(props, _ref) {
|
|
|
126
34
|
var _cell$column;
|
|
127
35
|
var cell = _ref.cell;
|
|
128
36
|
return _extends({}, props, {
|
|
129
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
130
37
|
// @ts-ignore
|
|
131
38
|
align: cell === null || cell === void 0 ? void 0 : (_cell$column = cell.column) === null || _cell$column === void 0 ? void 0 : _cell$column.align
|
|
132
39
|
});
|
|
@@ -134,7 +41,6 @@ var cellGetter = function cellGetter(props, _ref) {
|
|
|
134
41
|
var mainCellGetter = function mainCellGetter(props, _ref2) {
|
|
135
42
|
var column = _ref2.column;
|
|
136
43
|
return _extends({}, props, {
|
|
137
|
-
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
138
44
|
// @ts-ignore
|
|
139
45
|
align: column === null || column === void 0 ? void 0 : column.align
|
|
140
46
|
});
|
|
@@ -221,7 +127,109 @@ var TBody = /*#__PURE__*/styled.div(_templateObject15 || (_templateObject15 = /*
|
|
|
221
127
|
var TFoot = /*#__PURE__*/styled.div(_templateObject16 || (_templateObject16 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n background: ", ";\n flex: 1 0 auto;\n display: flex;\n flex-direction: column;\n"])), gray95);
|
|
222
128
|
var TResizer = /*#__PURE__*/styled.div(_templateObject17 || (_templateObject17 = /*#__PURE__*/_taggedTemplateLiteralLoose(["\n display: inline-block;\n position: absolute;\n right: 5px;\n top: 0;\n z-index: 1;\n touch-action: none;\n\n &:after {\n content: '\u2194';\n position: absolute;\n right: 0;\n top: 0;\n }\n"])));
|
|
223
129
|
|
|
224
|
-
var
|
|
130
|
+
var FOOTER_PLACEMENT;
|
|
131
|
+
(function (FOOTER_PLACEMENT) {
|
|
132
|
+
FOOTER_PLACEMENT["TOP"] = "top";
|
|
133
|
+
FOOTER_PLACEMENT["BOTTOM"] = "bottom";
|
|
134
|
+
})(FOOTER_PLACEMENT || (FOOTER_PLACEMENT = {}));
|
|
135
|
+
|
|
136
|
+
var useLoadingState = function useLoadingState(showLoadingState, loading, pageSize, columns, LoadingCellComponent) {
|
|
137
|
+
var loadingColumns = useMemo(function () {
|
|
138
|
+
return showLoadingState && loading ? columns.map(function (column) {
|
|
139
|
+
var loadingColumn = _extends({}, column, {
|
|
140
|
+
Cell: function Cell() {
|
|
141
|
+
return React.createElement(LoadingCellComponent, null);
|
|
142
|
+
}
|
|
143
|
+
});
|
|
144
|
+
return loadingColumn;
|
|
145
|
+
}) : [];
|
|
146
|
+
}, [columns, loading, showLoadingState]);
|
|
147
|
+
var loadingData = useMemo(function () {
|
|
148
|
+
if (showLoadingState && loading && columns && columns.length > 0) {
|
|
149
|
+
var dataObject = {};
|
|
150
|
+
var dataArray = [];
|
|
151
|
+
for (var i = 0; i < columns.length; i += 1) {
|
|
152
|
+
dataObject["empty_" + i] = '';
|
|
153
|
+
}
|
|
154
|
+
for (var _i = 0; _i < pageSize; _i += 1) {
|
|
155
|
+
dataArray.push(dataObject);
|
|
156
|
+
}
|
|
157
|
+
return dataArray;
|
|
158
|
+
}
|
|
159
|
+
return [];
|
|
160
|
+
}, [columns, loading, pageSize, showLoadingState]);
|
|
161
|
+
return {
|
|
162
|
+
// @ts-ignore
|
|
163
|
+
loadingColumns: loadingColumns,
|
|
164
|
+
loadingData: loadingData
|
|
165
|
+
};
|
|
166
|
+
};
|
|
167
|
+
|
|
168
|
+
// @ts-nocheck
|
|
169
|
+
var TABLE_SHADOW_CLASS_NAME = {
|
|
170
|
+
LEFT: 'shadow_left',
|
|
171
|
+
RIGHT: 'shadow_right'
|
|
172
|
+
};
|
|
173
|
+
function changeClassName(tableWrapperNode, newClassNameList) {
|
|
174
|
+
var classList = tableWrapperNode.classList;
|
|
175
|
+
classList.remove(TABLE_SHADOW_CLASS_NAME.LEFT, TABLE_SHADOW_CLASS_NAME.RIGHT);
|
|
176
|
+
classList.add.apply(classList, newClassNameList);
|
|
177
|
+
}
|
|
178
|
+
function calculateNewClassNames(tableNode, tableWrapperNode) {
|
|
179
|
+
if (!tableNode || !tableWrapperNode) {
|
|
180
|
+
return;
|
|
181
|
+
}
|
|
182
|
+
var tableRect = tableNode.getBoundingClientRect();
|
|
183
|
+
var tableWrapperRect = tableWrapperNode.getBoundingClientRect();
|
|
184
|
+
var newClassName = [];
|
|
185
|
+
var tableRectLeft = Math.floor(tableRect.left);
|
|
186
|
+
var tableRectRight = Math.floor(tableRect.right);
|
|
187
|
+
var tableWrapperRectLeft = Math.floor(tableWrapperRect.left);
|
|
188
|
+
var tableWrapperRectRight = Math.floor(tableWrapperRect.right);
|
|
189
|
+
if (tableRectLeft < tableWrapperRectLeft) {
|
|
190
|
+
newClassName.push(TABLE_SHADOW_CLASS_NAME.LEFT);
|
|
191
|
+
}
|
|
192
|
+
if (tableRectRight > tableWrapperRectRight) {
|
|
193
|
+
newClassName.push(TABLE_SHADOW_CLASS_NAME.RIGHT);
|
|
194
|
+
}
|
|
195
|
+
changeClassName(tableWrapperNode, newClassName);
|
|
196
|
+
}
|
|
197
|
+
var useTableShadow = (function (tableRef, tableWrapperRef) {
|
|
198
|
+
useEffect(function () {
|
|
199
|
+
var _tableRef$current;
|
|
200
|
+
var ticking = false;
|
|
201
|
+
function onMousewheel() {
|
|
202
|
+
if (ticking) {
|
|
203
|
+
return;
|
|
204
|
+
}
|
|
205
|
+
window.requestAnimationFrame(function () {
|
|
206
|
+
calculateNewClassNames(tableRef.current, tableWrapperRef.current);
|
|
207
|
+
ticking = false;
|
|
208
|
+
});
|
|
209
|
+
ticking = true;
|
|
210
|
+
}
|
|
211
|
+
calculateNewClassNames(tableRef.current, tableWrapperRef.current);
|
|
212
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current = tableRef.current) === null || _tableRef$current === void 0 ? void 0 : _tableRef$current.addEventListener('mousewheel', onMousewheel);
|
|
213
|
+
window.addEventListener('resize', onMousewheel);
|
|
214
|
+
return function () {
|
|
215
|
+
var _tableRef$current2;
|
|
216
|
+
tableRef === null || tableRef === void 0 ? void 0 : (_tableRef$current2 = tableRef.current) === null || _tableRef$current2 === void 0 ? void 0 : _tableRef$current2.removeEventListener('mousewheel', onMousewheel);
|
|
217
|
+
window.removeEventListener('resize', onMousewheel);
|
|
218
|
+
};
|
|
219
|
+
}, [tableRef.current, tableWrapperRef.current]);
|
|
220
|
+
});
|
|
221
|
+
|
|
222
|
+
var _excluded = ["getTableProps", "headerGroups", "footerGroups", "setHiddenColumns", "rows", "prepareRow", "visibleColumns"],
|
|
223
|
+
_excluded2 = ["key"],
|
|
224
|
+
_excluded3 = ["key"],
|
|
225
|
+
_excluded4 = ["key"],
|
|
226
|
+
_excluded5 = ["key"],
|
|
227
|
+
_excluded6 = ["key"],
|
|
228
|
+
_excluded7 = ["key"],
|
|
229
|
+
_excluded8 = ["key"],
|
|
230
|
+
_excluded9 = ["key"],
|
|
231
|
+
_excluded0 = ["key"],
|
|
232
|
+
_excluded1 = ["key"];
|
|
225
233
|
var TableRoot$1 = TableRoot;
|
|
226
234
|
var TableWrapper$1 = TableWrapper;
|
|
227
235
|
var TableContent$1 = TableContent;
|
|
@@ -295,38 +303,52 @@ function getHeadContent(column) {
|
|
|
295
303
|
}
|
|
296
304
|
return column.render('Header');
|
|
297
305
|
}
|
|
298
|
-
var Table = function Table(
|
|
306
|
+
var Table = function Table(_ref) {
|
|
299
307
|
var _controlledPagination;
|
|
300
|
-
var columns =
|
|
301
|
-
data =
|
|
302
|
-
totalItems =
|
|
303
|
-
fetchData =
|
|
304
|
-
controlledPagination =
|
|
305
|
-
initialState =
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
308
|
+
var columns = _ref.columns,
|
|
309
|
+
data = _ref.data,
|
|
310
|
+
totalItems = _ref.totalItems,
|
|
311
|
+
fetchData = _ref.fetchData,
|
|
312
|
+
controlledPagination = _ref.controlledPagination,
|
|
313
|
+
_ref$initialState = _ref.initialState,
|
|
314
|
+
initialState = _ref$initialState === void 0 ? defaultProps.initialState : _ref$initialState,
|
|
315
|
+
_ref$isLoading = _ref.isLoading,
|
|
316
|
+
isLoading = _ref$isLoading === void 0 ? defaultProps.isLoading : _ref$isLoading,
|
|
317
|
+
_ref$loadingMessage = _ref.loadingMessage,
|
|
318
|
+
loadingMessage = _ref$loadingMessage === void 0 ? defaultProps.loadingMessage : _ref$loadingMessage,
|
|
319
|
+
_ref$labelPerPage = _ref.labelPerPage,
|
|
320
|
+
labelPerPage = _ref$labelPerPage === void 0 ? defaultProps.labelPerPage : _ref$labelPerPage,
|
|
321
|
+
_ref$footerPlacement = _ref.footerPlacement,
|
|
322
|
+
footerPlacement = _ref$footerPlacement === void 0 ? defaultProps.footerPlacement : _ref$footerPlacement,
|
|
323
|
+
onSortedChange = _ref.onSortedChange,
|
|
324
|
+
_ref$hasDefaultPagina = _ref.hasDefaultPagination,
|
|
325
|
+
hasDefaultPagination = _ref$hasDefaultPagina === void 0 ? defaultProps.hasDefaultPagination : _ref$hasDefaultPagina,
|
|
326
|
+
onSelectRowsChange = _ref.onSelectRowsChange,
|
|
327
|
+
_ref$parentElementId = _ref.parentElementId,
|
|
328
|
+
parentElementId = _ref$parentElementId === void 0 ? defaultProps.parentElementId : _ref$parentElementId,
|
|
329
|
+
_ref$tableContentId = _ref.tableContentId,
|
|
330
|
+
tableContentId = _ref$tableContentId === void 0 ? defaultProps.tableContentId : _ref$tableContentId,
|
|
331
|
+
_ref$LoadingCellCompo = _ref.LoadingCellComponent,
|
|
332
|
+
LoadingCellComponent = _ref$LoadingCellCompo === void 0 ? defaultProps.LoadingCellComponent : _ref$LoadingCellCompo,
|
|
333
|
+
PaginationComponent = _ref.PaginationComponent,
|
|
334
|
+
_ref$getRowPreProps = _ref.getRowPreProps,
|
|
335
|
+
getRowPreProps = _ref$getRowPreProps === void 0 ? defaultProps.getRowPreProps : _ref$getRowPreProps,
|
|
336
|
+
getTableProps$1 = _ref.getTableProps,
|
|
337
|
+
getHeaderGroupProps = _ref.getHeaderGroupProps,
|
|
338
|
+
getHeaderProps = _ref.getHeaderProps,
|
|
339
|
+
getRowProps = _ref.getRowProps,
|
|
340
|
+
getCellProps = _ref.getCellProps,
|
|
341
|
+
getFooterProps = _ref.getFooterProps,
|
|
342
|
+
getFooterGroupProps = _ref.getFooterGroupProps,
|
|
343
|
+
_ref$showLoadingState = _ref.showLoadingState,
|
|
344
|
+
showLoadingState = _ref$showLoadingState === void 0 ? defaultProps.showLoadingState : _ref$showLoadingState,
|
|
345
|
+
_ref$noDataMessage = _ref.noDataMessage,
|
|
346
|
+
noDataMessage = _ref$noDataMessage === void 0 ? defaultProps.noDataMessage : _ref$noDataMessage,
|
|
347
|
+
rowSubComponent = _ref.rowSubComponent,
|
|
348
|
+
_ref$isEnableRowSelec = _ref.isEnableRowSelect,
|
|
349
|
+
isEnableRowSelect = _ref$isEnableRowSelec === void 0 ? defaultProps.isEnableRowSelect : _ref$isEnableRowSelec,
|
|
350
|
+
_ref$selectColumnProp = _ref.selectColumnProps,
|
|
351
|
+
selectColumnProps = _ref$selectColumnProp === void 0 ? defaultProps.selectColumnProps : _ref$selectColumnProp;
|
|
330
352
|
var memoColumns = useMemo(function () {
|
|
331
353
|
return columns;
|
|
332
354
|
}, [columns]);
|
|
@@ -372,8 +394,8 @@ var Table = function Table(props) {
|
|
|
372
394
|
var getToggleAllPageRowsSelectedProps = instance.getToggleAllPageRowsSelectedProps,
|
|
373
395
|
toggleAllPageRowsSelected = instance.toggleAllPageRowsSelected,
|
|
374
396
|
page = instance.page;
|
|
375
|
-
var isDisabledAllRows = page.map(function (
|
|
376
|
-
var original =
|
|
397
|
+
var isDisabledAllRows = page.map(function (_ref2) {
|
|
398
|
+
var original = _ref2.original;
|
|
377
399
|
return original;
|
|
378
400
|
}).filter(isEnableRowSelect).length === 0;
|
|
379
401
|
return React.createElement(Checkbox, {
|
|
@@ -383,8 +405,8 @@ var Table = function Table(props) {
|
|
|
383
405
|
isDisabled: isDisabledAllRows
|
|
384
406
|
});
|
|
385
407
|
},
|
|
386
|
-
Cell: function Cell(
|
|
387
|
-
var row =
|
|
408
|
+
Cell: function Cell(_ref3) {
|
|
409
|
+
var row = _ref3.row;
|
|
388
410
|
var id = row.id,
|
|
389
411
|
original = row.original,
|
|
390
412
|
toggleRowSelected = row.toggleRowSelected,
|
|
@@ -525,16 +547,36 @@ var Table = function Table(props) {
|
|
|
525
547
|
className: "table-head",
|
|
526
548
|
"data-role": "table-head"
|
|
527
549
|
}, headerGroups.map(function (headerGroup) {
|
|
528
|
-
|
|
550
|
+
var _headerGroup$getHeade = headerGroup.getHeaderGroupProps(getTableElementProps(getHeaderGroupProps)),
|
|
551
|
+
headerGroupKey = _headerGroup$getHeade.key,
|
|
552
|
+
headerGroupProps = _objectWithoutPropertiesLoose(_headerGroup$getHeade, _excluded2);
|
|
553
|
+
return React.createElement(TR$1, Object.assign({
|
|
554
|
+
key: headerGroupKey
|
|
555
|
+
}, headerGroupProps), headerGroup.headers.map(function (column) {
|
|
529
556
|
var headerProps = extendSortByProps(column);
|
|
530
|
-
|
|
557
|
+
var _column$getHeaderProp = column.getHeaderProps(getTableElementInternalProps(headerProps, getHeaderProps, mainCellGetter)),
|
|
558
|
+
columnKey = _column$getHeaderProp.key,
|
|
559
|
+
thProps = _objectWithoutPropertiesLoose(_column$getHeaderProp, _excluded3);
|
|
560
|
+
return React.createElement(TH$1, Object.assign({
|
|
561
|
+
key: columnKey
|
|
562
|
+
}, thProps), getHeadContent(column), renderResizer(column));
|
|
531
563
|
}));
|
|
532
564
|
})), footerPlacement.includes(FOOTER_PLACEMENT.TOP) && React.createElement(TFoot$1, {
|
|
533
565
|
className: "table-footer-top",
|
|
534
566
|
"data-role": "table-footer-top"
|
|
535
567
|
}, footerGroups.map(function (group) {
|
|
536
|
-
|
|
537
|
-
|
|
568
|
+
var _group$getFooterGroup = group.getFooterGroupProps(getTableElementProps(getFooterGroupProps)),
|
|
569
|
+
footerTopGroupKey = _group$getFooterGroup.key,
|
|
570
|
+
footerTopGroupProps = _objectWithoutPropertiesLoose(_group$getFooterGroup, _excluded4);
|
|
571
|
+
return React.createElement(TR$1, Object.assign({
|
|
572
|
+
key: footerTopGroupKey
|
|
573
|
+
}, footerTopGroupProps), group.headers.map(function (column) {
|
|
574
|
+
var _column$getFooterProp = column.getFooterProps(getTableElementProps(getFooterProps, mainCellGetter)),
|
|
575
|
+
footerTopColumnKey = _column$getFooterProp.key,
|
|
576
|
+
footerTopTdProps = _objectWithoutPropertiesLoose(_column$getFooterProp, _excluded5);
|
|
577
|
+
return React.createElement(TD$1, Object.assign({
|
|
578
|
+
key: footerTopColumnKey
|
|
579
|
+
}, footerTopTdProps), column.render('Footer'));
|
|
538
580
|
}));
|
|
539
581
|
})), React.createElement(TBody$1, {
|
|
540
582
|
className: "table-body",
|
|
@@ -545,27 +587,55 @@ var Table = function Table(props) {
|
|
|
545
587
|
isDelimiterTd = _getRowPreProps.isDelimiterTd;
|
|
546
588
|
if (isDelimiterTd) {
|
|
547
589
|
var cell = row.cells[0].render('Cell');
|
|
590
|
+
var _row$getRowProps = row.getRowProps(getTableRowProps(getRowProps)),
|
|
591
|
+
delimiterRowKey = _row$getRowProps.key,
|
|
592
|
+
delimiterRowProps = _objectWithoutPropertiesLoose(_row$getRowProps, _excluded6);
|
|
593
|
+
var _row$cells$0$getCellP = row.cells[0].getCellProps(getTableCellProps(getCellProps, cellGetter)),
|
|
594
|
+
delimiterCellKey = _row$cells$0$getCellP.key,
|
|
595
|
+
delimiterCellProps = _objectWithoutPropertiesLoose(_row$cells$0$getCellP, _excluded7);
|
|
548
596
|
return React.createElement(React.Fragment, {
|
|
549
597
|
key: "group_" + row.index
|
|
550
|
-
}, React.createElement(TRGroup$1, null, React.createElement(TR$1, Object.assign({
|
|
598
|
+
}, React.createElement(TRGroup$1, null, React.createElement(TR$1, Object.assign({
|
|
599
|
+
key: delimiterRowKey
|
|
600
|
+
}, delimiterRowProps), React.createElement(TD$1, Object.assign({
|
|
601
|
+
key: delimiterCellKey,
|
|
551
602
|
colSpan: visibleColumns.length
|
|
552
|
-
},
|
|
603
|
+
}, delimiterCellProps), React.createElement("strong", null, cell)))), (row === null || row === void 0 ? void 0 : row.isExpanded) && rowSubComponent && rowSubComponent(row));
|
|
553
604
|
}
|
|
605
|
+
var _row$getRowProps2 = row.getRowProps(getTableRowProps(getRowProps)),
|
|
606
|
+
rowKey = _row$getRowProps2.key,
|
|
607
|
+
rowProps = _objectWithoutPropertiesLoose(_row$getRowProps2, _excluded8);
|
|
554
608
|
return React.createElement(React.Fragment, {
|
|
555
609
|
key: "group_" + row.index
|
|
556
|
-
}, React.createElement(TRGroup$1, null, React.createElement(TR$1, Object.assign({
|
|
557
|
-
|
|
610
|
+
}, React.createElement(TRGroup$1, null, React.createElement(TR$1, Object.assign({
|
|
611
|
+
key: rowKey
|
|
612
|
+
}, rowProps), row.cells.map(function (cell) {
|
|
613
|
+
var _cell$getCellProps = cell.getCellProps(getTableCellProps(getCellProps, cellGetter)),
|
|
614
|
+
cellKey = _cell$getCellProps.key,
|
|
615
|
+
cellProps = _objectWithoutPropertiesLoose(_cell$getCellProps, _excluded9);
|
|
616
|
+
return React.createElement(TD$1, Object.assign({
|
|
617
|
+
key: cellKey
|
|
618
|
+
}, cellProps), cell.render('Cell'));
|
|
558
619
|
}))), (row === null || row === void 0 ? void 0 : row.isExpanded) && rowSubComponent && rowSubComponent(row));
|
|
559
620
|
})), footerPlacement.includes(FOOTER_PLACEMENT.BOTTOM) && React.createElement(TFoot$1, {
|
|
560
621
|
className: "table-footer-bottom",
|
|
561
622
|
"data-role": "table-footer-bottom"
|
|
562
623
|
}, footerGroups.map(function (group) {
|
|
563
|
-
|
|
564
|
-
|
|
624
|
+
var _group$getFooterGroup2 = group.getFooterGroupProps(getTableElementProps(getFooterGroupProps)),
|
|
625
|
+
footerBottomGroupKey = _group$getFooterGroup2.key,
|
|
626
|
+
footerBottomGroupProps = _objectWithoutPropertiesLoose(_group$getFooterGroup2, _excluded0);
|
|
627
|
+
return React.createElement(TR$1, Object.assign({
|
|
628
|
+
key: footerBottomGroupKey
|
|
629
|
+
}, footerBottomGroupProps), group.headers.map(function (column) {
|
|
630
|
+
var _column$getFooterProp2 = column.getFooterProps(getTableElementProps(getFooterProps, mainCellGetter)),
|
|
631
|
+
footerBottomColumnKey = _column$getFooterProp2.key,
|
|
632
|
+
footerBottomTdProps = _objectWithoutPropertiesLoose(_column$getFooterProp2, _excluded1);
|
|
633
|
+
return React.createElement(TD$1, Object.assign({
|
|
634
|
+
key: footerBottomColumnKey
|
|
635
|
+
}, footerBottomTdProps), column.render('Footer'));
|
|
565
636
|
}));
|
|
566
637
|
}))))), !isLoading && !data.length && noDataMessage, pagination);
|
|
567
638
|
};
|
|
568
|
-
Table.defaultProps = defaultProps;
|
|
569
639
|
|
|
570
640
|
export { Table, defaultProps };
|
|
571
641
|
//# sourceMappingURL=table.esm.js.map
|