gantri-components 2.75.0-beta.1 → 2.75.0-beta.3

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 (21) hide show
  1. package/dist/components/table/components/cell-reorder-wrapper/cell-reorder-wrapper.d.ts +1 -5
  2. package/dist/components/table/components/custom-columns-toggle/custom-columns-toggle.d.ts +1 -5
  3. package/dist/components/table/components/custom-columns-toggle/custom-columns-toggle.helpers.d.ts +2 -10
  4. package/dist/components/table/components/table-actions-wrapper/hooks/useConfirmInteraction.d.ts +1 -5
  5. package/dist/components/table/components/table-actions-wrapper/table-actions-wrapper.d.ts +1 -5
  6. package/dist/components/table/components/table-draggable-row/table-draggable-row.d.ts +1 -5
  7. package/dist/components/table/components/table-footer/table-footer.d.ts +1 -5
  8. package/dist/components/table/components/table-header/table-header.d.ts +1 -5
  9. package/dist/components/table/components/table-row/helpers/get-row-component-props/get-row-component-props.d.ts +1 -5
  10. package/dist/components/table/components/table-row/table-row.d.ts +1 -5
  11. package/dist/components/table/components/table-row-cells/table-row-cells.d.ts +1 -5
  12. package/dist/components/table/components/table-row-overlay/table-row-overlay.d.ts +1 -5
  13. package/dist/components/table/hooks/use-drag-and-drop-rows/use-drag-and-drop-rows.d.ts +1 -5
  14. package/dist/components/table/table.adapters.d.ts +2 -10
  15. package/dist/components/table/table.d.ts +1 -5
  16. package/dist/components/table/table.helpers.d.ts +1 -5
  17. package/dist/components/table/table.types.d.ts +42 -0
  18. package/dist/index.cjs.js +1 -1
  19. package/dist/index.esm.js +1 -1
  20. package/dist/index.umd.js +1 -1
  21. package/package.json +1 -1
@@ -1,8 +1,4 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { CellReorderWrapperProps } from './cell-reorder-wrapper.types';
3
3
  /** When reordering is provided, wraps the first column in the provided props. */
4
- export declare const CellReorderWrapper: <TData extends RowData<{
5
- [key: string]: unknown;
6
- id?: string | number | undefined;
7
- subRows?: any[] | undefined;
8
- }>>(props: CellReorderWrapperProps<TData>) => JSX.Element;
4
+ export declare const CellReorderWrapper: <TData extends RowData<import("../..").CustomTData>>(props: CellReorderWrapperProps<TData>) => JSX.Element;
@@ -1,7 +1,3 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { CustomColumnsWrapperProps } from './custom-columns-toggle.types';
3
- export declare const CustomColumnsToggle: <TData extends RowData<{
4
- [key: string]: unknown;
5
- id?: string | number | undefined;
6
- subRows?: any[] | undefined;
7
- }>>(props: CustomColumnsWrapperProps<TData>) => JSX.Element;
3
+ export declare const CustomColumnsToggle: <TData extends RowData<import("../..").CustomTData>>(props: CustomColumnsWrapperProps<TData>) => JSX.Element;
@@ -3,13 +3,5 @@ import { CustomColumnOption } from './custom-columns-toggle.types';
3
3
  export interface GetCustomColumnOptionsArgs<TData extends RowData> {
4
4
  table: Table<TData>;
5
5
  }
6
- export declare const getCustomColumnOptions: <TData extends RowData<{
7
- [key: string]: unknown;
8
- id?: string | number | undefined;
9
- subRows?: any[] | undefined;
10
- }>>(args: GetCustomColumnOptionsArgs<TData>) => CustomColumnOption[];
11
- export declare const transformColumnsIntoVisibilityState: <TData extends RowData<{
12
- [key: string]: unknown;
13
- id?: string | number | undefined;
14
- subRows?: any[] | undefined;
15
- }>>(columns: Column<TData, unknown>[]) => {};
6
+ export declare const getCustomColumnOptions: <TData extends RowData<import("../..").CustomTData>>(args: GetCustomColumnOptionsArgs<TData>) => CustomColumnOption[];
7
+ export declare const transformColumnsIntoVisibilityState: <TData extends RowData<import("../..").CustomTData>>(columns: Column<TData, unknown>[]) => {};
@@ -4,11 +4,7 @@ export interface UseConfirmInteractionProps<TData extends RowData> {
4
4
  table: Table<TData>;
5
5
  }
