@hotelrank/raw-grids 1.0.0 → 1.0.1
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/index.cjs +3 -3
- package/dist/index.d.ts +46 -38
- package/dist/index.js +2910 -2931
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -10,28 +10,24 @@ import { ReactNode } from 'react';
|
|
|
10
10
|
import { RefAttributes } from 'react';
|
|
11
11
|
import { Store } from '@tanstack/store';
|
|
12
12
|
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
showSNo?: boolean;
|
|
21
|
-
indexChildren?: default_2.ReactNode;
|
|
22
|
-
};
|
|
13
|
+
declare interface ActionColumn<T> extends BaseColumn {
|
|
14
|
+
type: 'actions';
|
|
15
|
+
id: typeof ACTIONS_COLUMN_ID;
|
|
16
|
+
render: (row: T) => default_2.ReactNode;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
export declare const ACTIONS_COLUMN_ID: "__actions__";
|
|
23
20
|
|
|
24
21
|
export declare const addPreset: (pageKey: string, item: PresetItem) => void;
|
|
25
22
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
label: string;
|
|
23
|
+
declare interface BaseColumn {
|
|
24
|
+
label: string | default_2.ReactNode;
|
|
29
25
|
minWidth?: number | string;
|
|
30
|
-
align?: 'left' | 'center' | 'right';
|
|
31
|
-
sortable?: boolean;
|
|
32
26
|
backgroundColor?: string;
|
|
33
27
|
}
|
|
34
28
|
|
|
29
|
+
export declare type Column<T> = DataColumn<T> | ActionColumn<T> | VisibilityColumn;
|
|
30
|
+
|
|
35
31
|
export declare interface ConfirmActionDialogProps {
|
|
36
32
|
open: boolean;
|
|
37
33
|
onClose: () => void;
|
|
@@ -56,35 +52,36 @@ export declare interface ConfirmDeleteDialogProps {
|
|
|
56
52
|
isLoading?: boolean;
|
|
57
53
|
}
|
|
58
54
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
55
|
+
declare interface DataColumn<T> extends BaseColumn {
|
|
56
|
+
type?: 'data';
|
|
57
|
+
id: keyof T & string;
|
|
58
|
+
align?: 'left' | 'center' | 'right';
|
|
59
|
+
sortable?: boolean;
|
|
60
|
+
sortAccessor?: SortAccessor<T>;
|
|
61
|
+
sortComparator?: SortComparator<T>;
|
|
62
|
+
render?: (row: T) => default_2.ReactNode;
|
|
67
63
|
}
|
|
68
64
|
|
|
65
|
+
export declare function DataTable<T>({ tableId, data: rowData, headers, loading, loadingChildren, skeletonLoading, emptyMessage, page, pageSize, onPageChange, onPageSizeChange, density, totalCount, pageSizeOptions, onRowSelect, onRowSelectEvent, enableColumnVisibility, }: DataTableProps<T>): JSX_2.Element;
|
|
66
|
+
|
|
69
67
|
export declare interface DataTableProps<T> {
|
|
70
68
|
tableId: string;
|
|
71
|
-
headers
|
|
72
|
-
data
|
|
69
|
+
headers: Column<T>[];
|
|
70
|
+
data: T[];
|
|
73
71
|
loading?: boolean;
|
|
74
72
|
emptyMessage?: string;
|
|
75
|
-
actions?: DataTableAction<T>[];
|
|
76
73
|
page?: number;
|
|
77
74
|
pageSize?: number;
|
|
78
|
-
onPageChange?: (page: number) => void
|
|
79
|
-
onPageSizeChange?: (size: number) => void
|
|
75
|
+
onPageChange?: (page: number) => void;
|
|
76
|
+
onPageSizeChange?: (size: number) => void;
|
|
80
77
|
density?: DensityType;
|
|
81
78
|
totalCount?: number;
|
|
82
|
-
actionConfig?: ActionHeaderProps;
|
|
83
79
|
loadingChildren?: JSX.Element;
|
|
84
80
|
skeletonLoading?: boolean;
|
|
85
81
|
pageSizeOptions?: number[];
|
|
86
82
|
onRowSelect?: (row: T, event?: default_2.MouseEvent) => void;
|
|
87
83
|
onRowSelectEvent?: 'left' | 'right';
|
|
84
|
+
enableColumnVisibility?: boolean;
|
|
88
85
|
}
|
|
89
86
|
|
|
90
87
|
export declare type DateTimeVariant = 'date' | 'time' | 'dateTime' | 'full' | 'relative' | 'short';
|
|
@@ -350,7 +347,7 @@ export declare class OptionsClientImpl implements OptionsClient {
|
|
|
350
347
|
private store;
|
|
351
348
|
private inflight;
|
|
352
349
|
constructor(api: OptionsApi);
|
|
353
|
-
getRaw(key: string): OptionValue
|
|
350
|
+
getRaw(key: string): OptionValue;
|
|
354
351
|
getKey<T = any>(key: string): Promise<T | undefined>;
|
|
355
352
|
getMultiKey<T = any>(keys: string[]): Promise<Record<string, T>>;
|
|
356
353
|
subscribe(key: string, cb: Listener): () => void;
|
|
@@ -369,7 +366,7 @@ export declare function OptionsProvider({ client: { apiUrl }, children, }: {
|
|
|
369
366
|
export declare class OptionsStore {
|
|
370
367
|
private state;
|
|
371
368
|
private listeners;
|
|
372
|
-
get(key: string): OptionValue
|
|
369
|
+
get(key: string): OptionValue;
|
|
373
370
|
set(option: OptionValue): void;
|
|
374
371
|
setMany(options: OptionValue[]): void;
|
|
375
372
|
subscribe(key: string, listener: Listener): () => void;
|
|
@@ -410,11 +407,9 @@ export declare const saveOrder: (pageKey: string, filters: string[]) => void;
|
|
|
410
407
|
|
|
411
408
|
export declare const savePresets: (pageKey: string, items: PresetItem[]) => void;
|
|
412
409
|
|
|
413
|
-
export declare const setActionsConfig: (actionsConfig: ActionHeaderProps) => void;
|
|
414
|
-
|
|
415
410
|
export declare function setColumnWidth(columnId: string, width: number): void;
|
|
416
411
|
|
|
417
|
-
export declare function setData(newData: any[], headers?: Column[]): void;
|
|
412
|
+
export declare function setData(newData: any[], headers?: Column<any>[], enableColumnVisibility?: boolean): void;
|
|
418
413
|
|
|
419
414
|
export declare function setTableId(tableId: string): void;
|
|
420
415
|
|
|
@@ -422,6 +417,12 @@ declare type SlotProps = {
|
|
|
422
417
|
children: ReactNode;
|
|
423
418
|
};
|
|
424
419
|
|
|
420
|
+
declare type SortAccessor<T> = (row: T) => unknown;
|
|
421
|
+
|
|
422
|
+
declare type SortComparator<T> = (a: T, b: T, direction: Exclude<SortDirection, null>) => number;
|
|
423
|
+
|
|
424
|
+
declare type SortDirection = 'asc' | 'desc' | null;
|
|
425
|
+
|
|
425
426
|
export declare type SortOrder = 'asc' | 'desc';
|
|
426
427
|
|
|
427
428
|
export declare function StackedDateTime({ value, dateVariant, timeVariant, dateFormat, timeFormat, align, dateColor, dateFontSize, dateFontWeight, timeColor, timeFontSize, timeFontWeight, showTime, }: StackedDateTimeProps): JSX_2.Element;
|
|
@@ -445,18 +446,18 @@ declare interface StackedDateTimeProps {
|
|
|
445
446
|
declare interface TableState {
|
|
446
447
|
tableId: string;
|
|
447
448
|
sortColumn: string | null;
|
|
448
|
-
sortDirection: 'asc' | 'desc';
|
|
449
|
+
sortDirection: 'asc' | 'desc' | null;
|
|
449
450
|
visibility: Record<string, boolean>;
|
|
450
451
|
columnWidths: Record<string, number>;
|
|
451
|
-
columnOrder: Column[];
|
|
452
|
+
columnOrder: Column<any>[];
|
|
452
453
|
data: any[];
|
|
453
454
|
sortableColumns: {
|
|
454
455
|
id: string;
|
|
455
456
|
label: string | default_2.ReactNode;
|
|
456
457
|
sortable: boolean;
|
|
457
|
-
|
|
458
|
+
minWidth?: number | string;
|
|
458
459
|
}[];
|
|
459
|
-
|
|
460
|
+
enableColumnVisibility: boolean;
|
|
460
461
|
}
|
|
461
462
|
|
|
462
463
|
export declare const tableStore: Store<TableState, (cb: TableState) => TableState>;
|
|
@@ -504,6 +505,13 @@ declare interface UsePaginationResult {
|
|
|
504
505
|
|
|
505
506
|
export declare type ValueType = 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
506
507
|
|
|
508
|
+
export declare const VISIBILITY_COLUMN_ID: "__visibility__";
|
|
509
|
+
|
|
510
|
+
declare interface VisibilityColumn extends BaseColumn {
|
|
511
|
+
type: 'visibility';
|
|
512
|
+
id: typeof VISIBILITY_COLUMN_ID;
|
|
513
|
+
}
|
|
514
|
+
|
|
507
515
|
/**
|
|
508
516
|
* Chakra v3 / Ark UI slot components do NOT expose `children` in their typings.
|
|
509
517
|
* This wrapper intentionally loosens typing to make them library-safe.
|