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