Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@equinor/fusion

Package Overview
Dependencies
Maintainers
2
Versions
485
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@equinor/fusion - npm Package Compare versions

Comparing version 0.1.67 to 0.1.69

8

lib/core/ComponentDisplayType.d.ts

@@ -6,1 +6,9 @@ export declare enum ComponentDisplayType {

export declare const useComponentDisplayType: () => ComponentDisplayType;
declare type ComponentDisplayStyles = {
comfortable: string;
compact: string;
};
export declare const useComponentDisplayClassNames: <T extends ComponentDisplayStyles>(styles: T) => {
[x: string]: boolean;
};
export {};

@@ -11,1 +11,8 @@ import useCoreSettings from "../settings/useCoreSettings";

};
export const useComponentDisplayClassNames = (styles) => {
const displayType = useComponentDisplayType();
return {
[styles.comfortable]: displayType === ComponentDisplayType.Comfortable,
[styles.compact]: displayType === ComponentDisplayType.Compact,
};
};

4

lib/index.d.ts

@@ -14,7 +14,7 @@ export { IAuthContainer, default as AuthContainer } from "./auth/AuthContainer";

export { withAbortController, useAbortControllerManager } from "./utils/AbortControllerManager";
export { useComponentDisplayType, ComponentDisplayType } from "./core/ComponentDisplayType";
export { useComponentDisplayType, useComponentDisplayClassNames, ComponentDisplayType } from "./core/ComponentDisplayType";
export * from "./utils/url";
export { default as useHistory, HistoryContext, IHistoryContext } from "./hooks/useHistory";
export { useTasksContainer, useTasks, useTaskSourceSystems, useTaskTypes, useTaskPrioritySetter } from "./core/TasksContainer";
export { default as createPagination, applyPagination, Page, Pagination } from "./utils/Pagination";
export { createPagination, applyPagination, usePagination, Page, Pagination } from "./utils/Pagination";
export * from "./http/hooks/dataProxy/useHandover";

@@ -13,7 +13,7 @@ export { default as AuthContainer } from "./auth/AuthContainer";

export { withAbortController, useAbortControllerManager } from "./utils/AbortControllerManager";
export { useComponentDisplayType, ComponentDisplayType } from "./core/ComponentDisplayType";
export { useComponentDisplayType, useComponentDisplayClassNames, ComponentDisplayType } from "./core/ComponentDisplayType";
export * from "./utils/url";
export { default as useHistory, HistoryContext } from "./hooks/useHistory";
export { useTasksContainer, useTasks, useTaskSourceSystems, useTaskTypes, useTaskPrioritySetter } from "./core/TasksContainer";
export { default as createPagination, applyPagination } from "./utils/Pagination";
export { createPagination, applyPagination, usePagination } from "./utils/Pagination";
export * from "./http/hooks/dataProxy/useHandover";

@@ -0,1 +1,2 @@

/// <reference types="react" />
export declare type Page = {

@@ -18,3 +19,3 @@ index: number;

export declare const applyPagination: <T>(data: T[], { perPage, currentPage }: Pagination) => T[];
declare const _default: (rowCount: number, perPage: number, currentPageIndex?: number, padding?: number) => {
export declare const createPagination: (rowCount: number, perPage: number, currentPageIndex?: number, padding?: number) => {
rowCount: number;

@@ -31,2 +32,6 @@ perPage: number;

};
export default _default;
export declare const usePagination: <T>(data: T[], perPage: number, currentPageIndex?: number, padding?: number) => {
pagination: Pagination;
pagedData: T[];
setCurrentPageIndex: import("react").Dispatch<import("react").SetStateAction<number>>;
};

@@ -0,1 +1,2 @@

import { useState, useEffect } from 'react';
const getPaginationHead = (pages, currentPage, padding) => {

@@ -32,5 +33,5 @@ if (currentPage.index < padding || pages.length <= padding) {

export const applyPagination = (data, { perPage, currentPage }) => {
return data.slice(perPage * currentPage.index, perPage);
return data.slice(perPage * currentPage.index, perPage * currentPage.index + perPage);
};
export default (rowCount, perPage, currentPageIndex = 0, padding = 3) => {
export const createPagination = (rowCount, perPage, currentPageIndex = 0, padding = 3) => {
const pageCount = Math.ceil(rowCount / perPage);

@@ -60,1 +61,17 @@ const pages = [];

};
export const usePagination = (data, perPage, currentPageIndex = 0, padding = 3) => {
const [internalCurrentPageIndex, setCurrentPageIndex] = useState(currentPageIndex);
const [pagination, setPagination] = useState(createPagination(data.length, perPage, currentPageIndex, padding));
const [pagedData, setPagedData] = useState(applyPagination(data, pagination));
useEffect(() => {
const newPagination = createPagination(data.length, perPage, currentPageIndex, padding);
const newPagedData = applyPagination(data, newPagination);
setPagination(newPagination);
setPagedData(newPagedData);
}, [data, internalCurrentPageIndex]);
return {
pagination,
pagedData,
setCurrentPageIndex,
};
};
{
"name": "@equinor/fusion",
"version": "0.1.67",
"version": "0.1.69",
"description": "Everything a Fusion app needs to communicate with the core",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc