@epam/ai-dial-chat-shared 1.4.0-dev.182 → 1.4.0-dev.187
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FileManagerDestinationPanel.d.ts","sourceRoot":"","sources":["../../../src/file-manager/FileManagerDestinationPanel/FileManagerDestinationPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EAEd,MAAM,kCAAkC,CAAC;AAQ1C,OAAO,EAAE,EAAE,EAA6C,MAAM,OAAO,CAAC;AAStE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"FileManagerDestinationPanel.d.ts","sourceRoot":"","sources":["../../../src/file-manager/FileManagerDestinationPanel/FileManagerDestinationPanel.tsx"],"names":[],"mappings":"AAAA,OAAO,EAOL,KAAK,sBAAsB,EAC3B,KAAK,QAAQ,EAEd,MAAM,kCAAkC,CAAC;AAQ1C,OAAO,EAAE,EAAE,EAA6C,MAAM,OAAO,CAAC;AAStE,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,KAAK,EAAE,iCAAiC,EAAE,MAAM,WAAW,CAAC;AAUnE,oDAAoD;AACpD,MAAM,WAAW,gCAAgC;IAC/C,yCAAyC;IACzC,OAAO,EAAE,sBAAsB,CAAC;IAChC,uFAAuF;IACvF,KAAK,EAAE,QAAQ,EAAE,CAAC;IAClB,uDAAuD;IACvD,WAAW,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IACzB,qDAAqD;IACrD,YAAY,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC1B,mEAAmE;IACnE,uBAAuB,EAAE,qBAAqB,CAAC,yBAAyB,CAAC,CAAC;IAC1E,oEAAoE;IACpE,cAAc,EAAE,qBAAqB,CAAC,gBAAgB,CAAC,CAAC;IACxD,yBAAyB;IACzB,MAAM,EAAE,iCAAiC,CAAC;IAC1C,gGAAgG;IAChG,QAAQ,EAAE,MAAM,IAAI,CAAC;CACtB;AAED,6GAA6G;AAC7G,eAAO,MAAM,2BAA2B,EAAE,EAAE,CAC1C,gCAAgC,CAoQjC,CAAC"}
|
|
@@ -1,141 +1,131 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import { DestinationFolderMode as te, DialFileNodeType as g, FolderDestinationLayout as _, FolderDestinationPanel as v, fromFolderPathKey as y, toFolderPathKey as b } from "@epam/ai-dial-react-file-manager";
|
|
1
|
+
import { findFolder as e, findSectionRoot as t, isSameOrInsidePath as n, toDestinationFolderNodes as r, toDestinationPath as i, toPathSegments as a } from "../destination-folders.js";
|
|
2
|
+
import { DIAL_ICON_SIZE as o, DIAL_KIT_ICON_STROKE as s, DialItemType as c, FileName as ee } from "@epam/ai-dial-ui-kit";
|
|
3
|
+
import { useCallback as l, useEffect as u, useMemo as d, useState as f } from "react";
|
|
4
|
+
import { jsx as p } from "react/jsx-runtime";
|
|
5
|
+
import { IconFolderShare as m } from "@tabler/icons-react";
|
|
6
|
+
import { DestinationFolderMode as te, DialFileNodeType as h, FolderDestinationLayout as g, FolderDestinationPanel as _, fromFolderPathKey as ne, toFolderPathKey as v } from "@epam/ai-dial-react-file-manager";
|
|
8
7
|
//#region src/file-manager/FileManagerDestinationPanel/FileManagerDestinationPanel.tsx
|
|
9
|
-
var
|
|
10
|
-
let
|
|
11
|
-
if (!
|
|
12
|
-
let t =
|
|
13
|
-
if (
|
|
14
|
-
if (
|
|
8
|
+
var y = "files", b = ".dial_folder", x = "Failed to create the folder. Please try again.", S = ({ request: S, roots: re, loadedPaths: C, loadingPaths: w, onFolderPopupPathChange: T, onCreateFolder: E, labels: D, onFinish: O }) => {
|
|
9
|
+
let k = t(re, S.sourceFolder), A = k?.path ?? "", j = a(A).length, M = S.mode === te.Move, N = d(() => S.items.filter((e) => e.nodeType === h.FOLDER).map((e) => e.path), [S.items]), P = l(({ path: e }) => {
|
|
10
|
+
if (!M) return;
|
|
11
|
+
let t = i(A, e);
|
|
12
|
+
if (N.some((e) => n(t, e))) return D.movedIntoItselfTooltip;
|
|
13
|
+
if (a(t).join("/") === a(S.sourceFolder).join("/")) return D.sourceFolderTooltip;
|
|
15
14
|
}, [
|
|
16
|
-
P,
|
|
17
15
|
M,
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
path: o(e.path).slice(N)
|
|
32
|
-
}))].find((e) => I(e) == null) ?? t;
|
|
33
|
-
}), [z, B] = m(() => /* @__PURE__ */ new Set()), V = d((e) => D(a(M, e)), [D, M]), H = d((e) => {
|
|
34
|
-
let t = a(e, []);
|
|
35
|
-
return T.has(t) || T.has(`${t}/`);
|
|
36
|
-
}, [T]);
|
|
37
|
-
f(() => {
|
|
38
|
-
V(L.path);
|
|
16
|
+
A,
|
|
17
|
+
N,
|
|
18
|
+
S.sourceFolder,
|
|
19
|
+
D
|
|
20
|
+
]), ie = a(S.sourceFolder).slice(j), [F, I] = f({
|
|
21
|
+
rootKey: y,
|
|
22
|
+
path: ie
|
|
23
|
+
}), [L, R] = f(() => /* @__PURE__ */ new Set()), z = l((e) => T(i(A, e)), [T, A]), B = l((e) => {
|
|
24
|
+
let t = i(e, []);
|
|
25
|
+
return C.has(t) || C.has(`${t}/`);
|
|
26
|
+
}, [C]);
|
|
27
|
+
u(() => {
|
|
28
|
+
z(F.path);
|
|
39
29
|
}, []);
|
|
40
|
-
let
|
|
30
|
+
let V = d(() => r(k?.items, j, B), [
|
|
31
|
+
k,
|
|
41
32
|
j,
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
]), G = d((e) => {
|
|
33
|
+
B
|
|
34
|
+
]), H = d(() => new Set([...w].filter((e) => n(e, A)).map((e) => v(a(e).slice(j)))), [
|
|
35
|
+
w,
|
|
36
|
+
A,
|
|
37
|
+
j
|
|
38
|
+
]), U = l((e) => {
|
|
49
39
|
e.forEach((e) => {
|
|
50
|
-
|
|
51
|
-
}),
|
|
52
|
-
}, [
|
|
53
|
-
key:
|
|
54
|
-
label:
|
|
55
|
-
items:
|
|
56
|
-
expandedPaths:
|
|
57
|
-
onExpandedPathsChange:
|
|
58
|
-
loadingPaths:
|
|
40
|
+
L.has(e) || z(ne(e));
|
|
41
|
+
}), R(e);
|
|
42
|
+
}, [L, z]), W = d(() => [{
|
|
43
|
+
key: y,
|
|
44
|
+
label: k?.name ?? "",
|
|
45
|
+
items: V,
|
|
46
|
+
expandedPaths: L,
|
|
47
|
+
onExpandedPathsChange: U,
|
|
48
|
+
loadingPaths: H
|
|
59
49
|
}], [
|
|
60
|
-
|
|
50
|
+
k,
|
|
51
|
+
V,
|
|
52
|
+
L,
|
|
61
53
|
U,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
}, [
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
if (!j) return null;
|
|
78
|
-
let X = a(M, L.path), oe = W.has(b(L.path)) || !H(X), Z = C.items.length, [Q] = C.items, $ = Z === 1 && Q.nodeType === g.FOLDER, se = P ? k.getMoveTitle(Z, $) : k.getCopyTitle(Z, $), ce = /* @__PURE__ */ h("ul", {
|
|
54
|
+
H
|
|
55
|
+
]), [G, K] = f(), q = l(() => {
|
|
56
|
+
K(D.createFolderFailedMessage ?? x);
|
|
57
|
+
}, [D.createFolderFailedMessage]), J = l(async (e, t, n) => {
|
|
58
|
+
K(void 0);
|
|
59
|
+
let r = `${i(A, t)}/${n}`;
|
|
60
|
+
if (!await E({
|
|
61
|
+
fileContent: new File([], b, { type: "text/plain" }),
|
|
62
|
+
name: b
|
|
63
|
+
}, r, `${r}/${b}`)) throw Error(`Folder "${n}" was not created`);
|
|
64
|
+
}, [E, A]), ae = l((e) => {
|
|
65
|
+
K(void 0), I(e), z(e.path);
|
|
66
|
+
}, [z]);
|
|
67
|
+
if (!k) return null;
|
|
68
|
+
let Y = i(A, F.path), X = H.has(v(F.path)) || !B(Y), Z = S.items.length, [Q] = S.items, $ = Z === 1 && Q.nodeType === h.FOLDER, oe = M ? D.getMoveTitle(Z, $) : D.getCopyTitle(Z, $), se = /* @__PURE__ */ p("ul", {
|
|
79
69
|
className: "flex max-h-60 min-w-0 flex-col gap-1 overflow-y-auto",
|
|
80
|
-
children:
|
|
70
|
+
children: S.items.map((e) => /* @__PURE__ */ p("li", {
|
|
81
71
|
className: "min-w-0",
|
|
82
|
-
children: /* @__PURE__ */
|
|
72
|
+
children: /* @__PURE__ */ p(ee, {
|
|
83
73
|
name: e.name,
|
|
84
|
-
type: e.nodeType ===
|
|
74
|
+
type: e.nodeType === h.FOLDER ? c.Folder : c.File
|
|
85
75
|
})
|
|
86
76
|
}, e.path))
|
|
87
77
|
});
|
|
88
|
-
return /* @__PURE__ */
|
|
78
|
+
return /* @__PURE__ */ p(_, {
|
|
89
79
|
isOpen: !0,
|
|
90
80
|
onClose: () => {
|
|
91
|
-
|
|
81
|
+
S.cancel(), O();
|
|
92
82
|
},
|
|
93
83
|
item: {
|
|
94
84
|
title: Q.name,
|
|
95
|
-
summary:
|
|
85
|
+
summary: se
|
|
96
86
|
},
|
|
97
|
-
roots:
|
|
98
|
-
destination:
|
|
99
|
-
layout:
|
|
87
|
+
roots: W,
|
|
88
|
+
destination: F,
|
|
89
|
+
layout: g.Inline,
|
|
100
90
|
onDestinationChange: ae,
|
|
101
|
-
onCreateFolder:
|
|
102
|
-
getDisabledReason:
|
|
103
|
-
onCreateFolderError:
|
|
104
|
-
submitError:
|
|
91
|
+
onCreateFolder: J,
|
|
92
|
+
getDisabledReason: P,
|
|
93
|
+
onCreateFolderError: q,
|
|
94
|
+
submitError: G,
|
|
105
95
|
labels: {
|
|
106
|
-
title:
|
|
107
|
-
closeAriaLabel:
|
|
108
|
-
cancelLabel:
|
|
96
|
+
title: oe,
|
|
97
|
+
closeAriaLabel: D.closeAriaLabel,
|
|
98
|
+
cancelLabel: D.cancelLabel
|
|
109
99
|
},
|
|
110
100
|
panelLabels: {
|
|
111
|
-
destinationHeading:
|
|
112
|
-
createFolderLabel:
|
|
113
|
-
searchPlaceholder:
|
|
114
|
-
clearSearchAriaLabel:
|
|
115
|
-
folderEmptyStateLabel:
|
|
116
|
-
cancelCreatingFolderLabel:
|
|
117
|
-
addSiblingFolderLabel:
|
|
118
|
-
addChildFolderLabel:
|
|
119
|
-
createFolderEmptyNameError:
|
|
120
|
-
createFolderInvalidNameError:
|
|
121
|
-
createFolderDuplicateNameError:
|
|
122
|
-
createFolderSameAsParentNameError:
|
|
123
|
-
createFolderHiddenNameWarning:
|
|
124
|
-
retryLabel:
|
|
101
|
+
destinationHeading: M ? D.moveHeading : D.copyHeading,
|
|
102
|
+
createFolderLabel: D.addFolderLabel,
|
|
103
|
+
searchPlaceholder: D.searchPlaceholder,
|
|
104
|
+
clearSearchAriaLabel: D.clearSearchAriaLabel,
|
|
105
|
+
folderEmptyStateLabel: D.folderEmptyStateLabel,
|
|
106
|
+
cancelCreatingFolderLabel: D.cancelCreatingFolderLabel,
|
|
107
|
+
addSiblingFolderLabel: D.addSiblingFolderLabel,
|
|
108
|
+
addChildFolderLabel: D.addChildFolderLabel,
|
|
109
|
+
createFolderEmptyNameError: D.createFolderEmptyNameError,
|
|
110
|
+
createFolderInvalidNameError: D.createFolderInvalidNameError,
|
|
111
|
+
createFolderDuplicateNameError: D.createFolderDuplicateNameError,
|
|
112
|
+
createFolderSameAsParentNameError: D.createFolderSameAsParentNameError,
|
|
113
|
+
createFolderHiddenNameWarning: D.createFolderHiddenNameWarning,
|
|
114
|
+
retryLabel: D.retryLabel
|
|
125
115
|
},
|
|
126
116
|
action: {
|
|
127
|
-
label:
|
|
128
|
-
icon: /* @__PURE__ */
|
|
129
|
-
size:
|
|
130
|
-
stroke:
|
|
117
|
+
label: M ? D.moveButtonLabel : D.copyButtonLabel,
|
|
118
|
+
icon: /* @__PURE__ */ p(m, {
|
|
119
|
+
size: o.SM,
|
|
120
|
+
stroke: s,
|
|
131
121
|
"aria-hidden": !0
|
|
132
122
|
}),
|
|
133
|
-
isDisabled:
|
|
123
|
+
isDisabled: X || P(F) != null,
|
|
134
124
|
onClick: () => {
|
|
135
|
-
|
|
125
|
+
S.confirm(Y, e(k, Y)?.items), O();
|
|
136
126
|
}
|
|
137
127
|
}
|
|
138
128
|
});
|
|
139
129
|
};
|
|
140
130
|
//#endregion
|
|
141
|
-
export {
|
|
131
|
+
export { S as FileManagerDestinationPanel };
|
package/package.json
CHANGED