@epam/ai-dial-chat-shared 1.2.0-dev.61 → 1.2.0-dev.69
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.
|
@@ -4,52 +4,52 @@ import { FileUploadStatus as n } from "../upload-batch.js";
|
|
|
4
4
|
import { useGridEditingScroll as te } from "../useGridEditingScroll/useGridEditingScroll.js";
|
|
5
5
|
import { OperationLoaderModal as ne } from "../OperationLoaderModal/OperationLoaderModal.js";
|
|
6
6
|
import { UploadProgressModal as re } from "../UploadProgressModal/UploadProgressModal.js";
|
|
7
|
-
import { NOT_ALLOWED_SYMBOLS_REGEXP as
|
|
7
|
+
import { NOT_ALLOWED_SYMBOLS_REGEXP as ie, PrimaryButton as r, Spinner as ae } from "@epam/ai-dial-ui-kit";
|
|
8
8
|
import { memo as i, useEffect as oe, useMemo as a, useState as se } from "react";
|
|
9
9
|
import { Fragment as ce, jsx as o, jsxs as s } from "react/jsx-runtime";
|
|
10
|
-
import { DialFileManager as le, DialFileManagerActions as c, DialFileManagerTabs as
|
|
10
|
+
import { DialFileManager as le, DialFileManagerActions as c, DialFileManagerTabs as ue, GridSelectionMode as de } from "@epam/ai-dial-react-file-manager";
|
|
11
11
|
//#region src/file-manager/DialFileManagerShell/DialFileManagerShell.tsx
|
|
12
|
-
var
|
|
12
|
+
var l = (e, t) => {
|
|
13
13
|
if (e.isDownloading) return t.downloadingLabel;
|
|
14
14
|
if (e.isDeleting) return t.deletingLabel;
|
|
15
15
|
if (e.isRenaming && !e.isMoving) return t.renamingLabel;
|
|
16
16
|
if (e.isUnsharing) return t.unsharingLabel;
|
|
17
17
|
if (e.isRemovingAccess) return t.removingAccessLabel;
|
|
18
|
-
},
|
|
19
|
-
let { items:
|
|
18
|
+
}, u = ({ controller: i, labels: u, activeTab: d, tabs: f, onTabChange: p, selectedPaths: m, onSelectedPathsChange: fe, variant: pe, actionProfile: me, autoSelectUploadedItems: he = !1, allowedFileTypes: ge, maxSelectableFileSize: h, oversizedUploadMessage: g, isRowSelectable: _, getDisabledTooltip: _e, unsupportedFileTypeTooltip: ve }) => {
|
|
19
|
+
let { items: ye, isLoading: be, error: xe, path: v, onPathChange: Se, retry: Ce, onSearchFiles: we, isSearching: y, searchResults: b, clearSearchResults: Te, expandedPaths: x, loadedPaths: S, onExpandedPathsChange: C, onFolderPopupPathChange: w, folderPopupLoadingPaths: T, onUploadFiles: E, onUploadArchive: D, onValidateUpload: O, uploadBatchState: k, cancelUpload: A, clearUploadBatch: Ee, onCreateFolder: De, onCreateFolderValidate: Oe, onDownloadFiles: ke, isDownloading: Ae, onDeleteFiles: je, isDeleting: Me, onMoveToFiles: Ne, onRenameValidate: Pe, isRenaming: Fe, onCopyFiles: Ie, isCopying: Le, isMoving: j, cancelCopyMove: Re, uploadEnabled: M, isNewButtonDisabled: N, disabledNewButtonTooltip: P, visibleColumns: F, dateLocale: I, dateOptions: L, actionLabels: R, sharedWithMeIds: ze, sharedByMePaths: z, onUnshareFiles: Be, isUnsharing: Ve, onRemoveFilesAccess: He, isRemovingAccess: Ue, fileMetadata: B, isFileMetadataLoading: V, onGetInfo: We, clearMetadata: H } = i, [U, Ge] = se(void 0), { handleGridApiChange: Ke, reset: W } = te();
|
|
20
20
|
oe(() => {
|
|
21
21
|
W();
|
|
22
|
-
}, [
|
|
22
|
+
}, [d, W]);
|
|
23
23
|
let G = a(() => {
|
|
24
24
|
let e = {};
|
|
25
|
-
return c.Download in R && (e[c.Download] =
|
|
25
|
+
return c.Download in R && (e[c.Download] = u.downloadLabel), c.Delete in R && (e[c.Delete] = u.deleteLabel), c.Rename in R && (e[c.Rename] = u.renameLabel), c.Copy in R && (e[c.Copy] = u.copyLabel), c.Move in R && (e[c.Move] = u.moveLabel), c.Duplicate in R && (e[c.Duplicate] = u.duplicateLabel), c.Unshare in R && (e[c.Unshare] = u.unshareLabel), c.RemoveAccess in R && (e[c.RemoveAccess] = u.removeAccessLabel), e;
|
|
26
26
|
}, [
|
|
27
27
|
R,
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
u.downloadLabel,
|
|
29
|
+
u.deleteLabel,
|
|
30
|
+
u.renameLabel,
|
|
31
|
+
u.copyLabel,
|
|
32
|
+
u.moveLabel,
|
|
33
|
+
u.duplicateLabel,
|
|
34
|
+
u.unshareLabel,
|
|
35
|
+
u.removeAccessLabel
|
|
36
36
|
]), K = a(() => c.Info in R ? {
|
|
37
37
|
...G,
|
|
38
|
-
[c.Info]:
|
|
38
|
+
[c.Info]: u.infoLabel
|
|
39
39
|
} : G, [
|
|
40
40
|
G,
|
|
41
41
|
R,
|
|
42
|
-
|
|
42
|
+
u.infoLabel
|
|
43
43
|
]), q = a(() => {
|
|
44
|
-
if (
|
|
45
|
-
for (let e of
|
|
44
|
+
if (m.size === 0) return !1;
|
|
45
|
+
for (let e of m) if (!z.has(e)) return !1;
|
|
46
46
|
return !0;
|
|
47
|
-
}, [
|
|
47
|
+
}, [m, z]), J = a(() => {
|
|
48
48
|
if (q) return G;
|
|
49
49
|
let { [c.RemoveAccess]: e, ...t } = G;
|
|
50
50
|
return t;
|
|
51
|
-
}, [G, q]),
|
|
52
|
-
selectionMode:
|
|
51
|
+
}, [G, q]), qe = a(() => ({
|
|
52
|
+
selectionMode: de.MULTIPLE,
|
|
53
53
|
visibleColumns: F,
|
|
54
54
|
dateLocale: I,
|
|
55
55
|
dateOptions: L,
|
|
@@ -67,201 +67,203 @@ var d = (e, t) => {
|
|
|
67
67
|
L,
|
|
68
68
|
K,
|
|
69
69
|
_
|
|
70
|
-
]),
|
|
71
|
-
header:
|
|
70
|
+
]), Je = a(() => ({
|
|
71
|
+
header: u.treeHeaderByTab[d],
|
|
72
72
|
expandedPaths: x,
|
|
73
73
|
loadedPaths: S,
|
|
74
74
|
loadingPaths: T,
|
|
75
75
|
onExpandedPathsChange: C,
|
|
76
76
|
actionLabels: G
|
|
77
77
|
}), [
|
|
78
|
-
|
|
79
|
-
|
|
78
|
+
u.treeHeaderByTab,
|
|
79
|
+
d,
|
|
80
80
|
x,
|
|
81
81
|
S,
|
|
82
82
|
T,
|
|
83
83
|
C,
|
|
84
84
|
G
|
|
85
|
-
]), Y =
|
|
86
|
-
tabs:
|
|
87
|
-
activeTab:
|
|
88
|
-
onTabChange:
|
|
85
|
+
]), Y = pe === t.Standalone && me === e.Full && d === ue.MyFiles && M, Ye = a(() => ({
|
|
86
|
+
tabs: f,
|
|
87
|
+
activeTab: d,
|
|
88
|
+
onTabChange: p,
|
|
89
89
|
showHiddenFilesToggle: !0,
|
|
90
|
-
hiddenFilesSwitcherLabel:
|
|
91
|
-
showHiddenFilesLabel:
|
|
92
|
-
hideHiddenFilesLabel:
|
|
90
|
+
hiddenFilesSwitcherLabel: u.hiddenFilesLabel,
|
|
91
|
+
showHiddenFilesLabel: u.showHiddenFilesLabel,
|
|
92
|
+
hideHiddenFilesLabel: u.hideHiddenFilesLabel,
|
|
93
93
|
isNewButtonDisabled: N,
|
|
94
94
|
disabledNewButtonTooltip: P,
|
|
95
95
|
newActions: {
|
|
96
|
-
uploadFiles: { label:
|
|
97
|
-
newFolder: { label:
|
|
98
|
-
...Y ? { uploadArchive: { label:
|
|
96
|
+
uploadFiles: { label: u.uploadFilesLabel },
|
|
97
|
+
newFolder: { label: u.newFolderLabel },
|
|
98
|
+
...Y ? { uploadArchive: { label: u.uploadArchiveAction } } : {}
|
|
99
99
|
}
|
|
100
100
|
}), [
|
|
101
|
-
|
|
101
|
+
f,
|
|
102
|
+
d,
|
|
102
103
|
p,
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
f.hideHiddenFilesLabel,
|
|
104
|
+
u.hiddenFilesLabel,
|
|
105
|
+
u.showHiddenFilesLabel,
|
|
106
|
+
u.hideHiddenFilesLabel,
|
|
107
107
|
N,
|
|
108
108
|
P,
|
|
109
|
-
|
|
110
|
-
|
|
109
|
+
u.uploadFilesLabel,
|
|
110
|
+
u.newFolderLabel,
|
|
111
111
|
Y,
|
|
112
|
-
|
|
113
|
-
]),
|
|
114
|
-
getSelectionLabel:
|
|
112
|
+
u.uploadArchiveAction
|
|
113
|
+
]), Xe = a(() => ({
|
|
114
|
+
getSelectionLabel: u.getSelectionLabel,
|
|
115
115
|
actionLabels: J
|
|
116
|
-
}), [
|
|
117
|
-
cancelLabel:
|
|
118
|
-
confirmLabel:
|
|
119
|
-
titleRenderer:
|
|
120
|
-
contentRenderer:
|
|
116
|
+
}), [u.getSelectionLabel, J]), Ze = a(() => ({
|
|
117
|
+
cancelLabel: u.deleteCancelLabel,
|
|
118
|
+
confirmLabel: u.deleteConfirmLabel,
|
|
119
|
+
titleRenderer: u.deleteConfirmTitle,
|
|
120
|
+
contentRenderer: u.deleteConfirmBody
|
|
121
121
|
}), [
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
]),
|
|
122
|
+
u.deleteCancelLabel,
|
|
123
|
+
u.deleteConfirmLabel,
|
|
124
|
+
u.deleteConfirmTitle,
|
|
125
|
+
u.deleteConfirmBody
|
|
126
|
+
]), Qe = a(() => {
|
|
127
127
|
let e;
|
|
128
|
-
for (let t of
|
|
128
|
+
for (let t of m) {
|
|
129
129
|
let n = ee(t);
|
|
130
130
|
if (e === void 0) e = n;
|
|
131
131
|
else if (e !== n) return;
|
|
132
132
|
}
|
|
133
133
|
return e;
|
|
134
|
-
}, [
|
|
135
|
-
copyLabel:
|
|
136
|
-
moveLabel:
|
|
137
|
-
addFolderLabel:
|
|
138
|
-
hiddenFilesSwitcherLabel:
|
|
139
|
-
getCopyHeader:
|
|
140
|
-
getMoveHeader:
|
|
141
|
-
disabledPathTooltip: X ?
|
|
142
|
-
emptyStateTitle:
|
|
143
|
-
emptyStateDescription:
|
|
134
|
+
}, [m]), X = U != null && T.has(U), Z = X ? U : Qe, $e = a(() => ({
|
|
135
|
+
copyLabel: u.copyLabel,
|
|
136
|
+
moveLabel: u.moveLabel,
|
|
137
|
+
addFolderLabel: u.addFolderLabel,
|
|
138
|
+
hiddenFilesSwitcherLabel: u.hiddenFilesSwitcherLabel,
|
|
139
|
+
getCopyHeader: u.getCopyHeader,
|
|
140
|
+
getMoveHeader: u.getMoveHeader,
|
|
141
|
+
disabledPathTooltip: X ? u.folderPickerLoadingTooltip : u.moveSourceDisabledTooltip,
|
|
142
|
+
emptyStateTitle: u.folderPickerEmptyStateTitle,
|
|
143
|
+
emptyStateDescription: u.folderPickerEmptyStateDescription,
|
|
144
144
|
sourceFolder: Z,
|
|
145
145
|
destinationFolderPath: U,
|
|
146
|
-
setDestinationFolderPath:
|
|
146
|
+
setDestinationFolderPath: Ge,
|
|
147
147
|
filesLoading: X
|
|
148
148
|
}), [
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
149
|
+
u.copyLabel,
|
|
150
|
+
u.moveLabel,
|
|
151
|
+
u.addFolderLabel,
|
|
152
|
+
u.hiddenFilesSwitcherLabel,
|
|
153
|
+
u.getCopyHeader,
|
|
154
|
+
u.getMoveHeader,
|
|
155
|
+
u.folderPickerLoadingTooltip,
|
|
156
|
+
u.moveSourceDisabledTooltip,
|
|
157
|
+
u.folderPickerEmptyStateTitle,
|
|
158
|
+
u.folderPickerEmptyStateDescription,
|
|
159
159
|
X,
|
|
160
160
|
Z,
|
|
161
161
|
U
|
|
162
|
-
]),
|
|
163
|
-
|
|
164
|
-
},
|
|
162
|
+
]), et = () => {
|
|
163
|
+
A(), Ee();
|
|
164
|
+
}, tt = a(() => ({
|
|
165
165
|
fileMetadata: B,
|
|
166
166
|
loading: V,
|
|
167
167
|
clearMetadata: H,
|
|
168
|
-
header:
|
|
169
|
-
nameLabel:
|
|
170
|
-
pathLabel:
|
|
171
|
-
modifiedDateLabel:
|
|
172
|
-
sizeLabel:
|
|
173
|
-
authorLabel:
|
|
168
|
+
header: u.metadataHeader,
|
|
169
|
+
nameLabel: u.metadataNameLabel,
|
|
170
|
+
pathLabel: u.metadataPathLabel,
|
|
171
|
+
modifiedDateLabel: u.metadataModifiedDateLabel,
|
|
172
|
+
sizeLabel: u.metadataSizeLabel,
|
|
173
|
+
authorLabel: u.metadataAuthorLabel
|
|
174
174
|
}), [
|
|
175
175
|
B,
|
|
176
176
|
V,
|
|
177
177
|
H,
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
]), Q =
|
|
185
|
-
isDownloading:
|
|
186
|
-
isDeleting:
|
|
187
|
-
isRenaming:
|
|
178
|
+
u.metadataHeader,
|
|
179
|
+
u.metadataNameLabel,
|
|
180
|
+
u.metadataPathLabel,
|
|
181
|
+
u.metadataModifiedDateLabel,
|
|
182
|
+
u.metadataSizeLabel,
|
|
183
|
+
u.metadataAuthorLabel
|
|
184
|
+
]), Q = l({
|
|
185
|
+
isDownloading: Ae,
|
|
186
|
+
isDeleting: Me,
|
|
187
|
+
isRenaming: Fe,
|
|
188
188
|
isMoving: j,
|
|
189
|
-
isUnsharing:
|
|
190
|
-
isRemovingAccess:
|
|
191
|
-
},
|
|
189
|
+
isUnsharing: Ve,
|
|
190
|
+
isRemovingAccess: Ue
|
|
191
|
+
}, u), nt = a(() => {
|
|
192
192
|
if (k == null) return "";
|
|
193
193
|
let e = k.files.filter((e) => e.status !== n.Uploading).length;
|
|
194
|
-
return
|
|
195
|
-
}, [k,
|
|
196
|
-
title:
|
|
194
|
+
return u.getUploadProgressText(e, k.files.length);
|
|
195
|
+
}, [k, u]), $ = a(() => b != null && !y ? {
|
|
196
|
+
title: u.searchEmptyStateTitle,
|
|
197
197
|
description: ""
|
|
198
198
|
} : v.split("/").filter(Boolean).length > 1 ? {
|
|
199
|
-
title:
|
|
199
|
+
title: u.folderEmptyStateTitle,
|
|
200
200
|
description: ""
|
|
201
|
-
} :
|
|
201
|
+
} : u.emptyStateByTab[d], [
|
|
202
202
|
b,
|
|
203
203
|
y,
|
|
204
204
|
v,
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
205
|
+
u.searchEmptyStateTitle,
|
|
206
|
+
u.folderEmptyStateTitle,
|
|
207
|
+
u.emptyStateByTab,
|
|
208
|
+
d
|
|
209
209
|
]);
|
|
210
210
|
return /* @__PURE__ */ s(ce, { children: [
|
|
211
|
-
|
|
211
|
+
xe == null ? /* @__PURE__ */ s("div", {
|
|
212
212
|
className: "relative flex min-h-0 w-full grow overflow-auto bg-layer-sunken",
|
|
213
213
|
children: [/* @__PURE__ */ o(le, {
|
|
214
214
|
className: "min-h-0 w-full grow bg-layer-sunken",
|
|
215
215
|
gridClassName: "size-full",
|
|
216
|
-
items:
|
|
216
|
+
items: ye,
|
|
217
217
|
path: v,
|
|
218
|
-
onPathChange:
|
|
219
|
-
onGridApiChange:
|
|
220
|
-
filesLoading:
|
|
221
|
-
allowedFileTypes:
|
|
222
|
-
maxSelectableFileSize:
|
|
223
|
-
|
|
224
|
-
|
|
218
|
+
onPathChange: Se,
|
|
219
|
+
onGridApiChange: Ke,
|
|
220
|
+
filesLoading: be,
|
|
221
|
+
allowedFileTypes: ge,
|
|
222
|
+
maxSelectableFileSize: h,
|
|
223
|
+
maxFileSize: h,
|
|
224
|
+
uploadValidationMessages: g == null ? void 0 : { oversizedFiles: g },
|
|
225
|
+
selectedPaths: m,
|
|
226
|
+
onSelectedPathsChange: fe,
|
|
225
227
|
navigationPanelOptions: { searchable: !0 },
|
|
226
228
|
hideSearchPathItemName: !0,
|
|
227
|
-
onSearchFiles:
|
|
229
|
+
onSearchFiles: we,
|
|
228
230
|
searchInProgress: y,
|
|
229
231
|
searchResults: b ?? [],
|
|
230
|
-
clearSearchResults:
|
|
231
|
-
gridOptions:
|
|
232
|
-
treeOptions:
|
|
232
|
+
clearSearchResults: Te,
|
|
233
|
+
gridOptions: qe,
|
|
234
|
+
treeOptions: Je,
|
|
233
235
|
onFolderPopupPathChange: w,
|
|
234
|
-
toolbarOptions:
|
|
235
|
-
bulkActionsToolbarOptions:
|
|
236
|
-
autoSelectUploadedItems:
|
|
236
|
+
toolbarOptions: Ye,
|
|
237
|
+
bulkActionsToolbarOptions: Xe,
|
|
238
|
+
autoSelectUploadedItems: he,
|
|
237
239
|
emptyStateTitle: $.title,
|
|
238
240
|
emptyStateDescription: $.description,
|
|
239
241
|
uploadEnabled: M,
|
|
240
|
-
sharedWithMeIds:
|
|
242
|
+
sharedWithMeIds: ze,
|
|
241
243
|
sharedByMePaths: z,
|
|
242
|
-
onUnshareFiles:
|
|
243
|
-
onRemoveFilesAccess:
|
|
244
|
-
fileMetadataPopupOptions:
|
|
245
|
-
onGetInfo:
|
|
244
|
+
onUnshareFiles: Be,
|
|
245
|
+
onRemoveFilesAccess: He,
|
|
246
|
+
fileMetadataPopupOptions: tt,
|
|
247
|
+
onGetInfo: We,
|
|
246
248
|
onUploadFiles: E,
|
|
247
249
|
onUploadArchive: D,
|
|
248
250
|
onValidateUpload: O,
|
|
249
|
-
onCreateFolder:
|
|
250
|
-
onCreateFolderValidate:
|
|
251
|
-
onDownloadFiles:
|
|
252
|
-
onDeleteFiles:
|
|
253
|
-
onMoveToFiles:
|
|
254
|
-
onCopyFiles:
|
|
255
|
-
onRenameValidate:
|
|
256
|
-
renameValidationMessages:
|
|
251
|
+
onCreateFolder: De,
|
|
252
|
+
onCreateFolderValidate: Oe,
|
|
253
|
+
onDownloadFiles: ke,
|
|
254
|
+
onDeleteFiles: je,
|
|
255
|
+
onMoveToFiles: Ne,
|
|
256
|
+
onCopyFiles: Ie,
|
|
257
|
+
onRenameValidate: Pe,
|
|
258
|
+
renameValidationMessages: u.renameValidationMessages,
|
|
257
259
|
isRenameFileAvailable: M,
|
|
258
|
-
deleteConfirmationOptions:
|
|
259
|
-
conflictResolutionPopupOptions:
|
|
260
|
-
destinationFolderPopupOptions:
|
|
261
|
-
forbiddenSymbolsRegExp:
|
|
262
|
-
forbiddenSymbolsTooltip:
|
|
263
|
-
getDisabledTooltip:
|
|
264
|
-
unsupportedFileTypeTooltip:
|
|
260
|
+
deleteConfirmationOptions: Ze,
|
|
261
|
+
conflictResolutionPopupOptions: u.conflictResolutionPopupOptions,
|
|
262
|
+
destinationFolderPopupOptions: $e,
|
|
263
|
+
forbiddenSymbolsRegExp: ie,
|
|
264
|
+
forbiddenSymbolsTooltip: u.forbiddenSymbolsTooltip,
|
|
265
|
+
getDisabledTooltip: _e,
|
|
266
|
+
unsupportedFileTypeTooltip: ve
|
|
265
267
|
}), Q != null && /* @__PURE__ */ o("div", {
|
|
266
268
|
"aria-live": "polite",
|
|
267
269
|
className: "absolute inset-0 z-[52] flex items-center justify-center bg-backdrop desktop:p-4",
|
|
@@ -274,26 +276,26 @@ var d = (e, t) => {
|
|
|
274
276
|
}) : /* @__PURE__ */ s("div", {
|
|
275
277
|
role: "alert",
|
|
276
278
|
className: "flex flex-col items-center gap-4 p-6",
|
|
277
|
-
children: [/* @__PURE__ */ o("p", { children:
|
|
278
|
-
label:
|
|
279
|
-
onClick:
|
|
279
|
+
children: [/* @__PURE__ */ o("p", { children: u.errorMessage }), /* @__PURE__ */ o(r, {
|
|
280
|
+
label: u.retryLabel,
|
|
281
|
+
onClick: Ce
|
|
280
282
|
})]
|
|
281
283
|
}),
|
|
282
284
|
k != null && /* @__PURE__ */ o(re, {
|
|
283
285
|
batchState: k,
|
|
284
|
-
uploadProgressTitle:
|
|
285
|
-
uploadProgressText:
|
|
286
|
-
cancelLabel:
|
|
287
|
-
onCancel:
|
|
286
|
+
uploadProgressTitle: u.uploadProgressTitle,
|
|
287
|
+
uploadProgressText: nt,
|
|
288
|
+
cancelLabel: u.cancelLabel,
|
|
289
|
+
onCancel: et
|
|
288
290
|
}),
|
|
289
|
-
(
|
|
290
|
-
title: j ?
|
|
291
|
-
text: j ?
|
|
292
|
-
cancelLabel:
|
|
293
|
-
onCancel:
|
|
291
|
+
(Le || j) && /* @__PURE__ */ o(ne, {
|
|
292
|
+
title: j ? u.operationLoaderMoveTitle : u.operationLoaderCopyTitle,
|
|
293
|
+
text: j ? u.movingLabel : u.copyingLabel,
|
|
294
|
+
cancelLabel: u.operationLoaderCancelLabel,
|
|
295
|
+
onCancel: Re
|
|
294
296
|
})
|
|
295
297
|
] });
|
|
296
298
|
};
|
|
297
|
-
i(
|
|
299
|
+
i(u);
|
|
298
300
|
//#endregion
|
|
299
|
-
export {
|
|
301
|
+
export { u as DialFileManagerShell };
|
|
@@ -5,38 +5,38 @@ import { memo as a, useCallback as o, useMemo as s } from "react";
|
|
|
5
5
|
import { jsx as c, jsxs as l } from "react/jsx-runtime";
|
|
6
6
|
import { DialFileNodeType as u } from "@epam/ai-dial-react-file-manager";
|
|
7
7
|
//#region src/file-manager/FileManagerAttachModal/FileManagerAttachModal.tsx
|
|
8
|
-
var d = a(({ isOpen: a, onClose: d, onAttach: f, onSkippedUnsupportedFiles: p, onCountLimitExceeded: m, controller: h, isAnyOperationInProgress: g, activeTab: _, tabs: v, onTabChange: y, labels: b, variant: x, actionProfile: S, selectedPaths: C, onSelectedPathsChange: w, resolveFolderPath: T, isFileTypeAllowed: E, maxSelectableFileSize: D, maximumAttachmentsAmount: O, existingAttachmentsAmount: k = 0, isRowSelectable: A, getDisabledTooltip: j, unsupportedFileTypeTooltip: M, allowedFileTypes: N, autoSelectUploadedItems: P = !1 }) => {
|
|
9
|
-
let { items:
|
|
8
|
+
var d = a(({ isOpen: a, onClose: d, onAttach: f, onSkippedUnsupportedFiles: p, onCountLimitExceeded: m, controller: h, isAnyOperationInProgress: g, activeTab: _, tabs: v, onTabChange: y, labels: b, variant: x, actionProfile: S, selectedPaths: C, onSelectedPathsChange: w, resolveFolderPath: T, isFileTypeAllowed: E, maxSelectableFileSize: D, maximumAttachmentsAmount: O, existingAttachmentsAmount: k = 0, isRowSelectable: A, getDisabledTooltip: j, unsupportedFileTypeTooltip: M, allowedFileTypes: N, autoSelectUploadedItems: P = !1, oversizedUploadMessage: F }) => {
|
|
9
|
+
let { items: I, isLoading: L, searchResults: R } = h, z = s(() => {
|
|
10
10
|
let e = /* @__PURE__ */ new Map(), t = (n) => {
|
|
11
11
|
n.forEach((n) => {
|
|
12
12
|
(n.nodeType === u.ITEM || n.nodeType === u.FOLDER) && (e.set(n.path, n), n.id && e.set(n.id, n)), n.items && t(n.items);
|
|
13
13
|
});
|
|
14
14
|
};
|
|
15
|
-
return t(
|
|
15
|
+
return t(I), R?.forEach((t) => {
|
|
16
16
|
e.set(t.path, t), t.id && e.set(t.id, t);
|
|
17
17
|
}), e;
|
|
18
|
-
}, [
|
|
18
|
+
}, [I, R]), B = s(() => Array.from(C).map((e) => z.get(e)).filter((e) => e != null), [z, C]), V = o((e) => {
|
|
19
19
|
if (A == null) {
|
|
20
20
|
w(new Set(e));
|
|
21
21
|
return;
|
|
22
22
|
}
|
|
23
23
|
let t = /* @__PURE__ */ new Set();
|
|
24
24
|
for (let n of e) {
|
|
25
|
-
let e =
|
|
25
|
+
let e = z.get(n);
|
|
26
26
|
e != null && A({ data: e }) && t.add(n);
|
|
27
27
|
}
|
|
28
28
|
w(t);
|
|
29
29
|
}, [
|
|
30
|
-
|
|
30
|
+
z,
|
|
31
31
|
A,
|
|
32
32
|
w
|
|
33
|
-
]),
|
|
33
|
+
]), H = o(() => {
|
|
34
34
|
let t = [], n = [];
|
|
35
|
-
for (let r of
|
|
35
|
+
for (let r of B) e(r.path) || (r.nodeType === u.FOLDER ? t.push(r.path) : n.push(r));
|
|
36
36
|
let r = t.filter((e) => !t.some((t) => t !== e && e.startsWith(`${t}/`))), i = n.filter((t) => !(e(t.path) || E != null && t.contentType != null && !E(t.contentType))), a = i.filter((e) => !r.some((t) => e.path.startsWith(`${t}/`)));
|
|
37
37
|
n.length - i.length > 0 && p?.();
|
|
38
38
|
let o = r.flatMap((e) => {
|
|
39
|
-
let t =
|
|
39
|
+
let t = z.get(e);
|
|
40
40
|
if (t == null) return [];
|
|
41
41
|
let n = T(t);
|
|
42
42
|
return n == null ? [] : [n];
|
|
@@ -53,44 +53,44 @@ var d = a(({ isOpen: a, onClose: d, onAttach: f, onSkippedUnsupportedFiles: p, o
|
|
|
53
53
|
f,
|
|
54
54
|
p,
|
|
55
55
|
m,
|
|
56
|
-
|
|
56
|
+
B,
|
|
57
57
|
E,
|
|
58
58
|
O,
|
|
59
59
|
k,
|
|
60
|
-
|
|
60
|
+
z,
|
|
61
61
|
T
|
|
62
|
-
]), { title:
|
|
62
|
+
]), { title: U, attachLabel: W, headerDescription: G, ...K } = b;
|
|
63
63
|
return /* @__PURE__ */ c(n, {
|
|
64
64
|
open: a,
|
|
65
65
|
header: /* @__PURE__ */ l("div", {
|
|
66
66
|
className: "flex flex-col gap-1",
|
|
67
|
-
children: [/* @__PURE__ */ c("span", { children:
|
|
67
|
+
children: [/* @__PURE__ */ c("span", { children: U }), G != null && /* @__PURE__ */ c("p", {
|
|
68
68
|
className: "dial-small-text text-start",
|
|
69
|
-
children:
|
|
69
|
+
children: G
|
|
70
70
|
})]
|
|
71
71
|
}),
|
|
72
|
-
ariaLabel:
|
|
72
|
+
ariaLabel: U,
|
|
73
73
|
size: r.Lg,
|
|
74
74
|
className: "flex !h-[min(800px,100dvh)] w-full flex-col !bg-layer-sunken",
|
|
75
75
|
onClose: d,
|
|
76
76
|
footer: /* @__PURE__ */ c("div", {
|
|
77
77
|
className: "flex justify-end px-6 py-4",
|
|
78
78
|
children: /* @__PURE__ */ c(i, {
|
|
79
|
-
label:
|
|
80
|
-
disabled:
|
|
81
|
-
onClick:
|
|
79
|
+
label: W,
|
|
80
|
+
disabled: B.length === 0 || L || g,
|
|
81
|
+
onClick: H
|
|
82
82
|
})
|
|
83
83
|
}),
|
|
84
84
|
children: /* @__PURE__ */ c("div", {
|
|
85
85
|
className: "flex min-h-0 flex-col",
|
|
86
86
|
children: /* @__PURE__ */ c(t, {
|
|
87
87
|
controller: h,
|
|
88
|
-
labels:
|
|
88
|
+
labels: K,
|
|
89
89
|
activeTab: _,
|
|
90
90
|
tabs: v,
|
|
91
91
|
onTabChange: y,
|
|
92
92
|
selectedPaths: C,
|
|
93
|
-
onSelectedPathsChange:
|
|
93
|
+
onSelectedPathsChange: V,
|
|
94
94
|
variant: x,
|
|
95
95
|
actionProfile: S,
|
|
96
96
|
autoSelectUploadedItems: P,
|
|
@@ -98,7 +98,8 @@ var d = a(({ isOpen: a, onClose: d, onAttach: f, onSkippedUnsupportedFiles: p, o
|
|
|
98
98
|
maxSelectableFileSize: D,
|
|
99
99
|
isRowSelectable: A,
|
|
100
100
|
getDisabledTooltip: j,
|
|
101
|
-
unsupportedFileTypeTooltip: M
|
|
101
|
+
unsupportedFileTypeTooltip: M,
|
|
102
|
+
oversizedUploadMessage: F
|
|
102
103
|
})
|
|
103
104
|
})
|
|
104
105
|
});
|
package/file-manager.d.ts
CHANGED
|
@@ -190,8 +190,10 @@ export declare interface DialFileManagerShellProps {
|
|
|
190
190
|
autoSelectUploadedItems?: boolean;
|
|
191
191
|
/** MIME type filters for selectable files. */
|
|
192
192
|
allowedFileTypes?: DialFileAcceptType[];
|
|
193
|
-
/** Maximum file size in bytes for selectable files. */
|
|
193
|
+
/** Maximum file size in bytes for selectable files, and — reused as the ui-kit's own `maxFileSize` — the maximum size accepted for a newly-uploaded file. */
|
|
194
194
|
maxSelectableFileSize?: number;
|
|
195
|
+
/** Pre-translated message shown by the ui-kit when a newly-selected file exceeds `maxSelectableFileSize`. Omit to leave upload-size validation unrestricted regardless of `maxSelectableFileSize`. */
|
|
196
|
+
oversizedUploadMessage?: string;
|
|
195
197
|
/** Custom row-selectability predicate, forwarded to the grid's row selection. */
|
|
196
198
|
isRowSelectable?: (node: {
|
|
197
199
|
data?: FileManagerSelectableNode | null;
|
|
@@ -316,6 +318,8 @@ export declare interface FileManagerAttachModalProps {
|
|
|
316
318
|
allowedFileTypes?: DialFileAcceptType[];
|
|
317
319
|
/** Whether to auto-select items immediately after upload. Defaults to `false`. */
|
|
318
320
|
autoSelectUploadedItems?: boolean;
|
|
321
|
+
/** Pre-translated message shown by the ui-kit when a newly-selected file exceeds `maxSelectableFileSize`. Omit to leave upload-size validation unrestricted regardless of `maxSelectableFileSize`. */
|
|
322
|
+
oversizedUploadMessage?: string;
|
|
319
323
|
}
|
|
320
324
|
|
|
321
325
|
/**
|
package/index.d.ts
CHANGED
|
@@ -140,7 +140,9 @@ export declare enum AttachmentErrorReason {
|
|
|
140
140
|
/** Upload failed because the device was offline. */
|
|
141
141
|
Network = "network",
|
|
142
142
|
/** File MIME type is not in the deployment's inputAttachmentTypes list. */
|
|
143
|
-
UnsupportedType = "unsupported-type"
|
|
143
|
+
UnsupportedType = "unsupported-type",
|
|
144
|
+
/** File size exceeds the configured maximum attachment size. */
|
|
145
|
+
FileTooLarge = "file-too-large"
|
|
144
146
|
}
|
|
145
147
|
|
|
146
148
|
/** A file attachment referenced by a citation — same shape as `MessageAttachment` but scoped to annotations. */
|
package/package.json
CHANGED
package/types/attachment.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
//#region src/types/attachment.ts
|
|
2
2
|
var e = /* @__PURE__ */ function(e) {
|
|
3
|
-
return e.Network = "network", e.UnsupportedType = "unsupported-type", e;
|
|
3
|
+
return e.Network = "network", e.UnsupportedType = "unsupported-type", e.FileTooLarge = "file-too-large", e;
|
|
4
4
|
}({}), t = /* @__PURE__ */ function(e) {
|
|
5
5
|
return e.File = "file", e.Image = "image", e.Audio = "audio", e.Prompt = "prompt", e.Pasted = "pasted", e.Link = "link", e;
|
|
6
6
|
}({});
|