@idds/react 1.5.39 → 1.5.40

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.es.js CHANGED
@@ -5895,6 +5895,7 @@ function Spinner({
5895
5895
  function Table({
5896
5896
  columns,
5897
5897
  fetchData,
5898
+ initialPage = 1,
5898
5899
  initialPageSize = 10,
5899
5900
  pageSizeOptions = [10, 20, 50],
5900
5901
  initialSortField = null,
@@ -5921,7 +5922,7 @@ function Table({
5921
5922
  const [loading, setLoading] = useState(false);
5922
5923
  const tableRef = useRef(null);
5923
5924
  const reactId = useId();
5924
- const [page, setPage] = useState(1);
5925
+ const [page, setPage] = useState(initialPage);
5925
5926
  const [pageSize, setPageSize] = useState(initialPageSize);
5926
5927
  const [sortField, setSortField] = useState(initialSortField);
5927
5928
  const [sortOrder, setSortOrder] = useState(
@@ -5966,6 +5967,9 @@ function Table({
5966
5967
  ctl.abort();
5967
5968
  };
5968
5969
  }, [page, pageSize, sortField, sortOrder, searchTerm, fetchData]);
5970
+ useEffect(() => {
5971
+ setPage(initialPage);
5972
+ }, [initialPage]);
5969
5973
  const toggleAll = () => {
5970
5974
  const next = !allSelected;
5971
5975
  const newMap = {};