ptechcore_ui 1.0.49 → 1.0.51

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.cts CHANGED
@@ -745,6 +745,13 @@ declare const AccountServices: {
745
745
  delete: (id: number) => Promise<unknown>;
746
746
  };
747
747
 
748
+ type BadgeVariant = 'default' | 'success' | 'warning' | 'error' | 'info' | 'purple' | 'blue' | 'green';
749
+ interface BadgeProps {
750
+ children: React$1.ReactNode;
751
+ variant?: BadgeVariant;
752
+ }
753
+ declare const Badge: ({ children, variant }: BadgeProps) => react_jsx_runtime.JSX.Element;
754
+
748
755
  type ImportField = {
749
756
  value: string;
750
757
  label: string;
@@ -772,6 +779,13 @@ type FDrawerLineAction = {
772
779
  navigate?: string;
773
780
  onclick?: (item: any) => any;
774
781
  };
782
+ type ViewMode$1 = 'table' | 'grid';
783
+ type FDrawerToolbarAction = {
784
+ label: string;
785
+ icon?: React$1.ReactNode;
786
+ onClick: () => void;
787
+ variant?: 'full' | 'outline' | 'text';
788
+ };
775
789
  interface FDrawerProps {
776
790
  children?: React$1.ReactNode;
777
791
  apiEndpoint: string;
@@ -784,6 +798,9 @@ interface FDrawerProps {
784
798
  onBulkDelete?: (ids: number[]) => Promise<void>;
785
799
  onDuplicate?: (item: any) => Promise<void>;
786
800
  title?: string;
801
+ gridRenderer?: (item: any) => React$1.ReactNode;
802
+ defaultView?: ViewMode$1;
803
+ toolbarActions?: FDrawerToolbarAction[];
787
804
  }
788
805
  declare const FDrawer: React$1.FC<FDrawerProps>;
789
806
 
@@ -1019,6 +1036,8 @@ interface FileManagerProps {
1019
1036
  onDownload?: (item: FileItem) => void;
1020
1037
  onSelect?: (items: FileItem[]) => void;
1021
1038
  onOpen?: (item: FileItem) => void;
1039
+ /** Callback pour rafraîchir les données */
1040
+ onRefresh?: () => Promise<void>;
1022
1041
  viewMode?: ViewMode;
1023
1042
  allowMultiSelect?: boolean;
1024
1043
  allowUpload?: boolean;
@@ -1045,11 +1064,19 @@ interface FileManagerTexts {
1045
1064
  dropFilesHere?: string;
1046
1065
  cancel?: string;
1047
1066
  confirm?: string;
1067
+ refresh?: string;
1048
1068
  }
1049
1069
  interface ContextMenuPosition {
1050
1070
  x: number;
1051
1071
  y: number;
1052
1072
  }
1073
+ interface ContextMenuAction {
1074
+ label: string;
1075
+ icon?: ReactNode;
1076
+ onClick: () => void;
1077
+ disabled?: boolean;
1078
+ danger?: boolean;
1079
+ }
1053
1080
  interface FileManagerContextValue {
1054
1081
  data: FileItem[];
1055
1082
  currentFolder: FileItem | null;
@@ -1081,6 +1108,7 @@ interface FileManagerContextValue {
1081
1108
  onDelete?: (item: FileItem) => Promise<void>;
1082
1109
  onDownload?: (item: FileItem) => void;
1083
1110
  onOpen?: (item: FileItem) => void;
1111
+ onRefresh?: () => Promise<void>;
1084
1112
  allowUpload: boolean;
1085
1113
  allowCreateFolder: boolean;
1086
1114
  allowRename: boolean;
@@ -1274,6 +1302,124 @@ declare const FileManager: React$1.FC<FileManagerProps>;
1274
1302
  */
1275
1303
  declare const EntityFileManager: React$1.FC<EntityFileManagerProps>;
1276
1304
 
1305
+ /**
1306
+ * RootFileManager - FileManager intégré pour l'arborescence ROOT d'un BusinessEntity.
1307
+ *
1308
+ * Ce composant affiche l'intégralité de l'arborescence GED d'un BusinessEntity,
1309
+ * incluant toutes les catégories (Clients, Fournisseurs, RFQ, etc.) et leurs contenus.
1310
+ *
1311
+ * DIFFÉRENCE AVEC EntityFileManager :
1312
+ * ===================================
1313
+ * - EntityFileManager : Affiche les dossiers d'une entité spécifique (Client, Vendor, etc.)
1314
+ * - RootFileManager : Affiche TOUTE l'arborescence depuis ROOT
1315
+ *
1316
+ * STRUCTURE AFFICHÉE :
1317
+ * ====================
1318
+ * 📁 [Nom du BusinessEntity]
1319
+ * ├── 📁 Clients
1320
+ * │ └── 📁 CLI_Client ABC
1321
+ * │ └── 📁 Contrats, Factures, etc.
1322
+ * ├── 📁 Fournisseurs
1323
+ * │ └── 📁 FRN_Fournisseur XYZ
1324
+ * │ └── ...
1325
+ * ├── 📁 Appels d'offres
1326
+ * │ └── ...
1327
+ * └── 📁 Documents généraux
1328
+ *
1329
+ * EXEMPLE D'UTILISATION :
1330
+ * =======================
1331
+ * ```tsx
1332
+ * <RootFileManager
1333
+ * businessEntityId={entity.id}
1334
+ * height="600px"
1335
+ * allowUpload={true}
1336
+ * allowCreateFolder={true}
1337
+ * />
1338
+ * ```
1339
+ */
1340
+
1341
+ interface RootFileManagerProps {
1342
+ /** ID du BusinessEntity */
1343
+ businessEntityId: number | string;
1344
+ /** Hauteur du composant (CSS) */
1345
+ height?: string;
1346
+ /** Autoriser l'upload de fichiers */
1347
+ allowUpload?: boolean;
1348
+ /** Autoriser la création de dossiers */
1349
+ allowCreateFolder?: boolean;
1350
+ /** Autoriser le renommage */
1351
+ allowRename?: boolean;
1352
+ /** Autoriser la suppression */
1353
+ allowDelete?: boolean;
1354
+ /** Autoriser le téléchargement */
1355
+ allowDownload?: boolean;
1356
+ /** Callback lors de la sélection de fichiers */
1357
+ onFileSelect?: (files: FileItem[]) => void;
1358
+ /** Callback lors de l'ouverture d'un fichier */
1359
+ onFileOpen?: (file: FileItem) => void;
1360
+ /** Callback après upload réussi */
1361
+ onUploadSuccess?: (files: FileItem[]) => void;
1362
+ /** Callback en cas d'erreur */
1363
+ onError?: (error: Error) => void;
1364
+ }
1365
+ declare const RootFileManager: React$1.FC<RootFileManagerProps>;
1366
+
1367
+ /**
1368
+ * AttachmentUploader - Composant simplifié pour attacher des fichiers à un objet
1369
+ *
1370
+ * Utilisation:
1371
+ * ```tsx
1372
+ * // Avec sélection de dossier dynamique (recommandé)
1373
+ * <AttachmentUploader
1374
+ * model="accounting.FundCall"
1375
+ * objectId={fundCall.id}
1376
+ * businessEntityId={businessEntity.id}
1377
+ * linkType="attachment"
1378
+ * onUploadSuccess={(files) => console.log('Uploaded:', files)}
1379
+ * />
1380
+ *
1381
+ * // Avec dossier fixe
1382
+ * <AttachmentUploader
1383
+ * model="accounting.FundCall"
1384
+ * objectId={fundCall.id}
1385
+ * folderCode="FO000123"
1386
+ * linkType="attachment"
1387
+ * />
1388
+ * ```
1389
+ */
1390
+
1391
+ interface AttachmentUploaderProps {
1392
+ /** Chemin du modèle Django (ex: 'accounting.FundCall') */
1393
+ model: string;
1394
+ /** ID de l'objet à lier */
1395
+ objectId: number | string;
1396
+ /** ID du BusinessEntity (pour le sélecteur de dossier dynamique) */
1397
+ businessEntityId?: number | string;
1398
+ /** Code du dossier où uploader (optionnel si businessEntityId est fourni) */
1399
+ folderCode?: string;
1400
+ /** Code du dossier de départ pour la navigation (optionnel, root par défaut) */
1401
+ startingFolderCode?: string;
1402
+ /** Type de liaison (défaut: 'attachment') */
1403
+ linkType?: string;
1404
+ /** Titre affiché (défaut: 'Pièces jointes') */
1405
+ title?: string;
1406
+ /** Autoriser l'upload (défaut: true) */
1407
+ allowUpload?: boolean;
1408
+ /** Autoriser la suppression (défaut: true) */
1409
+ allowDelete?: boolean;
1410
+ /** Autoriser la création de dossiers (défaut: true) */
1411
+ allowCreateFolder?: boolean;
1412
+ /** Types de fichiers acceptés */
1413
+ accept?: string;
1414
+ /** Callback après upload réussi */
1415
+ onUploadSuccess?: (files: BackendFile[]) => void;
1416
+ /** Callback en cas d'erreur */
1417
+ onError?: (error: Error) => void;
1418
+ /** Classes CSS additionnelles */
1419
+ className?: string;
1420
+ }
1421
+ declare const AttachmentUploader: React$1.FC<AttachmentUploaderProps>;
1422
+
1277
1423
  declare const useFileManager: () => FileManagerContextValue;
1278
1424
  interface FileManagerProviderProps extends FileManagerProps {
1279
1425
  children: React$1.ReactNode;
@@ -1338,6 +1484,81 @@ declare const FileManagerProvider: React$1.FC<FileManagerProviderProps>;
1338
1484
  */
1339
1485
  declare function useFileManagerApi(entityType: EntityType, entityId: string | number, businessEntityId: string | number): UseFileManagerApiReturn;
1340
1486
 
1487
+ /**
1488
+ * Hook pour intégrer le FileManager avec l'arborescence ROOT d'un BusinessEntity.
1489
+ *
1490
+ * Ce hook charge l'intégralité de l'arborescence GED depuis le dossier ROOT,
1491
+ * incluant toutes les catégories (Clients, Fournisseurs, RFQ, etc.) et leurs sous-dossiers.
1492
+ *
1493
+ * DIFFÉRENCE AVEC useFileManagerApi :
1494
+ * ===================================
1495
+ * - useFileManagerApi : Charge les dossiers d'une entité spécifique (Client, Vendor, etc.)
1496
+ * - useRootFileManagerApi : Charge TOUTE l'arborescence depuis ROOT
1497
+ *
1498
+ * STRUCTURE CHARGÉE :
1499
+ * ===================
1500
+ * 📁 ROOT (BusinessEntity)
1501
+ * ├── 📁 Clients (CATEGORY)
1502
+ * │ └── 📁 CLI_Client ABC (ENTITY)
1503
+ * │ └── ...
1504
+ * ├── 📁 Fournisseurs (CATEGORY)
1505
+ * │ └── ...
1506
+ * ├── 📁 Appels d'offres (CATEGORY)
1507
+ * │ └── ...
1508
+ * └── 📁 Documents généraux (CATEGORY)
1509
+ *
1510
+ * EXEMPLE D'UTILISATION :
1511
+ * =======================
1512
+ * ```tsx
1513
+ * const { data, loading, error, handlers, rootName } = useRootFileManagerApi(
1514
+ * businessEntity.id
1515
+ * );
1516
+ *
1517
+ * if (loading) return <Spinner />;
1518
+ * if (error) return <Error message={error.message} />;
1519
+ *
1520
+ * return (
1521
+ * <FileManager
1522
+ * data={data}
1523
+ * rootName={rootName}
1524
+ * onCreateFolder={handlers.onCreateFolder}
1525
+ * onUploadFiles={handlers.onUploadFiles}
1526
+ * ...
1527
+ * />
1528
+ * );
1529
+ * ```
1530
+ */
1531
+
1532
+ interface UseRootFileManagerApiReturn {
1533
+ /** Données transformées pour le FileManager */
1534
+ data: FileItem[];
1535
+ /** État de chargement */
1536
+ loading: boolean;
1537
+ /** Erreur éventuelle */
1538
+ error: Error | null;
1539
+ /** Code du dossier ROOT */
1540
+ rootFolderCode: string | null;
1541
+ /** Nom du dossier ROOT (nom du BusinessEntity) */
1542
+ rootName: string;
1543
+ /** Rafraîchir les données */
1544
+ refresh: () => Promise<void>;
1545
+ /** Handlers pour le FileManager */
1546
+ handlers: {
1547
+ onCreateFolder: (name: string, parentId: string) => Promise<FileItem | void>;
1548
+ onUploadFiles: (files: File[], parentId: string) => Promise<FileItem[] | void>;
1549
+ onRename: (item: FileItem, newName: string) => Promise<void>;
1550
+ onDelete: (item: FileItem) => Promise<void>;
1551
+ onDownload: (item: FileItem) => void;
1552
+ };
1553
+ }
1554
+ /**
1555
+ * Hook pour gérer l'intégration FileManager avec l'arborescence ROOT.
1556
+ *
1557
+ * @param businessEntityId - ID du BusinessEntity
1558
+ * @returns État et handlers pour le FileManager
1559
+ */
1560
+ declare function useRootFileManagerApi(businessEntityId: string | number): UseRootFileManagerApiReturn;
1561
+
1341
1562
  /**
1342
1563
  * Service API pour la GED (Gestion Électronique de Documents).
1343
1564
  *
@@ -1559,8 +1780,36 @@ declare const fileManagerApi: {
1559
1780
  };
1560
1781
 
1561
1782
  declare const getFileIcon: (mimeType?: string, isFolder?: boolean, isOpen?: boolean) => LucideIcon;
1783
+ /**
1784
+ * Retourne la classe de couleur Tailwind pour un type de fichier
1785
+ */
1786
+ declare const getFileIconColor: (mimeType?: string, isFolder?: boolean) => string;
1787
+ declare const getMimeTypeFromExtension: (filename: string) => string;
1562
1788
  declare const formatFileSize: (bytes?: number) => string;
1563
1789
  declare const formatDate: (date?: Date | string) => string;
1790
+ declare const formatDateTime: (date?: Date | string) => string;
1791
+ declare const isImageFile: (mimeType?: string) => boolean;
1792
+ declare const getFileExtension: (filename: string) => string;
1793
+ declare const findFolderById: (items: FileItem[], id: string) => FileItem | null;
1794
+ declare const getAllFolders: (items: FileItem[]) => FileItem[];
1795
+
1796
+ interface FileCardProps {
1797
+ item: FileItem;
1798
+ variant?: 'grid' | 'list';
1799
+ }
1800
+ declare const FileCard: React$1.FC<FileCardProps>;
1801
+
1802
+ declare const FolderTree: React$1.FC;
1803
+
1804
+ declare const FileGrid: React$1.FC;
1805
+
1806
+ declare const FileList: React$1.FC;
1807
+
1808
+ declare const Breadcrumb: React$1.FC;
1809
+
1810
+ declare const Toolbar: React$1.FC;
1811
+
1812
+ declare const ContextMenu: React$1.FC;
1564
1813
 
1565
1814
  interface PrintPreviewProps {
1566
1815
  /** Contenu à imprimer */
@@ -1871,4 +2120,4 @@ declare const WorkSpaceRoutes: React.FC<{
1871
2120
  module_description: string;
1872
2121
  }>;
1873
2122
 
1874
- export { ACCOUNT_TYPE_LABELS, type Account, type AccountListResponse, AccountServices, type AccountType, AccountingWorkspace, AssetsDashboard as ActifsPage, Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AuthServices, BALANCE_TYPE_LABELS, type BackendFile, type BackendFolder, type BalanceType, BudgetPage, CHOICES, CardBody, CardHeader, TeamChat as ChatEquipePage, type Client, type ClientListResponse, ClientServices, type ConfirmOptions, CountrySelector, CrmWorkspace, DataTable, DateInput, DocumentFooter, DocumentHeader, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, FROM_MODULE_CHOICES, FacilityWorkspace, FetchApi, FileInput, type FileItem, FileManager, type FileManagerProps, FileManagerProvider, type FileManagerTexts, ForeignCurrencySelector, FormClient, FormVendor, type FromModule, HRConnectPage, InfoBox, InputField, InvoiceTypeSelector, LegalFormSelector, MeetingHubPage, type MenuItem, MinimalVendorForm, Modal, ModernCard, type ModuleConfig, type ModuleType, NumberInput, PRINT_GREEN, Pages, PaymentMethodSelector, type PendingTask, TeamCalendar as PlanningPage, PrimaryButton, PrintPreview, type PrintPreviewProps, PrintableDocument, type PrintableDocumentProps, type ProcurementWorkspaceStats, PurchaseRequestsPage, PurchaseWorkspace, type RecentActivity, RewiseLayout, SYSCOHADA_CLASSES, SearchableSelect, type SearchableSelectOption, SecondaryButton, SelectAccount, SelectClient, SelectCostCenter, SelectDepartment, SelectInput, SelectUnit, SelectUser, SelectVendor, SessionProvider, SignatureSection, StatCard, TEMPLATE_FNE_CHOICES, TaskPilot, TaxSelector, type TemplateFNE, TemplateFNESelector, TextInput, ThemeProvider, ToastContainer, ToastProvider, TotalsSection, type Unit, UnitServices, type UseFileManagerApiReturn, type User, UserServices, type Vendor, type VendorListResponse, VendorServices, type ViewMode, WorkSpace, WorkSpaceRoutes, WorkspaceServices, fileManagerApi, formatCurrency, formatDate, formatDateFR, formatFileSize, getFileIcon, numberToWords, useAlert, useFileManager, useFileManagerApi, useSession, useToast };
2123
+ export { ACCOUNT_TYPE_LABELS, type Account, type AccountListResponse, AccountServices, type AccountType, AccountingWorkspace, AssetsDashboard as ActifsPage, Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AttachmentUploader, type AttachmentUploaderProps, AuthServices, BALANCE_TYPE_LABELS, type BackendFile, type BackendFolder, Badge, type BalanceType, Breadcrumb, BudgetPage, CHOICES, CardBody, CardHeader, TeamChat as ChatEquipePage, type Client, type ClientListResponse, ClientServices, type ConfirmOptions, ContextMenu, type ContextMenuAction, type ContextMenuPosition, CountrySelector, CrmWorkspace, DataTable, DateInput, DocumentFooter, DocumentHeader, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, FROM_MODULE_CHOICES, FacilityWorkspace, FetchApi, FileCard, FileGrid, FileInput, type FileItem, FileList, FileManager, type FileManagerContextValue, type FileManagerProps, FileManagerProvider, type FileManagerTexts, FolderTree, ForeignCurrencySelector, FormClient, FormVendor, type FromModule, HRConnectPage, InfoBox, InputField, InvoiceTypeSelector, LegalFormSelector, MeetingHubPage, type MenuItem, MinimalVendorForm, Modal, ModernCard, type ModuleConfig, type ModuleType, NumberInput, PRINT_GREEN, Pages, PaymentMethodSelector, type PendingTask, TeamCalendar as PlanningPage, PrimaryButton, PrintPreview, type PrintPreviewProps, PrintableDocument, type PrintableDocumentProps, type ProcurementWorkspaceStats, PurchaseRequestsPage, PurchaseWorkspace, type RecentActivity, RewiseLayout, RootFileManager, SYSCOHADA_CLASSES, SearchableSelect, type SearchableSelectOption, SecondaryButton, SelectAccount, SelectClient, SelectCostCenter, SelectDepartment, SelectInput, SelectUnit, SelectUser, SelectVendor, SessionProvider, SignatureSection, StatCard, TEMPLATE_FNE_CHOICES, TaskPilot, TaxSelector, type TemplateFNE, TemplateFNESelector, TextInput, ThemeProvider, ToastContainer, ToastProvider, Toolbar, TotalsSection, type Unit, UnitServices, type UseFileManagerApiReturn, type User, UserServices, type Vendor, type VendorListResponse, VendorServices, type ViewMode, WorkSpace, WorkSpaceRoutes, WorkspaceServices, fileManagerApi, findFolderById, formatCurrency, formatDate, formatDateFR, formatDateTime, formatFileSize, getAllFolders, getFileExtension, getFileIcon, getFileIconColor, getMimeTypeFromExtension, isImageFile, numberToWords, useAlert, useFileManager, useFileManagerApi, useRootFileManagerApi, useSession, useToast };
package/dist/index.d.ts CHANGED
@@ -745,6 +745,13 @@ declare const AccountServices: {
745
745
  delete: (id: number) => Promise<unknown>;
746
746
  };
747
747
 
748
+ type BadgeVariant = 'default' | 'success' | 'warning' | 'error' | 'info' | 'purple' | 'blue' | 'green';
749
+ interface BadgeProps {
750
+ children: React$1.ReactNode;
751
+ variant?: BadgeVariant;
752
+ }
753
+ declare const Badge: ({ children, variant }: BadgeProps) => react_jsx_runtime.JSX.Element;
754
+
748
755
  type ImportField = {
749
756
  value: string;
750
757
  label: string;
@@ -772,6 +779,13 @@ type FDrawerLineAction = {
772
779
  navigate?: string;
773
780
  onclick?: (item: any) => any;
774
781
  };
782
+ type ViewMode$1 = 'table' | 'grid';
783
+ type FDrawerToolbarAction = {
784
+ label: string;
785
+ icon?: React$1.ReactNode;
786
+ onClick: () => void;
787
+ variant?: 'full' | 'outline' | 'text';
788
+ };
775
789
  interface FDrawerProps {
776
790
  children?: React$1.ReactNode;
777
791
  apiEndpoint: string;
@@ -784,6 +798,9 @@ interface FDrawerProps {
784
798
  onBulkDelete?: (ids: number[]) => Promise<void>;
785
799
  onDuplicate?: (item: any) => Promise<void>;
786
800
  title?: string;
801
+ gridRenderer?: (item: any) => React$1.ReactNode;
802
+ defaultView?: ViewMode$1;
803
+ toolbarActions?: FDrawerToolbarAction[];
787
804
  }
788
805
  declare const FDrawer: React$1.FC<FDrawerProps>;
789
806
 
@@ -1019,6 +1036,8 @@ interface FileManagerProps {
1019
1036
  onDownload?: (item: FileItem) => void;
1020
1037
  onSelect?: (items: FileItem[]) => void;
1021
1038
  onOpen?: (item: FileItem) => void;
1039
+ /** Callback pour rafraîchir les données */
1040
+ onRefresh?: () => Promise<void>;
1022
1041
  viewMode?: ViewMode;
1023
1042
  allowMultiSelect?: boolean;
1024
1043
  allowUpload?: boolean;
@@ -1045,11 +1064,19 @@ interface FileManagerTexts {
1045
1064
  dropFilesHere?: string;
1046
1065
  cancel?: string;
1047
1066
  confirm?: string;
1067
+ refresh?: string;
1048
1068
  }
1049
1069
  interface ContextMenuPosition {
1050
1070
  x: number;
1051
1071
  y: number;
1052
1072
  }
1073
+ interface ContextMenuAction {
1074
+ label: string;
1075
+ icon?: ReactNode;
1076
+ onClick: () => void;
1077
+ disabled?: boolean;
1078
+ danger?: boolean;
1079
+ }
1053
1080
  interface FileManagerContextValue {
1054
1081
  data: FileItem[];
1055
1082
  currentFolder: FileItem | null;
@@ -1081,6 +1108,7 @@ interface FileManagerContextValue {
1081
1108
  onDelete?: (item: FileItem) => Promise<void>;
1082
1109
  onDownload?: (item: FileItem) => void;
1083
1110
  onOpen?: (item: FileItem) => void;
1111
+ onRefresh?: () => Promise<void>;
1084
1112
  allowUpload: boolean;
1085
1113
  allowCreateFolder: boolean;
1086
1114
  allowRename: boolean;
@@ -1274,6 +1302,124 @@ declare const FileManager: React$1.FC<FileManagerProps>;
1274
1302
  */
1275
1303
  declare const EntityFileManager: React$1.FC<EntityFileManagerProps>;
1276
1304
 
1305
+ /**
1306
+ * RootFileManager - FileManager intégré pour l'arborescence ROOT d'un BusinessEntity.
1307
+ *
1308
+ * Ce composant affiche l'intégralité de l'arborescence GED d'un BusinessEntity,
1309
+ * incluant toutes les catégories (Clients, Fournisseurs, RFQ, etc.) et leurs contenus.
1310
+ *
1311
+ * DIFFÉRENCE AVEC EntityFileManager :
1312
+ * ===================================
1313
+ * - EntityFileManager : Affiche les dossiers d'une entité spécifique (Client, Vendor, etc.)
1314
+ * - RootFileManager : Affiche TOUTE l'arborescence depuis ROOT
1315
+ *
1316
+ * STRUCTURE AFFICHÉE :
1317
+ * ====================
1318
+ * 📁 [Nom du BusinessEntity]
1319
+ * ├── 📁 Clients
1320
+ * │ └── 📁 CLI_Client ABC
1321
+ * │ └── 📁 Contrats, Factures, etc.
1322
+ * ├── 📁 Fournisseurs
1323
+ * │ └── 📁 FRN_Fournisseur XYZ
1324
+ * │ └── ...
1325
+ * ├── 📁 Appels d'offres
1326
+ * │ └── ...
1327
+ * └── 📁 Documents généraux
1328
+ *
1329
+ * EXEMPLE D'UTILISATION :
1330
+ * =======================
1331
+ * ```tsx
1332
+ * <RootFileManager
1333
+ * businessEntityId={entity.id}
1334
+ * height="600px"
1335
+ * allowUpload={true}
1336
+ * allowCreateFolder={true}
1337
+ * />
1338
+ * ```
1339
+ */
1340
+
1341
+ interface RootFileManagerProps {
1342
+ /** ID du BusinessEntity */
1343
+ businessEntityId: number | string;
1344
+ /** Hauteur du composant (CSS) */
1345
+ height?: string;
1346
+ /** Autoriser l'upload de fichiers */
1347
+ allowUpload?: boolean;
1348
+ /** Autoriser la création de dossiers */
1349
+ allowCreateFolder?: boolean;
1350
+ /** Autoriser le renommage */
1351
+ allowRename?: boolean;
1352
+ /** Autoriser la suppression */
1353
+ allowDelete?: boolean;
1354
+ /** Autoriser le téléchargement */
1355
+ allowDownload?: boolean;
1356
+ /** Callback lors de la sélection de fichiers */
1357
+ onFileSelect?: (files: FileItem[]) => void;
1358
+ /** Callback lors de l'ouverture d'un fichier */
1359
+ onFileOpen?: (file: FileItem) => void;
1360
+ /** Callback après upload réussi */
1361
+ onUploadSuccess?: (files: FileItem[]) => void;
1362
+ /** Callback en cas d'erreur */
1363
+ onError?: (error: Error) => void;
1364
+ }
1365
+ declare const RootFileManager: React$1.FC<RootFileManagerProps>;
1366
+
1367
+ /**
1368
+ * AttachmentUploader - Composant simplifié pour attacher des fichiers à un objet
1369
+ *
1370
+ * Utilisation:
1371
+ * ```tsx
1372
+ * // Avec sélection de dossier dynamique (recommandé)
1373
+ * <AttachmentUploader
1374
+ * model="accounting.FundCall"
1375
+ * objectId={fundCall.id}
1376
+ * businessEntityId={businessEntity.id}
1377
+ * linkType="attachment"
1378
+ * onUploadSuccess={(files) => console.log('Uploaded:', files)}
1379
+ * />
1380
+ *
1381
+ * // Avec dossier fixe
1382
+ * <AttachmentUploader
1383
+ * model="accounting.FundCall"
1384
+ * objectId={fundCall.id}
1385
+ * folderCode="FO000123"
1386
+ * linkType="attachment"
1387
+ * />
1388
+ * ```
1389
+ */
1390
+
1391
+ interface AttachmentUploaderProps {
1392
+ /** Chemin du modèle Django (ex: 'accounting.FundCall') */
1393
+ model: string;
1394
+ /** ID de l'objet à lier */
1395
+ objectId: number | string;
1396
+ /** ID du BusinessEntity (pour le sélecteur de dossier dynamique) */
1397
+ businessEntityId?: number | string;
1398
+ /** Code du dossier où uploader (optionnel si businessEntityId est fourni) */
1399
+ folderCode?: string;
1400
+ /** Code du dossier de départ pour la navigation (optionnel, root par défaut) */
1401
+ startingFolderCode?: string;
1402
+ /** Type de liaison (défaut: 'attachment') */
1403
+ linkType?: string;
1404
+ /** Titre affiché (défaut: 'Pièces jointes') */
1405
+ title?: string;
1406
+ /** Autoriser l'upload (défaut: true) */
1407
+ allowUpload?: boolean;
1408
+ /** Autoriser la suppression (défaut: true) */
1409
+ allowDelete?: boolean;
1410
+ /** Autoriser la création de dossiers (défaut: true) */
1411
+ allowCreateFolder?: boolean;
1412
+ /** Types de fichiers acceptés */
1413
+ accept?: string;
1414
+ /** Callback après upload réussi */
1415
+ onUploadSuccess?: (files: BackendFile[]) => void;
1416
+ /** Callback en cas d'erreur */
1417
+ onError?: (error: Error) => void;
1418
+ /** Classes CSS additionnelles */
1419
+ className?: string;
1420
+ }
1421
+ declare const AttachmentUploader: React$1.FC<AttachmentUploaderProps>;
1422
+
1277
1423
  declare const useFileManager: () => FileManagerContextValue;
1278
1424
  interface FileManagerProviderProps extends FileManagerProps {
1279
1425
  children: React$1.ReactNode;
@@ -1338,6 +1484,81 @@ declare const FileManagerProvider: React$1.FC<FileManagerProviderProps>;
1338
1484
  */
1339
1485
  declare function useFileManagerApi(entityType: EntityType, entityId: string | number, businessEntityId: string | number): UseFileManagerApiReturn;
1340
1486
 
1487
+ /**
1488
+ * Hook pour intégrer le FileManager avec l'arborescence ROOT d'un BusinessEntity.
1489
+ *
1490
+ * Ce hook charge l'intégralité de l'arborescence GED depuis le dossier ROOT,
1491
+ * incluant toutes les catégories (Clients, Fournisseurs, RFQ, etc.) et leurs sous-dossiers.
1492
+ *
1493
+ * DIFFÉRENCE AVEC useFileManagerApi :
1494
+ * ===================================
1495
+ * - useFileManagerApi : Charge les dossiers d'une entité spécifique (Client, Vendor, etc.)
1496
+ * - useRootFileManagerApi : Charge TOUTE l'arborescence depuis ROOT
1497
+ *
1498
+ * STRUCTURE CHARGÉE :
1499
+ * ===================
1500
+ * 📁 ROOT (BusinessEntity)
1501
+ * ├── 📁 Clients (CATEGORY)
1502
+ * │ └── 📁 CLI_Client ABC (ENTITY)
1503
+ * │ └── ...
1504
+ * ├── 📁 Fournisseurs (CATEGORY)
1505
+ * │ └── ...
1506
+ * ├── 📁 Appels d'offres (CATEGORY)
1507
+ * │ └── ...
1508
+ * └── 📁 Documents généraux (CATEGORY)
1509
+ *
1510
+ * EXEMPLE D'UTILISATION :
1511
+ * =======================
1512
+ * ```tsx
1513
+ * const { data, loading, error, handlers, rootName } = useRootFileManagerApi(
1514
+ * businessEntity.id
1515
+ * );
1516
+ *
1517
+ * if (loading) return <Spinner />;
1518
+ * if (error) return <Error message={error.message} />;
1519
+ *
1520
+ * return (
1521
+ * <FileManager
1522
+ * data={data}
1523
+ * rootName={rootName}
1524
+ * onCreateFolder={handlers.onCreateFolder}
1525
+ * onUploadFiles={handlers.onUploadFiles}
1526
+ * ...
1527
+ * />
1528
+ * );
1529
+ * ```
1530
+ */
1531
+
1532
+ interface UseRootFileManagerApiReturn {
1533
+ /** Données transformées pour le FileManager */
1534
+ data: FileItem[];
1535
+ /** État de chargement */
1536
+ loading: boolean;
1537
+ /** Erreur éventuelle */
1538
+ error: Error | null;
1539
+ /** Code du dossier ROOT */
1540
+ rootFolderCode: string | null;
1541
+ /** Nom du dossier ROOT (nom du BusinessEntity) */
1542
+ rootName: string;
1543
+ /** Rafraîchir les données */
1544
+ refresh: () => Promise<void>;
1545
+ /** Handlers pour le FileManager */
1546
+ handlers: {
1547
+ onCreateFolder: (name: string, parentId: string) => Promise<FileItem | void>;
1548
+ onUploadFiles: (files: File[], parentId: string) => Promise<FileItem[] | void>;
1549
+ onRename: (item: FileItem, newName: string) => Promise<void>;
1550
+ onDelete: (item: FileItem) => Promise<void>;
1551
+ onDownload: (item: FileItem) => void;
1552
+ };
1553
+ }
1554
+ /**
1555
+ * Hook pour gérer l'intégration FileManager avec l'arborescence ROOT.
1556
+ *
1557
+ * @param businessEntityId - ID du BusinessEntity
1558
+ * @returns État et handlers pour le FileManager
1559
+ */
1560
+ declare function useRootFileManagerApi(businessEntityId: string | number): UseRootFileManagerApiReturn;
1561
+
1341
1562
  /**
1342
1563
  * Service API pour la GED (Gestion Électronique de Documents).
1343
1564
  *
@@ -1559,8 +1780,36 @@ declare const fileManagerApi: {
1559
1780
  };
1560
1781
 
1561
1782
  declare const getFileIcon: (mimeType?: string, isFolder?: boolean, isOpen?: boolean) => LucideIcon;
1783
+ /**
1784
+ * Retourne la classe de couleur Tailwind pour un type de fichier
1785
+ */
1786
+ declare const getFileIconColor: (mimeType?: string, isFolder?: boolean) => string;
1787
+ declare const getMimeTypeFromExtension: (filename: string) => string;
1562
1788
  declare const formatFileSize: (bytes?: number) => string;
1563
1789
  declare const formatDate: (date?: Date | string) => string;
1790
+ declare const formatDateTime: (date?: Date | string) => string;
1791
+ declare const isImageFile: (mimeType?: string) => boolean;
1792
+ declare const getFileExtension: (filename: string) => string;
1793
+ declare const findFolderById: (items: FileItem[], id: string) => FileItem | null;
1794
+ declare const getAllFolders: (items: FileItem[]) => FileItem[];
1795
+
1796
+ interface FileCardProps {
1797
+ item: FileItem;
1798
+ variant?: 'grid' | 'list';
1799
+ }
1800
+ declare const FileCard: React$1.FC<FileCardProps>;
1801
+
1802
+ declare const FolderTree: React$1.FC;
1803
+
1804
+ declare const FileGrid: React$1.FC;
1805
+
1806
+ declare const FileList: React$1.FC;
1807
+
1808
+ declare const Breadcrumb: React$1.FC;
1809
+
1810
+ declare const Toolbar: React$1.FC;
1811
+
1812
+ declare const ContextMenu: React$1.FC;
1564
1813
 
1565
1814
  interface PrintPreviewProps {
1566
1815
  /** Contenu à imprimer */
@@ -1871,4 +2120,4 @@ declare const WorkSpaceRoutes: React.FC<{
1871
2120
  module_description: string;
1872
2121
  }>;
1873
2122
 
1874
- export { ACCOUNT_TYPE_LABELS, type Account, type AccountListResponse, AccountServices, type AccountType, AccountingWorkspace, AssetsDashboard as ActifsPage, Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AuthServices, BALANCE_TYPE_LABELS, type BackendFile, type BackendFolder, type BalanceType, BudgetPage, CHOICES, CardBody, CardHeader, TeamChat as ChatEquipePage, type Client, type ClientListResponse, ClientServices, type ConfirmOptions, CountrySelector, CrmWorkspace, DataTable, DateInput, DocumentFooter, DocumentHeader, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, FROM_MODULE_CHOICES, FacilityWorkspace, FetchApi, FileInput, type FileItem, FileManager, type FileManagerProps, FileManagerProvider, type FileManagerTexts, ForeignCurrencySelector, FormClient, FormVendor, type FromModule, HRConnectPage, InfoBox, InputField, InvoiceTypeSelector, LegalFormSelector, MeetingHubPage, type MenuItem, MinimalVendorForm, Modal, ModernCard, type ModuleConfig, type ModuleType, NumberInput, PRINT_GREEN, Pages, PaymentMethodSelector, type PendingTask, TeamCalendar as PlanningPage, PrimaryButton, PrintPreview, type PrintPreviewProps, PrintableDocument, type PrintableDocumentProps, type ProcurementWorkspaceStats, PurchaseRequestsPage, PurchaseWorkspace, type RecentActivity, RewiseLayout, SYSCOHADA_CLASSES, SearchableSelect, type SearchableSelectOption, SecondaryButton, SelectAccount, SelectClient, SelectCostCenter, SelectDepartment, SelectInput, SelectUnit, SelectUser, SelectVendor, SessionProvider, SignatureSection, StatCard, TEMPLATE_FNE_CHOICES, TaskPilot, TaxSelector, type TemplateFNE, TemplateFNESelector, TextInput, ThemeProvider, ToastContainer, ToastProvider, TotalsSection, type Unit, UnitServices, type UseFileManagerApiReturn, type User, UserServices, type Vendor, type VendorListResponse, VendorServices, type ViewMode, WorkSpace, WorkSpaceRoutes, WorkspaceServices, fileManagerApi, formatCurrency, formatDate, formatDateFR, formatFileSize, getFileIcon, numberToWords, useAlert, useFileManager, useFileManagerApi, useSession, useToast };
2123
+ export { ACCOUNT_TYPE_LABELS, type Account, type AccountListResponse, AccountServices, type AccountType, AccountingWorkspace, AssetsDashboard as ActifsPage, Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AttachmentUploader, type AttachmentUploaderProps, AuthServices, BALANCE_TYPE_LABELS, type BackendFile, type BackendFolder, Badge, type BalanceType, Breadcrumb, BudgetPage, CHOICES, CardBody, CardHeader, TeamChat as ChatEquipePage, type Client, type ClientListResponse, ClientServices, type ConfirmOptions, ContextMenu, type ContextMenuAction, type ContextMenuPosition, CountrySelector, CrmWorkspace, DataTable, DateInput, DocumentFooter, DocumentHeader, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, FROM_MODULE_CHOICES, FacilityWorkspace, FetchApi, FileCard, FileGrid, FileInput, type FileItem, FileList, FileManager, type FileManagerContextValue, type FileManagerProps, FileManagerProvider, type FileManagerTexts, FolderTree, ForeignCurrencySelector, FormClient, FormVendor, type FromModule, HRConnectPage, InfoBox, InputField, InvoiceTypeSelector, LegalFormSelector, MeetingHubPage, type MenuItem, MinimalVendorForm, Modal, ModernCard, type ModuleConfig, type ModuleType, NumberInput, PRINT_GREEN, Pages, PaymentMethodSelector, type PendingTask, TeamCalendar as PlanningPage, PrimaryButton, PrintPreview, type PrintPreviewProps, PrintableDocument, type PrintableDocumentProps, type ProcurementWorkspaceStats, PurchaseRequestsPage, PurchaseWorkspace, type RecentActivity, RewiseLayout, RootFileManager, SYSCOHADA_CLASSES, SearchableSelect, type SearchableSelectOption, SecondaryButton, SelectAccount, SelectClient, SelectCostCenter, SelectDepartment, SelectInput, SelectUnit, SelectUser, SelectVendor, SessionProvider, SignatureSection, StatCard, TEMPLATE_FNE_CHOICES, TaskPilot, TaxSelector, type TemplateFNE, TemplateFNESelector, TextInput, ThemeProvider, ToastContainer, ToastProvider, Toolbar, TotalsSection, type Unit, UnitServices, type UseFileManagerApiReturn, type User, UserServices, type Vendor, type VendorListResponse, VendorServices, type ViewMode, WorkSpace, WorkSpaceRoutes, WorkspaceServices, fileManagerApi, findFolderById, formatCurrency, formatDate, formatDateFR, formatDateTime, formatFileSize, getAllFolders, getFileExtension, getFileIcon, getFileIconColor, getMimeTypeFromExtension, isImageFile, numberToWords, useAlert, useFileManager, useFileManagerApi, useRootFileManagerApi, useSession, useToast };