ptechcore_ui 1.0.49 → 1.0.50
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 +3974 -2810
- package/dist/index.d.cts +233 -1
- package/dist/index.d.ts +233 -1
- package/dist/index.js +4064 -2894
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1019,6 +1019,8 @@ interface FileManagerProps {
|
|
|
1019
1019
|
onDownload?: (item: FileItem) => void;
|
|
1020
1020
|
onSelect?: (items: FileItem[]) => void;
|
|
1021
1021
|
onOpen?: (item: FileItem) => void;
|
|
1022
|
+
/** Callback pour rafraîchir les données */
|
|
1023
|
+
onRefresh?: () => Promise<void>;
|
|
1022
1024
|
viewMode?: ViewMode;
|
|
1023
1025
|
allowMultiSelect?: boolean;
|
|
1024
1026
|
allowUpload?: boolean;
|
|
@@ -1045,11 +1047,19 @@ interface FileManagerTexts {
|
|
|
1045
1047
|
dropFilesHere?: string;
|
|
1046
1048
|
cancel?: string;
|
|
1047
1049
|
confirm?: string;
|
|
1050
|
+
refresh?: string;
|
|
1048
1051
|
}
|
|
1049
1052
|
interface ContextMenuPosition {
|
|
1050
1053
|
x: number;
|
|
1051
1054
|
y: number;
|
|
1052
1055
|
}
|
|
1056
|
+
interface ContextMenuAction {
|
|
1057
|
+
label: string;
|
|
1058
|
+
icon?: ReactNode;
|
|
1059
|
+
onClick: () => void;
|
|
1060
|
+
disabled?: boolean;
|
|
1061
|
+
danger?: boolean;
|
|
1062
|
+
}
|
|
1053
1063
|
interface FileManagerContextValue {
|
|
1054
1064
|
data: FileItem[];
|
|
1055
1065
|
currentFolder: FileItem | null;
|
|
@@ -1081,6 +1091,7 @@ interface FileManagerContextValue {
|
|
|
1081
1091
|
onDelete?: (item: FileItem) => Promise<void>;
|
|
1082
1092
|
onDownload?: (item: FileItem) => void;
|
|
1083
1093
|
onOpen?: (item: FileItem) => void;
|
|
1094
|
+
onRefresh?: () => Promise<void>;
|
|
1084
1095
|
allowUpload: boolean;
|
|
1085
1096
|
allowCreateFolder: boolean;
|
|
1086
1097
|
allowRename: boolean;
|
|
@@ -1274,6 +1285,124 @@ declare const FileManager: React$1.FC<FileManagerProps>;
|
|
|
1274
1285
|
*/
|
|
1275
1286
|
declare const EntityFileManager: React$1.FC<EntityFileManagerProps>;
|
|
1276
1287
|
|
|
1288
|
+
/**
|
|
1289
|
+
* RootFileManager - FileManager intégré pour l'arborescence ROOT d'un BusinessEntity.
|
|
1290
|
+
*
|
|
1291
|
+
* Ce composant affiche l'intégralité de l'arborescence GED d'un BusinessEntity,
|
|
1292
|
+
* incluant toutes les catégories (Clients, Fournisseurs, RFQ, etc.) et leurs contenus.
|
|
1293
|
+
*
|
|
1294
|
+
* DIFFÉRENCE AVEC EntityFileManager :
|
|
1295
|
+
* ===================================
|
|
1296
|
+
* - EntityFileManager : Affiche les dossiers d'une entité spécifique (Client, Vendor, etc.)
|
|
1297
|
+
* - RootFileManager : Affiche TOUTE l'arborescence depuis ROOT
|
|
1298
|
+
*
|
|
1299
|
+
* STRUCTURE AFFICHÉE :
|
|
1300
|
+
* ====================
|
|
1301
|
+
* 📁 [Nom du BusinessEntity]
|
|
1302
|
+
* ├── 📁 Clients
|
|
1303
|
+
* │ └── 📁 CLI_Client ABC
|
|
1304
|
+
* │ └── 📁 Contrats, Factures, etc.
|
|
1305
|
+
* ├── 📁 Fournisseurs
|
|
1306
|
+
* │ └── 📁 FRN_Fournisseur XYZ
|
|
1307
|
+
* │ └── ...
|
|
1308
|
+
* ├── 📁 Appels d'offres
|
|
1309
|
+
* │ └── ...
|
|
1310
|
+
* └── 📁 Documents généraux
|
|
1311
|
+
*
|
|
1312
|
+
* EXEMPLE D'UTILISATION :
|
|
1313
|
+
* =======================
|
|
1314
|
+
* ```tsx
|
|
1315
|
+
* <RootFileManager
|
|
1316
|
+
* businessEntityId={entity.id}
|
|
1317
|
+
* height="600px"
|
|
1318
|
+
* allowUpload={true}
|
|
1319
|
+
* allowCreateFolder={true}
|
|
1320
|
+
* />
|
|
1321
|
+
* ```
|
|
1322
|
+
*/
|
|
1323
|
+
|
|
1324
|
+
interface RootFileManagerProps {
|
|
1325
|
+
/** ID du BusinessEntity */
|
|
1326
|
+
businessEntityId: number | string;
|
|
1327
|
+
/** Hauteur du composant (CSS) */
|
|
1328
|
+
height?: string;
|
|
1329
|
+
/** Autoriser l'upload de fichiers */
|
|
1330
|
+
allowUpload?: boolean;
|
|
1331
|
+
/** Autoriser la création de dossiers */
|
|
1332
|
+
allowCreateFolder?: boolean;
|
|
1333
|
+
/** Autoriser le renommage */
|
|
1334
|
+
allowRename?: boolean;
|
|
1335
|
+
/** Autoriser la suppression */
|
|
1336
|
+
allowDelete?: boolean;
|
|
1337
|
+
/** Autoriser le téléchargement */
|
|
1338
|
+
allowDownload?: boolean;
|
|
1339
|
+
/** Callback lors de la sélection de fichiers */
|
|
1340
|
+
onFileSelect?: (files: FileItem[]) => void;
|
|
1341
|
+
/** Callback lors de l'ouverture d'un fichier */
|
|
1342
|
+
onFileOpen?: (file: FileItem) => void;
|
|
1343
|
+
/** Callback après upload réussi */
|
|
1344
|
+
onUploadSuccess?: (files: FileItem[]) => void;
|
|
1345
|
+
/** Callback en cas d'erreur */
|
|
1346
|
+
onError?: (error: Error) => void;
|
|
1347
|
+
}
|
|
1348
|
+
declare const RootFileManager: React$1.FC<RootFileManagerProps>;
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* AttachmentUploader - Composant simplifié pour attacher des fichiers à un objet
|
|
1352
|
+
*
|
|
1353
|
+
* Utilisation:
|
|
1354
|
+
* ```tsx
|
|
1355
|
+
* // Avec sélection de dossier dynamique (recommandé)
|
|
1356
|
+
* <AttachmentUploader
|
|
1357
|
+
* model="accounting.FundCall"
|
|
1358
|
+
* objectId={fundCall.id}
|
|
1359
|
+
* businessEntityId={businessEntity.id}
|
|
1360
|
+
* linkType="attachment"
|
|
1361
|
+
* onUploadSuccess={(files) => console.log('Uploaded:', files)}
|
|
1362
|
+
* />
|
|
1363
|
+
*
|
|
1364
|
+
* // Avec dossier fixe
|
|
1365
|
+
* <AttachmentUploader
|
|
1366
|
+
* model="accounting.FundCall"
|
|
1367
|
+
* objectId={fundCall.id}
|
|
1368
|
+
* folderCode="FO000123"
|
|
1369
|
+
* linkType="attachment"
|
|
1370
|
+
* />
|
|
1371
|
+
* ```
|
|
1372
|
+
*/
|
|
1373
|
+
|
|
1374
|
+
interface AttachmentUploaderProps {
|
|
1375
|
+
/** Chemin du modèle Django (ex: 'accounting.FundCall') */
|
|
1376
|
+
model: string;
|
|
1377
|
+
/** ID de l'objet à lier */
|
|
1378
|
+
objectId: number | string;
|
|
1379
|
+
/** ID du BusinessEntity (pour le sélecteur de dossier dynamique) */
|
|
1380
|
+
businessEntityId?: number | string;
|
|
1381
|
+
/** Code du dossier où uploader (optionnel si businessEntityId est fourni) */
|
|
1382
|
+
folderCode?: string;
|
|
1383
|
+
/** Code du dossier de départ pour la navigation (optionnel, root par défaut) */
|
|
1384
|
+
startingFolderCode?: string;
|
|
1385
|
+
/** Type de liaison (défaut: 'attachment') */
|
|
1386
|
+
linkType?: string;
|
|
1387
|
+
/** Titre affiché (défaut: 'Pièces jointes') */
|
|
1388
|
+
title?: string;
|
|
1389
|
+
/** Autoriser l'upload (défaut: true) */
|
|
1390
|
+
allowUpload?: boolean;
|
|
1391
|
+
/** Autoriser la suppression (défaut: true) */
|
|
1392
|
+
allowDelete?: boolean;
|
|
1393
|
+
/** Autoriser la création de dossiers (défaut: true) */
|
|
1394
|
+
allowCreateFolder?: boolean;
|
|
1395
|
+
/** Types de fichiers acceptés */
|
|
1396
|
+
accept?: string;
|
|
1397
|
+
/** Callback après upload réussi */
|
|
1398
|
+
onUploadSuccess?: (files: BackendFile[]) => void;
|
|
1399
|
+
/** Callback en cas d'erreur */
|
|
1400
|
+
onError?: (error: Error) => void;
|
|
1401
|
+
/** Classes CSS additionnelles */
|
|
1402
|
+
className?: string;
|
|
1403
|
+
}
|
|
1404
|
+
declare const AttachmentUploader: React$1.FC<AttachmentUploaderProps>;
|
|
1405
|
+
|
|
1277
1406
|
declare const useFileManager: () => FileManagerContextValue;
|
|
1278
1407
|
interface FileManagerProviderProps extends FileManagerProps {
|
|
1279
1408
|
children: React$1.ReactNode;
|
|
@@ -1338,6 +1467,81 @@ declare const FileManagerProvider: React$1.FC<FileManagerProviderProps>;
|
|
|
1338
1467
|
*/
|
|
1339
1468
|
declare function useFileManagerApi(entityType: EntityType, entityId: string | number, businessEntityId: string | number): UseFileManagerApiReturn;
|
|
1340
1469
|
|
|
1470
|
+
/**
|
|
1471
|
+
* Hook pour intégrer le FileManager avec l'arborescence ROOT d'un BusinessEntity.
|
|
1472
|
+
*
|
|
1473
|
+
* Ce hook charge l'intégralité de l'arborescence GED depuis le dossier ROOT,
|
|
1474
|
+
* incluant toutes les catégories (Clients, Fournisseurs, RFQ, etc.) et leurs sous-dossiers.
|
|
1475
|
+
*
|
|
1476
|
+
* DIFFÉRENCE AVEC useFileManagerApi :
|
|
1477
|
+
* ===================================
|
|
1478
|
+
* - useFileManagerApi : Charge les dossiers d'une entité spécifique (Client, Vendor, etc.)
|
|
1479
|
+
* - useRootFileManagerApi : Charge TOUTE l'arborescence depuis ROOT
|
|
1480
|
+
*
|
|
1481
|
+
* STRUCTURE CHARGÉE :
|
|
1482
|
+
* ===================
|
|
1483
|
+
* 📁 ROOT (BusinessEntity)
|
|
1484
|
+
* ├── 📁 Clients (CATEGORY)
|
|
1485
|
+
* │ └── 📁 CLI_Client ABC (ENTITY)
|
|
1486
|
+
* │ └── ...
|
|
1487
|
+
* ├── 📁 Fournisseurs (CATEGORY)
|
|
1488
|
+
* │ └── ...
|
|
1489
|
+
* ├── 📁 Appels d'offres (CATEGORY)
|
|
1490
|
+
* │ └── ...
|
|
1491
|
+
* └── 📁 Documents généraux (CATEGORY)
|
|
1492
|
+
*
|
|
1493
|
+
* EXEMPLE D'UTILISATION :
|
|
1494
|
+
* =======================
|
|
1495
|
+
* ```tsx
|
|
1496
|
+
* const { data, loading, error, handlers, rootName } = useRootFileManagerApi(
|
|
1497
|
+
* businessEntity.id
|
|
1498
|
+
* );
|
|
1499
|
+
*
|
|
1500
|
+
* if (loading) return <Spinner />;
|
|
1501
|
+
* if (error) return <Error message={error.message} />;
|
|
1502
|
+
*
|
|
1503
|
+
* return (
|
|
1504
|
+
* <FileManager
|
|
1505
|
+
* data={data}
|
|
1506
|
+
* rootName={rootName}
|
|
1507
|
+
* onCreateFolder={handlers.onCreateFolder}
|
|
1508
|
+
* onUploadFiles={handlers.onUploadFiles}
|
|
1509
|
+
* ...
|
|
1510
|
+
* />
|
|
1511
|
+
* );
|
|
1512
|
+
* ```
|
|
1513
|
+
*/
|
|
1514
|
+
|
|
1515
|
+
interface UseRootFileManagerApiReturn {
|
|
1516
|
+
/** Données transformées pour le FileManager */
|
|
1517
|
+
data: FileItem[];
|
|
1518
|
+
/** État de chargement */
|
|
1519
|
+
loading: boolean;
|
|
1520
|
+
/** Erreur éventuelle */
|
|
1521
|
+
error: Error | null;
|
|
1522
|
+
/** Code du dossier ROOT */
|
|
1523
|
+
rootFolderCode: string | null;
|
|
1524
|
+
/** Nom du dossier ROOT (nom du BusinessEntity) */
|
|
1525
|
+
rootName: string;
|
|
1526
|
+
/** Rafraîchir les données */
|
|
1527
|
+
refresh: () => Promise<void>;
|
|
1528
|
+
/** Handlers pour le FileManager */
|
|
1529
|
+
handlers: {
|
|
1530
|
+
onCreateFolder: (name: string, parentId: string) => Promise<FileItem | void>;
|
|
1531
|
+
onUploadFiles: (files: File[], parentId: string) => Promise<FileItem[] | void>;
|
|
1532
|
+
onRename: (item: FileItem, newName: string) => Promise<void>;
|
|
1533
|
+
onDelete: (item: FileItem) => Promise<void>;
|
|
1534
|
+
onDownload: (item: FileItem) => void;
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Hook pour gérer l'intégration FileManager avec l'arborescence ROOT.
|
|
1539
|
+
*
|
|
1540
|
+
* @param businessEntityId - ID du BusinessEntity
|
|
1541
|
+
* @returns État et handlers pour le FileManager
|
|
1542
|
+
*/
|
|
1543
|
+
declare function useRootFileManagerApi(businessEntityId: string | number): UseRootFileManagerApiReturn;
|
|
1544
|
+
|
|
1341
1545
|
/**
|
|
1342
1546
|
* Service API pour la GED (Gestion Électronique de Documents).
|
|
1343
1547
|
*
|
|
@@ -1559,8 +1763,36 @@ declare const fileManagerApi: {
|
|
|
1559
1763
|
};
|
|
1560
1764
|
|
|
1561
1765
|
declare const getFileIcon: (mimeType?: string, isFolder?: boolean, isOpen?: boolean) => LucideIcon;
|
|
1766
|
+
/**
|
|
1767
|
+
* Retourne la classe de couleur Tailwind pour un type de fichier
|
|
1768
|
+
*/
|
|
1769
|
+
declare const getFileIconColor: (mimeType?: string, isFolder?: boolean) => string;
|
|
1770
|
+
declare const getMimeTypeFromExtension: (filename: string) => string;
|
|
1562
1771
|
declare const formatFileSize: (bytes?: number) => string;
|
|
1563
1772
|
declare const formatDate: (date?: Date | string) => string;
|
|
1773
|
+
declare const formatDateTime: (date?: Date | string) => string;
|
|
1774
|
+
declare const isImageFile: (mimeType?: string) => boolean;
|
|
1775
|
+
declare const getFileExtension: (filename: string) => string;
|
|
1776
|
+
declare const findFolderById: (items: FileItem[], id: string) => FileItem | null;
|
|
1777
|
+
declare const getAllFolders: (items: FileItem[]) => FileItem[];
|
|
1778
|
+
|
|
1779
|
+
interface FileCardProps {
|
|
1780
|
+
item: FileItem;
|
|
1781
|
+
variant?: 'grid' | 'list';
|
|
1782
|
+
}
|
|
1783
|
+
declare const FileCard: React$1.FC<FileCardProps>;
|
|
1784
|
+
|
|
1785
|
+
declare const FolderTree: React$1.FC;
|
|
1786
|
+
|
|
1787
|
+
declare const FileGrid: React$1.FC;
|
|
1788
|
+
|
|
1789
|
+
declare const FileList: React$1.FC;
|
|
1790
|
+
|
|
1791
|
+
declare const Breadcrumb: React$1.FC;
|
|
1792
|
+
|
|
1793
|
+
declare const Toolbar: React$1.FC;
|
|
1794
|
+
|
|
1795
|
+
declare const ContextMenu: React$1.FC;
|
|
1564
1796
|
|
|
1565
1797
|
interface PrintPreviewProps {
|
|
1566
1798
|
/** Contenu à imprimer */
|
|
@@ -1871,4 +2103,4 @@ declare const WorkSpaceRoutes: React.FC<{
|
|
|
1871
2103
|
module_description: string;
|
|
1872
2104
|
}>;
|
|
1873
2105
|
|
|
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 };
|
|
2106
|
+
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, 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
|
@@ -1019,6 +1019,8 @@ interface FileManagerProps {
|
|
|
1019
1019
|
onDownload?: (item: FileItem) => void;
|
|
1020
1020
|
onSelect?: (items: FileItem[]) => void;
|
|
1021
1021
|
onOpen?: (item: FileItem) => void;
|
|
1022
|
+
/** Callback pour rafraîchir les données */
|
|
1023
|
+
onRefresh?: () => Promise<void>;
|
|
1022
1024
|
viewMode?: ViewMode;
|
|
1023
1025
|
allowMultiSelect?: boolean;
|
|
1024
1026
|
allowUpload?: boolean;
|
|
@@ -1045,11 +1047,19 @@ interface FileManagerTexts {
|
|
|
1045
1047
|
dropFilesHere?: string;
|
|
1046
1048
|
cancel?: string;
|
|
1047
1049
|
confirm?: string;
|
|
1050
|
+
refresh?: string;
|
|
1048
1051
|
}
|
|
1049
1052
|
interface ContextMenuPosition {
|
|
1050
1053
|
x: number;
|
|
1051
1054
|
y: number;
|
|
1052
1055
|
}
|
|
1056
|
+
interface ContextMenuAction {
|
|
1057
|
+
label: string;
|
|
1058
|
+
icon?: ReactNode;
|
|
1059
|
+
onClick: () => void;
|
|
1060
|
+
disabled?: boolean;
|
|
1061
|
+
danger?: boolean;
|
|
1062
|
+
}
|
|
1053
1063
|
interface FileManagerContextValue {
|
|
1054
1064
|
data: FileItem[];
|
|
1055
1065
|
currentFolder: FileItem | null;
|
|
@@ -1081,6 +1091,7 @@ interface FileManagerContextValue {
|
|
|
1081
1091
|
onDelete?: (item: FileItem) => Promise<void>;
|
|
1082
1092
|
onDownload?: (item: FileItem) => void;
|
|
1083
1093
|
onOpen?: (item: FileItem) => void;
|
|
1094
|
+
onRefresh?: () => Promise<void>;
|
|
1084
1095
|
allowUpload: boolean;
|
|
1085
1096
|
allowCreateFolder: boolean;
|
|
1086
1097
|
allowRename: boolean;
|
|
@@ -1274,6 +1285,124 @@ declare const FileManager: React$1.FC<FileManagerProps>;
|
|
|
1274
1285
|
*/
|
|
1275
1286
|
declare const EntityFileManager: React$1.FC<EntityFileManagerProps>;
|
|
1276
1287
|
|
|
1288
|
+
/**
|
|
1289
|
+
* RootFileManager - FileManager intégré pour l'arborescence ROOT d'un BusinessEntity.
|
|
1290
|
+
*
|
|
1291
|
+
* Ce composant affiche l'intégralité de l'arborescence GED d'un BusinessEntity,
|
|
1292
|
+
* incluant toutes les catégories (Clients, Fournisseurs, RFQ, etc.) et leurs contenus.
|
|
1293
|
+
*
|
|
1294
|
+
* DIFFÉRENCE AVEC EntityFileManager :
|
|
1295
|
+
* ===================================
|
|
1296
|
+
* - EntityFileManager : Affiche les dossiers d'une entité spécifique (Client, Vendor, etc.)
|
|
1297
|
+
* - RootFileManager : Affiche TOUTE l'arborescence depuis ROOT
|
|
1298
|
+
*
|
|
1299
|
+
* STRUCTURE AFFICHÉE :
|
|
1300
|
+
* ====================
|
|
1301
|
+
* 📁 [Nom du BusinessEntity]
|
|
1302
|
+
* ├── 📁 Clients
|
|
1303
|
+
* │ └── 📁 CLI_Client ABC
|
|
1304
|
+
* │ └── 📁 Contrats, Factures, etc.
|
|
1305
|
+
* ├── 📁 Fournisseurs
|
|
1306
|
+
* │ └── 📁 FRN_Fournisseur XYZ
|
|
1307
|
+
* │ └── ...
|
|
1308
|
+
* ├── 📁 Appels d'offres
|
|
1309
|
+
* │ └── ...
|
|
1310
|
+
* └── 📁 Documents généraux
|
|
1311
|
+
*
|
|
1312
|
+
* EXEMPLE D'UTILISATION :
|
|
1313
|
+
* =======================
|
|
1314
|
+
* ```tsx
|
|
1315
|
+
* <RootFileManager
|
|
1316
|
+
* businessEntityId={entity.id}
|
|
1317
|
+
* height="600px"
|
|
1318
|
+
* allowUpload={true}
|
|
1319
|
+
* allowCreateFolder={true}
|
|
1320
|
+
* />
|
|
1321
|
+
* ```
|
|
1322
|
+
*/
|
|
1323
|
+
|
|
1324
|
+
interface RootFileManagerProps {
|
|
1325
|
+
/** ID du BusinessEntity */
|
|
1326
|
+
businessEntityId: number | string;
|
|
1327
|
+
/** Hauteur du composant (CSS) */
|
|
1328
|
+
height?: string;
|
|
1329
|
+
/** Autoriser l'upload de fichiers */
|
|
1330
|
+
allowUpload?: boolean;
|
|
1331
|
+
/** Autoriser la création de dossiers */
|
|
1332
|
+
allowCreateFolder?: boolean;
|
|
1333
|
+
/** Autoriser le renommage */
|
|
1334
|
+
allowRename?: boolean;
|
|
1335
|
+
/** Autoriser la suppression */
|
|
1336
|
+
allowDelete?: boolean;
|
|
1337
|
+
/** Autoriser le téléchargement */
|
|
1338
|
+
allowDownload?: boolean;
|
|
1339
|
+
/** Callback lors de la sélection de fichiers */
|
|
1340
|
+
onFileSelect?: (files: FileItem[]) => void;
|
|
1341
|
+
/** Callback lors de l'ouverture d'un fichier */
|
|
1342
|
+
onFileOpen?: (file: FileItem) => void;
|
|
1343
|
+
/** Callback après upload réussi */
|
|
1344
|
+
onUploadSuccess?: (files: FileItem[]) => void;
|
|
1345
|
+
/** Callback en cas d'erreur */
|
|
1346
|
+
onError?: (error: Error) => void;
|
|
1347
|
+
}
|
|
1348
|
+
declare const RootFileManager: React$1.FC<RootFileManagerProps>;
|
|
1349
|
+
|
|
1350
|
+
/**
|
|
1351
|
+
* AttachmentUploader - Composant simplifié pour attacher des fichiers à un objet
|
|
1352
|
+
*
|
|
1353
|
+
* Utilisation:
|
|
1354
|
+
* ```tsx
|
|
1355
|
+
* // Avec sélection de dossier dynamique (recommandé)
|
|
1356
|
+
* <AttachmentUploader
|
|
1357
|
+
* model="accounting.FundCall"
|
|
1358
|
+
* objectId={fundCall.id}
|
|
1359
|
+
* businessEntityId={businessEntity.id}
|
|
1360
|
+
* linkType="attachment"
|
|
1361
|
+
* onUploadSuccess={(files) => console.log('Uploaded:', files)}
|
|
1362
|
+
* />
|
|
1363
|
+
*
|
|
1364
|
+
* // Avec dossier fixe
|
|
1365
|
+
* <AttachmentUploader
|
|
1366
|
+
* model="accounting.FundCall"
|
|
1367
|
+
* objectId={fundCall.id}
|
|
1368
|
+
* folderCode="FO000123"
|
|
1369
|
+
* linkType="attachment"
|
|
1370
|
+
* />
|
|
1371
|
+
* ```
|
|
1372
|
+
*/
|
|
1373
|
+
|
|
1374
|
+
interface AttachmentUploaderProps {
|
|
1375
|
+
/** Chemin du modèle Django (ex: 'accounting.FundCall') */
|
|
1376
|
+
model: string;
|
|
1377
|
+
/** ID de l'objet à lier */
|
|
1378
|
+
objectId: number | string;
|
|
1379
|
+
/** ID du BusinessEntity (pour le sélecteur de dossier dynamique) */
|
|
1380
|
+
businessEntityId?: number | string;
|
|
1381
|
+
/** Code du dossier où uploader (optionnel si businessEntityId est fourni) */
|
|
1382
|
+
folderCode?: string;
|
|
1383
|
+
/** Code du dossier de départ pour la navigation (optionnel, root par défaut) */
|
|
1384
|
+
startingFolderCode?: string;
|
|
1385
|
+
/** Type de liaison (défaut: 'attachment') */
|
|
1386
|
+
linkType?: string;
|
|
1387
|
+
/** Titre affiché (défaut: 'Pièces jointes') */
|
|
1388
|
+
title?: string;
|
|
1389
|
+
/** Autoriser l'upload (défaut: true) */
|
|
1390
|
+
allowUpload?: boolean;
|
|
1391
|
+
/** Autoriser la suppression (défaut: true) */
|
|
1392
|
+
allowDelete?: boolean;
|
|
1393
|
+
/** Autoriser la création de dossiers (défaut: true) */
|
|
1394
|
+
allowCreateFolder?: boolean;
|
|
1395
|
+
/** Types de fichiers acceptés */
|
|
1396
|
+
accept?: string;
|
|
1397
|
+
/** Callback après upload réussi */
|
|
1398
|
+
onUploadSuccess?: (files: BackendFile[]) => void;
|
|
1399
|
+
/** Callback en cas d'erreur */
|
|
1400
|
+
onError?: (error: Error) => void;
|
|
1401
|
+
/** Classes CSS additionnelles */
|
|
1402
|
+
className?: string;
|
|
1403
|
+
}
|
|
1404
|
+
declare const AttachmentUploader: React$1.FC<AttachmentUploaderProps>;
|
|
1405
|
+
|
|
1277
1406
|
declare const useFileManager: () => FileManagerContextValue;
|
|
1278
1407
|
interface FileManagerProviderProps extends FileManagerProps {
|
|
1279
1408
|
children: React$1.ReactNode;
|
|
@@ -1338,6 +1467,81 @@ declare const FileManagerProvider: React$1.FC<FileManagerProviderProps>;
|
|
|
1338
1467
|
*/
|
|
1339
1468
|
declare function useFileManagerApi(entityType: EntityType, entityId: string | number, businessEntityId: string | number): UseFileManagerApiReturn;
|
|
1340
1469
|
|
|
1470
|
+
/**
|
|
1471
|
+
* Hook pour intégrer le FileManager avec l'arborescence ROOT d'un BusinessEntity.
|
|
1472
|
+
*
|
|
1473
|
+
* Ce hook charge l'intégralité de l'arborescence GED depuis le dossier ROOT,
|
|
1474
|
+
* incluant toutes les catégories (Clients, Fournisseurs, RFQ, etc.) et leurs sous-dossiers.
|
|
1475
|
+
*
|
|
1476
|
+
* DIFFÉRENCE AVEC useFileManagerApi :
|
|
1477
|
+
* ===================================
|
|
1478
|
+
* - useFileManagerApi : Charge les dossiers d'une entité spécifique (Client, Vendor, etc.)
|
|
1479
|
+
* - useRootFileManagerApi : Charge TOUTE l'arborescence depuis ROOT
|
|
1480
|
+
*
|
|
1481
|
+
* STRUCTURE CHARGÉE :
|
|
1482
|
+
* ===================
|
|
1483
|
+
* 📁 ROOT (BusinessEntity)
|
|
1484
|
+
* ├── 📁 Clients (CATEGORY)
|
|
1485
|
+
* │ └── 📁 CLI_Client ABC (ENTITY)
|
|
1486
|
+
* │ └── ...
|
|
1487
|
+
* ├── 📁 Fournisseurs (CATEGORY)
|
|
1488
|
+
* │ └── ...
|
|
1489
|
+
* ├── 📁 Appels d'offres (CATEGORY)
|
|
1490
|
+
* │ └── ...
|
|
1491
|
+
* └── 📁 Documents généraux (CATEGORY)
|
|
1492
|
+
*
|
|
1493
|
+
* EXEMPLE D'UTILISATION :
|
|
1494
|
+
* =======================
|
|
1495
|
+
* ```tsx
|
|
1496
|
+
* const { data, loading, error, handlers, rootName } = useRootFileManagerApi(
|
|
1497
|
+
* businessEntity.id
|
|
1498
|
+
* );
|
|
1499
|
+
*
|
|
1500
|
+
* if (loading) return <Spinner />;
|
|
1501
|
+
* if (error) return <Error message={error.message} />;
|
|
1502
|
+
*
|
|
1503
|
+
* return (
|
|
1504
|
+
* <FileManager
|
|
1505
|
+
* data={data}
|
|
1506
|
+
* rootName={rootName}
|
|
1507
|
+
* onCreateFolder={handlers.onCreateFolder}
|
|
1508
|
+
* onUploadFiles={handlers.onUploadFiles}
|
|
1509
|
+
* ...
|
|
1510
|
+
* />
|
|
1511
|
+
* );
|
|
1512
|
+
* ```
|
|
1513
|
+
*/
|
|
1514
|
+
|
|
1515
|
+
interface UseRootFileManagerApiReturn {
|
|
1516
|
+
/** Données transformées pour le FileManager */
|
|
1517
|
+
data: FileItem[];
|
|
1518
|
+
/** État de chargement */
|
|
1519
|
+
loading: boolean;
|
|
1520
|
+
/** Erreur éventuelle */
|
|
1521
|
+
error: Error | null;
|
|
1522
|
+
/** Code du dossier ROOT */
|
|
1523
|
+
rootFolderCode: string | null;
|
|
1524
|
+
/** Nom du dossier ROOT (nom du BusinessEntity) */
|
|
1525
|
+
rootName: string;
|
|
1526
|
+
/** Rafraîchir les données */
|
|
1527
|
+
refresh: () => Promise<void>;
|
|
1528
|
+
/** Handlers pour le FileManager */
|
|
1529
|
+
handlers: {
|
|
1530
|
+
onCreateFolder: (name: string, parentId: string) => Promise<FileItem | void>;
|
|
1531
|
+
onUploadFiles: (files: File[], parentId: string) => Promise<FileItem[] | void>;
|
|
1532
|
+
onRename: (item: FileItem, newName: string) => Promise<void>;
|
|
1533
|
+
onDelete: (item: FileItem) => Promise<void>;
|
|
1534
|
+
onDownload: (item: FileItem) => void;
|
|
1535
|
+
};
|
|
1536
|
+
}
|
|
1537
|
+
/**
|
|
1538
|
+
* Hook pour gérer l'intégration FileManager avec l'arborescence ROOT.
|
|
1539
|
+
*
|
|
1540
|
+
* @param businessEntityId - ID du BusinessEntity
|
|
1541
|
+
* @returns État et handlers pour le FileManager
|
|
1542
|
+
*/
|
|
1543
|
+
declare function useRootFileManagerApi(businessEntityId: string | number): UseRootFileManagerApiReturn;
|
|
1544
|
+
|
|
1341
1545
|
/**
|
|
1342
1546
|
* Service API pour la GED (Gestion Électronique de Documents).
|
|
1343
1547
|
*
|
|
@@ -1559,8 +1763,36 @@ declare const fileManagerApi: {
|
|
|
1559
1763
|
};
|
|
1560
1764
|
|
|
1561
1765
|
declare const getFileIcon: (mimeType?: string, isFolder?: boolean, isOpen?: boolean) => LucideIcon;
|
|
1766
|
+
/**
|
|
1767
|
+
* Retourne la classe de couleur Tailwind pour un type de fichier
|
|
1768
|
+
*/
|
|
1769
|
+
declare const getFileIconColor: (mimeType?: string, isFolder?: boolean) => string;
|
|
1770
|
+
declare const getMimeTypeFromExtension: (filename: string) => string;
|
|
1562
1771
|
declare const formatFileSize: (bytes?: number) => string;
|
|
1563
1772
|
declare const formatDate: (date?: Date | string) => string;
|
|
1773
|
+
declare const formatDateTime: (date?: Date | string) => string;
|
|
1774
|
+
declare const isImageFile: (mimeType?: string) => boolean;
|
|
1775
|
+
declare const getFileExtension: (filename: string) => string;
|
|
1776
|
+
declare const findFolderById: (items: FileItem[], id: string) => FileItem | null;
|
|
1777
|
+
declare const getAllFolders: (items: FileItem[]) => FileItem[];
|
|
1778
|
+
|
|
1779
|
+
interface FileCardProps {
|
|
1780
|
+
item: FileItem;
|
|
1781
|
+
variant?: 'grid' | 'list';
|
|
1782
|
+
}
|
|
1783
|
+
declare const FileCard: React$1.FC<FileCardProps>;
|
|
1784
|
+
|
|
1785
|
+
declare const FolderTree: React$1.FC;
|
|
1786
|
+
|
|
1787
|
+
declare const FileGrid: React$1.FC;
|
|
1788
|
+
|
|
1789
|
+
declare const FileList: React$1.FC;
|
|
1790
|
+
|
|
1791
|
+
declare const Breadcrumb: React$1.FC;
|
|
1792
|
+
|
|
1793
|
+
declare const Toolbar: React$1.FC;
|
|
1794
|
+
|
|
1795
|
+
declare const ContextMenu: React$1.FC;
|
|
1564
1796
|
|
|
1565
1797
|
interface PrintPreviewProps {
|
|
1566
1798
|
/** Contenu à imprimer */
|
|
@@ -1871,4 +2103,4 @@ declare const WorkSpaceRoutes: React.FC<{
|
|
|
1871
2103
|
module_description: string;
|
|
1872
2104
|
}>;
|
|
1873
2105
|
|
|
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 };
|
|
2106
|
+
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, 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 };
|