ode-explorer 1.3.3-develop-pedago.202402131510 → 1.3.3-develop-pedago.202402131554

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.html CHANGED
@@ -15,16 +15,20 @@
15
15
  <div id="portal"></div>
16
16
  <!-- SET INITIALISATION CONFIG -->
17
17
  <script>
18
- var WORFLOW_ACCESS = "org.entcore.blog.controllers.BlogController|blog";
18
+ var WORFLOW_ACCESS =
19
+ "fr.wseduc.scrapbook.controllers.ScrapbookController|view";
19
20
  var WORKFLOW_CREATE =
20
- "org.entcore.blog.controllers.BlogController|create";
21
+ "fr.wseduc.scrapbook.controllers.ScrapbookController|createScrapbook";
21
22
  var WORKFLOW_PUBLISH =
22
- "org.entcore.blog.controllers.BlogController|publish";
23
- var WORKFLOW_PRINT = "org.entcore.blog.controllers.BlogController|print";
23
+ "fr.wseduc.scrapbook.controllers.ScrapbookController|publish";
24
+ var WORKFLOW_PRINT =
25
+ "fr.wseduc.scrapbook.controllers.ScrapbookController|print";
26
+ var WORKFLOW_EXPORT_HTML =
27
+ "fr.wseduc.scrapbook.controllers.ScrapbookController|exportHtml";
24
28
  ///////////
