@equinor/fusion
Advanced tools
Comparing version 0.1.71 to 0.1.72
@@ -18,3 +18,3 @@ export { IAuthContainer, default as AuthContainer } from "./auth/AuthContainer"; | ||
export { useTasksContainer, useTasks, useTaskSourceSystems, useTaskTypes, useTaskPrioritySetter } from "./core/TasksContainer"; | ||
export { createPagination, applyPagination, usePagination, useAsyncPagination, Page, Pagination } from "./utils/Pagination"; | ||
export { createPagination, applyPagination, usePagination, useAsyncPagination, Page, Pagination, PaginationResult } from "./utils/Pagination"; | ||
export * from "./http/hooks/dataProxy/useHandover"; |
@@ -7,3 +7,3 @@ /// <reference types="react" /> | ||
export declare type Pagination = { | ||
rowCount: number; | ||
totalCount: number; | ||
perPage: number; | ||
@@ -20,4 +20,4 @@ pageCount: number; | ||
export declare const applyPagination: <T>(data: T[], { perPage, currentPage }: Pagination) => T[]; | ||
export declare const createPagination: (rowCount: number, perPage: number, currentPageIndex?: number, padding?: number) => { | ||
rowCount: number; | ||
export declare const createPagination: (totalCount: number, perPage: number, currentPageIndex?: number, padding?: number) => { | ||
totalCount: number; | ||
perPage: number; | ||
@@ -24,0 +24,0 @@ pageCount: number; |
@@ -35,4 +35,4 @@ import { useState, useEffect } from "react"; | ||
}; | ||
export const createPagination = (rowCount, perPage, currentPageIndex = 0, padding = 3) => { | ||
const pageCount = Math.ceil(rowCount / perPage); | ||
export const createPagination = (totalCount, perPage, currentPageIndex = 0, padding = 3) => { | ||
const pageCount = Math.ceil(totalCount / perPage); | ||
const pages = []; | ||
@@ -49,3 +49,3 @@ for (let i = 0; i < pageCount; i++) { | ||
return { | ||
rowCount, | ||
totalCount, | ||
perPage, | ||
@@ -102,4 +102,6 @@ pageCount, | ||
useEffect(() => { | ||
setData([]); | ||
setPagination(createPagination(pagination.totalCount, internalPerPage, internalCurrentPageIndex, padding)); | ||
applyPaginationAsync(); | ||
}, [fetchAsync, internalCurrentPageIndex, internalPerPage]); | ||
}, [internalCurrentPageIndex, internalPerPage]); | ||
return { | ||
@@ -106,0 +108,0 @@ pagination, |
{ | ||
"name": "@equinor/fusion", | ||
"version": "0.1.71", | ||
"version": "0.1.72", | ||
"description": "Everything a Fusion app needs to communicate with the core", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
146340
3465