@paubox/ui 0.23.0 → 1.0.0
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/index.esm.js +151 -152
- package/package.json +1 -1
- package/src/lib/Pagination/Pagination.d.ts +24 -7
- package/src/lib/Table/Table.d.ts +5 -4
package/index.esm.js
CHANGED
|
@@ -29032,7 +29032,7 @@ function _templateObject1$6() {
|
|
|
29032
29032
|
var PaginationContainer = styled.div(_templateObject$7(), spacing(2), spacing(1), spacing(1));
|
|
29033
29033
|
var PageControls = styled.div(_templateObject1$6());
|
|
29034
29034
|
var Pagination = function(param) {
|
|
29035
|
-
var pageInfo = param.pageInfo, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, onPageSizeChange = param.onPageSizeChange, subText = param.subText, onPageChange = param.onPageChange, _param_testId = param.testId, testId = _param_testId === void 0 ? 'pagination' : _param_testId;
|
|
29035
|
+
var mode = param.mode, pageInfo = param.pageInfo, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, onPageSizeChange = param.onPageSizeChange, subText = param.subText, onPageChange = param.onPageChange, _param_testId = param.testId, testId = _param_testId === void 0 ? 'pagination' : _param_testId;
|
|
29036
29036
|
return /*#__PURE__*/ jsxs(PaginationContainer, {
|
|
29037
29037
|
children: [
|
|
29038
29038
|
/*#__PURE__*/ jsxs(PageControls, {
|
|
@@ -29058,7 +29058,7 @@ var Pagination = function(param) {
|
|
|
29058
29058
|
label: '100'
|
|
29059
29059
|
}
|
|
29060
29060
|
],
|
|
29061
|
-
value: pageInfo.
|
|
29061
|
+
value: pageInfo.pageSize,
|
|
29062
29062
|
setValue: function(value) {
|
|
29063
29063
|
onPageSizeChange(Number(value));
|
|
29064
29064
|
},
|
|
@@ -29077,38 +29077,79 @@ var Pagination = function(param) {
|
|
|
29077
29077
|
}),
|
|
29078
29078
|
/*#__PURE__*/ jsxs(PageControls, {
|
|
29079
29079
|
children: [
|
|
29080
|
-
/*#__PURE__*/
|
|
29081
|
-
|
|
29082
|
-
|
|
29083
|
-
|
|
29084
|
-
|
|
29085
|
-
|
|
29086
|
-
|
|
29087
|
-
|
|
29088
|
-
|
|
29089
|
-
|
|
29090
|
-
|
|
29091
|
-
|
|
29092
|
-
|
|
29093
|
-
|
|
29094
|
-
|
|
29095
|
-
|
|
29096
|
-
|
|
29097
|
-
|
|
29080
|
+
mode === 'page' && /*#__PURE__*/ jsxs(Fragment, {
|
|
29081
|
+
children: [
|
|
29082
|
+
/*#__PURE__*/ jsx(Typography, {
|
|
29083
|
+
variant: "paragraph300Regular",
|
|
29084
|
+
as: "span",
|
|
29085
|
+
children: "".concat(pageInfo.pageSize * (pageInfo.currentPage - 1) + 1, " – ").concat(pageInfo.currentPage >= pageInfo.pageCount ? pageInfo.itemCount : pageInfo.pageSize * pageInfo.currentPage, " of ").concat(pageInfo.itemCount)
|
|
29086
|
+
}),
|
|
29087
|
+
/*#__PURE__*/ jsx(Button, {
|
|
29088
|
+
color: "secondary",
|
|
29089
|
+
onClick: function() {
|
|
29090
|
+
return onPageChange(pageInfo.currentPage - 1);
|
|
29091
|
+
},
|
|
29092
|
+
disabled: isLoading || pageInfo.currentPage === 1,
|
|
29093
|
+
style: {
|
|
29094
|
+
fontSize: 10,
|
|
29095
|
+
padding: spacing(1),
|
|
29096
|
+
marginLeft: spacing(1)
|
|
29097
|
+
},
|
|
29098
|
+
"data-testid": "".concat(testId, "-prev-button"),
|
|
29099
|
+
children: /*#__PURE__*/ jsx(ChevronLeft, {})
|
|
29100
|
+
}),
|
|
29101
|
+
/*#__PURE__*/ jsx(Button, {
|
|
29102
|
+
color: "secondary",
|
|
29103
|
+
onClick: function() {
|
|
29104
|
+
return onPageChange(pageInfo.currentPage + 1);
|
|
29105
|
+
},
|
|
29106
|
+
disabled: isLoading || pageInfo.currentPage >= pageInfo.pageCount,
|
|
29107
|
+
style: {
|
|
29108
|
+
fontSize: 10,
|
|
29109
|
+
padding: spacing(1),
|
|
29110
|
+
marginLeft: spacing(1)
|
|
29111
|
+
},
|
|
29112
|
+
"data-testid": "".concat(testId, "-next-button"),
|
|
29113
|
+
children: /*#__PURE__*/ jsx(ChevronRight, {})
|
|
29114
|
+
})
|
|
29115
|
+
]
|
|
29098
29116
|
}),
|
|
29099
|
-
/*#__PURE__*/
|
|
29100
|
-
|
|
29101
|
-
|
|
29102
|
-
|
|
29103
|
-
|
|
29104
|
-
|
|
29105
|
-
|
|
29106
|
-
|
|
29107
|
-
|
|
29108
|
-
|
|
29109
|
-
|
|
29110
|
-
|
|
29111
|
-
|
|
29117
|
+
mode === 'cursor' && /*#__PURE__*/ jsxs(Fragment, {
|
|
29118
|
+
children: [
|
|
29119
|
+
/*#__PURE__*/ jsx(Typography, {
|
|
29120
|
+
variant: "paragraph300Regular",
|
|
29121
|
+
as: "span",
|
|
29122
|
+
children: "".concat(pageInfo.pageIndex * pageInfo.pageSize + 1, " – ").concat((pageInfo.pageIndex + 1) * pageInfo.pageSize > pageInfo.itemCount ? pageInfo.itemCount : (pageInfo.pageIndex + 1) * pageInfo.pageSize, " of ").concat(pageInfo.itemCount)
|
|
29123
|
+
}),
|
|
29124
|
+
/*#__PURE__*/ jsx(Button, {
|
|
29125
|
+
color: "secondary",
|
|
29126
|
+
onClick: function() {
|
|
29127
|
+
return onPageChange('prev');
|
|
29128
|
+
},
|
|
29129
|
+
disabled: isLoading || !pageInfo.hasPrevPage,
|
|
29130
|
+
style: {
|
|
29131
|
+
fontSize: 10,
|
|
29132
|
+
padding: spacing(1),
|
|
29133
|
+
marginLeft: spacing(1)
|
|
29134
|
+
},
|
|
29135
|
+
"data-testid": "".concat(testId, "-prev-button"),
|
|
29136
|
+
children: /*#__PURE__*/ jsx(ChevronLeft, {})
|
|
29137
|
+
}),
|
|
29138
|
+
/*#__PURE__*/ jsx(Button, {
|
|
29139
|
+
color: "secondary",
|
|
29140
|
+
onClick: function() {
|
|
29141
|
+
return onPageChange('next');
|
|
29142
|
+
},
|
|
29143
|
+
disabled: isLoading || !pageInfo.hasNextPage,
|
|
29144
|
+
style: {
|
|
29145
|
+
fontSize: 10,
|
|
29146
|
+
padding: spacing(1),
|
|
29147
|
+
marginLeft: spacing(1)
|
|
29148
|
+
},
|
|
29149
|
+
"data-testid": "".concat(testId, "-next-button"),
|
|
29150
|
+
children: /*#__PURE__*/ jsx(ChevronRight, {})
|
|
29151
|
+
})
|
|
29152
|
+
]
|
|
29112
29153
|
})
|
|
29113
29154
|
]
|
|
29114
29155
|
})
|
|
@@ -33082,22 +33123,6 @@ function getCoreRowModel() {
|
|
|
33082
33123
|
}));
|
|
33083
33124
|
};
|
|
33084
33125
|
}
|
|
33085
|
-
function expandRows(rowModel) {
|
|
33086
|
-
var expandedRows = [];
|
|
33087
|
-
var handleRow = function(row) {
|
|
33088
|
-
var _row$subRows;
|
|
33089
|
-
expandedRows.push(row);
|
|
33090
|
-
if ((_row$subRows = row.subRows) != null && _row$subRows.length && row.getIsExpanded()) {
|
|
33091
|
-
row.subRows.forEach(handleRow);
|
|
33092
|
-
}
|
|
33093
|
-
};
|
|
33094
|
-
rowModel.rows.forEach(handleRow);
|
|
33095
|
-
return {
|
|
33096
|
-
rows: expandedRows,
|
|
33097
|
-
flatRows: rowModel.flatRows,
|
|
33098
|
-
rowsById: rowModel.rowsById
|
|
33099
|
-
};
|
|
33100
|
-
}
|
|
33101
33126
|
function filterRows(rows, filterRowImpl, table) {
|
|
33102
33127
|
if (table.options.filterFromLeafRows) {
|
|
33103
33128
|
return filterRowModelFromLeafs(rows, filterRowImpl, table);
|
|
@@ -33298,49 +33323,6 @@ function getFilteredRowModel() {
|
|
|
33298
33323
|
}));
|
|
33299
33324
|
};
|
|
33300
33325
|
}
|
|
33301
|
-
function getPaginationRowModel(opts) {
|
|
33302
|
-
return function(table) {
|
|
33303
|
-
return memo(function() {
|
|
33304
|
-
return [
|
|
33305
|
-
table.getState().pagination,
|
|
33306
|
-
table.getPrePaginationRowModel(),
|
|
33307
|
-
table.options.paginateExpandedRows ? undefined : table.getState().expanded
|
|
33308
|
-
];
|
|
33309
|
-
}, function(pagination, rowModel) {
|
|
33310
|
-
if (!rowModel.rows.length) {
|
|
33311
|
-
return rowModel;
|
|
33312
|
-
}
|
|
33313
|
-
var pageSize = pagination.pageSize, pageIndex = pagination.pageIndex;
|
|
33314
|
-
var rows = rowModel.rows, flatRows = rowModel.flatRows, rowsById = rowModel.rowsById;
|
|
33315
|
-
var pageStart = pageSize * pageIndex;
|
|
33316
|
-
var pageEnd = pageStart + pageSize;
|
|
33317
|
-
rows = rows.slice(pageStart, pageEnd);
|
|
33318
|
-
var paginatedRowModel;
|
|
33319
|
-
if (!table.options.paginateExpandedRows) {
|
|
33320
|
-
paginatedRowModel = expandRows({
|
|
33321
|
-
rows: rows,
|
|
33322
|
-
flatRows: flatRows,
|
|
33323
|
-
rowsById: rowsById
|
|
33324
|
-
});
|
|
33325
|
-
} else {
|
|
33326
|
-
paginatedRowModel = {
|
|
33327
|
-
rows: rows,
|
|
33328
|
-
flatRows: flatRows,
|
|
33329
|
-
rowsById: rowsById
|
|
33330
|
-
};
|
|
33331
|
-
}
|
|
33332
|
-
paginatedRowModel.flatRows = [];
|
|
33333
|
-
var handleRow = function(row) {
|
|
33334
|
-
paginatedRowModel.flatRows.push(row);
|
|
33335
|
-
if (row.subRows.length) {
|
|
33336
|
-
row.subRows.forEach(handleRow);
|
|
33337
|
-
}
|
|
33338
|
-
};
|
|
33339
|
-
paginatedRowModel.rows.forEach(handleRow);
|
|
33340
|
-
return paginatedRowModel;
|
|
33341
|
-
}, getMemoOptions(table.options, 'debugTable', 'getPaginationRowModel'));
|
|
33342
|
-
};
|
|
33343
|
-
}
|
|
33344
33326
|
function getSortedRowModel() {
|
|
33345
33327
|
return function(table) {
|
|
33346
33328
|
return memo(function() {
|
|
@@ -33882,30 +33864,28 @@ var TableBody = function(param) {
|
|
|
33882
33864
|
|
|
33883
33865
|
var RowContextMenu = function(param) {
|
|
33884
33866
|
var anchorRef = param.anchorRef, _param_actions = param.actions, actions = _param_actions === void 0 ? [] : _param_actions, activeRow = param.activeRow, setActiveRow = param.setActiveRow;
|
|
33885
|
-
return /*#__PURE__*/ jsx(
|
|
33886
|
-
|
|
33887
|
-
|
|
33888
|
-
|
|
33889
|
-
|
|
33890
|
-
|
|
33891
|
-
|
|
33892
|
-
|
|
33893
|
-
|
|
33894
|
-
|
|
33895
|
-
|
|
33896
|
-
|
|
33897
|
-
|
|
33898
|
-
|
|
33899
|
-
|
|
33900
|
-
|
|
33901
|
-
|
|
33902
|
-
|
|
33903
|
-
|
|
33904
|
-
|
|
33905
|
-
|
|
33906
|
-
|
|
33907
|
-
}, i);
|
|
33908
|
-
})
|
|
33867
|
+
return /*#__PURE__*/ jsx(Popper, {
|
|
33868
|
+
open: !!activeRow,
|
|
33869
|
+
anchorRef: anchorRef,
|
|
33870
|
+
onClose: function() {
|
|
33871
|
+
anchorRef.current = null;
|
|
33872
|
+
setActiveRow(null);
|
|
33873
|
+
},
|
|
33874
|
+
offset: 4,
|
|
33875
|
+
style: {
|
|
33876
|
+
padding: "".concat(spacing(1), "px 0")
|
|
33877
|
+
},
|
|
33878
|
+
children: actions.map(function(action, i) {
|
|
33879
|
+
return /*#__PURE__*/ jsx(MenuItem, {
|
|
33880
|
+
disabled: activeRow == null ? true : typeof action.disabled === 'function' ? action.disabled(activeRow) : action.disabled,
|
|
33881
|
+
onClick: function(e) {
|
|
33882
|
+
e.stopPropagation();
|
|
33883
|
+
if (activeRow) action.onClick(activeRow);
|
|
33884
|
+
anchorRef.current = null;
|
|
33885
|
+
setActiveRow(null);
|
|
33886
|
+
},
|
|
33887
|
+
label: action.label
|
|
33888
|
+
}, i);
|
|
33909
33889
|
})
|
|
33910
33890
|
});
|
|
33911
33891
|
};
|
|
@@ -34063,7 +34043,7 @@ var TableContainer = styled(/*#__PURE__*/ forwardRef(function(props, ref) {
|
|
|
34063
34043
|
var TableWrapper = styled.table(_templateObject1$2());
|
|
34064
34044
|
var ContextMenuButton = styled(Button)(_templateObject2$2(), spacing(0.5));
|
|
34065
34045
|
var Table = function(param) {
|
|
34066
|
-
var columns = param.columns, _param_data = param.data, data = _param_data === void 0 ? [] : _param_data, getRowId = param.getRowId, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, pageInfo = param.pageInfo, subText = param.subText, onPageSizeChange = param.onPageSizeChange, onPageChange = param.onPageChange, sortBy = param.sortBy, sortOrder = param.sortOrder, onSortChange = param.onSortChange, _param_enableRowSelection = param.enableRowSelection, enableRowSelection = _param_enableRowSelection === void 0 ? false : _param_enableRowSelection, _param_selectedRows = param.selectedRows, selectedRows = _param_selectedRows === void 0 ? {} : _param_selectedRows, onRowSelectionChange = param.onRowSelectionChange, getRowDisabled = param.getRowDisabled, onRowClick = param.onRowClick, contextMenuActions = param.contextMenuActions, _param_dense = param.dense, dense = _param_dense === void 0 ? false : _param_dense, height = param.height, error = param.error, _param_testId = param.testId, testId = _param_testId === void 0 ? 'table' : _param_testId;
|
|
34046
|
+
var columns = param.columns, _param_data = param.data, data = _param_data === void 0 ? [] : _param_data, getRowId = param.getRowId, _param_isLoading = param.isLoading, isLoading = _param_isLoading === void 0 ? false : _param_isLoading, _param_paginationMode = param.paginationMode, paginationMode = _param_paginationMode === void 0 ? 'page' : _param_paginationMode, pageInfo = param.pageInfo, subText = param.subText, onPageSizeChange = param.onPageSizeChange, onPageChange = param.onPageChange, sortBy = param.sortBy, sortOrder = param.sortOrder, onSortChange = param.onSortChange, _param_enableRowSelection = param.enableRowSelection, enableRowSelection = _param_enableRowSelection === void 0 ? false : _param_enableRowSelection, _param_selectedRows = param.selectedRows, selectedRows = _param_selectedRows === void 0 ? {} : _param_selectedRows, onRowSelectionChange = param.onRowSelectionChange, getRowDisabled = param.getRowDisabled, onRowClick = param.onRowClick, contextMenuActions = param.contextMenuActions, _param_dense = param.dense, dense = _param_dense === void 0 ? false : _param_dense, height = param.height, error = param.error, _param_testId = param.testId, testId = _param_testId === void 0 ? 'table' : _param_testId;
|
|
34067
34047
|
var containerRef = useRef(null);
|
|
34068
34048
|
var ctxMenuAnchorRef = useRef(null);
|
|
34069
34049
|
var _useState = _sliced_to_array$1(useState({}), 2), columnSizing = _useState[0], setColumnSizing = _useState[1];
|
|
@@ -34208,10 +34188,6 @@ var Table = function(param) {
|
|
|
34208
34188
|
sortDescFirst: false
|
|
34209
34189
|
},
|
|
34210
34190
|
state: {
|
|
34211
|
-
pagination: pageInfo && {
|
|
34212
|
-
pageIndex: pageInfo.currentPage - 1,
|
|
34213
|
-
pageSize: pageInfo.items
|
|
34214
|
-
},
|
|
34215
34191
|
columnSizing: columnSizing,
|
|
34216
34192
|
sorting: sortBy ? [
|
|
34217
34193
|
{
|
|
@@ -34224,12 +34200,11 @@ var Table = function(param) {
|
|
|
34224
34200
|
onSortingChange: handleSortingChange,
|
|
34225
34201
|
manualPagination: true,
|
|
34226
34202
|
manualSorting: true,
|
|
34227
|
-
pageCount: pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.pageCount,
|
|
34203
|
+
pageCount: paginationMode === 'page' && pageInfo && 'currentPage' in pageInfo ? pageInfo === null || pageInfo === void 0 ? void 0 : pageInfo.pageCount : undefined,
|
|
34228
34204
|
enableColumnResizing: true,
|
|
34229
34205
|
getCoreRowModel: getCoreRowModel(),
|
|
34230
34206
|
getSortedRowModel: getSortedRowModel(),
|
|
34231
34207
|
getFilteredRowModel: getFilteredRowModel(),
|
|
34232
|
-
getPaginationRowModel: getPaginationRowModel(),
|
|
34233
34208
|
onRowSelectionChange: onRowSelectionChange,
|
|
34234
34209
|
enableRowSelection: !!enableRowSelection,
|
|
34235
34210
|
onColumnSizingChange: setColumnSizing,
|
|
@@ -34243,47 +34218,57 @@ var Table = function(param) {
|
|
|
34243
34218
|
});
|
|
34244
34219
|
return /*#__PURE__*/ jsxs("div", {
|
|
34245
34220
|
children: [
|
|
34246
|
-
/*#__PURE__*/ jsxs(
|
|
34221
|
+
/*#__PURE__*/ jsxs("div", {
|
|
34247
34222
|
style: {
|
|
34248
|
-
|
|
34223
|
+
position: 'relative',
|
|
34224
|
+
borderRadius: "".concat(spacing(1), "px"),
|
|
34225
|
+
overflow: 'hidden'
|
|
34249
34226
|
},
|
|
34250
|
-
ref: containerRef,
|
|
34251
34227
|
children: [
|
|
34252
34228
|
isLoading && /*#__PURE__*/ jsx(LoadingOverlay, {}),
|
|
34253
|
-
|
|
34254
|
-
variant: "paragraph200Regular",
|
|
34255
|
-
as: "div",
|
|
34229
|
+
/*#__PURE__*/ jsxs(TableContainer, {
|
|
34256
34230
|
style: {
|
|
34257
|
-
|
|
34258
|
-
left: '50%',
|
|
34259
|
-
top: '50%',
|
|
34260
|
-
transform: 'translate(-50%, -50%)'
|
|
34231
|
+
height: height
|
|
34261
34232
|
},
|
|
34262
|
-
|
|
34263
|
-
}),
|
|
34264
|
-
/*#__PURE__*/ jsxs(TableWrapper, {
|
|
34233
|
+
ref: containerRef,
|
|
34265
34234
|
children: [
|
|
34266
|
-
/*#__PURE__*/ jsx(
|
|
34267
|
-
|
|
34268
|
-
|
|
34269
|
-
|
|
34270
|
-
|
|
34271
|
-
|
|
34235
|
+
Boolean(!isLoading && (!(data === null || data === void 0 ? void 0 : data.length) || error)) && /*#__PURE__*/ jsx(Typography, {
|
|
34236
|
+
variant: "paragraph200Regular",
|
|
34237
|
+
as: "div",
|
|
34238
|
+
style: {
|
|
34239
|
+
position: 'absolute',
|
|
34240
|
+
left: '50%',
|
|
34241
|
+
top: '50%',
|
|
34242
|
+
transform: 'translate(-50%, -50%)'
|
|
34243
|
+
},
|
|
34244
|
+
children: !error ? 'No results found.' : error
|
|
34272
34245
|
}),
|
|
34273
|
-
/*#__PURE__*/
|
|
34274
|
-
|
|
34275
|
-
|
|
34276
|
-
|
|
34277
|
-
|
|
34278
|
-
|
|
34279
|
-
|
|
34280
|
-
|
|
34246
|
+
/*#__PURE__*/ jsxs(TableWrapper, {
|
|
34247
|
+
children: [
|
|
34248
|
+
/*#__PURE__*/ jsx(TableHeader, {
|
|
34249
|
+
table: table,
|
|
34250
|
+
columnWidths: columnWidths,
|
|
34251
|
+
disableControls: disableControls,
|
|
34252
|
+
dense: dense,
|
|
34253
|
+
testId: testId
|
|
34254
|
+
}),
|
|
34255
|
+
/*#__PURE__*/ jsx(TableBody, {
|
|
34256
|
+
table: table,
|
|
34257
|
+
columnWidths: columnWidths,
|
|
34258
|
+
enableRowSelection: enableRowSelection,
|
|
34259
|
+
onRowClick: onRowClick,
|
|
34260
|
+
getRowDisabled: getRowDisabled,
|
|
34261
|
+
dense: dense,
|
|
34262
|
+
testId: testId
|
|
34263
|
+
})
|
|
34264
|
+
]
|
|
34281
34265
|
})
|
|
34282
34266
|
]
|
|
34283
34267
|
})
|
|
34284
34268
|
]
|
|
34285
34269
|
}),
|
|
34286
|
-
onPageSizeChange && onPageChange && pageInfo && /*#__PURE__*/ jsx(Pagination, {
|
|
34270
|
+
onPageSizeChange && onPageChange && pageInfo && (paginationMode === 'page' && 'currentPage' in pageInfo ? /*#__PURE__*/ jsx(Pagination, {
|
|
34271
|
+
mode: "page",
|
|
34287
34272
|
pageInfo: pageInfo,
|
|
34288
34273
|
subText: subText,
|
|
34289
34274
|
isLoading: isLoading,
|
|
@@ -34296,7 +34281,21 @@ var Table = function(param) {
|
|
|
34296
34281
|
onPageChange(page);
|
|
34297
34282
|
},
|
|
34298
34283
|
testId: "".concat(testId, "-pagination")
|
|
34299
|
-
}),
|
|
34284
|
+
}) : /*#__PURE__*/ jsx(Pagination, {
|
|
34285
|
+
mode: "cursor",
|
|
34286
|
+
pageInfo: pageInfo,
|
|
34287
|
+
subText: subText,
|
|
34288
|
+
isLoading: isLoading,
|
|
34289
|
+
onPageSizeChange: function(size) {
|
|
34290
|
+
resetContainerScroll();
|
|
34291
|
+
onPageSizeChange(size);
|
|
34292
|
+
},
|
|
34293
|
+
onPageChange: function(page) {
|
|
34294
|
+
resetContainerScroll();
|
|
34295
|
+
onPageChange(page);
|
|
34296
|
+
},
|
|
34297
|
+
testId: "".concat(testId, "-pagination")
|
|
34298
|
+
})),
|
|
34300
34299
|
/*#__PURE__*/ jsx(RowContextMenu, {
|
|
34301
34300
|
anchorRef: ctxMenuAnchorRef,
|
|
34302
34301
|
actions: contextMenuActions,
|
package/package.json
CHANGED
|
@@ -1,16 +1,33 @@
|
|
|
1
|
-
export interface
|
|
1
|
+
export interface PageInfoPageBased {
|
|
2
|
+
currentPage: number;
|
|
3
|
+
pageSize: number;
|
|
2
4
|
pageCount: number;
|
|
3
5
|
itemCount: number;
|
|
4
|
-
currentPage: number;
|
|
5
|
-
items: number;
|
|
6
6
|
}
|
|
7
|
-
interface
|
|
8
|
-
|
|
7
|
+
export interface PageInfoCursorBased {
|
|
8
|
+
pageSize: number;
|
|
9
|
+
itemCount: number;
|
|
10
|
+
currentCursor: string[];
|
|
11
|
+
hasNextPage: boolean;
|
|
12
|
+
hasPrevPage: boolean;
|
|
13
|
+
pageIndex: number;
|
|
14
|
+
}
|
|
15
|
+
interface BasePaginationProps {
|
|
9
16
|
isLoading: boolean;
|
|
10
17
|
subText?: string;
|
|
11
18
|
onPageSizeChange: (size: number) => void;
|
|
12
|
-
onPageChange: (page: number) => void;
|
|
13
19
|
testId?: string;
|
|
14
20
|
}
|
|
15
|
-
|
|
21
|
+
interface PagePaginationProps extends BasePaginationProps {
|
|
22
|
+
mode: 'page';
|
|
23
|
+
pageInfo: PageInfoPageBased;
|
|
24
|
+
onPageChange: (page: number) => void;
|
|
25
|
+
}
|
|
26
|
+
interface CursorPaginationProps extends BasePaginationProps {
|
|
27
|
+
mode: 'cursor';
|
|
28
|
+
pageInfo: PageInfoCursorBased;
|
|
29
|
+
onPageChange: (page: 'next' | 'prev') => void;
|
|
30
|
+
}
|
|
31
|
+
export type PaginationProps = PagePaginationProps | CursorPaginationProps;
|
|
32
|
+
export declare const Pagination: ({ mode, pageInfo, isLoading, onPageSizeChange, subText, onPageChange, testId, }: PaginationProps) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
16
33
|
export {};
|
package/src/lib/Table/Table.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { HTMLProps } from 'react';
|
|
2
2
|
import { ColumnDef, OnChangeFn, Row } from '@tanstack/react-table';
|
|
3
|
-
import {
|
|
3
|
+
import { PageInfoPageBased, PageInfoCursorBased } from '../Pagination/Pagination';
|
|
4
4
|
export declare const TableContainer: import("@emotion/styled").StyledComponent<Omit<HTMLProps<HTMLDivElement>, "ref"> & import("react").RefAttributes<HTMLDivElement> & {
|
|
5
5
|
theme?: import("@emotion/react").Theme;
|
|
6
6
|
}, {}, {}>;
|
|
@@ -43,10 +43,11 @@ interface TableRowProps<T> {
|
|
|
43
43
|
contextMenuActions?: RowAction<T>[];
|
|
44
44
|
}
|
|
45
45
|
interface PaginationProps {
|
|
46
|
-
|
|
46
|
+
paginationMode?: 'page' | 'cursor';
|
|
47
|
+
pageInfo?: PageInfoPageBased | PageInfoCursorBased;
|
|
47
48
|
subText?: string;
|
|
48
49
|
onPageSizeChange?: (size: number) => void;
|
|
49
|
-
onPageChange?: (page:
|
|
50
|
+
onPageChange?: (page: any) => void;
|
|
50
51
|
}
|
|
51
52
|
interface TableDataProps<T> {
|
|
52
53
|
columns: TableColumn<T>[];
|
|
@@ -61,5 +62,5 @@ interface TableDataProps<T> {
|
|
|
61
62
|
}
|
|
62
63
|
export interface TableProps<T extends object> extends TableStyleProps, TableRowProps<T>, TableDataProps<T>, PaginationProps {
|
|
63
64
|
}
|
|
64
|
-
export declare const Table: <T extends object>({ columns, data, getRowId, isLoading, pageInfo, subText, onPageSizeChange, onPageChange, sortBy, sortOrder, onSortChange, enableRowSelection, selectedRows, onRowSelectionChange, getRowDisabled, onRowClick, contextMenuActions, dense, height, error, testId, }: TableProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
65
|
+
export declare const Table: <T extends object>({ columns, data, getRowId, isLoading, paginationMode, pageInfo, subText, onPageSizeChange, onPageChange, sortBy, sortOrder, onSortChange, enableRowSelection, selectedRows, onRowSelectionChange, getRowDisabled, onRowClick, contextMenuActions, dense, height, error, testId, }: TableProps<T>) => import("@emotion/react/jsx-runtime").JSX.Element;
|
|
65
66
|
export {};
|