@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.
Files changed (66) 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/table/actions.d.ts +14 -0
  4. package/dist/features/table/components/dashboard/table/data-mask-map.d.ts +2 -0
  5. package/dist/features/table/components/dashboard/table/details/details.d.ts +27 -0
  6. package/dist/features/table/components/dashboard/table/details/label.d.ts +5 -0
  7. package/dist/features/table/components/dashboard/table/details/rows/downloads.d.ts +6 -0
  8. package/dist/features/table/components/dashboard/table/details/rows/primitive.d.ts +6 -0
  9. package/dist/features/table/components/dashboard/table/details/rows/table.d.ts +17 -0
  10. package/{src/features/table/components/dashboard/table/details/styles.ts → dist/features/table/components/dashboard/table/details/styles.d.ts} +2 -10
  11. package/dist/features/table/components/dashboard/table/filter-render-map.d.ts +2 -0
  12. package/dist/features/table/components/dashboard/table/filters/date-filter.d.ts +2 -0
  13. package/dist/features/table/components/dashboard/table/filters/status-filter.d.ts +2 -0
  14. package/dist/features/table/components/dashboard/table/no-results.d.ts +2 -0
  15. package/dist/features/table/components/dashboard/table/status-pill.d.ts +8 -0
  16. package/dist/features/table/components/dashboard/table/table-header.d.ts +16 -0
  17. package/dist/features/table/components/dashboard/table/table-input.d.ts +11 -0
  18. package/dist/features/table/components/dashboard/table/table-row/action-button.d.ts +8 -0
  19. package/dist/features/table/components/dashboard/table/table-row/table-row.d.ts +32 -0
  20. package/dist/features/table/components/dashboard/table/table-row-skeleton.d.ts +6 -0
  21. package/dist/features/table/components/dashboard/table/table.d.ts +18 -0
  22. package/dist/features/table/components/dashboard/table-dashboard.d.ts +22 -0
  23. package/{src/features/table/index.ts → dist/features/table/index.d.ts} +1 -7
  24. package/dist/features/table/logic/resolvers.d.ts +21 -0
  25. package/dist/features/table/logic/transformers.d.ts +35 -0
  26. package/dist/features/table/logic/types.d.ts +8 -0
  27. package/{src/features/table/types/handlers.ts → dist/features/table/types/handlers.d.ts} +12 -30
  28. package/{src/features/table/types/index.ts → dist/features/table/types/index.d.ts} +0 -1
  29. package/{src/features/table/types/queries.ts → dist/features/table/types/queries.d.ts} +3 -10
  30. package/dist/features/table/types/schemas.d.ts +31 -0
  31. package/{src/index.ts → dist/index.d.ts} +0 -2
  32. package/dist/portal.d.ts +38 -0
  33. package/dist/tsconfig.tsbuildinfo +1 -0
  34. package/package.json +6 -3
  35. package/src/auth/auth-context.tsx +0 -86
  36. package/src/features/table/components/dashboard/table/actions.ts +0 -59
  37. package/src/features/table/components/dashboard/table/data-mask-map.ts +0 -26
  38. package/src/features/table/components/dashboard/table/details/details.tsx +0 -164
  39. package/src/features/table/components/dashboard/table/details/label.tsx +0 -26
  40. package/src/features/table/components/dashboard/table/details/rows/downloads.tsx +0 -26
  41. package/src/features/table/components/dashboard/table/details/rows/primitive.tsx +0 -26
  42. package/src/features/table/components/dashboard/table/details/rows/table.tsx +0 -74
  43. package/src/features/table/components/dashboard/table/filter-render-map.tsx +0 -9
  44. package/src/features/table/components/dashboard/table/filters/date-filter.tsx +0 -31
  45. package/src/features/table/components/dashboard/table/filters/status-filter.tsx +0 -36
  46. package/src/features/table/components/dashboard/table/no-results.tsx +0 -26
  47. package/src/features/table/components/dashboard/table/status-pill.tsx +0 -18
  48. package/src/features/table/components/dashboard/table/table-header.tsx +0 -62
  49. package/src/features/table/components/dashboard/table/table-input.tsx +0 -94
  50. package/src/features/table/components/dashboard/table/table-row/action-button.tsx +0 -39
  51. package/src/features/table/components/dashboard/table/table-row/table-row.tsx +0 -96
  52. package/src/features/table/components/dashboard/table/table-row-skeleton.tsx +0 -36
  53. package/src/features/table/components/dashboard/table/table.tsx +0 -250
  54. package/src/features/table/components/dashboard/table-dashboard.tsx +0 -71
  55. package/src/features/table/logic/resolvers.ts +0 -68
  56. package/src/features/table/logic/transformers.ts +0 -56
  57. package/src/features/table/logic/types.ts +0 -8
  58. package/src/features/table/types/schemas.ts +0 -50
  59. package/src/portal.tsx +0 -68
  60. package/tsconfig.json +0 -28
  61. package/typedoc.json +0 -10
  62. /package/{src/features/table/components/dashboard/index.tsx → dist/features/table/components/dashboard/index.d.ts} +0 -0
  63. /package/{src/features/table/components/dashboard/table/details/index.ts → dist/features/table/components/dashboard/table/details/index.d.ts} +0 -0
  64. /package/{src/features/table/components/dashboard/table/details/rows/index.ts → dist/features/table/components/dashboard/table/details/rows/index.d.ts} +0 -0
  65. /package/{src/features/table/components/dashboard/table/index.ts → dist/features/table/components/dashboard/table/index.d.ts} +0 -0
  66. /package/{src/features/table/logic/index.ts → dist/features/table/logic/index.d.ts} +0 -0
