@apia/uploader-controller 4.0.44 → 4.0.46
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +174 -51
- package/dist/index.js +483 -107
- package/dist/index.js.map +1 -1
- package/package.json +5 -4
package/dist/index.d.ts
CHANGED
|
@@ -1,45 +1,28 @@
|
|
|
1
1
|
import * as _apia_util from '@apia/util';
|
|
2
|
-
import { EventEmitter, NotificationDefinition,
|
|
2
|
+
import { EventEmitter, NotificationDefinition, TApiaLoad, TApiaFunction } from '@apia/util';
|
|
3
3
|
import * as _apia_api2 from '@apia/api2';
|
|
4
4
|
import { ApiContext } from '@apia/api2';
|
|
5
|
+
import { MobXTreeNodeState, MobXTreeNode, MobXTree } from '@apia/tree2-controller';
|
|
5
6
|
|
|
6
|
-
interface UploadContext extends ApiContext {
|
|
7
|
-
currentUserLogin: string;
|
|
8
|
-
docLangs: string;
|
|
9
|
-
everyoneCanUpdate: boolean;
|
|
10
|
-
ownerCanUpdate: boolean;
|
|
11
|
-
readonly: boolean;
|
|
12
|
-
IN_MONITOR: boolean;
|
|
13
|
-
WEBDAV_SERVER: string;
|
|
14
|
-
ITHit: any;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* El comportamiento de esta función se explica por su
|
|
18
|
-
* nombre.
|
|
19
|
-
*/
|
|
20
|
-
declare function returnExactlyTheSame(defaultParameters: Record<string, unknown>): Record<string, unknown>;
|
|
21
|
-
declare const parseFileDefinition: (context: UploadContext, fileDefinition: TFileUploaded | TUploaderFileInfo, isSignRequired: boolean) => TUploaderFileInfo;
|
|
22
|
-
type TOnUploadProgress = (progress: number) => void;
|
|
23
7
|
declare class UploaderApi extends EventEmitter<{
|
|
24
8
|
fileUploaded: null;
|
|
25
9
|
}> {
|
|
26
10
|
props: {
|
|
27
11
|
context: UploadContext;
|
|
28
12
|
id: string;
|
|
29
|
-
type: 'E' | 'P';
|
|
30
13
|
modalConfig: TModalConfig;
|
|
31
14
|
};
|
|
32
15
|
maxFiles: number;
|
|
33
16
|
modalController: UploaderModalController | null;
|
|
34
|
-
allowTranslations: boolean;
|
|
35
17
|
langs: Record<number, string> | undefined;
|
|
36
18
|
currentConfiguration: TUploaderLoadCurrentFunctionMessages | undefined;
|
|
37
19
|
state: UploaderState;
|
|
38
20
|
get filesArray(): TUploaderFileInfo[];
|
|
21
|
+
get id(): string;
|
|
22
|
+
get modalConfig(): TModalConfig;
|
|
39
23
|
constructor(props: {
|
|
40
24
|
context: UploadContext;
|
|
41
25
|
id: string;
|
|
42
|
-
type: 'E' | 'P';
|
|
43
26
|
modalConfig: TModalConfig;
|
|
44
27
|
});
|
|
45
28
|
get context(): UploadContext;
|
|
@@ -101,7 +84,7 @@ declare class UploaderApi extends EventEmitter<{
|
|
|
101
84
|
docHistory: TDocumentDownloadHistory | TDocumentDownloadHistory[];
|
|
102
85
|
};
|
|
103
86
|
};
|
|
104
|
-
} & _apia_util.
|
|
87
|
+
} & _apia_util.TNotificationMessage) | null>;
|
|
105
88
|
/**
|
|
106
89
|
* This method searches for the provided id in several places:
|
|
107
90
|
*
|
|
@@ -125,7 +108,7 @@ declare class UploaderApi extends EventEmitter<{
|
|
|
125
108
|
checkWebDavLock(docId: string): Promise<unknown>;
|
|
126
109
|
checkSignature(file: TUploaderFileInfo): Promise<_apia_api2.TApiaApiAxiosResponse<({
|
|
127
110
|
markedToSign: boolean;
|
|
128
|
-
} & _apia_util.
|
|
111
|
+
} & _apia_util.TNotificationMessage) | null> | null>;
|
|
129
112
|
editDocument(id: string): Promise<void>;
|
|
130
113
|
downloadVersion(fileId: string, version?: string): Promise<void>;
|
|
131
114
|
downloadDocument(id: string, version?: string): Promise<void>;
|
|
@@ -147,17 +130,18 @@ declare class UploaderApi extends EventEmitter<{
|
|
|
147
130
|
langId?: number;
|
|
148
131
|
translatingFile?: TUploaderFileInfo;
|
|
149
132
|
}): Promise<boolean>;
|
|
133
|
+
protected getLoadCurrentDocumentsParameters(params: Record<string, unknown>): Record<string, unknown>;
|
|
150
134
|
loadCurrentDocuments(): Promise<void>;
|
|
151
135
|
lockDocument(id: string): Promise<void>;
|
|
152
136
|
protected evaluateDeleteDocumentResult(result: unknown): boolean;
|
|
153
137
|
setTranslationFile(file: TUploaderFileInfo, docId: string, langId: number): void;
|
|
154
|
-
protected getCheckSignatureParameters:
|
|
155
|
-
protected getAjaxUploadFileStatusParameters:
|
|
156
|
-
protected getAjaxUploadStartParameters:
|
|
157
|
-
protected getConfirmDropModalParameters:
|
|
158
|
-
protected getCheckLockDocumentParameters:
|
|
159
|
-
protected getCheckWebDavLockParameters:
|
|
160
|
-
protected getConfirmDropModalPostdata:
|
|
138
|
+
protected getCheckSignatureParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
139
|
+
protected getAjaxUploadFileStatusParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
140
|
+
protected getAjaxUploadStartParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
141
|
+
protected getConfirmDropModalParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
142
|
+
protected getCheckLockDocumentParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
143
|
+
protected getCheckWebDavLockParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
144
|
+
protected getConfirmDropModalPostdata(props: Record<string, unknown>): Record<string, unknown>;
|
|
161
145
|
protected getConfirmDropModalMetadataString: ({ metadata, }: {
|
|
162
146
|
metadata: TDocumentMetadata[];
|
|
163
147
|
}) => string;
|
|
@@ -166,17 +150,17 @@ declare class UploaderApi extends EventEmitter<{
|
|
|
166
150
|
usersPermissions: IUsersPermissions[];
|
|
167
151
|
}) => string;
|
|
168
152
|
protected getConfirmDropModalAdditionalMetadataString: (additionalMetadata: TDocumentMetadata[] | []) => string;
|
|
169
|
-
protected getDeleteDocumentParameters:
|
|
170
|
-
protected getClearTempFilesParameters:
|
|
171
|
-
protected getDocumentInfoParameters:
|
|
172
|
-
protected getDownloadMultipleDocumentsParameters:
|
|
173
|
-
protected getEditDocumentParameters:
|
|
174
|
-
protected getLockDocumentParameters:
|
|
175
|
-
protected getMarkFileToSignParameters:
|
|
176
|
-
protected getProcessDroppedFilesParameters:
|
|
177
|
-
protected getProcessDroppedFilesPostdata:
|
|
178
|
-
protected getReloadMetadataParameters:
|
|
179
|
-
protected getSaveDroppedFilesParameters:
|
|
153
|
+
protected getDeleteDocumentParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
154
|
+
protected getClearTempFilesParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
155
|
+
protected getDocumentInfoParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
156
|
+
protected getDownloadMultipleDocumentsParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
157
|
+
protected getEditDocumentParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
158
|
+
protected getLockDocumentParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
159
|
+
protected getMarkFileToSignParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
160
|
+
protected getProcessDroppedFilesParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
161
|
+
protected getProcessDroppedFilesPostdata(props: Record<string, unknown>): Record<string, unknown>;
|
|
162
|
+
protected getReloadMetadataParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
163
|
+
protected getSaveDroppedFilesParameters(props: Record<string, unknown>): Record<string, unknown>;
|
|
180
164
|
protected filterAlreadyUploadedFiles(files: File[], conf?: TSaveDroppedFilesConf): File[];
|
|
181
165
|
protected filterByFilesAmountLimit(files: File[]): File[];
|
|
182
166
|
protected filterAcceptedFiles(files: File[], shouldNotify?: boolean, docTypeId?: string | TDocType): File[];
|
|
@@ -192,6 +176,92 @@ declare class UploaderApi extends EventEmitter<{
|
|
|
192
176
|
getLoadFilesForFolderParameters(): Record<string, unknown>;
|
|
193
177
|
}
|
|
194
178
|
|
|
179
|
+
type TFilePickerProps = {
|
|
180
|
+
controller?: DirectoriesPicker;
|
|
181
|
+
onFilePick: (file: string) => unknown;
|
|
182
|
+
};
|
|
183
|
+
type TDocumentStructure = {
|
|
184
|
+
dLckByCurrUsr: string;
|
|
185
|
+
docLock: string;
|
|
186
|
+
folder: string;
|
|
187
|
+
id: string;
|
|
188
|
+
moreDocs: number;
|
|
189
|
+
name: string;
|
|
190
|
+
};
|
|
191
|
+
type TFolderStructure = {
|
|
192
|
+
addToggler: boolean;
|
|
193
|
+
allEdit: 'M' | 'R';
|
|
194
|
+
canWrite: boolean;
|
|
195
|
+
date: string;
|
|
196
|
+
desc: string;
|
|
197
|
+
edit: boolean;
|
|
198
|
+
id: string;
|
|
199
|
+
level: string;
|
|
200
|
+
name: string;
|
|
201
|
+
parent: string;
|
|
202
|
+
selectedFolder: boolean;
|
|
203
|
+
};
|
|
204
|
+
type TDirectoriesPickerResponse = {
|
|
205
|
+
documents: {
|
|
206
|
+
document: TDocumentStructure | TDocumentStructure[];
|
|
207
|
+
documentInfo: {
|
|
208
|
+
folder: string;
|
|
209
|
+
moreDocs: number;
|
|
210
|
+
};
|
|
211
|
+
};
|
|
212
|
+
folder: TFolderStructure[];
|
|
213
|
+
};
|
|
214
|
+
type TFilesPickerResponse = {
|
|
215
|
+
folders: {
|
|
216
|
+
folder: TFolderStructure | TFolderStructure[];
|
|
217
|
+
};
|
|
218
|
+
documents: {
|
|
219
|
+
document: TDocumentStructure | TDocumentStructure[];
|
|
220
|
+
documentInfo: {
|
|
221
|
+
folder: string;
|
|
222
|
+
moreDocs: number;
|
|
223
|
+
};
|
|
224
|
+
};
|
|
225
|
+
};
|
|
226
|
+
type TCreateTreeNode = {
|
|
227
|
+
id?: string;
|
|
228
|
+
parentId: string;
|
|
229
|
+
} & Omit<Partial<MobXTreeNodeState>, 'children'>;
|
|
230
|
+
|
|
231
|
+
declare class DirectoryPickerFolderNode extends MobXTreeNode {
|
|
232
|
+
protected loadMoreDocsNode: MobXTreeNode | null;
|
|
233
|
+
protected removeLoadMoreDocsNode(): void;
|
|
234
|
+
isLoadingMore: boolean;
|
|
235
|
+
constructor(parent: DirectoryPickerFolderNode | DirectoriesPicker, { parentId, id, ...props }: TCreateTreeNode);
|
|
236
|
+
getTree(): DirectoriesPicker;
|
|
237
|
+
loadMore(focus?: boolean): Promise<void>;
|
|
238
|
+
refresh(): Promise<void>;
|
|
239
|
+
}
|
|
240
|
+
|
|
241
|
+
declare class DocumentNode extends MobXTreeNode {
|
|
242
|
+
constructor(parent: DirectoryPickerFolderNode | DirectoriesPicker, { parentId, id, ...props }: TCreateTreeNode);
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
declare class DirectoriesPicker extends MobXTree {
|
|
246
|
+
api: UploaderApi;
|
|
247
|
+
isLoading: boolean;
|
|
248
|
+
renderers: TModalConfig['renderers'];
|
|
249
|
+
constructor(api: UploaderApi);
|
|
250
|
+
createDocument(nodeProps: TCreateTreeNode): DocumentNode;
|
|
251
|
+
createFolder(nodeProps: TCreateTreeNode): DirectoryPickerFolderNode;
|
|
252
|
+
initialLoad(): Promise<void>;
|
|
253
|
+
getFolderStructureParams(): {
|
|
254
|
+
ajaxUrl: string;
|
|
255
|
+
action: string;
|
|
256
|
+
preventAsXmlParameter: boolean;
|
|
257
|
+
isAjax: boolean;
|
|
258
|
+
isXml: boolean;
|
|
259
|
+
docId: string | undefined;
|
|
260
|
+
};
|
|
261
|
+
getNodeHandler(nodeProps: TCreateTreeNode): DirectoryPickerFolderNode;
|
|
262
|
+
parseStructureResponse(res: any): TFolderStructure[] | null;
|
|
263
|
+
}
|
|
264
|
+
|
|
195
265
|
declare class UploaderModalController {
|
|
196
266
|
api: UploaderApi;
|
|
197
267
|
modalConfig: TModalConfig;
|
|
@@ -200,6 +270,7 @@ declare class UploaderModalController {
|
|
|
200
270
|
translatingFile?: TUploaderFileInfo;
|
|
201
271
|
versionFile?: TUploaderFileInfo;
|
|
202
272
|
} | undefined;
|
|
273
|
+
directories: DirectoriesPicker | null;
|
|
203
274
|
state: UploaderModalState;
|
|
204
275
|
constructor(api: UploaderApi, modalConfig: TModalConfig, conf?: {
|
|
205
276
|
langId?: number;
|
|
@@ -234,7 +305,6 @@ declare class UploaderModalController {
|
|
|
234
305
|
deleteMetadata(indices: number[]): void;
|
|
235
306
|
deletePermission(item: IPoolsPermissions | IUsersPermissions): void;
|
|
236
307
|
protected onChangeExtension(): void;
|
|
237
|
-
openModal(): Promise<void>;
|
|
238
308
|
setDescription(desc: string): void;
|
|
239
309
|
protected resetMetadata(): Promise<void>;
|
|
240
310
|
validate(): boolean;
|
|
@@ -322,7 +392,7 @@ type TFileUploaded = {
|
|
|
322
392
|
virtualDoc?: boolean;
|
|
323
393
|
locked?: boolean;
|
|
324
394
|
};
|
|
325
|
-
type TAjaxUploadStart =
|
|
395
|
+
type TAjaxUploadStart = TApiaLoad<TApiaFunction<{
|
|
326
396
|
general: {
|
|
327
397
|
isDocTypeDisabled: boolean;
|
|
328
398
|
useDocTypePermitted: boolean;
|
|
@@ -358,19 +428,30 @@ type TDocumentMetadata = {
|
|
|
358
428
|
};
|
|
359
429
|
type TModalConfig = {
|
|
360
430
|
allowDocumentsMonitor: boolean;
|
|
361
|
-
allowPickFromDirectories: boolean;
|
|
362
431
|
collapsePermissions: boolean;
|
|
363
432
|
collapseDirectories: boolean;
|
|
364
433
|
collapseMetadata: boolean;
|
|
365
|
-
defaultDirectory?: number;
|
|
366
434
|
monitorId?: number;
|
|
367
435
|
oneClickUpload: boolean;
|
|
368
436
|
rootFolder?: string;
|
|
369
|
-
showDirectoriesStructure: boolean;
|
|
370
437
|
showExpDate: boolean;
|
|
371
438
|
showPermissions: boolean;
|
|
372
439
|
showMetadata: boolean;
|
|
373
440
|
translationId?: string;
|
|
441
|
+
allowPickFromDirectories: boolean;
|
|
442
|
+
showDirectoriesStructure: boolean;
|
|
443
|
+
defaultDirectory?: number;
|
|
444
|
+
/**
|
|
445
|
+
* Renderers
|
|
446
|
+
*
|
|
447
|
+
* Due to avoid react policy on controllers we cannot declare ReactComponent here.
|
|
448
|
+
*/
|
|
449
|
+
renderers?: {
|
|
450
|
+
FolderIconRenderer?: any;
|
|
451
|
+
FileIconRenderer: any;
|
|
452
|
+
LoadMoreRenderer?: any;
|
|
453
|
+
LockedFolderIconRenderer?: any;
|
|
454
|
+
};
|
|
374
455
|
};
|
|
375
456
|
type TUploaderLoadCurrentFunctionMessages = {
|
|
376
457
|
allowSign: boolean;
|
|
@@ -384,13 +465,13 @@ type TSaveDroppedFilesConf = {
|
|
|
384
465
|
translatingFile?: TUploaderFileInfo;
|
|
385
466
|
shouldReset?: boolean;
|
|
386
467
|
};
|
|
387
|
-
type TAjaxUploadFileStatus =
|
|
468
|
+
type TAjaxUploadFileStatus = TApiaLoad<TApiaFunction<{
|
|
388
469
|
message: {
|
|
389
470
|
label: string;
|
|
390
471
|
name: string;
|
|
391
472
|
}[];
|
|
392
473
|
}>>;
|
|
393
|
-
type TProcessDroppedFiles =
|
|
474
|
+
type TProcessDroppedFiles = TApiaLoad<TApiaFunction<{
|
|
394
475
|
principal: {
|
|
395
476
|
docInfo: TDocInfo | TDocInfo[];
|
|
396
477
|
docTypes: {
|
|
@@ -412,7 +493,7 @@ type TDocInfo = {
|
|
|
412
493
|
docInfoTmpId: string;
|
|
413
494
|
docInfoType: string;
|
|
414
495
|
};
|
|
415
|
-
type TConfirmDropModal =
|
|
496
|
+
type TConfirmDropModal = TApiaLoad<TApiaFunction<{
|
|
416
497
|
general: TFileUploaded | TFileUploaded[];
|
|
417
498
|
fromForm: {
|
|
418
499
|
fromForm: {
|
|
@@ -450,7 +531,7 @@ type TUploaderLoadCurrentFunction = {
|
|
|
450
531
|
}[];
|
|
451
532
|
};
|
|
452
533
|
};
|
|
453
|
-
type TDocumentInformation =
|
|
534
|
+
type TDocumentInformation = TApiaLoad<TApiaFunction<{
|
|
454
535
|
data: {
|
|
455
536
|
onClose: string;
|
|
456
537
|
general: TApiaDocumentDefinition;
|
|
@@ -490,6 +571,48 @@ type TDocumentVersion = {
|
|
|
490
571
|
type TRequireOnlyOne<T, Keys extends keyof T = keyof T> = Pick<T, Exclude<keyof T, Keys>> & {
|
|
491
572
|
[K in Keys]-?: Required<Pick<T, K>> & Partial<Record<Exclude<Keys, K>, undefined>>;
|
|
492
573
|
}[Keys];
|
|
574
|
+
interface UploadContext extends ApiContext {
|
|
575
|
+
currentUserLogin: string;
|
|
576
|
+
docLangs: string;
|
|
577
|
+
everyoneCanUpdate: boolean;
|
|
578
|
+
openModal: () => unknown;
|
|
579
|
+
ownerCanUpdate: boolean;
|
|
580
|
+
readonly: boolean;
|
|
581
|
+
allowTranslation: boolean;
|
|
582
|
+
IN_MONITOR: boolean;
|
|
583
|
+
WEBDAV_SERVER: string;
|
|
584
|
+
WEBDAV_INSTALLER_URL: string;
|
|
585
|
+
ITHit: any;
|
|
586
|
+
}
|
|
587
|
+
type TOnUploadProgress = (progress: number) => void;
|
|
588
|
+
|
|
589
|
+
declare const parseFileDefinition: (context: UploadContext, fileDefinition: TFileUploaded | TUploaderFileInfo, isSignRequired: boolean) => TUploaderFileInfo;
|
|
590
|
+
|
|
591
|
+
declare class FilePicker extends DirectoriesPicker {
|
|
592
|
+
constructor(api: UploaderApi);
|
|
593
|
+
getNodeHandler(nodeProps: TCreateTreeNode): DirectoryPickerFolderNode;
|
|
594
|
+
getFolderStructureParams(): any;
|
|
595
|
+
parseStructureResponse(res: any): TFolderStructure[] | null;
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
declare class FilePickerFolderNode extends DirectoryPickerFolderNode {
|
|
599
|
+
private params;
|
|
600
|
+
constructor(parent: DirectoryPickerFolderNode | DirectoriesPicker, props: TCreateTreeNode, params?: Record<string, unknown>);
|
|
601
|
+
loadMore(focus?: boolean): Promise<void>;
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
declare const DirectoryPickerActions: {
|
|
605
|
+
ajaxUrl: (api: UploaderApi) => string;
|
|
606
|
+
loadFolderStructure: string;
|
|
607
|
+
loadFilesForFolder: string;
|
|
608
|
+
};
|
|
609
|
+
declare const FilePickerActions: {
|
|
610
|
+
ajaxUrl: string;
|
|
611
|
+
loadFileSystemStructureTree: string;
|
|
612
|
+
loadFilesForFolder: string;
|
|
613
|
+
loadFolderStructure: string;
|
|
614
|
+
};
|
|
615
|
+
declare function makeId(str: string): string;
|
|
493
616
|
|
|
494
|
-
export { type IPoolsPermissions, type IUsersPermissions, type TAjaxUploadFileStatus, type TAjaxUploadStart, type TApiaDocumentDefinition, type TConfirmDropModal, type TDocInfo, type TDocType, type TDocumentDownloadHistory, type TDocumentInformation, type TDocumentMetadata, type TDocumentPermission, type TDocumentVersion, type TFileUploaded, type TModalConfig, type TOnUploadProgress, type TProcessDroppedFiles, type TRequireOnlyOne, type TSaveDroppedFilesConf, type TUploadModalOpener, type TUploaderFileInfo, type TUploaderLoadCurrentFunction, type TUploaderLoadCurrentFunctionMessages, type UploadContext, UploaderApi, UploaderModalController, type UploaderModalState, type UploaderState,
|
|
617
|
+
export { DirectoriesPicker, DirectoryPickerActions, DirectoryPickerFolderNode, DocumentNode, FilePicker, FilePickerActions, FilePickerFolderNode, type IPoolsPermissions, type IUsersPermissions, type TAjaxUploadFileStatus, type TAjaxUploadStart, type TApiaDocumentDefinition, type TConfirmDropModal, type TCreateTreeNode, type TDirectoriesPickerResponse, type TDocInfo, type TDocType, type TDocumentDownloadHistory, type TDocumentInformation, type TDocumentMetadata, type TDocumentPermission, type TDocumentStructure, type TDocumentVersion, type TFilePickerProps, type TFileUploaded, type TFilesPickerResponse, type TFolderStructure, type TModalConfig, type TOnUploadProgress, type TProcessDroppedFiles, type TRequireOnlyOne, type TSaveDroppedFilesConf, type TUploadModalOpener, type TUploaderFileInfo, type TUploaderLoadCurrentFunction, type TUploaderLoadCurrentFunctionMessages, type UploadContext, UploaderApi, UploaderModalController, type UploaderModalState, type UploaderState, makeId, parseFileDefinition };
|
|
495
618
|
//# sourceMappingURL=index.d.ts.map
|