@segmentify/ui 0.0.23 → 0.0.25
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/components/molecules/base-button.d.ts +7 -16
- package/dist/components/molecules/confirmation-dialog.d.ts +1 -1
- package/dist/components/molecules/select-field.d.ts +5 -4
- package/dist/components/organisms/data-table/actions.d.ts +12 -0
- package/dist/components/organisms/data-table/content.d.ts +11 -1
- package/dist/components/organisms/data-table/context.d.ts +1 -0
- package/dist/components/organisms/data-table/index.d.ts +4 -1
- package/dist/components/organisms/data-table/pagination.d.ts +2 -3
- package/dist/components/organisms/data-table/root.d.ts +2 -1
- package/dist/components/organisms/form-checkbox.d.ts +5 -3
- package/dist/components/organisms/form-combobox.d.ts +5 -3
- package/dist/components/organisms/form-date-picker.d.ts +5 -3
- package/dist/components/organisms/form-file-upload.d.ts +5 -3
- package/dist/components/organisms/form-password.d.ts +5 -3
- package/dist/components/organisms/form-radio.d.ts +5 -3
- package/dist/components/organisms/form-slider.d.ts +7 -5
- package/dist/components/organisms/form-switch.d.ts +5 -3
- package/dist/components/organisms/form-textarea.d.ts +5 -3
- package/dist/hooks/use-data-table.d.ts +29 -2
- package/dist/mock/actions.d.ts +6 -0
- package/dist/mock/columns.d.ts +9 -0
- package/dist/segmentify-ui.cjs +61 -61
- package/dist/segmentify-ui.js +8987 -9192
- package/package.json +1 -1
- package/dist/mock.d.ts +0 -3
|
@@ -1,24 +1,15 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
import { buttonVariants } from '../../lib/design-variants';
|
|
3
3
|
import { VariantProps } from 'class-variance-authority';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
variant?: VariantProps<typeof buttonVariants>['variant'];
|
|
4
|
+
declare const BaseButton: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref">, "children"> & {
|
|
5
|
+
size?: VariantProps<typeof buttonVariants>["size"];
|
|
6
|
+
variant?: VariantProps<typeof buttonVariants>["variant"];
|
|
8
7
|
label?: string;
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
isSuffix?: boolean;
|
|
9
|
+
isPrefix?: boolean;
|
|
11
10
|
isLoading?: boolean;
|
|
12
11
|
labelClassName?: string;
|
|
13
|
-
|
|
14
|
-
type IconOnlyProps = BaseProps & {
|
|
15
|
-
isIconOnly: true;
|
|
16
|
-
icon: React.ReactNode;
|
|
17
|
-
};
|
|
18
|
-
type DefaultButtonProps = BaseProps & {
|
|
19
|
-
isIconOnly?: false;
|
|
12
|
+
isIconOnly?: boolean;
|
|
20
13
|
icon?: React.ReactNode;
|
|
21
|
-
}
|
|
22
|
-
type BaseButtonProps = Union.Strict<IconOnlyProps | DefaultButtonProps>;
|
|
23
|
-
declare const BaseButton: React.ForwardRefExoticComponent<BaseButtonProps & React.RefAttributes<HTMLButtonElement>>;
|
|
14
|
+
} & React.RefAttributes<HTMLButtonElement>>;
|
|
24
15
|
export { BaseButton };
|
|
@@ -4,14 +4,15 @@ import type { SelectItemProps } from '../../lib/types';
|
|
|
4
4
|
interface SelectFieldProps extends React.ComponentProps<typeof Select> {
|
|
5
5
|
options: SelectItemProps[];
|
|
6
6
|
placeholder: string;
|
|
7
|
-
triggerClassName: string;
|
|
8
|
-
containerClassName: string;
|
|
9
7
|
onChange: (value: string) => void;
|
|
10
8
|
value: string;
|
|
11
|
-
label
|
|
9
|
+
label?: string;
|
|
10
|
+
labelClassName?: string;
|
|
11
|
+
triggerClassName?: string;
|
|
12
|
+
containerClassName?: string;
|
|
12
13
|
isPortal?: boolean;
|
|
13
14
|
hasFormControlWrapper?: boolean;
|
|
14
15
|
selectContentClassName?: string;
|
|
15
16
|
}
|
|
16
|
-
export declare const SelectField: ({ options, placeholder, hasFormControlWrapper, selectContentClassName, onChange, value, label, triggerClassName, containerClassName, isPortal, ...props }: SelectFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare const SelectField: ({ options, placeholder, hasFormControlWrapper, selectContentClassName, onChange, value, label, triggerClassName, labelClassName, containerClassName, isPortal, ...props }: SelectFieldProps) => import("react/jsx-runtime").JSX.Element;
|
|
17
18
|
export {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
export interface ActionItem {
|
|
3
|
+
label: string;
|
|
4
|
+
icon?: ReactNode;
|
|
5
|
+
onClick: () => void;
|
|
6
|
+
variant?: 'default' | 'destructive';
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
}
|
|
9
|
+
export interface ActionsProps {
|
|
10
|
+
actions: ActionItem[];
|
|
11
|
+
}
|
|
12
|
+
export declare const Actions: ({ actions }: ActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
@@ -1,8 +1,18 @@
|
|
|
1
1
|
import { ReactNode } from 'react';
|
|
2
|
+
import { type Row } from '@tanstack/react-table';
|
|
3
|
+
export interface RenderRowSubComponentProps<TData = unknown> {
|
|
4
|
+
row: Row<TData>;
|
|
5
|
+
}
|
|
2
6
|
interface ContentProps {
|
|
3
7
|
className?: string;
|
|
4
8
|
loadingContent?: ReactNode;
|
|
5
9
|
emptyContent?: ReactNode;
|
|
10
|
+
/**
|
|
11
|
+
* Render a sub-component below a row when it's expanded.
|
|
12
|
+
* The sub-component can handle its own data fetching and render sub-rows.
|
|
13
|
+
* @example ({ row }) => <SubRowAsync row={row} />
|
|
14
|
+
*/
|
|
15
|
+
renderRowSubComponent?: (props: RenderRowSubComponentProps) => ReactNode;
|
|
6
16
|
}
|
|
7
|
-
export declare function Content({ className, loadingContent, emptyContent, }: ContentProps): import("react/jsx-runtime").JSX.Element;
|
|
17
|
+
export declare function Content({ className, loadingContent, emptyContent, renderRowSubComponent, }: ContentProps): import("react/jsx-runtime").JSX.Element;
|
|
8
18
|
export {};
|
|
@@ -4,6 +4,7 @@ export interface DataTableContextValue<TData> {
|
|
|
4
4
|
isLoading: boolean;
|
|
5
5
|
globalFilter: string;
|
|
6
6
|
onGlobalFilterChange: (value: string) => void;
|
|
7
|
+
totalCount?: number;
|
|
7
8
|
}
|
|
8
9
|
export declare const DataTableContext: import("react").Context<DataTableContextValue<unknown> | null>;
|
|
9
10
|
export declare function useDataTableContext<TData>(): DataTableContextValue<TData>;
|
|
@@ -3,11 +3,14 @@ import { Toolbar } from './toolbar';
|
|
|
3
3
|
import { Search } from './search';
|
|
4
4
|
import { ColumnVisibility } from './column-visibility';
|
|
5
5
|
import { Content } from './content';
|
|
6
|
+
export type { ActionItem, ActionsProps } from './actions';
|
|
7
|
+
export type { RenderRowSubComponentProps } from './content';
|
|
6
8
|
export declare const DataTable: {
|
|
7
9
|
Root: typeof Root;
|
|
8
10
|
Toolbar: typeof Toolbar;
|
|
9
11
|
Search: typeof Search;
|
|
10
12
|
ColumnVisibility: typeof ColumnVisibility;
|
|
11
13
|
Content: typeof Content;
|
|
12
|
-
Pagination: ({ showSelectedCount,
|
|
14
|
+
Pagination: ({ showSelectedCount, showPaginationInfo, className }: import("./pagination").PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
15
|
+
Actions: ({ actions }: import("./actions").ActionsProps) => import("react/jsx-runtime").JSX.Element | null;
|
|
13
16
|
};
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export interface PaginationProps {
|
|
2
2
|
showSelectedCount?: boolean;
|
|
3
|
-
|
|
4
|
-
nextLabel?: string;
|
|
3
|
+
showPaginationInfo?: boolean;
|
|
5
4
|
className?: string;
|
|
6
5
|
}
|
|
7
|
-
export declare const Pagination: ({ showSelectedCount,
|
|
6
|
+
export declare const Pagination: ({ showSelectedCount, showPaginationInfo, className }: PaginationProps) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -6,7 +6,8 @@ interface RootProps<TData> {
|
|
|
6
6
|
isLoading?: boolean;
|
|
7
7
|
globalFilter?: string;
|
|
8
8
|
onGlobalFilterChange?: (value: string) => void;
|
|
9
|
+
totalCount?: number;
|
|
9
10
|
className?: string;
|
|
10
11
|
}
|
|
11
|
-
export declare function Root<TData>({ table, children, isLoading, globalFilter, onGlobalFilterChange, className, }: RootProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
12
|
+
export declare function Root<TData>({ table, children, isLoading, globalFilter, onGlobalFilterChange, totalCount, className, }: RootProps<TData>): import("react/jsx-runtime").JSX.Element;
|
|
12
13
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
1
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
|
+
type FormCheckboxProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
3
|
+
name: Path<TFieldValues>;
|
|
4
|
+
control?: Control<TFieldValues>;
|
|
3
5
|
label: string;
|
|
4
6
|
formClassName?: string;
|
|
5
7
|
};
|
|
6
|
-
export declare const FormCheckbox: ({ name, formClassName, ...props }:
|
|
8
|
+
export declare const FormCheckbox: <TFieldValues extends FieldValues = FieldValues>({ name, control, formClassName, ...props }: FormCheckboxProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
1
2
|
import type { SelectItemProps } from '../../lib/types';
|
|
2
|
-
type
|
|
3
|
-
name:
|
|
3
|
+
type FormComboboxProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
4
|
+
name: Path<TFieldValues>;
|
|
4
5
|
label: string;
|
|
5
6
|
triggerPlaceholder: string;
|
|
6
7
|
inputPlaceholder: string;
|
|
@@ -19,6 +20,7 @@ type Props = {
|
|
|
19
20
|
onInputChange?: (inputValue: string) => void;
|
|
20
21
|
isDisabled?: boolean;
|
|
21
22
|
tooltipContent?: string;
|
|
23
|
+
control?: Control<TFieldValues>;
|
|
22
24
|
};
|
|
23
|
-
export declare const FormCombobox: ({ name, label, triggerPlaceholder, inputPlaceholder, options, description, multiple, emptyMessage, containerClassName, contentClassName, contentListClassName, avoidCollisions, clearable, hasAllOption, allOptionLabel, closeOnSelect, onInputChange, isDisabled, tooltipContent, }:
|
|
25
|
+
export declare const FormCombobox: <TFieldValues extends FieldValues = FieldValues>({ name, label, triggerPlaceholder, inputPlaceholder, options, description, multiple, emptyMessage, containerClassName, contentClassName, contentListClassName, avoidCollisions, clearable, hasAllOption, allOptionLabel, closeOnSelect, onInputChange, isDisabled, tooltipContent, control, }: FormComboboxProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
24
26
|
export {};
|
|
@@ -1,5 +1,7 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
|
+
export interface FormDatePickerProps<TFieldValues extends FieldValues = FieldValues> {
|
|
3
|
+
name: Path<TFieldValues>;
|
|
4
|
+
control?: Control<TFieldValues>;
|
|
3
5
|
disabledCondition?: boolean | ((date: Date) => boolean);
|
|
4
6
|
label?: string;
|
|
5
7
|
placeholder?: string;
|
|
@@ -8,4 +10,4 @@ export interface FormDatePickerProps {
|
|
|
8
10
|
triggerClassName?: string;
|
|
9
11
|
showErrorPlaceholder?: boolean;
|
|
10
12
|
}
|
|
11
|
-
export declare const FormDatePicker: ({ name, disabledCondition, label, placeholder, description, containerClassName, triggerClassName, showErrorPlaceholder, }: FormDatePickerProps) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const FormDatePicker: <TFieldValues extends FieldValues = FieldValues>({ name, control, disabledCondition, label, placeholder, description, containerClassName, triggerClassName, showErrorPlaceholder, }: FormDatePickerProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
1
2
|
import type { ClassValue } from 'clsx';
|
|
2
|
-
type FormFileUploadProps = {
|
|
3
|
-
name:
|
|
3
|
+
type FormFileUploadProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
4
|
+
name: Path<TFieldValues>;
|
|
5
|
+
control?: Control<TFieldValues>;
|
|
4
6
|
label?: string;
|
|
5
7
|
uploadButtonLabel?: string;
|
|
6
8
|
description?: string;
|
|
@@ -13,7 +15,7 @@ type FormFileUploadProps = {
|
|
|
13
15
|
onUpload?: (file: File) => Promise<string>;
|
|
14
16
|
};
|
|
15
17
|
export declare const FormFileUpload: {
|
|
16
|
-
({ name, label, uploadButtonLabel, description, accept, disabled, multiple, containerClassName, tooltipContent, hasRequiredIndicator, onUpload, }: FormFileUploadProps): import("react/jsx-runtime").JSX.Element;
|
|
18
|
+
<TFieldValues extends FieldValues = FieldValues>({ name, control, label, uploadButtonLabel, description, accept, disabled, multiple, containerClassName, tooltipContent, hasRequiredIndicator, onUpload, }: FormFileUploadProps<TFieldValues>): import("react/jsx-runtime").JSX.Element;
|
|
17
19
|
displayName: string;
|
|
18
20
|
};
|
|
19
21
|
export {};
|
|
@@ -1,12 +1,14 @@
|
|
|
1
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
1
2
|
import type { ClassValue } from 'clsx';
|
|
2
|
-
type Props = {
|
|
3
|
+
type Props<TFieldValues extends FieldValues = FieldValues> = {
|
|
3
4
|
label: string;
|
|
4
|
-
name:
|
|
5
|
+
name: Path<TFieldValues>;
|
|
5
6
|
placeholder: string;
|
|
7
|
+
control?: Control<TFieldValues>;
|
|
6
8
|
containerClassName?: ClassValue;
|
|
7
9
|
description?: string;
|
|
8
10
|
tooltipContent?: string;
|
|
9
11
|
hasRequiredIndicator?: boolean;
|
|
10
12
|
};
|
|
11
|
-
export declare const FormPassword: ({ label, name, containerClassName, description, placeholder, tooltipContent, hasRequiredIndicator, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
13
|
+
export declare const FormPassword: <TFieldValues extends FieldValues = FieldValues>({ label, name, containerClassName, description, placeholder, tooltipContent, control, hasRequiredIndicator, ...props }: Props<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
12
14
|
export {};
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
1
2
|
import type { SelectItemProps } from '../../lib/types';
|
|
2
|
-
type Props = {
|
|
3
|
-
name:
|
|
3
|
+
type Props<TFieldValues extends FieldValues = FieldValues> = {
|
|
4
|
+
name: Path<TFieldValues>;
|
|
4
5
|
label: string;
|
|
5
6
|
items: SelectItemProps[];
|
|
7
|
+
control?: Control<TFieldValues>;
|
|
6
8
|
containerClassName?: string;
|
|
7
9
|
itemClassName?: string;
|
|
8
10
|
itemLabelClassName?: string;
|
|
9
11
|
selectedClassName?: string;
|
|
10
12
|
description?: string;
|
|
11
13
|
};
|
|
12
|
-
export declare const FormRadio: ({ name, label, items, containerClassName, itemClassName, itemLabelClassName, selectedClassName, description, }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
14
|
+
export declare const FormRadio: <TFieldValues extends FieldValues = FieldValues>({ name, label, items, control, containerClassName, itemClassName, itemLabelClassName, selectedClassName, description, }: Props<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
13
15
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
3
|
import { Slider } from '../../components/atoms/slider';
|
|
3
|
-
type FormSliderProps = {
|
|
4
|
-
name:
|
|
4
|
+
type FormSliderProps<TFieldValues extends FieldValues = FieldValues> = {
|
|
5
|
+
name: Path<TFieldValues>;
|
|
6
|
+
control?: Control<TFieldValues>;
|
|
5
7
|
label?: string;
|
|
6
8
|
description?: string;
|
|
7
9
|
min?: number;
|
|
@@ -10,12 +12,12 @@ type FormSliderProps = {
|
|
|
10
12
|
leftLabel?: string;
|
|
11
13
|
rightLabel?: string;
|
|
12
14
|
showLabels?: boolean;
|
|
13
|
-
complementaryField?:
|
|
15
|
+
complementaryField?: Path<TFieldValues>;
|
|
14
16
|
onValueChange?: (value: number) => void;
|
|
15
17
|
containerClassName?: string;
|
|
16
18
|
labelClassName?: string;
|
|
17
19
|
showErrorPlaceholder?: boolean;
|
|
18
20
|
tooltipContent?: string;
|
|
19
|
-
} & React.ComponentProps<typeof Slider>;
|
|
20
|
-
export declare const FormSlider: ({ name, label, description, min, max, step, leftLabel, rightLabel, showLabels, complementaryField, onValueChange, containerClassName, labelClassName, showErrorPlaceholder, tooltipContent, ...props }: FormSliderProps) => import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
} & Omit<React.ComponentProps<typeof Slider>, 'name' | 'onValueChange'>;
|
|
22
|
+
export declare const FormSlider: <TFieldValues extends FieldValues = FieldValues>({ name, control, label, description, min, max, step, leftLabel, rightLabel, showLabels, complementaryField, onValueChange, containerClassName, labelClassName, showErrorPlaceholder, tooltipContent, ...props }: FormSliderProps<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
21
23
|
export {};
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
type
|
|
2
|
-
|
|
1
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
|
+
type Props<TFieldValues extends FieldValues = FieldValues> = {
|
|
3
|
+
name: Path<TFieldValues>;
|
|
3
4
|
label: string;
|
|
5
|
+
control?: Control<TFieldValues>;
|
|
4
6
|
description?: string;
|
|
5
7
|
};
|
|
6
|
-
export declare const FormSwitch: ({ name, label, description, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
8
|
+
export declare const FormSwitch: <TFieldValues extends FieldValues = FieldValues>({ name, label, description, control, ...props }: Props<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
7
9
|
export {};
|
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
type
|
|
1
|
+
import { type Control, type FieldValues, type Path } from 'react-hook-form';
|
|
2
|
+
type Props<TFieldValues extends FieldValues = FieldValues> = {
|
|
2
3
|
label: string;
|
|
3
|
-
name:
|
|
4
|
+
name: Path<TFieldValues>;
|
|
4
5
|
placeholder: string;
|
|
6
|
+
control?: Control<TFieldValues>;
|
|
5
7
|
description?: string;
|
|
6
8
|
containerClassName?: string;
|
|
7
9
|
};
|
|
8
|
-
export declare const FormTextarea: ({ label, name, description, placeholder, containerClassName, ...props }: Props) => import("react/jsx-runtime").JSX.Element;
|
|
10
|
+
export declare const FormTextarea: <TFieldValues extends FieldValues = FieldValues>({ label, name, description, placeholder, containerClassName, control, ...props }: Props<TFieldValues>) => import("react/jsx-runtime").JSX.Element;
|
|
9
11
|
export {};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { type ColumnDef, type ColumnFiltersState, type SortingState, type VisibilityState, type PaginationState, type RowSelectionState, type Table } from '@tanstack/react-table';
|
|
1
|
+
import { type ColumnDef, type ColumnFiltersState, type SortingState, type VisibilityState, type PaginationState, type RowSelectionState, type ColumnPinningState, type ExpandedState, type Table } from '@tanstack/react-table';
|
|
2
2
|
import { type UseQueryOptions } from '@tanstack/react-query';
|
|
3
3
|
export interface FetcherParams {
|
|
4
4
|
pageIndex: number;
|
|
@@ -39,6 +39,11 @@ export interface UseDataTableOptions<TData> {
|
|
|
39
39
|
* Initial column visibility
|
|
40
40
|
*/
|
|
41
41
|
initialColumnVisibility?: VisibilityState;
|
|
42
|
+
/**
|
|
43
|
+
* Initial column pinning state
|
|
44
|
+
* @example { left: ['select'], right: ['actions'] }
|
|
45
|
+
*/
|
|
46
|
+
initialColumnPinning?: ColumnPinningState;
|
|
42
47
|
/**
|
|
43
48
|
* Whether pagination is handled manually (server-side)
|
|
44
49
|
* @default false
|
|
@@ -54,6 +59,20 @@ export interface UseDataTableOptions<TData> {
|
|
|
54
59
|
* @default false
|
|
55
60
|
*/
|
|
56
61
|
manualFiltering?: boolean;
|
|
62
|
+
/**
|
|
63
|
+
* Function to get sub-rows from a row (for expandable rows)
|
|
64
|
+
* @example (row) => row.subRows
|
|
65
|
+
*/
|
|
66
|
+
getSubRows?: (row: TData) => TData[] | undefined;
|
|
67
|
+
/**
|
|
68
|
+
* Function to determine if a row can be expanded.
|
|
69
|
+
* Set to `() => true` to allow all rows to expand (useful for lazy-loaded sub-components).
|
|
70
|
+
* @example () => true
|
|
71
|
+
* @example (row) => row.original.hasDetails
|
|
72
|
+
*/
|
|
73
|
+
getRowCanExpand?: (row: {
|
|
74
|
+
original: TData;
|
|
75
|
+
}) => boolean;
|
|
57
76
|
/**
|
|
58
77
|
* Additional react-query options
|
|
59
78
|
* Allows customizing staleTime, gcTime, refetchInterval, etc.
|
|
@@ -121,6 +140,14 @@ export interface UseDataTableReturn<TData> {
|
|
|
121
140
|
* Current row selection
|
|
122
141
|
*/
|
|
123
142
|
rowSelection: RowSelectionState;
|
|
143
|
+
/**
|
|
144
|
+
* Current column pinning state
|
|
145
|
+
*/
|
|
146
|
+
columnPinning: ColumnPinningState;
|
|
147
|
+
/**
|
|
148
|
+
* Current expanded state
|
|
149
|
+
*/
|
|
150
|
+
expanded: ExpandedState;
|
|
124
151
|
/**
|
|
125
152
|
* Whether the query is in success state
|
|
126
153
|
*/
|
|
@@ -130,4 +157,4 @@ export interface UseDataTableReturn<TData> {
|
|
|
130
157
|
*/
|
|
131
158
|
isError: boolean;
|
|
132
159
|
}
|
|
133
|
-
export declare function useDataTable<TData>({ queryKey, columns, fetcher, initialPageSize, initialSorting, initialColumnVisibility, manualPagination, manualSorting, manualFiltering, queryOptions, }: UseDataTableOptions<TData>): UseDataTableReturn<TData>;
|
|
160
|
+
export declare function useDataTable<TData>({ queryKey, columns, fetcher, initialPageSize, initialSorting, initialColumnVisibility, initialColumnPinning, manualPagination, manualSorting, manualFiltering, getSubRows, getRowCanExpand, queryOptions, }: UseDataTableOptions<TData>): UseDataTableReturn<TData>;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
2
|
+
import { Product } from '../app';
|
|
3
|
+
import { type ReactNode } from 'react';
|
|
4
|
+
export type ColumnDefWithSubCell<TData> = ColumnDef<TData> & {
|
|
5
|
+
meta?: {
|
|
6
|
+
subCell?: (data: TData) => ReactNode;
|
|
7
|
+
};
|
|
8
|
+
};
|
|
9
|
+
export declare const columns: ColumnDefWithSubCell<Product>[];
|