25
29
  var explorerConfig = {
26
- app: "blog",
27
- types: ["blog"],
30
+ app: "scrapbook",
31
+ types: ["scrapbook"],
28
32
  filters: [
29
33
  { id: "owner", defaultValue: true },
30
34
  { id: "public", defaultValue: false },
@@ -58,12 +62,12 @@
58
62
  workflow: WORKFLOW_CREATE,
59
63
  target: "tree",
60
64
  },
61
- {
62
- id: "createPublic",
63
- workflow:
64
- "org.entcore.blog.controllers.BlogController|createPublicBlog",
65
- target: "tree",
66
- },
65
+ /*{
66
+ id: "duplicate",
67
+ workflow: WORFLOW_ACCESS,
68
+ target: "actionbar",
69
+ right: "tree",
70
+ },*/
67
71
  {
68
72
  id: "move",
69
73
  workflow: WORFLOW_ACCESS,
@@ -76,6 +80,12 @@
76
80
  target: "actionbar",
77
81
  right: "creator",
78
82
  },
83
+ {
84
+ id: "export",
85
+ workflow: WORKFLOW_EXPORT_HTML,
86
+ target: "actionbar",
87
+ right: "read",
88
+ },
79
89
  {
80
90
  id: "print",
81
91
  workflow: WORKFLOW_PRINT,
package/dist/index.js CHANGED
@@ -68229,20 +68229,21 @@ const queryClient = new QueryClient({
68229
68229
  });
68230
68230
  const getHTMLConfig = getExplorerConfig();
68231
68231
  createRoot(root).render(
68232
- // <StrictMode>
68233
- /* @__PURE__ */ jsxRuntimeExports.jsxs(QueryClientProvider, { client: queryClient, children: [
68234
- /* @__PURE__ */ jsxRuntimeExports.jsx(
68235
- OdeClientProvider,
68236
- {
68237
- params: {
68238
- app: getHTMLConfig.app
68239
- },
68240
- children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root, {}) })
68241
- }
68242
- ),
68243
- /* @__PURE__ */ jsxRuntimeExports.jsx(ReactQueryDevtools2, { initialIsOpen: false })
68232
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(reactExports.StrictMode, { children: [
68233
+ /* @__PURE__ */ jsxRuntimeExports.jsxs(QueryClientProvider, { client: queryClient, children: [
68234
+ /* @__PURE__ */ jsxRuntimeExports.jsx(
68235
+ OdeClientProvider,
68236
+ {
68237
+ params: {
68238
+ app: getHTMLConfig.app
68239
+ },
68240
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(ThemeProvider, { children: /* @__PURE__ */ jsxRuntimeExports.jsx(Root, {}) })
68241
+ }
68242
+ ),
68243
+ /* @__PURE__ */ jsxRuntimeExports.jsx(ReactQueryDevtools2, { initialIsOpen: false })
68244
+ ] }),
68245
+ ","
68244
68246
  ] })
68245
- // </StrictMode>,
68246
68247
  );
68247
68248
  function EmptyScreenApp() {
68248
68249
  const { appCode } = useOdeClient();
@@ -68997,7 +68998,11 @@ function useActionBar() {
68997
68998
  case "edit":
68998
68999
  return onEdit();
68999
69000
  case "export":
69000
- return onExport();
69001
+ if (resourceIds.length > 0) {
69002
+ return onExport();
69003
+ } else {
69004
+ return null;
69005
+ }
69001
69006
  case ACTION.SHARE:
69002
69007
  return setOpenedModalName("share");
69003
69008
  default:
@@ -69020,6 +69025,8 @@ function useActionBar() {
69020
69025
  return onlyOneItemSelected && noFolderSelected;
69021
69026
  case ACTION.SHARE:
69022
69027
  return noFolderSelected && onlyOneItemSelected;
69028
+ case "export":
69029
+ return onlyOneItemSelected && noFolderSelected;
69023
69030
  case ACTION.PRINT:
69024
69031
  return onlyOneItemSelected && noFolderSelected;
69025
69032
  case "edit":
package/dist/version.txt CHANGED
@@ -1 +1 @@
1
- ode-explorer=1.0-b2school-SNAPSHOT 13/02/2024 15:11:30
1
+ ode-explorer=1.0-b2school-SNAPSHOT 13/02/2024 15:54:32
@@ -1,5 +1,5 @@
1
1
  import { jsx as i, Fragment as $, jsxs as J } from "react/jsx-runtime";
2
- import { useState as T, useEffect as K, Suspense as ie, lazy as v } from "react";
2
+ import { useState as T, useEffect as K, Suspense as ie, lazy as A } from "react";
3
3
  import { useUser as le, Button as Q, useOdeClient as ue, ActionBar as de, LoadingScreen as he, isActionAvailable as pe, BlogPublic as fe, ShareModal as me, ShareBlog as Re } from "@edifice-ui/react";
4
4
  import { useTransition as Se, animated as Ee } from "@react-spring/web";
5
5
  import { useTranslation as X } from "react-i18next";
@@ -52,8 +52,8 @@ function Be({
52
52
  if (typeof o[0] == "string")
53
53
  await m(o);
54
54
  else {
55
- const E = o.map((b) => b.rights);
56
- await a(E);
55
+ const b = o.map((O) => O.rights);
56
+ await a(b);
57
57
  }
58
58
  else
59
59
  s(!1);
@@ -66,7 +66,7 @@ function Be({
66
66
  };
67
67
  }
68
68
  function ee() {
69
- const [r, o] = T(!1), [n, h] = T("void"), [s, S] = T(), p = be((e) => e.config), m = Oe(), a = Ce(), R = Z(), l = ye(), c = Ie(), f = q(), E = ve(), b = Ae(), O = ge(), {
69
+ const [r, o] = T(!1), [n, h] = T("void"), [s, S] = T(), p = be((e) => e.config), m = Oe(), a = Ce(), R = Z(), l = ye(), c = Ie(), f = q(), b = ve(), O = Ae(), C = ge(), {
70
70
  openResource: B,
71
71
  printSelectedResource: x,
72
72
  openFolder: D,
@@ -80,15 +80,15 @@ function ee() {
80
80
  o(!1);
81
81
  return;
82
82
  }
83
- if (b) {
83
+ if (O) {
84
84
  o(!1);
85
85
  return;
86
86
  }
87
87
  o(!0);
88
88
  }, [a, c]);
89
89
  async function k(e) {
90
- var P;
91
- switch ((P = document.getElementById("root")) == null || P.setAttribute("aria-hidden", "true"), S(e), e.id) {
90
+ var w;
91
+ switch ((w = document.getElementById("root")) == null || w.setAttribute("aria-hidden", "true"), S(e), e.id) {
92
92
  case d.OPEN:
93
93
  return a.length > 0 ? B(R[0]) : D({
94
94
  folder: l[0],
@@ -101,14 +101,14 @@ function ee() {
101
101
  case d.DELETE:
102
102
  return h("delete");
103
103
  case d.RESTORE:
104
- return await A();
104
+ return await g();
105
105
  case d.PUBLISH:
106
106
  return h("publish");
107
107
  case d.UPD_PROPS:
108
108
  case "edit":
109
109
  return re();
110
110
  case "export":
111
- return ce();
111
+ return a.length > 0 ? ce() : null;
112
112
  case d.SHARE:
113
113
  return h("share");
114
114
  default:
@@ -116,20 +116,22 @@ function ee() {
116
116
  }
117
117
  }
118
118
  function H(e) {
119
- const P = a.length + c.length, I = a.length === 1 || c.length === 1, G = P === 1, w = c.length === 0;
119
+ const w = a.length + c.length, E = a.length === 1 || c.length === 1, G = w === 1, v = c.length === 0;
120
120
  switch (e.id) {
121
121
  case d.OPEN:
122
122
  return G;
123
123
  case d.MANAGE:
124
- return I;
124
+ return E;
125
125
  case d.PUBLISH:
126
- return I && w;
126
+ return E && v;
127
127
  case d.UPD_PROPS:
128
- return I && w;
128
+ return E && v;
129
129
  case d.SHARE:
130
- return w && I;
130
+ return v && E;
131
+ case "export":
132
+ return E && v;
131
133
  case d.PRINT:
132
- return I && w;
134
+ return E && v;
133
135
  case "edit":
134
136
  return G;
135
137
  default:
@@ -137,29 +139,29 @@ function ee() {
137
139
  }
138
140
  }
139
141
  const U = () => !0;
140
- async function A() {
142
+ async function g() {
141
143
  try {
142
144
  if (f)
143
- await E.mutate();
145
+ await b.mutate();
144
146
  else
145
147
  throw new Error("Cannot restore untrashed resources");
146
- g();
148
+ M();
147
149
  } catch (e) {
148
150
  console.error(e);
149
151
  }
150
152
  }
151
- function g() {
153
+ function M() {
152
154
  var e;
153
155
  h("void"), s != null && s.id && ((e = document.getElementById(s == null ? void 0 : s.id)) == null || e.focus());
154
156
  }
155
157
  const t = (e) => () => {
156
- n === e && (g(), L(), _());
157
- }, j = t("move"), M = t("move"), Y = t("delete"), C = t("delete"), y = t("publish"), u = t("publish"), z = t("edit_folder"), V = t("edit_folder"), se = t("edit_resource"), te = t("edit_resource"), oe = t("share"), ne = t("share");
158
+ n === e && (M(), L(), _());
159
+ }, j = t("move"), P = t("move"), Y = t("delete"), y = t("delete"), I = t("publish"), u = t("publish"), z = t("edit_folder"), V = t("edit_folder"), se = t("edit_resource"), te = t("edit_resource"), oe = t("share"), ne = t("share");
158
160
  function re() {
159
161
  if (a && a.length > 0) {
160
162
  const e = R[0].assetId;
161
163
  (p == null ? void 0 : p.app) == "scrapbook" ? Pe({
162
- searchParams: O,
164
+ searchParams: C,
163
165
  assetId: e
164
166
  }) : h("edit_resource");
165
167
  } else
@@ -169,7 +171,7 @@ function ee() {
169
171
  if (a && a.length > 0) {
170
172
  const e = R[0].assetId;
171
173
  we({
172
- searchParams: O,
174
+ searchParams: C,
173
175
  assetId: e
174
176
  });
175
177
  }
@@ -178,7 +180,7 @@ function ee() {
178
180
  return e.id === "edit" && c.length > 0 ? "explorer.rename" : `explorer.actions.${e.id}`;
179
181
  }
180
182
  return {
181
- onRestore: A,
183
+ onRestore: g,
182
184
  actions: f ? p == null ? void 0 : p.trashActions : N,
183
185
  selectedElement: [...R, ...l],
184
186
  currentFolderId: m == null ? void 0 : m.id,
@@ -188,13 +190,13 @@ function ee() {
188
190
  isActionBarOpen: r,
189
191
  isMoveModalOpen: n === "move",
190
192
  onMoveCancel: j,
191
- onMoveSuccess: M,
193
+ onMoveSuccess: P,
192
194
  isDeleteModalOpen: n === "delete",
193
- onDeleteCancel: C,
195
+ onDeleteCancel: y,
194
196
  onDeleteSuccess: Y,
195
197
  isPublishModalOpen: n === "publish",
196
198
  onPublishCancel: u,
197
- onPublishSuccess: y,
199
+ onPublishSuccess: I,
198
200
  isEditFolderOpen: n === "edit_folder",
199
201
  onEditFolderCancel: V,
200
202
  onEditFolderSuccess: z,
@@ -204,7 +206,7 @@ function ee() {
204
206
  isShareResourceOpen: n === "share",
205
207
  onShareResourceCancel: ne,
206
208
  onShareResourceSuccess: oe,
207
- onClearActionBar: g
209
+ onClearActionBar: M
208
210
  };
209
211
  }
210
212
  function xe({
@@ -231,7 +233,7 @@ function xe({
231
233
  a(!0);
232
234
  }, children: S(p(n)) }) : /* @__PURE__ */ i($, {});
233
235
  }
234
- const De = /* @__PURE__ */ v(async () => await import("./PublishModal.js")), Le = /* @__PURE__ */ v(async () => await import("./ResourceModal.js")), _e = /* @__PURE__ */ v(async () => await import("./DeleteModal.js")), Ne = /* @__PURE__ */ v(async () => await import("./MoveModal.js")), ke = /* @__PURE__ */ v(async () => await import("./FolderModal.js"));
236
+ const De = /* @__PURE__ */ A(async () => await import("./PublishModal.js")), Le = /* @__PURE__ */ A(async () => await import("./ResourceModal.js")), _e = /* @__PURE__ */ A(async () => await import("./DeleteModal.js")), Ne = /* @__PURE__ */ A(async () => await import("./MoveModal.js")), ke = /* @__PURE__ */ A(async () => await import("./FolderModal.js"));
235
237
  function Qe() {
236
238
  const {
237
239
  appCode: r
@@ -249,9 +251,9 @@ function Qe() {
249
251
  onEditFolderCancel: l,
250
252
  onEditFolderSuccess: c,
251
253
  isEditResourceOpen: f,
252
- onEditResourceCancel: E,
253
- onEditResourceSuccess: b,
254
- isShareResourceOpen: O,
254
+ onEditResourceCancel: b,
255
+ onEditResourceSuccess: O,
256
+ isShareResourceOpen: C,
255
257
  onShareResourceCancel: B,
256
258
  onShareResourceSuccess: x,
257
259
  onMoveCancel: D,
@@ -261,8 +263,8 @@ function Qe() {
261
263
  onPublishCancel: k,
262
264
  onPublishSuccess: H,
263
265
  isActivable: U,
264
- handleClick: A
265
- } = ee(), t = Z()[0], j = Fe(r), M = Te(r), Y = Se(m, {
266
+ handleClick: g
267
+ } = ee(), t = Z()[0], j = Fe(r), P = Te(r), Y = Se(m, {
266
268
  from: {
267
269
  opacity: 0,
268
270
  transform: "translateY(100%)"
@@ -277,16 +279,16 @@ function Qe() {
277
279
  }
278
280
  });
279
281
  return /* @__PURE__ */ J($, { children: [
280
- Y((C, y) => y && /* @__PURE__ */ i(Ee.div, { className: "position-fixed bottom-0 start-0 end-0 z-3", style: C, children: /* @__PURE__ */ i(de, { children: n == null ? void 0 : n.filter((u) => u.available && u.target === "actionbar").map((u) => U(u) && /* @__PURE__ */ i(xe, { resourceRights: h, roleExpected: u.right, action: u, children: /* @__PURE__ */ i(Q, { id: u.id, type: "button", color: "primary", variant: "filled", onClick: () => {
281
- A(u);
282
+ Y((y, I) => I && /* @__PURE__ */ i(Ee.div, { className: "position-fixed bottom-0 start-0 end-0 z-3", style: y, children: /* @__PURE__ */ i(de, { children: n == null ? void 0 : n.filter((u) => u.available && u.target === "actionbar").map((u) => U(u) && /* @__PURE__ */ i(xe, { resourceRights: h, roleExpected: u.right, action: u, children: /* @__PURE__ */ i(Q, { id: u.id, type: "button", color: "primary", variant: "filled", onClick: () => {
283
+ g(u);
282
284
  }, children: o(R(u)) }, u.id) }, u.id)) }) })),
283
285
  /* @__PURE__ */ J(ie, { fallback: /* @__PURE__ */ i(he, {}), children: [
284
286
  s && /* @__PURE__ */ i(Ne, { isOpen: s, onCancel: D, onSuccess: L }),
285
287
  S && /* @__PURE__ */ i(_e, { isOpen: S, onCancel: _, onSuccess: N }),
286
288
  p && t && /* @__PURE__ */ i(De, { isOpen: p, resourceId: t.assetId, onCancel: k, onSuccess: H }),
287
289
  a && /* @__PURE__ */ i(ke, { edit: !0, isOpen: a, onCancel: l, onSuccess: c }),
288
- f && t && /* @__PURE__ */ i(Le, { mode: "update", isOpen: f, resourceId: t.assetId, updateResource: M, onCancel: E, onSuccess: b, children: (C, y, u, z, V) => r === "blog" && pe("createPublic", n) && /* @__PURE__ */ i(fe, { appCode: r, isUpdating: y, resource: C, watch: u, setValue: z, register: V }) }),
289
- O && t && /* @__PURE__ */ i(me, { isOpen: O, resourceId: t.assetId, shareResource: j, onCancel: B, onSuccess: x, children: r === "blog" ? /* @__PURE__ */ i(Re, { resource: t, updateResource: M }) : null })
290
+ f && t && /* @__PURE__ */ i(Le, { mode: "update", isOpen: f, resourceId: t.assetId, updateResource: P, onCancel: b, onSuccess: O, children: (y, I, u, z, V) => r === "blog" && pe("createPublic", n) && /* @__PURE__ */ i(fe, { appCode: r, isUpdating: I, resource: y, watch: u, setValue: z, register: V }) }),
291
+ C && t && /* @__PURE__ */ i(me, { isOpen: C, resourceId: t.assetId, shareResource: j, onCancel: B, onSuccess: x, children: r === "blog" ? /* @__PURE__ */ i(Re, { resource: t, updateResource: P }) : null })
290
292
  ] })
291
293
  ] });
292
294
  }
@@ -5,7 +5,7 @@ export default function useActionBar(): {
5
5
  selectedElement: (import("edifice-ts-client").IFolder | import("edifice-ts-client").IResource)[];
6
6
  currentFolderId: string | undefined;
7
7
  overrideLabel: (action: IAction) => string;
8
- handleClick: (action: IAction) => Promise<void>;
8
+ handleClick: (action: IAction) => Promise<void | null>;
9
9
  isActivable: (action: IAction) => boolean;
10
10
  isActionBarOpen: boolean;
11
11
  isMoveModalOpen: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-explorer",
3
- "version": "1.3.3-develop-pedago.202402131510",
3
+ "version": "1.3.3-develop-pedago.202402131554",
4
4
  "description": "Open Digital Education Explorer",
5
5
  "homepage": "https://github.com/opendigitaleducation/explorer#readme",
6
6
  "bugs": {