@rolster/react-components 18.21.5 → 18.21.7
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 +21 -19
- package/dist/cjs/index.js.map +1 -1
- package/dist/es/index.js +21 -19
- package/dist/es/index.js.map +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.d.ts +1 -1
- package/dist/esm/components/molecules/Pagination/Pagination.js +18 -18
- package/dist/esm/components/molecules/Pagination/Pagination.js.map +1 -1
- package/dist/esm/controllers/ListController.js +3 -1
- package/dist/esm/controllers/ListController.js.map +1 -1
- package/package.json +2 -2
package/dist/es/index.js
CHANGED
|
@@ -1861,51 +1861,51 @@ function RlsLabelSwitch({ children, disabled, extended, identifier, formControl,
|
|
|
1861
1861
|
}
|
|
1862
1862
|
|
|
1863
1863
|
function RlsPagination({ suggestions, count, filter, onPagination }) {
|
|
1864
|
-
const
|
|
1865
|
-
const
|
|
1864
|
+
const [template, setTemplate] = useState();
|
|
1865
|
+
const controller = useRef();
|
|
1866
1866
|
const refreshTemplate = useCallback((template, suggestions) => {
|
|
1867
1867
|
const { firstPage, lastPage } = template;
|
|
1868
1868
|
onPagination && onPagination({ firstPage, lastPage, suggestions });
|
|
1869
1869
|
setTemplate(template);
|
|
1870
1870
|
}, [onPagination]);
|
|
1871
|
+
const refreshPagination = useCallback((pagination) => {
|
|
1872
|
+
pagination &&
|
|
1873
|
+
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1874
|
+
}, []);
|
|
1871
1875
|
useEffect(() => {
|
|
1872
|
-
|
|
1876
|
+
const pagination = new PaginationController({
|
|
1873
1877
|
suggestions,
|
|
1874
1878
|
count,
|
|
1875
|
-
position: template
|
|
1879
|
+
position: template?.currentPage.value
|
|
1876
1880
|
});
|
|
1877
|
-
|
|
1881
|
+
controller.current = pagination;
|
|
1882
|
+
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1878
1883
|
}, [suggestions, count]);
|
|
1879
1884
|
useEffect(() => {
|
|
1880
|
-
refreshPagination(controller.current
|
|
1885
|
+
refreshPagination(controller.current?.filtrable(filter));
|
|
1881
1886
|
}, [filter]);
|
|
1882
|
-
const refreshPagination = useCallback((pagination) => {
|
|
1883
|
-
if (pagination) {
|
|
1884
|
-
refreshTemplate(pagination.template, pagination.page.collection);
|
|
1885
|
-
}
|
|
1886
|
-
}, []);
|
|
1887
1887
|
const goToPagination = useCallback((page) => {
|
|
1888
|
-
refreshPagination(controller.current
|
|
1888
|
+
refreshPagination(controller.current?.goToPage(page));
|
|
1889
1889
|
}, []);
|
|
1890
1890
|
const goFirstPagination = useCallback(() => {
|
|
1891
|
-
refreshPagination(controller.current
|
|
1891
|
+
refreshPagination(controller.current?.goFirstPage());
|
|
1892
1892
|
}, []);
|
|
1893
1893
|
const goPreviousPagination = useCallback(() => {
|
|
1894
|
-
refreshPagination(controller.current
|
|
1894
|
+
refreshPagination(controller.current?.goPreviousPage());
|
|
1895
1895
|
}, []);
|
|
1896
1896
|
const goNextPagination = useCallback(() => {
|
|
1897
|
-
refreshPagination(controller.current
|
|
1897
|
+
refreshPagination(controller.current?.goNextPage());
|
|
1898
1898
|
}, []);
|
|
1899
1899
|
const goLastPagination = useCallback(() => {
|
|
1900
|
-
refreshPagination(controller.current
|
|
1900
|
+
refreshPagination(controller.current?.goLastPage());
|
|
1901
1901
|
}, []);
|
|
1902
|
-
return (jsxRuntimeExports.jsxs("div", { className: "rls-pagination", children: [jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: template
|
|
1902
|
+
return (jsxRuntimeExports.jsxs("div", { className: "rls-pagination", children: [jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goFirstPagination, disabled: template?.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-left" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goPreviousPagination, disabled: template?.firstPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-left" }) })] }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__pages", children: template?.pages.map((page, index) => {
|
|
1903
1903
|
return (jsxRuntimeExports.jsx("div", { className: renderClassStatus('rls-pagination__page', {
|
|
1904
1904
|
active: page.active
|
|
1905
1905
|
}), onClick: () => {
|
|
1906
1906
|
goToPagination(page);
|
|
1907
1907
|
}, children: page.label }, index));
|
|
1908
|
-
}) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template
|
|
1908
|
+
}) }), jsxRuntimeExports.jsx("div", { className: "rls-pagination__description", children: template?.description }), jsxRuntimeExports.jsxs("div", { className: "rls-pagination__actions", children: [jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goNextPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrow-ios-right" }) }), jsxRuntimeExports.jsx("button", { className: "rls-pagination__action", onClick: goLastPagination, disabled: template?.lastPage, children: jsxRuntimeExports.jsx(RlsIcon, { value: "arrowhead-right" }) })] })] }));
|
|
1909
1909
|
}
|
|
1910
1910
|
|
|
1911
1911
|
function RlsPickerDayItem({ day, onSelect, disabled }) {
|
|
@@ -2434,7 +2434,9 @@ function useListController(props) {
|
|
|
2434
2434
|
element && setFormValue(element);
|
|
2435
2435
|
}
|
|
2436
2436
|
else {
|
|
2437
|
-
automatic
|
|
2437
|
+
automatic
|
|
2438
|
+
? setFormValue(collection.value[0], true)
|
|
2439
|
+
: refreshState({ ...state, value: '' });
|
|
2438
2440
|
}
|
|
2439
2441
|
}
|
|
2440
2442
|
changeValueInternal.current = false;
|