@wakastellar/ui 0.1.8 → 0.1.11
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/blocks/index.d.ts +2 -0
- package/dist/blocks/sidebar/index.d.ts +149 -0
- package/dist/components/DataTable/DataTable.d.ts +1 -1
- package/dist/components/DataTable/DataTableAdvanced.d.ts +1 -1
- package/dist/components/DataTable/DataTableBody.d.ts +68 -0
- package/dist/components/DataTable/DataTableCell.d.ts +34 -0
- package/dist/components/DataTable/DataTableConflictResolver.d.ts +45 -0
- package/dist/components/DataTable/DataTableFilterBuilder.d.ts +14 -0
- package/dist/components/DataTable/DataTableFilters.d.ts +3 -3
- package/dist/components/DataTable/DataTableHeader.d.ts +48 -0
- package/dist/components/DataTable/DataTableSelection.d.ts +17 -12
- package/dist/components/DataTable/DataTableSyncStatus.d.ts +31 -0
- package/dist/components/DataTable/formatters/index.d.ts +127 -0
- package/dist/components/DataTable/hooks/useDataTable.d.ts +1 -1
- package/dist/components/DataTable/hooks/useDataTableAdvanced.d.ts +1 -1
- package/dist/components/DataTable/hooks/useDataTableAdvancedFilters.d.ts +18 -0
- package/dist/components/DataTable/hooks/useDataTableColumnTemplates.d.ts +28 -0
- package/dist/components/DataTable/hooks/useDataTableExport.d.ts +7 -3
- package/dist/components/DataTable/hooks/useDataTableImport.d.ts +4 -2
- package/dist/components/DataTable/hooks/useDataTableOffline.d.ts +80 -0
- package/dist/components/DataTable/hooks/useDataTableVirtualization.d.ts +1 -1
- package/dist/components/DataTable/index.d.ts +48 -2
- package/dist/components/DataTable/services/IndexedDBService.d.ts +117 -0
- package/dist/components/DataTable/templates/index.d.ts +104 -0
- package/dist/components/DataTable/types.d.ts +417 -25
- package/dist/components/command/index.d.ts +1 -1
- package/dist/components/error-boundary/ErrorBoundary.d.ts +102 -0
- package/dist/components/error-boundary/index.d.ts +2 -0
- package/dist/components/index.d.ts +6 -0
- package/dist/components/typography/index.d.ts +1 -1
- package/dist/components/waka-autocomplete/index.d.ts +59 -0
- package/dist/components/waka-charts/WakaAreaChart.d.ts +12 -0
- package/dist/components/waka-charts/WakaBarChart.d.ts +12 -0
- package/dist/components/waka-charts/WakaChart.d.ts +17 -0
- package/dist/components/waka-charts/WakaLineChart.d.ts +12 -0
- package/dist/components/waka-charts/WakaMiniChart.d.ts +13 -0
- package/dist/components/waka-charts/WakaPieChart.d.ts +12 -0
- package/dist/components/waka-charts/WakaSparkline.d.ts +13 -0
- package/dist/components/waka-charts/dataTableHelpers.d.ts +34 -0
- package/dist/components/waka-charts/hooks/useChartTheme.d.ts +23 -0
- package/dist/components/waka-charts/hooks/useRechartsLoader.d.ts +161 -0
- package/dist/components/waka-charts/index.d.ts +57 -0
- package/dist/components/waka-charts/types.d.ts +298 -0
- package/dist/components/waka-color-picker/index.d.ts +40 -0
- package/dist/components/waka-file-upload/index.d.ts +49 -0
- package/dist/components/waka-rich-text-editor/index.d.ts +36 -0
- package/dist/context/admincrumb-context.d.ts +118 -1
- package/dist/context/language-context.d.ts +160 -22
- package/dist/context/theme-provider.d.ts +39 -1
- package/dist/context/waka-provider.d.ts +50 -7
- package/dist/hooks/use-toast.d.ts +116 -0
- package/dist/hooks/use-translation.d.ts +24 -1
- package/dist/hooks/useToast.d.ts +82 -0
- package/dist/index.cjs.js +32 -26
- package/dist/index.d.ts +9 -3
- package/dist/index.es.js +11352 -5729
- package/dist/types/provider.d.ts +30 -0
- package/dist/ui.css +1 -1
- package/dist/utils/cn.d.ts +15 -1
- package/dist/utils/datetime-helpers.d.ts +241 -33
- package/dist/utils/error-handling.d.ts +190 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/logger.d.ts +4 -4
- package/dist/utils/theme-loader.d.ts +140 -30
- package/dist/utils/tweak.d.ts +14 -1
- package/package.json +63 -52
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { ColumnTemplatesConfig, ColumnTemplatesResult } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Hook pour créer des colonnes DataTable à partir de templates prédéfinis
|
|
4
|
+
*
|
|
5
|
+
* @template TData - Type des données de la table
|
|
6
|
+
* @param config - Configuration des templates (locale, currency, etc.)
|
|
7
|
+
* @returns Fonctions pour créer des colonnes et accéder aux formatters
|
|
8
|
+
*
|
|
9
|
+
* @example
|
|
10
|
+
* ```tsx
|
|
11
|
+
* const { createColumns, getFormatter } = useDataTableColumnTemplates({
|
|
12
|
+
* locale: 'fr-FR',
|
|
13
|
+
* currency: 'EUR',
|
|
14
|
+
* })
|
|
15
|
+
*
|
|
16
|
+
* const columns = createColumns<User>([
|
|
17
|
+
* { accessorKey: 'email', template: 'email' },
|
|
18
|
+
* { accessorKey: 'salary', template: 'currency' },
|
|
19
|
+
* { accessorKey: 'status', template: 'status', options: {
|
|
20
|
+
* templateOptions: {
|
|
21
|
+
* statusColors: { active: 'bg-green-100 text-green-800' }
|
|
22
|
+
* }
|
|
23
|
+
* }},
|
|
24
|
+
* ])
|
|
25
|
+
* ```
|
|
26
|
+
*/
|
|
27
|
+
export declare function useDataTableColumnTemplates<TData extends Record<string, unknown>>(config?: ColumnTemplatesConfig): ColumnTemplatesResult<TData>;
|
|
28
|
+
export default useDataTableColumnTemplates;
|
|
@@ -1,11 +1,15 @@
|
|
|
1
|
+
import { ColumnDef } from '@tanstack/react-table';
|
|
1
2
|
import { ExportConfig } from '../types';
|
|
3
|
+
import { WakaError } from '../../../utils/error-handling';
|
|
2
4
|
/**
|
|
3
5
|
* Hook pour gérer l'export des données du DataTable
|
|
6
|
+
* @template TData - Type des données de la table
|
|
4
7
|
*/
|
|
5
|
-
export declare function useDataTableExport<TData
|
|
8
|
+
export declare function useDataTableExport<TData extends Record<string, unknown>>({ data, columns, exportConfig, onError, }: {
|
|
6
9
|
data: TData[];
|
|
7
|
-
columns:
|
|
8
|
-
exportConfig?: ExportConfig
|
|
10
|
+
columns: ColumnDef<TData, unknown>[];
|
|
11
|
+
exportConfig?: ExportConfig<TData>;
|
|
12
|
+
onError?: (error: WakaError) => void;
|
|
9
13
|
}): {
|
|
10
14
|
exportData: (format: string, customData?: TData[], customFilename?: string) => Promise<void>;
|
|
11
15
|
exportAll: (format: string) => Promise<void>;
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { ImportConfig } from '../types';
|
|
2
|
+
import { WakaError } from '../../../utils/error-handling';
|
|
2
3
|
/**
|
|
3
4
|
* Hook pour gérer l'import des données dans le DataTable
|
|
4
5
|
*/
|
|
5
|
-
export declare function useDataTableImport<TData>({ importConfig, }: {
|
|
6
|
-
importConfig?: ImportConfig
|
|
6
|
+
export declare function useDataTableImport<TData>({ importConfig, onError, }: {
|
|
7
|
+
importConfig?: ImportConfig<TData>;
|
|
8
|
+
onError?: (error: WakaError) => void;
|
|
7
9
|
}): {
|
|
8
10
|
importData: (file: File) => Promise<TData[]>;
|
|
9
11
|
importWithUI: () => Promise<TData[]>;
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { SyncQueueItem, ConflictEntry } from '../services/IndexedDBService';
|
|
2
|
+
export type ConflictResolution = "client-wins" | "server-wins" | "latest-wins" | "manual";
|
|
3
|
+
export interface SyncResult<TData> {
|
|
4
|
+
id: string;
|
|
5
|
+
success: boolean;
|
|
6
|
+
data?: Partial<TData>;
|
|
7
|
+
error?: string;
|
|
8
|
+
serverData?: Partial<TData>;
|
|
9
|
+
serverTimestamp?: Date;
|
|
10
|
+
}
|
|
11
|
+
export interface OfflineConfig<TData> {
|
|
12
|
+
/** ID unique de la table pour le stockage */
|
|
13
|
+
tableId: string;
|
|
14
|
+
/** Activer le mode offline */
|
|
15
|
+
enabled?: boolean;
|
|
16
|
+
/** Stratégie de résolution des conflits */
|
|
17
|
+
conflictResolution?: ConflictResolution;
|
|
18
|
+
/** Callback de synchronisation vers le serveur */
|
|
19
|
+
onSync?: (changes: SyncQueueItem<TData>[]) => Promise<SyncResult<TData>[]>;
|
|
20
|
+
/** Intervalle de synchronisation automatique (ms) */
|
|
21
|
+
autoSyncInterval?: number;
|
|
22
|
+
/** Taille max du cache (nombre d'entrées) */
|
|
23
|
+
maxCacheSize?: number;
|
|
24
|
+
/** Durée d'expiration du cache (ms) */
|
|
25
|
+
cacheExpiration?: number;
|
|
26
|
+
/** Callback quand le statut online change */
|
|
27
|
+
onOnlineStatusChange?: (isOnline: boolean) => void;
|
|
28
|
+
/** Callback après synchronisation */
|
|
29
|
+
onSyncComplete?: (results: SyncResult<TData>[]) => void;
|
|
30
|
+
/** Callback sur conflit */
|
|
31
|
+
onConflict?: (conflict: ConflictEntry<TData>) => void;
|
|
32
|
+
}
|
|
33
|
+
export interface OfflineState<TData> {
|
|
34
|
+
/** Connexion internet disponible */
|
|
35
|
+
isOnline: boolean;
|
|
36
|
+
/** Synchronisation en cours */
|
|
37
|
+
isSyncing: boolean;
|
|
38
|
+
/** Nombre de changements en attente */
|
|
39
|
+
pendingChangesCount: number;
|
|
40
|
+
/** Données en cache */
|
|
41
|
+
cachedData: TData[] | null;
|
|
42
|
+
/** Timestamp du dernier cache */
|
|
43
|
+
lastCacheUpdate: Date | null;
|
|
44
|
+
/** Conflits à résoudre */
|
|
45
|
+
conflicts: ConflictEntry<TData>[];
|
|
46
|
+
/** Erreur de synchronisation */
|
|
47
|
+
syncError: string | null;
|
|
48
|
+
/** Dernière synchronisation réussie */
|
|
49
|
+
lastSyncTime: Date | null;
|
|
50
|
+
/** IndexedDB disponible */
|
|
51
|
+
isAvailable: boolean;
|
|
52
|
+
}
|
|
53
|
+
export interface OfflineActions<TData> {
|
|
54
|
+
/** Cache les données */
|
|
55
|
+
cacheData: (data: TData[]) => Promise<void>;
|
|
56
|
+
/** Ajoute un changement à la queue */
|
|
57
|
+
queueChange: (change: {
|
|
58
|
+
rowId: string;
|
|
59
|
+
type: SyncQueueItem<TData>["type"];
|
|
60
|
+
data: Partial<TData> | null;
|
|
61
|
+
}) => Promise<void>;
|
|
62
|
+
/** Lance la synchronisation */
|
|
63
|
+
sync: () => Promise<void>;
|
|
64
|
+
/** Résout un conflit */
|
|
65
|
+
resolveConflict: (conflictId: string, resolution: "local" | "server" | "merge", mergedData?: Partial<TData>) => Promise<void>;
|
|
66
|
+
/** Récupère les données du cache */
|
|
67
|
+
loadFromCache: () => Promise<TData[] | null>;
|
|
68
|
+
/** Vide le cache */
|
|
69
|
+
clearCache: () => Promise<void>;
|
|
70
|
+
/** Vide la queue de synchronisation */
|
|
71
|
+
clearQueue: () => Promise<void>;
|
|
72
|
+
/** Force le rafraîchissement de l'état */
|
|
73
|
+
refresh: () => Promise<void>;
|
|
74
|
+
}
|
|
75
|
+
export type UseDataTableOfflineResult<TData> = [OfflineState<TData>, OfflineActions<TData>];
|
|
76
|
+
/**
|
|
77
|
+
* Hook pour gérer le mode offline du DataTable
|
|
78
|
+
*/
|
|
79
|
+
export declare function useDataTableOffline<TData extends Record<string, unknown>>(config: OfflineConfig<TData>): UseDataTableOfflineResult<TData>;
|
|
80
|
+
export default useDataTableOffline;
|
|
@@ -2,7 +2,7 @@ import { VirtualizationConfig } from '../types';
|
|
|
2
2
|
/**
|
|
3
3
|
* Hook pour gérer la virtualisation du DataTable
|
|
4
4
|
*/
|
|
5
|
-
export declare function useDataTableVirtualization<TData
|
|
5
|
+
export declare function useDataTableVirtualization<TData extends Record<string, unknown>>({ data, virtualization, containerRef, }: {
|
|
6
6
|
data: TData[];
|
|
7
7
|
virtualization?: VirtualizationConfig;
|
|
8
8
|
containerRef: React.RefObject<HTMLElement>;
|
|
@@ -6,13 +6,38 @@
|
|
|
6
6
|
* Composant de table de données hautement configurable avec support de :
|
|
7
7
|
* - Tri, filtrage, pagination
|
|
8
8
|
* - Sélection multiple
|
|
9
|
-
* - Export/Import (CSV, JSON)
|
|
9
|
+
* - Export/Import (CSV, JSON, XLSX)
|
|
10
10
|
* - Layouts multiples (standard, card, compact, split, infinite)
|
|
11
11
|
* - Thème clair/sombre via TweakCN
|
|
12
12
|
* - i18n complet
|
|
13
13
|
* - Virtualisation pour grandes données
|
|
14
14
|
* - Toolbar customisable
|
|
15
15
|
* - Actions par ligne et groupées
|
|
16
|
+
* - Édition inline
|
|
17
|
+
* - Groupement avec agrégations
|
|
18
|
+
* - Redimensionnement des colonnes
|
|
19
|
+
*
|
|
20
|
+
* @example
|
|
21
|
+
* ```tsx
|
|
22
|
+
* import {
|
|
23
|
+
* DataTableAdvanced,
|
|
24
|
+
* useDataTableAdvanced,
|
|
25
|
+
* type DataTableProps,
|
|
26
|
+
* type ColumnDef
|
|
27
|
+
* } from '@wakastellar/ui'
|
|
28
|
+
*
|
|
29
|
+
* const columns: ColumnDef<User>[] = [
|
|
30
|
+
* { accessorKey: 'name', header: 'Name' },
|
|
31
|
+
* { accessorKey: 'email', header: 'Email' },
|
|
32
|
+
* ]
|
|
33
|
+
*
|
|
34
|
+
* <DataTableAdvanced
|
|
35
|
+
* data={users}
|
|
36
|
+
* columns={columns}
|
|
37
|
+
* selection="multiple"
|
|
38
|
+
* enableExport={{ formats: ['csv', 'xlsx'] }}
|
|
39
|
+
* />
|
|
40
|
+
* ```
|
|
16
41
|
*/
|
|
17
42
|
export { DataTable } from './DataTable';
|
|
18
43
|
export { DataTableAdvanced } from './DataTableAdvanced';
|
|
@@ -24,6 +49,14 @@ export { DataTableColumnResizer } from './DataTableColumnResizer';
|
|
|
24
49
|
export { DataTableGrouping, DataTableGroupTotals, DataTableGroupingControls } from './DataTableGrouping';
|
|
25
50
|
export { DataTableContextMenu } from './DataTableContextMenu';
|
|
26
51
|
export { DataTableSelection, useDataTableSelection } from './DataTableSelection';
|
|
52
|
+
export { DataTableCell } from './DataTableCell';
|
|
53
|
+
export type { DataTableCellProps } from './DataTableCell';
|
|
54
|
+
export { DataTableHeader, DataTableHeaderRow } from './DataTableHeader';
|
|
55
|
+
export type { DataTableHeaderProps } from './DataTableHeader';
|
|
56
|
+
export { DataTableBody, DataTableBodyRow } from './DataTableBody';
|
|
57
|
+
export type { DataTableBodyProps } from './DataTableBody';
|
|
58
|
+
export { DataTableRow } from './DataTableRow';
|
|
59
|
+
export { DataTableGroupRow } from './DataTableGroupRow';
|
|
27
60
|
export { useDataTable } from './hooks/useDataTable';
|
|
28
61
|
export { useDataTableAdvanced } from './hooks/useDataTableAdvanced';
|
|
29
62
|
export { useDataTableVirtualization } from './hooks/useDataTableVirtualization';
|
|
@@ -32,6 +65,19 @@ export { useDataTableImport } from './hooks/useDataTableImport';
|
|
|
32
65
|
export { useDataTableTheme } from './hooks/useDataTableTheme';
|
|
33
66
|
export { useTableLayout } from './hooks/useTableLayout';
|
|
34
67
|
export { useDataTableEdit } from './hooks/useDataTableEdit';
|
|
35
|
-
export
|
|
68
|
+
export { useDataTableColumnTemplates } from './hooks/useDataTableColumnTemplates';
|
|
69
|
+
export { useDataTableAdvancedFilters, OPERATORS_BY_TYPE, OPERATOR_LABELS } from './hooks/useDataTableAdvancedFilters';
|
|
70
|
+
export { useDataTableOffline } from './hooks/useDataTableOffline';
|
|
71
|
+
export type { OfflineConfig, OfflineState, OfflineActions, SyncResult, ConflictResolution, UseDataTableOfflineResult, } from './hooks/useDataTableOffline';
|
|
72
|
+
export { DataTableFilterBuilder } from './DataTableFilterBuilder';
|
|
73
|
+
export { DataTableSyncStatus } from './DataTableSyncStatus';
|
|
74
|
+
export type { DataTableSyncStatusProps } from './DataTableSyncStatus';
|
|
75
|
+
export { DataTableConflictResolver } from './DataTableConflictResolver';
|
|
76
|
+
export type { DataTableConflictResolverProps } from './DataTableConflictResolver';
|
|
77
|
+
export { IndexedDBService, getIndexedDBService } from './services/IndexedDBService';
|
|
78
|
+
export type { CacheEntry, SyncQueueItem, ConflictEntry, } from './services/IndexedDBService';
|
|
79
|
+
export { formatters } from './formatters';
|
|
80
|
+
export { templatesMap, getTemplate, availableTemplateNames, createActionsTemplate, dateTemplate, datetimeTemplate, timeTemplate, currencyTemplate, percentageTemplate, numberTemplate, statusTemplate, badgeTemplate, emailTemplate, phoneTemplate, urlTemplate, avatarTemplate, booleanTemplate, actionsTemplate, indexTemplate, idTemplate, ratingTemplate, progressTemplate, tagsTemplate, jsonTemplate, textTemplate, } from './templates';
|
|
81
|
+
export type { DataTableProps, DataTableLayout, DataTableVariant, DataTableDensity, DataTableState, FilterConfig, FilterPosition, FilterValue, PaginationConfig, ToolbarConfig, TableAction, ExportConfig, ImportConfig, SelectionState, EditConfig, ColumnEditConfig, EditableCellValue, SelectionMode, SortMode, VirtualizationType, GroupingConfig, VirtualizationConfig, ColumnResizeConfig, ColumnOrderConfig, RowExpansionConfig, DataTableTheme, RangeValue, DateRangeValue, AggregatedValue, ExportableCellValue, ImportedRowData, TypographyConfig, ColumnTemplateName, FormatterType, ColumnTemplateAction, ColumnTemplateOptions, ColumnTemplateDefinition, ColumnTemplate, ColumnTemplatesConfig, ColumnTemplatesResult, FilterOperator, FilterColumnType, FilterRule, FilterGroup, FilterPreset, FilterableColumn, AdvancedFiltersConfig, AdvancedFiltersState, AdvancedFiltersActions, AdvancedFiltersResult, } from './types';
|
|
36
82
|
export type { EditCellConfig } from './DataTableEditCell';
|
|
37
83
|
export { exportToCSV, exportToJSON, parseCSV, saveTableState, loadTableState, } from './utils';
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Service IndexedDB pour le mode offline du DataTable
|
|
3
|
+
* Gère le cache des données, la queue de synchronisation et les conflits
|
|
4
|
+
*/
|
|
5
|
+
export interface CacheEntry<TData> {
|
|
6
|
+
id: string;
|
|
7
|
+
tableId: string;
|
|
8
|
+
data: TData[];
|
|
9
|
+
timestamp: Date;
|
|
10
|
+
version: number;
|
|
11
|
+
}
|
|
12
|
+
export interface SyncQueueItem<TData> {
|
|
13
|
+
id: string;
|
|
14
|
+
tableId: string;
|
|
15
|
+
rowId: string;
|
|
16
|
+
type: "create" | "update" | "delete";
|
|
17
|
+
data: Partial<TData> | null;
|
|
18
|
+
timestamp: Date;
|
|
19
|
+
attempts: number;
|
|
20
|
+
lastError?: string;
|
|
21
|
+
}
|
|
22
|
+
export interface ConflictEntry<TData> {
|
|
23
|
+
id: string;
|
|
24
|
+
tableId: string;
|
|
25
|
+
rowId: string;
|
|
26
|
+
localData: Partial<TData> | null;
|
|
27
|
+
serverData: Partial<TData> | null;
|
|
28
|
+
localTimestamp: Date;
|
|
29
|
+
serverTimestamp: Date;
|
|
30
|
+
type: "create" | "update" | "delete";
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Service pour gérer IndexedDB
|
|
34
|
+
*/
|
|
35
|
+
export declare class IndexedDBService {
|
|
36
|
+
private db;
|
|
37
|
+
private initPromise;
|
|
38
|
+
/**
|
|
39
|
+
* Initialise la connexion à IndexedDB
|
|
40
|
+
*/
|
|
41
|
+
init(): Promise<void>;
|
|
42
|
+
/**
|
|
43
|
+
* Vérifie si IndexedDB est disponible
|
|
44
|
+
*/
|
|
45
|
+
isAvailable(): boolean;
|
|
46
|
+
/**
|
|
47
|
+
* Ferme la connexion
|
|
48
|
+
*/
|
|
49
|
+
close(): void;
|
|
50
|
+
/**
|
|
51
|
+
* Sauvegarde les données en cache
|
|
52
|
+
*/
|
|
53
|
+
cacheData<TData>(tableId: string, data: TData[], version?: number): Promise<void>;
|
|
54
|
+
/**
|
|
55
|
+
* Récupère les données du cache
|
|
56
|
+
*/
|
|
57
|
+
getCachedData<TData>(tableId: string): Promise<CacheEntry<TData> | null>;
|
|
58
|
+
/**
|
|
59
|
+
* Supprime les données du cache
|
|
60
|
+
*/
|
|
61
|
+
clearCache(tableId: string): Promise<void>;
|
|
62
|
+
/**
|
|
63
|
+
* Supprime les entrées de cache expirées
|
|
64
|
+
*/
|
|
65
|
+
cleanExpiredCache(maxAgeMs: number): Promise<number>;
|
|
66
|
+
/**
|
|
67
|
+
* Ajoute un changement à la queue de synchronisation
|
|
68
|
+
*/
|
|
69
|
+
queueChange<TData>(tableId: string, rowId: string, type: SyncQueueItem<TData>["type"], data: Partial<TData> | null): Promise<string>;
|
|
70
|
+
/**
|
|
71
|
+
* Récupère les changements en attente
|
|
72
|
+
*/
|
|
73
|
+
getPendingChanges<TData>(tableId: string): Promise<SyncQueueItem<TData>[]>;
|
|
74
|
+
/**
|
|
75
|
+
* Compte les changements en attente
|
|
76
|
+
*/
|
|
77
|
+
countPendingChanges(tableId: string): Promise<number>;
|
|
78
|
+
/**
|
|
79
|
+
* Marque un changement comme traité (le supprime)
|
|
80
|
+
*/
|
|
81
|
+
removeFromQueue(id: string): Promise<void>;
|
|
82
|
+
/**
|
|
83
|
+
* Met à jour le nombre de tentatives d'un changement
|
|
84
|
+
*/
|
|
85
|
+
updateAttempts<TData>(id: string, error?: string): Promise<void>;
|
|
86
|
+
/**
|
|
87
|
+
* Vide la queue de synchronisation
|
|
88
|
+
*/
|
|
89
|
+
clearQueue(tableId: string): Promise<void>;
|
|
90
|
+
/**
|
|
91
|
+
* Ajoute un conflit
|
|
92
|
+
*/
|
|
93
|
+
addConflict<TData>(conflict: Omit<ConflictEntry<TData>, "id">): Promise<string>;
|
|
94
|
+
/**
|
|
95
|
+
* Récupère les conflits d'une table
|
|
96
|
+
*/
|
|
97
|
+
getConflicts<TData>(tableId: string): Promise<ConflictEntry<TData>[]>;
|
|
98
|
+
/**
|
|
99
|
+
* Supprime un conflit résolu
|
|
100
|
+
*/
|
|
101
|
+
resolveConflict(id: string): Promise<void>;
|
|
102
|
+
/**
|
|
103
|
+
* Vide tous les conflits d'une table
|
|
104
|
+
*/
|
|
105
|
+
clearConflicts(tableId: string): Promise<void>;
|
|
106
|
+
/**
|
|
107
|
+
* Obtient des statistiques sur la base de données
|
|
108
|
+
*/
|
|
109
|
+
getStats(tableId: string): Promise<{
|
|
110
|
+
cacheSize: number;
|
|
111
|
+
pendingChanges: number;
|
|
112
|
+
conflicts: number;
|
|
113
|
+
lastCacheUpdate: Date | null;
|
|
114
|
+
}>;
|
|
115
|
+
}
|
|
116
|
+
export declare function getIndexedDBService(): IndexedDBService;
|
|
117
|
+
export default IndexedDBService;
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { ColumnTemplate } from '../types';
|
|
2
|
+
/**
|
|
3
|
+
* Template Date
|
|
4
|
+
*/
|
|
5
|
+
export declare const dateTemplate: ColumnTemplate<unknown, unknown>;
|
|
6
|
+
/**
|
|
7
|
+
* Template DateTime
|
|
8
|
+
*/
|
|
9
|
+
export declare const datetimeTemplate: ColumnTemplate<unknown, unknown>;
|
|
10
|
+
/**
|
|
11
|
+
* Template Time
|
|
12
|
+
*/
|
|
13
|
+
export declare const timeTemplate: ColumnTemplate<unknown, unknown>;
|
|
14
|
+
/**
|
|
15
|
+
* Template Currency
|
|
16
|
+
*/
|
|
17
|
+
export declare const currencyTemplate: ColumnTemplate<unknown, unknown>;
|
|
18
|
+
/**
|
|
19
|
+
* Template Percentage
|
|
20
|
+
*/
|
|
21
|
+
export declare const percentageTemplate: ColumnTemplate<unknown, unknown>;
|
|
22
|
+
/**
|
|
23
|
+
* Template Number
|
|
24
|
+
*/
|
|
25
|
+
export declare const numberTemplate: ColumnTemplate<unknown, unknown>;
|
|
26
|
+
/**
|
|
27
|
+
* Template Status/Badge
|
|
28
|
+
*/
|
|
29
|
+
export declare const statusTemplate: ColumnTemplate<unknown, unknown>;
|
|
30
|
+
/**
|
|
31
|
+
* Template Badge (alias de status)
|
|
32
|
+
*/
|
|
33
|
+
export declare const badgeTemplate: ColumnTemplate<unknown, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* Template Email
|
|
36
|
+
*/
|
|
37
|
+
export declare const emailTemplate: ColumnTemplate<unknown, unknown>;
|
|
38
|
+
/**
|
|
39
|
+
* Template Phone
|
|
40
|
+
*/
|
|
41
|
+
export declare const phoneTemplate: ColumnTemplate<unknown, unknown>;
|
|
42
|
+
/**
|
|
43
|
+
* Template URL
|
|
44
|
+
*/
|
|
45
|
+
export declare const urlTemplate: ColumnTemplate<unknown, unknown>;
|
|
46
|
+
/**
|
|
47
|
+
* Template Avatar
|
|
48
|
+
*/
|
|
49
|
+
export declare const avatarTemplate: ColumnTemplate<unknown, unknown>;
|
|
50
|
+
/**
|
|
51
|
+
* Template Boolean
|
|
52
|
+
*/
|
|
53
|
+
export declare const booleanTemplate: ColumnTemplate<unknown, unknown>;
|
|
54
|
+
/**
|
|
55
|
+
* Template Actions
|
|
56
|
+
*/
|
|
57
|
+
export declare function createActionsTemplate<TData>(): ColumnTemplate<TData, unknown>;
|
|
58
|
+
/**
|
|
59
|
+
* Template Actions par défaut
|
|
60
|
+
*/
|
|
61
|
+
export declare const actionsTemplate: ColumnTemplate<unknown, unknown>;
|
|
62
|
+
/**
|
|
63
|
+
* Template Index (numéro de ligne)
|
|
64
|
+
*/
|
|
65
|
+
export declare const indexTemplate: ColumnTemplate<unknown, unknown>;
|
|
66
|
+
/**
|
|
67
|
+
* Template ID
|
|
68
|
+
*/
|
|
69
|
+
export declare const idTemplate: ColumnTemplate<unknown, unknown>;
|
|
70
|
+
/**
|
|
71
|
+
* Template Rating (étoiles)
|
|
72
|
+
*/
|
|
73
|
+
export declare const ratingTemplate: ColumnTemplate<unknown, unknown>;
|
|
74
|
+
/**
|
|
75
|
+
* Template Progress
|
|
76
|
+
*/
|
|
77
|
+
export declare const progressTemplate: ColumnTemplate<unknown, unknown>;
|
|
78
|
+
/**
|
|
79
|
+
* Template Tags
|
|
80
|
+
*/
|
|
81
|
+
export declare const tagsTemplate: ColumnTemplate<unknown, unknown>;
|
|
82
|
+
/**
|
|
83
|
+
* Template JSON
|
|
84
|
+
*/
|
|
85
|
+
export declare const jsonTemplate: ColumnTemplate<unknown, unknown>;
|
|
86
|
+
/**
|
|
87
|
+
* Template Text (par défaut)
|
|
88
|
+
*/
|
|
89
|
+
export declare const textTemplate: ColumnTemplate<unknown, unknown>;
|
|
90
|
+
/**
|
|
91
|
+
* Map des templates par nom
|
|
92
|
+
* Note: Les templates sont typés avec `unknown` pour permettre l'accès dynamique par nom.
|
|
93
|
+
* Le typage précis est assuré lors de l'utilisation via useDataTableColumnTemplates.
|
|
94
|
+
*/
|
|
95
|
+
export declare const templatesMap: Record<string, ColumnTemplate<unknown, unknown>>;
|
|
96
|
+
/**
|
|
97
|
+
* Récupère un template par son nom
|
|
98
|
+
*/
|
|
99
|
+
export declare function getTemplate(name: string): ColumnTemplate<unknown, unknown> | undefined;
|
|
100
|
+
/**
|
|
101
|
+
* Liste des noms de templates disponibles
|
|
102
|
+
*/
|
|
103
|
+
export declare const availableTemplateNames: string[];
|
|
104
|
+
export default templatesMap;
|