@epam/ai-dial-chat-hooks 1.2.0-rc.1 → 1.3.0-dev.13
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/file-manager.d.ts +17 -4
- package/file-manager.js +25 -25
- package/files/dial-file-manager.model.js +7 -3
- package/files/dial-file-manager.types.js +1 -1
- package/files/useDialFileListing/useDialFileListing.js +24 -14
- package/files/useDialFileManager/useDialFileManager.js +148 -140
- package/files/useDialFileMutations/useDialFileMutations.js +206 -204
- package/files/useDialFileSharing/useDialFileSharing.js +45 -39
- package/index.d.ts +17 -4
- package/index.js +43 -43
- package/package.json +15 -15
package/file-manager.d.ts
CHANGED
|
@@ -75,9 +75,11 @@ export declare const buildFromCache: (cache: Map<string, ListFilesItemDto[]>, li
|
|
|
75
75
|
*/
|
|
76
76
|
export declare const buildSharedItemVirtualPath: (relativePath: string, rootLabel: string, isFolder: boolean) => string;
|
|
77
77
|
|
|
78
|
-
export declare const
|
|
78
|
+
export declare const COLUMNS_MY_FILES: FileManagerColumnKey[];
|
|
79
79
|
|
|
80
|
-
export declare const
|
|
80
|
+
export declare const COLUMNS_ORGANIZATION: FileManagerColumnKey[];
|
|
81
|
+
|
|
82
|
+
export declare const COLUMNS_SHARED: FileManagerColumnKey[];
|
|
81
83
|
|
|
82
84
|
export declare interface CopyMoveResult {
|
|
83
85
|
success?: boolean;
|
|
@@ -405,7 +407,9 @@ export declare enum FileOperationKind {
|
|
|
405
407
|
FilesMoved = "filesMoved",
|
|
406
408
|
/** A copy whose every item landed in its own source folder (Duplicate). */
|
|
407
409
|
FileDuplicated = "fileDuplicated",
|
|
408
|
-
FilesDuplicated = "filesDuplicated"
|
|
410
|
+
FilesDuplicated = "filesDuplicated",
|
|
411
|
+
/** One or more shared-with-me items were removed from the Shared tab. */
|
|
412
|
+
FilesUnshared = "filesUnshared"
|
|
409
413
|
}
|
|
410
414
|
|
|
411
415
|
/**
|
|
@@ -773,6 +777,11 @@ export declare interface UseDialFileListingResult {
|
|
|
773
777
|
mergeCreatedFolder: (parentApiPath: string, created: CreateFolderResponseDto, inheritedPermissions?: string[]) => void;
|
|
774
778
|
/** Forces the listing effect to re-fetch the currently browsed folder. */
|
|
775
779
|
bumpRetry: () => void;
|
|
780
|
+
/**
|
|
781
|
+
* Drops the named root rows from the Shared tab's cached listing, so an
|
|
782
|
+
* unshared item disappears at once instead of waiting for the refetch.
|
|
783
|
+
*/
|
|
784
|
+
removeSharedRootItems: (names: string[]) => void;
|
|
776
785
|
}
|
|
777
786
|
|
|
778
787
|
/**
|
|
@@ -1094,7 +1103,7 @@ export declare interface UseDialFileMutationsResult {
|
|
|
1094
1103
|
* shared retry counter after each mutation settles rather than holding its
|
|
1095
1104
|
* own cache copy.
|
|
1096
1105
|
*/
|
|
1097
|
-
export declare const useDialFileSharing: ({ filesApi, bucket, rootLabel, bumpRetry, onNotification, }: UseDialFileSharingOptions) => UseDialFileSharingResult;
|
|
1106
|
+
export declare const useDialFileSharing: ({ filesApi, bucket, rootLabel, bumpRetry, onNotification, onOperationSuccess, removeSharedRootItems, }: UseDialFileSharingOptions) => UseDialFileSharingResult;
|
|
1098
1107
|
|
|
1099
1108
|
/** Options accepted by `useDialFileSharing`. */
|
|
1100
1109
|
export declare interface UseDialFileSharingOptions {
|
|
@@ -1108,6 +1117,10 @@ export declare interface UseDialFileSharingOptions {
|
|
|
1108
1117
|
bumpRetry: () => void;
|
|
1109
1118
|
/** Called when a sharing mutation fails and should surface a toast notification. */
|
|
1110
1119
|
onNotification?: (notification: FileManagerNotification) => void;
|
|
1120
|
+
/** Called with a structured event once an unshare succeeds, so the host can show its success toast. */
|
|
1121
|
+
onOperationSuccess?: (event: FileOperationSuccessEvent) => void;
|
|
1122
|
+
/** Removes the unshared root rows from the cached Shared listing ahead of the refetch. */
|
|
1123
|
+
removeSharedRootItems?: (names: string[]) => void;
|
|
1111
1124
|
}
|
|
1112
1125
|
|
|
1113
1126
|
/** Values returned by `useDialFileSharing`. */
|
package/file-manager.js
CHANGED
|
@@ -3,28 +3,28 @@ import { isDialFileAcceptType as r, mimeTypesToAttachmentExtensionLabels as i, m
|
|
|
3
3
|
import { sanitizeFileName as s, splitFileNameExtension as c, trimFileNameToByteLimit as l } from "./files/file-name.js";
|
|
4
4
|
import { DialFilesApiUploadMode as u } from "./files/dial-files-api.js";
|
|
5
5
|
import { FileManagerNotificationReason as d, FileNameValidationErrorReason as f, FileOperationKind as p } from "./files/dial-file-manager.types.js";
|
|
6
|
-
import {
|
|
7
|
-
import { buildSharedItemVirtualPath as
|
|
8
|
-
import { resolveDialFileApiPath as
|
|
9
|
-
import { prepareCopyItems as
|
|
10
|
-
import { buildFromCache as
|
|
11
|
-
import { createFilesApiClient as
|
|
12
|
-
import { createUploadFileWithProgress as
|
|
13
|
-
import { openAnnotationAttachment as
|
|
14
|
-
import { getUrlFileName as
|
|
15
|
-
import { annotationToDisplayAttachment as
|
|
16
|
-
import { dialFileToAttachment as
|
|
17
|
-
import { DownloadDestinationType as
|
|
18
|
-
import { prepareDownloadDestination as
|
|
19
|
-
import { deriveActionProfile as
|
|
20
|
-
import { useDialFileListing as
|
|
21
|
-
import { useDialFileMetadata as
|
|
22
|
-
import { useDialFileMutations as
|
|
23
|
-
import { useDialFileSharing as
|
|
24
|
-
import { useDialFileUploadBatch as
|
|
25
|
-
import { useDialFileManager as
|
|
26
|
-
import { useDialFileManagerSections as
|
|
27
|
-
import { useDialFileManagerTabConfig as
|
|
28
|
-
import { useFileAttachmentPicker as
|
|
29
|
-
import { useGridEditingScroll as
|
|
30
|
-
export { m as
|
|
6
|
+
import { COLUMNS_MY_FILES as m, COLUMNS_ORGANIZATION as h, COLUMNS_SHARED as g, CORE_PERMISSION_MAP as _, DATE_OPTIONS as v, DIAL_FILE_MANAGER_SECTION_TABS as y, PATH_SEPARATOR_REGEXP as b, RESERVED_MARKER_NAME as x, UPLOAD_CONCURRENCY as S } from "./files/dial-file-manager.model.js";
|
|
7
|
+
import { buildSharedItemVirtualPath as C, dialCorePathToRelative as w, findDialFileByPath as T, findFolderByVirtualPath as E, formatOperationFolderName as D, getVirtualPathName as O, hasDialFileWritePermission as k, hasForbiddenNameSymbols as A, hasSamePaths as j, isCopyMoveDuplicateAllowed as M, isShareActionsAllowed as N, normalizeVirtualPath as P, parseNewFolderVirtualPath as F, resolveOwnerCoords as I, resolveSectionByPath as L, unionPathSets as R, withRoutableRootLabels as z } from "./files/dial-file-manager-path.util.js";
|
|
8
|
+
import { resolveDialFileApiPath as B, virtualPathToApiPath as V } from "./files/resolve-dial-file-api-path.js";
|
|
9
|
+
import { prepareCopyItems as H, prepareMoveRenameItems as U } from "./files/dial-file-manager-copy-move.util.js";
|
|
10
|
+
import { buildFromCache as W, fetchByTab as G, fetchForSearch as K, findFirstSuccessfulCopyMoveItem as q, mapCorePermissions as J, mapFileMetadataToDialFile as Y, mapSearchItem as X, mergeCreatedFolderIntoCache as Z, updateEntry as Q } from "./files/dial-file-manager-mapping.util.js";
|
|
11
|
+
import { createFilesApiClient as $ } from "./files/create-files-api.js";
|
|
12
|
+
import { createUploadFileWithProgress as ee } from "./files/create-upload-file-with-progress.js";
|
|
13
|
+
import { openAnnotationAttachment as te } from "./files/annotation.js";
|
|
14
|
+
import { getUrlFileName as ne, isExternalSourcePreviewable as re, resolveExternalSourceContentType as ie } from "./files/source-content.js";
|
|
15
|
+
import { annotationToDisplayAttachment as ae, attachmentDtoToDisplayAttachment as oe, attachmentDtosToDisplayAttachments as se } from "./files/attachment-dto-to-display.js";
|
|
16
|
+
import { dialFileToAttachment as ce, dialFilesToAttachments as le, dialFolderPathToAttachment as ue } from "./files/dial-file-to-attachment.js";
|
|
17
|
+
import { DownloadDestinationType as de } from "./files/download-destination.js";
|
|
18
|
+
import { prepareDownloadDestination as fe } from "./files/prepare-download-destination.js";
|
|
19
|
+
import { deriveActionProfile as pe } from "./files/file-manager-variant.js";
|
|
20
|
+
import { useDialFileListing as me } from "./files/useDialFileListing/useDialFileListing.js";
|
|
21
|
+
import { useDialFileMetadata as he } from "./files/useDialFileMetadata/useDialFileMetadata.js";
|
|
22
|
+
import { useDialFileMutations as ge } from "./files/useDialFileMutations/useDialFileMutations.js";
|
|
23
|
+
import { useDialFileSharing as _e } from "./files/useDialFileSharing/useDialFileSharing.js";
|
|
24
|
+
import { useDialFileUploadBatch as ve } from "./files/useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
25
|
+
import { useDialFileManager as ye } from "./files/useDialFileManager/useDialFileManager.js";
|
|
26
|
+
import { useDialFileManagerSections as be } from "./files/useDialFileManagerSections/useDialFileManagerSections.js";
|
|
27
|
+
import { useDialFileManagerTabConfig as xe } from "./files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js";
|
|
28
|
+
import { useFileAttachmentPicker as Se } from "./files/useFileAttachmentPicker/useFileAttachmentPicker.js";
|
|
29
|
+
import { useGridEditingScroll as Ce } from "@epam/ai-dial-chat-shared";
|
|
30
|
+
export { m as COLUMNS_MY_FILES, h as COLUMNS_ORGANIZATION, g as COLUMNS_SHARED, _ as CORE_PERMISSION_MAP, v as DATE_OPTIONS, y as DIAL_FILE_MANAGER_SECTION_TABS, u as DialFilesApiUploadMode, de as DownloadDestinationType, d as FileManagerNotificationReason, f as FileNameValidationErrorReason, p as FileOperationKind, b as PATH_SEPARATOR_REGEXP, x as RESERVED_MARKER_NAME, S as UPLOAD_CONCURRENCY, ae as annotationToDisplayAttachment, oe as attachmentDtoToDisplayAttachment, se as attachmentDtosToDisplayAttachments, W as buildFromCache, C as buildSharedItemVirtualPath, $ as createFilesApiClient, ee as createUploadFileWithProgress, pe as deriveActionProfile, w as dialCorePathToRelative, ce as dialFileToAttachment, le as dialFilesToAttachments, ue as dialFolderPathToAttachment, G as fetchByTab, K as fetchForSearch, T as findDialFileByPath, q as findFirstSuccessfulCopyMoveItem, E as findFolderByVirtualPath, D as formatOperationFolderName, ne as getUrlFileName, O as getVirtualPathName, k as hasDialFileWritePermission, A as hasForbiddenNameSymbols, j as hasSamePaths, M as isCopyMoveDuplicateAllowed, r as isDialFileAcceptType, e as isDialFileId, re as isExternalSourcePreviewable, N as isShareActionsAllowed, J as mapCorePermissions, Y as mapFileMetadataToDialFile, X as mapSearchItem, Z as mergeCreatedFolderIntoCache, i as mimeTypesToAttachmentExtensionLabels, a as mimeTypesToDialFileAcceptTypes, o as mimeTypesToFileAccept, P as normalizeVirtualPath, te as openAnnotationAttachment, F as parseNewFolderVirtualPath, H as prepareCopyItems, fe as prepareDownloadDestination, U as prepareMoveRenameItems, B as resolveDialFileApiPath, t as resolveDialFileBucketAndPath, ie as resolveExternalSourceContentType, I as resolveOwnerCoords, n as resolveRelativeDialFilePath, L as resolveSectionByPath, s as sanitizeFileName, c as splitFileNameExtension, l as trimFileNameToByteLimit, R as unionPathSets, Q as updateEntry, me as useDialFileListing, ye as useDialFileManager, be as useDialFileManagerSections, xe as useDialFileManagerTabConfig, he as useDialFileMetadata, ge as useDialFileMutations, _e as useDialFileSharing, ve as useDialFileUploadBatch, Se as useFileAttachmentPicker, Ce as useGridEditingScroll, V as virtualPathToApiPath, z as withRoutableRootLabels };
|
|
@@ -14,19 +14,23 @@ var i = 3, a = e, o = /[/\\]/, s = {
|
|
|
14
14
|
r.Size,
|
|
15
15
|
r.Actions
|
|
16
16
|
], l = [
|
|
17
|
+
r.Name,
|
|
18
|
+
r.Author,
|
|
19
|
+
r.Actions
|
|
20
|
+
], u = [
|
|
17
21
|
r.Name,
|
|
18
22
|
r.UpdatedAt,
|
|
19
23
|
r.Size,
|
|
20
24
|
r.Author,
|
|
21
25
|
r.Actions
|
|
22
|
-
],
|
|
26
|
+
], d = {
|
|
23
27
|
READ: n.READ,
|
|
24
28
|
WRITE: n.WRITE,
|
|
25
29
|
SHARE: n.SHARE
|
|
26
|
-
},
|
|
30
|
+
}, f = [
|
|
27
31
|
t.MyFiles,
|
|
28
32
|
t.Shared,
|
|
29
33
|
t.Organization
|
|
30
34
|
];
|
|
31
35
|
//#endregion
|
|
32
|
-
export { c as
|
|
36
|
+
export { c as COLUMNS_MY_FILES, u as COLUMNS_ORGANIZATION, l as COLUMNS_SHARED, d as CORE_PERMISSION_MAP, s as DATE_OPTIONS, f as DIAL_FILE_MANAGER_SECTION_TABS, o as PATH_SEPARATOR_REGEXP, a as RESERVED_MARKER_NAME, i as UPLOAD_CONCURRENCY };
|
|
@@ -4,7 +4,7 @@ var e = /* @__PURE__ */ function(e) {
|
|
|
4
4
|
}({}), t = /* @__PURE__ */ function(e) {
|
|
5
5
|
return e.Empty = "empty", e.ForbiddenSymbols = "forbiddenSymbols", e.ReservedName = "reservedName", e.TooLong = "tooLong", e.DuplicateName = "duplicateName", e;
|
|
6
6
|
}({}), n = /* @__PURE__ */ function(e) {
|
|
7
|
-
return e.FolderCreated = "folderCreated", e.FileRenamed = "fileRenamed", e.FileDownloaded = "fileDownloaded", e.FilesDownloaded = "filesDownloaded", e.FileCopied = "fileCopied", e.FilesCopied = "filesCopied", e.FileMoved = "fileMoved", e.FilesMoved = "filesMoved", e.FileDuplicated = "fileDuplicated", e.FilesDuplicated = "filesDuplicated", e;
|
|
7
|
+
return e.FolderCreated = "folderCreated", e.FileRenamed = "fileRenamed", e.FileDownloaded = "fileDownloaded", e.FilesDownloaded = "filesDownloaded", e.FileCopied = "fileCopied", e.FilesCopied = "filesCopied", e.FileMoved = "fileMoved", e.FilesMoved = "filesMoved", e.FileDuplicated = "fileDuplicated", e.FilesDuplicated = "filesDuplicated", e.FilesUnshared = "filesUnshared", e;
|
|
8
8
|
}({});
|
|
9
9
|
//#endregion
|
|
10
10
|
export { e as FileManagerNotificationReason, t as FileNameValidationErrorReason, n as FileOperationKind };
|
|
@@ -27,11 +27,11 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
27
27
|
return;
|
|
28
28
|
}
|
|
29
29
|
let t = !1;
|
|
30
|
-
return A(!0), j(null), s(_, b, v, C, L.current).then(({ items: e, permissions:
|
|
30
|
+
return A(!0), j(null), s(_, b, v, C, L.current).then(({ items: e, permissions: n }) => {
|
|
31
31
|
t || (E((t) => {
|
|
32
32
|
let n = new Map(t);
|
|
33
33
|
return n.set(C, e), n;
|
|
34
|
-
}), k((e) => new Map(e).set(C,
|
|
34
|
+
}), k((e) => new Map(e).set(C, n)), b === g.Shared && C === "" && (F(e.map((e) => e.nodeType === m.Folder ? `/${y}/${e.name}/` : `/${y}/${e.name}`)), L.current = new Map(e.map((e) => [e.name, {
|
|
35
35
|
bucket: e.bucket ?? "",
|
|
36
36
|
dialCorePath: e.path
|
|
37
37
|
}]))));
|
|
@@ -144,6 +144,15 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
144
144
|
]), ve = l((e, t, n) => {
|
|
145
145
|
E((r) => re(r, e, t, n));
|
|
146
146
|
}, []), ye = l((e) => {
|
|
147
|
+
if (e.length === 0) return;
|
|
148
|
+
let t = new Set(e);
|
|
149
|
+
E((e) => {
|
|
150
|
+
let n = e.get("");
|
|
151
|
+
if (n == null) return e;
|
|
152
|
+
let r = new Map(e);
|
|
153
|
+
return r.set("", n.filter((e) => !t.has(e.name))), r;
|
|
154
|
+
}), F((t) => t?.filter((t) => !e.some((e) => t === `/${y}/${e}`)));
|
|
155
|
+
}, [y]), be = l((e) => {
|
|
147
156
|
if (!S) return;
|
|
148
157
|
let n = e == null ? "" : o(e, y), r = e ?? `/${y}`;
|
|
149
158
|
if (J((e) => {
|
|
@@ -185,7 +194,7 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
185
194
|
S,
|
|
186
195
|
x,
|
|
187
196
|
y
|
|
188
|
-
]),
|
|
197
|
+
]), xe = d(() => {
|
|
189
198
|
let e = /* @__PURE__ */ new Set(), t = new Set([...W, ...q]);
|
|
190
199
|
for (let n of t) {
|
|
191
200
|
let t = o(n, y);
|
|
@@ -197,7 +206,7 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
197
206
|
q,
|
|
198
207
|
T,
|
|
199
208
|
y
|
|
200
|
-
]),
|
|
209
|
+
]), Se = l((e) => {
|
|
201
210
|
S && (W.forEach((t) => {
|
|
202
211
|
e.has(t) || U.current.delete(o(t, y));
|
|
203
212
|
}), G(e), [...e].filter((e) => {
|
|
@@ -230,9 +239,9 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
230
239
|
S,
|
|
231
240
|
x,
|
|
232
241
|
y
|
|
233
|
-
]),
|
|
242
|
+
]), Ce = l(() => {
|
|
234
243
|
B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, z(null), R(!1);
|
|
235
|
-
}, []),
|
|
244
|
+
}, []), we = l((e, t) => {
|
|
236
245
|
if (S) {
|
|
237
246
|
if (B.current != null && (clearTimeout(B.current), B.current = null), V.current?.(), V.current = null, !t.trim()) {
|
|
238
247
|
z(null), R(!1);
|
|
@@ -267,7 +276,7 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
267
276
|
C,
|
|
268
277
|
S,
|
|
269
278
|
y
|
|
270
|
-
]), $ = C ? `/${y}/${C}` : `/${y}`,
|
|
279
|
+
]), $ = C ? `/${y}/${C}` : `/${y}`, Te = d(() => {
|
|
271
280
|
let e = Z[0];
|
|
272
281
|
if (e) return a($) === a(`/${y}`) ? e : i(e.items ?? [], $);
|
|
273
282
|
}, [
|
|
@@ -283,25 +292,26 @@ var _ = ({ filesApi: _, bucket: v, rootLabel: y, activeTab: b, onNotification: x
|
|
|
283
292
|
folderPath: C,
|
|
284
293
|
onPathChange: he,
|
|
285
294
|
retry: Q,
|
|
286
|
-
onSearchFiles:
|
|
295
|
+
onSearchFiles: we,
|
|
287
296
|
isSearching: fe,
|
|
288
297
|
searchResults: pe,
|
|
289
|
-
clearSearchResults:
|
|
298
|
+
clearSearchResults: Ce,
|
|
290
299
|
expandedPaths: W,
|
|
291
|
-
loadedPaths:
|
|
292
|
-
onExpandedPathsChange:
|
|
293
|
-
onFolderPopupPathChange:
|
|
300
|
+
loadedPaths: xe,
|
|
301
|
+
onExpandedPathsChange: Se,
|
|
302
|
+
onFolderPopupPathChange: be,
|
|
294
303
|
folderPopupLoadingPaths: me,
|
|
295
304
|
sharedWithMeIds: d(() => b === g.Shared ? P : void 0, [b, P]),
|
|
296
305
|
sharedByMePaths: de,
|
|
297
|
-
currentFolder:
|
|
306
|
+
currentFolder: Te,
|
|
298
307
|
cache: T,
|
|
299
308
|
listingPermissionsCache: O,
|
|
300
309
|
sharedRootMetaRef: L,
|
|
301
310
|
setFolderPath: w,
|
|
302
311
|
invalidateFolders: _e,
|
|
303
312
|
mergeCreatedFolder: ve,
|
|
304
|
-
bumpRetry: ge
|
|
313
|
+
bumpRetry: ge,
|
|
314
|
+
removeSharedRootItems: ye
|
|
305
315
|
};
|
|
306
316
|
};
|
|
307
317
|
//#endregion
|
|
@@ -1,150 +1,158 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { hasDialFileWritePermission as
|
|
3
|
-
import { deriveActionProfile as
|
|
4
|
-
import { useDialFileListing as
|
|
5
|
-
import { useDialFileMetadata as
|
|
6
|
-
import { useDialFileMutations as
|
|
7
|
-
import { useDialFileSharing as
|
|
8
|
-
import { useDialFileUploadBatch as
|
|
9
|
-
import { DialFileManagerActionProfile as
|
|
10
|
-
import { useCallback as
|
|
11
|
-
import { DialFileManagerActions as
|
|
1
|
+
import { COLUMNS_MY_FILES as e, COLUMNS_ORGANIZATION as t, COLUMNS_SHARED as n, DATE_OPTIONS as r } from "../dial-file-manager.model.js";
|
|
2
|
+
import { hasDialFileWritePermission as i, isCopyMoveDuplicateAllowed as a, isShareActionsAllowed as o } from "../dial-file-manager-path.util.js";
|
|
3
|
+
import { deriveActionProfile as s } from "../file-manager-variant.js";
|
|
4
|
+
import { useDialFileListing as c } from "../useDialFileListing/useDialFileListing.js";
|
|
5
|
+
import { useDialFileMetadata as l } from "../useDialFileMetadata/useDialFileMetadata.js";
|
|
6
|
+
import { useDialFileMutations as u } from "../useDialFileMutations/useDialFileMutations.js";
|
|
7
|
+
import { useDialFileSharing as d } from "../useDialFileSharing/useDialFileSharing.js";
|
|
8
|
+
import { useDialFileUploadBatch as f } from "../useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
9
|
+
import { DialFileManagerActionProfile as p, DialFileManagerVariant as m, isUploadInProgress as h } from "@epam/ai-dial-chat-shared";
|
|
10
|
+
import { useCallback as g, useMemo as _ } from "react";
|
|
11
|
+
import { DialFileManagerActions as v, DialFileManagerTabs as y } from "@epam/ai-dial-react-file-manager";
|
|
12
12
|
//#region src/files/useDialFileManager/useDialFileManager.ts
|
|
13
|
-
var
|
|
14
|
-
let
|
|
15
|
-
filesApi:
|
|
16
|
-
bucket:
|
|
17
|
-
rootLabel:
|
|
18
|
-
activeTab:
|
|
19
|
-
onNotification:
|
|
20
|
-
isActive:
|
|
21
|
-
sessionKey:
|
|
22
|
-
}),
|
|
23
|
-
filesApi:
|
|
24
|
-
bucket:
|
|
25
|
-
rootLabel:
|
|
26
|
-
activeTab:
|
|
27
|
-
cache:
|
|
28
|
-
sharedRootMetaRef:
|
|
29
|
-
invalidateFolders:
|
|
30
|
-
bumpRetry:
|
|
31
|
-
onNotification:
|
|
32
|
-
}), R = l({
|
|
33
|
-
filesApi: y,
|
|
34
|
-
bucket: b,
|
|
35
|
-
rootLabel: x,
|
|
36
|
-
activeTab: S,
|
|
37
|
-
folderPath: I.folderPath,
|
|
38
|
-
currentFolder: I.currentFolder,
|
|
39
|
-
sharedRootMetaRef: I.sharedRootMetaRef,
|
|
40
|
-
listingPermissionsCache: I.listingPermissionsCache,
|
|
41
|
-
invalidateFolders: I.invalidateFolders,
|
|
42
|
-
bumpRetry: I.bumpRetry,
|
|
43
|
-
mergeCreatedFolder: I.mergeCreatedFolder,
|
|
44
|
-
setFolderPath: I.setFolderPath,
|
|
45
|
-
onNotification: T,
|
|
46
|
-
onOperationSuccess: E,
|
|
47
|
-
downloadDestination: N,
|
|
48
|
-
forbiddenSymbolsRegExp: D
|
|
13
|
+
var b = ({ filesApi: b, bucket: x, rootLabel: S = "My files", activeTab: C = y.MyFiles, isActive: w, sessionKey: T, onNotification: E, onOperationSuccess: D, forbiddenSymbolsRegExp: O, variant: k = m.Attach, actionProfile: A, labels: j, locale: M, disabledNewButtonTooltip: N, downloadDestination: P, buildValidationErrorMessage: F }) => {
|
|
14
|
+
let I = A ?? s(k), L = c({
|
|
15
|
+
filesApi: b,
|
|
16
|
+
bucket: x,
|
|
17
|
+
rootLabel: S,
|
|
18
|
+
activeTab: C,
|
|
19
|
+
onNotification: E,
|
|
20
|
+
isActive: w,
|
|
21
|
+
sessionKey: T
|
|
22
|
+
}), R = f({
|
|
23
|
+
filesApi: b,
|
|
24
|
+
bucket: x,
|
|
25
|
+
rootLabel: S,
|
|
26
|
+
activeTab: C,
|
|
27
|
+
cache: L.cache,
|
|
28
|
+
sharedRootMetaRef: L.sharedRootMetaRef,
|
|
29
|
+
invalidateFolders: L.invalidateFolders,
|
|
30
|
+
bumpRetry: L.bumpRetry,
|
|
31
|
+
onNotification: E
|
|
49
32
|
}), z = u({
|
|
50
|
-
filesApi:
|
|
51
|
-
bucket:
|
|
52
|
-
rootLabel:
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
33
|
+
filesApi: b,
|
|
34
|
+
bucket: x,
|
|
35
|
+
rootLabel: S,
|
|
36
|
+
activeTab: C,
|
|
37
|
+
folderPath: L.folderPath,
|
|
38
|
+
currentFolder: L.currentFolder,
|
|
39
|
+
sharedRootMetaRef: L.sharedRootMetaRef,
|
|
40
|
+
listingPermissionsCache: L.listingPermissionsCache,
|
|
41
|
+
invalidateFolders: L.invalidateFolders,
|
|
42
|
+
bumpRetry: L.bumpRetry,
|
|
43
|
+
mergeCreatedFolder: L.mergeCreatedFolder,
|
|
44
|
+
setFolderPath: L.setFolderPath,
|
|
45
|
+
onNotification: E,
|
|
46
|
+
onOperationSuccess: D,
|
|
47
|
+
downloadDestination: P,
|
|
48
|
+
forbiddenSymbolsRegExp: O
|
|
49
|
+
}), B = d({
|
|
50
|
+
filesApi: b,
|
|
51
|
+
bucket: x,
|
|
52
|
+
rootLabel: S,
|
|
53
|
+
bumpRetry: L.bumpRetry,
|
|
54
|
+
onNotification: E,
|
|
55
|
+
onOperationSuccess: D,
|
|
56
|
+
removeSharedRootItems: L.removeSharedRootItems
|
|
57
|
+
}), V = l({
|
|
58
|
+
filesApi: b,
|
|
59
|
+
bucket: x,
|
|
60
|
+
rootLabel: S,
|
|
61
|
+
onNotification: E
|
|
62
|
+
}), H = i(L.currentFolder), U = _(() => C === y.Organization || C === y.Shared && L.folderPath === "" ? !1 : H, [
|
|
63
|
+
C,
|
|
64
|
+
L.folderPath,
|
|
65
|
+
H
|
|
66
|
+
]), W = _(() => {
|
|
67
|
+
switch (C) {
|
|
68
|
+
case y.Shared: return n;
|
|
69
|
+
case y.Organization: return t;
|
|
70
|
+
default: return e;
|
|
71
|
+
}
|
|
72
|
+
}, [C]), G = _(() => {
|
|
65
73
|
let e = {}, t = (t) => {
|
|
66
|
-
let n =
|
|
74
|
+
let n = j[t];
|
|
67
75
|
n != null && (e[t] = n);
|
|
68
76
|
};
|
|
69
|
-
return t(
|
|
77
|
+
return t(v.Download), C === y.MyFiles ? (t(v.Delete), U && (t(v.Rename), a(I) && (t(v.Copy), t(v.Move), t(v.Duplicate))), o(I) && t(v.RemoveAccess)) : C === y.Shared && o(I) && t(v.Unshare), I === p.Full && t(v.Info), e;
|
|
70
78
|
}, [
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
]),
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
]),
|
|
86
|
-
let n =
|
|
87
|
-
return n ?
|
|
88
|
-
}, [
|
|
89
|
-
let n =
|
|
90
|
-
return n ?
|
|
91
|
-
}, [
|
|
79
|
+
C,
|
|
80
|
+
U,
|
|
81
|
+
I,
|
|
82
|
+
j
|
|
83
|
+
]), K = _(() => z.isCreatingFolder || z.isDownloading || z.isDeleting || z.isRenaming || z.isCopying || z.isMoving || B.isUnsharing || B.isRemovingAccess || h(R.uploadBatchState), [
|
|
84
|
+
z.isCreatingFolder,
|
|
85
|
+
z.isDownloading,
|
|
86
|
+
z.isDeleting,
|
|
87
|
+
z.isRenaming,
|
|
88
|
+
z.isCopying,
|
|
89
|
+
z.isMoving,
|
|
90
|
+
B.isUnsharing,
|
|
91
|
+
B.isRemovingAccess,
|
|
92
|
+
R.uploadBatchState
|
|
93
|
+
]), q = g((e, t) => {
|
|
94
|
+
let n = z.onCreateFolderValidate(e, t);
|
|
95
|
+
return n ? F(n) : null;
|
|
96
|
+
}, [z, F]), J = g((e, t) => {
|
|
97
|
+
let n = z.onRenameValidate(e, t);
|
|
98
|
+
return n ? F(n, t) : null;
|
|
99
|
+
}, [z, F]);
|
|
92
100
|
return {
|
|
93
|
-
items:
|
|
94
|
-
isLoading:
|
|
95
|
-
error:
|
|
96
|
-
path:
|
|
97
|
-
onPathChange:
|
|
98
|
-
retry:
|
|
99
|
-
onSearchFiles:
|
|
100
|
-
isSearching:
|
|
101
|
-
searchResults:
|
|
102
|
-
clearSearchResults:
|
|
103
|
-
expandedPaths:
|
|
104
|
-
loadedPaths:
|
|
105
|
-
onExpandedPathsChange:
|
|
106
|
-
onFolderPopupPathChange:
|
|
107
|
-
folderPopupLoadingPaths:
|
|
108
|
-
onUploadFiles:
|
|
109
|
-
onUploadArchive:
|
|
110
|
-
onValidateUpload:
|
|
111
|
-
uploadBatchState:
|
|
112
|
-
cancelUpload:
|
|
113
|
-
cancelUploadFile:
|
|
114
|
-
clearUploadBatch:
|
|
115
|
-
onCreateFolder:
|
|
116
|
-
onCreateFolderValidate:
|
|
117
|
-
isCreatingFolder:
|
|
118
|
-
onDownloadFiles:
|
|
119
|
-
isDownloading:
|
|
120
|
-
onDeleteFiles:
|
|
121
|
-
isDeleting:
|
|
122
|
-
onRenameValidate:
|
|
123
|
-
onMoveToFiles:
|
|
124
|
-
isRenaming:
|
|
125
|
-
onCopyFiles:
|
|
126
|
-
isCopying:
|
|
127
|
-
isMoving:
|
|
128
|
-
cancelCopyMove:
|
|
129
|
-
uploadEnabled:
|
|
130
|
-
isNewButtonDisabled: !
|
|
131
|
-
disabledNewButtonTooltip:
|
|
132
|
-
visibleColumns:
|
|
133
|
-
dateLocale:
|
|
134
|
-
dateOptions:
|
|
135
|
-
actionLabels:
|
|
136
|
-
sharedWithMeIds:
|
|
137
|
-
sharedByMePaths:
|
|
138
|
-
onUnshareFiles:
|
|
139
|
-
isUnsharing:
|
|
140
|
-
onRemoveFilesAccess:
|
|
141
|
-
isRemovingAccess:
|
|
142
|
-
fileMetadata:
|
|
143
|
-
isFileMetadataLoading:
|
|
144
|
-
onGetInfo:
|
|
145
|
-
clearMetadata:
|
|
146
|
-
isAnyOperationInProgress:
|
|
101
|
+
items: L.items,
|
|
102
|
+
isLoading: L.isLoading,
|
|
103
|
+
error: L.error,
|
|
104
|
+
path: L.path,
|
|
105
|
+
onPathChange: L.onPathChange,
|
|
106
|
+
retry: L.retry,
|
|
107
|
+
onSearchFiles: L.onSearchFiles,
|
|
108
|
+
isSearching: L.isSearching,
|
|
109
|
+
searchResults: L.searchResults,
|
|
110
|
+
clearSearchResults: L.clearSearchResults,
|
|
111
|
+
expandedPaths: L.expandedPaths,
|
|
112
|
+
loadedPaths: L.loadedPaths,
|
|
113
|
+
onExpandedPathsChange: L.onExpandedPathsChange,
|
|
114
|
+
onFolderPopupPathChange: L.onFolderPopupPathChange,
|
|
115
|
+
folderPopupLoadingPaths: L.folderPopupLoadingPaths,
|
|
116
|
+
onUploadFiles: R.onUploadFiles,
|
|
117
|
+
onUploadArchive: R.onUploadArchive,
|
|
118
|
+
onValidateUpload: R.onValidateUpload,
|
|
119
|
+
uploadBatchState: R.uploadBatchState,
|
|
120
|
+
cancelUpload: R.cancelUpload,
|
|
121
|
+
cancelUploadFile: R.cancelUploadFile,
|
|
122
|
+
clearUploadBatch: R.clearUploadBatch,
|
|
123
|
+
onCreateFolder: z.onCreateFolder,
|
|
124
|
+
onCreateFolderValidate: q,
|
|
125
|
+
isCreatingFolder: z.isCreatingFolder,
|
|
126
|
+
onDownloadFiles: z.onDownloadFiles,
|
|
127
|
+
isDownloading: z.isDownloading,
|
|
128
|
+
onDeleteFiles: z.onDeleteFiles,
|
|
129
|
+
isDeleting: z.isDeleting,
|
|
130
|
+
onRenameValidate: J,
|
|
131
|
+
onMoveToFiles: z.onMoveToFiles,
|
|
132
|
+
isRenaming: z.isRenaming,
|
|
133
|
+
onCopyFiles: z.onCopyFiles,
|
|
134
|
+
isCopying: z.isCopying,
|
|
135
|
+
isMoving: z.isMoving,
|
|
136
|
+
cancelCopyMove: z.cancelCopyMove,
|
|
137
|
+
uploadEnabled: U,
|
|
138
|
+
isNewButtonDisabled: !U,
|
|
139
|
+
disabledNewButtonTooltip: N,
|
|
140
|
+
visibleColumns: W,
|
|
141
|
+
dateLocale: M,
|
|
142
|
+
dateOptions: r,
|
|
143
|
+
actionLabels: G,
|
|
144
|
+
sharedWithMeIds: L.sharedWithMeIds,
|
|
145
|
+
sharedByMePaths: L.sharedByMePaths,
|
|
146
|
+
onUnshareFiles: B.onUnshareFiles,
|
|
147
|
+
isUnsharing: B.isUnsharing,
|
|
148
|
+
onRemoveFilesAccess: B.onRemoveFilesAccess,
|
|
149
|
+
isRemovingAccess: B.isRemovingAccess,
|
|
150
|
+
fileMetadata: V.fileMetadata,
|
|
151
|
+
isFileMetadataLoading: V.isFileMetadataLoading,
|
|
152
|
+
onGetInfo: V.onGetInfo,
|
|
153
|
+
clearMetadata: V.clearMetadata,
|
|
154
|
+
isAnyOperationInProgress: K
|
|
147
155
|
};
|
|
148
156
|
};
|
|
149
157
|
//#endregion
|
|
150
|
-
export {
|
|
158
|
+
export { b as useDialFileManager };
|