ptechcore_ui 1.0.25 → 1.0.29
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 +648 -38
- package/dist/index.d.cts +471 -1
- package/dist/index.d.ts +471 -1
- package/dist/index.js +643 -38
- package/package.json +57 -55
package/dist/index.d.cts
CHANGED
|
@@ -15,6 +15,7 @@ interface ModalProps {
|
|
|
15
15
|
title: string;
|
|
16
16
|
description?: string;
|
|
17
17
|
width?: string;
|
|
18
|
+
minContentHeight?: string;
|
|
18
19
|
open: boolean;
|
|
19
20
|
onClose: () => void;
|
|
20
21
|
children: React$1.ReactNode;
|
|
@@ -88,6 +89,12 @@ declare const RewiseLayout: React$1.FC<PrivateLayoutProps>;
|
|
|
88
89
|
|
|
89
90
|
declare const ToastContainer: React$1.FC;
|
|
90
91
|
|
|
92
|
+
interface TrackableModel {
|
|
93
|
+
id?: number | null;
|
|
94
|
+
created_at?: string;
|
|
95
|
+
updated_at?: string;
|
|
96
|
+
}
|
|
97
|
+
|
|
91
98
|
interface Module$1 {
|
|
92
99
|
id: number;
|
|
93
100
|
code: string;
|
|
@@ -249,6 +256,7 @@ interface Vendor {
|
|
|
249
256
|
interface SessionContextType {
|
|
250
257
|
isAuthenticated: boolean;
|
|
251
258
|
token: string | null;
|
|
259
|
+
setToken: (token: string | null) => void;
|
|
252
260
|
activeBusinessEntity: Entity | null;
|
|
253
261
|
setActiveBusinessEntity: (entity: Entity | null) => void;
|
|
254
262
|
loggedUser: User | null;
|
|
@@ -256,6 +264,7 @@ interface SessionContextType {
|
|
|
256
264
|
logout: () => void;
|
|
257
265
|
showAuthModal: boolean;
|
|
258
266
|
setShowAuthModal: (data: boolean) => void;
|
|
267
|
+
refreshSession: () => Promise<void>;
|
|
259
268
|
vendors: Vendor[];
|
|
260
269
|
setVendors: (vendors: Vendor[]) => void;
|
|
261
270
|
loadingVendors: boolean;
|
|
@@ -556,6 +565,46 @@ declare const ApprovalServices: {
|
|
|
556
565
|
}>;
|
|
557
566
|
};
|
|
558
567
|
|
|
568
|
+
type UnitOccupancyStatus = 'occupiable' | 'non_occupiable' | 'in_negociated' | 'indeterminate';
|
|
569
|
+
type UnitStatus = 'long rental' | 'short rental' | 'other' | 'draft' | 'active';
|
|
570
|
+
type UnitDestination = 'Nl' | 'L';
|
|
571
|
+
type UnitArchived = 'archived' | 'not_archived';
|
|
572
|
+
interface Unit extends TrackableModel {
|
|
573
|
+
name?: string | null;
|
|
574
|
+
code?: string | null;
|
|
575
|
+
location?: string | null;
|
|
576
|
+
object_name?: string | null;
|
|
577
|
+
unit_description?: string | null;
|
|
578
|
+
unit_comment?: string | null;
|
|
579
|
+
area_gla?: number | null;
|
|
580
|
+
area_gfa?: number | null;
|
|
581
|
+
area_gfa_mezz?: number | null;
|
|
582
|
+
area_m_2?: number | null;
|
|
583
|
+
area_m_2_mezz?: number | null;
|
|
584
|
+
height?: number | null;
|
|
585
|
+
width?: number | null;
|
|
586
|
+
length?: number | null;
|
|
587
|
+
unit_destination?: UnitDestination;
|
|
588
|
+
no_leasable_occupancy_status?: string;
|
|
589
|
+
area_category?: string | null;
|
|
590
|
+
detail_cat?: string | null;
|
|
591
|
+
zoning?: number | null;
|
|
592
|
+
drawing?: string | null;
|
|
593
|
+
archived?: UnitArchived;
|
|
594
|
+
unit_start_date?: string | null;
|
|
595
|
+
unit_end_date?: string | null;
|
|
596
|
+
occupancy_status?: UnitOccupancyStatus;
|
|
597
|
+
status?: UnitStatus;
|
|
598
|
+
}
|
|
599
|
+
|
|
600
|
+
declare const UnitServices: {
|
|
601
|
+
create: (data: Partial<Unit>) => Promise<unknown>;
|
|
602
|
+
get: (id: number) => Promise<unknown>;
|
|
603
|
+
list: (params?: any) => Promise<unknown>;
|
|
604
|
+
update: (id: number, data: Partial<Unit>) => Promise<unknown>;
|
|
605
|
+
delete: (id: number) => Promise<unknown>;
|
|
606
|
+
};
|
|
607
|
+
|
|
559
608
|
type ImportField = {
|
|
560
609
|
value: string;
|
|
561
610
|
label: string;
|
|
@@ -678,6 +727,7 @@ declare const SelectVendor: React.FC<SelectProps$1>;
|
|
|
678
727
|
declare const SelectUser: React.FC<SelectProps$1>;
|
|
679
728
|
declare const SelectDepartment: React.FC<SelectProps$1>;
|
|
680
729
|
declare const SelectCostCenter: React.FC<SelectProps$1>;
|
|
730
|
+
declare const SelectUnit: React.FC<SelectProps$1>;
|
|
681
731
|
|
|
682
732
|
interface SelectProps {
|
|
683
733
|
value?: any;
|
|
@@ -852,17 +902,437 @@ interface FileManagerContextValue {
|
|
|
852
902
|
allowMultiSelect: boolean;
|
|
853
903
|
texts: Required<FileManagerTexts>;
|
|
854
904
|
}
|
|
905
|
+
/**
|
|
906
|
+
* Types d'entités supportées par la GED.
|
|
907
|
+
*
|
|
908
|
+
* Chaque type correspond à un modèle Django backend :
|
|
909
|
+
* - CLIENT → accounting.models.Client
|
|
910
|
+
* - VENDOR → accounting.models.Vendor
|
|
911
|
+
* - RFQ → procurement.models.RFQ
|
|
912
|
+
* - DEPT → core.models.Departments
|
|
913
|
+
* - PROJECT → core.models.Project
|
|
914
|
+
*
|
|
915
|
+
* POUR AJOUTER UN NOUVEAU TYPE :
|
|
916
|
+
* 1. Ajouter le type ici
|
|
917
|
+
* 2. Mettre à jour ENTITY_MODEL_MAP dans fileManagerApi.ts
|
|
918
|
+
* 3. Mettre à jour getRootName dans EntityFileManager.tsx
|
|
919
|
+
*/
|
|
920
|
+
type EntityType = 'CLIENT' | 'VENDOR' | 'RFQ' | 'DEPT' | 'PROJECT';
|
|
921
|
+
/**
|
|
922
|
+
* Structure d'un dossier retourné par l'API backend.
|
|
923
|
+
* Correspond au FolderTreeSerializer Django.
|
|
924
|
+
*/
|
|
925
|
+
interface BackendFolder {
|
|
926
|
+
id: number;
|
|
927
|
+
code: string;
|
|
928
|
+
name: string;
|
|
929
|
+
folder_type: string;
|
|
930
|
+
folder_type_display: string;
|
|
931
|
+
category_type?: string;
|
|
932
|
+
is_system_folder: boolean;
|
|
933
|
+
file_count: number;
|
|
934
|
+
total_size?: number;
|
|
935
|
+
children?: BackendFolder[];
|
|
936
|
+
files?: BackendFile[];
|
|
937
|
+
}
|
|
938
|
+
/**
|
|
939
|
+
* Structure d'un fichier retourné par l'API backend.
|
|
940
|
+
* Correspond au FileListSerializer Django.
|
|
941
|
+
*/
|
|
942
|
+
interface BackendFile {
|
|
943
|
+
id: number;
|
|
944
|
+
code: string;
|
|
945
|
+
name: string;
|
|
946
|
+
file_url: string;
|
|
947
|
+
size: number;
|
|
948
|
+
mime_type: string;
|
|
949
|
+
extension: string;
|
|
950
|
+
folder: number;
|
|
951
|
+
folder_name?: string;
|
|
952
|
+
created_at: string;
|
|
953
|
+
updated_at?: string;
|
|
954
|
+
created_by?: string;
|
|
955
|
+
}
|
|
956
|
+
/**
|
|
957
|
+
* Props pour le composant EntityFileManager.
|
|
958
|
+
*
|
|
959
|
+
* Ce composant est un wrapper qui intègre FileManager avec l'API backend GED.
|
|
960
|
+
* Il charge automatiquement les dossiers de l'entité et gère les opérations CRUD.
|
|
961
|
+
*
|
|
962
|
+
* EXEMPLE D'UTILISATION :
|
|
963
|
+
* ```tsx
|
|
964
|
+
* <EntityFileManager
|
|
965
|
+
* entityType="VENDOR"
|
|
966
|
+
* entityId={vendor.id}
|
|
967
|
+
* businessEntityId={businessEntity.id}
|
|
968
|
+
* onFileSelect={(files) => console.log('Sélection:', files)}
|
|
969
|
+
* />
|
|
970
|
+
* ```
|
|
971
|
+
*/
|
|
972
|
+
interface EntityFileManagerProps {
|
|
973
|
+
/** Type d'entité (CLIENT, VENDOR, RFQ, DEPT, PROJECT) */
|
|
974
|
+
entityType: EntityType;
|
|
975
|
+
/** ID de l'entité */
|
|
976
|
+
entityId: number | string;
|
|
977
|
+
/** ID du BusinessEntity (pour le contexte) */
|
|
978
|
+
businessEntityId: number | string;
|
|
979
|
+
/** Classes CSS additionnelles */
|
|
980
|
+
className?: string;
|
|
981
|
+
/** Hauteur du composant (défaut: '600px') */
|
|
982
|
+
height?: string;
|
|
983
|
+
/** Autoriser l'upload de fichiers (défaut: true) */
|
|
984
|
+
allowUpload?: boolean;
|
|
985
|
+
/** Autoriser la création de dossiers (défaut: true) */
|
|
986
|
+
allowCreateFolder?: boolean;
|
|
987
|
+
/** Autoriser le renommage (défaut: true) */
|
|
988
|
+
allowRename?: boolean;
|
|
989
|
+
/** Autoriser la suppression (défaut: true) */
|
|
990
|
+
allowDelete?: boolean;
|
|
991
|
+
/** Autoriser le téléchargement (défaut: true) */
|
|
992
|
+
allowDownload?: boolean;
|
|
993
|
+
/** Appelé quand l'utilisateur sélectionne des fichiers */
|
|
994
|
+
onFileSelect?: (files: FileItem[]) => void;
|
|
995
|
+
/** Appelé quand l'utilisateur ouvre un fichier */
|
|
996
|
+
onFileOpen?: (file: FileItem) => void;
|
|
997
|
+
/** Appelé après un upload réussi */
|
|
998
|
+
onUploadSuccess?: (files: FileItem[]) => void;
|
|
999
|
+
/** Appelé en cas d'erreur */
|
|
1000
|
+
onError?: (error: Error) => void;
|
|
1001
|
+
}
|
|
1002
|
+
/**
|
|
1003
|
+
* Valeur retournée par le hook useFileManagerApi.
|
|
1004
|
+
*/
|
|
1005
|
+
interface UseFileManagerApiReturn {
|
|
1006
|
+
/** Données transformées pour FileManager */
|
|
1007
|
+
data: FileItem[];
|
|
1008
|
+
/** État de chargement */
|
|
1009
|
+
loading: boolean;
|
|
1010
|
+
/** Erreur éventuelle */
|
|
1011
|
+
error: Error | null;
|
|
1012
|
+
/** Code du dossier racine de l'entité */
|
|
1013
|
+
rootFolderCode: string | null;
|
|
1014
|
+
/** Rafraîchir les données */
|
|
1015
|
+
refresh: () => Promise<void>;
|
|
1016
|
+
/** Handlers pour FileManager */
|
|
1017
|
+
handlers: {
|
|
1018
|
+
onCreateFolder: (name: string, parentId: string) => Promise<FileItem | void>;
|
|
1019
|
+
onUploadFiles: (files: File[], parentId: string) => Promise<FileItem[] | void>;
|
|
1020
|
+
onRename: (item: FileItem, newName: string) => Promise<void>;
|
|
1021
|
+
onDelete: (item: FileItem) => Promise<void>;
|
|
1022
|
+
onDownload: (item: FileItem) => void;
|
|
1023
|
+
};
|
|
1024
|
+
}
|
|
855
1025
|
|
|
856
1026
|
declare const FileManager: React$1.FC<FileManagerProps>;
|
|
857
1027
|
|
|
1028
|
+
/**
|
|
1029
|
+
* EntityFileManager - FileManager scopé à une entité métier.
|
|
1030
|
+
*
|
|
1031
|
+
* Ce composant encapsule le FileManager générique et l'intègre avec l'API
|
|
1032
|
+
* backend GED pour afficher les documents d'une entité spécifique
|
|
1033
|
+
* (Client, Vendor, RFQ, Département, Projet).
|
|
1034
|
+
*
|
|
1035
|
+
* FONCTIONNALITÉS :
|
|
1036
|
+
* =================
|
|
1037
|
+
* - Charge automatiquement les dossiers de l'entité au montage
|
|
1038
|
+
* - Navigation limitée au dossier racine de l'entité (scopé)
|
|
1039
|
+
* - Gestion des états loading/error/empty
|
|
1040
|
+
* - Opérations CRUD complètes (upload, création, renommage, suppression)
|
|
1041
|
+
* - Permissions configurables
|
|
1042
|
+
*
|
|
1043
|
+
* ARCHITECTURE :
|
|
1044
|
+
* ==============
|
|
1045
|
+
* EntityFileManager
|
|
1046
|
+
* └── useFileManagerApi (hook)
|
|
1047
|
+
* └── fileManagerApi (service)
|
|
1048
|
+
* └── API Backend Django
|
|
1049
|
+
*
|
|
1050
|
+
* EXEMPLE D'UTILISATION :
|
|
1051
|
+
* =======================
|
|
1052
|
+
* ```tsx
|
|
1053
|
+
* // Dans la vue d'un Vendor
|
|
1054
|
+
* <EntityFileManager
|
|
1055
|
+
* entityType="VENDOR"
|
|
1056
|
+
* entityId={vendor.id}
|
|
1057
|
+
* businessEntityId={businessEntity.id}
|
|
1058
|
+
* />
|
|
1059
|
+
*
|
|
1060
|
+
* // Avec permissions limitées (lecture seule)
|
|
1061
|
+
* <EntityFileManager
|
|
1062
|
+
* entityType="CLIENT"
|
|
1063
|
+
* entityId={client.id}
|
|
1064
|
+
* businessEntityId={businessEntity.id}
|
|
1065
|
+
* allowUpload={false}
|
|
1066
|
+
* allowCreateFolder={false}
|
|
1067
|
+
* allowRename={false}
|
|
1068
|
+
* allowDelete={false}
|
|
1069
|
+
* />
|
|
1070
|
+
*
|
|
1071
|
+
* // Avec callbacks personnalisés
|
|
1072
|
+
* <EntityFileManager
|
|
1073
|
+
* entityType="RFQ"
|
|
1074
|
+
* entityId={rfq.id}
|
|
1075
|
+
* businessEntityId={businessEntity.id}
|
|
1076
|
+
* onFileSelect={(files) => console.log('Sélection:', files)}
|
|
1077
|
+
* onFileOpen={(file) => openPreview(file)}
|
|
1078
|
+
* />
|
|
1079
|
+
* ```
|
|
1080
|
+
*/
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* FileManager scopé à une entité métier.
|
|
1084
|
+
*
|
|
1085
|
+
* Ce composant charge automatiquement les dossiers de l'entité et fournit
|
|
1086
|
+
* une interface complète pour la gestion des documents.
|
|
1087
|
+
*/
|
|
1088
|
+
declare const EntityFileManager: React$1.FC<EntityFileManagerProps>;
|
|
1089
|
+
|
|
858
1090
|
declare const useFileManager: () => FileManagerContextValue;
|
|
859
1091
|
interface FileManagerProviderProps extends FileManagerProps {
|
|
860
1092
|
children: React$1.ReactNode;
|
|
861
1093
|
}
|
|
862
1094
|
declare const FileManagerProvider: React$1.FC<FileManagerProviderProps>;
|
|
863
1095
|
|
|
1096
|
+
/**
|
|
1097
|
+
* Hook pour intégrer le FileManager avec l'API backend GED.
|
|
1098
|
+
*
|
|
1099
|
+
* Ce hook gère :
|
|
1100
|
+
* - Le chargement des données depuis l'API
|
|
1101
|
+
* - La transformation des données backend → frontend
|
|
1102
|
+
* - Les opérations CRUD (création, renommage, suppression, upload)
|
|
1103
|
+
* - Le rafraîchissement des données après mutation
|
|
1104
|
+
*
|
|
1105
|
+
* ARCHITECTURE :
|
|
1106
|
+
* ==============
|
|
1107
|
+
* 1. Chargement initial :
|
|
1108
|
+
* - Récupère les dossiers de l'entité via /folders/for_entity/
|
|
1109
|
+
* - Trouve le dossier ENTITY (racine de l'entité)
|
|
1110
|
+
* - Charge l'arborescence complète via /folders/{code}/tree/
|
|
1111
|
+
*
|
|
1112
|
+
* 2. Transformation :
|
|
1113
|
+
* - Convertit BackendFolder/BackendFile → FileItem
|
|
1114
|
+
* - Construit les chemins (path) récursivement
|
|
1115
|
+
* - Aplatit la structure pour le FileManager
|
|
1116
|
+
*
|
|
1117
|
+
* 3. Mutations :
|
|
1118
|
+
* - Chaque mutation rafraîchit les données après succès
|
|
1119
|
+
* - Les erreurs sont capturées et exposées via l'état error
|
|
1120
|
+
*
|
|
1121
|
+
* EXEMPLE D'UTILISATION :
|
|
1122
|
+
* =======================
|
|
1123
|
+
* ```tsx
|
|
1124
|
+
* const { data, loading, error, handlers } = useFileManagerApi(
|
|
1125
|
+
* 'VENDOR',
|
|
1126
|
+
* vendor.id,
|
|
1127
|
+
* businessEntity.id
|
|
1128
|
+
* );
|
|
1129
|
+
*
|
|
1130
|
+
* if (loading) return <Spinner />;
|
|
1131
|
+
* if (error) return <Error message={error.message} />;
|
|
1132
|
+
*
|
|
1133
|
+
* return (
|
|
1134
|
+
* <FileManager
|
|
1135
|
+
* data={data}
|
|
1136
|
+
* onCreateFolder={handlers.onCreateFolder}
|
|
1137
|
+
* onUploadFiles={handlers.onUploadFiles}
|
|
1138
|
+
* ...
|
|
1139
|
+
* />
|
|
1140
|
+
* );
|
|
1141
|
+
* ```
|
|
1142
|
+
*/
|
|
1143
|
+
|
|
1144
|
+
/**
|
|
1145
|
+
* Hook pour gérer l'intégration FileManager avec l'API GED.
|
|
1146
|
+
*
|
|
1147
|
+
* @param entityType - Type d'entité (CLIENT, VENDOR, RFQ, DEPT, PROJECT)
|
|
1148
|
+
* @param entityId - ID de l'entité
|
|
1149
|
+
* @param businessEntityId - ID du BusinessEntity
|
|
1150
|
+
* @returns État et handlers pour le FileManager
|
|
1151
|
+
*/
|
|
1152
|
+
declare function useFileManagerApi(entityType: EntityType, entityId: string | number, businessEntityId: string | number): UseFileManagerApiReturn;
|
|
1153
|
+
|
|
1154
|
+
/**
|
|
1155
|
+
* Service API pour la GED (Gestion Électronique de Documents).
|
|
1156
|
+
*
|
|
1157
|
+
* Ce service gère toutes les communications avec le backend Django files_manager.
|
|
1158
|
+
*
|
|
1159
|
+
* ENDPOINTS UTILISÉS :
|
|
1160
|
+
* ====================
|
|
1161
|
+
* - GET /api/files_manager/folders/for_entity/?model=...&id=... → Dossiers d'une entité
|
|
1162
|
+
* - GET /api/files_manager/folders/{code}/tree/ → Arborescence d'un dossier
|
|
1163
|
+
* - GET /api/files_manager/folders/{code}/ → Détails d'un dossier
|
|
1164
|
+
* - POST /api/files_manager/folders/ → Créer un dossier
|
|
1165
|
+
* - PUT /api/files_manager/folders/{code}/ → Modifier un dossier
|
|
1166
|
+
* - DELETE /api/files_manager/folders/{code}/ → Supprimer un dossier
|
|
1167
|
+
* - GET /api/files_manager/files/ → Liste des fichiers
|
|
1168
|
+
* - POST /api/files_manager/files/ → Upload un fichier
|
|
1169
|
+
* - PUT /api/files_manager/files/{code}/ → Modifier un fichier
|
|
1170
|
+
* - DELETE /api/files_manager/files/{code}/ → Supprimer un fichier
|
|
1171
|
+
*
|
|
1172
|
+
* POUR AJOUTER UN NOUVEAU TYPE D'ENTITÉ :
|
|
1173
|
+
* =======================================
|
|
1174
|
+
* 1. Ajouter le type dans EntityType (types.ts)
|
|
1175
|
+
* 2. Ajouter le mapping dans ENTITY_MODEL_MAP ci-dessous
|
|
1176
|
+
*/
|
|
1177
|
+
|
|
1178
|
+
/**
|
|
1179
|
+
* Récupère les dossiers d'une entité.
|
|
1180
|
+
*
|
|
1181
|
+
* Utilise l'endpoint /folders/for_entity/ pour récupérer tous les dossiers
|
|
1182
|
+
* associés à une entité spécifique (Client, Vendor, RFQ, etc.).
|
|
1183
|
+
*
|
|
1184
|
+
* @param entityType - Type d'entité (CLIENT, VENDOR, etc.)
|
|
1185
|
+
* @param entityId - ID de l'entité
|
|
1186
|
+
* @param folderType - Optionnel: filtrer par type de dossier
|
|
1187
|
+
* @returns Liste des dossiers
|
|
1188
|
+
*
|
|
1189
|
+
* @example
|
|
1190
|
+
* const folders = await fileManagerApi.getEntityFolders('VENDOR', 123);
|
|
1191
|
+
*/
|
|
1192
|
+
declare function getEntityFolders(entityType: EntityType, entityId: string | number, folderType?: string): Promise<BackendFolder[]>;
|
|
1193
|
+
/**
|
|
1194
|
+
* Récupère l'arborescence complète d'un dossier.
|
|
1195
|
+
*
|
|
1196
|
+
* Retourne le dossier avec tous ses sous-dossiers et fichiers
|
|
1197
|
+
* de manière récursive.
|
|
1198
|
+
*
|
|
1199
|
+
* @param folderCode - Code du dossier (ex: 'FO000001')
|
|
1200
|
+
* @returns Structure hiérarchique du dossier
|
|
1201
|
+
*
|
|
1202
|
+
* @example
|
|
1203
|
+
* const tree = await fileManagerApi.getFolderTree('FO000001');
|
|
1204
|
+
*/
|
|
1205
|
+
declare function getFolderTree(folderCode: string): Promise<BackendFolder>;
|
|
1206
|
+
/**
|
|
1207
|
+
* Récupère les détails d'un dossier.
|
|
1208
|
+
*
|
|
1209
|
+
* @param folderCode - Code du dossier
|
|
1210
|
+
* @returns Détails du dossier
|
|
1211
|
+
*/
|
|
1212
|
+
declare function getFolder(folderCode: string): Promise<BackendFolder>;
|
|
1213
|
+
/**
|
|
1214
|
+
* Crée un nouveau dossier.
|
|
1215
|
+
*
|
|
1216
|
+
* @param name - Nom du dossier
|
|
1217
|
+
* @param parentCode - Code du dossier parent
|
|
1218
|
+
* @param businessEntityId - ID du BusinessEntity
|
|
1219
|
+
* @returns Dossier créé
|
|
1220
|
+
*
|
|
1221
|
+
* @example
|
|
1222
|
+
* const folder = await fileManagerApi.createFolder('Mon dossier', 'FO000001', 1);
|
|
1223
|
+
*/
|
|
1224
|
+
declare function createFolder(name: string, parentCode: string, businessEntityId: string | number): Promise<BackendFolder>;
|
|
1225
|
+
/**
|
|
1226
|
+
* Renomme un dossier.
|
|
1227
|
+
*
|
|
1228
|
+
* @param folderCode - Code du dossier
|
|
1229
|
+
* @param newName - Nouveau nom
|
|
1230
|
+
* @returns Dossier mis à jour
|
|
1231
|
+
*/
|
|
1232
|
+
declare function renameFolder(folderCode: string, newName: string): Promise<BackendFolder>;
|
|
1233
|
+
/**
|
|
1234
|
+
* Supprime un dossier.
|
|
1235
|
+
*
|
|
1236
|
+
* Note: Un dossier système (is_system_folder=true) ne peut pas être supprimé.
|
|
1237
|
+
*
|
|
1238
|
+
* @param folderCode - Code du dossier à supprimer
|
|
1239
|
+
*/
|
|
1240
|
+
declare function deleteFolder(folderCode: string): Promise<void>;
|
|
1241
|
+
/**
|
|
1242
|
+
* Récupère les fichiers d'un dossier.
|
|
1243
|
+
*
|
|
1244
|
+
* @param folderId - ID du dossier
|
|
1245
|
+
* @returns Liste des fichiers
|
|
1246
|
+
*/
|
|
1247
|
+
declare function getFolderFiles(folderId: number | string): Promise<BackendFile[]>;
|
|
1248
|
+
/**
|
|
1249
|
+
* Upload un fichier dans un dossier.
|
|
1250
|
+
*
|
|
1251
|
+
* @param file - Fichier à uploader
|
|
1252
|
+
* @param folderCode - Code du dossier de destination
|
|
1253
|
+
* @param options - Options additionnelles (nom, description, tags)
|
|
1254
|
+
* @returns Fichier créé
|
|
1255
|
+
*
|
|
1256
|
+
* @example
|
|
1257
|
+
* const uploadedFile = await fileManagerApi.uploadFile(
|
|
1258
|
+
* file,
|
|
1259
|
+
* 'FO000001',
|
|
1260
|
+
* { name: 'Mon document.pdf', description: 'Contrat 2024' }
|
|
1261
|
+
* );
|
|
1262
|
+
*/
|
|
1263
|
+
declare function uploadFile(file: File, folderCode: string, options?: {
|
|
1264
|
+
name?: string;
|
|
1265
|
+
description?: string;
|
|
1266
|
+
tags?: string[];
|
|
1267
|
+
}): Promise<BackendFile>;
|
|
1268
|
+
/**
|
|
1269
|
+
* Upload plusieurs fichiers dans un dossier.
|
|
1270
|
+
*
|
|
1271
|
+
* @param files - Fichiers à uploader
|
|
1272
|
+
* @param folderCode - Code du dossier de destination
|
|
1273
|
+
* @returns Liste des fichiers créés
|
|
1274
|
+
*/
|
|
1275
|
+
declare function uploadFiles(files: File[], folderCode: string): Promise<BackendFile[]>;
|
|
1276
|
+
/**
|
|
1277
|
+
* Renomme un fichier.
|
|
1278
|
+
*
|
|
1279
|
+
* @param fileCode - Code du fichier
|
|
1280
|
+
* @param newName - Nouveau nom
|
|
1281
|
+
* @returns Fichier mis à jour
|
|
1282
|
+
*/
|
|
1283
|
+
declare function renameFile(fileCode: string, newName: string): Promise<BackendFile>;
|
|
1284
|
+
/**
|
|
1285
|
+
* Supprime un fichier.
|
|
1286
|
+
*
|
|
1287
|
+
* @param fileCode - Code du fichier à supprimer
|
|
1288
|
+
*/
|
|
1289
|
+
declare function deleteFile(fileCode: string): Promise<void>;
|
|
1290
|
+
/**
|
|
1291
|
+
* Construit l'URL de téléchargement d'un fichier.
|
|
1292
|
+
*
|
|
1293
|
+
* @param fileCode - Code du fichier
|
|
1294
|
+
* @returns URL de téléchargement
|
|
1295
|
+
*/
|
|
1296
|
+
declare function getDownloadUrl(fileCode: string): string;
|
|
1297
|
+
/**
|
|
1298
|
+
* Construit l'URL directe d'un fichier.
|
|
1299
|
+
*
|
|
1300
|
+
* @param fileUrl - URL relative du fichier depuis l'API
|
|
1301
|
+
* @returns URL complète
|
|
1302
|
+
*/
|
|
1303
|
+
declare function getFileUrl(fileUrl: string): string;
|
|
1304
|
+
/**
|
|
1305
|
+
* Service API pour la GED.
|
|
1306
|
+
*
|
|
1307
|
+
* @example
|
|
1308
|
+
* // Récupérer les dossiers d'un vendor
|
|
1309
|
+
* const folders = await fileManagerApi.getEntityFolders('VENDOR', vendorId);
|
|
1310
|
+
*
|
|
1311
|
+
* // Récupérer l'arborescence
|
|
1312
|
+
* const tree = await fileManagerApi.getFolderTree(folders[0].code);
|
|
1313
|
+
*
|
|
1314
|
+
* // Uploader un fichier
|
|
1315
|
+
* const file = await fileManagerApi.uploadFile(myFile, 'FO000001');
|
|
1316
|
+
*/
|
|
1317
|
+
declare const fileManagerApi: {
|
|
1318
|
+
getEntityFolders: typeof getEntityFolders;
|
|
1319
|
+
getFolderTree: typeof getFolderTree;
|
|
1320
|
+
getFolder: typeof getFolder;
|
|
1321
|
+
createFolder: typeof createFolder;
|
|
1322
|
+
renameFolder: typeof renameFolder;
|
|
1323
|
+
deleteFolder: typeof deleteFolder;
|
|
1324
|
+
getFolderFiles: typeof getFolderFiles;
|
|
1325
|
+
uploadFile: typeof uploadFile;
|
|
1326
|
+
uploadFiles: typeof uploadFiles;
|
|
1327
|
+
renameFile: typeof renameFile;
|
|
1328
|
+
deleteFile: typeof deleteFile;
|
|
1329
|
+
getDownloadUrl: typeof getDownloadUrl;
|
|
1330
|
+
getFileUrl: typeof getFileUrl;
|
|
1331
|
+
ENTITY_MODEL_MAP: Record<EntityType, string>;
|
|
1332
|
+
};
|
|
1333
|
+
|
|
864
1334
|
declare const getFileIcon: (mimeType?: string, isFolder?: boolean, isOpen?: boolean) => LucideIcon;
|
|
865
1335
|
declare const formatFileSize: (bytes?: number) => string;
|
|
866
1336
|
declare const formatDate: (date?: Date | string) => string;
|
|
867
1337
|
|
|
868
|
-
export { Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AuthServices, CHOICES, type ConfirmOptions, CountrySelector, DateInput, FDrawer, FetchApi, FileInput, type FileItem, FileManager, type FileManagerProps, FileManagerProvider, type FileManagerTexts, ForeignCurrencySelector, InputField, InvoiceTypeSelector, LegalFormSelector, type MenuItem, Modal, NumberInput, Pages, PaymentMethodSelector, PrimaryButton, RewiseLayout, SecondaryButton, SelectCostCenter, SelectDepartment, SelectInput, SelectUser, SelectVendor, SessionProvider, TaxSelector, TemplateFNESelector, TextInput, ThemeProvider, ToastContainer, ToastProvider, type User, UserServices, type ViewMode, formatDate, formatFileSize, getFileIcon, useAlert, useFileManager, useSession, useToast };
|
|
1338
|
+
export { Alert, AlertProvider, ApprovalAnswerModal, ApprovalAnswerPage, ApprovalPreviewAnswer, ApprovalServices, ApprovalWorkflow, AuthServices, type BackendFile, type BackendFolder, CHOICES, type ConfirmOptions, CountrySelector, DateInput, EntityFileManager, type EntityFileManagerProps, type EntityType, FDrawer, FetchApi, FileInput, type FileItem, FileManager, type FileManagerProps, FileManagerProvider, type FileManagerTexts, ForeignCurrencySelector, InputField, InvoiceTypeSelector, LegalFormSelector, type MenuItem, Modal, NumberInput, Pages, PaymentMethodSelector, PrimaryButton, RewiseLayout, SecondaryButton, SelectCostCenter, SelectDepartment, SelectInput, SelectUnit, SelectUser, SelectVendor, SessionProvider, TaxSelector, TemplateFNESelector, TextInput, ThemeProvider, ToastContainer, ToastProvider, type Unit, UnitServices, type UseFileManagerApiReturn, type User, UserServices, type ViewMode, fileManagerApi, formatDate, formatFileSize, getFileIcon, useAlert, useFileManager, useFileManagerApi, useSession, useToast };
|