ab-ui-library 1.1.10 → 1.1.11
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/components/AdvancedTable/AdvancedPagination.js +6 -1
- package/components/AdvancedTable/Table.d.ts +1 -1
- package/components/AdvancedTable/Table.js +3 -1
- package/components/AdvancedTable/types.d.ts +1 -0
- package/components/AdvancedTable/useTable.d.ts +1 -1
- package/components/AdvancedTable/useTable.js +2 -0
- package/package.json +1 -1
|
@@ -112,6 +112,11 @@ function AdvancedPagination(_ref) {
|
|
|
112
112
|
var page = navigatePage ? Number(navigatePage) - 1 : 0;
|
|
113
113
|
table.setPageIndex(page);
|
|
114
114
|
};
|
|
115
|
+
var onRowCountChange = function onRowCountChange(value) {
|
|
116
|
+
if (value) {
|
|
117
|
+
table.setPageSize(Number(value));
|
|
118
|
+
}
|
|
119
|
+
};
|
|
115
120
|
var getVisiblePageNumbers = function getVisiblePageNumbers() {
|
|
116
121
|
var currentPage = pageIndex;
|
|
117
122
|
var totalPages = table.getPageCount();
|
|
@@ -137,7 +142,7 @@ function AdvancedPagination(_ref) {
|
|
|
137
142
|
className: "advanced-table__pagination"
|
|
138
143
|
}, /*#__PURE__*/React.createElement(Select, {
|
|
139
144
|
setSelectedItem: function setSelectedItem(value) {
|
|
140
|
-
return
|
|
145
|
+
return onRowCountChange(value);
|
|
141
146
|
},
|
|
142
147
|
selectedItem: "".concat(pageSize),
|
|
143
148
|
className: 'no-border',
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
import type { TTableProps } from './types';
|
|
2
|
-
export declare function Table<TData>({ data, columns, isLoading, hasError, tableHeight, emptyTitle, emptySubTitle, emptyIllustration, withSelect, withBorder,
|
|
2
|
+
export declare function Table<TData>({ data, columns, isLoading, hasError, totalCount, tableHeight, emptyTitle, emptySubTitle, emptyIllustration, withSelect, withBorder, reloadButtonText, reloadButtonIcon, defaultPageIndex, defaultPageSize, reloadAction, renderHeader, renderFooter, onSortChange, onRowClick, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
@@ -54,6 +54,7 @@ function Table(_ref) {
|
|
|
54
54
|
columns = _ref.columns,
|
|
55
55
|
isLoading = _ref.isLoading,
|
|
56
56
|
hasError = _ref.hasError,
|
|
57
|
+
totalCount = _ref.totalCount,
|
|
57
58
|
_ref$tableHeight = _ref.tableHeight,
|
|
58
59
|
tableHeight = _ref$tableHeight === void 0 ? '70vh' : _ref$tableHeight,
|
|
59
60
|
emptyTitle = _ref.emptyTitle,
|
|
@@ -63,11 +64,11 @@ function Table(_ref) {
|
|
|
63
64
|
withSelect = _ref$withSelect === void 0 ? false : _ref$withSelect,
|
|
64
65
|
_ref$withBorder = _ref.withBorder,
|
|
65
66
|
withBorder = _ref$withBorder === void 0 ? true : _ref$withBorder,
|
|
66
|
-
reloadAction = _ref.reloadAction,
|
|
67
67
|
reloadButtonText = _ref.reloadButtonText,
|
|
68
68
|
reloadButtonIcon = _ref.reloadButtonIcon,
|
|
69
69
|
defaultPageIndex = _ref.defaultPageIndex,
|
|
70
70
|
defaultPageSize = _ref.defaultPageSize,
|
|
71
|
+
reloadAction = _ref.reloadAction,
|
|
71
72
|
renderHeader = _ref.renderHeader,
|
|
72
73
|
renderFooter = _ref.renderFooter,
|
|
73
74
|
onSortChange = _ref.onSortChange,
|
|
@@ -79,6 +80,7 @@ function Table(_ref) {
|
|
|
79
80
|
data: data,
|
|
80
81
|
columns: columns,
|
|
81
82
|
withSelect: withSelect,
|
|
83
|
+
totalCount: totalCount,
|
|
82
84
|
defaultPageIndex: defaultPageIndex,
|
|
83
85
|
defaultPageSize: defaultPageSize,
|
|
84
86
|
onSortChange: onSortChange,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { DragEndEvent, DragStartEvent } from '@dnd-kit/core';
|
|
2
2
|
import type { Column, TTableProps } from './types';
|
|
3
|
-
export declare function useTable<TData>({ withSelect, columns, data, defaultPageSize, defaultPageIndex, onSortChange, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): {
|
|
3
|
+
export declare function useTable<TData>({ withSelect, columns, data, totalCount, defaultPageSize, defaultPageIndex, onSortChange, onRowSelection, onColumnSizing, onPaginationChange }: TTableProps<TData>): {
|
|
4
4
|
table: import("@tanstack/react-table").Table<TData>;
|
|
5
5
|
activeHeader: import("@tanstack/react-table").Header<TData, unknown> | null | undefined;
|
|
6
6
|
sensors: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
|
|
@@ -34,6 +34,7 @@ function useTable(_ref) {
|
|
|
34
34
|
var withSelect = _ref.withSelect,
|
|
35
35
|
columns = _ref.columns,
|
|
36
36
|
data = _ref.data,
|
|
37
|
+
totalCount = _ref.totalCount,
|
|
37
38
|
_ref$defaultPageSize = _ref.defaultPageSize,
|
|
38
39
|
defaultPageSize = _ref$defaultPageSize === void 0 ? 10 : _ref$defaultPageSize,
|
|
39
40
|
_ref$defaultPageIndex = _ref.defaultPageIndex,
|
|
@@ -136,6 +137,7 @@ function useTable(_ref) {
|
|
|
136
137
|
var table = useReactTable({
|
|
137
138
|
data: data,
|
|
138
139
|
columns: reorderedColumns,
|
|
140
|
+
pageCount: Math.ceil(totalCount / pagination.pageSize),
|
|
139
141
|
state: {
|
|
140
142
|
sorting: sorting,
|
|
141
143
|
pagination: pagination,
|