ode-explorer 1.4.18-develop-integration.202410021150 → 1.4.18-develop-pedago.202410071739

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 (42) hide show
  1. package/dist/index.html +1 -1
  2. package/dist/index.js +1388 -76626
  3. package/dist/version.txt +1 -1
  4. package/lib/ActionBarContainer.js +172 -166
  5. package/lib/AppAction.js +27 -25
  6. package/lib/DeleteModal.js +6 -4
  7. package/lib/DraggableCard.js +25 -0
  8. package/lib/EmptyScreenApp.js +26 -24
  9. package/lib/ExportModal.js +13 -11
  10. package/lib/FolderModal.js +6 -4
  11. package/lib/FoldersList.js +84 -44
  12. package/lib/Library.js +25 -27
  13. package/lib/MoveModal.js +71 -55
  14. package/lib/ResourcesList.js +96 -73
  15. package/lib/components/Explorer.d.ts +1 -1
  16. package/lib/config/dndkit.d.ts +2 -0
  17. package/lib/config/{getExplorerConfig.d.ts → explorer.d.ts} +5 -1
  18. package/lib/config/index.d.ts +2 -0
  19. package/lib/features/AccessControl/AccessControl.d.ts +1 -1
  20. package/lib/features/ActionBar/Move/useMoveModal.d.ts +3 -4
  21. package/lib/features/ActionBar/useActionBar.d.ts +1 -1
  22. package/lib/features/DndKit/useDndKit.d.ts +7 -0
  23. package/lib/features/List/DraggableCard.d.ts +6 -0
  24. package/lib/features/List/FolderCard.d.ts +6 -2
  25. package/lib/index.d.ts +1 -1
  26. package/lib/index.js +7 -5
  27. package/lib/index2.js +1019 -950
  28. package/lib/providers/index.d.ts +6 -0
  29. package/lib/services/resource/service.d.ts +11 -0
  30. package/lib/store/index.d.ts +87 -33
  31. package/lib/utils/getChildrenIds.d.ts +2 -0
  32. package/package.json +7 -5
  33. package/lib/utils/TreeNodeFolderWrapper.d.ts +0 -12
  34. package/lib/utils/addNode.d.ts +0 -6
  35. package/lib/utils/deleteNode.d.ts +0 -4
  36. package/lib/utils/findNodeById.d.ts +0 -2
  37. package/lib/utils/getAncestors.d.ts +0 -2
  38. package/lib/utils/hasChildren.d.ts +0 -2
  39. package/lib/utils/modifyNode.d.ts +0 -2
  40. package/lib/utils/moveNode.d.ts +0 -5
  41. package/lib/utils/updateNode.d.ts +0 -6
  42. package/lib/utils/wrapTreeNode.d.ts +0 -3
@@ -1,113 +1,136 @@
1
- import { jsx as i, jsxs as n, Fragment as M } from "react/jsx-runtime";
2
- import S, { useCallback as O } from "react";
3
- import { Card as c, Image as B, AppIcon as $, Avatar as D, Tooltip as y, useOdeClient as G, useDate as L, Button as U } from "@edifice-ui/react";
4
- import { useSpring as q, animated as T } from "@react-spring/web";
5
- import E from "clsx";
6
- import { useTranslation as F } from "react-i18next";
7
- import { d as H, h as J, i as K, u as Q, e as V } from "./index2.js";
8
- import { Users as W, Globe as X } from "@edifice-ui/icons";
9
- import { OneProfile as Y } from "@edifice-ui/icons/nav";
1
+ import { jsx as e, jsxs as o, Fragment as z } from "react/jsx-runtime";
2
+ import C, { useState as $, useEffect as j, useCallback as M } from "react";
3
+ import { Card as m, Image as B, AppIcon as E, Avatar as G, Tooltip as O, useOdeClient as L, useDate as U, Button as q } from "@edifice-ui/react";
4
+ import { useSpring as H, animated as k } from "@react-spring/web";
5
+ import J from "clsx";
6
+ import { useTranslation as w } from "react-i18next";
7
+ import { o as K, e as Q, h as V, i as W, a as X, f as Y } from "./index2.js";
8
+ import { useDraggable as Z } from "@dnd-kit/core";
9
+ import { Users as _, Globe as tt } from "@edifice-ui/icons";
10
+ import { OneProfile as et } from "@edifice-ui/icons/nav";
11
+ import { D as it } from "./DraggableCard.js";
12
+ import "@dnd-kit/modifiers";
10
13
  import "edifice-ts-client";