@@ -1,68 +0,0 @@
1
- import { method, multi } from "@arrows/multimethod";
2
- import type { Column } from "@evenicanpm/portal-types-schemas";
3
- import type * as Types from "../types";
4
- import type { FilterRequest } from "./types";
5
-
6
- /** MULTIMETHOD FOR FILTERS
7
- * Allows multiple implementations
8
- * based on multiple column properties.
9
- * Priotizes column name, but also can
10
- * use data type
11
- * @internal
12
- */
13
- export const resolveFilterUI = multi(
14
- (req: FilterRequest, handlers: Types.Handlers.FilterRenderMap) => {
15
- if (handlers?.[req.filterName]) return "BY_NAME";
16
- if (handlers?.[req.filterType]) return "BY_TYPE";
17
- return "NONE";
18
- },
19
- method(
20
- "BY_NAME",
21
- (req: FilterRequest, handlers: Types.Handlers.FilterRenderMap) =>
22
- handlers[req.filterName],
23
- ),
24
- method(
25
- "BY_TYPE",
26
- (req: FilterRequest, handlers: Types.Handlers.FilterRenderMap) =>
27
- handlers[req.filterType],
28
- ),
29
- method("NONE", () => () => null),
30
- );
31
-
32
- /**
33
- * Dispatch identifies which properties are
34
- * in handler, then provides corresponding method
35
- * @internal
36
- */
37
- export const resolveDataMask = multi(
38
- (col: Column, handlers: Types.Handlers.DataMaskMap) => {
39
- if (!col?.DataMask) return "SKIP";
40
- if (handlers?.[col?.DataType]) return "BY_TYPE";
41
- if (handlers?.[col?.Data]) return "BY_NAME";
42
- return "SKIP";
43
- },
44
- method(
45
- "BY_TYPE",
46
- (col: Column, handlers: Types.Handlers.DataMaskMap) =>
47
- handlers?.[col?.DataType],
48
- ),
49
- method(
50
- "BY_NAME",
51
- (col: Column, handlers: Types.Handlers.DataMaskMap) =>
52
- handlers?.[col?.Data],
53
- ),
54
- method("SKIP", () => (value: string | number) => value),
55
- );
56
-
57
- /**
58
- * Simpler, doesn't need multimethod cause only dispatches on column name
59
- * @internal
60
- */
61
- export const resolveCellUI = (
62
- col: Column,
63
- handlers: Types.Handlers.CellRenderMap,
64
- ) => {
65
- if (Object.hasOwn(handlers, col.Data)) return handlers?.[col?.Data];
66
-
67
- return (value: string | number) => value;
68
- };
@@ -1,56 +0,0 @@
1
- import type { Column } from "@evenicanpm/portal-types-schemas";
2
-
3
- /**
4
- * These are pure static functions that include business rules
5
- * and data manipulation to get the data into the correct
6
- * form for rendering.
7
- *
8
- * @packageDocumentation
9
- */
10
-
11
- /**
12
- * Gets filters and returns an array of the
13
- * active filters and corresponding options
14
- * in FilterRequest
15
- */
16
- export const getActiveFilters = (columns: Column[] | undefined) => {
17
- return columns
18
- ?.filter((c) => c?.IsFilterable)
19
- ?.flatMap((c) =>
20
- c?.Filters?.map((f) => ({
21
- filterName: c.Data,
22
- filterOptions: f.FilterOptions,
23
- filterType: f.FilterType ?? c.DataType,
24
- })),
25
- );
26
- };
27
-
28
- /**
29
- * Filters and sorts visible cols
30
- */
31
- export const getVisibleColumns = (columns: Column[] | undefined) =>
32
- columns
33
- ?.filter(
34
- (column): column is Column & { ColumnOrder: number } =>
35
- typeof column.ColumnOrder === "number",
36
- )
37
- .sort((a, b) => a.ColumnOrder - b.ColumnOrder);
38
-
39
- /**
40
- *
41
- */
42
- export const getVisibleDetails = (columns: Column[] | undefined) =>
43
- columns
44
- ?.filter((col) => col.DisplayOrder)
45
- ?.sort((a, b) => {
46
- if (a?.DisplayOrder && b?.DisplayOrder) {
47
- return a?.DisplayOrder - b?.DisplayOrder;
48
- }
49
- return -1;
50
- });
51
-
52
- /**
53
- * Filters and sorts visible cols
54
- */
55
- export const getSearchableColumns = (columns: Column[] | undefined) =>
56
- columns?.filter((column) => column?.IsSearchable);
@@ -1,8 +0,0 @@
1
- /**
2
- * FILTER REQUEST to RESOLVER
3
- */
4
- export interface FilterRequest {
5
- filterName: string;
6
- filterOptions: string[];
7
- filterType: string;
8
- }
@@ -1,50 +0,0 @@
1
- import type { TableViewParams } from "@evenicanpm/portal-types-schemas";
2
- import type {
3
- CellRenderMap,
4
- DataMaskMap,
5
- DetailsRenderMap,
6
- FilterRenderMap,
7
- NoResultsComponent,
8
- } from "./handlers";
9
- import type { TableRows } from "./queries";
10
-
11
- /**
12
- * These are primary domain models and the source of truth for table system.
13
- */
14
-
15
- /**
16
- * Status maps
17
- */
18
- export type StatusTextMap = Record<number | string, string>;
19
-
20
- export type StatusColor = "success" | "primary" | "warning" | "error";
21
-
22
- export type StatusColorMap = Record<number | string, StatusColor>;
23
-
24
- /**
25
- * Resource Definition
26
- */
27
- export interface Resource {
28
- name: string;
29
- label: string;
30
- idField: string;
31
-
32
- // Data Handlers
33
- rowsQueryFn: (displaySettings: TableViewParams) => {
34
- queryKey: readonly unknown[];
35
- queryFn: () => Promise<TableRows>;
36
- };
37
-
38
- // UI Renderers & Mappings
39
- cellRenderMap?: CellRenderMap;
40
- dataMaskMap?: DataMaskMap;
41
- filterRenderMap?: FilterRenderMap;
42
- noResultsComponent?: NoResultsComponent;
43
-
44
- // Optional Details view
45
- detailsRenderMap?: DetailsRenderMap;
46
-
47
- // State Visuals
48
- statusTextMap: StatusTextMap;
49
- statusColorMap: StatusColorMap;
50
- }
package/src/portal.tsx DELETED
@@ -1,68 +0,0 @@
1
- import { FlexBox } from "@evenicanpm/ui";
2
- import type { PropsWithChildren } from "react";
3
- import {
4
- type AuthProviderProps,
5
- PortalAuthProvider,
6
- } from "./auth/auth-context";
7
- import { TableDashboard } from "./features/table/components/dashboard/table-dashboard";
8
-
9
- /**
10
- * Main Entry point properties into portal package
11
- *
12
- *
13
- */
14
- interface PortalProps extends AuthProviderProps {
15
- // Add Portal Specific Properties Here
16
- // ie. roles
17
- }
18
-
19
- /**
20
- * The main **e4Portal** entry point.
21
- * * This is a React Functional Component that provides the core context
22
- * and layout for the application. It is required to wrap all components
23
- * that use the library's hooks or sub-components.
24
- *
25
- *
26
- * @param props - The properties passed to the Portal component.
27
- * @returns A React Element rendering the main application structure.
28
- */
29
- const Portal = ({
30
- session,
31
- logout,
32
- children,
33
- }: PropsWithChildren<PortalProps>) => {
34
- // Not Logged In
35
- if (!session?.email) {
36
- return (
37
- <FlexBox mt={5} width="100%" justifyContent="center">
38
- Please login to view the portal.
39
- </FlexBox>
40
- );
41
- }
42
-
43
- // Logged In yes
44
- return (
45
- <PortalAuthProvider session={session} logout={logout}>
46
- {children}
47
- </PortalAuthProvider>
48
- );
49
- };
50
-
51
- /**
52
- *
53
- * # Feature: Table
54
- * This is the table feature component.
55
- * @params props
56
- *
57
- */
58
- Portal.Table = TableDashboard;
59
-
60
- /**
61
- *
62
- * # Feature: Settings
63
- * This is the table feature component.
64
- * @params props
65
- *
66
- */
67
-
68
- export { Portal, type PortalProps };
package/tsconfig.json DELETED
@@ -1,28 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES6",
4
- "useDefineForClassFields": true,
5
- "lib": ["ES2022", "DOM", "DOM.Iterable"],
6
- "module": "ESNext",
7
- "sourceMap": true,
8
- "esModuleInterop": true,
9
- "skipLibCheck": true,
10
- "declaration": true,
11
- "preserveSymlinks": true,
12
- "moduleResolution": "Node",
13
- "resolveJsonModule": true,
14
- "isolatedModules": true,
15
- "emitDeclarationOnly": true,
16
- "jsx": "preserve",
17
- "strict": true,
18
- "noUnusedLocals": true,
19
- "noUnusedParameters": true,
20
- "noFallthroughCasesInSwitch": true,
21
- "allowJs": true,
22
- "forceConsistentCasingInFileNames": true,
23
- "incremental": true,
24
- "baseUrl": "./",
25
- "outDir": "./dist"
26
- },
27
- "include": ["src"]
28
- }
package/typedoc.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "highlightLanguages": [
3
- "bash",
4
- "typescript",
5
- "tsx",
6
- "javascript",
7
- "html",
8
- "css"
9
- ]
10
- }