6
6
  export type OnConfirmInteraction = (interaction: TableInteraction) => Promise<boolean>;
7
- export declare const useConfirmInteraction: <TData extends RowData<{
8
- [key: string]: unknown;
9
- id?: string | number | undefined;
10
- subRows?: any[] | undefined;
11
- }>>(props: UseConfirmInteractionProps<TData>) => {
7
+ export declare const useConfirmInteraction: <TData extends RowData<import("../../..").CustomTData>>(props: UseConfirmInteractionProps<TData>) => {
12
8
  /** Not necessary for `onConfirmInteraction`. Only provided in case additional logic is needed. */
13
9
  confirmAllInteractions: boolean;
14
10
  /** If applicable, renders a discard selections confirmation modal when called. */
@@ -2,8 +2,4 @@ import React, { PropsWithChildren } from 'react';
2
2
  import { RowData } from '@tanstack/react-table';
3
3
  import { TableActionsWrapperProps } from './table-actions-wrapper.types';
4
4
  /** Wraps the table with relevant components for paging, filters, sort, and table actions. */
5
- export declare const TableActionsWrapper: <TData extends RowData<{
6
- [key: string]: unknown;
7
- id?: string | number | undefined;
8
- subRows?: any[] | undefined;
9
- }>>(props: React.PropsWithChildren<TableActionsWrapperProps<TData>>) => JSX.Element;
5
+ export declare const TableActionsWrapper: <TData extends RowData<import("../..").CustomTData>>(props: React.PropsWithChildren<TableActionsWrapperProps<TData>>) => JSX.Element;
@@ -1,7 +1,3 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { DraggableRowProps } from './table-draggable-row.types';
3
- export declare const TableDraggableRow: <TData extends RowData<{
4
- [key: string]: unknown;
5
- id?: string | number | undefined;
6
- subRows?: any[] | undefined;
7
- }>>(props: DraggableRowProps<TData>) => JSX.Element;
3
+ export declare const TableDraggableRow: <TData extends RowData<import("../..").CustomTData>>(props: DraggableRowProps<TData>) => JSX.Element;
@@ -1,7 +1,3 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { TableFooterProps } from './table-footer.types';
3
- export declare const TableFooter: <TData extends RowData<{
4
- [key: string]: unknown;
5
- id?: string | number | undefined;
6
- subRows?: any[] | undefined;
7
- }>>(props: TableFooterProps<TData>) => JSX.Element;
3
+ export declare const TableFooter: <TData extends RowData<import("../..").CustomTData>>(props: TableFooterProps<TData>) => JSX.Element;
@@ -1,7 +1,3 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { TableHeaderProps } from './table-header.types';
3
- export declare const TableHeader: <TData extends RowData<{
4
- [key: string]: unknown;
5
- id?: string | number | undefined;
6
- subRows?: any[] | undefined;
7
- }>>(props: TableHeaderProps<TData>) => JSX.Element;
3
+ export declare const TableHeader: <TData extends RowData<import("../..").CustomTData>>(props: TableHeaderProps<TData>) => JSX.Element;
@@ -1,11 +1,7 @@
1
1
  import { MouseEvent } from 'react';
2
2
  import { RowData } from '@tanstack/react-table';
3
3
  import { TableRowProps } from '../../table-row.types';
4
- export declare const getRowComponentProps: <TData extends RowData<{
5
- [key: string]: unknown;
6
- id?: string | number | undefined;
7
- subRows?: any[] | undefined;
8
- }>>(props: TableRowProps<TData>) => {
4
+ export declare const getRowComponentProps: <TData extends RowData<import("../../../..").CustomTData>>(props: TableRowProps<TData>) => {
9
5
  className: string;
10
6
  onClick: (event: MouseEvent<HTMLTableRowElement>) => void;
11
7
  "data-row-is-clickable": string | undefined;
@@ -1,7 +1,3 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { TableRowProps } from './table-row.types';
3
- export declare const TableRow: <TData extends RowData<{
4
- [key: string]: unknown;
5
- id?: string | number | undefined;
6
- subRows?: any[] | undefined;
7
- }>>(props: TableRowProps<TData>) => JSX.Element;
3
+ export declare const TableRow: <TData extends RowData<import("../..").CustomTData>>(props: TableRowProps<TData>) => JSX.Element;
@@ -1,7 +1,3 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { TableRowCellsProps } from './table-row-cells.types';
3
- export declare const TableRowCells: <TData extends RowData<{
4
- [key: string]: unknown;
5
- id?: string | number | undefined;
6
- subRows?: any[] | undefined;
7
- }>>(props: TableRowCellsProps<TData>) => JSX.Element;
3
+ export declare const TableRowCells: <TData extends RowData<import("../..").CustomTData>>(props: TableRowCellsProps<TData>) => JSX.Element;
@@ -1,7 +1,3 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { TableRowOverlayProps } from './table-row-overlay.types';
3
- export declare const TableRowOverlay: <TData extends RowData<{
4
- [key: string]: unknown;
5
- id?: string | number | undefined;
6
- subRows?: any[] | undefined;
7
- }>>(props: TableRowOverlayProps<TData>) => JSX.Element;
3
+ export declare const TableRowOverlay: <TData extends RowData<import("../..").CustomTData>>(props: TableRowOverlayProps<TData>) => JSX.Element;
@@ -1,11 +1,7 @@
1
1
  import { DragEndEvent, DragStartEvent } from '@dnd-kit/core';
2
2
  import { RowData } from '@tanstack/react-table';
3
3
  import { UseDragAndDropRowsProps } from './use-drag-and-drop-rows.types';
4
- export declare const useDragAndDropRows: <TData extends RowData<{
5
- [key: string]: unknown;
6
- id?: string | number | undefined;
7
- subRows?: any[] | undefined;
8
- }>>(props: UseDragAndDropRowsProps<TData>) => {
4
+ export declare const useDragAndDropRows: <TData extends RowData<import("../..").CustomTData>>(props: UseDragAndDropRowsProps<TData>) => {
9
5
  activeIndex: number;
10
6
  handleDragEnd: (event: DragEndEvent) => void;
11
7
  handleDragStart: (event: DragStartEvent) => void;
@@ -2,16 +2,8 @@ import { ColumnDef, ColumnOrderState, RowData, Table, VisibilityState } from '@t
2
2
  import { ColumnConfig } from './table.types';
3
3
  export declare const extractColumnIdsFromColumnConfig: (records: ColumnConfig[]) => string[];
4
4
  export declare const extractColumnsVisibilityFromColumnConfig: (records: ColumnConfig[]) => VisibilityState;
5
- export declare const extractColumnsVisibilityFromTable: <TData extends RowData<{
6
- [key: string]: unknown;
7
- id?: string | number | undefined;
8
- subRows?: any[] | undefined;
9
- }>>(table: Table<TData>) => {};
10
- export declare const extractColumnsDefinition: <TData extends RowData<{
11
- [key: string]: unknown;
12
- id?: string | number | undefined;
13
- subRows?: any[] | undefined;
14
- }>>(columns: ColumnDef<TData, unknown>[]) => {
5
+ export declare const extractColumnsVisibilityFromTable: <TData extends RowData<import("./table.types").CustomTData>>(table: Table<TData>) => {};
6
+ export declare const extractColumnsDefinition: <TData extends RowData<import("./table.types").CustomTData>>(columns: ColumnDef<TData, unknown>[]) => {
15
7
  order: string[];
16
8
  visibility: Record<string, boolean>;
17
9
  };
@@ -6,10 +6,6 @@ import { TableProps } from './table.types';
6
6
  * Official docs: https://tanstack.com/table/v8/docs/guide/overview
7
7
  */
8
8
  export declare const Table: {
9
- <TData extends RowData<{
10
- [key: string]: unknown;
11
- id?: string | number | undefined;
12
- subRows?: any[] | undefined;
13
- }>>(props: TableProps<TData>): JSX.Element;
9
+ <TData extends RowData<import("./table.types").CustomTData>>(props: TableProps<TData>): JSX.Element;
14
10
  defaultProps: import("./table.types").TableDefaultProps;
15
11
  };
@@ -1,9 +1,5 @@
1
1
  import { RowData } from '@tanstack/react-table';
2
2
  import { ColumnConfig, GetColumnsConfigFn, TDataWithId } from './table.types';
3
- export declare const addMissingIds: <TData extends RowData<{
4
- [key: string]: unknown;
5
- id?: string | number | undefined;
6
- subRows?: any[] | undefined;
7
- }>>(data: TData[]) => TDataWithId<TData>[];
3
+ export declare const addMissingIds: <TData extends RowData<import("./table.types").CustomTData>>(data: TData[]) => TDataWithId<TData>[];
8
4
  export declare const hyphenateColumnId: ((id: string) => string) & import("lodash").MemoizedFunction;
9
5
  export declare const processColumnsConfigGenerator: (fetchData: GetColumnsConfigFn, handler: (val: ColumnConfig[]) => void, columnsConfiguration: ColumnConfig[]) => Promise<void | ColumnConfig[]>;
@@ -83,3 +83,45 @@ export interface CustomCellProps extends HTMLAttributes<HTMLTableCellElement>, R
83
83
  export type TDataWithId<TData extends RowData> = TData & {
84
84
  id: number | string;
85
85
  };
86
+ export type CustomTData = Record<any, any> & {
87
+ id?: number | string;
88
+ subRows?: CustomTData[];
89
+ };
90
+ export interface CustomRowData<TData = CustomTData> {
91
+ id?: number | string;
92
+ subRows?: TData[];
93
+ }
94
+ export interface CustomTableMeta<TData extends RowData> {
95
+ getColumnsConfig?: () => Promise<ColumnConfig[]>;
96
+ onColumnsConfigChange?: (config: ColumnConfig[]) => Promise<void>;
97
+ }
98
+ export interface CustomColumnMeta<TData extends RowData, TValue> {
99
+ /** If the function returns true, enables clickable td styling. */
100
+ getIsClickable?: (cell: Cell<TData, TValue>) => boolean;
101
+ /** If a function is returned, it will be passed to the td element and automatically enable clickable td styling. */
102
+ getOnClick?: (cell: Cell<TData, TValue>) => MouseEventHandler<HTMLTableCellElement>;
103
+ /**
104
+ * If true, the column is initially hidden in the table.
105
+ *
106
+ * If false or not specified, the column is shown by default.
107
+ */
108
+ hidden?: boolean;
109
+ /**
110
+ * If true or not specified, the column can be hidden by user action.
111
+ *
112
+ * If false, the column cannot be hidden by the user.
113
+ */
114
+ hideable?: boolean;
115
+ /**
116
+ * The label to display for this column in the table header.
117
+ *
118
+ * If not specified, some default label might be used, depending on your implementation.
119
+ */
120
+ label?: string;
121
+ /**
122
+ * If true or not specified, the column can be reordered by user action.
123
+ *
124
+ * If false, the column cannot be moved from its initial position.
125
+ */
126
+ reorderable?: boolean;
127
+ }