11
14
  import "i18next";
12
15
  import "zustand";
13
16
  import "@tanstack/react-query";
14
- const C = ({
15
- app: a,
17
+ const A = ({
18
+ app: s,
16
19
  resource: t,
17
- time: f,
18
- isSelected: x = !1,
20
+ time: x,
21
+ isSelected: b = !1,
19
22
  isSelectable: u = !0,
20
- onClick: d,
21
- onSelect: s
23
+ onClick: p,
24
+ onSelect: c
22
25
  }) => {
23
- const o = `/userbook/avatar/${t == null ? void 0 : t.creatorId}`;
24
- function m(l) {
26
+ const [a, h] = $(!1), r = `/userbook/avatar/${t == null ? void 0 : t.creatorId}`;
27
+ function R(i) {
25
28
  const {
26
- rights: v,
27
- creatorId: N
28
- } = l || {};
29
- return v.filter((I) => !I.includes(N)).length >= 1;
29
+ rights: l,
30
+ creatorId: d
31
+ } = i || {};
32
+ return l.filter((F) => !F.includes(d)).length >= 1;
30
33
  }
31
- const r = m(t), R = t == null ? void 0 : t.public, {
32
- t: g
33
- } = F();
34
- return /* @__PURE__ */ i(c, { app: a, isSelected: x, isSelectable: u, onClick: d, onSelect: s, children: (l) => /* @__PURE__ */ n(M, { children: [
35
- /* @__PURE__ */ n(c.Body, { children: [
36
- /* @__PURE__ */ i("div", { className: "card-image medium", children: t != null && t.thumbnail ? /* @__PURE__ */ i(B, { alt: "", src: `${t == null ? void 0 : t.thumbnail}?thumbnail=80x80`, objectFit: "cover", className: "h-full w-100" }) : /* @__PURE__ */ i($, { app: a, iconFit: "ratio", size: "80", variant: "rounded" }) }),
37
- /* @__PURE__ */ n("div", { className: "text-truncate", children: [
38
- /* @__PURE__ */ i(c.Title, { children: t == null ? void 0 : t.name }),
39
- /* @__PURE__ */ i(c.Text, { children: /* @__PURE__ */ i("em", { children: f }) })
34
+ const {
35
+ attributes: I,
36
+ listeners: v,
37
+ setNodeRef: y,
38
+ transform: n
39
+ } = Z({
40
+ id: t.id,
41
+ data: {
42
+ id: t.id,
43
+ type: "resource"
44
+ }
45
+ }), S = R(t), N = t == null ? void 0 : t.public, g = K(), {
46
+ t: f
47
+ } = w(), D = {
48
+ position: a ? "absolute" : "relative",
49
+ zIndex: a ? 2e3 : 1,
50
+ transform: `translate3d(${((n == null ? void 0 : n.x) ?? 0) / 1}px, ${((n == null ? void 0 : n.y) ?? 0) / 1}px, 0)`
51
+ };
52
+ return j(() => {
53
+ const i = g.elementDrag === t.id;
54
+ h(i);
55
+ }, [g]), /* @__PURE__ */ e("div", { ref: y, ...v, ...I, style: {
56
+ ...D
57
+ }, children: a ? /* @__PURE__ */ e(it, { app: s, type: "resource", name: t == null ? void 0 : t.name }) : /* @__PURE__ */ e(m, { app: s, isSelected: !a && b, isSelectable: !a && u, onClick: p, onSelect: c, children: (i) => /* @__PURE__ */ o(z, { children: [
58
+ /* @__PURE__ */ o(m.Body, { children: [
59
+ /* @__PURE__ */ e("div", { className: "card-image medium", children: t != null && t.thumbnail ? /* @__PURE__ */ e(B, { alt: "", src: `${t == null ? void 0 : t.thumbnail}?thumbnail=80x80`, objectFit: "cover", className: "h-full w-100" }) : /* @__PURE__ */ e(E, { app: s, iconFit: "ratio", size: "80", variant: "rounded" }) }),
60
+ /* @__PURE__ */ o("div", { className: "text-truncate", children: [
61
+ /* @__PURE__ */ e(m.Title, { children: t == null ? void 0 : t.name }),
62
+ /* @__PURE__ */ e(m.Text, { children: /* @__PURE__ */ e("em", { children: x }) })
40
63
  ] })
41
64
  ] }),
42
- /* @__PURE__ */ n(c.Footer, { children: [
43
- /* @__PURE__ */ n("div", { className: "d-inline-flex align-items-center gap-8 text-truncate", children: [
44
- o ? /* @__PURE__ */ i(D, { alt: (t == null ? void 0 : t.creatorName) || "", size: "xs", src: o, variant: "circle", width: "24", height: "24" }) : /* @__PURE__ */ i(Y, {}),
45
- /* @__PURE__ */ i(c.Text, { children: t == null ? void 0 : t.creatorName })
65
+ /* @__PURE__ */ o(m.Footer, { children: [
66
+ /* @__PURE__ */ o("div", { className: "d-inline-flex align-items-center gap-8 text-truncate", children: [
67
+ r ? /* @__PURE__ */ e(G, { alt: (t == null ? void 0 : t.creatorName) || "", size: "xs", src: r, variant: "circle", width: "24", height: "24" }) : /* @__PURE__ */ e(et, {}),
68
+ /* @__PURE__ */ e(m.Text, { children: t == null ? void 0 : t.creatorName })
46
69
  ] }),
47
- /* @__PURE__ */ n("div", { className: "d-inline-flex align-items-center gap-8", children: [
48
- r && /* @__PURE__ */ i(y, { message: g("tooltip.shared", {
49
- ns: l
50
- }), placement: "top", children: /* @__PURE__ */ i(W, { width: 16, height: 16 }) }),
51
- R && /* @__PURE__ */ i(y, { message: g("tooltip.public", {
52
- ns: l
53
- }), placement: "top", children: /* @__PURE__ */ i(X, { width: 16, height: 16 }) })
70
+ /* @__PURE__ */ o("div", { className: "d-inline-flex align-items-center gap-8", children: [
71
+ S && /* @__PURE__ */ e(O, { message: f("tooltip.shared", {
72
+ ns: i
73
+ }), placement: "top", children: /* @__PURE__ */ e(_, { width: 16, height: 16 }) }),
74
+ N && /* @__PURE__ */ e(O, { message: f("tooltip.public", {
75
+ ns: i
76
+ }), placement: "top", children: /* @__PURE__ */ e(tt, { width: 16, height: 16 }) })
54
77
  ] })
55
78
  ] })
56
- ] }) });
79
+ ] }) }) });
57
80
  };
58
- C.displayName = "ResourceCard";
59
- const rt = ({
60
- data: a,
81
+ A.displayName = "ResourceCard";
82
+ const Rt = ({
83
+ data: s,
61
84
  fetchNextPage: t
62
85
  }) => {
63
86
  const {
64
- currentApp: f
65
- } = G(), {
66
- t: x
67
- } = F(), {
87
+ currentApp: x
88
+ } = L(), {
89
+ t: b
90
+ } = w(), {
68
91
  fromNow: u
69
- } = L(), d = H(), s = J(), o = K(), {
70
- setSelectedResources: m,
92
+ } = U(), p = Q(), c = V(), a = W(), {
93
+ setSelectedResources: h,
71
94
  setResourceIds: r,
72
95
  openResource: R,
73
- setResourceIsTrash: g
74
- } = Q(), l = V(), v = q({
96
+ setResourceIsTrash: I
97
+ } = X(), v = Y(), y = H({
75
98
  from: {
76
99
  opacity: 0
77
100
  },
78
101
  to: {
79
102
  opacity: 1
80
103
  }
81
- }), b = d.pagination.startIdx + d.pagination.pageSize < (d.pagination.maxIdx || 0), I = O(() => {
104
+ }), S = p.pagination.startIdx + p.pagination.pageSize < (p.pagination.maxIdx || 0), N = M(() => {
82
105
  t();
83
- }, []), k = (e) => {
84
- l ? (g(!0), r([e.id]), m([e])) : R(e);
106
+ }, []), g = (i) => {
107
+ v ? (I(!0), r([i.id]), h([i])) : R(i);
85
108
  };
86
- async function w(e) {
87
- if (s.includes(e.id)) {
88
- r(s.filter((h) => h !== e.id)), m(o.filter((h) => h.id !== e.id));
109
+ async function f(i) {
110
+ if (c.includes(i.id)) {
111
+ r(c.filter((l) => l !== i.id)), h(a.filter((l) => l.id !== i.id));
89
112
  return;
90
113
  }
91
- r([...s, e.id]), m([...o, e]);
114
+ r([...c, i.id]), h([...a, i]);
92
115
  }
93
- const A = E("grid ps-0 list-unstyled");
94
- return /* @__PURE__ */ n(S.Fragment, { children: [
95
- /* @__PURE__ */ i(T.ul, { className: A, children: a == null ? void 0 : a.pages.map((e, h) => (
116
+ const D = J("grid ps-0 list-unstyled");
117
+ return /* @__PURE__ */ o(C.Fragment, { children: [
118
+ /* @__PURE__ */ e(k.ul, { className: D, children: s == null ? void 0 : s.pages.map((i, l) => (
96
119
  // eslint-disable-next-line react/no-array-index-key
97
- /* @__PURE__ */ i(S.Fragment, { children: e.resources.map((p) => {
120
+ /* @__PURE__ */ e(C.Fragment, { children: i.resources.map((d) => {
98
121
  const {
99
- id: P,
100
- updatedAt: z
101
- } = p, j = u(z);
102
- return /* @__PURE__ */ i(T.li, { className: "g-col-4 z-1", style: {
122
+ id: T,
123
+ updatedAt: F
124
+ } = d, P = u(F);
125
+ return /* @__PURE__ */ e(k.li, { className: "g-col-4", style: {
103
126
  position: "relative",
104
- ...v
105
- }, children: /* @__PURE__ */ i(C, { app: f, resource: p, time: j, isSelectable: !0, isSelected: s.includes(p.id), onClick: () => k(p), onSelect: () => w(p) }) }, P);
106
- }) }, h)
127
+ ...y
128
+ }, children: /* @__PURE__ */ e(A, { app: x, resource: d, time: P, isSelectable: !0, isSelected: c.includes(d.id), onClick: () => g(d), onSelect: () => f(d) }) }, T);
129
+ }) }, l)
107
130
  )) }),
108
- b && /* @__PURE__ */ i("div", { className: "d-grid gap-2 col-4 mx-auto my-24", children: /* @__PURE__ */ i(U, { type: "button", color: "secondary", variant: "filled", onClick: I, children: x("explorer.see.more") }) })
131
+ S && /* @__PURE__ */ e("div", { className: "d-grid gap-2 col-4 mx-auto my-24", children: /* @__PURE__ */ e(q, { type: "button", color: "secondary", variant: "filled", onClick: N, children: b("explorer.see.more") }) })
109
132
  ] });
110
133
  };
111
134
  export {
112
- rt as default
135
+ Rt as default
113
136
  };
@@ -1,4 +1,4 @@
1
- import { AppParams } from '../config/getExplorerConfig';
1
+ import { AppParams } from '../config';
2
2
  declare const Explorer: ({ config }: {
3
3
  config: AppParams;
4
4
  }) => import("react/jsx-runtime").JSX.Element;
@@ -0,0 +1,2 @@
1
+ export declare const DELAY = 175;
2
+ export declare const TOLERANCE = 10;
@@ -1,7 +1,11 @@
1
- import { type App, type ResourceType, type IAction, type IFilter, type IOrder } from "edifice-ts-client";
1
+ import { ResourceService, type App, type IAction, type IFilter, type IOrder, type ResourceType } from "edifice-ts-client";
2
2
  export interface AppParams {
3
3
  /** Application code */
4
4
  app: App;
5
+ /**
6
+ * Initialize App Resource Service
7
+ */
8
+ service: typeof ResourceService;
5
9
  /** Array of ResourceType */
6
10
  types: ResourceType[];
7
11
  /** Array of IFilter */
@@ -0,0 +1,2 @@
1
+ export * from "./dndkit";
2
+ export * from "./explorer";
@@ -1,4 +1,4 @@
1
- import { type ReactNode, type ReactElement } from "react";
1
+ import { type ReactElement, type ReactNode } from "react";
2
2
  import { IAction, RightRole } from "edifice-ts-client";
3
3
  import { IObjectWithRights } from './useAccessControl';
4
4
  interface AccessControlProps {
@@ -1,12 +1,11 @@
1
- import { type ID } from "edifice-ts-client";
2
1
  interface ModalProps {
3
2
  onSuccess?: () => void;
4
3
  }
5
4
  export declare function useMoveModal({ onSuccess }: ModalProps): {
5
+ treeData: import("@edifice-ui/react").TreeData;
6
6
  disableSubmit: boolean;
7
7
  handleTreeItemSelect: (folderId: string) => void;
8
- handleTreeItemFold: (folderId: string) => void;
9
- handleTreeItemUnfold: (folderId: ID) => Promise<void>;
10
- onMove: () => void;
8
+ handleOnTreeItemUnfold: (nodeId: string) => void;
9
+ onMove: () => Promise<void>;
11
10
  };
12
11
  export {};
@@ -2,7 +2,7 @@ import { type IAction } from "edifice-ts-client";
2
2
  export default function useActionBar(): {
3
3
  onRestore: () => Promise<void>;
4
4
  actions: IAction[] | undefined;
5
- selectedElement: (import("edifice-ts-client").IFolder | import("edifice-ts-client").IResource)[];
5
+ selectedElement: (import("edifice-ts-client").IResource | import("edifice-ts-client").IFolder)[];
6
6
  currentFolderId: string | undefined;
7
7
  overrideLabel: (action: IAction) => string;
8
8
  handleClick: (action: IAction) => Promise<void>;
@@ -0,0 +1,7 @@
1
+ import { DragEndEvent, DragOverEvent, DragStartEvent } from "@dnd-kit/core";
2
+ export default function useDndKit(): {
3
+ handleDragEnd: (event: DragEndEvent) => Promise<void>;
4
+ handleDragStart: (event: DragStartEvent) => void;
5
+ handleDragOver: (event: DragOverEvent) => void;
6
+ sensors: import("@dnd-kit/core").SensorDescriptor<import("@dnd-kit/core").SensorOptions>[];
7
+ };
@@ -0,0 +1,6 @@
1
+ import { IWebApp } from "edifice-ts-client";
2
+ export declare const DraggableCard: ({ app, type, name, }: {
3
+ app?: IWebApp | undefined;
4
+ type: "folder" | "resource";
5
+ name?: string | undefined;
6
+ }) => import("react/jsx-runtime").JSX.Element;
@@ -1,5 +1,5 @@
1
1
  import { CardProps } from "@edifice-ui/react";
2
- import { IWebApp } from "edifice-ts-client";
2
+ import { ID, IWebApp } from "edifice-ts-client";
3
3
  export interface FolderCardProps extends Omit<CardProps, "children"> {
4
4
  /**
5
5
  * IWeb App
@@ -9,9 +9,13 @@ export interface FolderCardProps extends Omit<CardProps, "children"> {
9
9
  * Folder's name
10
10
  */
11
11
  name: string;
12
+ /**
13
+ * Folder's id
14
+ */
15
+ idFolder: ID;
12
16
  }
13
17
  declare const FolderCard: {
14
- ({ app, name, isSelected, isSelectable, onClick, onSelect, }: FolderCardProps): import("react/jsx-runtime").JSX.Element;
18
+ ({ app, name, idFolder, isSelected, isSelectable, onClick, onSelect, }: FolderCardProps): import("react/jsx-runtime").JSX.Element;
15
19
  displayName: string;
16
20
  };
17
21
  export default FolderCard;
package/lib/index.d.ts CHANGED
@@ -1,2 +1,2 @@
1
1
  export { default as Explorer } from "./components/Explorer";
2
- export * from "./config/getExplorerConfig";
2
+ export * from "./config/explorer";
package/lib/index.js CHANGED
@@ -1,14 +1,16 @@
1
- import { E as g, z as l } from "./index2.js";
1
+ import { E as s, B as n } from "./index2.js";
2
2
  import "react/jsx-runtime";
3
3
  import "react";
4
+ import "@dnd-kit/core";
5
+ import "@dnd-kit/modifiers";
4
6
  import "@edifice-ui/react";
5
- import "@edifice-ui/icons";
6
- import "react-i18next";
7
7
  import "edifice-ts-client";
8
8
  import "i18next";
9
9
  import "zustand";
10
10
  import "@tanstack/react-query";
11
+ import "react-i18next";
12
+ import "@edifice-ui/icons";
11
13
  export {
12
- g as Explorer,
13
- l as getExplorerConfig
14
+ s as Explorer,
15
+ n as getExplorerConfig
14
16
  };