@nccirtu/tablefy 0.8.4 → 0.9.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/README.md +224 -200
- package/dist/columns/forms/builders/actions-builder.d.ts +14 -0
- package/dist/columns/forms/builders/form-schema.d.ts +35 -0
- package/dist/columns/forms/builders/index.d.ts +5 -0
- package/dist/columns/forms/builders/section-builder.d.ts +16 -0
- package/dist/columns/forms/builders/tab-builder.d.ts +16 -0
- package/dist/columns/forms/builders/wizard-builder.d.ts +17 -0
- package/dist/columns/forms/components/field-renderer.d.ts +12 -0
- package/dist/columns/forms/components/form-actions.d.ts +9 -0
- package/dist/columns/forms/components/form-renderer.d.ts +14 -0
- package/dist/columns/forms/components/grid-layout.d.ts +7 -0
- package/dist/columns/forms/components/index.d.ts +9 -0
- package/dist/columns/forms/components/section-renderer.d.ts +14 -0
- package/dist/columns/forms/components/tab-renderer.d.ts +15 -0
- package/dist/columns/forms/components/wizard-renderer.d.ts +17 -0
- package/dist/columns/forms/fields/base-field.d.ts +24 -0
- package/dist/columns/forms/fields/checkbox-group.d.ts +12 -0
- package/dist/columns/forms/fields/checkbox.d.ts +9 -0
- package/dist/columns/forms/fields/date-picker.d.ts +15 -0
- package/dist/columns/forms/fields/file-upload.d.ts +17 -0
- package/dist/columns/forms/fields/hidden.d.ts +9 -0
- package/dist/columns/forms/fields/index.d.ts +12 -0
- package/dist/columns/forms/fields/radio-group.d.ts +14 -0
- package/dist/columns/forms/fields/repeater.d.ts +21 -0
- package/dist/columns/forms/fields/select.d.ts +16 -0
- package/dist/columns/forms/fields/text-input.d.ts +20 -0
- package/dist/columns/forms/fields/textarea.d.ts +14 -0
- package/dist/columns/forms/fields/toggle.d.ts +11 -0
- package/dist/columns/forms/index.d.ts +26 -0
- package/dist/columns/forms/types/actions.d.ts +11 -0
- package/dist/columns/forms/types/field.d.ts +98 -0
- package/dist/columns/forms/types/form.d.ts +37 -0
- package/dist/columns/forms/types/index.d.ts +4 -0
- package/dist/columns/forms/types/layout.d.ts +31 -0
- package/dist/columns/index.d.ts +2 -0
- package/dist/columns/inertia/index.d.ts +4 -0
- package/dist/columns/inertia/precognition.d.ts +6 -0
- package/dist/columns/inertia/types.d.ts +63 -0
- package/dist/columns/inertia/use-inertia-form.d.ts +2 -0
- package/dist/columns/inertia/use-server-table.d.ts +2 -0
- package/dist/forms/builders/actions-builder.d.ts +14 -0
- package/dist/forms/builders/empty-state.d.ts +46 -0
- package/dist/forms/builders/form-schema.d.ts +35 -0
- package/dist/forms/builders/index.d.ts +2 -0
- package/dist/forms/builders/section-builder.d.ts +16 -0
- package/dist/forms/builders/tab-builder.d.ts +16 -0
- package/dist/forms/builders/table-schema.d.ts +45 -0
- package/dist/forms/builders/wizard-builder.d.ts +17 -0
- package/dist/forms/columns/actions-column.d.ts +26 -0
- package/dist/forms/columns/avatar-group-column.d.ts +38 -0
- package/dist/forms/columns/badge-column.d.ts +29 -0
- package/dist/forms/columns/base-column.d.ts +21 -0
- package/dist/forms/columns/button-column.d.ts +14 -0
- package/dist/forms/columns/checkbox-column.d.ts +5 -0
- package/dist/forms/columns/date-column.d.ts +24 -0
- package/dist/forms/columns/dropdown-column.d.ts +17 -0
- package/dist/forms/columns/enum-column.d.ts +52 -0
- package/dist/forms/columns/icon-column.d.ts +58 -0
- package/dist/forms/columns/image-column.d.ts +21 -0
- package/dist/forms/columns/index.d.ts +18 -0
- package/dist/forms/columns/input-column.d.ts +27 -0
- package/dist/forms/columns/link-column.d.ts +27 -0
- package/dist/forms/columns/number-column.d.ts +23 -0
- package/dist/forms/columns/progress-column.d.ts +30 -0
- package/dist/forms/columns/select-column.d.ts +24 -0
- package/dist/forms/columns/text-column.d.ts +14 -0
- package/dist/forms/columns/types.d.ts +46 -0
- package/dist/forms/components/field-renderer.d.ts +12 -0
- package/dist/forms/components/form-actions.d.ts +9 -0
- package/dist/forms/components/form-renderer.d.ts +14 -0
- package/dist/forms/components/grid-layout.d.ts +7 -0
- package/dist/forms/components/index.d.ts +9 -0
- package/dist/forms/components/section-renderer.d.ts +14 -0
- package/dist/forms/components/tab-renderer.d.ts +15 -0
- package/dist/forms/components/wizard-renderer.d.ts +17 -0
- package/dist/forms/confirm/ConfirmProvider.d.ts +6 -0
- package/dist/forms/confirm/confirm.d.ts +3 -0
- package/dist/forms/confirm/index.d.ts +3 -0
- package/dist/forms/confirm/types.d.ts +10 -0
- package/dist/forms/fields/base-field.d.ts +24 -0
- package/dist/forms/fields/checkbox-group.d.ts +12 -0
- package/dist/forms/fields/checkbox.d.ts +9 -0
- package/dist/forms/fields/date-picker.d.ts +15 -0
- package/dist/forms/fields/file-upload.d.ts +17 -0
- package/dist/forms/fields/hidden.d.ts +9 -0
- package/dist/forms/fields/index.d.ts +12 -0
- package/dist/forms/fields/radio-group.d.ts +14 -0
- package/dist/forms/fields/repeater.d.ts +21 -0
- package/dist/forms/fields/select.d.ts +16 -0
- package/dist/forms/fields/text-input.d.ts +20 -0
- package/dist/forms/fields/textarea.d.ts +14 -0
- package/dist/forms/fields/toggle.d.ts +11 -0
- package/dist/forms/forms/builders/actions-builder.d.ts +14 -0
- package/dist/forms/forms/builders/form-schema.d.ts +35 -0
- package/dist/forms/forms/builders/index.d.ts +5 -0
- package/dist/forms/forms/builders/section-builder.d.ts +16 -0
- package/dist/forms/forms/builders/tab-builder.d.ts +16 -0
- package/dist/forms/forms/builders/wizard-builder.d.ts +17 -0
- package/dist/forms/forms/components/field-renderer.d.ts +12 -0
- package/dist/forms/forms/components/form-actions.d.ts +9 -0
- package/dist/forms/forms/components/form-renderer.d.ts +14 -0
- package/dist/forms/forms/components/grid-layout.d.ts +7 -0
- package/dist/forms/forms/components/index.d.ts +9 -0
- package/dist/forms/forms/components/section-renderer.d.ts +14 -0
- package/dist/forms/forms/components/tab-renderer.d.ts +15 -0
- package/dist/forms/forms/components/wizard-renderer.d.ts +17 -0
- package/dist/forms/forms/fields/base-field.d.ts +24 -0
- package/dist/forms/forms/fields/checkbox-group.d.ts +12 -0
- package/dist/forms/forms/fields/checkbox.d.ts +9 -0
- package/dist/forms/forms/fields/date-picker.d.ts +15 -0
- package/dist/forms/forms/fields/file-upload.d.ts +17 -0
- package/dist/forms/forms/fields/hidden.d.ts +9 -0
- package/dist/forms/forms/fields/index.d.ts +12 -0
- package/dist/forms/forms/fields/radio-group.d.ts +14 -0
- package/dist/forms/forms/fields/repeater.d.ts +21 -0
- package/dist/forms/forms/fields/select.d.ts +16 -0
- package/dist/forms/forms/fields/text-input.d.ts +20 -0
- package/dist/forms/forms/fields/textarea.d.ts +14 -0
- package/dist/forms/forms/fields/toggle.d.ts +11 -0
- package/dist/forms/forms/index.d.ts +26 -0
- package/dist/forms/forms/types/actions.d.ts +11 -0
- package/dist/forms/forms/types/field.d.ts +98 -0
- package/dist/forms/forms/types/form.d.ts +37 -0
- package/dist/forms/forms/types/index.d.ts +4 -0
- package/dist/forms/forms/types/layout.d.ts +31 -0
- package/dist/forms/index.d.ts +25 -0
- package/dist/forms/index.esm.js +1052 -0
- package/dist/forms/index.esm.js.map +1 -0
- package/dist/forms/index.js +1077 -0
- package/dist/forms/index.js.map +1 -0
- package/dist/forms/inertia/index.d.ts +4 -0
- package/dist/forms/inertia/precognition.d.ts +6 -0
- package/dist/forms/inertia/types.d.ts +63 -0
- package/dist/forms/inertia/use-inertia-form.d.ts +2 -0
- package/dist/forms/inertia/use-server-table.d.ts +2 -0
- package/dist/forms/tablefy/avatar-list.d.ts +15 -0
- package/dist/forms/tablefy/data-table-empty.d.ts +8 -0
- package/dist/forms/tablefy/data-table-header.d.ts +17 -0
- package/dist/forms/tablefy/data-table-pagination.d.ts +9 -0
- package/dist/forms/tablefy/data-table-schema.d.ts +1 -0
- package/dist/forms/tablefy/data-table.d.ts +13 -0
- package/dist/forms/tablefy/index.d.ts +6 -0
- package/dist/forms/types/actions.d.ts +21 -0
- package/dist/forms/types/empty-state.d.ts +18 -0
- package/dist/forms/types/field.d.ts +98 -0
- package/dist/forms/types/filters.d.ts +25 -0
- package/dist/forms/types/form.d.ts +37 -0
- package/dist/forms/types/index.d.ts +4 -0
- package/dist/forms/types/layout.d.ts +31 -0
- package/dist/forms/types/table.d.ts +42 -0
- package/dist/forms/utils.d.ts +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.esm.js +1050 -9
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +1058 -0
- package/dist/index.js.map +1 -1
- package/dist/inertia/builders/empty-state.d.ts +46 -0
- package/dist/inertia/builders/index.d.ts +2 -0
- package/dist/inertia/builders/table-schema.d.ts +45 -0
- package/dist/inertia/columns/actions-column.d.ts +26 -0
- package/dist/inertia/columns/avatar-group-column.d.ts +38 -0
- package/dist/inertia/columns/badge-column.d.ts +29 -0
- package/dist/inertia/columns/base-column.d.ts +21 -0
- package/dist/inertia/columns/button-column.d.ts +14 -0
- package/dist/inertia/columns/checkbox-column.d.ts +5 -0
- package/dist/inertia/columns/date-column.d.ts +24 -0
- package/dist/inertia/columns/dropdown-column.d.ts +17 -0
- package/dist/inertia/columns/enum-column.d.ts +52 -0
- package/dist/inertia/columns/icon-column.d.ts +58 -0
- package/dist/inertia/columns/image-column.d.ts +21 -0
- package/dist/inertia/columns/index.d.ts +18 -0
- package/dist/inertia/columns/input-column.d.ts +27 -0
- package/dist/inertia/columns/link-column.d.ts +27 -0
- package/dist/inertia/columns/number-column.d.ts +23 -0
- package/dist/inertia/columns/progress-column.d.ts +30 -0
- package/dist/inertia/columns/select-column.d.ts +24 -0
- package/dist/inertia/columns/text-column.d.ts +14 -0
- package/dist/inertia/columns/types.d.ts +46 -0
- package/dist/inertia/confirm/ConfirmProvider.d.ts +6 -0
- package/dist/inertia/confirm/confirm.d.ts +3 -0
- package/dist/inertia/confirm/index.d.ts +3 -0
- package/dist/inertia/confirm/types.d.ts +10 -0
- package/dist/inertia/forms/builders/actions-builder.d.ts +14 -0
- package/dist/inertia/forms/builders/form-schema.d.ts +35 -0
- package/dist/inertia/forms/builders/index.d.ts +5 -0
- package/dist/inertia/forms/builders/section-builder.d.ts +16 -0
- package/dist/inertia/forms/builders/tab-builder.d.ts +16 -0
- package/dist/inertia/forms/builders/wizard-builder.d.ts +17 -0
- package/dist/inertia/forms/components/field-renderer.d.ts +12 -0
- package/dist/inertia/forms/components/form-actions.d.ts +9 -0
- package/dist/inertia/forms/components/form-renderer.d.ts +14 -0
- package/dist/inertia/forms/components/grid-layout.d.ts +7 -0
- package/dist/inertia/forms/components/index.d.ts +9 -0
- package/dist/inertia/forms/components/section-renderer.d.ts +14 -0
- package/dist/inertia/forms/components/tab-renderer.d.ts +15 -0
- package/dist/inertia/forms/components/wizard-renderer.d.ts +17 -0
- package/dist/inertia/forms/fields/base-field.d.ts +24 -0
- package/dist/inertia/forms/fields/checkbox-group.d.ts +12 -0
- package/dist/inertia/forms/fields/checkbox.d.ts +9 -0
- package/dist/inertia/forms/fields/date-picker.d.ts +15 -0
- package/dist/inertia/forms/fields/file-upload.d.ts +17 -0
- package/dist/inertia/forms/fields/hidden.d.ts +9 -0
- package/dist/inertia/forms/fields/index.d.ts +12 -0
- package/dist/inertia/forms/fields/radio-group.d.ts +14 -0
- package/dist/inertia/forms/fields/repeater.d.ts +21 -0
- package/dist/inertia/forms/fields/select.d.ts +16 -0
- package/dist/inertia/forms/fields/text-input.d.ts +20 -0
- package/dist/inertia/forms/fields/textarea.d.ts +14 -0
- package/dist/inertia/forms/fields/toggle.d.ts +11 -0
- package/dist/inertia/forms/index.d.ts +26 -0
- package/dist/inertia/forms/types/actions.d.ts +11 -0
- package/dist/inertia/forms/types/field.d.ts +98 -0
- package/dist/inertia/forms/types/form.d.ts +37 -0
- package/dist/inertia/forms/types/index.d.ts +4 -0
- package/dist/inertia/forms/types/layout.d.ts +31 -0
- package/dist/inertia/index.d.ts +25 -0
- package/dist/inertia/index.esm.js +149 -0
- package/dist/inertia/index.esm.js.map +1 -0
- package/dist/inertia/index.js +153 -0
- package/dist/inertia/index.js.map +1 -0
- package/dist/inertia/inertia/index.d.ts +4 -0
- package/dist/inertia/inertia/precognition.d.ts +6 -0
- package/dist/inertia/inertia/types.d.ts +63 -0
- package/dist/inertia/inertia/use-inertia-form.d.ts +2 -0
- package/dist/inertia/inertia/use-server-table.d.ts +2 -0
- package/dist/inertia/precognition.d.ts +6 -0
- package/dist/inertia/tablefy/avatar-list.d.ts +15 -0
- package/dist/inertia/tablefy/data-table-empty.d.ts +8 -0
- package/dist/inertia/tablefy/data-table-header.d.ts +17 -0
- package/dist/inertia/tablefy/data-table-pagination.d.ts +9 -0
- package/dist/inertia/tablefy/data-table-schema.d.ts +1 -0
- package/dist/inertia/tablefy/data-table.d.ts +13 -0
- package/dist/inertia/tablefy/index.d.ts +6 -0
- package/dist/inertia/types/actions.d.ts +21 -0
- package/dist/inertia/types/empty-state.d.ts +18 -0
- package/dist/inertia/types/filters.d.ts +25 -0
- package/dist/inertia/types/index.d.ts +4 -0
- package/dist/inertia/types/table.d.ts +42 -0
- package/dist/inertia/types.d.ts +63 -0
- package/dist/inertia/use-inertia-form.d.ts +2 -0
- package/dist/inertia/use-server-table.d.ts +2 -0
- package/dist/inertia/utils.d.ts +1 -0
- package/package.json +39 -13
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { FormBuildResult, BuiltField } from "../types/form";
|
|
2
|
+
import { SectionConfig, TabConfig, WizardStepConfig } from "../types/layout";
|
|
3
|
+
import { ActionsBuilder } from "./actions-builder";
|
|
4
|
+
type FieldBuilder<TData extends Record<string, any>> = {
|
|
5
|
+
build(): BuiltField<TData>;
|
|
6
|
+
};
|
|
7
|
+
/**
|
|
8
|
+
* Form Schema Builder
|
|
9
|
+
* Fluent API for building complete form configurations
|
|
10
|
+
*/
|
|
11
|
+
export declare class FormSchema<TData extends Record<string, any>> {
|
|
12
|
+
private fieldBuilders;
|
|
13
|
+
private schemaConfig;
|
|
14
|
+
static make<TData extends Record<string, any>>(): FormSchema<TData>;
|
|
15
|
+
title(title: string | ((data: TData) => string)): this;
|
|
16
|
+
description(description: string | ((data: TData) => string)): this;
|
|
17
|
+
columns(columns: number): this;
|
|
18
|
+
bordered(bordered?: boolean): this;
|
|
19
|
+
spacing(spacing: "compact" | "normal" | "relaxed"): this;
|
|
20
|
+
disabled(disabled: boolean | ((data: TData) => boolean)): this;
|
|
21
|
+
fields(...builders: FieldBuilder<TData>[]): this;
|
|
22
|
+
sections(...sections: {
|
|
23
|
+
build(): SectionConfig<TData>;
|
|
24
|
+
}[]): this;
|
|
25
|
+
tabs(...tabs: {
|
|
26
|
+
build(): TabConfig<TData>;
|
|
27
|
+
}[]): this;
|
|
28
|
+
wizard(...steps: {
|
|
29
|
+
build(): WizardStepConfig<TData>;
|
|
30
|
+
}[]): this;
|
|
31
|
+
actions(fn: (builder: ActionsBuilder<TData>) => ActionsBuilder<TData>): this;
|
|
32
|
+
actionsPosition(position: "start" | "end" | "between" | "center"): this;
|
|
33
|
+
build(): FormBuildResult<TData>;
|
|
34
|
+
}
|
|
35
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { SectionConfig } from "../types/layout";
|
|
3
|
+
export declare class SectionBuilder<TData extends Record<string, any>> {
|
|
4
|
+
private sectionConfig;
|
|
5
|
+
constructor(title: string);
|
|
6
|
+
static make<TData extends Record<string, any>>(title: string): SectionBuilder<TData>;
|
|
7
|
+
id(id: string): this;
|
|
8
|
+
description(description: string): this;
|
|
9
|
+
fields(fields: string[]): this;
|
|
10
|
+
columns(columns: number): this;
|
|
11
|
+
collapsible(collapsible?: boolean): this;
|
|
12
|
+
collapsed(collapsed?: boolean): this;
|
|
13
|
+
icon(icon: ReactNode): this;
|
|
14
|
+
hidden(fn: (data: TData) => boolean): this;
|
|
15
|
+
build(): SectionConfig<TData>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { TabConfig, SectionConfig } from "../types/layout";
|
|
3
|
+
export declare class TabBuilder<TData extends Record<string, any>> {
|
|
4
|
+
private tabConfig;
|
|
5
|
+
constructor(label: string);
|
|
6
|
+
static make<TData extends Record<string, any>>(label: string): TabBuilder<TData>;
|
|
7
|
+
id(id: string): this;
|
|
8
|
+
icon(icon: ReactNode): this;
|
|
9
|
+
fields(fields: string[]): this;
|
|
10
|
+
sections(...sections: {
|
|
11
|
+
build(): SectionConfig<TData>;
|
|
12
|
+
}[]): this;
|
|
13
|
+
badge(badge: string | number | ((data: TData) => string | number)): this;
|
|
14
|
+
disabled(fn: (data: TData) => boolean): this;
|
|
15
|
+
build(): TabConfig<TData>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
type ColumnBuilder<TData> = {
|
|
6
|
+
build(): ColumnDef<TData, unknown>;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Table Schema Builder
|
|
10
|
+
* Fluent API for building complete table configurations
|
|
11
|
+
*/
|
|
12
|
+
export declare class TableSchema<TData> {
|
|
13
|
+
private columnBuilders;
|
|
14
|
+
private config;
|
|
15
|
+
static make<TData>(): TableSchema<TData>;
|
|
16
|
+
description(text: string): this;
|
|
17
|
+
title(text: string): this;
|
|
18
|
+
headerActions(actions: HeaderAction<TData>[]): this;
|
|
19
|
+
emptyState(config: EmptyStateConfig): this;
|
|
20
|
+
searchEmptyState(config: EmptyStateConfig): this;
|
|
21
|
+
filterEmptyState(config: EmptyStateConfig): this;
|
|
22
|
+
searchable(config?: {
|
|
23
|
+
placeholder?: string;
|
|
24
|
+
} | boolean): this;
|
|
25
|
+
paginated(config?: {
|
|
26
|
+
pageSize?: number;
|
|
27
|
+
pageSizeOptions?: number[];
|
|
28
|
+
} | boolean): this;
|
|
29
|
+
selectable(multiSelect?: boolean): this;
|
|
30
|
+
sortable(defaultSort?: {
|
|
31
|
+
id: string;
|
|
32
|
+
desc: boolean;
|
|
33
|
+
}): this;
|
|
34
|
+
columnVisibility(enabled?: boolean): this;
|
|
35
|
+
bordered(enabled?: boolean): this;
|
|
36
|
+
striped(enabled?: boolean): this;
|
|
37
|
+
hoverable(enabled?: boolean): this;
|
|
38
|
+
density(density: "compact" | "default" | "comfortable"): this;
|
|
39
|
+
columns(...builders: ColumnBuilder<TData>[]): this;
|
|
40
|
+
build(): {
|
|
41
|
+
columns: ColumnDef<TData, unknown>[];
|
|
42
|
+
config: DataTableConfig<TData>;
|
|
43
|
+
};
|
|
44
|
+
}
|
|
45
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ReactNode } from "react";
|
|
2
|
+
import { WizardStepConfig, SectionConfig } from "../types/layout";
|
|
3
|
+
export declare class WizardStep<TData extends Record<string, any>> {
|
|
4
|
+
private stepConfig;
|
|
5
|
+
constructor(label: string);
|
|
6
|
+
static make<TData extends Record<string, any>>(label: string): WizardStep<TData>;
|
|
7
|
+
id(id: string): this;
|
|
8
|
+
description(description: string): this;
|
|
9
|
+
icon(icon: ReactNode): this;
|
|
10
|
+
fields(fields: string[]): this;
|
|
11
|
+
sections(...sections: {
|
|
12
|
+
build(): SectionConfig<TData>;
|
|
13
|
+
}[]): this;
|
|
14
|
+
canProceed(fn: (data: TData) => boolean): this;
|
|
15
|
+
beforeNext(fn: (data: TData) => Promise<boolean> | boolean): this;
|
|
16
|
+
build(): WizardStepConfig<TData>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
export interface ActionItem<TData> {
|
|
4
|
+
label?: string;
|
|
5
|
+
icon?: ReactNode;
|
|
6
|
+
onClick?: (row: TData) => void;
|
|
7
|
+
href?: (row: TData) => string;
|
|
8
|
+
render?: (row: TData) => ReactNode;
|
|
9
|
+
variant?: "default" | "destructive";
|
|
10
|
+
separator?: boolean;
|
|
11
|
+
hidden?: (row: TData) => boolean;
|
|
12
|
+
disabled?: (row: TData) => boolean;
|
|
13
|
+
}
|
|
14
|
+
export declare class ActionsColumn<TData> {
|
|
15
|
+
private config;
|
|
16
|
+
static make<TData>(): ActionsColumn<TData>;
|
|
17
|
+
label(label: string): this;
|
|
18
|
+
triggerIcon(icon: ReactNode): this;
|
|
19
|
+
action(action: ActionItem<TData>): this;
|
|
20
|
+
view(onClick: (row: TData) => void): this;
|
|
21
|
+
edit(onClick: (row: TData) => void): this;
|
|
22
|
+
delete(onClick: (row: TData) => void): this;
|
|
23
|
+
link(label: string, href: (row: TData) => string): this;
|
|
24
|
+
separator(): this;
|
|
25
|
+
build(): ColumnDef<TData, unknown>;
|
|
26
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { BaseColumnConfig } from "./types";
|
|
4
|
+
interface AvatarItem {
|
|
5
|
+
src?: string;
|
|
6
|
+
name: string;
|
|
7
|
+
fallback?: string;
|
|
8
|
+
}
|
|
9
|
+
interface AvatarGroupColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
10
|
+
maxVisible?: number;
|
|
11
|
+
size?: number;
|
|
12
|
+
overlap?: "none" | "sm" | "md" | "lg";
|
|
13
|
+
showTooltip?: boolean;
|
|
14
|
+
nameField?: keyof TData | ((row: TData) => AvatarItem[]);
|
|
15
|
+
srcField?: string;
|
|
16
|
+
fallbackField?: string;
|
|
17
|
+
showNames?: boolean;
|
|
18
|
+
maxNames?: number;
|
|
19
|
+
}
|
|
20
|
+
export declare class AvatarGroupColumn<TData> extends BaseColumn<TData, AvatarGroupColumnConfig<TData>> {
|
|
21
|
+
constructor(accessor: keyof TData | string);
|
|
22
|
+
static make<TData>(accessor: keyof TData | string): AvatarGroupColumn<TData>;
|
|
23
|
+
maxVisible(max: number): this;
|
|
24
|
+
size(size: "xs" | "sm" | "md" | "lg"): this;
|
|
25
|
+
overlap(overlap: "none" | "sm" | "md" | "lg"): this;
|
|
26
|
+
noOverlap(): this;
|
|
27
|
+
hideTooltip(): this;
|
|
28
|
+
fields(config: {
|
|
29
|
+
src?: string;
|
|
30
|
+
name: string;
|
|
31
|
+
fallback?: string;
|
|
32
|
+
}): this;
|
|
33
|
+
mapItems(fn: (row: TData) => AvatarItem[]): this;
|
|
34
|
+
showNames(show?: boolean, max?: number): this;
|
|
35
|
+
private toContactItems;
|
|
36
|
+
build(): ColumnDef<TData, unknown>;
|
|
37
|
+
}
|
|
38
|
+
export {};
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { BaseColumn } from "./base-column";
|
|
4
|
+
import { BadgeColumnConfig } from "./types";
|
|
5
|
+
type BadgeVariant = "default" | "secondary" | "destructive" | "outline" | "success" | "warning" | "info" | "muted";
|
|
6
|
+
interface VariantConfig {
|
|
7
|
+
label?: string;
|
|
8
|
+
variant?: BadgeVariant;
|
|
9
|
+
className?: string;
|
|
10
|
+
icon?: ReactNode;
|
|
11
|
+
}
|
|
12
|
+
export declare class BadgeColumn<TData> extends BaseColumn<TData, BadgeColumnConfig<TData>> {
|
|
13
|
+
static make<TData>(accessor: keyof TData | string): BadgeColumn<TData>;
|
|
14
|
+
variants(variants: Record<string, VariantConfig>): this;
|
|
15
|
+
boolean(trueLabel?: string, falseLabel?: string): this;
|
|
16
|
+
status(statuses: Record<string, {
|
|
17
|
+
label: string;
|
|
18
|
+
color: string;
|
|
19
|
+
}>): this;
|
|
20
|
+
variantFn(fn: (value: unknown, row: TData) => {
|
|
21
|
+
label?: string;
|
|
22
|
+
variant?: BadgeVariant;
|
|
23
|
+
className?: string;
|
|
24
|
+
icon?: ReactNode;
|
|
25
|
+
}): this;
|
|
26
|
+
classNameFn(fn: (value: unknown, row: TData) => string): this;
|
|
27
|
+
build(): ColumnDef<TData, unknown>;
|
|
28
|
+
}
|
|
29
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumnConfig } from "./types";
|
|
3
|
+
export declare abstract class BaseColumn<TData, TConfig extends BaseColumnConfig<TData>> {
|
|
4
|
+
protected config: TConfig;
|
|
5
|
+
constructor(accessor: keyof TData | string);
|
|
6
|
+
label(label: string): this;
|
|
7
|
+
sortable(sortable?: boolean): this;
|
|
8
|
+
searchable(searchable?: boolean): this;
|
|
9
|
+
hidden(hidden?: boolean): this;
|
|
10
|
+
visibleByDefault(visible?: boolean): this;
|
|
11
|
+
visibilityLabel(label: string): this;
|
|
12
|
+
alignLeft(): this;
|
|
13
|
+
alignCenter(): this;
|
|
14
|
+
alignRight(): this;
|
|
15
|
+
width(width: string | number): this;
|
|
16
|
+
className(className: string): this;
|
|
17
|
+
headerClassName(className: string): this;
|
|
18
|
+
cellClassName(className: string): this;
|
|
19
|
+
abstract build(): ColumnDef<TData, unknown>;
|
|
20
|
+
protected getAlignmentClass(): string;
|
|
21
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
interface ButtonColumnConfig {
|
|
2
|
+
accessorKey?: string;
|
|
3
|
+
header?: string;
|
|
4
|
+
label?: string;
|
|
5
|
+
onClick?: (data: any) => void;
|
|
6
|
+
}
|
|
7
|
+
export declare const ButtonColumn: (config: ButtonColumnConfig) => {
|
|
8
|
+
accessorKey: string;
|
|
9
|
+
header: string;
|
|
10
|
+
cell: ({ row }: {
|
|
11
|
+
row: any;
|
|
12
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
};
|
|
14
|
+
export { ButtonColumn as buttonColumn };
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { BaseColumnConfig } from "./types";
|
|
4
|
+
interface DateColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
format?: "short" | "long" | "relative" | "time" | "datetime" | string;
|
|
6
|
+
locale?: string;
|
|
7
|
+
showIcon?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export declare class DateColumn<TData> extends BaseColumn<TData, DateColumnConfig<TData>> {
|
|
10
|
+
constructor(accessor: keyof TData | string);
|
|
11
|
+
static make<TData>(accessor: keyof TData | string): DateColumn<TData>;
|
|
12
|
+
format(format: "short" | "long" | "relative" | "time" | "datetime"): this;
|
|
13
|
+
locale(locale: string): this;
|
|
14
|
+
withIcon(show?: boolean): this;
|
|
15
|
+
short(): this;
|
|
16
|
+
long(): this;
|
|
17
|
+
relative(): this;
|
|
18
|
+
time(): this;
|
|
19
|
+
datetime(): this;
|
|
20
|
+
private formatDate;
|
|
21
|
+
private getRelativeTime;
|
|
22
|
+
build(): ColumnDef<TData, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export {};
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
interface DropdownOption {
|
|
2
|
+
label: string;
|
|
3
|
+
onClick?: (data: any) => void;
|
|
4
|
+
}
|
|
5
|
+
interface DropdownColumnConfig {
|
|
6
|
+
accessorKey?: string;
|
|
7
|
+
header?: string;
|
|
8
|
+
options: DropdownOption[];
|
|
9
|
+
}
|
|
10
|
+
export declare const DropdownColumn: (config: DropdownColumnConfig) => {
|
|
11
|
+
accessorKey: string;
|
|
12
|
+
header: string;
|
|
13
|
+
cell: ({ row }: {
|
|
14
|
+
row: any;
|
|
15
|
+
}) => import("react/jsx-runtime").JSX.Element;
|
|
16
|
+
};
|
|
17
|
+
export { DropdownColumn as dropdownColumn };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { LucideIcon } from "lucide-react";
|
|
3
|
+
import { BaseColumn } from "./base-column";
|
|
4
|
+
import { BaseColumnConfig } from "./types";
|
|
5
|
+
export interface EnumOption<T = string | number> {
|
|
6
|
+
value: T;
|
|
7
|
+
label: string;
|
|
8
|
+
icon?: LucideIcon;
|
|
9
|
+
color?: "default" | "secondary" | "destructive" | "outline" | "success" | "warning" | "info";
|
|
10
|
+
className?: string;
|
|
11
|
+
}
|
|
12
|
+
interface EnumColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
13
|
+
options: EnumOption[];
|
|
14
|
+
asBadge?: boolean;
|
|
15
|
+
showIcon?: boolean;
|
|
16
|
+
iconPosition?: "left" | "right";
|
|
17
|
+
placeholder?: string;
|
|
18
|
+
}
|
|
19
|
+
export declare class EnumColumn<TData> extends BaseColumn<TData, EnumColumnConfig<TData>> {
|
|
20
|
+
constructor(accessor: keyof TData | string);
|
|
21
|
+
static make<TData>(accessor: keyof TData | string): EnumColumn<TData>;
|
|
22
|
+
/**
|
|
23
|
+
* Define the enum options with labels, icons, and colors
|
|
24
|
+
*/
|
|
25
|
+
options(options: EnumOption[]): this;
|
|
26
|
+
/**
|
|
27
|
+
* Display as plain text instead of badge
|
|
28
|
+
*/
|
|
29
|
+
asText(): this;
|
|
30
|
+
/**
|
|
31
|
+
* Display as badge (default)
|
|
32
|
+
*/
|
|
33
|
+
asBadge(): this;
|
|
34
|
+
/**
|
|
35
|
+
* Hide icons
|
|
36
|
+
*/
|
|
37
|
+
hideIcon(): this;
|
|
38
|
+
/**
|
|
39
|
+
* Show icons (default)
|
|
40
|
+
*/
|
|
41
|
+
showIcon(): this;
|
|
42
|
+
/**
|
|
43
|
+
* Set icon position
|
|
44
|
+
*/
|
|
45
|
+
iconPosition(position: "left" | "right"): this;
|
|
46
|
+
/**
|
|
47
|
+
* Placeholder for unknown values
|
|
48
|
+
*/
|
|
49
|
+
placeholder(placeholder: string): this;
|
|
50
|
+
build(): ColumnDef<TData, unknown>;
|
|
51
|
+
}
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { LucideIcon } from "lucide-react";
|
|
3
|
+
import { ReactNode } from "react";
|
|
4
|
+
import { BaseColumn } from "./base-column";
|
|
5
|
+
import { BaseColumnConfig } from "./types";
|
|
6
|
+
interface IconState {
|
|
7
|
+
icon: ReactNode | LucideIcon;
|
|
8
|
+
label?: string;
|
|
9
|
+
color?: string;
|
|
10
|
+
bgColor?: string;
|
|
11
|
+
tooltip?: string;
|
|
12
|
+
}
|
|
13
|
+
interface IconColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
14
|
+
states?: Record<string, IconState>;
|
|
15
|
+
size?: "xs" | "sm" | "md" | "lg";
|
|
16
|
+
showLabel?: boolean;
|
|
17
|
+
showTooltip?: boolean;
|
|
18
|
+
withBackground?: boolean;
|
|
19
|
+
defaultIcon?: ReactNode;
|
|
20
|
+
defaultLabel?: string;
|
|
21
|
+
}
|
|
22
|
+
export declare class IconColumn<TData> extends BaseColumn<TData, IconColumnConfig<TData>> {
|
|
23
|
+
constructor(accessor: keyof TData | string);
|
|
24
|
+
static make<TData>(accessor: keyof TData | string): IconColumn<TData>;
|
|
25
|
+
state(value: string, config: IconState): this;
|
|
26
|
+
states(states: Record<string, IconState>): this;
|
|
27
|
+
size(size: "xs" | "sm" | "md" | "lg"): this;
|
|
28
|
+
showLabel(show?: boolean): this;
|
|
29
|
+
hideTooltip(): this;
|
|
30
|
+
withBackground(show?: boolean): this;
|
|
31
|
+
default(icon: ReactNode, label?: string): this;
|
|
32
|
+
boolean(config?: {
|
|
33
|
+
trueIcon?: ReactNode;
|
|
34
|
+
falseIcon?: ReactNode;
|
|
35
|
+
trueLabel?: string;
|
|
36
|
+
falseLabel?: string;
|
|
37
|
+
trueColor?: string;
|
|
38
|
+
falseColor?: string;
|
|
39
|
+
trueBgColor?: string;
|
|
40
|
+
falseBgColor?: string;
|
|
41
|
+
}): this;
|
|
42
|
+
activeInactive(): this;
|
|
43
|
+
onlineStatus(): this;
|
|
44
|
+
priority(): this;
|
|
45
|
+
verification(): this;
|
|
46
|
+
private createCheckIcon;
|
|
47
|
+
private createXIcon;
|
|
48
|
+
private createCircleIcon;
|
|
49
|
+
private createArrowUpIcon;
|
|
50
|
+
private createArrowDownIcon;
|
|
51
|
+
private createMinusIcon;
|
|
52
|
+
private createAlertIcon;
|
|
53
|
+
private createShieldCheckIcon;
|
|
54
|
+
private createShieldXIcon;
|
|
55
|
+
private createClockIcon;
|
|
56
|
+
build(): ColumnDef<TData, unknown>;
|
|
57
|
+
}
|
|
58
|
+
export {};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { BaseColumnConfig } from "./types";
|
|
4
|
+
interface ImageColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
size?: "sm" | "md" | "lg";
|
|
6
|
+
rounded?: "none" | "sm" | "md" | "lg" | "full";
|
|
7
|
+
fallback?: string;
|
|
8
|
+
alt?: (row: TData) => string;
|
|
9
|
+
}
|
|
10
|
+
export declare class ImageColumn<TData> extends BaseColumn<TData, ImageColumnConfig<TData>> {
|
|
11
|
+
constructor(accessor: keyof TData | string);
|
|
12
|
+
static make<TData>(accessor: keyof TData | string): ImageColumn<TData>;
|
|
13
|
+
size(size: "sm" | "md" | "lg"): this;
|
|
14
|
+
rounded(rounded: "none" | "sm" | "md" | "lg" | "full"): this;
|
|
15
|
+
circular(): this;
|
|
16
|
+
square(): this;
|
|
17
|
+
fallback(url: string): this;
|
|
18
|
+
alt(fn: (row: TData) => string): this;
|
|
19
|
+
build(): ColumnDef<TData, unknown>;
|
|
20
|
+
}
|
|
21
|
+
export {};
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
export { AvatarGroupColumn } from "./avatar-group-column";
|
|
2
|
+
export { BadgeColumn } from "./badge-column";
|
|
3
|
+
export { ButtonColumn } from "./button-column";
|
|
4
|
+
export { CheckboxColumn } from "./checkbox-column";
|
|
5
|
+
export { DateColumn } from "./date-column";
|
|
6
|
+
export { DropdownColumn } from "./dropdown-column";
|
|
7
|
+
export { IconColumn } from "./icon-column";
|
|
8
|
+
export { ImageColumn } from "./image-column";
|
|
9
|
+
export { InputColumn } from "./input-column";
|
|
10
|
+
export { LinkColumn } from "./link-column";
|
|
11
|
+
export { NumberColumn } from "./number-column";
|
|
12
|
+
export { ProgressColumn } from "./progress-column";
|
|
13
|
+
export { SelectColumn } from "./select-column";
|
|
14
|
+
export { TextColumn } from "./text-column";
|
|
15
|
+
export { ActionsColumn } from "./actions-column";
|
|
16
|
+
export { EnumColumn } from "./enum-column";
|
|
17
|
+
export type { EnumOption } from "./enum-column";
|
|
18
|
+
export type * from "./types";
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { BaseColumnConfig } from "./types";
|
|
4
|
+
interface InputColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
placeholder?: string;
|
|
6
|
+
type?: "text" | "email" | "number" | "password" | "url";
|
|
7
|
+
disabled?: boolean | ((row: TData) => boolean);
|
|
8
|
+
onSave?: (row: TData, newValue: string) => void;
|
|
9
|
+
onChange?: (row: TData, newValue: string) => void;
|
|
10
|
+
debounce?: number;
|
|
11
|
+
}
|
|
12
|
+
export declare class InputColumn<TData> extends BaseColumn<TData, InputColumnConfig<TData>> {
|
|
13
|
+
constructor(accessor: keyof TData | string);
|
|
14
|
+
static make<TData>(accessor: keyof TData | string): InputColumn<TData>;
|
|
15
|
+
placeholder(placeholder: string): this;
|
|
16
|
+
type(type: "text" | "email" | "number" | "password" | "url"): this;
|
|
17
|
+
disabled(disabled: boolean | ((row: TData) => boolean)): this;
|
|
18
|
+
onSave(handler: (row: TData, newValue: string) => void): this;
|
|
19
|
+
onChange(handler: (row: TData, newValue: string) => void): this;
|
|
20
|
+
debounce(ms: number): this;
|
|
21
|
+
email(): this;
|
|
22
|
+
number(): this;
|
|
23
|
+
password(): this;
|
|
24
|
+
url(): this;
|
|
25
|
+
build(): ColumnDef<TData, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export { InputColumn as inputColumn };
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { BaseColumn } from "./base-column";
|
|
4
|
+
import { BaseColumnConfig } from "./types";
|
|
5
|
+
interface LinkColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
6
|
+
href?: string | ((row: TData) => string);
|
|
7
|
+
external?: boolean;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
showExternalIcon?: boolean;
|
|
10
|
+
underline?: "always" | "hover" | "never";
|
|
11
|
+
openInNewTab?: boolean;
|
|
12
|
+
onClick?: (row: TData) => void;
|
|
13
|
+
}
|
|
14
|
+
export declare class LinkColumn<TData> extends BaseColumn<TData, LinkColumnConfig<TData>> {
|
|
15
|
+
constructor(accessor: keyof TData | string);
|
|
16
|
+
static make<TData>(accessor: keyof TData | string): LinkColumn<TData>;
|
|
17
|
+
href(href: string | ((row: TData) => string)): this;
|
|
18
|
+
urlFromField(field: keyof TData): this;
|
|
19
|
+
external(external?: boolean): this;
|
|
20
|
+
icon(icon: ReactNode): this;
|
|
21
|
+
showExternalIcon(show?: boolean): this;
|
|
22
|
+
underline(style: "always" | "hover" | "never"): this;
|
|
23
|
+
openInNewTab(open?: boolean): this;
|
|
24
|
+
onClick(handler: (row: TData) => void): this;
|
|
25
|
+
build(): ColumnDef<TData, unknown>;
|
|
26
|
+
}
|
|
27
|
+
export {};
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { BaseColumnConfig } from "./types";
|
|
4
|
+
interface NumberColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
decimals?: number;
|
|
6
|
+
locale?: string;
|
|
7
|
+
currency?: string;
|
|
8
|
+
percent?: boolean;
|
|
9
|
+
prefix?: string;
|
|
10
|
+
suffix?: string;
|
|
11
|
+
}
|
|
12
|
+
export declare class NumberColumn<TData> extends BaseColumn<TData, NumberColumnConfig<TData>> {
|
|
13
|
+
constructor(accessor: keyof TData | string);
|
|
14
|
+
static make<TData>(accessor: keyof TData | string): NumberColumn<TData>;
|
|
15
|
+
decimals(decimals: number): this;
|
|
16
|
+
locale(locale: string): this;
|
|
17
|
+
money(currency?: string): this;
|
|
18
|
+
percent(): this;
|
|
19
|
+
prefix(prefix: string): this;
|
|
20
|
+
suffix(suffix: string): this;
|
|
21
|
+
build(): ColumnDef<TData, unknown>;
|
|
22
|
+
}
|
|
23
|
+
export {};
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { BaseColumnConfig } from "./types";
|
|
4
|
+
interface ProgressColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
5
|
+
max?: number;
|
|
6
|
+
showValue?: boolean;
|
|
7
|
+
showPercentage?: boolean;
|
|
8
|
+
size?: "sm" | "md" | "lg";
|
|
9
|
+
color?: "default" | "success" | "warning" | "danger" | ((value: number, max: number) => string);
|
|
10
|
+
thresholds?: {
|
|
11
|
+
warning?: number;
|
|
12
|
+
danger?: number;
|
|
13
|
+
};
|
|
14
|
+
format?: (value: number, max: number) => string;
|
|
15
|
+
}
|
|
16
|
+
export declare class ProgressColumn<TData> extends BaseColumn<TData, ProgressColumnConfig<TData>> {
|
|
17
|
+
constructor(accessor: keyof TData | string);
|
|
18
|
+
static make<TData>(accessor: keyof TData | string): ProgressColumn<TData>;
|
|
19
|
+
max(max: number): this;
|
|
20
|
+
showValue(show?: boolean): this;
|
|
21
|
+
showPercentage(show?: boolean): this;
|
|
22
|
+
hideLabel(): this;
|
|
23
|
+
size(size: "sm" | "md" | "lg"): this;
|
|
24
|
+
color(color: "default" | "success" | "warning" | "danger"): this;
|
|
25
|
+
colorByThreshold(warning?: number, danger?: number): this;
|
|
26
|
+
colorByThresholdInverse(warning?: number, danger?: number): this;
|
|
27
|
+
format(fn: (value: number, max: number) => string): this;
|
|
28
|
+
build(): ColumnDef<TData, unknown>;
|
|
29
|
+
}
|
|
30
|
+
export {};
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { ColumnDef } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { BaseColumnConfig } from "./types";
|
|
4
|
+
export interface SelectOption {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
interface SelectColumnConfig<TData> extends BaseColumnConfig<TData> {
|
|
10
|
+
options?: SelectOption[];
|
|
11
|
+
placeholder?: string;
|
|
12
|
+
disabled?: boolean | ((row: TData) => boolean);
|
|
13
|
+
onValueChange?: (row: TData, newValue: string) => void;
|
|
14
|
+
}
|
|
15
|
+
export declare class SelectColumn<TData> extends BaseColumn<TData, SelectColumnConfig<TData>> {
|
|
16
|
+
constructor(accessor: keyof TData | string);
|
|
17
|
+
static make<TData>(accessor: keyof TData | string): SelectColumn<TData>;
|
|
18
|
+
options(options: SelectOption[]): this;
|
|
19
|
+
placeholder(placeholder: string): this;
|
|
20
|
+
disabled(disabled: boolean | ((row: TData) => boolean)): this;
|
|
21
|
+
onValueChange(handler: (row: TData, newValue: string) => void): this;
|
|
22
|
+
build(): ColumnDef<TData, unknown>;
|
|
23
|
+
}
|
|
24
|
+
export { SelectColumn as selectColumn };
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ColumnDef, Row } from "@tanstack/react-table";
|
|
2
|
+
import { BaseColumn } from "./base-column";
|
|
3
|
+
import { FormattedColumnConfig } from "./types";
|
|
4
|
+
export declare class TextColumn<TData> extends BaseColumn<TData, FormattedColumnConfig<TData>> {
|
|
5
|
+
static make<TData>(accessor: keyof TData | string): TextColumn<TData>;
|
|
6
|
+
formatter(fn: (value: unknown, row: Row<TData>) => React.ReactNode): this;
|
|
7
|
+
prefix(prefix: string): this;
|
|
8
|
+
suffix(suffix: string): this;
|
|
9
|
+
placeholder(placeholder: string): this;
|
|
10
|
+
uppercase(): this;
|
|
11
|
+
lowercase(): this;
|
|
12
|
+
limit(chars: number): this;
|
|
13
|
+
build(): ColumnDef<TData, unknown>;
|
|
14
|
+
}
|