@evenicanpm/portal-table-ui 1.5.0 → 1.7.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/package.json +6 -5
- package/src/auth/auth-context.tsx +92 -0
- package/src/features/table/components/dashboard/table/bulk-action-button.tsx +77 -0
- package/src/features/table/components/dashboard/table/data-mask-map.ts +26 -0
- package/src/features/table/components/dashboard/table/details/details.tsx +185 -0
- package/src/features/table/components/dashboard/table/details/label.tsx +26 -0
- package/src/features/table/components/dashboard/table/details/rows/downloads.tsx +25 -0
- package/src/features/table/components/dashboard/table/details/rows/primitive.tsx +25 -0
- package/src/features/table/components/dashboard/table/details/rows/table.tsx +73 -0
- package/{dist/features/table/components/dashboard/table/details/styles.d.ts → src/features/table/components/dashboard/table/details/styles.ts} +10 -2
- package/src/features/table/components/dashboard/table/details/templates/invoice-details.tsx +407 -0
- package/src/features/table/components/dashboard/table/details/templates/template-registry.ts +36 -0
- package/src/features/table/components/dashboard/table/filter-render-map.tsx +10 -0
- package/src/features/table/components/dashboard/table/filters/date-filter.tsx +31 -0
- package/src/features/table/components/dashboard/table/filters/status-filter.tsx +36 -0
- package/src/features/table/components/dashboard/table/no-results.tsx +26 -0
- package/src/features/table/components/dashboard/table/status-pill.tsx +18 -0
- package/src/features/table/components/dashboard/table/table-header.tsx +98 -0
- package/src/features/table/components/dashboard/table/table-input.tsx +94 -0
- package/src/features/table/components/dashboard/table/table-row/action-button.tsx +47 -0
- package/src/features/table/components/dashboard/table/table-row/table-row.tsx +144 -0
- package/src/features/table/components/dashboard/table/table-row-skeleton.tsx +35 -0
- package/src/features/table/components/dashboard/table/table.tsx +361 -0
- package/src/features/table/components/dashboard/table/use-select-rows.ts +53 -0
- package/src/features/table/components/dashboard/table-dashboard.tsx +71 -0
- package/{dist/features/table/index.d.ts → src/features/table/index.ts} +7 -1
- package/src/features/table/logic/resolvers.ts +111 -0
- package/src/features/table/logic/transformers.ts +56 -0
- package/src/features/table/logic/types.ts +8 -0
- package/{dist/features/table/types/handlers.d.ts → src/features/table/types/handlers.ts} +30 -12
- package/{dist/features/table/types/index.d.ts → src/features/table/types/index.ts} +1 -0
- package/{dist/features/table/types/queries.d.ts → src/features/table/types/queries.ts} +10 -3
- package/src/features/table/types/schemas.ts +89 -0
- package/{dist/index.d.ts → src/index.ts} +2 -1
- package/src/portal.tsx +68 -0
- package/dist/auth/auth-context.d.ts +0 -36
- package/dist/features/settings/index.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/actions.d.ts +0 -14
- package/dist/features/table/components/dashboard/table/data-mask-map.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/details/details.d.ts +0 -27
- package/dist/features/table/components/dashboard/table/details/label.d.ts +0 -5
- package/dist/features/table/components/dashboard/table/details/rows/downloads.d.ts +0 -6
- package/dist/features/table/components/dashboard/table/details/rows/primitive.d.ts +0 -6
- package/dist/features/table/components/dashboard/table/details/rows/table.d.ts +0 -17
- package/dist/features/table/components/dashboard/table/filter-render-map.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/filters/date-filter.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/filters/status-filter.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/no-results.d.ts +0 -2
- package/dist/features/table/components/dashboard/table/status-pill.d.ts +0 -8
- package/dist/features/table/components/dashboard/table/table-header.d.ts +0 -16
- package/dist/features/table/components/dashboard/table/table-input.d.ts +0 -11
- package/dist/features/table/components/dashboard/table/table-row/action-button.d.ts +0 -8
- package/dist/features/table/components/dashboard/table/table-row/table-row.d.ts +0 -32
- package/dist/features/table/components/dashboard/table/table-row-skeleton.d.ts +0 -6
- package/dist/features/table/components/dashboard/table/table.d.ts +0 -18
- package/dist/features/table/components/dashboard/table-dashboard.d.ts +0 -22
- package/dist/features/table/logic/resolvers.d.ts +0 -21
- package/dist/features/table/logic/transformers.d.ts +0 -35
- package/dist/features/table/logic/types.d.ts +0 -8
- package/dist/features/table/types/schemas.d.ts +0 -31
- package/dist/portal.d.ts +0 -38
- package/dist/tsconfig.tsbuildinfo +0 -1
- /package/{dist/features/table/components/dashboard/index.d.ts → src/features/table/components/dashboard/index.tsx} +0 -0
- /package/{dist/features/table/components/dashboard/table/details/index.d.ts → src/features/table/components/dashboard/table/details/index.ts} +0 -0
- /package/{dist/features/table/components/dashboard/table/details/rows/index.d.ts → src/features/table/components/dashboard/table/details/rows/index.ts} +0 -0
- /package/{dist/features/table/components/dashboard/table/index.d.ts → src/features/table/components/dashboard/table/index.ts} +0 -0
- /package/{dist/features/table/logic/index.d.ts → src/features/table/logic/index.ts} +0 -0
|
@@ -1,17 +0,0 @@
|
|
|
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,8 +0,0 @@
|
|
|
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 };
|
|
@@ -1,16 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,11 +0,0 @@
|
|
|
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 };
|
|
@@ -1,8 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,32 +0,0 @@
|
|
|
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 {};
|
|
@@ -1,18 +0,0 @@
|
|
|
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;
|
|
@@ -1,22 +0,0 @@
|
|
|
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;
|
|
@@ -1,21 +0,0 @@
|
|
|
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);
|
|
@@ -1,35 +0,0 @@
|
|
|
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,31 +0,0 @@
|
|
|
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
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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 };
|