@evenicanpm/portal-table-ui 1.4.1 → 1.6.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.
Files changed (41) hide show
  1. package/dist/auth/auth-context.d.ts +36 -0
  2. package/dist/features/settings/index.d.ts +2 -0
  3. package/dist/features/table/components/dashboard/index.d.ts +1 -0
  4. package/dist/features/table/components/dashboard/table/actions.d.ts +14 -0
  5. package/dist/features/table/components/dashboard/table/data-mask-map.d.ts +2 -0
  6. package/dist/features/table/components/dashboard/table/details/details.d.ts +27 -0
  7. package/dist/features/table/components/dashboard/table/details/index.d.ts +1 -0
  8. package/dist/features/table/components/dashboard/table/details/label.d.ts +5 -0
  9. package/dist/features/table/components/dashboard/table/details/rows/downloads.d.ts +6 -0
  10. package/dist/features/table/components/dashboard/table/details/rows/index.d.ts +3 -0
  11. package/dist/features/table/components/dashboard/table/details/rows/primitive.d.ts +6 -0
  12. package/dist/features/table/components/dashboard/table/details/rows/table.d.ts +17 -0
  13. package/dist/features/table/components/dashboard/table/details/styles.d.ts +10 -0
  14. package/dist/features/table/components/dashboard/table/filter-render-map.d.ts +2 -0
  15. package/dist/features/table/components/dashboard/table/filters/date-filter.d.ts +2 -0
  16. package/dist/features/table/components/dashboard/table/filters/status-filter.d.ts +2 -0
  17. package/dist/features/table/components/dashboard/table/index.d.ts +2 -0
  18. package/dist/features/table/components/dashboard/table/no-results.d.ts +2 -0
  19. package/dist/features/table/components/dashboard/table/status-pill.d.ts +8 -0
  20. package/dist/features/table/components/dashboard/table/table-header.d.ts +16 -0
  21. package/dist/features/table/components/dashboard/table/table-input.d.ts +11 -0
  22. package/dist/features/table/components/dashboard/table/table-row/action-button.d.ts +8 -0
  23. package/dist/features/table/components/dashboard/table/table-row/table-row.d.ts +32 -0
  24. package/dist/features/table/components/dashboard/table/table-row-skeleton.d.ts +6 -0
  25. package/dist/features/table/components/dashboard/table/table.d.ts +18 -0
  26. package/dist/features/table/components/dashboard/table-dashboard.d.ts +22 -0
  27. package/dist/features/table/index.d.ts +8 -0
  28. package/dist/features/table/logic/index.d.ts +23 -0
  29. package/dist/features/table/logic/resolvers.d.ts +21 -0
  30. package/dist/features/table/logic/transformers.d.ts +35 -0
  31. package/dist/features/table/logic/types.d.ts +8 -0
  32. package/dist/features/table/types/handlers.d.ts +53 -0
  33. package/dist/features/table/types/index.d.ts +69 -0
  34. package/dist/features/table/types/queries.d.ts +27 -0
  35. package/dist/features/table/types/schemas.d.ts +31 -0
  36. package/dist/index.d.ts +63 -0
  37. package/dist/portal.d.ts +38 -0
  38. package/dist/tsconfig.tsbuildinfo +1 -0
  39. package/package.json +8 -4
  40. package/tsconfig.json +0 -28
  41. package/typedoc.json +0 -10
