ode-explorer 1.3.2-dev.202401091744 → 1.3.2-dev.202401101530
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.js +3 -3
- package/dist/version.txt +1 -1
- package/lib/ActionBarContainer.js +219 -313
- package/lib/AppAction.js +26 -39
- package/lib/DeleteModal.js +31 -39
- package/lib/DisableModal.js +14 -14
- package/lib/EmptyScreenApp.js +27 -43
- package/lib/EmptyScreenError.js +9 -10
- package/lib/EmptyScreenNoContentInFolder.js +12 -14
- package/lib/EmptyScreenSearch.js +11 -13
- package/lib/EmptyScreenTrash.js +11 -13
- package/lib/FolderModal.js +86 -105
- package/lib/FoldersList.js +42 -55
- package/lib/Library.js +12 -15
- package/lib/MoveModal.js +53 -69
- package/lib/ResourcesList.js +190 -202
- package/lib/TrashModal.js +13 -13
- package/lib/index.js +2 -2
- package/lib/index2.js +1012 -1503
- package/lib/style.css +1 -410
- package/package.json +3 -4
package/lib/AppAction.js
CHANGED
|
@@ -1,47 +1,34 @@
|
|
|
1
|
-
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Suspense, lazy } from "react";
|
|
3
|
-
import { Plus } from "@edifice-ui/icons";
|
|
4
|
-
import { useToggle, useOdeClient, Button, LoadingScreen } from "@edifice-ui/react";
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
6
|
-
import { u as
|
|
1
|
+
import { jsxs as d, Fragment as p, jsx as e } from "react/jsx-runtime";
|
|
2
|
+
import { Suspense as f, lazy as C } from "react";
|
|
3
|
+
import { Plus as g } from "@edifice-ui/icons";
|
|
4
|
+
import { useToggle as R, useOdeClient as S, Button as h, LoadingScreen as O } from "@edifice-ui/react";
|
|
5
|
+
import { useTranslation as x } from "react-i18next";
|
|
6
|
+
import { u as y, a as A, b, c as F } from "./index2.js";
|
|
7
7
|
import "edifice-ts-client";
|
|
8
8
|
import "i18next";
|
|
9
9
|
import "zustand";
|
|
10
10
|
import "@tanstack/react-query";
|
|
11
|
-
const
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
t
|
|
24
|
-
} =
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
data: actions
|
|
31
|
-
} = useActions();
|
|
32
|
-
const canCreate = actions == null ? void 0 : actions.find((action) => action.id === "create");
|
|
33
|
-
const currentFolder = useCurrentFolder();
|
|
34
|
-
const createResource = useCreateResource();
|
|
35
|
-
const handleOnResourceCreate = () => {
|
|
36
|
-
clearSelectedItems();
|
|
37
|
-
clearSelectedIds();
|
|
38
|
-
toggle();
|
|
39
|
-
};
|
|
40
|
-
return canCreate ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
41
|
-
/* @__PURE__ */ jsx(Button, { type: "button", color: "primary", variant: "filled", leftIcon: /* @__PURE__ */ jsx(Plus, {}), className: "ms-auto", onClick: handleOnResourceCreate, children: t("explorer.create.title") }),
|
|
42
|
-
/* @__PURE__ */ jsx(Suspense, { fallback: /* @__PURE__ */ jsx(LoadingScreen, {}), children: isCreateResourceOpen && /* @__PURE__ */ jsx(CreateModal, { mode: "create", actions, currentFolder, createResource, isOpen: isCreateResourceOpen, onSuccess: toggle, onCancel: toggle }) })
|
|
11
|
+
const I = /* @__PURE__ */ C(async () => ({
|
|
12
|
+
default: (await import("@edifice-ui/react")).ResourceModal
|
|
13
|
+
}));
|
|
14
|
+
function q() {
|
|
15
|
+
const [o, r] = R(), {
|
|
16
|
+
appCode: n
|
|
17
|
+
} = S(), {
|
|
18
|
+
t: s
|
|
19
|
+
} = x(n), {
|
|
20
|
+
clearSelectedItems: a,
|
|
21
|
+
clearSelectedIds: c
|
|
22
|
+
} = y(), {
|
|
23
|
+
data: t
|
|
24
|
+
} = A(), l = t == null ? void 0 : t.find((m) => m.id === "create"), i = b(), u = F();
|
|
25
|
+
return l ? /* @__PURE__ */ d(p, { children: [
|
|
26
|
+
/* @__PURE__ */ e(h, { type: "button", color: "primary", variant: "filled", leftIcon: /* @__PURE__ */ e(g, {}), className: "ms-auto", onClick: () => {
|
|
27
|
+
a(), c(), r();
|
|
28
|
+
}, children: s("explorer.create.title") }),
|
|
29
|
+
/* @__PURE__ */ e(f, { fallback: /* @__PURE__ */ e(O, {}), children: o && /* @__PURE__ */ e(I, { mode: "create", actions: t, currentFolder: i, createResource: u, isOpen: o, onSuccess: r, onCancel: r }) })
|
|
43
30
|
] }) : null;
|
|
44
31
|
}
|
|
45
32
|
export {
|
|
46
|
-
|
|
33
|
+
q as default
|
|
47
34
|
};
|
package/lib/DeleteModal.js
CHANGED
|
@@ -1,60 +1,52 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Modal, Button } from "@edifice-ui/react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
import { q as
|
|
1
|
+
import { jsxs as s, jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as a, Button as d } from "@edifice-ui/react";
|
|
3
|
+
import { createPortal as m } from "react-dom";
|
|
4
|
+
import { useTranslation as p } from "react-i18next";
|
|
5
|
+
import { q as c, r as h, d as u } from "./index2.js";
|
|
6
6
|
import "react";
|
|
7
7
|
import "@edifice-ui/icons";
|
|
8
8
|
import "edifice-ts-client";
|
|
9
9
|
import "i18next";
|
|
10
10
|
import "zustand";
|
|
11
11
|
import "@tanstack/react-query";
|
|
12
|
-
function
|
|
13
|
-
onSuccess
|
|
12
|
+
function f({
|
|
13
|
+
onSuccess: t
|
|
14
14
|
}) {
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
const isTrashFolder = useIsTrash();
|
|
18
|
-
async function onDelete() {
|
|
15
|
+
const i = c(), r = h(), e = u();
|
|
16
|
+
async function o() {
|
|
19
17
|
try {
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
await trashItem.mutate();
|
|
24
|
-
}
|
|
25
|
-
onSuccess == null ? void 0 : onSuccess();
|
|
26
|
-
} catch (e) {
|
|
27
|
-
console.error(e);
|
|
18
|
+
e ? await i.mutate() : await r.mutate(), t == null || t();
|
|
19
|
+
} catch (n) {
|
|
20
|
+
console.error(n);
|
|
28
21
|
}
|
|
29
22
|
}
|
|
30
23
|
return {
|
|
31
|
-
isTrashFolder,
|
|
32
|
-
onDelete
|
|
24
|
+
isTrashFolder: e,
|
|
25
|
+
onDelete: o
|
|
33
26
|
};
|
|
34
27
|
}
|
|
35
|
-
function
|
|
36
|
-
isOpen,
|
|
37
|
-
onSuccess = () => ({}),
|
|
38
|
-
onCancel = () => ({})
|
|
28
|
+
function k({
|
|
29
|
+
isOpen: t,
|
|
30
|
+
onSuccess: i = () => ({}),
|
|
31
|
+
onCancel: r = () => ({})
|
|
39
32
|
}) {
|
|
40
33
|
const {
|
|
41
|
-
t
|
|
42
|
-
} =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
onSuccess
|
|
34
|
+
t: e
|
|
35
|
+
} = p(), {
|
|
36
|
+
isTrashFolder: o,
|
|
37
|
+
onDelete: n
|
|
38
|
+
} = f({
|
|
39
|
+
onSuccess: i
|
|
48
40
|
});
|
|
49
|
-
return /* @__PURE__ */
|
|
50
|
-
/* @__PURE__ */
|
|
51
|
-
/* @__PURE__ */
|
|
52
|
-
/* @__PURE__ */
|
|
53
|
-
/* @__PURE__ */
|
|
54
|
-
/* @__PURE__ */
|
|
41
|
+
return /* @__PURE__ */ m(/* @__PURE__ */ s(a, { isOpen: t, onModalClose: r, id: "deleteModal", children: [
|
|
42
|
+
/* @__PURE__ */ l(a.Header, { onModalClose: r, children: e(o ? "explorer.delete.title" : "explorer.trash.title") }),
|
|
43
|
+
/* @__PURE__ */ l(a.Body, { children: /* @__PURE__ */ l("p", { className: "body", children: e(o ? "explorer.delete.subtitle" : "explorer.trash.subtitle") }) }),
|
|
44
|
+
/* @__PURE__ */ s(a.Footer, { children: [
|
|
45
|
+
/* @__PURE__ */ l(d, { color: "tertiary", onClick: r, type: "button", variant: "ghost", children: e("explorer.cancel") }),
|
|
46
|
+
/* @__PURE__ */ l(d, { color: "danger", onClick: n, type: "button", variant: "filled", children: e(o ? "explorer.delete" : "explorer.trash") })
|
|
55
47
|
] })
|
|
56
48
|
] }), document.getElementById("portal"));
|
|
57
49
|
}
|
|
58
50
|
export {
|
|
59
|
-
|
|
51
|
+
k as default
|
|
60
52
|
};
|
package/lib/DisableModal.js
CHANGED
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Modal, Button } from "@edifice-ui/react";
|
|
3
|
-
import { createPortal } from "react-dom";
|
|
4
|
-
import { useTranslation } from "react-i18next";
|
|
5
|
-
function
|
|
6
|
-
isOpen,
|
|
7
|
-
onCancel = () => ({})
|
|
1
|
+
import { jsxs as a, jsx as o } from "react/jsx-runtime";
|
|
2
|
+
import { Modal as r, Button as i } from "@edifice-ui/react";
|
|
3
|
+
import { createPortal as n } from "react-dom";
|
|
4
|
+
import { useTranslation as d } from "react-i18next";
|
|
5
|
+
function u({
|
|
6
|
+
isOpen: l,
|
|
7
|
+
onCancel: t = () => ({})
|
|
8
8
|
}) {
|
|
9
9
|
const {
|
|
10
|
-
t
|
|
11
|
-
} =
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
/* @__PURE__ */
|
|
14
|
-
/* @__PURE__ */
|
|
15
|
-
/* @__PURE__ */
|
|
10
|
+
t: e
|
|
11
|
+
} = d();
|
|
12
|
+
return /* @__PURE__ */ n(/* @__PURE__ */ a(r, { isOpen: l, onModalClose: t, id: "trash_action_disable_resource", children: [
|
|
13
|
+
/* @__PURE__ */ o(r.Header, { onModalClose: () => t(), children: e("explorer.trash.action.modal.title") }),
|
|
14
|
+
/* @__PURE__ */ o(r.Body, { children: /* @__PURE__ */ o("p", { className: "body", children: e("explorer.trash.action.modal.text") }) }),
|
|
15
|
+
/* @__PURE__ */ o(r.Footer, { children: /* @__PURE__ */ o(i, { color: "primary", onClick: t, type: "button", variant: "outline", children: e("close") }) })
|
|
16
16
|
] }), document.getElementById("portal"));
|
|
17
17
|
}
|
|
18
18
|
export {
|
|
19
|
-
|
|
19
|
+
u as default
|
|
20
20
|
};
|
package/lib/EmptyScreenApp.js
CHANGED
|
@@ -1,53 +1,37 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useOdeClient, useOdeTheme, usePaths, EmptyScreen } from "@edifice-ui/react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
import { a as
|
|
1
|
+
import { jsx as l } from "react/jsx-runtime";
|
|
2
|
+
import { useOdeClient as m, useOdeTheme as a, usePaths as c, EmptyScreen as u } from "@edifice-ui/react";
|
|
3
|
+
import { useTranslation as d } from "react-i18next";
|
|
4
|
+
import { a as x } from "./index2.js";
|
|
5
5
|
import "react";
|
|
6
6
|
import "@edifice-ui/icons";
|
|
7
7
|
import "edifice-ts-client";
|
|
8
8
|
import "i18next";
|
|
9
9
|
import "zustand";
|
|
10
10
|
import "@tanstack/react-query";
|
|
11
|
-
function
|
|
11
|
+
function P() {
|
|
12
12
|
const {
|
|
13
|
-
appCode
|
|
14
|
-
} =
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
});
|
|
35
|
-
} else if (!(canCreate == null ? void 0 : canCreate.available) && (theme == null ? void 0 : theme.is1d)) {
|
|
36
|
-
return t("explorer.emptyScreen.txt1d.consultation", {
|
|
37
|
-
ns: appCode
|
|
38
|
-
});
|
|
39
|
-
} else {
|
|
40
|
-
return t("explorer.emptyScreen.txt2d.consultation", {
|
|
41
|
-
ns: appCode
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
};
|
|
45
|
-
return /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: `${imagePath}/emptyscreen/illu-${appCode}.svg`, imageAlt: t("explorer.emptyScreen.app.alt", {
|
|
46
|
-
ns: appCode
|
|
47
|
-
}), title: `${(canCreate == null ? void 0 : canCreate.available) ? t("explorer.emptyScreen.title.create", {
|
|
48
|
-
ns: appCode
|
|
49
|
-
}) : t("explorer.emptyScreen.title.consultation")}`, text: labelEmptyScreenApp() });
|
|
13
|
+
appCode: r
|
|
14
|
+
} = m(), {
|
|
15
|
+
theme: t
|
|
16
|
+
} = a(), [i] = c(), {
|
|
17
|
+
t: o
|
|
18
|
+
} = d(), {
|
|
19
|
+
data: p
|
|
20
|
+
} = x(), e = p == null ? void 0 : p.find((s) => s.id === "create"), n = () => e != null && e.available && (t != null && t.is1d) ? o("explorer.emptyScreen.txt1d.create", {
|
|
21
|
+
ns: r
|
|
22
|
+
}) : e != null && e.available && !(t != null && t.is1d) ? o("explorer.emptyScreen.txt2d.create", {
|
|
23
|
+
ns: r
|
|
24
|
+
}) : !(e != null && e.available) && (t != null && t.is1d) ? o("explorer.emptyScreen.txt1d.consultation", {
|
|
25
|
+
ns: r
|
|
26
|
+
}) : o("explorer.emptyScreen.txt2d.consultation", {
|
|
27
|
+
ns: r
|
|
28
|
+
});
|
|
29
|
+
return /* @__PURE__ */ l(u, { imageSrc: `${i}/emptyscreen/illu-${r}.svg`, imageAlt: o("explorer.emptyScreen.app.alt", {
|
|
30
|
+
ns: r
|
|
31
|
+
}), title: `${e != null && e.available ? o("explorer.emptyScreen.title.create", {
|
|
32
|
+
ns: r
|
|
33
|
+
}) : o("explorer.emptyScreen.title.consultation")}`, text: n() });
|
|
50
34
|
}
|
|
51
35
|
export {
|
|
52
|
-
|
|
36
|
+
P as default
|
|
53
37
|
};
|
package/lib/EmptyScreenError.js
CHANGED
|
@@ -1,13 +1,12 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { usePaths, EmptyScreen } from "@edifice-ui/react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
function
|
|
5
|
-
const [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
}
|
|
9
|
-
return /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: `${imagePath}/emptyscreen/illu-error.svg`, imageAlt: t("explorer.emptyScreen.error.alt"), text: "explorer.emptyScreen.error.text" });
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { usePaths as o, EmptyScreen as m } from "@edifice-ui/react";
|
|
3
|
+
import { useTranslation as n } from "react-i18next";
|
|
4
|
+
function c() {
|
|
5
|
+
const [r] = o(), {
|
|
6
|
+
t: e
|
|
7
|
+
} = n();
|
|
8
|
+
return /* @__PURE__ */ t(m, { imageSrc: `${r}/emptyscreen/illu-error.svg`, imageAlt: e("explorer.emptyScreen.error.alt"), text: "explorer.emptyScreen.error.text" });
|
|
10
9
|
}
|
|
11
10
|
export {
|
|
12
|
-
|
|
11
|
+
c as default
|
|
13
12
|
};
|
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { usePaths, useOdeClient, EmptyScreen } from "@edifice-ui/react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
function
|
|
5
|
-
const [
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} = useOdeClient();
|
|
9
|
-
const {
|
|
1
|
+
import { jsx as r } from "react/jsx-runtime";
|
|
2
|
+
import { usePaths as o, useOdeClient as m, EmptyScreen as l } from "@edifice-ui/react";
|
|
3
|
+
import { useTranslation as p } from "react-i18next";
|
|
4
|
+
function i() {
|
|
5
|
+
const [n] = o(), {
|
|
6
|
+
appCode: e
|
|
7
|
+
} = m(), {
|
|
10
8
|
t
|
|
11
|
-
} =
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
ns:
|
|
9
|
+
} = p();
|
|
10
|
+
return /* @__PURE__ */ r(l, { imageSrc: `${n}/emptyscreen/illu-no-content-in-folder.svg`, imageAlt: t("explorer.emptyScreen.folder.empty.alt", {
|
|
11
|
+
ns: e
|
|
14
12
|
}), text: t("explorer.emptyScreen.label", {
|
|
15
|
-
ns:
|
|
13
|
+
ns: e
|
|
16
14
|
}) });
|
|
17
15
|
}
|
|
18
16
|
export {
|
|
19
|
-
|
|
17
|
+
i as default
|
|
20
18
|
};
|
package/lib/EmptyScreenSearch.js
CHANGED
|
@@ -1,20 +1,18 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useOdeClient, usePaths, EmptyScreen } from "@edifice-ui/react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
function
|
|
5
|
-
const {
|
|
6
|
-
appCode
|
|
7
|
-
} = useOdeClient();
|
|
8
|
-
const [imagePath] = usePaths();
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useOdeClient as n, usePaths as a, EmptyScreen as o } from "@edifice-ui/react";
|
|
3
|
+
import { useTranslation as c } from "react-i18next";
|
|
4
|
+
function l() {
|
|
9
5
|
const {
|
|
6
|
+
appCode: e
|
|
7
|
+
} = n(), [r] = a(), {
|
|
10
8
|
t
|
|
11
|
-
} =
|
|
12
|
-
return /* @__PURE__ */
|
|
13
|
-
ns:
|
|
9
|
+
} = c();
|
|
10
|
+
return /* @__PURE__ */ s(o, { imageSrc: `${r}/emptyscreen/illu-search.svg`, imageAlt: t("explorer.emptyScreen.search.alt", {
|
|
11
|
+
ns: e
|
|
14
12
|
}), text: t("explorer.emptyScreen.search.text", {
|
|
15
|
-
ns:
|
|
13
|
+
ns: e
|
|
16
14
|
}) });
|
|
17
15
|
}
|
|
18
16
|
export {
|
|
19
|
-
|
|
17
|
+
l as default
|
|
20
18
|
};
|
package/lib/EmptyScreenTrash.js
CHANGED
|
@@ -1,18 +1,16 @@
|
|
|
1
|
-
import { jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useOdeClient, usePaths, EmptyScreen } from "@edifice-ui/react";
|
|
3
|
-
import { useTranslation } from "react-i18next";
|
|
4
|
-
function
|
|
1
|
+
import { jsx as s } from "react/jsx-runtime";
|
|
2
|
+
import { useOdeClient as a, usePaths as m, EmptyScreen as n } from "@edifice-ui/react";
|
|
3
|
+
import { useTranslation as o } from "react-i18next";
|
|
4
|
+
function c() {
|
|
5
5
|
const {
|
|
6
|
-
appCode
|
|
7
|
-
} =
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
return /* @__PURE__ */ jsx(EmptyScreen, { imageSrc: `${imagePath}/emptyscreen/illu-trash.svg`, imageAlt: t("explorer.emptyScreen.trash.alt"), title: t("explorer.emptyScreen.trash.title"), text: t("explorer.emptyScreen.trash.empty", {
|
|
13
|
-
ns: appCode
|
|
6
|
+
appCode: t
|
|
7
|
+
} = a(), [r] = m(), {
|
|
8
|
+
t: e
|
|
9
|
+
} = o();
|
|
10
|
+
return /* @__PURE__ */ s(n, { imageSrc: `${r}/emptyscreen/illu-trash.svg`, imageAlt: e("explorer.emptyScreen.trash.alt"), title: e("explorer.emptyScreen.trash.title"), text: e("explorer.emptyScreen.trash.empty", {
|
|
11
|
+
ns: t
|
|
14
12
|
}) });
|
|
15
13
|
}
|
|
16
14
|
export {
|
|
17
|
-
|
|
15
|
+
c as default
|
|
18
16
|
};
|
package/lib/FolderModal.js
CHANGED
|
@@ -1,138 +1,119 @@
|
|
|
1
|
-
import { jsxs, jsx } from "react/jsx-runtime";
|
|
2
|
-
import { useId, useEffect } from "react";
|
|
3
|
-
import { Modal, FormControl, Label, Input, Button } from "@edifice-ui/react";
|
|
4
|
-
import { createPortal } from "react-dom";
|
|
5
|
-
import { useTranslation } from "react-i18next";
|
|
6
|
-
import { FOLDER } from "edifice-ts-client";
|
|
7
|
-
import { useForm } from "react-hook-form";
|
|
8
|
-
import { h as
|
|
1
|
+
import { jsxs as b, jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import { useId as B, useEffect as L } from "react";
|
|
3
|
+
import { Modal as m, FormControl as j, Label as w, Input as R, Button as I } from "@edifice-ui/react";
|
|
4
|
+
import { createPortal as T } from "react-dom";
|
|
5
|
+
import { useTranslation as U } from "react-i18next";
|
|
6
|
+
import { FOLDER as V } from "edifice-ts-client";
|
|
7
|
+
import { useForm as _ } from "react-hook-form";
|
|
8
|
+
import { h as k, b as z, o as A, p as H } from "./index2.js";
|
|
9
9
|
import "@edifice-ui/icons";
|
|
10
10
|
import "i18next";
|
|
11
11
|
import "zustand";
|
|
12
12
|
import "@tanstack/react-query";
|
|
13
|
-
function
|
|
14
|
-
edit,
|
|
15
|
-
onSuccess,
|
|
16
|
-
onClose
|
|
13
|
+
function P({
|
|
14
|
+
edit: o,
|
|
15
|
+
onSuccess: e,
|
|
16
|
+
onClose: s
|
|
17
17
|
}) {
|
|
18
|
-
var
|
|
19
|
-
const
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
const {
|
|
25
|
-
reset,
|
|
26
|
-
register,
|
|
27
|
-
handleSubmit,
|
|
28
|
-
setFocus,
|
|
18
|
+
var x;
|
|
19
|
+
const l = k(), r = z(), c = A(), f = H(), u = o ? (x = l[0]) == null ? void 0 : x.name : void 0, {
|
|
20
|
+
reset: t,
|
|
21
|
+
register: p,
|
|
22
|
+
handleSubmit: n,
|
|
23
|
+
setFocus: h,
|
|
29
24
|
formState: {
|
|
30
|
-
errors,
|
|
31
|
-
isSubmitting,
|
|
32
|
-
isDirty,
|
|
33
|
-
isValid
|
|
25
|
+
errors: F,
|
|
26
|
+
isSubmitting: d,
|
|
27
|
+
isDirty: g,
|
|
28
|
+
isValid: v
|
|
34
29
|
}
|
|
35
|
-
} =
|
|
30
|
+
} = _({
|
|
36
31
|
mode: "onChange",
|
|
37
32
|
values: {
|
|
38
|
-
name:
|
|
33
|
+
name: u || ""
|
|
39
34
|
}
|
|
40
|
-
})
|
|
41
|
-
|
|
42
|
-
const onSubmit = async function({
|
|
43
|
-
name: name2
|
|
35
|
+
}), M = B(), D = async function({
|
|
36
|
+
name: y
|
|
44
37
|
}) {
|
|
45
|
-
var
|
|
38
|
+
var C;
|
|
46
39
|
try {
|
|
47
|
-
if (
|
|
48
|
-
const
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
name: name2
|
|
55
|
-
});
|
|
56
|
-
reset();
|
|
57
|
-
onSuccess == null ? void 0 : onSuccess();
|
|
40
|
+
if (o) {
|
|
41
|
+
const i = (C = l[0]) == null ? void 0 : C.parentId, q = l[0].id;
|
|
42
|
+
await f.mutate({
|
|
43
|
+
folderId: q,
|
|
44
|
+
parentId: i,
|
|
45
|
+
name: y
|
|
46
|
+
}), t(), e == null || e();
|
|
58
47
|
} else {
|
|
59
|
-
const
|
|
60
|
-
await
|
|
61
|
-
name:
|
|
62
|
-
parentId
|
|
63
|
-
});
|
|
64
|
-
reset();
|
|
65
|
-
onSuccess == null ? void 0 : onSuccess();
|
|
48
|
+
const i = (r == null ? void 0 : r.id) || V.DEFAULT;
|
|
49
|
+
await c.mutate({
|
|
50
|
+
name: y,
|
|
51
|
+
parentId: i
|
|
52
|
+
}), t(), e == null || e();
|
|
66
53
|
}
|
|
67
|
-
} catch (
|
|
68
|
-
console.error(
|
|
54
|
+
} catch (i) {
|
|
55
|
+
console.error(i);
|
|
69
56
|
}
|
|
70
57
|
};
|
|
71
|
-
function
|
|
72
|
-
|
|
73
|
-
onClose();
|
|
58
|
+
function E() {
|
|
59
|
+
t(), s();
|
|
74
60
|
}
|
|
75
|
-
const formId = `createModal_${id}`;
|
|
76
61
|
return {
|
|
77
|
-
formId
|
|
78
|
-
errors,
|
|
79
|
-
isSubmitting,
|
|
80
|
-
isDirty,
|
|
81
|
-
isValid,
|
|
82
|
-
register,
|
|
83
|
-
setFocus,
|
|
84
|
-
handleSubmit,
|
|
85
|
-
onCancel,
|
|
86
|
-
onSubmit
|
|
62
|
+
formId: `createModal_${M}`,
|
|
63
|
+
errors: F,
|
|
64
|
+
isSubmitting: d,
|
|
65
|
+
isDirty: g,
|
|
66
|
+
isValid: v,
|
|
67
|
+
register: p,
|
|
68
|
+
setFocus: h,
|
|
69
|
+
handleSubmit: n,
|
|
70
|
+
onCancel: E,
|
|
71
|
+
onSubmit: D
|
|
87
72
|
};
|
|
88
73
|
}
|
|
89
|
-
function
|
|
90
|
-
isOpen,
|
|
91
|
-
edit,
|
|
92
|
-
onSuccess,
|
|
93
|
-
onCancel:
|
|
74
|
+
function oe({
|
|
75
|
+
isOpen: o,
|
|
76
|
+
edit: e,
|
|
77
|
+
onSuccess: s,
|
|
78
|
+
onCancel: l
|
|
94
79
|
}) {
|
|
95
80
|
const {
|
|
96
|
-
t
|
|
97
|
-
} =
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
onClose
|
|
81
|
+
t: r
|
|
82
|
+
} = U(), {
|
|
83
|
+
isDirty: c,
|
|
84
|
+
isValid: f,
|
|
85
|
+
isSubmitting: u,
|
|
86
|
+
formId: t,
|
|
87
|
+
onSubmit: p,
|
|
88
|
+
onCancel: n,
|
|
89
|
+
handleSubmit: h,
|
|
90
|
+
register: F,
|
|
91
|
+
setFocus: d
|
|
92
|
+
} = P({
|
|
93
|
+
edit: e,
|
|
94
|
+
onSuccess: s,
|
|
95
|
+
onClose: l
|
|
112
96
|
});
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
/* @__PURE__ */ jsx(Label, { children: t("explorer.create.folder.name") }),
|
|
122
|
-
/* @__PURE__ */ jsx(Input, { type: "text", ...register("name", {
|
|
123
|
-
required: true,
|
|
97
|
+
return L(() => {
|
|
98
|
+
o && d("name");
|
|
99
|
+
}, [o, d]), o ? /* @__PURE__ */ T(/* @__PURE__ */ b(m, { isOpen: o, onModalClose: n, id: "modal_" + t, children: [
|
|
100
|
+
/* @__PURE__ */ a(m.Header, { onModalClose: n, children: r(e ? "explorer.rename.folder" : "explorer.create.folder") }),
|
|
101
|
+
/* @__PURE__ */ a(m.Body, { children: /* @__PURE__ */ a("form", { id: t, onSubmit: h(p), children: /* @__PURE__ */ b(j, { id: "nameFolder", isRequired: !0, children: [
|
|
102
|
+
/* @__PURE__ */ a(w, { children: r("explorer.create.folder.name") }),
|
|
103
|
+
/* @__PURE__ */ a(R, { type: "text", ...F("name", {
|
|
104
|
+
required: !0,
|
|
124
105
|
pattern: {
|
|
125
106
|
value: /[^ ]/,
|
|
126
107
|
message: "invalid title"
|
|
127
108
|
}
|
|
128
|
-
}), placeholder:
|
|
109
|
+
}), placeholder: r("explorer.create.folder.name"), size: "md", "aria-required": !0 })
|
|
129
110
|
] }) }) }),
|
|
130
|
-
/* @__PURE__ */
|
|
131
|
-
/* @__PURE__ */
|
|
132
|
-
/* @__PURE__ */
|
|
111
|
+
/* @__PURE__ */ b(m.Footer, { children: [
|
|
112
|
+
/* @__PURE__ */ a(I, { color: "tertiary", onClick: n, type: "button", variant: "ghost", children: r("explorer.cancel") }),
|
|
113
|
+
/* @__PURE__ */ a(I, { form: t, type: "submit", color: "primary", variant: "filled", disabled: !c || !f || u, children: r(e ? "explorer.rename" : "explorer.create") })
|
|
133
114
|
] })
|
|
134
115
|
] }), document.getElementById("portal")) : null;
|
|
135
116
|
}
|
|
136
117
|
export {
|
|
137
|
-
|
|
118
|
+
oe as default
|
|
138
119
|
};
|