ode-explorer 1.4.19 → 1.5.0

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.
Files changed (69) hide show
  1. package/dist/index.html +48 -48
  2. package/dist/index.js +1387 -76631
  3. package/dist/version.txt +1 -1
  4. package/explorer.d.ts +1 -1
  5. package/lib/ActionBarContainer.js +175 -175
  6. package/lib/AppAction.js +26 -30
  7. package/lib/DeleteModal.js +8 -14
  8. package/lib/DraggableCard.js +25 -0
  9. package/lib/EmptyScreenApp.js +22 -25
  10. package/lib/ExportModal.js +24 -30
  11. package/lib/FolderModal.js +14 -18
  12. package/lib/FoldersList.js +88 -48
  13. package/lib/Library.js +25 -27
  14. package/lib/MoveModal.js +65 -56
  15. package/lib/ResourcesList.js +101 -81
  16. package/lib/components/EmptyScreens/EmptyScreenApp.d.ts +0 -1
  17. package/lib/components/EmptyScreens/EmptyScreenError.d.ts +0 -1
  18. package/lib/components/EmptyScreens/EmptyScreenNoContentInFolder.d.ts +0 -1
  19. package/lib/components/EmptyScreens/EmptyScreenSearch.d.ts +0 -1
  20. package/lib/components/Explorer.d.ts +1 -1
  21. package/lib/components/LoadMore.d.ts +1 -2
  22. package/lib/components/OnboardingModal.d.ts +1 -1
  23. package/lib/config/dndkit.d.ts +2 -0
  24. package/lib/config/{getExplorerConfig.d.ts → explorer.d.ts} +5 -1
  25. package/lib/config/index.d.ts +2 -0
  26. package/lib/features/AccessControl/AccessControl.d.ts +2 -2
  27. package/lib/features/AccessControl/useAccessControl.d.ts +1 -1
  28. package/lib/features/ActionBar/Delete/DeleteModal.d.ts +1 -2
  29. package/lib/features/ActionBar/Disable/DisableModal.d.ts +1 -2
  30. package/lib/features/ActionBar/Export/ExportModal.d.ts +1 -2
  31. package/lib/features/ActionBar/Folder/FolderModal.d.ts +1 -2
  32. package/lib/features/ActionBar/Folder/useFolderModal.d.ts +5 -5
  33. package/lib/features/ActionBar/Move/MoveModal.d.ts +1 -2
  34. package/lib/features/ActionBar/Move/useMoveModal.d.ts +3 -4
  35. package/lib/features/ActionBar/Publish/PublishModal.d.ts +1 -1
  36. package/lib/features/ActionBar/Resource/ResourceModal.d.ts +1 -1
  37. package/lib/features/ActionBar/Share/ShareModal.d.ts +1 -1
  38. package/lib/features/ActionBar/Trash/TrashModal.d.ts +1 -2
  39. package/lib/features/ActionBar/useActionBar.d.ts +2 -2
  40. package/lib/features/DndKit/useDndKit.d.ts +7 -0
  41. package/lib/features/List/DraggableCard.d.ts +6 -0
  42. package/lib/features/List/FolderCard.d.ts +8 -4
  43. package/lib/features/List/FoldersList.d.ts +2 -2
  44. package/lib/features/List/ResourceCard.d.ts +3 -3
  45. package/lib/features/List/ResourcesList.d.ts +2 -2
  46. package/lib/features/SearchForm/useSearchForm.d.ts +1 -2
  47. package/lib/i18n.d.ts +1 -1
  48. package/lib/index.d.ts +2 -2
  49. package/lib/index.js +3 -12
  50. package/lib/index2.js +1017 -952
  51. package/lib/providers/index.d.ts +6 -0
  52. package/lib/services/api/index.d.ts +16 -16
  53. package/lib/services/queries/actions.d.ts +18 -0
  54. package/lib/services/queries/index.d.ts +46 -0
  55. package/lib/services/resource/service.d.ts +11 -0
  56. package/lib/store/index.d.ts +89 -35
  57. package/lib/utils/getChildrenIds.d.ts +2 -0
  58. package/lib/utils/isResourceShared.d.ts +1 -1
  59. package/package.json +52 -53
  60. package/lib/utils/TreeNodeFolderWrapper.d.ts +0 -12
  61. package/lib/utils/addNode.d.ts +0 -6
  62. package/lib/utils/deleteNode.d.ts +0 -4
  63. package/lib/utils/findNodeById.d.ts +0 -2
  64. package/lib/utils/getAncestors.d.ts +0 -2
  65. package/lib/utils/hasChildren.d.ts +0 -2
  66. package/lib/utils/modifyNode.d.ts +0 -2
  67. package/lib/utils/moveNode.d.ts +0 -5
  68. package/lib/utils/updateNode.d.ts +0 -6
  69. package/lib/utils/wrapTreeNode.d.ts +0 -3
