@mdspl/mds-shared-ui 1.2.4 → 1.2.6
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 +6 -3
- package/dist/index.d.ts +52 -41
- package/dist/index.js +3426 -2838
- package/package.json +3 -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
|
-
id: string;
|
|
23
|
+
declare interface BaseColumn {
|
|
28
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 | SerialNumberColumn;
|
|
30
|
+
|
|
35
31
|
export declare interface ConfirmActionDialogProps {
|
|
36
32
|
open: boolean;
|
|
37
33
|
onClose: () => void;
|
|
@@ -56,44 +52,42 @@ 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 extends {
|
|
66
|
+
id: string | number;
|
|
67
|
+
}>({ tableId, data: rowData, headers, loading, loadingChildren, skeletonLoading, emptyMessage, page, pageSize, onPageChange, onPageSizeChange, density, totalCount, pageSizeOptions, onRowSelect, onRowSelectEvent, enableColumnVisibility, dataType, }: DataTableProps<T>): JSX_2.Element;
|
|
68
|
+
|
|
69
69
|
export declare interface DataTableProps<T> {
|
|
70
70
|
tableId: string;
|
|
71
|
-
headers
|
|
72
|
-
data
|
|
71
|
+
headers: Column<T>[];
|
|
72
|
+
data: T[];
|
|
73
73
|
loading?: boolean;
|
|
74
74
|
emptyMessage?: string;
|
|
75
|
-
actions?: DataTableAction<T>[];
|
|
76
75
|
page?: number;
|
|
77
76
|
pageSize?: number;
|
|
78
|
-
onPageChange?: (page: number) => void
|
|
79
|
-
onPageSizeChange?: (size: number) => void
|
|
77
|
+
onPageChange?: (page: number) => void;
|
|
78
|
+
onPageSizeChange?: (size: number) => void;
|
|
80
79
|
density?: DensityType;
|
|
81
80
|
totalCount?: number;
|
|
82
|
-
actionConfig?: ActionHeaderProps;
|
|
83
81
|
loadingChildren?: JSX.Element;
|
|
84
82
|
skeletonLoading?: boolean;
|
|
85
83
|
pageSizeOptions?: number[];
|
|
86
84
|
onRowSelect?: (row: T, event?: default_2.MouseEvent) => void;
|
|
87
85
|
onRowSelectEvent?: 'left' | 'right';
|
|
86
|
+
enableColumnVisibility?: boolean;
|
|
87
|
+
dataType?: 'pagination' | 'infinite';
|
|
88
|
+
enableRowNumbers?: boolean;
|
|
88
89
|
}
|
|
89
90
|
|
|
90
|
-
export declare type DataTableRow<T> = {
|
|
91
|
-
__key?: string | number;
|
|
92
|
-
__raw: T;
|
|
93
|
-
id?: string | number;
|
|
94
|
-
cells: Record<string, default_2.ReactNode>;
|
|
95
|
-
};
|
|
96
|
-
|
|
97
91
|
export declare type DateTimeVariant = 'date' | 'time' | 'dateTime' | 'full' | 'relative' | 'short';
|
|
98
92
|
|
|
99
93
|
export declare const deletePreset: (pageKey: string, id: string) => void;
|
|
@@ -417,11 +411,16 @@ export declare const saveOrder: (pageKey: string, filters: string[]) => void;
|
|
|
417
411
|
|
|
418
412
|
export declare const savePresets: (pageKey: string, items: PresetItem[]) => void;
|
|
419
413
|
|
|
420
|
-
export declare const
|
|
414
|
+
export declare const SERIAL_NUMBER_COLUMN_ID: "__serial_number__";
|
|
415
|
+
|
|
416
|
+
declare interface SerialNumberColumn extends BaseColumn {
|
|
417
|
+
type: 'serial_number';
|
|
418
|
+
id: typeof SERIAL_NUMBER_COLUMN_ID;
|
|
419
|
+
}
|
|
421
420
|
|
|
422
421
|
export declare function setColumnWidth(columnId: string, width: number): void;
|
|
423
422
|
|
|
424
|
-
export declare function setData(newData: any[], headers?: Column[]): void;
|
|
423
|
+
export declare function setData(newData: any[], headers?: Column<any>[], enableColumnVisibility?: boolean): void;
|
|
425
424
|
|
|
426
425
|
export declare function setTableId(tableId: string): void;
|
|
427
426
|
|
|
@@ -429,6 +428,12 @@ declare type SlotProps = {
|
|
|
429
428
|
children: ReactNode;
|
|
430
429
|
};
|
|
431
430
|
|
|
431
|
+
declare type SortAccessor<T> = (row: T) => unknown;
|
|
432
|
+
|
|
433
|
+
declare type SortComparator<T> = (a: T, b: T, direction: Exclude<SortDirection, null>) => number;
|
|
434
|
+
|
|
435
|
+
declare type SortDirection = 'asc' | 'desc' | null;
|
|
436
|
+
|
|
432
437
|
export declare type SortOrder = 'asc' | 'desc';
|
|
433
438
|
|
|
434
439
|
export declare function StackedDateTime({ value, dateVariant, timeVariant, dateFormat, timeFormat, align, dateColor, dateFontSize, dateFontWeight, timeColor, timeFontSize, timeFontWeight, showTime, }: StackedDateTimeProps): JSX_2.Element;
|
|
@@ -452,19 +457,18 @@ declare interface StackedDateTimeProps {
|
|
|
452
457
|
declare interface TableState {
|
|
453
458
|
tableId: string;
|
|
454
459
|
sortColumn: string | null;
|
|
455
|
-
sortDirection: 'asc' | 'desc';
|
|
460
|
+
sortDirection: 'asc' | 'desc' | null;
|
|
456
461
|
visibility: Record<string, boolean>;
|
|
457
462
|
columnWidths: Record<string, number>;
|
|
458
|
-
columnOrder: Column[];
|
|
463
|
+
columnOrder: Column<any>[];
|
|
459
464
|
data: any[];
|
|
460
465
|
sortableColumns: {
|
|
461
466
|
id: string;
|
|
462
467
|
label: string | default_2.ReactNode;
|
|
463
468
|
sortable: boolean;
|
|
464
|
-
backgroundColor?: string;
|
|
465
469
|
minWidth?: number | string;
|
|
466
470
|
}[];
|
|
467
|
-
|
|
471
|
+
enableColumnVisibility: boolean;
|
|
468
472
|
}
|
|
469
473
|
|
|
470
474
|
export declare const tableStore: Store<TableState, (cb: TableState) => TableState>;
|
|
@@ -512,6 +516,13 @@ declare interface UsePaginationResult {
|
|
|
512
516
|
|
|
513
517
|
export declare type ValueType = 'string' | 'number' | 'boolean' | 'array' | 'object';
|
|
514
518
|
|
|
519
|
+
export declare const VISIBILITY_COLUMN_ID: "__visibility__";
|
|
520
|
+
|
|
521
|
+
declare interface VisibilityColumn extends BaseColumn {
|
|
522
|
+
type: 'visibility';
|
|
523
|
+
id: typeof VISIBILITY_COLUMN_ID;
|
|
524
|
+
}
|
|
525
|
+
|
|
515
526
|
/**
|
|
516
527
|
* Chakra v3 / Ark UI slot components do NOT expose `children` in their typings.
|
|
517
528
|
* This wrapper intentionally loosens typing to make them library-safe.
|