@nar-bus/lena-ui-shared 1.3.3 → 1.3.4
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.d.ts +65 -3
- package/dist/index.js +3814 -3750
- package/dist/index.js.map +1 -1
- package/dist/theme.css +1 -3
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -26,6 +26,7 @@ import { NamedExoticComponent } from 'react';
|
|
|
26
26
|
import { Panel } from 'react-resizable-panels';
|
|
27
27
|
import * as PopoverPrimitive from '@radix-ui/react-popover';
|
|
28
28
|
import * as ProgressPrimitive from '@radix-ui/react-progress';
|
|
29
|
+
import { QueryKey } from '@tanstack/react-query';
|
|
29
30
|
import * as RadioGroupPrimitive from '@radix-ui/react-radio-group';
|
|
30
31
|
import * as React_2 from 'react';
|
|
31
32
|
import { ReactNode } from 'react';
|
|
@@ -667,7 +668,7 @@ export declare function createEmptyFilter(field: string, operator?: FilterState[
|
|
|
667
668
|
|
|
668
669
|
export declare function CRUDTabContent<T extends {
|
|
669
670
|
id: number;
|
|
670
|
-
}>({ isActive, columns, fieldConfig, defaultSortBy, getRowId, allQueryKey, useSearchHook, deleteItem, isDeleting, detailPath, searchPlaceholder, emptyTitle, emptyDescription, entityType, getEntityName, viewLabel: viewLabelProp, deleteLabel: deleteLabelProp, refreshLabel: refreshLabelProp, createLabel: createLabelProp, CreateSheetComponent, hideToolbar, externalCreateSheetOpen, onExternalCreateSheetOpenChange, }: CRUDTabContentProps<T>): JSX.Element;
|
|
671
|
+
}>({ isActive, columns, fieldConfig, defaultSortBy, getRowId, allQueryKey, detailKey, listKey, fetchDetail, fetchList, useSearchHook, deleteItem, isDeleting, detailPath, searchPlaceholder, emptyTitle, emptyDescription, entityType, getEntityName, viewLabel: viewLabelProp, deleteLabel: deleteLabelProp, refreshLabel: refreshLabelProp, createLabel: createLabelProp, CreateSheetComponent, hideToolbar, externalCreateSheetOpen, onExternalCreateSheetOpenChange, }: CRUDTabContentProps<T>): JSX.Element;
|
|
671
672
|
|
|
672
673
|
export declare interface CRUDTabContentProps<T extends {
|
|
673
674
|
id: number;
|
|
@@ -684,6 +685,14 @@ export declare interface CRUDTabContentProps<T extends {
|
|
|
684
685
|
getRowId?: (row: T) => string;
|
|
685
686
|
/** Query key for invalidation */
|
|
686
687
|
allQueryKey: readonly string[];
|
|
688
|
+
/** Detail query key factory */
|
|
689
|
+
detailKey: (id: number) => readonly unknown[];
|
|
690
|
+
/** List query key factory */
|
|
691
|
+
listKey: (params: SearchRequest) => readonly unknown[];
|
|
692
|
+
/** Fetch detail function for prefetch */
|
|
693
|
+
fetchDetail: (id: number) => Promise<T>;
|
|
694
|
+
/** Fetch list function for prefetch */
|
|
695
|
+
fetchList: (params: SearchRequest) => Promise<PagedResponse<T>>;
|
|
687
696
|
/** Search hook factory */
|
|
688
697
|
useSearchHook: (params: SearchRequest, enabled: boolean) => {
|
|
689
698
|
data: PagedResponse<T> | undefined;
|
|
@@ -741,7 +750,7 @@ export declare interface DataRowProps {
|
|
|
741
750
|
size?: 'sm' | 'md';
|
|
742
751
|
}
|
|
743
752
|
|
|
744
|
-
export declare function DataTable<TData>({ columns, getRowId, data, isLoading, error, pagination, onPageChange, onPageSizeChange, pageSizeOptions, sortBy, sortDirection, onSortChange, searchValue, onSearchChange, searchPlaceholder, searchDebounceMs, fieldConfig, filters, onFiltersChange, enableRowSelection, rowSelection, onRowSelectionChange, bulkActions, rowActions, toolbarStart, toolbarEnd, className, toolbarVariant, emptyIcon, emptyTitle, emptyDescription, onRowClick, rowClassName, meta, headerColor, }: DataTableComponentProps<TData>): JSX.Element;
|
|
753
|
+
export declare function DataTable<TData>({ columns, getRowId, data, isLoading, error, pagination, onPageChange, onPageSizeChange, onPrefetchPage, pageSizeOptions, sortBy, sortDirection, onSortChange, searchValue, onSearchChange, searchPlaceholder, searchDebounceMs, fieldConfig, filters, onFiltersChange, enableRowSelection, rowSelection, onRowSelectionChange, bulkActions, rowActions, toolbarStart, toolbarEnd, className, toolbarVariant, emptyIcon, emptyTitle, emptyDescription, onRowClick, onRowHover, rowClassName, meta, headerColor, }: DataTableComponentProps<TData>): JSX.Element;
|
|
745
754
|
|
|
746
755
|
declare interface DataTableActions {
|
|
747
756
|
setGeneralSearch: (value: string) => void;
|
|
@@ -790,6 +799,7 @@ declare interface DataTableComponentProps<TData> {
|
|
|
790
799
|
pagination: PaginationInfo;
|
|
791
800
|
onPageChange: (page: number) => void;
|
|
792
801
|
onPageSizeChange: (size: number) => void;
|
|
802
|
+
onPrefetchPage?: (page: number) => void;
|
|
793
803
|
pageSizeOptions?: number[];
|
|
794
804
|
sortBy: string;
|
|
795
805
|
sortDirection: 'ASC' | 'DESC';
|
|
@@ -815,6 +825,7 @@ declare interface DataTableComponentProps<TData> {
|
|
|
815
825
|
emptyTitle?: string;
|
|
816
826
|
emptyDescription?: string;
|
|
817
827
|
onRowClick?: (row: TData) => void;
|
|
828
|
+
onRowHover?: (row: TData) => void;
|
|
818
829
|
rowClassName?: (row: TData) => string;
|
|
819
830
|
meta?: Record<string, unknown>;
|
|
820
831
|
/** Custom header color (CSS color value). Overrides --table-header variable */
|
|
@@ -1376,6 +1387,16 @@ export declare function formatDate(timestamp: DateInput_3): string;
|
|
|
1376
1387
|
*/
|
|
1377
1388
|
export declare function formatDateTime(timestamp: DateInput_3): string;
|
|
1378
1389
|
|
|
1390
|
+
/**
|
|
1391
|
+
* Format a timestamp to compact date with time (e.g., "27.03.26 15:30")
|
|
1392
|
+
*/
|
|
1393
|
+
export declare function formatDateTimeCompact(timestamp: DateInput_3): string;
|
|
1394
|
+
|
|
1395
|
+
/**
|
|
1396
|
+
* Format a timestamp to compact date with time and seconds (e.g., "27.03.26 15:30:45")
|
|
1397
|
+
*/
|
|
1398
|
+
export declare function formatDateTimeCompactFull(timestamp: DateInput_3): string;
|
|
1399
|
+
|
|
1379
1400
|
/**
|
|
1380
1401
|
* Format a timestamp to full date with seconds (e.g., "Jan 1, 2024 14:30:45")
|
|
1381
1402
|
*/
|
|
@@ -2623,7 +2644,7 @@ export declare function Table({ className, ...props }: React_2.ComponentProps<"t
|
|
|
2623
2644
|
|
|
2624
2645
|
export declare const TABLE_CELL_CLASSES = "px-2.5 py-1.5 text-xs";
|
|
2625
2646
|
|
|
2626
|
-
export declare const TABLE_CONTAINER_CLASSES = "
|
|
2647
|
+
export declare const TABLE_CONTAINER_CLASSES = "rounded-lg border border-border/80 bg-card overflow-hidden shadow-sm";
|
|
2627
2648
|
|
|
2628
2649
|
export declare const TABLE_HEADER_CLASSES = "px-2 py-0.5 text-xs font-semibold uppercase tracking-wider transition-colors";
|
|
2629
2650
|
|
|
@@ -3152,6 +3173,47 @@ export declare function useOptimisticPageResponse<T extends {
|
|
|
3152
3173
|
deleteItem: (id: number | string) => void;
|
|
3153
3174
|
};
|
|
3154
3175
|
|
|
3176
|
+
/**
|
|
3177
|
+
* Hook for prefetching list and detail data on hover.
|
|
3178
|
+
* Improves perceived performance by loading data before user navigates.
|
|
3179
|
+
*
|
|
3180
|
+
* @example
|
|
3181
|
+
* ```tsx
|
|
3182
|
+
* const { prefetchDetail, prefetchPage } = usePrefetch({
|
|
3183
|
+
* detailKey: simCardKeys.detail,
|
|
3184
|
+
* listKey: simCardKeys.list,
|
|
3185
|
+
* fetchDetail: getSimCard,
|
|
3186
|
+
* fetchList: searchSimCards,
|
|
3187
|
+
* searchParams: table.searchRequest,
|
|
3188
|
+
* });
|
|
3189
|
+
*
|
|
3190
|
+
* <DataTable
|
|
3191
|
+
* onRowHover={(row) => prefetchDetail(row.id)}
|
|
3192
|
+
* onPrefetchPage={prefetchPage}
|
|
3193
|
+
* />
|
|
3194
|
+
* ```
|
|
3195
|
+
*/
|
|
3196
|
+
export declare function usePrefetch<TData>({ detailKey, listKey, fetchDetail, fetchList, searchParams, staleTime, }: UsePrefetchOptions<TData>): {
|
|
3197
|
+
prefetchDetail: (id: number) => void;
|
|
3198
|
+
prefetchPage: (page: number) => void;
|
|
3199
|
+
clearPrefetchCache: () => void;
|
|
3200
|
+
};
|
|
3201
|
+
|
|
3202
|
+
declare interface UsePrefetchOptions<TData> {
|
|
3203
|
+
/** Query key factory for detail queries */
|
|
3204
|
+
detailKey: (id: number) => QueryKey;
|
|
3205
|
+
/** Query key factory for list queries */
|
|
3206
|
+
listKey: (params: SearchRequest) => QueryKey;
|
|
3207
|
+
/** Function to fetch detail data */
|
|
3208
|
+
fetchDetail?: (id: number) => Promise<TData>;
|
|
3209
|
+
/** Function to fetch list data */
|
|
3210
|
+
fetchList?: (params: SearchRequest) => Promise<unknown>;
|
|
3211
|
+
/** Current search params (for pagination prefetch) */
|
|
3212
|
+
searchParams?: SearchRequest;
|
|
3213
|
+
/** Stale time for prefetched data (default: 30s) */
|
|
3214
|
+
staleTime?: number;
|
|
3215
|
+
}
|
|
3216
|
+
|
|
3155
3217
|
/**
|
|
3156
3218
|
* useTabUrlSync — Synchronizes active tab state with URL search params.
|
|
3157
3219
|
*
|