@prt-ts/fluent-react-table-v2 9.40.0-build.3.0 → 9.40.0-build.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@prt-ts/fluent-react-table-v2",
3
- "version": "9.40.0-build.3.0",
3
+ "version": "9.40.0-build.5.0",
4
4
  "main": "./index.js",
5
5
  "types": "./src\\index.d.ts",
6
6
  "peerDependencies": {
@@ -0,0 +1,7 @@
1
+ import { Column, Table } from '@tanstack/react-table';
2
+ type FilterNumberRangeProps<TItem extends object> = {
3
+ column: Column<TItem, unknown>;
4
+ table: Table<TItem>;
5
+ };
6
+ export declare const FilterDate: <TItem extends object>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -0,0 +1,7 @@
1
+ import { Column, Table } from '@tanstack/react-table';
2
+ type FilterNumberRangeProps<TItem extends object> = {
3
+ column: Column<TItem, unknown>;
4
+ table: Table<TItem>;
5
+ };
6
+ export declare const FilterDateRange: <TItem extends object>(props: FilterNumberRangeProps<TItem>) => import("react/jsx-runtime").JSX.Element;
7
+ export {};
@@ -1,12 +1,17 @@
1
1
  import * as React from 'react';
2
- import { Table } from '@tanstack/react-table';
2
+ import { Table, TableState } from '@tanstack/react-table';
3
+ import { TableView } from '../../types';
3
4
  type GridHeaderProps<TItem extends object> = {
4
5
  table: Table<TItem>;
5
6
  gridTitle: JSX.Element | React.ReactNode;
7
+ headerMenu?: JSX.Element | React.ReactNode;
6
8
  globalFilter: string;
7
9
  setGlobalFilter: (value: string) => void;
10
+ tableViews: TableView[];
11
+ applyTableState: (tableState: Partial<TableState>) => boolean;
8
12
  openFilterDrawer: boolean;
9
13
  setFilterDrawerOpen: React.Dispatch<React.SetStateAction<boolean>>;
14
+ resetToGridDefaultView: () => boolean;
10
15
  };
11
16
  export declare const GridHeader: <TItem extends object>(props: GridHeaderProps<TItem>) => import("react/jsx-runtime").JSX.Element;
12
17
  export {};
@@ -1,8 +1,13 @@
1
+ import { TableState } from '@tanstack/react-table';
1
2
  import { TableProps } from '..';
2
- import { TableRef } from '../types';
3
+ import { TableRef, TableView } from '../types';
3
4
  import * as React from 'react';
4
5
  export declare const useGridContainer: <TItem extends object>(props: TableProps<TItem>, ref: React.ForwardedRef<TableRef<TItem>>) => {
5
6
  table: import("@tanstack/react-table").Table<TItem>;
6
7
  globalFilter: string;
8
+ tableViews: TableView[];
9
+ headerMenu: JSX.Element | React.ReactNode;
7
10
  setGlobalFilter: React.Dispatch<React.SetStateAction<string>>;
11
+ resetToDefaultView: () => boolean;
12
+ applyTableState: (tableState: Partial<TableState>) => boolean;
8
13
  };
@@ -0,0 +1,4 @@
1
+ import { FilterFn } from "@tanstack/react-table";
2
+ export declare const arrIncludesSome: FilterFn<unknown>;
3
+ export declare const dateRange: FilterFn<unknown>;
4
+ export declare const date: FilterFn<unknown>;
@@ -0,0 +1,2 @@
1
+ import { Column } from "@tanstack/react-table";
2
+ export declare const getLeafColumns: <TItem extends object>(columns: Column<TItem, unknown>[]) => Column<TItem, unknown>[];
@@ -1,4 +1,4 @@
1
1
  export { Table } from "./components";
2
- export type { TableProps, TableRef } from "./types";
3
- export type { ColumnDef } from "@tanstack/react-table";
2
+ export type { TableProps, TableRef, TableView } from "./types";
3
+ export type { ColumnDef, TableState } from "@tanstack/react-table";
4
4
  export { createColumnHelper } from "@tanstack/react-table";
@@ -1,5 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { ColumnDef, ColumnFiltersState, ColumnOrderState, ColumnPinningState, ExpandedState, GroupingState, RowSelectionState, SortingState, VisibilityState } from "@tanstack/react-table";
3
+ import { TableView } from "./TableView";
3
4
  export type TableProps<TItem extends object> = {
4
5
  /**
5
6
  * Table Columns definitions.
@@ -17,6 +18,10 @@ export type TableProps<TItem extends object> = {
17
18
  * Grid title
18
19
  */
19
20
  gridTitle?: JSX.Element | React.ReactNode;
21
+ /**
22
+ * Table header menu
23
+ */
24
+ headerMenu?: (selectedItems: TItem[]) => JSX.Element | React.ReactNode;
20
25
  /**
21
26
  * Table default page size.
22
27
  */
@@ -75,4 +80,8 @@ export type TableProps<TItem extends object> = {
75
80
  * @default defaultNoItemComponent
76
81
  */
77
82
  noItemPage?: React.ReactNode;
83
+ /**
84
+ * Table Views
85
+ */
86
+ views?: TableView[];
78
87
  };
@@ -1,8 +1,7 @@
1
- import { Table } from "@tanstack/react-table";
1
+ import { Table, TableState } from "@tanstack/react-table";
2
2
  export type TableRef<TItem extends object> = {
3
3
  table: Table<TItem>;
4
- getTableState: () => Record<string, unknown>;
5
- saveCurrentTableState: (viewName: string) => boolean;
6
- applySavedView: (viewName: string) => boolean;
4
+ getTableState: () => Partial<TableState>;
5
+ applyTableState: (tableState: Partial<TableState>) => boolean;
7
6
  resetToDefaultView: () => boolean;
8
7
  };
@@ -0,0 +1,7 @@
1
+ import { TableState } from "@tanstack/react-table";
2
+ export type TableView = {
3
+ id: number;
4
+ viewName: string;
5
+ tableState: Partial<TableState>;
6
+ isDefault?: boolean;
7
+ };
@@ -1,2 +1,3 @@
1
1
  export * from "./TableProps";
2
2
  export * from "./TableRef";
3
+ export * from "./TableView";