@nccirtu/tablefy 0.6.2 → 0.6.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.
- package/dist/builders/empty-state.d.ts +46 -0
- package/dist/builders/index.d.ts +2 -0
- package/dist/builders/table-schema.d.ts +84 -0
- package/dist/columns/builders/empty-state.d.ts +46 -0
- package/dist/columns/builders/index.d.ts +2 -0
- package/dist/columns/builders/table-schema.d.ts +84 -0
- package/dist/columns/index.d.ts +2 -2
- package/dist/columns/tablefy/data-table-empty.d.ts +1 -1
- package/dist/columns/tablefy/data-table-header.d.ts +1 -1
- package/dist/columns/tablefy/data-table-pagination.d.ts +1 -1
- package/dist/columns/tablefy/data-table.d.ts +1 -1
- package/dist/columns/types/actions.d.ts +20 -0
- package/dist/columns/types/empty-state.d.ts +18 -0
- package/dist/columns/types/filters.d.ts +25 -0
- package/dist/columns/types/index.d.ts +4 -0
- package/dist/columns/types/table.d.ts +41 -0
- package/dist/columns/utils.d.ts +1 -0
- package/dist/index.d.ts +2 -2
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/tablefy/data-table-empty.d.ts +1 -1
- package/dist/tablefy/data-table-header.d.ts +1 -1
- package/dist/tablefy/data-table-pagination.d.ts +1 -1
- package/dist/tablefy/data-table.d.ts +1 -1
- package/dist/types/actions.d.ts +20 -0
- package/dist/types/empty-state.d.ts +18 -0
- package/dist/types/filters.d.ts +25 -0
- package/dist/types/index.d.ts +4 -0
- package/dist/types/table.d.ts +41 -0
- package/dist/utils.d.ts +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EmptyStateConfig } from "../types/empty-state";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Empty State Builder
|
|
5
|
+
* Fluent API for building empty state configurations
|
|
6
|
+
*/
|
|
7
|
+
export declare class EmptyStateBuilder {
|
|
8
|
+
private config;
|
|
9
|
+
static make(): EmptyStateBuilder;
|
|
10
|
+
title(title: string): this;
|
|
11
|
+
description(description: string): this;
|
|
12
|
+
icon(icon: React.ReactNode): this;
|
|
13
|
+
imageUrl(imageUrl: string): this;
|
|
14
|
+
action(label: string, onClick?: () => void, href?: string, icon?: React.ReactNode): this;
|
|
15
|
+
variant(variant: "default" | "search" | "filter" | "error" | "custom"): this;
|
|
16
|
+
error(params?: {
|
|
17
|
+
onRetry?: () => void;
|
|
18
|
+
}): this;
|
|
19
|
+
noSearchResults(params?: {
|
|
20
|
+
onClear?: () => void;
|
|
21
|
+
}): this;
|
|
22
|
+
noFilterResults(params?: {
|
|
23
|
+
onReset?: () => void;
|
|
24
|
+
}): this;
|
|
25
|
+
noData(): this;
|
|
26
|
+
build(): EmptyStateConfig;
|
|
27
|
+
static noData(config: {
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
createLabel?: string;
|
|
31
|
+
createHref?: string;
|
|
32
|
+
createOnClick?: () => void;
|
|
33
|
+
}): EmptyStateConfig;
|
|
34
|
+
static noSearchResults(config: {
|
|
35
|
+
title: string;
|
|
36
|
+
description: string;
|
|
37
|
+
clearLabel?: string;
|
|
38
|
+
onClear?: () => void;
|
|
39
|
+
}): EmptyStateConfig;
|
|
40
|
+
static noFilterResults(config: {
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
resetLabel?: string;
|
|
44
|
+
onReset?: () => void;
|
|
45
|
+
}): EmptyStateConfig;
|
|
46
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { DataTableConfig } from "../types/table";
|
|
3
|
+
import { HeaderAction } from "../types/actions";
|
|
4
|
+
import { EmptyStateConfig } from "../types/empty-state";
|
|
5
|
+
import React from "react";
|
|
6
|
+
type ColumnBuilder<TData> = {
|
|
7
|
+
build(): ColumnDef<TData, unknown>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Header Actions Builder
|
|
11
|
+
* Fluent API for building header actions
|
|
12
|
+
*/
|
|
13
|
+
declare class HeaderActionsBuilder<TData> {
|
|
14
|
+
private actions;
|
|
15
|
+
create(config: {
|
|
16
|
+
label: string;
|
|
17
|
+
href?: string;
|
|
18
|
+
onClick?: () => void;
|
|
19
|
+
icon?: React.ReactNode;
|
|
20
|
+
}): this;
|
|
21
|
+
export(config: {
|
|
22
|
+
label: string;
|
|
23
|
+
icon?: React.ReactNode;
|
|
24
|
+
formats?: Array<{
|
|
25
|
+
label: string;
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
}>;
|
|
28
|
+
}): this;
|
|
29
|
+
import(config: {
|
|
30
|
+
label: string;
|
|
31
|
+
icon?: React.ReactNode;
|
|
32
|
+
onClick?: () => void;
|
|
33
|
+
}): this;
|
|
34
|
+
bulkExport(config: {
|
|
35
|
+
label: string;
|
|
36
|
+
icon?: React.ReactNode;
|
|
37
|
+
onExport: (rows: TData[]) => void;
|
|
38
|
+
}): this;
|
|
39
|
+
bulkDelete(config: {
|
|
40
|
+
label: string;
|
|
41
|
+
icon?: React.ReactNode;
|
|
42
|
+
onDelete: (rows: TData[]) => void;
|
|
43
|
+
}): this;
|
|
44
|
+
custom(action: HeaderAction<TData>): this;
|
|
45
|
+
build(): HeaderAction<TData>[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Table Schema Builder
|
|
49
|
+
* Fluent API for building complete table configurations
|
|
50
|
+
*/
|
|
51
|
+
export declare class TableSchema<TData> {
|
|
52
|
+
private columnBuilders;
|
|
53
|
+
private config;
|
|
54
|
+
static make<TData>(): TableSchema<TData>;
|
|
55
|
+
description(text: string): this;
|
|
56
|
+
title(text: string): this;
|
|
57
|
+
headerActions(builder: (b: HeaderActionsBuilder<TData>) => HeaderActionsBuilder<TData>): this;
|
|
58
|
+
emptyState(config: EmptyStateConfig): this;
|
|
59
|
+
searchEmptyState(config: EmptyStateConfig): this;
|
|
60
|
+
filterEmptyState(config: EmptyStateConfig): this;
|
|
61
|
+
searchable(config?: {
|
|
62
|
+
placeholder?: string;
|
|
63
|
+
} | boolean): this;
|
|
64
|
+
paginated(config?: {
|
|
65
|
+
pageSize?: number;
|
|
66
|
+
pageSizeOptions?: number[];
|
|
67
|
+
} | boolean): this;
|
|
68
|
+
selectable(multiSelect?: boolean): this;
|
|
69
|
+
sortable(defaultSort?: {
|
|
70
|
+
id: string;
|
|
71
|
+
desc: boolean;
|
|
72
|
+
}): this;
|
|
73
|
+
columnVisibility(enabled?: boolean): this;
|
|
74
|
+
bordered(enabled?: boolean): this;
|
|
75
|
+
striped(enabled?: boolean): this;
|
|
76
|
+
hoverable(enabled?: boolean): this;
|
|
77
|
+
density(density: "compact" | "default" | "comfortable"): this;
|
|
78
|
+
columns(...builders: ColumnBuilder<TData>[]): this;
|
|
79
|
+
build(): {
|
|
80
|
+
columns: ColumnDef<TData, unknown>[];
|
|
81
|
+
config: DataTableConfig<TData>;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export {};
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { EmptyStateConfig } from "../types/empty-state";
|
|
2
|
+
import React from "react";
|
|
3
|
+
/**
|
|
4
|
+
* Empty State Builder
|
|
5
|
+
* Fluent API for building empty state configurations
|
|
6
|
+
*/
|
|
7
|
+
export declare class EmptyStateBuilder {
|
|
8
|
+
private config;
|
|
9
|
+
static make(): EmptyStateBuilder;
|
|
10
|
+
title(title: string): this;
|
|
11
|
+
description(description: string): this;
|
|
12
|
+
icon(icon: React.ReactNode): this;
|
|
13
|
+
imageUrl(imageUrl: string): this;
|
|
14
|
+
action(label: string, onClick?: () => void, href?: string, icon?: React.ReactNode): this;
|
|
15
|
+
variant(variant: "default" | "search" | "filter" | "error" | "custom"): this;
|
|
16
|
+
error(params?: {
|
|
17
|
+
onRetry?: () => void;
|
|
18
|
+
}): this;
|
|
19
|
+
noSearchResults(params?: {
|
|
20
|
+
onClear?: () => void;
|
|
21
|
+
}): this;
|
|
22
|
+
noFilterResults(params?: {
|
|
23
|
+
onReset?: () => void;
|
|
24
|
+
}): this;
|
|
25
|
+
noData(): this;
|
|
26
|
+
build(): EmptyStateConfig;
|
|
27
|
+
static noData(config: {
|
|
28
|
+
title: string;
|
|
29
|
+
description: string;
|
|
30
|
+
createLabel?: string;
|
|
31
|
+
createHref?: string;
|
|
32
|
+
createOnClick?: () => void;
|
|
33
|
+
}): EmptyStateConfig;
|
|
34
|
+
static noSearchResults(config: {
|
|
35
|
+
title: string;
|
|
36
|
+
description: string;
|
|
37
|
+
clearLabel?: string;
|
|
38
|
+
onClear?: () => void;
|
|
39
|
+
}): EmptyStateConfig;
|
|
40
|
+
static noFilterResults(config: {
|
|
41
|
+
title: string;
|
|
42
|
+
description: string;
|
|
43
|
+
resetLabel?: string;
|
|
44
|
+
onReset?: () => void;
|
|
45
|
+
}): EmptyStateConfig;
|
|
46
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { DataTableConfig } from "../types/table";
|
|
3
|
+
import { HeaderAction } from "../types/actions";
|
|
4
|
+
import { EmptyStateConfig } from "../types/empty-state";
|
|
5
|
+
import React from "react";
|
|
6
|
+
type ColumnBuilder<TData> = {
|
|
7
|
+
build(): ColumnDef<TData, unknown>;
|
|
8
|
+
};
|
|
9
|
+
/**
|
|
10
|
+
* Header Actions Builder
|
|
11
|
+
* Fluent API for building header actions
|
|
12
|
+
*/
|
|
13
|
+
declare class HeaderActionsBuilder<TData> {
|
|
14
|
+
private actions;
|
|
15
|
+
create(config: {
|
|
16
|
+
label: string;
|
|
17
|
+
href?: string;
|
|
18
|
+
onClick?: () => void;
|
|
19
|
+
icon?: React.ReactNode;
|
|
20
|
+
}): this;
|
|
21
|
+
export(config: {
|
|
22
|
+
label: string;
|
|
23
|
+
icon?: React.ReactNode;
|
|
24
|
+
formats?: Array<{
|
|
25
|
+
label: string;
|
|
26
|
+
onClick: () => void;
|
|
27
|
+
}>;
|
|
28
|
+
}): this;
|
|
29
|
+
import(config: {
|
|
30
|
+
label: string;
|
|
31
|
+
icon?: React.ReactNode;
|
|
32
|
+
onClick?: () => void;
|
|
33
|
+
}): this;
|
|
34
|
+
bulkExport(config: {
|
|
35
|
+
label: string;
|
|
36
|
+
icon?: React.ReactNode;
|
|
37
|
+
onExport: (rows: TData[]) => void;
|
|
38
|
+
}): this;
|
|
39
|
+
bulkDelete(config: {
|
|
40
|
+
label: string;
|
|
41
|
+
icon?: React.ReactNode;
|
|
42
|
+
onDelete: (rows: TData[]) => void;
|
|
43
|
+
}): this;
|
|
44
|
+
custom(action: HeaderAction<TData>): this;
|
|
45
|
+
build(): HeaderAction<TData>[];
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Table Schema Builder
|
|
49
|
+
* Fluent API for building complete table configurations
|
|
50
|
+
*/
|
|
51
|
+
export declare class TableSchema<TData> {
|
|
52
|
+
private columnBuilders;
|
|
53
|
+
private config;
|
|
54
|
+
static make<TData>(): TableSchema<TData>;
|
|
55
|
+
description(text: string): this;
|
|
56
|
+
title(text: string): this;
|
|
57
|
+
headerActions(builder: (b: HeaderActionsBuilder<TData>) => HeaderActionsBuilder<TData>): this;
|
|
58
|
+
emptyState(config: EmptyStateConfig): this;
|
|
59
|
+
searchEmptyState(config: EmptyStateConfig): this;
|
|
60
|
+
filterEmptyState(config: EmptyStateConfig): this;
|
|
61
|
+
searchable(config?: {
|
|
62
|
+
placeholder?: string;
|
|
63
|
+
} | boolean): this;
|
|
64
|
+
paginated(config?: {
|
|
65
|
+
pageSize?: number;
|
|
66
|
+
pageSizeOptions?: number[];
|
|
67
|
+
} | boolean): this;
|
|
68
|
+
selectable(multiSelect?: boolean): this;
|
|
69
|
+
sortable(defaultSort?: {
|
|
70
|
+
id: string;
|
|
71
|
+
desc: boolean;
|
|
72
|
+
}): this;
|
|
73
|
+
columnVisibility(enabled?: boolean): this;
|
|
74
|
+
bordered(enabled?: boolean): this;
|
|
75
|
+
striped(enabled?: boolean): this;
|
|
76
|
+
hoverable(enabled?: boolean): this;
|
|
77
|
+
density(density: "compact" | "default" | "comfortable"): this;
|
|
78
|
+
columns(...builders: ColumnBuilder<TData>[]): this;
|
|
79
|
+
build(): {
|
|
80
|
+
columns: ColumnDef<TData, unknown>[];
|
|
81
|
+
config: DataTableConfig<TData>;
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
export {};
|
package/dist/columns/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DataTable } from "./tablefy/data-table";
|
|
2
2
|
export { DataTableSchema } from "./tablefy/data-table-schema";
|
|
3
|
-
export { TableSchema, EmptyStateBuilder } from "./
|
|
3
|
+
export { TableSchema, EmptyStateBuilder } from "./builders";
|
|
4
4
|
export { AvatarGroupColumn, AvatarGroupColumn as avatarGroupColumn, } from "./columns/avatar-group-column";
|
|
5
5
|
export { BadgeColumn, BadgeColumn as badgeColumn, } from "./columns/badge-column";
|
|
6
6
|
export { ButtonColumn, ButtonColumn as buttonColumn, } from "./columns/button-column";
|
|
@@ -16,4 +16,4 @@ export { ProgressColumn, ProgressColumn as progressColumn, } from "./columns/pro
|
|
|
16
16
|
export { SelectColumn, SelectColumn as selectColumn, } from "./columns/select-column";
|
|
17
17
|
export { TextColumn, TextColumn as textColumn } from "./columns/text-column";
|
|
18
18
|
export { ActionsColumn } from "./columns/actions-column";
|
|
19
|
-
export type { DataTableConfig, EmptyStateConfig, FilterConfig, HeaderAction, PaginationConfig, SearchConfig, } from "./
|
|
19
|
+
export type { DataTableConfig, EmptyStateConfig, FilterConfig, HeaderAction, PaginationConfig, SearchConfig, } from "./types";
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Header Action Configuration
|
|
4
|
+
* Defines actions that can be displayed in the table header
|
|
5
|
+
*/
|
|
6
|
+
export interface HeaderAction<TData = unknown> {
|
|
7
|
+
id: string;
|
|
8
|
+
label: string;
|
|
9
|
+
icon?: ReactNode;
|
|
10
|
+
variant?: "default" | "secondary" | "outline" | "ghost" | "destructive";
|
|
11
|
+
size?: "default" | "sm" | "lg" | "icon";
|
|
12
|
+
onClick?: () => void;
|
|
13
|
+
href?: string;
|
|
14
|
+
disabled?: boolean;
|
|
15
|
+
loading?: boolean;
|
|
16
|
+
bulk?: boolean;
|
|
17
|
+
bulkOnClick?: (selectedRows: TData[]) => void;
|
|
18
|
+
hidden?: boolean;
|
|
19
|
+
children?: Omit<HeaderAction<TData>, "children" | "bulk">[];
|
|
20
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
/**
|
|
3
|
+
* Empty State Configuration
|
|
4
|
+
* Defines how empty states are displayed in the table
|
|
5
|
+
*/
|
|
6
|
+
export interface EmptyStateConfig {
|
|
7
|
+
icon?: ReactNode;
|
|
8
|
+
imageUrl?: string;
|
|
9
|
+
title: string;
|
|
10
|
+
description?: string;
|
|
11
|
+
action?: {
|
|
12
|
+
label: string;
|
|
13
|
+
onClick?: () => void;
|
|
14
|
+
href?: string;
|
|
15
|
+
icon?: ReactNode;
|
|
16
|
+
};
|
|
17
|
+
variant?: "default" | "search" | "filter" | "error" | "custom";
|
|
18
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Filter Configuration
|
|
3
|
+
* Defines filters that can be applied to table data
|
|
4
|
+
*/
|
|
5
|
+
export interface FilterConfig {
|
|
6
|
+
id: string;
|
|
7
|
+
label: string;
|
|
8
|
+
type: "text" | "select" | "multi-select" | "date" | "date-range" | "boolean";
|
|
9
|
+
column: string;
|
|
10
|
+
placeholder?: string;
|
|
11
|
+
options?: Array<{
|
|
12
|
+
label: string;
|
|
13
|
+
value: string;
|
|
14
|
+
}>;
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* Search Configuration
|
|
18
|
+
* Defines search functionality for the table
|
|
19
|
+
*/
|
|
20
|
+
export interface SearchConfig {
|
|
21
|
+
enabled: boolean;
|
|
22
|
+
placeholder?: string;
|
|
23
|
+
columns?: string[];
|
|
24
|
+
debounce?: number;
|
|
25
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { HeaderAction } from "./actions";
|
|
2
|
+
import { EmptyStateConfig } from "./empty-state";
|
|
3
|
+
import { FilterConfig, SearchConfig } from "./filters";
|
|
4
|
+
/**
|
|
5
|
+
* Pagination Configuration
|
|
6
|
+
* Defines pagination settings for the table
|
|
7
|
+
*/
|
|
8
|
+
export interface PaginationConfig {
|
|
9
|
+
enabled: boolean;
|
|
10
|
+
pageSize?: number;
|
|
11
|
+
pageSizeOptions?: number[];
|
|
12
|
+
showPageInfo?: boolean;
|
|
13
|
+
showPageSizeSelector?: boolean;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Complete Data Table Configuration
|
|
17
|
+
* Main configuration object for the data table component
|
|
18
|
+
*/
|
|
19
|
+
export interface DataTableConfig<TData> {
|
|
20
|
+
title?: string;
|
|
21
|
+
description?: string;
|
|
22
|
+
headerActions?: HeaderAction<TData>[];
|
|
23
|
+
emptyState?: EmptyStateConfig;
|
|
24
|
+
searchEmptyState?: EmptyStateConfig;
|
|
25
|
+
filterEmptyState?: EmptyStateConfig;
|
|
26
|
+
search?: SearchConfig;
|
|
27
|
+
filters?: FilterConfig[];
|
|
28
|
+
pagination?: PaginationConfig;
|
|
29
|
+
enableRowSelection?: boolean;
|
|
30
|
+
enableMultiRowSelection?: boolean;
|
|
31
|
+
enableSorting?: boolean;
|
|
32
|
+
defaultSort?: {
|
|
33
|
+
id: string;
|
|
34
|
+
desc: boolean;
|
|
35
|
+
};
|
|
36
|
+
enableColumnVisibility?: boolean;
|
|
37
|
+
density?: "compact" | "default" | "comfortable";
|
|
38
|
+
bordered?: boolean;
|
|
39
|
+
striped?: boolean;
|
|
40
|
+
hoverable?: boolean;
|
|
41
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function cn(...inputs: Array<string | boolean | undefined | null>): string;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { DataTable } from "./tablefy/data-table";
|
|
2
2
|
export { DataTableSchema } from "./tablefy/data-table-schema";
|
|
3
|
-
export { TableSchema, EmptyStateBuilder } from "./
|
|
3
|
+
export { TableSchema, EmptyStateBuilder } from "./builders";
|
|
4
4
|
export { AvatarGroupColumn, AvatarGroupColumn as avatarGroupColumn, } from "./columns/avatar-group-column";
|
|
5
5
|
export { BadgeColumn, BadgeColumn as badgeColumn, } from "./columns/badge-column";
|
|
6
6
|
export { ButtonColumn, ButtonColumn as buttonColumn, } from "./columns/button-column";
|
|
@@ -16,4 +16,4 @@ export { ProgressColumn, ProgressColumn as progressColumn, } from "./columns/pro
|
|
|
16
16
|
export { SelectColumn, SelectColumn as selectColumn, } from "./columns/select-column";
|
|
17
17
|
export { TextColumn, TextColumn as textColumn } from "./columns/text-column";
|
|
18
18
|
export { ActionsColumn } from "./columns/actions-column";
|
|
19
|
-
export type { DataTableConfig, EmptyStateConfig, FilterConfig, HeaderAction, PaginationConfig, SearchConfig, } from "./
|
|
19
|
+
export type { DataTableConfig, EmptyStateConfig, FilterConfig, HeaderAction, PaginationConfig, SearchConfig, } from "./types";
|