@@ -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,2 @@
1
+ declare const PortalSettings: () => import("react").JSX.Element;
2
+ export { PortalSettings };
@@ -0,0 +1 @@
1
+ export { TableDashboard } from "./table-dashboard";
@@ -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,2 @@
1
+ import * as Table from "../../../types/";
2
+ export declare const dataMaskMap: Table.Handlers.DataMaskMap;
@@ -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 @@
1
+ export { Details } from "./details";
@@ -0,0 +1,5 @@
1
+ interface Props {
2
+ label: string;
3
+ }
4
+ declare const DetailsRowLabel: (props: Props) => import("react").JSX.Element;
5
+ export { DetailsRowLabel };
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ label: string;
3
+ value: string[];
4
+ }
5
+ declare const DetailsDownloads: ({ value }: Props) => import("react").JSX.Element;
6
+ export { DetailsDownloads };
@@ -0,0 +1,3 @@
1
+ export { DetailsDownloads } from "./downloads";
2
+ export { DetailsPrimitive } from "./primitive";
3
+ export { DetailsTable } from "./table";
@@ -0,0 +1,6 @@
1
+ interface Props {
2
+ label: string;
3
+ value: string | number;
4
+ }
5
+ declare const DetailsPrimitive: (props: Props) => import("react").JSX.Element;
6
+ export { DetailsPrimitive };
@@ -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 };
@@ -0,0 +1,10 @@
1
+ import type { StyledComponent } from "@emotion/styled";
2
+ import { type BoxProps } from "@mui/material";
3
+ /**
4
+ * Explicit type annotation is required here to prevent TS2742.
5
+ * Without it, TypeScript tries to infer complex internal types from nested
6
+ * node_modules (@mui/system), which leads to non-portable type definitions
7
+ * in monorepo or library builds.
8
+ */
9
+ declare const DetailsRowBox: StyledComponent<BoxProps>;
10
+ export { DetailsRowBox };
@@ -0,0 +1,2 @@
1
+ import * as Table from "../../../types/";
2
+ export declare const filterRenderMapFallback: Table.Handlers.FilterRenderMap;
@@ -0,0 +1,2 @@
1
+ import * as Table from "../../../../types";
2
+ export declare const DateFilter: (props: Table.Handlers.FilterProps) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import * as Table from "../../../../types/";
2
+ export declare const StatusFilter: (props: Table.Handlers.FilterProps) => import("react").JSX.Element;
@@ -0,0 +1,2 @@
1
+ import Table from "./table";
2
+ export { Table };
@@ -0,0 +1,2 @@
1
+ import * as Table from "../../../types/";
2
+ export declare const NoResultsComponent: Table.Handlers.NoResultsComponent;
@@ -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,6 @@
1
+ import type React from "react";
2
+ export type TableRowSkeletonProps = {
3
+ pageSize: number;
4
+ colSpan: number;
5
+ };
6
+ export default function TableRowSkeleton({ pageSize, colSpan, }: Readonly<TableRowSkeletonProps>): React.JSX.Element;
@@ -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;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * @author Sam Forderer
3
+
4
+ * @packageDocumentation
5
+ */
6
+ export type { DocumentTableProps } from "./components/dashboard/table/table";
7
+ export { TableDashboard, type TableProps, } from "./components/dashboard/table-dashboard";
8
+ export * as Table from "./types";
@@ -0,0 +1,23 @@
1
+ /**
2
+ *
3
+ * Purpose of resolvers is to resolve the handlers
4
+ * (filters, datamasks, and cell renders) these
5
+ * resolvers allow multiple ways of calling handlers
6
+ *
7
+ * eg:
8
+ * datamasks -> 1. column name
9
+ * 2. datatype
10
+ *
11
+ * {
12
+ * Status: () => value
13
+ * DateTime: () => value
14
+ * }
15
+ *
16
+ * Keeps system flexible
17
+ *
18
+ * Row Value -> Resolver -> UI
19
+ *
20
+ * @packageDocumentation
21
+ */
22
+ export * as resolvers from "./resolvers";
23
+ export * as transformers from "./transformers";
@@ -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;
@@ -0,0 +1,8 @@
1
+ /**
2
+ * FILTER REQUEST to RESOLVER
3
+ */
4
+ export interface FilterRequest {
5
+ filterName: string;
6
+ filterOptions: string[];
7
+ filterType: string;
8
+ }
@@ -0,0 +1,53 @@
1
+ import type { FilterOption } from "@evenicanpm/portal-types-schemas";
2
+ /**
3
+ *
4
+ * @group View Handlers
5
+ */
6
+ export type DataMaskMap = Record<string, MaskingFunction>;
7
+ export type MaskingFunction = (value: string | number, dataMask: string) => string;
8
+ /**
9
+ * Uses column names as keys and maps out
10
+ * value with specific JSX for specific column names.
11
+ *
12
+ *
13
+ * e.g. Status -> MUIChip
14
+ *
15
+ * @group View Handlers
16
+ */
17
+ export interface CellRenderMap {
18
+ [ColumnName: string]: (value: string | number | string[]) => React.ReactElement;
19
+ }
20
+ export interface FilterProps {
21
+ filterName: string;
22
+ filterOptions: FilterOption[];
23
+ value: Record<string, string>;
24
+ setValue: React.Dispatch<React.SetStateAction<Record<string, string>>>;
25
+ resetPagination: () => void;
26
+ }
27
+ /**
28
+ *
29
+ * Provides render methods for particular filter
30
+ * types. Filter types currently come from DataTypes.
31
+ *
32
+ * Note: Naive solution is to trust that project injects filter
33
+ * render methods for all columns with filters.We can then have a fallback for
34
+ * general data types.
35
+ *
36
+ * @group View Handlers
37
+ */
38
+ export interface FilterRenderMap {
39
+ [ColumnName: string]: (props: FilterProps) => React.ReactElement;
40
+ }
41
+ /**
42
+ *
43
+ * @group View Handlers
44
+ */
45
+ export interface EmptyStateProps {
46
+ label: string;
47
+ }
48
+ export type NoResultsComponent = (props: EmptyStateProps) => React.ReactElement;
49
+ export interface DetailsRenderMap {
50
+ [columnName: string]: (props: {
51
+ [columnName: string]: string | number | object | string[] | number[] | object[];
52
+ }) => React.ReactNode;
53
+ }
@@ -0,0 +1,69 @@
1
+ /**
2
+ * # Table System: Module Registry
3
+ *
4
+ * This registry defines the structural blueprints for the Table system modules.
5
+ * Architecture driven by an array of Resource types which are equipped with
6
+ * configuration and render handlers responsible for rendering a table.
7
+ *
8
+ * ---
9
+ *
10
+ * ### 1. Queries (queries.ts)
11
+ * API Contracts. The raw shapes of server responses. These act as the transport
12
+ * layer for data before it is mapped into the system's primary models.
13
+ *
14
+ * ### 2. Schemas (schemas.ts)
15
+ * System Models. The primary blueprints—such as Column, Filter, and Resource—often
16
+ * derived from API definitions. These are the vocabulary used to drive the module.
17
+ *
18
+ * ### 3. State (state.ts)
19
+ * View Configuration. The dynamic parameters tracking how resources are
20
+ * filtered, sorted, and paginated in the current view.
21
+ *
22
+ * ### 4. Handlers (handlers.ts)
23
+ * Logic Registries. Objects indexed by column or resource type that map
24
+ * logic (like filtering and data masking) to specific parts of the system.
25
+ *
26
+ * ---
27
+ *
28
+ * @remarks
29
+ * ## File descriptions
30
+ * ```
31
+ * ├── components // UI
32
+ * │ └── dashboard // displays multiple tables with tabs
33
+ * │ ├── index.tsx
34
+ * │ ├── table // individual table component
35
+ * │ │ ├── details
36
+ * │ │ │ ├── details.tsx // the details page
37
+ * │ │ │ ├── index.ts
38
+ * │ │ │ ├── label.tsx // labels used on details page
39
+ * │ │ │ ├── rows // individual rows for different details
40
+ * │ │ │ │ ├── downloads.tsx // download button for "documents" field
41
+ * │ │ │ │ ├── index.ts
42
+ * │ │ │ │ ├── primitive.tsx // simple text or number details field
43
+ * │ │ │ │ └── table.tsx // for complex object data (displays in table)
44
+ * │ │ │ └── styles.ts
45
+ * │ │ ├── status-pill.tsx // status pill used across table and details
46
+ * │ │ ├── table-input.tsx // table search bar
47
+ * │ │ └── table.tsx // actual table component
48
+ * │ └── table-dashboard.tsx // actual dashboard component
49
+ * ├── index.ts
50
+ * ├── logic // handles data transformations
51
+ * │ ├── index.ts
52
+ * │ ├── resolvers.ts // multi methods that just handle resolving the maps
53
+ * │ ├── transformers.ts // pure functions just for simple data transformations
54
+ * │ └── types.ts // types specifically for the transformations
55
+ * ├── queries // handles data fetching with react-query
56
+ * │ └── useTableQueries.tsx
57
+ * └── types // global types for feature
58
+ * ├── handlers.ts // types for handler maps (masks, renders, filters)
59
+ * ├── index.ts
60
+ * ├── queries.ts // types for data coming over the wire
61
+ * ├── schemas.ts // core system types (Resource)
62
+ * └── state.ts // types for transient state data (filter state)
63
+ * ```
64
+ *
65
+ * @packageDocumentation
66
+ */
67
+ export * as Handlers from "./handlers";
68
+ export * as Queries from "./queries";
69
+ export * as Schemas from "./schemas";
@@ -0,0 +1,27 @@
1
+ import type { ViewConfig } from "@evenicanpm/portal-types-schemas";
2
+ /**
3
+ *
4
+ * These are data types returned from API Backend
5
+ *
6
+ */
7
+ /**
8
+ *
9
+ * A single row in the data table response object.
10
+ *
11
+ */
12
+ export type Row = Record<string, string | number | string[] | Record<string, string>[] | unknown>;
13
+ /**
14
+ *
15
+ * The response type defined in TDD for row data.
16
+ *
17
+ */
18
+ export interface TableRows {
19
+ items: number;
20
+ data: Row[];
21
+ }
22
+ /**
23
+ *
24
+ * Response type of data from table config
25
+ *
26
+ */
27
+ export type TableConfig = ViewConfig;
@@ -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
+ }
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Main entry point for the **e4Portal** library.
3
+ * All public functions are exported from here.
4
+ *
5
+ * The primary export of this package is the `Portal` React compound-component.
6
+ * The `Portal` component is the top-level that contains the auth, rbac and any other
7
+ * functionality that is not related to specific features. Specific features (e.g. `Table`)
8
+ * are modularized and exported as compond components attached to the main `Portal` component.
9
+ *
10
+ * ## Usage
11
+ *
12
+ * ```tsx
13
+ *
14
+ * import { Portal } from "@evenicanpm/portal";
15
+ *
16
+ * return (
17
+ * <Portal>
18
+ * <Portal.Table resources={resources}/>
19
+ * </Portal>
20
+ * );
21
+ *```
22
+ * To explore package hierarchy, navigate to the `Portal` link in the components group below.
23
+ * `TableProps` will be the main interface used to setup the `Table` feature for Copperstate implementation.
24
+ *
25
+ * ## Table Feature Usage
26
+ * ```tsx
27
+ * const PortalView = () => {
28
+ * const { data: session, status } = useSession(); // authentication + token
29
+ * const { data: userData, isPending } = getUser.useData(); // D365 User Info
30
+ * const { mutateAsync } = useSessionLogout();
31
+ *
32
+ *
33
+ * const invoicesResource = {
34
+ * name: "invoices",
35
+ * label: "Invoices",
36
+ * detailsFields: ["Code", "AccountName", "Total", "Status"],
37
+ * rowsQueryFn: getInvoices,
38
+ * configQueryFn: getInvoicesTable,
39
+ * idField: "Code",
40
+ * dataMaskHandlers,
41
+ * columnRenderHandlers: fieldRenderMap,
42
+ * filterRenderHandlers: filterRenderHandlers,
43
+ * };
44
+ *
45
+ * const resources = [
46
+ * invoicesResource,
47
+ * // DEFINE MORE RESOURCES HERE
48
+ * ];
49
+ *
50
+ * return (
51
+ * <Container>
52
+ * <Portal session={authObject} logout={handleLogout}>
53
+ * <Portal.Table resources={resources} />
54
+ * </Portal>
55
+ * </Container>
56
+ * )
57
+ *};
58
+ * ```
59
+ * @module e4 Portal
60
+ */
61
+ export type { Session } from "./auth/auth-context";
62
+ export { Portal, type PortalProps } from "./portal";
63
+ export { Table } from "./features/table";