@evenicanpm/portal-table-ui 1.4.1 → 1.5.0
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/auth/auth-context.d.ts +36 -0
- package/dist/features/settings/index.d.ts +2 -0
- package/dist/features/table/components/dashboard/table/actions.d.ts +14 -0
- package/dist/features/table/components/dashboard/table/data-mask-map.d.ts +2 -0
- package/dist/features/table/components/dashboard/table/details/details.d.ts +27 -0
- package/dist/features/table/components/dashboard/table/details/label.d.ts +5 -0
- package/dist/features/table/components/dashboard/table/details/rows/downloads.d.ts +6 -0
- package/dist/features/table/components/dashboard/table/details/rows/primitive.d.ts +6 -0
- package/dist/features/table/components/dashboard/table/details/rows/table.d.ts +17 -0
- package/{src/features/table/components/dashboard/table/details/styles.ts → dist/features/table/components/dashboard/table/details/styles.d.ts} +2 -10
- package/dist/features/table/components/dashboard/table/filter-render-map.d.ts +2 -0
- package/dist/features/table/components/dashboard/table/filters/date-filter.d.ts +2 -0
- package/dist/features/table/components/dashboard/table/filters/status-filter.d.ts +2 -0
- package/dist/features/table/components/dashboard/table/no-results.d.ts +2 -0
- package/dist/features/table/components/dashboard/table/status-pill.d.ts +8 -0
- package/dist/features/table/components/dashboard/table/table-header.d.ts +16 -0
- package/dist/features/table/components/dashboard/table/table-input.d.ts +11 -0
- package/dist/features/table/components/dashboard/table/table-row/action-button.d.ts +8 -0
- package/dist/features/table/components/dashboard/table/table-row/table-row.d.ts +32 -0
- package/dist/features/table/components/dashboard/table/table-row-skeleton.d.ts +6 -0
- package/dist/features/table/components/dashboard/table/table.d.ts +18 -0
- package/dist/features/table/components/dashboard/table-dashboard.d.ts +22 -0
- package/{src/features/table/index.ts → dist/features/table/index.d.ts} +1 -7
- package/dist/features/table/logic/resolvers.d.ts +21 -0
- package/dist/features/table/logic/transformers.d.ts +35 -0
- package/dist/features/table/logic/types.d.ts +8 -0
- package/{src/features/table/types/handlers.ts → dist/features/table/types/handlers.d.ts} +12 -30
- package/{src/features/table/types/index.ts → dist/features/table/types/index.d.ts} +0 -1
- package/{src/features/table/types/queries.ts → dist/features/table/types/queries.d.ts} +3 -10
- package/dist/features/table/types/schemas.d.ts +31 -0
- package/{src/index.ts → dist/index.d.ts} +0 -2
- package/dist/portal.d.ts +38 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/package.json +6 -3
- package/src/auth/auth-context.tsx +0 -86
- package/src/features/table/components/dashboard/table/actions.ts +0 -59
- package/src/features/table/components/dashboard/table/data-mask-map.ts +0 -26
- package/src/features/table/components/dashboard/table/details/details.tsx +0 -164
- package/src/features/table/components/dashboard/table/details/label.tsx +0 -26
- package/src/features/table/components/dashboard/table/details/rows/downloads.tsx +0 -26
- package/src/features/table/components/dashboard/table/details/rows/primitive.tsx +0 -26
- package/src/features/table/components/dashboard/table/details/rows/table.tsx +0 -74
- package/src/features/table/components/dashboard/table/filter-render-map.tsx +0 -9
- package/src/features/table/components/dashboard/table/filters/date-filter.tsx +0 -31
- package/src/features/table/components/dashboard/table/filters/status-filter.tsx +0 -36
- package/src/features/table/components/dashboard/table/no-results.tsx +0 -26
- package/src/features/table/components/dashboard/table/status-pill.tsx +0 -18
- package/src/features/table/components/dashboard/table/table-header.tsx +0 -62
- package/src/features/table/components/dashboard/table/table-input.tsx +0 -94
- package/src/features/table/components/dashboard/table/table-row/action-button.tsx +0 -39
- package/src/features/table/components/dashboard/table/table-row/table-row.tsx +0 -96
- package/src/features/table/components/dashboard/table/table-row-skeleton.tsx +0 -36
- package/src/features/table/components/dashboard/table/table.tsx +0 -250
- package/src/features/table/components/dashboard/table-dashboard.tsx +0 -71
- package/src/features/table/logic/resolvers.ts +0 -68
- package/src/features/table/logic/transformers.ts +0 -56
- package/src/features/table/logic/types.ts +0 -8
- package/src/features/table/types/schemas.ts +0 -50
- package/src/portal.tsx +0 -68
- package/tsconfig.json +0 -28
- package/typedoc.json +0 -10
- /package/{src/features/table/components/dashboard/index.tsx → dist/features/table/components/dashboard/index.d.ts} +0 -0
- /package/{src/features/table/components/dashboard/table/details/index.ts → dist/features/table/components/dashboard/table/details/index.d.ts} +0 -0
- /package/{src/features/table/components/dashboard/table/details/rows/index.ts → dist/features/table/components/dashboard/table/details/rows/index.d.ts} +0 -0
- /package/{src/features/table/components/dashboard/table/index.ts → dist/features/table/components/dashboard/table/index.d.ts} +0 -0
- /package/{src/features/table/logic/index.ts → dist/features/table/logic/index.d.ts} +0 -0
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { type PropsWithChildren } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Powers the auth provider that portal is wrapped in
|
|
4
|
+
* Aggregates user and session related data that is needed
|
|
5
|
+
* within the portal
|
|
6
|
+
*/
|
|
7
|
+
interface AuthProviderProps {
|
|
8
|
+
/** The user details returned from auth framework eg. next-auth **/
|
|
9
|
+
session: Session;
|
|
10
|
+
/** how to handle logout **/
|
|
11
|
+
logout: () => void;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* The context value
|
|
15
|
+
*/
|
|
16
|
+
interface AuthContext {
|
|
17
|
+
session: Session | null;
|
|
18
|
+
/** how to handle logout **/
|
|
19
|
+
logout: (() => void) | null;
|
|
20
|
+
isAuthenticated: boolean | null;
|
|
21
|
+
}
|
|
22
|
+
interface Session {
|
|
23
|
+
email: string | null | undefined;
|
|
24
|
+
name: string | null | undefined;
|
|
25
|
+
token: string | null | undefined;
|
|
26
|
+
}
|
|
27
|
+
declare const AuthContext: import("react").Context<AuthContext>;
|
|
28
|
+
/**
|
|
29
|
+
* Used to access auth details and callback handlers within the portal auth context
|
|
30
|
+
*/
|
|
31
|
+
declare const useAuth: () => AuthContext;
|
|
32
|
+
/**
|
|
33
|
+
*
|
|
34
|
+
*/
|
|
35
|
+
declare const PortalAuthProvider: ({ session, logout, children, }: PropsWithChildren<AuthProviderProps>) => import("react").JSX.Element;
|
|
36
|
+
export { PortalAuthProvider, useAuth, type AuthProviderProps, AuthContext, type Session, };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import FileDownloadOutlinedIcon from "@mui/icons-material/FileDownloadOutlined";
|
|
2
|
+
import { UseMutationOptions } from "@tanstack/react-query";
|
|
3
|
+
/**
|
|
4
|
+
*
|
|
5
|
+
* Map of action types -> MUI Icons
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export declare const actionIconMap: Record<string, typeof FileDownloadOutlinedIcon>;
|
|
9
|
+
type MutationFactory = (resourceName: string, docId: string) => UseMutationOptions<any, any, any, any>;
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
*/
|
|
13
|
+
export declare const actionMutationMap: Record<string, MutationFactory>;
|
|
14
|
+
export {};
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import type { Column } from "@evenicanpm/portal-types-schemas";
|
|
2
|
+
import type * as Types from "../../../../types";
|
|
3
|
+
import type { StatusColorMap, StatusTextMap } from "../../../../types/schemas";
|
|
4
|
+
interface DetailsProps {
|
|
5
|
+
/** What do we do when use clicks back button? */
|
|
6
|
+
handleBack: () => void;
|
|
7
|
+
/** What is the id field name */
|
|
8
|
+
id: string | number;
|
|
9
|
+
/** The actual pojo of data from the API */
|
|
10
|
+
documentData: Types.Queries.Row;
|
|
11
|
+
documentTypeLabel: string;
|
|
12
|
+
/** Special instructions for how to render certain properties */
|
|
13
|
+
detailsRenderMap?: Types.Handlers.DetailsRenderMap;
|
|
14
|
+
/** Data mask map */
|
|
15
|
+
dataMaskMap: Types.Handlers.DataMaskMap;
|
|
16
|
+
/** Table columns **/
|
|
17
|
+
columns: Column[];
|
|
18
|
+
/** */
|
|
19
|
+
statusColorMap: StatusColorMap;
|
|
20
|
+
/** */
|
|
21
|
+
statusTextMap: StatusTextMap;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* The Details Page
|
|
25
|
+
*/
|
|
26
|
+
declare const Details: ({ id, documentTypeLabel, documentData, handleBack, columns, dataMaskMap, statusColorMap, statusTextMap, }: DetailsProps) => import("react").JSX.Element;
|
|
27
|
+
export { Details };
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { Column } from "@evenicanpm/portal-types-schemas";
|
|
2
|
+
import type { DataMaskMap } from "../../../../../types/handlers";
|
|
3
|
+
interface Props {
|
|
4
|
+
column: Column;
|
|
5
|
+
value: Record<string, string>[];
|
|
6
|
+
label: string;
|
|
7
|
+
dataMaskMap: DataMaskMap;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Simple table that takes an array of records,
|
|
11
|
+
* builds array of columns from first index and then loops
|
|
12
|
+
* builds table values from rest of the indexes.
|
|
13
|
+
* @param props
|
|
14
|
+
* @returns
|
|
15
|
+
*/
|
|
16
|
+
declare const DetailsTable: (props: Props) => import("react").JSX.Element;
|
|
17
|
+
export { DetailsTable };
|
|
@@ -1,18 +1,10 @@
|
|
|
1
1
|
import type { StyledComponent } from "@emotion/styled";
|
|
2
|
-
import {
|
|
3
|
-
import { styled } from "@mui/material/styles";
|
|
4
|
-
|
|
2
|
+
import { type BoxProps } from "@mui/material";
|
|
5
3
|
/**
|
|
6
4
|
* Explicit type annotation is required here to prevent TS2742.
|
|
7
5
|
* Without it, TypeScript tries to infer complex internal types from nested
|
|
8
6
|
* node_modules (@mui/system), which leads to non-portable type definitions
|
|
9
7
|
* in monorepo or library builds.
|
|
10
8
|
*/
|
|
11
|
-
const DetailsRowBox: StyledComponent<BoxProps
|
|
12
|
-
mb: 2,
|
|
13
|
-
display: "flex",
|
|
14
|
-
alignItems: "flex-start",
|
|
15
|
-
gap: 2,
|
|
16
|
-
});
|
|
17
|
-
|
|
9
|
+
declare const DetailsRowBox: StyledComponent<BoxProps>;
|
|
18
10
|
export { DetailsRowBox };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { StatusColorMap, StatusTextMap } from "../../../types/schemas";
|
|
2
|
+
interface Props {
|
|
3
|
+
status: number | string | string[];
|
|
4
|
+
statusTextMap: StatusTextMap;
|
|
5
|
+
statusColorMap: StatusColorMap;
|
|
6
|
+
}
|
|
7
|
+
declare const StatusPill: (props: Props) => import("react").JSX.Element | null;
|
|
8
|
+
export { StatusPill };
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import { Column } from "@evenicanpm/portal-types-schemas";
|
|
3
|
+
interface TableHeaderProps {
|
|
4
|
+
hasActions: boolean;
|
|
5
|
+
columns: (Column & {
|
|
6
|
+
ColumnOrder: number;
|
|
7
|
+
})[] | undefined;
|
|
8
|
+
loading: boolean;
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
*
|
|
12
|
+
* Table handles display and caches it's own data.
|
|
13
|
+
*
|
|
14
|
+
*/
|
|
15
|
+
export default function TableHeader({ hasActions, columns, loading, }: Readonly<TableHeaderProps>): React.JSX.Element;
|
|
16
|
+
export {};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { Column } from "@evenicanpm/portal-types-schemas";
|
|
2
|
+
import React from "react";
|
|
3
|
+
interface SearchProps {
|
|
4
|
+
searchTerm: string;
|
|
5
|
+
setSearchTerm: React.Dispatch<React.SetStateAction<string>>;
|
|
6
|
+
setColumn: React.Dispatch<React.SetStateAction<string>>;
|
|
7
|
+
selectedColumn: string;
|
|
8
|
+
searchCols: Column[];
|
|
9
|
+
}
|
|
10
|
+
declare const SearchField: React.MemoExoticComponent<({ searchTerm, setSearchTerm, searchCols, selectedColumn, setColumn, }: SearchProps) => React.JSX.Element>;
|
|
11
|
+
export { SearchField };
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { Action } from "@evenicanpm/portal-types-schemas";
|
|
2
|
+
interface ActionButtonProps {
|
|
3
|
+
docId: string;
|
|
4
|
+
action: Action;
|
|
5
|
+
resourceName: string;
|
|
6
|
+
}
|
|
7
|
+
export declare function ActionButton({ action, resourceName, docId, }: Readonly<ActionButtonProps>): import("react").JSX.Element;
|
|
8
|
+
export {};
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import type React from "react";
|
|
2
|
+
import type * as Types from "../../../../types";
|
|
3
|
+
import { Action } from "@evenicanpm/portal-types-schemas";
|
|
4
|
+
/**
|
|
5
|
+
* This is what we transorm the column data into for convenient rendering.
|
|
6
|
+
*/
|
|
7
|
+
type ColumnLogic = {
|
|
8
|
+
id: string;
|
|
9
|
+
mask: string | undefined;
|
|
10
|
+
maskFn: any;
|
|
11
|
+
cellFn: ((value: string | number | string[]) => React.ReactElement<any, string | React.JSXElementConstructor<any>>) | ((value: string | number) => string | number);
|
|
12
|
+
}[] | undefined;
|
|
13
|
+
export type DocumentTableProps = {
|
|
14
|
+
/** The row to render */
|
|
15
|
+
row: Types.Queries.Row;
|
|
16
|
+
/** The render logic for each column ie data mask functions, cell maps*/
|
|
17
|
+
columnLogic: ColumnLogic;
|
|
18
|
+
/** */
|
|
19
|
+
handleClick: React.Dispatch<React.SetStateAction<string | number | null>>;
|
|
20
|
+
/** Actions renderer */
|
|
21
|
+
actions: Action[];
|
|
22
|
+
/** Does this view config have actions? */
|
|
23
|
+
/** The id field for the document (used for knowing what to set selected id to) */
|
|
24
|
+
idField: string;
|
|
25
|
+
};
|
|
26
|
+
/**
|
|
27
|
+
* A single row (document) in the table. Takes the pre-constructed column logic
|
|
28
|
+
* and executes all of the cell renders and data map functions. Also handles
|
|
29
|
+
* rendering the action icons.
|
|
30
|
+
*/
|
|
31
|
+
export default function DataTableRow({ row, columnLogic, handleClick: handleSelectDocument, actions, idField, }: Readonly<DocumentTableProps>): React.JSX.Element;
|
|
32
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { type QueryKey } from "@tanstack/react-query";
|
|
2
|
+
import type React from "react";
|
|
3
|
+
import type * as Types from "../../../types";
|
|
4
|
+
export type DocumentTableProps = {
|
|
5
|
+
resource: Types.Schemas.Resource;
|
|
6
|
+
pageSize: number;
|
|
7
|
+
setPageSize: React.Dispatch<React.SetStateAction<number>>;
|
|
8
|
+
viewConfigQuery: (resourceName: string) => {
|
|
9
|
+
queryKey: QueryKey;
|
|
10
|
+
queryFn: () => Promise<Types.Queries.TableConfig>;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
/**
|
|
14
|
+
*
|
|
15
|
+
* Table handles display and caches it's own data.
|
|
16
|
+
*
|
|
17
|
+
*/
|
|
18
|
+
export default function DocumentTable({ resource, pageSize, setPageSize, viewConfigQuery, }: Readonly<DocumentTableProps>): React.JSX.Element;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import type * as Types from "../../types";
|
|
2
|
+
import { QueryKey } from "@tanstack/react-query";
|
|
3
|
+
/**
|
|
4
|
+
* The main props for top-level table entry-point
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
export interface TableProps {
|
|
9
|
+
viewConfigQuery: (resourceName: string) => {
|
|
10
|
+
queryKey: QueryKey;
|
|
11
|
+
queryFn: () => Promise<Types.Queries.TableConfig>;
|
|
12
|
+
};
|
|
13
|
+
resources: Types.Schemas.Resource[];
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
*
|
|
17
|
+
* The TableDashboard is the main view component for the table feature.
|
|
18
|
+
* Holds state for the tabs and global pagination for all tables.
|
|
19
|
+
*
|
|
20
|
+
* @params props
|
|
21
|
+
*/
|
|
22
|
+
export declare const TableDashboard: ({ resources, viewConfigQuery }: TableProps) => import("react").JSX.Element;
|
|
@@ -3,12 +3,6 @@
|
|
|
3
3
|
|
|
4
4
|
* @packageDocumentation
|
|
5
5
|
*/
|
|
6
|
-
|
|
7
6
|
export type { DocumentTableProps } from "./components/dashboard/table/table";
|
|
8
|
-
export {
|
|
9
|
-
TableDashboard,
|
|
10
|
-
type TableProps,
|
|
11
|
-
} from "./components/dashboard/table-dashboard";
|
|
12
|
-
|
|
13
|
-
// SCHEMAS
|
|
7
|
+
export { TableDashboard, type TableProps, } from "./components/dashboard/table-dashboard";
|
|
14
8
|
export * as Table from "./types";
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { Column } from "@evenicanpm/portal-types-schemas";
|
|
2
|
+
import type * as Types from "../types";
|
|
3
|
+
/** MULTIMETHOD FOR FILTERS
|
|
4
|
+
* Allows multiple implementations
|
|
5
|
+
* based on multiple column properties.
|
|
6
|
+
* Priotizes column name, but also can
|
|
7
|
+
* use data type
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const resolveFilterUI: import("@arrows/multimethod/internal/types").Multimethod;
|
|
11
|
+
/**
|
|
12
|
+
* Dispatch identifies which properties are
|
|
13
|
+
* in handler, then provides corresponding method
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
16
|
+
export declare const resolveDataMask: import("@arrows/multimethod/internal/types").Multimethod;
|
|
17
|
+
/**
|
|
18
|
+
* Simpler, doesn't need multimethod cause only dispatches on column name
|
|
19
|
+
* @internal
|
|
20
|
+
*/
|
|
21
|
+
export declare const resolveCellUI: (col: Column, handlers: Types.Handlers.CellRenderMap) => ((value: string | number | string[]) => React.ReactElement) | ((value: string | number) => string | number);
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import type { Column } from "@evenicanpm/portal-types-schemas";
|
|
2
|
+
/**
|
|
3
|
+
* These are pure static functions that include business rules
|
|
4
|
+
* and data manipulation to get the data into the correct
|
|
5
|
+
* form for rendering.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
9
|
+
/**
|
|
10
|
+
* Gets filters and returns an array of the
|
|
11
|
+
* active filters and corresponding options
|
|
12
|
+
* in FilterRequest
|
|
13
|
+
*/
|
|
14
|
+
export declare const getActiveFilters: (columns: Column[] | undefined) => ({
|
|
15
|
+
filterName: string;
|
|
16
|
+
filterOptions: {
|
|
17
|
+
value: string | number;
|
|
18
|
+
label: string;
|
|
19
|
+
}[];
|
|
20
|
+
filterType: string;
|
|
21
|
+
} | undefined)[] | undefined;
|
|
22
|
+
/**
|
|
23
|
+
* Filters and sorts visible cols
|
|
24
|
+
*/
|
|
25
|
+
export declare const getVisibleColumns: (columns: Column[] | undefined) => (Column & {
|
|
26
|
+
ColumnOrder: number;
|
|
27
|
+
})[] | undefined;
|
|
28
|
+
/**
|
|
29
|
+
*
|
|
30
|
+
*/
|
|
31
|
+
export declare const getVisibleDetails: (columns: Column[] | undefined) => Column[] | undefined;
|
|
32
|
+
/**
|
|
33
|
+
* Filters and sorts visible cols
|
|
34
|
+
*/
|
|
35
|
+
export declare const getSearchableColumns: (columns: Column[] | undefined) => Column[] | undefined;
|
|
@@ -1,15 +1,10 @@
|
|
|
1
1
|
import type { FilterOption } from "@evenicanpm/portal-types-schemas";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
*
|
|
5
4
|
* @group View Handlers
|
|
6
5
|
*/
|
|
7
6
|
export type DataMaskMap = Record<string, MaskingFunction>;
|
|
8
|
-
export type MaskingFunction = (
|
|
9
|
-
value: string | number,
|
|
10
|
-
dataMask: string,
|
|
11
|
-
) => string;
|
|
12
|
-
|
|
7
|
+
export type MaskingFunction = (value: string | number, dataMask: string) => string;
|
|
13
8
|
/**
|
|
14
9
|
* Uses column names as keys and maps out
|
|
15
10
|
* value with specific JSX for specific column names.
|
|
@@ -20,19 +15,15 @@ export type MaskingFunction = (
|
|
|
20
15
|
* @group View Handlers
|
|
21
16
|
*/
|
|
22
17
|
export interface CellRenderMap {
|
|
23
|
-
|
|
24
|
-
value: string | number | string[],
|
|
25
|
-
) => React.ReactElement;
|
|
18
|
+
[ColumnName: string]: (value: string | number | string[]) => React.ReactElement;
|
|
26
19
|
}
|
|
27
|
-
|
|
28
20
|
export interface FilterProps {
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
21
|
+
filterName: string;
|
|
22
|
+
filterOptions: FilterOption[];
|
|
23
|
+
value: Record<string, string>;
|
|
24
|
+
setValue: React.Dispatch<React.SetStateAction<Record<string, string>>>;
|
|
25
|
+
resetPagination: () => void;
|
|
34
26
|
}
|
|
35
|
-
|
|
36
27
|
/**
|
|
37
28
|
*
|
|
38
29
|
* Provides render methods for particular filter
|
|
@@ -45,27 +36,18 @@ export interface FilterProps {
|
|
|
45
36
|
* @group View Handlers
|
|
46
37
|
*/
|
|
47
38
|
export interface FilterRenderMap {
|
|
48
|
-
|
|
39
|
+
[ColumnName: string]: (props: FilterProps) => React.ReactElement;
|
|
49
40
|
}
|
|
50
|
-
|
|
51
41
|
/**
|
|
52
42
|
*
|
|
53
43
|
* @group View Handlers
|
|
54
44
|
*/
|
|
55
45
|
export interface EmptyStateProps {
|
|
56
|
-
|
|
46
|
+
label: string;
|
|
57
47
|
}
|
|
58
|
-
|
|
59
48
|
export type NoResultsComponent = (props: EmptyStateProps) => React.ReactElement;
|
|
60
|
-
|
|
61
49
|
export interface DetailsRenderMap {
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
| number
|
|
66
|
-
| object
|
|
67
|
-
| string[]
|
|
68
|
-
| number[]
|
|
69
|
-
| object[];
|
|
70
|
-
}) => React.ReactNode;
|
|
50
|
+
[columnName: string]: (props: {
|
|
51
|
+
[columnName: string]: string | number | object | string[] | number[] | object[];
|
|
52
|
+
}) => React.ReactNode;
|
|
71
53
|
}
|
|
@@ -1,31 +1,24 @@
|
|
|
1
1
|
import type { ViewConfig } from "@evenicanpm/portal-types-schemas";
|
|
2
|
-
|
|
3
2
|
/**
|
|
4
3
|
*
|
|
5
4
|
* These are data types returned from API Backend
|
|
6
5
|
*
|
|
7
6
|
*/
|
|
8
|
-
|
|
9
7
|
/**
|
|
10
8
|
*
|
|
11
9
|
* A single row in the data table response object.
|
|
12
10
|
*
|
|
13
11
|
*/
|
|
14
|
-
export type Row = Record<
|
|
15
|
-
string,
|
|
16
|
-
string | number | string[] | Record<string, string>[] | unknown
|
|
17
|
-
>;
|
|
18
|
-
|
|
12
|
+
export type Row = Record<string, string | number | string[] | Record<string, string>[] | unknown>;
|
|
19
13
|
/**
|
|
20
14
|
*
|
|
21
15
|
* The response type defined in TDD for row data.
|
|
22
16
|
*
|
|
23
17
|
*/
|
|
24
18
|
export interface TableRows {
|
|
25
|
-
|
|
26
|
-
|
|
19
|
+
items: number;
|
|
20
|
+
data: Row[];
|
|
27
21
|
}
|
|
28
|
-
|
|
29
22
|
/**
|
|
30
23
|
*
|
|
31
24
|
* Response type of data from table config
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { TableViewParams } from "@evenicanpm/portal-types-schemas";
|
|
2
|
+
import type { CellRenderMap, DataMaskMap, DetailsRenderMap, FilterRenderMap, NoResultsComponent } from "./handlers";
|
|
3
|
+
import type { TableRows } from "./queries";
|
|
4
|
+
/**
|
|
5
|
+
* These are primary domain models and the source of truth for table system.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Status maps
|
|
9
|
+
*/
|
|
10
|
+
export type StatusTextMap = Record<number | string, string>;
|
|
11
|
+
export type StatusColor = "success" | "primary" | "warning" | "error";
|
|
12
|
+
export type StatusColorMap = Record<number | string, StatusColor>;
|
|
13
|
+
/**
|
|
14
|
+
* Resource Definition
|
|
15
|
+
*/
|
|
16
|
+
export interface Resource {
|
|
17
|
+
name: string;
|
|
18
|
+
label: string;
|
|
19
|
+
idField: string;
|
|
20
|
+
rowsQueryFn: (displaySettings: TableViewParams) => {
|
|
21
|
+
queryKey: readonly unknown[];
|
|
22
|
+
queryFn: () => Promise<TableRows>;
|
|
23
|
+
};
|
|
24
|
+
cellRenderMap?: CellRenderMap;
|
|
25
|
+
dataMaskMap?: DataMaskMap;
|
|
26
|
+
filterRenderMap?: FilterRenderMap;
|
|
27
|
+
noResultsComponent?: NoResultsComponent;
|
|
28
|
+
detailsRenderMap?: DetailsRenderMap;
|
|
29
|
+
statusTextMap: StatusTextMap;
|
|
30
|
+
statusColorMap: StatusColorMap;
|
|
31
|
+
}
|
package/dist/portal.d.ts
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import type { PropsWithChildren } from "react";
|
|
2
|
+
import { type AuthProviderProps } from "./auth/auth-context";
|
|
3
|
+
/**
|
|
4
|
+
* Main Entry point properties into portal package
|
|
5
|
+
*
|
|
6
|
+
*
|
|
7
|
+
*/
|
|
8
|
+
interface PortalProps extends AuthProviderProps {
|
|
9
|
+
}
|
|
10
|
+
/**
|
|
11
|
+
* The main **e4Portal** entry point.
|
|
12
|
+
* * This is a React Functional Component that provides the core context
|
|
13
|
+
* and layout for the application. It is required to wrap all components
|
|
14
|
+
* that use the library's hooks or sub-components.
|
|
15
|
+
*
|
|
16
|
+
*
|
|
17
|
+
* @param props - The properties passed to the Portal component.
|
|
18
|
+
* @returns A React Element rendering the main application structure.
|
|
19
|
+
*/
|
|
20
|
+
declare const Portal: {
|
|
21
|
+
({ session, logout, children, }: PropsWithChildren<PortalProps>): import("react").JSX.Element;
|
|
22
|
+
/**
|
|
23
|
+
*
|
|
24
|
+
* # Feature: Table
|
|
25
|
+
* This is the table feature component.
|
|
26
|
+
* @params props
|
|
27
|
+
*
|
|
28
|
+
*/
|
|
29
|
+
Table: ({ resources, viewConfigQuery }: import("./features/table/components/dashboard/table-dashboard").TableProps) => import("react").JSX.Element;
|
|
30
|
+
};
|
|
31
|
+
/**
|
|
32
|
+
*
|
|
33
|
+
* # Feature: Settings
|
|
34
|
+
* This is the table feature component.
|
|
35
|
+
* @params props
|
|
36
|
+
*
|
|
37
|
+
*/
|
|
38
|
+
export { Portal, type PortalProps };
|