fis-component 0.1.20 → 0.1.21
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/cjs/index.js +16 -5
- package/dist/cjs/index.js.map +1 -1
- package/dist/cjs/types/src/components/Pagination/Pagination.stories.d.ts +11 -0
- package/dist/cjs/types/src/components/Pagination/index.d.ts +3 -0
- package/dist/cjs/types/src/components/Table/Table/Table.stories.d.ts +2 -1
- package/dist/cjs/types/src/components/Table/Table/index.d.ts +3 -2
- package/dist/cjs/types/src/index.d.ts +2 -0
- package/dist/esm/index.js +16 -5
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/types/src/components/Pagination/Pagination.stories.d.ts +11 -0
- package/dist/esm/types/src/components/Pagination/index.d.ts +3 -0
- package/dist/esm/types/src/components/Table/Table/Table.stories.d.ts +2 -1
- package/dist/esm/types/src/components/Table/Table/index.d.ts +3 -2
- package/dist/esm/types/src/index.d.ts +2 -0
- package/dist/index.d.ts +7 -3
- package/package.json +1 -1
package/dist/cjs/index.js
CHANGED
|
@@ -75949,7 +75949,13 @@ const SpanTotalSC = styled.span `
|
|
|
75949
75949
|
`;
|
|
75950
75950
|
|
|
75951
75951
|
const LIMIT_DEFAULT = 10;
|
|
75952
|
-
const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minimize, recordCounted, onIconPageRecordClick, showTotal, ...rest }) => {
|
|
75952
|
+
const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minimize, recordCounted, scrollToFirstRowOnChange = true, tableRef, onIconPageRecordClick, showTotal, onChange, onShowSizeChange, ...rest }) => {
|
|
75953
|
+
const scrollToFirstRow = () => {
|
|
75954
|
+
if (scrollToFirstRowOnChange) {
|
|
75955
|
+
tableRef?.current?.scrollTo({ top: 0 });
|
|
75956
|
+
tableRef?.current?.nativeElement.scrollIntoView({ block: "start" });
|
|
75957
|
+
}
|
|
75958
|
+
};
|
|
75953
75959
|
const rangeRecords = React.useMemo(() => {
|
|
75954
75960
|
return [
|
|
75955
75961
|
(current - 1) * pageSize + 1,
|
|
@@ -75981,7 +75987,10 @@ const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minim
|
|
|
75981
75987
|
}
|
|
75982
75988
|
return originalElement;
|
|
75983
75989
|
};
|
|
75984
|
-
return (jsxRuntime.jsxs(DivPaginationContainer, { children: [jsxRuntime.jsx(SpanTotalSC, { children: showTotal ? showTotal(total, rangeRecords) : defaultShowTotal }), jsxRuntime.jsxs(DivPaginationContent, { children: [jsxRuntime.jsx(PaginationAntdSC, { ...mergedProps, "$minimize": Boolean(minimize), showSizeChanger: false, itemRender: itemRender
|
|
75990
|
+
return (jsxRuntime.jsxs(DivPaginationContainer, { children: [jsxRuntime.jsx(SpanTotalSC, { children: showTotal ? showTotal(total, rangeRecords) : defaultShowTotal }), jsxRuntime.jsxs(DivPaginationContent, { children: [jsxRuntime.jsx(PaginationAntdSC, { ...mergedProps, "$minimize": Boolean(minimize), showSizeChanger: false, itemRender: itemRender, onChange: (page, size) => {
|
|
75991
|
+
onChange?.(page, size);
|
|
75992
|
+
scrollToFirstRow();
|
|
75993
|
+
} }), jsxRuntime.jsx(FISSelect, { style: { width: "100px" }, size: "xs", options: [
|
|
75985
75994
|
{
|
|
75986
75995
|
groupLabel: "",
|
|
75987
75996
|
items: (rest.pageSizeOptions || [10, 20, 50, 100]).map((size) => ({
|
|
@@ -75990,9 +75999,11 @@ const FISPagination = ({ pageSize = LIMIT_DEFAULT, current = 1, total = 0, minim
|
|
|
75990
75999
|
})),
|
|
75991
76000
|
},
|
|
75992
76001
|
], value: String(pageSize), multi: false, onChange: (value) => {
|
|
75993
|
-
|
|
75994
|
-
|
|
75995
|
-
|
|
76002
|
+
const nextPageSize = Number(value);
|
|
76003
|
+
const nextCurrent = Math.min(current, Math.max(1, Math.ceil(total / nextPageSize)));
|
|
76004
|
+
onShowSizeChange?.(nextCurrent, nextPageSize);
|
|
76005
|
+
onChange?.(nextCurrent, nextPageSize);
|
|
76006
|
+
scrollToFirstRow();
|
|
75996
76007
|
} })] })] }));
|
|
75997
76008
|
};
|
|
75998
76009
|
|