@epam/ai-dial-chat-hooks 1.2.0-dev.99 → 1.3.0-dev.5
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/api-error/api-error.js +7 -4
- package/catalog/catalog-derivations.js +1 -1
- package/catalog/deployment-id.js +8 -2
- package/catalog/map-deployment-limits-to-catalog.js +16 -24
- package/catalog/map-deployment-limits-to-input.js +81 -9
- package/catalog/map-deployment-to-catalog-item.js +34 -34
- package/catalog/map-entity-details-to-catalog.js +237 -192
- package/catalog/map-skill-to-catalog-item.js +61 -54
- package/catalog/publish.js +4 -4
- package/catalog/useCatalogEditNavigation/useCatalogEditNavigation.js +122 -101
- package/catalog/useCatalogItemDetails.js +9 -8
- package/catalog/usePublishFolders/usePublishFolders.js +1 -1
- package/catalog.d.ts +171 -34
- package/catalog.js +23 -23
- package/conversation/conversation-transfer/export-conversation.js +24 -16
- package/conversation/conversation-transfer/import-conversation.js +80 -31
- package/conversation/create-chat-stream-api.js +89 -49
- package/conversation/get-model-id-from-conversation-id.js +15 -9
- package/conversation/message-utils.js +44 -2
- package/conversation/stage.js +6 -2
- package/conversation/useActiveConversationSync/useActiveConversationSync.js +7 -8
- package/conversation/useConversationExport/useConversationExport.js +9 -9
- package/conversation/useConversationHandlers/message-utils.js +8 -5
- package/conversation/useConversationHandlers/useConversationHandlers.js +181 -167
- package/conversation/useConversationImport/useConversationImport.js +123 -121
- package/conversation/useConversationPanelItems/useConversationPanelItems.js +49 -31
- package/conversation/useConversationStream/frame-scheduler.js +39 -0
- package/conversation/useConversationStream/generation-resume.js +122 -64
- package/conversation/useConversationStream/useConversationStream.js +298 -118
- package/conversation/useMessageSelectionReply/useMessageSelectionReply.js +189 -0
- package/conversation-sources/useConversationSources/useConversationSources.js +31 -24
- package/conversation-sources.d.ts +1 -1
- package/conversation-transfer.d.ts +2 -1
- package/conversation.d.ts +218 -22
- package/conversation.js +32 -31
- package/file-manager-canvas.d.ts +27 -7
- package/file-manager.d.ts +87 -32
- package/file-manager.js +25 -24
- package/files/attachment-canvas.js +67 -44
- package/files/dial-file-manager-copy-move.util.js +9 -8
- package/files/dial-file-manager-mapping.util.js +2 -1
- package/files/dial-file-manager-path.util.js +24 -2
- package/files/dial-file-manager.model.js +23 -19
- package/files/dial-file-manager.types.js +3 -3
- package/files/file-manager-variant.js +1 -1
- package/files/resolve-dial-file-api-path.js +11 -12
- package/files/useDialFileListing/useDialFileListing.js +140 -127
- package/files/useDialFileManager/useDialFileManager.js +139 -135
- package/files/useDialFileManagerSections/useDialFileManagerSections.js +155 -0
- package/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.js +20 -15
- package/files/useDialFileMutations/useDialFileMutations.js +65 -60
- package/files/useDialFileUploadBatch/useDialFileUploadBatch.js +117 -110
- package/files/useFileAttachmentPicker/useFileAttachmentPicker.js +28 -23
- package/index.d.ts +643 -128
- package/index.js +136 -134
- package/mcp-apps/useMcpAppTools/useMcpAppTools.js +1 -1
- package/oauth/authorize-url.js +3 -3
- package/oauth/toolset-id.js +5 -3
- package/oauth/useToolsetLogin/useToolsetLogin.js +8 -8
- package/oauth.d.ts +34 -2
- package/oauth.js +9 -9
- package/package.json +19 -23
- package/scheduled-task/scheduled-task-description.js +43 -39
- package/scheduled-task/scheduled-task-trigger.js +74 -71
- package/scheduled-task/use-scheduled-task-runs.js +162 -50
- package/scheduled-task/use-scheduled-tasks.js +52 -48
- package/scheduled-tasks.d.ts +27 -6
- package/scheduled-tasks.js +2 -2
- package/shared/application-schema.js +5 -2
- package/shared/cron-day-of-month.js +13 -0
- package/skill/skill-archive.js +19 -0
- package/skill/skill-types.js +8 -7
- package/skill/skill.js +52 -29
- package/skill/useSkillArchiveImport/useSkillArchiveImport.js +38 -34
- package/skill/useSkillEditorLoad.js +65 -59
- package/skill/useSkillEditorSubmit.js +105 -93
- package/skill/useSkillFileActions.js +70 -58
- package/skill-editor.d.ts +62 -13
- package/skill-editor.js +9 -9
- package/usage/map-user-usage-to-model-limits.js +137 -95
- package/usage.d.ts +8 -3
- package/usePageFileDrag/usePageFileDrag.js +3 -3
- package/utils.d.ts +26 -6
- package/utils.js +10 -10
|
@@ -1,146 +1,150 @@
|
|
|
1
1
|
import { COLUMNS_WITHOUT_AUTHOR as e, COLUMNS_WITH_AUTHOR as t, DATE_OPTIONS as n } from "../dial-file-manager.model.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { useDialFileListing as
|
|
5
|
-
import { useDialFileMetadata as
|
|
6
|
-
import { useDialFileMutations as
|
|
7
|
-
import { useDialFileSharing as
|
|
8
|
-
import { useDialFileUploadBatch as
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
2
|
+
import { hasDialFileWritePermission as r, isCopyMoveDuplicateAllowed as i, isShareActionsAllowed as a } from "../dial-file-manager-path.util.js";
|
|
3
|
+
import { deriveActionProfile as o } from "../file-manager-variant.js";
|
|
4
|
+
import { useDialFileListing as s } from "../useDialFileListing/useDialFileListing.js";
|
|
5
|
+
import { useDialFileMetadata as c } from "../useDialFileMetadata/useDialFileMetadata.js";
|
|
6
|
+
import { useDialFileMutations as l } from "../useDialFileMutations/useDialFileMutations.js";
|
|
7
|
+
import { useDialFileSharing as u } from "../useDialFileSharing/useDialFileSharing.js";
|
|
8
|
+
import { useDialFileUploadBatch as d } from "../useDialFileUploadBatch/useDialFileUploadBatch.js";
|
|
9
|
+
import { DialFileManagerActionProfile as f, DialFileManagerVariant as p, isUploadInProgress as m } from "@epam/ai-dial-chat-shared";
|
|
10
|
+
import { useCallback as h, useMemo as g } from "react";
|
|
11
|
+
import { DialFileManagerActions as _, DialFileManagerTabs as v } from "@epam/ai-dial-react-file-manager";
|
|
11
12
|
//#region src/files/useDialFileManager/useDialFileManager.ts
|
|
12
|
-
var
|
|
13
|
-
let
|
|
14
|
-
filesApi:
|
|
15
|
-
bucket:
|
|
16
|
-
rootLabel:
|
|
17
|
-
activeTab:
|
|
18
|
-
onNotification:
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
13
|
+
var y = ({ filesApi: y, bucket: b, rootLabel: x = "My files", activeTab: S = v.MyFiles, isActive: C, sessionKey: w, onNotification: T, onOperationSuccess: E, forbiddenSymbolsRegExp: D, variant: O = p.Attach, actionProfile: k, labels: A, locale: j, disabledNewButtonTooltip: M, downloadDestination: N, buildValidationErrorMessage: P }) => {
|
|
14
|
+
let F = k ?? o(O), I = s({
|
|
15
|
+
filesApi: y,
|
|
16
|
+
bucket: b,
|
|
17
|
+
rootLabel: x,
|
|
18
|
+
activeTab: S,
|
|
19
|
+
onNotification: T,
|
|
20
|
+
isActive: C,
|
|
21
|
+
sessionKey: w
|
|
22
|
+
}), L = d({
|
|
23
|
+
filesApi: y,
|
|
24
|
+
bucket: b,
|
|
25
|
+
rootLabel: x,
|
|
26
|
+
activeTab: S,
|
|
27
|
+
cache: I.cache,
|
|
28
|
+
sharedRootMetaRef: I.sharedRootMetaRef,
|
|
29
|
+
invalidateFolders: I.invalidateFolders,
|
|
30
|
+
bumpRetry: I.bumpRetry,
|
|
31
|
+
onNotification: T
|
|
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
|
|
49
|
+
}), z = u({
|
|
50
|
+
filesApi: y,
|
|
51
|
+
bucket: b,
|
|
52
|
+
rootLabel: x,
|
|
53
|
+
bumpRetry: I.bumpRetry,
|
|
54
|
+
onNotification: T
|
|
55
|
+
}), B = c({
|
|
56
|
+
filesApi: y,
|
|
57
|
+
bucket: b,
|
|
58
|
+
rootLabel: x,
|
|
59
|
+
onNotification: T
|
|
60
|
+
}), V = r(I.currentFolder), H = g(() => S === v.Organization || S === v.Shared && I.folderPath === "" ? !1 : V, [
|
|
61
|
+
S,
|
|
62
|
+
I.folderPath,
|
|
63
|
+
V
|
|
64
|
+
]), U = g(() => S === v.Shared ? t : e, [S]), W = g(() => {
|
|
62
65
|
let e = {}, t = (t) => {
|
|
63
|
-
let n =
|
|
66
|
+
let n = A[t];
|
|
64
67
|
n != null && (e[t] = n);
|
|
65
68
|
};
|
|
66
|
-
return t(
|
|
69
|
+
return t(_.Download), S === v.MyFiles ? (t(_.Delete), H && (t(_.Rename), i(F) && (t(_.Copy), t(_.Move), t(_.Duplicate))), a(F) && t(_.RemoveAccess)) : S === v.Shared && a(F) && t(_.Unshare), F === f.Full && t(_.Info), e;
|
|
67
70
|
}, [
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
]),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
]),
|
|
83
|
-
let n =
|
|
84
|
-
return n ?
|
|
85
|
-
}, [
|
|
86
|
-
let n =
|
|
87
|
-
return n ?
|
|
88
|
-
}, [
|
|
71
|
+
S,
|
|
72
|
+
H,
|
|
73
|
+
F,
|
|
74
|
+
A
|
|
75
|
+
]), G = g(() => R.isCreatingFolder || R.isDownloading || R.isDeleting || R.isRenaming || R.isCopying || R.isMoving || z.isUnsharing || z.isRemovingAccess || m(L.uploadBatchState), [
|
|
76
|
+
R.isCreatingFolder,
|
|
77
|
+
R.isDownloading,
|
|
78
|
+
R.isDeleting,
|
|
79
|
+
R.isRenaming,
|
|
80
|
+
R.isCopying,
|
|
81
|
+
R.isMoving,
|
|
82
|
+
z.isUnsharing,
|
|
83
|
+
z.isRemovingAccess,
|
|
84
|
+
L.uploadBatchState
|
|
85
|
+
]), K = h((e, t) => {
|
|
86
|
+
let n = R.onCreateFolderValidate(e, t);
|
|
87
|
+
return n ? P(n) : null;
|
|
88
|
+
}, [R, P]), q = h((e, t) => {
|
|
89
|
+
let n = R.onRenameValidate(e, t);
|
|
90
|
+
return n ? P(n, t) : null;
|
|
91
|
+
}, [R, P]);
|
|
89
92
|
return {
|
|
90
|
-
items:
|
|
91
|
-
isLoading:
|
|
92
|
-
error:
|
|
93
|
-
path:
|
|
94
|
-
onPathChange:
|
|
95
|
-
retry:
|
|
96
|
-
onSearchFiles:
|
|
97
|
-
isSearching:
|
|
98
|
-
searchResults:
|
|
99
|
-
clearSearchResults:
|
|
100
|
-
expandedPaths:
|
|
101
|
-
loadedPaths:
|
|
102
|
-
onExpandedPathsChange:
|
|
103
|
-
onFolderPopupPathChange:
|
|
104
|
-
folderPopupLoadingPaths:
|
|
105
|
-
onUploadFiles:
|
|
106
|
-
onUploadArchive:
|
|
107
|
-
onValidateUpload:
|
|
108
|
-
uploadBatchState:
|
|
109
|
-
cancelUpload:
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
93
|
+
items: I.items,
|
|
94
|
+
isLoading: I.isLoading,
|
|
95
|
+
error: I.error,
|
|
96
|
+
path: I.path,
|
|
97
|
+
onPathChange: I.onPathChange,
|
|
98
|
+
retry: I.retry,
|
|
99
|
+
onSearchFiles: I.onSearchFiles,
|
|
100
|
+
isSearching: I.isSearching,
|
|
101
|
+
searchResults: I.searchResults,
|
|
102
|
+
clearSearchResults: I.clearSearchResults,
|
|
103
|
+
expandedPaths: I.expandedPaths,
|
|
104
|
+
loadedPaths: I.loadedPaths,
|
|
105
|
+
onExpandedPathsChange: I.onExpandedPathsChange,
|
|
106
|
+
onFolderPopupPathChange: I.onFolderPopupPathChange,
|
|
107
|
+
folderPopupLoadingPaths: I.folderPopupLoadingPaths,
|
|
108
|
+
onUploadFiles: L.onUploadFiles,
|
|
109
|
+
onUploadArchive: L.onUploadArchive,
|
|
110
|
+
onValidateUpload: L.onValidateUpload,
|
|
111
|
+
uploadBatchState: L.uploadBatchState,
|
|
112
|
+
cancelUpload: L.cancelUpload,
|
|
113
|
+
cancelUploadFile: L.cancelUploadFile,
|
|
114
|
+
clearUploadBatch: L.clearUploadBatch,
|
|
115
|
+
onCreateFolder: R.onCreateFolder,
|
|
116
|
+
onCreateFolderValidate: K,
|
|
117
|
+
isCreatingFolder: R.isCreatingFolder,
|
|
118
|
+
onDownloadFiles: R.onDownloadFiles,
|
|
119
|
+
isDownloading: R.isDownloading,
|
|
120
|
+
onDeleteFiles: R.onDeleteFiles,
|
|
121
|
+
isDeleting: R.isDeleting,
|
|
122
|
+
onRenameValidate: q,
|
|
123
|
+
onMoveToFiles: R.onMoveToFiles,
|
|
124
|
+
isRenaming: R.isRenaming,
|
|
125
|
+
onCopyFiles: R.onCopyFiles,
|
|
126
|
+
isCopying: R.isCopying,
|
|
127
|
+
isMoving: R.isMoving,
|
|
128
|
+
cancelCopyMove: R.cancelCopyMove,
|
|
129
|
+
uploadEnabled: H,
|
|
130
|
+
isNewButtonDisabled: !H,
|
|
131
|
+
disabledNewButtonTooltip: M,
|
|
132
|
+
visibleColumns: U,
|
|
133
|
+
dateLocale: j,
|
|
130
134
|
dateOptions: n,
|
|
131
|
-
actionLabels:
|
|
132
|
-
sharedWithMeIds:
|
|
133
|
-
sharedByMePaths:
|
|
134
|
-
onUnshareFiles:
|
|
135
|
-
isUnsharing:
|
|
136
|
-
onRemoveFilesAccess:
|
|
137
|
-
isRemovingAccess:
|
|
138
|
-
fileMetadata:
|
|
139
|
-
isFileMetadataLoading:
|
|
140
|
-
onGetInfo:
|
|
141
|
-
clearMetadata:
|
|
142
|
-
isAnyOperationInProgress:
|
|
135
|
+
actionLabels: W,
|
|
136
|
+
sharedWithMeIds: I.sharedWithMeIds,
|
|
137
|
+
sharedByMePaths: I.sharedByMePaths,
|
|
138
|
+
onUnshareFiles: z.onUnshareFiles,
|
|
139
|
+
isUnsharing: z.isUnsharing,
|
|
140
|
+
onRemoveFilesAccess: z.onRemoveFilesAccess,
|
|
141
|
+
isRemovingAccess: z.isRemovingAccess,
|
|
142
|
+
fileMetadata: B.fileMetadata,
|
|
143
|
+
isFileMetadataLoading: B.isFileMetadataLoading,
|
|
144
|
+
onGetInfo: B.onGetInfo,
|
|
145
|
+
clearMetadata: B.clearMetadata,
|
|
146
|
+
isAnyOperationInProgress: G
|
|
143
147
|
};
|
|
144
148
|
};
|
|
145
149
|
//#endregion
|
|
146
|
-
export {
|
|
150
|
+
export { y as useDialFileManager };
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { FileManagerNotificationReason as e } from "../dial-file-manager.types.js";
|
|
2
|
+
import { DIAL_FILE_MANAGER_SECTION_TABS as t } from "../dial-file-manager.model.js";
|
|
3
|
+
import { hasSamePaths as n, resolveSectionByPath as r, unionPathSets as i, withRoutableRootLabels as ee } from "../dial-file-manager-path.util.js";
|
|
4
|
+
import { useDialFileManager as a } from "../useDialFileManager/useDialFileManager.js";
|
|
5
|
+
import { useEffect as te, useMemo as ne, useRef as re, useState as o } from "react";
|
|
6
|
+
import { NotificationVariant as s } from "@epam/ai-dial-ui-kit";
|
|
7
|
+
import { DialFileManagerTabs as c } from "@epam/ai-dial-react-file-manager";
|
|
8
|
+
//#region src/files/useDialFileManagerSections/useDialFileManagerSections.ts
|
|
9
|
+
var l = ({ activeTab: l, sections: u, ...d }) => {
|
|
10
|
+
let f = ne(() => ee(u.filter((e) => t.includes(e.tab))), [u]), p = l === c.All, m = (e) => {
|
|
11
|
+
let t = f.find((t) => t.tab === e);
|
|
12
|
+
return {
|
|
13
|
+
...d,
|
|
14
|
+
activeTab: e,
|
|
15
|
+
rootLabel: t?.rootLabel ?? e,
|
|
16
|
+
isActive: t != null && (p || l === e),
|
|
17
|
+
sessionKey: l
|
|
18
|
+
};
|
|
19
|
+
}, h = a(m(c.MyFiles)), g = a(m(c.Shared)), ie = a(m(c.Organization)), _ = (e) => {
|
|
20
|
+
switch (e) {
|
|
21
|
+
case c.MyFiles: return h;
|
|
22
|
+
case c.Shared: return g;
|
|
23
|
+
case c.Organization: return ie;
|
|
24
|
+
default: throw Error(`Not a file-manager section tab: ${e}`);
|
|
25
|
+
}
|
|
26
|
+
}, [v, y] = o(null), [b, x] = o(null), [S, C] = o(l);
|
|
27
|
+
S !== l && (C(l), y(null), x(null));
|
|
28
|
+
let w = (e) => f.some((t) => t.tab === e), ae = f[0]?.tab ?? c.MyFiles, T = v != null && w(v) ? v : ae, oe = b != null && w(b) ? b : T, E = (e) => e == null ? void 0 : r(e, f)?.tab, D = (e) => _(E(e) ?? T), O = (e, t) => {
|
|
29
|
+
let n = /* @__PURE__ */ new Map();
|
|
30
|
+
return e.forEach((e) => {
|
|
31
|
+
let r = E(t(e)) ?? T;
|
|
32
|
+
n.set(r, [...n.get(r) ?? [], e]);
|
|
33
|
+
}), [...n];
|
|
34
|
+
}, { onNotification: k } = d, A = re(/* @__PURE__ */ new Set());
|
|
35
|
+
te(() => {
|
|
36
|
+
let t = A.current;
|
|
37
|
+
if (!p) {
|
|
38
|
+
t.clear();
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
f.forEach(({ tab: n }) => {
|
|
42
|
+
if (_(n).error == null) {
|
|
43
|
+
t.delete(n);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
t.has(n) || (t.add(n), n !== T && k?.({
|
|
47
|
+
variant: s.Error,
|
|
48
|
+
reason: e.FolderLoadFailed
|
|
49
|
+
}));
|
|
50
|
+
});
|
|
51
|
+
}, [
|
|
52
|
+
f.map(({ tab: e }) => `${e}:${_(e).error ?? ""}`).join("|"),
|
|
53
|
+
p,
|
|
54
|
+
T,
|
|
55
|
+
k
|
|
56
|
+
]);
|
|
57
|
+
let j = () => {
|
|
58
|
+
k?.({
|
|
59
|
+
variant: s.Warning,
|
|
60
|
+
reason: e.CrossSectionTransferUnsupported
|
|
61
|
+
});
|
|
62
|
+
}, M = (e, t) => {
|
|
63
|
+
let n = new Set(e.map(E));
|
|
64
|
+
if (n.size !== 1) return;
|
|
65
|
+
let [r] = n;
|
|
66
|
+
if (r != null) return (t ? E(t) : r) === r ? r : void 0;
|
|
67
|
+
}, N = (e) => {
|
|
68
|
+
if (e == null) {
|
|
69
|
+
_(T).onPathChange();
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
let t = E(e);
|
|
73
|
+
t != null && (y(t), _(t).onPathChange(e));
|
|
74
|
+
}, P = (e) => {
|
|
75
|
+
f.forEach(({ tab: t }) => {
|
|
76
|
+
let r = _(t), i = new Set([...e].filter((e) => E(e) === t));
|
|
77
|
+
n(i, r.expandedPaths) || r.onExpandedPathsChange(i);
|
|
78
|
+
});
|
|
79
|
+
}, F = (e) => D(e).onFolderPopupPathChange(e), I = (e, t) => D(t).onUploadFiles(e, t), L = (e, t, n) => D(n).onUploadArchive(e, t, n), R = (e, t, n) => D(n).onValidateUpload(e, t, n), z = (e, t, n) => D(t).onCreateFolder(e, t, n), B = (e, t) => D(t.path).onCreateFolderValidate(e, t), V = (e) => O(e, (e) => e.path).forEach(([e, t]) => _(e).onDownloadFiles(t)), H = (e, t) => {
|
|
80
|
+
let n = E(t);
|
|
81
|
+
O(e, (e) => e.sourceUrl ?? t).forEach(([e, r]) => _(e).onDeleteFiles(r, e === n ? t : ""));
|
|
82
|
+
}, U = (e, t) => D(t.path).onRenameValidate(e, t), W = (e) => O(e, (e) => e.path).forEach(([e, t]) => _(e).onUnshareFiles(t)), G = (e) => O(e, (e) => e.path).forEach(([e, t]) => _(e).onRemoveFilesAccess(t)), K = (e) => {
|
|
83
|
+
let t = E(e.path) ?? T;
|
|
84
|
+
x(t), _(t).onGetInfo(e);
|
|
85
|
+
}, q = (e, t) => {
|
|
86
|
+
if (e.length === 0) return;
|
|
87
|
+
let n = M(e.map((e) => e.sourceUrl), t);
|
|
88
|
+
if (n == null) {
|
|
89
|
+
j();
|
|
90
|
+
return;
|
|
91
|
+
}
|
|
92
|
+
_(n).onCopyFiles(e, t);
|
|
93
|
+
}, se = (e, t, n) => {
|
|
94
|
+
if (e.length === 0) return;
|
|
95
|
+
let r = M(e.map((e) => e.sourceUrl ?? t), n);
|
|
96
|
+
if (r == null) {
|
|
97
|
+
j();
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
_(r).onMoveToFiles(e, t, n);
|
|
101
|
+
}, ce = () => f.forEach(({ tab: e }) => _(e).cancelCopyMove());
|
|
102
|
+
if (!p) {
|
|
103
|
+
let e = t.includes(l) ? l : c.MyFiles;
|
|
104
|
+
return {
|
|
105
|
+
..._(e),
|
|
106
|
+
sectionTab: e
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
let J = f.map(({ tab: e }) => _(e)), Y = _(T), X = _(oe), Z = [Y, ...J].find((e) => e.uploadBatchState != null) ?? Y, Q = (e) => J.some(e), $ = J.map((e) => e.sharedWithMeIds).filter((e) => e != null), le = new Set(f.filter(({ tab: e }) => e !== T && _(e).isLoading).map(({ tab: e }) => _(e).path));
|
|
110
|
+
return {
|
|
111
|
+
...Y,
|
|
112
|
+
items: J.map((e) => e.items[0]).filter((e) => e != null),
|
|
113
|
+
onPathChange: N,
|
|
114
|
+
expandedPaths: i(J.map((e) => e.expandedPaths)),
|
|
115
|
+
loadedPaths: i(J.map((e) => e.loadedPaths)),
|
|
116
|
+
onExpandedPathsChange: P,
|
|
117
|
+
onFolderPopupPathChange: F,
|
|
118
|
+
folderPopupLoadingPaths: i([...J.map((e) => e.folderPopupLoadingPaths), le]),
|
|
119
|
+
onUploadFiles: I,
|
|
120
|
+
onUploadArchive: L,
|
|
121
|
+
onValidateUpload: R,
|
|
122
|
+
uploadBatchState: Z.uploadBatchState,
|
|
123
|
+
cancelUpload: Z.cancelUpload,
|
|
124
|
+
cancelUploadFile: Z.cancelUploadFile,
|
|
125
|
+
clearUploadBatch: Z.clearUploadBatch,
|
|
126
|
+
onCreateFolder: z,
|
|
127
|
+
onCreateFolderValidate: B,
|
|
128
|
+
isCreatingFolder: Q((e) => e.isCreatingFolder),
|
|
129
|
+
onDownloadFiles: V,
|
|
130
|
+
isDownloading: Q((e) => e.isDownloading),
|
|
131
|
+
onDeleteFiles: H,
|
|
132
|
+
isDeleting: Q((e) => e.isDeleting),
|
|
133
|
+
onRenameValidate: U,
|
|
134
|
+
onMoveToFiles: se,
|
|
135
|
+
isRenaming: Q((e) => e.isRenaming),
|
|
136
|
+
onCopyFiles: q,
|
|
137
|
+
isCopying: Q((e) => e.isCopying),
|
|
138
|
+
isMoving: Q((e) => e.isMoving),
|
|
139
|
+
cancelCopyMove: ce,
|
|
140
|
+
sharedWithMeIds: $.length > 0 ? $.flat() : void 0,
|
|
141
|
+
sharedByMePaths: i(J.map((e) => e.sharedByMePaths)),
|
|
142
|
+
onUnshareFiles: W,
|
|
143
|
+
isUnsharing: Q((e) => e.isUnsharing),
|
|
144
|
+
onRemoveFilesAccess: G,
|
|
145
|
+
isRemovingAccess: Q((e) => e.isRemovingAccess),
|
|
146
|
+
fileMetadata: X.fileMetadata,
|
|
147
|
+
isFileMetadataLoading: X.isFileMetadataLoading,
|
|
148
|
+
onGetInfo: K,
|
|
149
|
+
clearMetadata: X.clearMetadata,
|
|
150
|
+
isAnyOperationInProgress: Q((e) => e.isAnyOperationInProgress),
|
|
151
|
+
sectionTab: T
|
|
152
|
+
};
|
|
153
|
+
};
|
|
154
|
+
//#endregion
|
|
155
|
+
export { l as useDialFileManagerSections };
|
|
@@ -1,19 +1,24 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { DIAL_FILE_MANAGER_SECTION_TABS as e } from "../dial-file-manager.model.js";
|
|
2
|
+
import { useCallback as t, useEffect as n, useMemo as r } from "react";
|
|
3
|
+
import { DialFileManagerTabs as i } from "@epam/ai-dial-react-file-manager";
|
|
3
4
|
//#region src/files/useDialFileManagerTabConfig/useDialFileManagerTabConfig.ts
|
|
4
|
-
var
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
5
|
+
var a = [
|
|
6
|
+
i.All,
|
|
7
|
+
i.MyFiles,
|
|
8
|
+
i.Shared,
|
|
9
|
+
i.Organization
|
|
10
|
+
], o = 2, s = (s, c, l, u) => {
|
|
11
|
+
let d = t((t) => {
|
|
12
|
+
let n = (e) => u == null || u.includes(e);
|
|
13
|
+
return n(t) ? t === i.All ? e.filter((e) => n(e)).length >= o : !0 : !1;
|
|
14
|
+
}, [u]), f = r(() => l?.filter((e) => d(e.value)), [l, d]);
|
|
15
|
+
return n(() => {
|
|
16
|
+
d(s) || c(a.find((e) => d(e)) ?? i.MyFiles);
|
|
12
17
|
}, [
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
]), { tabs:
|
|
18
|
+
d,
|
|
19
|
+
s,
|
|
20
|
+
c
|
|
21
|
+
]), { tabs: f };
|
|
17
22
|
};
|
|
18
23
|
//#endregion
|
|
19
|
-
export {
|
|
24
|
+
export { s as useDialFileManagerTabConfig };
|