@@ -1,43 +1,40 @@
1
1
  import { jsx as a } from "react/jsx-runtime";
2
- import { useOdeClient as c, useOdeTheme as d, usePaths as m, EmptyScreen as u } from "@edifice-ui/react";
3
- import { useTranslation as x } from "react-i18next";
4
- import { a as y } from "./index2.js";
5
- import "react";
6
- import "@edifice-ui/icons";
2
+ import { usePaths as u, useOdeClient as d, useOdeTheme as m, EmptyScreen as x } from "@edifice-ui/react";
3
+ import { useTranslation as S } from "react-i18next";
4
+ import "@tanstack/react-query";
7
5
  import "edifice-ts-client";
8
6
  import "i18next";
9
- import "zustand";
10
- import "@tanstack/react-query";
11
- function $() {
12
- const {
7
+ import { u as y, b as f } from "./index2.js";
8
+ function P() {
9
+ const [o] = u(), {
13
10
  appCode: r
14
- } = c(), {
11
+ } = d(), {
15
12
  theme: e
16
- } = d(), [s] = m(), {
17
- t: l
18
- } = x(), {
19
- data: i
20
- } = y(), t = i == null ? void 0 : i.find((o) => o.id === "create"), p = () => t != null && t.available && (e != null && e.is1d) ? l("explorer.emptyScreen.txt1d.create", {
13
+ } = m(), {
14
+ t: s
15
+ } = S(), l = y((i) => i.config), {
16
+ data: n
17
+ } = f(l == null ? void 0 : l.actions), t = n == null ? void 0 : n.find((i) => i.id === "create"), p = () => t != null && t.available && (e != null && e.is1d) ? s("explorer.emptyScreen.txt1d.create", {
21
18
  ns: r
22
- }) : t != null && t.available && !(e != null && e.is1d) ? l("explorer.emptyScreen.txt2d.create", {
19
+ }) : t != null && t.available && !(e != null && e.is1d) ? s("explorer.emptyScreen.txt2d.create", {
23
20
  ns: r
24
- }) : !(t != null && t.available) && (e != null && e.is1d) ? l("explorer.emptyScreen.txt1d.consultation", {
21
+ }) : !(t != null && t.available) && (e != null && e.is1d) ? s("explorer.emptyScreen.txt1d.consultation", {
25
22
  ns: r
26
- }) : l("explorer.emptyScreen.txt2d.consultation", {
23
+ }) : s("explorer.emptyScreen.txt2d.consultation", {
27
24
  ns: r
28
- }), n = () => t != null && t.available && (e != null && e.is1d) ? l("explorer.emptyScreen.title1d.create", {
25
+ }), c = () => t != null && t.available && (e != null && e.is1d) ? s("explorer.emptyScreen.title1d.create", {
29
26
  ns: r
30
- }) : t != null && t.available && !(e != null && e.is1d) ? l("explorer.emptyScreen.title2d.create", {
27
+ }) : t != null && t.available && !(e != null && e.is1d) ? s("explorer.emptyScreen.title2d.create", {
31
28
  ns: r
32
- }) : !(t != null && t.available) && (e != null && e.is1d) ? l("explorer.emptyScreen.title1d.consultation", {
29
+ }) : !(t != null && t.available) && (e != null && e.is1d) ? s("explorer.emptyScreen.title1d.consultation", {
33
30
  ns: r
34
- }) : l("explorer.emptyScreen.title2d.consultation", {
31
+ }) : s("explorer.emptyScreen.title2d.consultation", {
35
32
  ns: r
36
33
  });
37
- return /* @__PURE__ */ a(u, { imageSrc: `${s}/emptyscreen/illu-${r}.svg`, imageAlt: l("explorer.emptyScreen.app.alt", {
34
+ return /* @__PURE__ */ a(x, { imageSrc: `${o}/emptyscreen/illu-${r}.svg`, imageAlt: s("explorer.emptyScreen.app.alt", {
38
35
  ns: r
39
- }), title: n(), text: p() });
36
+ }), title: c(), text: p() });
40
37
  }
41
38
  export {
42
- $ as default
39
+ P as default
43
40
  };
@@ -1,53 +1,47 @@
1
- import { jsxs as l, jsx as o } from "react/jsx-runtime";
2
- import { useToast as p, Modal as i, Alert as d, Button as a } from "@edifice-ui/react";
1
+ import { jsxs as l, jsx as r } from "react/jsx-runtime";
2
+ import { useToast as d, Modal as n, Alert as p, Button as a } from "@edifice-ui/react";
3
3
  import { createPortal as x } from "react-dom";
4
4
  import { useTranslation as c } from "react-i18next";
5
- import { i as m, d as h, y as u } from "./index2.js";
6
- import "react";
7
- import "@edifice-ui/icons";
8
- import "edifice-ts-client";
9
- import "i18next";
10
- import "zustand";
11
- import "@tanstack/react-query";
12
- const f = (n) => {
13
- const t = m(), e = h(), s = p(), {
14
- t: r
5
+ import { i as h, e as u, A as m } from "./index2.js";
6
+ const f = (i) => {
7
+ const t = h(), o = u(), s = d(), {
8
+ t: e
15
9
  } = c();
16
10
  return {
17
11
  handleExportClick: () => {
18
- t.length ? (u({
19
- searchParams: e,
12
+ t.length ? (m({
13
+ searchParams: o,
20
14
  assetId: t[0].assetId
21
- }), n()) : s.error(r("explorer.error.noResourceSelected"));
15
+ }), i()) : s.error(e("explorer.error.noResourceSelected"));
22
16
  }
23
17
  };
24
18
  };
25
- function T({
26
- isOpen: n,
19
+ function C({
20
+ isOpen: i,
27
21
  onSuccess: t,
28
- onCancel: e
22
+ onCancel: o
29
23
  }) {
30
24
  const {
31
25
  handleExportClick: s
32
26
  } = f(t), {
33
- t: r
27
+ t: e
34
28
  } = c();
35
- return /* @__PURE__ */ x(/* @__PURE__ */ l(i, { isOpen: n, onModalClose: e, id: "exportModal", children: [
36
- /* @__PURE__ */ o(i.Header, { onModalClose: e, children: r("explorer.export.title") }),
37
- /* @__PURE__ */ l(i.Body, { children: [
29
+ return /* @__PURE__ */ x(/* @__PURE__ */ l(n, { isOpen: i, onModalClose: o, id: "exportModal", children: [
30
+ /* @__PURE__ */ r(n.Header, { onModalClose: o, children: e("explorer.export.title") }),
31
+ /* @__PURE__ */ l(n.Body, { children: [
38
32
  /* @__PURE__ */ l("ul", { children: [
39
- /* @__PURE__ */ o("li", { children: r("explorer.export.body.info.1") }),
40
- /* @__PURE__ */ o("li", { children: r("explorer.export.body.info.2") }),
41
- /* @__PURE__ */ o("li", { children: r("explorer.export.body.info.3") })
33
+ /* @__PURE__ */ r("li", { children: e("explorer.export.body.info.1") }),
34
+ /* @__PURE__ */ r("li", { children: e("explorer.export.body.info.2") }),
35
+ /* @__PURE__ */ r("li", { children: e("explorer.export.body.info.3") })
42
36
  ] }),
43
- /* @__PURE__ */ o(d, { type: "warning", children: r("explorer.export.body.warning") })
37
+ /* @__PURE__ */ r(p, { type: "warning", children: e("explorer.export.body.warning") })
44
38
  ] }),
45
- /* @__PURE__ */ l(i.Footer, { children: [
46
- /* @__PURE__ */ o(a, { color: "tertiary", onClick: e, type: "button", variant: "ghost", children: r("explorer.cancel") }),
47
- /* @__PURE__ */ o(a, { color: "primary", onClick: s, type: "button", variant: "filled", children: r("explorer.actions.export") })
39
+ /* @__PURE__ */ l(n.Footer, { children: [
40
+ /* @__PURE__ */ r(a, { color: "tertiary", onClick: o, type: "button", variant: "ghost", children: e("explorer.cancel") }),
41
+ /* @__PURE__ */ r(a, { color: "primary", onClick: s, type: "button", variant: "filled", children: e("explorer.actions.export") })
48
42
  ] })
49
43
  ] }), document.getElementById("portal"));
50
44
  }
51
45
  export {
52
- T as default
46
+ C as default
53
47
  };
@@ -5,11 +5,7 @@ import { createPortal as T } from "react-dom";
5
5
  import { useTranslation as U } from "react-i18next";
6
6
  import { FOLDER as V } from "edifice-ts-client";
7
7
  import { useForm as _ } from "react-hook-form";
8
- import { j as k, b as z, r as A, s as H } from "./index2.js";
9
- import "@edifice-ui/icons";
10
- import "i18next";
11
- import "zustand";
12
- import "@tanstack/react-query";
8
+ import { j as k, c as z, t as A, v as H } from "./index2.js";
13
9
  function P({
14
10
  edit: t,
15
11
  onSuccess: e,
@@ -23,7 +19,7 @@ function P({
23
19
  setFocus: h,
24
20
  formState: {
25
21
  errors: F,
26
- isSubmitting: d,
22
+ isSubmitting: i,
27
23
  isDirty: I,
28
24
  isValid: v
29
25
  }
@@ -38,21 +34,21 @@ function P({
38
34
  var g;
39
35
  try {
40
36
  if (t) {
41
- const i = (g = l[0]) == null ? void 0 : g.parentId, E = l[0].id;
37
+ const d = (g = l[0]) == null ? void 0 : g.parentId, E = l[0].id;
42
38
  await f.mutate({
43
39
  folderId: E,
44
- parentId: i,
40
+ parentId: d,
45
41
  name: y
46
42
  }), o(), e == null || e();
47
43
  } else {
48
- const i = (r == null ? void 0 : r.id) || V.DEFAULT;
44
+ const d = (r == null ? void 0 : r.id) || V.DEFAULT;
49
45
  await c.mutate({
50
46
  name: y,
51
- parentId: i
47
+ parentId: d
52
48
  }), o(), e == null || e();
53
49
  }
54
- } catch (i) {
55
- console.error(i);
50
+ } catch (d) {
51
+ console.error(d);
56
52
  }
57
53
  };
58
54
  function D() {
@@ -61,7 +57,7 @@ function P({
61
57
  return {
62
58
  formId: `createModal_${M}`,
63
59
  errors: F,
64
- isSubmitting: d,
60
+ isSubmitting: i,
65
61
  isDirty: I,
66
62
  isValid: v,
67
63
  register: p,
@@ -71,7 +67,7 @@ function P({
71
67
  onSubmit: L
72
68
  };
73
69
  }
74
- function te({
70
+ function Z({
75
71
  isOpen: t,
76
72
  edit: e,
77
73
  onSuccess: s,
@@ -88,15 +84,15 @@ function te({
88
84
  onCancel: n,
89
85
  handleSubmit: h,
90
86
  register: F,
91
- setFocus: d
87
+ setFocus: i
92
88
  } = P({
93
89
  edit: e,
94
90
  onSuccess: s,
95
91
  onClose: l
96
92
  });
97
93
  return q(() => {
98
- t && d("name");
99
- }, [t, d]), t ? /* @__PURE__ */ T(/* @__PURE__ */ x(m, { isOpen: t, onModalClose: n, id: "modal_" + o, children: [
94
+ t && i("name");
95
+ }, [t, i]), t ? /* @__PURE__ */ T(/* @__PURE__ */ x(m, { isOpen: t, onModalClose: n, id: "modal_" + o, children: [
100
96
  /* @__PURE__ */ a(m.Header, { onModalClose: n, children: r(e ? "explorer.rename.folder" : "explorer.create.folder") }),
101
97
  /* @__PURE__ */ a(m.Body, { children: /* @__PURE__ */ a("form", { id: o, onSubmit: h(p), children: /* @__PURE__ */ x(B, { id: "nameFolder", isRequired: !0, children: [
102
98
  /* @__PURE__ */ a(w, { children: r("explorer.create.folder.name") }),
@@ -116,5 +112,5 @@ function te({
116
112
  ] }), document.getElementById("portal")) : null;
117
113
  }
118
114
  export {
119
- te as default
115
+ Z as default
120
116
  };
@@ -1,64 +1,104 @@
1
- import { jsx as i, jsxs as y } from "react/jsx-runtime";
2
- import { Card as d, useOdeClient as C, useScrollToTop as T } from "@edifice-ui/react";
3
- import { useSpring as I, animated as a } from "@react-spring/web";
4
- import { Files as N } from "@edifice-ui/icons";
5
- import { j, k as x, u as k } from "./index2.js";
6
- import "react";
7
- import "react-i18next";
8
- import "edifice-ts-client";
9
- import "i18next";
10
- import "zustand";
11
- import "@tanstack/react-query";
12
- const g = ({
13
- app: s,
14
- name: n,
15
- isSelected: l = !1,
16
- isSelectable: o = !0,
17
- onClick: t,
18
- onSelect: c
19
- }) => /* @__PURE__ */ i(d, { app: s, isSelectable: o, isSelected: l, onClick: t, onSelect: c, children: (p) => /* @__PURE__ */ y(d.Body, { children: [
20
- /* @__PURE__ */ i(N, { width: "48", height: "48", className: `color-app-${p}` }),
21
- /* @__PURE__ */ i(d.Title, { children: n })
22
- ] }) });
23
- g.displayName = "FolderCard";
24
- const E = ({
25
- data: s
1
+ import { jsx as t, jsxs as N } from "react/jsx-runtime";
2
+ import { useBreakpoint as R, Card as S, useScrollToTop as k, useOdeClient as w } from "@edifice-ui/react";
3
+ import { useSpring as $, animated as v } from "@react-spring/web";
4
+ import { useQueryClient as j } from "@tanstack/react-query";
5
+ import { o as C, s as z, j as A, k as B, a as E } from "./index2.js";
6
+ import { useState as q, useId as L, useEffect as M } from "react";
7
+ import { useDroppable as P, useDraggable as Q } from "@dnd-kit/core";
8
+ import { Files as G } from "@edifice-ui/icons";
9
+ import { D as H } from "./DraggableCard.js";
10
+ const O = ({
11
+ app: r,
12
+ name: c,
13
+ idFolder: l,
14
+ isSelected: i = !1,
15
+ isSelectable: m = !0,
16
+ onClick: D,
17
+ onSelect: b
26
18
  }) => {
27
- var m, u;
28
- const {
29
- currentApp: n
30
- } = C(), l = j(), o = x(), {
31
- setSelectedFolders: t,
32
- setFolderIds: c,
19
+ const [o, a] = q(!1), p = L(), {
20
+ lg: F
21
+ } = R(), {
22
+ setNodeRef: y
23
+ } = P({
24
+ id: p,
25
+ data: {
26
+ id: l,
27
+ name: c,
28
+ isTreeview: !1,
29
+ accepts: ["folder", "resource"]
30
+ }
31
+ }), {
32
+ attributes: I,
33
+ listeners: u,
34
+ setNodeRef: g,
35
+ transform: e
36
+ } = Q({
37
+ id: p,
38
+ data: {
39
+ id: l,
40
+ type: "folder"
41
+ },
42
+ disabled: !F
43
+ }), s = C(), d = z(), h = (n) => {
44
+ g(n), y(n);
45
+ }, f = d.overId === l, T = !d.canMove && d.isTreeview ? "no-drop" : o ? "grabbing" : "default", x = {
46
+ transform: `translate3d(${((e == null ? void 0 : e.x) ?? 0) / 1}px, ${((e == null ? void 0 : e.y) ?? 0) / 1}px, 0)`,
47
+ cursor: T
48
+ };
49
+ return M(() => {
50
+ const n = s.elementDrag === l;
51
+ a(n);
52
+ }, [s]), /* @__PURE__ */ t("div", { ref: h, ...u, ...I, style: {
53
+ ...x
54
+ }, children: o ? /* @__PURE__ */ t(H, { name: c, app: r, type: "folder" }) : /* @__PURE__ */ t(S, { app: r, isSelectable: !o && m, isSelected: !o && i || f && o, isFocused: f, onClick: D, onSelect: b, children: (n) => /* @__PURE__ */ N(S.Body, { children: [
55
+ /* @__PURE__ */ t(G, { width: "48", height: "48", className: `color-app-${n}` }),
56
+ /* @__PURE__ */ t(S.Title, { children: c })
57
+ ] }) }) });
58
+ };
59
+ O.displayName = "FolderCard";
60
+ const ee = ({
61
+ data: r
62
+ }) => {
63
+ var u, g;
64
+ const c = j(), l = A(), i = B(), m = C(), D = k(), {
65
+ currentApp: b
66
+ } = w(), {
67
+ setSelectedFolders: o,
68
+ setFolderIds: a,
33
69
  openFolder: p
34
- } = k();
70
+ } = E();
35
71
  function F(e) {
36
- o.includes(e.id) ? (c(o.filter((r) => r !== e.id)), t(l.filter((r) => r.id !== e.id))) : (c([...o, e.id]), t([...l, e]));
72
+ i.includes(e.id) ? (a(i.filter((s) => s !== e.id)), o(l.filter((s) => s.id !== e.id))) : (a([e.id, ...i]), o([e, ...l]));
73
+ }
74
+ function y(e) {
75
+ D(), p({
76
+ folder: e,
77
+ folderId: e.id,
78
+ queryClient: c
79
+ });
37
80
  }
38
- const h = I({
81
+ const I = $({
39
82
  from: {
40
83
  opacity: 0
41
84
  },
42
85
  to: {
43
86
  opacity: 1
44
87
  }
45
- }), f = T();
46
- return (m = s == null ? void 0 : s.pages[0]) != null && m.folders.length ? /* @__PURE__ */ i(a.ul, { className: "grid ps-0 list-unstyled mb-24", children: (u = s == null ? void 0 : s.pages[0]) == null ? void 0 : u.folders.map((e) => {
88
+ });
89
+ return (u = r == null ? void 0 : r.pages[0]) != null && u.folders.length ? /* @__PURE__ */ t(v.ul, { className: "grid ps-0 list-unstyled mb-24", children: (g = r == null ? void 0 : r.pages[0]) == null ? void 0 : g.folders.map((e) => {
47
90
  const {
48
- id: r,
49
- name: S
50
- } = e;
51
- return /* @__PURE__ */ i(a.li, { className: "g-col-4 z-1", style: {
91
+ id: s,
92
+ name: d
93
+ } = e, h = m.elementDrag === s;
94
+ return /* @__PURE__ */ t(v.li, { className: `g-col-4 ${h ? "z-2000" : "z-1"}`, style: {
52
95
  position: "relative",
53
- ...h
54
- }, children: /* @__PURE__ */ i(g, { name: S, app: n, isSelected: o.includes(e.id), onClick: () => {
55
- f(), p({
56
- folder: e,
57
- folderId: e.id
58
- });
59
- }, onSelect: () => F(e) }) }, r);
96
+ ...I
97
+ }, children: /* @__PURE__ */ t(O, { name: d, idFolder: s, app: b, isSelected: i.includes(e.id), onClick: (f) => {
98
+ f.stopPropagation(), y(e);
99
+ }, onSelect: () => F(e) }) }, s);
60
100
  }) }) : null;
61
101
  };
62
102
  export {
63
- E as default
103
+ ee as default
64
104
  };
package/lib/Library.js CHANGED
@@ -1,38 +1,36 @@
1
- import { jsxs as t, jsx as a } from "react/jsx-runtime";
2
- import { useOdeClient as s, useOdeTheme as c, usePaths as m, useLibraryUrl as d, Image as p } from "@edifice-ui/react";
3
- import { odeServices as b } from "edifice-ts-client";
4
- import { ArrowRight as g } from "@edifice-ui/icons";
5
- import { useTranslation as u } from "react-i18next";
6
- const y = () => {
1
+ import { jsxs as t, jsx as i } from "react/jsx-runtime";
2
+ import { ArrowRight as o } from "@edifice-ui/icons";
3
+ import { useOdeTheme as n, usePaths as s, useLibraryUrl as c, Image as m } from "@edifice-ui/react";
4
+ import { useTranslation as p } from "react-i18next";
5
+ import { odeServices as d } from "edifice-ts-client";
6
+ const b = () => {
7
7
  const {
8
- currentLanguage: i
9
- } = s(), {
10
- theme: e
11
- } = c(), [l] = m(), r = d(), n = i === "fr" ? "image-library-year-end.gif" : "image-library.svg", o = `${l}/${e == null ? void 0 : e.bootstrapVersion}/${n}`;
8
+ theme: r
9
+ } = n(), [l] = s(), e = c(), a = `${l}/${r == null ? void 0 : r.bootstrapVersion}/image-library.svg`;
12
10
  return {
13
- libraryUrl: r,
14
- imageFullURL: o,
11
+ libraryUrl: e,
12
+ imageFullURL: a,
15
13
  handleClick: () => {
16
- r && (window.open(r, "_blank"), b.data().trackAccessLibraryFromExplorer());
14
+ e && (window.open(e, "_blank"), d.data().trackAccessLibraryFromExplorer());
17
15
  }
18
16
  };
19
- }, U = () => {
17
+ }, k = () => {
20
18
  const {
21
- libraryUrl: i,
22
- imageFullURL: e,
23
- handleClick: l
24
- } = y(), {
25
- t: r
26
- } = u();
27
- return i && /* @__PURE__ */ t("div", { className: "p-16", children: [
28
- /* @__PURE__ */ a(p, { width: "270", height: "140", loading: "lazy", className: "rounded", src: e, alt: r("explorer.libray.img.alt") }),
29
- /* @__PURE__ */ a("p", { className: "m-8", children: r("explorer.libray.title") }),
30
- /* @__PURE__ */ t("button", { type: "button", onClick: l, rel: "noreferrer", className: "btn btn-ghost-primary d-inline-flex align-items-center gap-4 p-8", children: [
31
- /* @__PURE__ */ a("span", { children: r("explorer.libray.btn") }),
32
- /* @__PURE__ */ a(g, {})
19
+ libraryUrl: r,
20
+ imageFullURL: l,
21
+ handleClick: e
22
+ } = b(), {
23
+ t: a
24
+ } = p();
25
+ return r && /* @__PURE__ */ t("div", { className: "p-16", children: [
26
+ /* @__PURE__ */ i(m, { width: "270", height: "140", loading: "lazy", className: "rounded", src: l, alt: a("explorer.libray.img.alt") }),
27
+ /* @__PURE__ */ i("p", { className: "m-8", children: a("explorer.libray.title") }),
28
+ /* @__PURE__ */ t("button", { type: "button", onClick: e, rel: "noreferrer", className: "btn btn-ghost-primary d-inline-flex align-items-center gap-4 p-8", children: [
29
+ /* @__PURE__ */ i("span", { children: a("explorer.libray.btn") }),
30
+ /* @__PURE__ */ i(o, {})
33
31
  ] })
34
32
  ] });
35
33
  };
36
34
  export {
37
- U as default
35
+ k as default
38
36
  };
package/lib/MoveModal.js CHANGED
@@ -1,78 +1,87 @@
1
- import { jsxs as h, jsx as l } from "react/jsx-runtime";
2
- import { Modal as a, TreeView as T, Button as I } from "@edifice-ui/react";
3
- import { createPortal as M } from "react-dom";
4
- import { useTranslation as y } from "react-i18next";
5
- import { useState as b } from "react";
6
- import { useQueryClient as x } from "@tanstack/react-query";
7
- import { w as F, j as w, i as S, u as g, x as j } from "./index2.js";
8
- import "@edifice-ui/icons";
9
- import "edifice-ts-client";
10
- import "i18next";
11
- import "zustand";
12
- function B({
13
- onSuccess: n
1
+ import { jsxs as T, jsx as s } from "react/jsx-runtime";
2
+ import { findNodeById as x, getAncestors as C, useOdeClient as S, Modal as m, TreeView as F, Button as b } from "@edifice-ui/react";
3
+ import { createPortal as g } from "react-dom";
4
+ import { useTranslation as w } from "react-i18next";
5
+ import { useQueryClient as A } from "@tanstack/react-query";
6
+ import { useState as B } from "react";
7
+ import { y as D, j, i as k, z as E, a as O } from "./index2.js";
8
+ function U({
9
+ onSuccess: a
14
10
  }) {
15
- const [d, t] = b(), r = F(), i = w(), m = S(), {
16
- foldTreeItem: s,
17
- unfoldTreeItem: c
18
- } = g(), f = x();
19
- async function u() {
11
+ const [d, n] = B(), u = A(), o = D(), h = j(), p = k(), i = E(), {
12
+ fetchTreeData: v
13
+ } = O();
14
+ async function y() {
20
15
  try {
21
- if (!d)
22
- throw new Error("explorer.move.selection.empty");
23
- await r.mutate(d), await (n == null ? void 0 : n());
24
- } catch (e) {
25
- console.error(e);
16
+ if (!d) throw new Error("explorer.move.selection.empty");
17
+ await o.mutate(d), await (a == null ? void 0 : a());
18
+ } catch (r) {
19
+ console.error(r);
26
20
  }
27
21
  }
28
- const v = (e) => {
29
- var p;
30
- for (const o of i)
31
- if (e === o.id || e === o.parentId)
22
+ const I = (r) => {
23
+ var f, c;
24
+ const t = C(i, r);
25
+ for (const e of h)
26
+ if (r === e.id || r === e.parentId || (f = e.childrenIds) != null && f.includes(r) || t.includes(e.id))
32
27
  return !1;
33
- for (const o of m)
34
- if (e === ((o == null ? void 0 : o.folderIds) && o.folderIds[0]) || ((p = o == null ? void 0 : o.folderIds) == null ? void 0 : p.length) === 0 && e === "default")
28
+ for (const e of p)
29
+ if (r === ((e == null ? void 0 : e.folderIds) && e.folderIds[0]) || ((c = e == null ? void 0 : e.folderIds) == null ? void 0 : c.length) === 0 && r === "default")
35
30
  return !1;
36
31
  return !0;
37
32
  };
38
33
  return {
34
+ treeData: i,
39
35
  disableSubmit: !d,
40
- handleTreeItemSelect: (e) => {
41
- v(e) ? t(e) : t(void 0);
36
+ handleTreeItemSelect: (r) => {
37
+ I(r) ? n(r) : n(void 0);
42
38
  },
43
- handleTreeItemFold: s,
44
- handleTreeItemUnfold: async (e) => await c(e, f),
45
- onMove: () => {
46
- u();
47
- }
39
+ handleOnTreeItemUnfold: (r) => {
40
+ var c, e;
41
+ const t = x(i, r), f = (c = t == null ? void 0 : t.children) == null ? void 0 : c.some((l) => {
42
+ var M;
43
+ return Array.isArray(l == null ? void 0 : l.children) && ((M = l.children) == null ? void 0 : M.length) > 0;
44
+ });
45
+ (e = t == null ? void 0 : t.children) == null || e.forEach((l) => {
46
+ f || v(l.id, u);
47
+ });
48
+ },
49
+ onMove: () => y()
48
50
  };
49
51
  }
50
- function z({
51
- isOpen: n,
52
+ function W({
53
+ isOpen: a,
52
54
  onSuccess: d,
53
- onCancel: t
55
+ onCancel: n
54
56
  }) {
55
57
  const {
56
- t: r
57
- } = y(), {
58
- handleTreeItemFold: i,
59
- handleTreeItemSelect: m,
60
- handleTreeItemUnfold: s,
61
- onMove: c,
62
- disableSubmit: f
63
- } = B({
58
+ appCode: u
59
+ } = S(), {
60
+ t: o
61
+ } = w(), {
62
+ treeData: h,
63
+ handleTreeItemSelect: p,
64
+ handleOnTreeItemUnfold: i,
65
+ onMove: v,
66
+ disableSubmit: y
67
+ } = U({
64
68
  onSuccess: d
65
- }), u = j();
66
- return /* @__PURE__ */ M(/* @__PURE__ */ h(a, { isOpen: n, onModalClose: t, id: "moveModal", children: [
67
- /* @__PURE__ */ l(a.Header, { onModalClose: t, children: r("explorer.move.title") }),
68
- /* @__PURE__ */ l(a.Subtitle, { children: r("explorer.move.subtitle") }),
69
- /* @__PURE__ */ l(a.Body, { children: /* @__PURE__ */ l(T, { data: u, onTreeItemSelect: m, onTreeItemFold: i, onTreeItemUnfold: s }) }),
70
- /* @__PURE__ */ h(a.Footer, { children: [
71
- /* @__PURE__ */ l(I, { color: "tertiary", onClick: t, type: "button", variant: "ghost", children: r("explorer.cancel") }),
72
- /* @__PURE__ */ l(I, { color: "primary", onClick: c, type: "button", variant: "filled", disabled: f, children: r("explorer.move") })
69
+ }), I = {
70
+ ...h,
71
+ name: o("explorer.filters.mine", {
72
+ ns: u
73
+ })
74
+ };
75
+ return /* @__PURE__ */ g(/* @__PURE__ */ T(m, { isOpen: a, onModalClose: n, id: "moveModal", children: [
76
+ /* @__PURE__ */ s(m.Header, { onModalClose: n, children: o("explorer.move.title") }),
77
+ /* @__PURE__ */ s(m.Subtitle, { children: o("explorer.move.subtitle") }),
78
+ /* @__PURE__ */ s(m.Body, { children: /* @__PURE__ */ s(F, { data: I, onTreeItemClick: p, onTreeItemUnfold: i }) }),
79
+ /* @__PURE__ */ T(m.Footer, { children: [
80
+ /* @__PURE__ */ s(b, { color: "tertiary", onClick: n, type: "button", variant: "ghost", children: o("explorer.cancel") }),
81
+ /* @__PURE__ */ s(b, { color: "primary", onClick: v, type: "button", variant: "filled", disabled: y, children: o("explorer.move") })
73
82
  ] })
74
83
  ] }), document.getElementById("portal"));
75
84
  }
76
85
  export {
77
- z as default
86
+ W as default
78
87
  };