ode-explorer 2.6.17-develop.20261104155830 → 2.6.17-develop.20261105225934

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,4 +1,5 @@
1
- import { IResource, ResourceService, App, IAction, IFilter, IOrder, ResourceType } from '@edifice.io/client';
1
+ import { ReactNode } from 'react';
2
+ import { IFolder, IResource, ResourceService, App, IAction, IFilter, IOrder, ResourceType } from '@edifice.io/client';
2
3
  export interface AppParams {
3
4
  /** Application code */
4
5
  app: App;
@@ -22,5 +23,13 @@ export interface AppParams {
22
23
  enableOnboarding?: boolean;
23
24
  /** Callback function triggered when a resource is created */
24
25
  onResourceCreated?: (resource: IResource) => void;
26
+ /**
27
+ * Render app specific actions in the header, before the create button.
28
+ * Only rendered for users having the create right.
29
+ * `currentFolder` is undefined while a search is active.
30
+ */
31
+ renderAppActions?: (props: {
32
+ currentFolder?: Partial<IFolder>;
33
+ }) => ReactNode;
25
34
  }
26
35
  export declare function getExplorerConfig(): AppParams;
package/lib/index2.js CHANGED
@@ -3,7 +3,7 @@ import { useEffect as B, Suspense as Q, lazy as M, useState as ie, useRef as we,
3
3
  import { useSensor as oe, PointerSensor as xe, KeyboardSensor as Se, useSensors as be, DndContext as Te } from "@dnd-kit/core";
4
4
  import { snapCenterToCursor as Fe } from "@dnd-kit/modifiers";
5
5
  import { odeServices as N, FOLDER as E, SORT_ORDER as Re, ResourceService as de, isActionAvailable as ne } from "@edifice.io/client";
6
- import { findParentNode as ve, findNodeById as G, wrapTreeNode as Ee, useToast as U, moveNode as Le, useUser as ue, useEdificeClient as Z, useShareMutation as Ne, useUpdateMutation as Ae, addNode as Me, updateNode as ke, deleteNode as Pe, getAncestors as ae, LoadingScreen as H, FormControl as He, Input as Qe, SearchButton as Ue, Dropdown as K, useToggle as Ze, useScrollToTop as Oe, TreeView as qe, Button as Be, IconButton as Ve, useXitiTrackPageLoad as _e, AppHeader as Ke, Breadcrumb as $e, Grid as te } from "@edifice.io/react";
6
+ import { findParentNode as ve, findNodeById as G, wrapTreeNode as Ee, useToast as U, moveNode as Le, useUser as ue, useEdificeClient as Z, useShareMutation as Ne, useUpdateMutation as Ae, addNode as Me, updateNode as ke, deleteNode as Pe, getAncestors as ae, LoadingScreen as H, FormControl as He, Input as Qe, SearchButton as Ue, Dropdown as $, useToggle as Ze, useScrollToTop as Oe, TreeView as qe, Button as Be, IconButton as Ve, useXitiTrackPageLoad as _e, AppHeader as Ke, Breadcrumb as $e, Grid as te } from "@edifice.io/react";
7
7
  import { t as L } from "i18next";
8
8
  import { createStore as ze, useStore as je } from "zustand";
9
9
  import { useQuery as We, queryOptions as Ge, useQueryClient as P, useMutation as O, useInfiniteQuery as Je } from "@tanstack/react-query";
@@ -416,11 +416,11 @@ const he = async (e) => {
416
416
  function T(e) {
417
417
  return je(it, e);
418
418
  }
419
- const dt = (e) => e.treeData, ut = (e) => e.actions, $ = () => T(dt), R = () => T(ut), A = () => T((e) => e.searchParams), se = () => T((e) => e.selectedNodeId), ps = () => T((e) => e.selectedFolders), fs = () => T((e) => e.selectedResources), ht = () => T((e) => e.searchConfig), J = () => T((e) => e.folderIds), X = () => T((e) => e.resourceIds), Y = () => T((e) => e.selectedResources.map((t) => t.assetId)), ee = () => T((e) => e.selectedResources.filter((t) => t.assetId === t.id)), z = () => T((e) => e.currentFolder), re = () => {
420
- const e = z();
419
+ const dt = (e) => e.treeData, ut = (e) => e.actions, z = () => T(dt), R = () => T(ut), A = () => T((e) => e.searchParams), se = () => T((e) => e.selectedNodeId), ps = () => T((e) => e.selectedFolders), fs = () => T((e) => e.selectedResources), ht = () => T((e) => e.searchConfig), J = () => T((e) => e.folderIds), X = () => T((e) => e.resourceIds), Y = () => T((e) => e.selectedResources.map((t) => t.assetId)), ee = () => T((e) => e.selectedResources.filter((t) => t.assetId === t.id)), _ = () => T((e) => e.currentFolder), re = () => {
420
+ const e = _();
421
421
  return (e == null ? void 0 : e.id) === E.BIN;
422
422
  }, pt = () => T((e) => e.resourceIsTrash), gs = () => T((e) => e.resourceOrFolderIsDraggable), ft = () => T((e) => e.elementDragOver), gt = () => T((e) => e.resourceActionDisable), mt = () => {
423
- const e = z();
423
+ const e = _();
424
424
  return (e == null ? void 0 : e.id) === "default";
425
425
  }, yt = () => T((e) => e.status), Ct = () => {
426
426
  const e = gt(), {
@@ -571,7 +571,7 @@ const xt = (e, t) => {
571
571
  getNextPageParam: (a) => a.pagination.startIdx + a.pagination.pageSize
572
572
  });
573
573
  }, ys = () => {
574
- const e = U(), t = P(), s = A(), r = $(), o = J(), l = Y(), a = X(), c = ee().length > 0, p = c ? l : a, {
574
+ const e = U(), t = P(), s = A(), r = z(), o = J(), l = Y(), a = X(), c = ee().length > 0, p = c ? l : a, {
575
575
  clearSelectedItems: d,
576
576
  clearSelectedIds: i,
577
577
  setTreeData: h,
@@ -723,7 +723,7 @@ const xt = (e, t) => {
723
723
  }, ws = () => {
724
724
  const e = U(), t = A(), s = P(), {
725
725
  user: r
726
- } = ue(), o = z(), {
726
+ } = ue(), o = _(), {
727
727
  filters: l,
728
728
  trashed: a
729
729
  } = t, c = "duplicate_start", p = ["context", {
@@ -777,7 +777,7 @@ const xt = (e, t) => {
777
777
  }
778
778
  });
779
779
  }, Tt = () => {
780
- const e = U(), t = P(), s = A(), r = $(), o = J(), l = Y(), a = X(), c = ee().length > 0, p = c ? l : a, {
780
+ const e = U(), t = P(), s = A(), r = z(), o = J(), l = Y(), a = X(), c = ee().length > 0, p = c ? l : a, {
781
781
  clearSelectedIds: d,
782
782
  clearSelectedItems: i,
783
783
  setTreeData: h,
@@ -842,7 +842,7 @@ const xt = (e, t) => {
842
842
  }
843
843
  });
844
844
  }, Ds = () => {
845
- const e = U(), t = P(), s = A(), r = $(), {
845
+ const e = U(), t = P(), s = A(), r = z(), {
846
846
  setTreeData: o
847
847
  } = R(), {
848
848
  filters: l,
@@ -893,7 +893,7 @@ const xt = (e, t) => {
893
893
  }
894
894
  });
895
895
  }, xs = () => {
896
- const e = U(), t = P(), s = A(), r = $(), {
896
+ const e = U(), t = P(), s = A(), r = z(), {
897
897
  setFolderIds: o,
898
898
  setSelectedFolders: l,
899
899
  setTreeData: a
@@ -1116,7 +1116,7 @@ function Ft() {
1116
1116
  setResourceIds: p,
1117
1117
  setFolderIds: d,
1118
1118
  fetchTreeData: i
1119
- } = R(), h = $(), g = oe(xe, {
1119
+ } = R(), h = z(), g = oe(xe, {
1120
1120
  activationConstraint: {
1121
1121
  delay: wt,
1122
1122
  tolerance: Dt
@@ -1138,8 +1138,8 @@ function Ft() {
1138
1138
  const {
1139
1139
  over: D,
1140
1140
  active: y
1141
- } = S, f = D == null ? void 0 : D.data.current, w = y.data.current, v = ae(h, f == null ? void 0 : f.id), _ = le(h, f == null ? void 0 : f.id);
1142
- if ((w == null ? void 0 : w.id) == (f == null ? void 0 : f.id) || v.includes(w == null ? void 0 : w.id) || _.includes(w == null ? void 0 : w.id))
1141
+ } = S, f = D == null ? void 0 : D.data.current, w = y.data.current, v = ae(h, f == null ? void 0 : f.id), K = le(h, f == null ? void 0 : f.id);
1142
+ if ((w == null ? void 0 : w.id) == (f == null ? void 0 : f.id) || v.includes(w == null ? void 0 : w.id) || K.includes(w == null ? void 0 : w.id))
1143
1143
  p([]), d([]);
1144
1144
  else {
1145
1145
  const j = (f == null ? void 0 : f.name) ?? l;
@@ -1175,7 +1175,7 @@ function Ft() {
1175
1175
  const {
1176
1176
  over: D,
1177
1177
  active: y
1178
- } = S, f = D == null ? void 0 : D.data.current, w = y == null ? void 0 : y.data.current, v = ae(h, f == null ? void 0 : f.id), _ = le(h, f == null ? void 0 : f.id);
1178
+ } = S, f = D == null ? void 0 : D.data.current, w = y == null ? void 0 : y.data.current, v = ae(h, f == null ? void 0 : f.id), K = le(h, f == null ? void 0 : f.id);
1179
1179
  if (D) {
1180
1180
  const j = {
1181
1181
  isOver: !0,
@@ -1183,7 +1183,7 @@ function Ft() {
1183
1183
  overId: f == null ? void 0 : f.id,
1184
1184
  isTreeview: f == null ? void 0 : f.isTreeview
1185
1185
  };
1186
- (w == null ? void 0 : w.id) === (f == null ? void 0 : f.id) || v.includes(w == null ? void 0 : w.id) || _.includes(w == null ? void 0 : w.id) ? c({
1186
+ (w == null ? void 0 : w.id) === (f == null ? void 0 : f.id) || v.includes(w == null ? void 0 : w.id) || K.includes(w == null ? void 0 : w.id) ? c({
1187
1187
  ...j,
1188
1188
  canMove: !1
1189
1189
  }) : (i(f == null ? void 0 : f.id, e), c({
@@ -1202,7 +1202,7 @@ function Ft() {
1202
1202
  };
1203
1203
  }
1204
1204
  const Rt = /* @__PURE__ */ M(async () => await import("./EmptyScreenApp.js")), vt = /* @__PURE__ */ M(async () => await import("./EmptyScreenSearch.js")), Et = /* @__PURE__ */ M(async () => await import("./EmptyScreenError.js")), Lt = /* @__PURE__ */ M(async () => await import("./EmptyScreenNoContentInFolder.js")), Nt = /* @__PURE__ */ M(async () => await import("./EmptyScreenTrash.js")), At = /* @__PURE__ */ M(async () => await import("./FoldersList.js")), Mt = /* @__PURE__ */ M(async () => await import("./ResourcesList.js")), kt = () => {
1205
- const e = mt(), t = re(), s = se(), r = A(), o = z(), l = U(), a = P(), {
1205
+ const e = mt(), t = re(), s = se(), r = A(), o = _(), l = U(), a = P(), {
1206
1206
  appCode: c
1207
1207
  } = Z(), {
1208
1208
  t: p
@@ -1308,7 +1308,7 @@ const Rt = /* @__PURE__ */ M(async () => await import("./EmptyScreenApp.js")), v
1308
1308
  return;
1309
1309
  }
1310
1310
  o(i);
1311
- }, a = z(), c = A(), {
1311
+ }, a = _(), c = A(), {
1312
1312
  setSearchParams: p
1313
1313
  } = R();
1314
1314
  B(() => {
@@ -1386,12 +1386,12 @@ const Rt = /* @__PURE__ */ M(async () => await import("./EmptyScreenApp.js")), v
1386
1386
  ns: e
1387
1387
  }), onClick: d })
1388
1388
  ] }),
1389
- /* @__PURE__ */ b(K, { placement: "bottom-end", children: [
1390
- /* @__PURE__ */ n(K.Trigger, { label: t("explorer.filters"), icon: /* @__PURE__ */ n(Qt, { width: 20 }), variant: "ghost", badgeContent: i }),
1391
- /* @__PURE__ */ n(K.Menu, { children: r.map((h) => h.value === "0" ? /* @__PURE__ */ b(De, { children: [
1392
- /* @__PURE__ */ n(K.RadioItem, { value: h.value, model: s, onChange: () => o(h.value), children: h.label }),
1393
- /* @__PURE__ */ n(K.Separator, {})
1394
- ] }, "0") : /* @__PURE__ */ n(K.RadioItem, { value: h.value, model: s, onChange: () => o(h.value), children: h.label }, h.value)) })
1389
+ /* @__PURE__ */ b($, { placement: "bottom-end", children: [
1390
+ /* @__PURE__ */ n($.Trigger, { label: t("explorer.filters"), icon: /* @__PURE__ */ n(Qt, { width: 20 }), variant: "ghost", badgeContent: i }),
1391
+ /* @__PURE__ */ n($.Menu, { children: r.map((h) => h.value === "0" ? /* @__PURE__ */ b(De, { children: [
1392
+ /* @__PURE__ */ n($.RadioItem, { value: h.value, model: s, onChange: () => o(h.value), children: h.label }),
1393
+ /* @__PURE__ */ n($.Separator, {})
1394
+ ] }, "0") : /* @__PURE__ */ n($.RadioItem, { value: h.value, model: s, onChange: () => o(h.value), children: h.label }, h.value)) })
1395
1395
  ] })
1396
1396
  ] });
1397
1397
  }, qt = ({
@@ -1407,7 +1407,7 @@ const Rt = /* @__PURE__ */ M(async () => await import("./EmptyScreenApp.js")), v
1407
1407
  /* @__PURE__ */ n("span", { children: r("explorer.tree.trash") })
1408
1408
  ] }) }) }) }) }) }) });
1409
1409
  }, Bt = /* @__PURE__ */ M(async () => await import("./FolderModal.js")), Vt = () => {
1410
- const [e, t] = Ze(), s = P(), r = $(), o = re(), l = se(), a = ft(), c = Oe(), p = o ? E.BIN : l, {
1410
+ const [e, t] = Ze(), s = P(), r = z(), o = re(), l = se(), a = ft(), c = Oe(), p = o ? E.BIN : l, {
1411
1411
  appCode: d
1412
1412
  } = Z(), {
1413
1413
  t: i
@@ -1427,8 +1427,8 @@ const Rt = /* @__PURE__ */ M(async () => await import("./EmptyScreenApp.js")), v
1427
1427
  }, F = (S) => {
1428
1428
  var f, w;
1429
1429
  const D = G(r, S), y = (f = D == null ? void 0 : D.children) == null ? void 0 : f.some((v) => {
1430
- var _;
1431
- return Array.isArray(v == null ? void 0 : v.children) && ((_ = v.children) == null ? void 0 : _.length) > 0;
1430
+ var K;
1431
+ return Array.isArray(v == null ? void 0 : v.children) && ((K = v.children) == null ? void 0 : K.length) > 0;
1432
1432
  });
1433
1433
  (w = D == null ? void 0 : D.children) == null || w.forEach((v) => {
1434
1434
  y || C(v.id, s);
@@ -1452,7 +1452,7 @@ function _t() {
1452
1452
  t: s
1453
1453
  } = V(["common", e]), {
1454
1454
  inputSearch: r
1455
- } = Ce(), o = se(), l = re(), a = z(), c = s("explorer.tree.trash"), p = s("explorer.tree.search"), d = s("explorer.filters.mine", {
1455
+ } = Ce(), o = se(), l = re(), a = _(), c = s("explorer.tree.trash"), p = s("explorer.tree.search"), d = s("explorer.filters.mine", {
1456
1456
  ns: e
1457
1457
  }), i = (a == null ? void 0 : a.name) || d;
1458
1458
  return /* @__PURE__ */ n("div", { className: "py-16", children: o && o !== "bin" && o !== "default" && !l ? /* @__PURE__ */ b("div", { className: "d-flex align-items-center gap-8", children: [
@@ -1476,28 +1476,36 @@ const Kt = "data:image/svg+xml,%3csvg%20width='300'%20height='214'%20viewBox='0%
1476
1476
  }, [e]);
1477
1477
  const {
1478
1478
  currentApp: o
1479
- } = Z(), {
1480
- data: l
1479
+ } = Z(), l = _(), {
1480
+ data: a
1481
1481
  } = St(e.actions), {
1482
- isTrashedModalOpen: a,
1483
- onTrashedCancel: c
1482
+ isTrashedModalOpen: c,
1483
+ onTrashedCancel: p
1484
1484
  } = It(), {
1485
- isActionDisableModalOpen: p,
1486
- onActionDisableCancel: d
1485
+ isActionDisableModalOpen: d,
1486
+ onActionDisableCancel: i
1487
1487
  } = Ct(), {
1488
- handleDragEnd: i,
1489
- handleDragOver: h,
1490
- handleDragStart: u,
1491
- sensors: g
1488
+ handleDragEnd: h,
1489
+ handleDragOver: u,
1490
+ handleDragStart: g,
1491
+ sensors: m
1492
1492
  } = Ft();
1493
1493
  _e();
1494
- const m = ne("publish", l), I = ne("create", l);
1494
+ const I = ne("publish", a), C = ne("create", a);
1495
1495
  return e && /* @__PURE__ */ b(W, { children: [
1496
- /* @__PURE__ */ n(Ke, { render: () => I ? /* @__PURE__ */ n(Q, { fallback: /* @__PURE__ */ n(H, {}), children: /* @__PURE__ */ n(jt, { onResourceCreated: e.onResourceCreated }) }) : null, children: /* @__PURE__ */ n($e, { app: o }) }),
1497
- /* @__PURE__ */ n(te, { className: "flex-grow-1", children: /* @__PURE__ */ b(Te, { sensors: g, modifiers: [Fe], onDragStart: u, onDragEnd: i, onDragOver: h, children: [
1496
+ /* @__PURE__ */ n(Ke, { render: () => {
1497
+ var x;
1498
+ return C ? /* @__PURE__ */ b(Q, { fallback: /* @__PURE__ */ n(H, {}), children: [
1499
+ (x = e.renderAppActions) == null ? void 0 : x.call(e, {
1500
+ currentFolder: l
1501
+ }),
1502
+ /* @__PURE__ */ n(jt, { onResourceCreated: e.onResourceCreated })
1503
+ ] }) : null;
1504
+ }, children: /* @__PURE__ */ n($e, { app: o }) }),
1505
+ /* @__PURE__ */ n(te, { className: "flex-grow-1", children: /* @__PURE__ */ b(Te, { sensors: m, modifiers: [Fe], onDragStart: g, onDragEnd: h, onDragOver: u, children: [
1498
1506
  /* @__PURE__ */ n(te.Col, { sm: "3", lg: "2", xl: "3", className: "border-end pt-16 pe-16 d-none d-lg-block", as: "aside", children: /* @__PURE__ */ b(Q, { fallback: /* @__PURE__ */ n(H, {}), children: [
1499
1507
  /* @__PURE__ */ n(Vt, {}),
1500
- m && /* @__PURE__ */ n(Wt, {})
1508
+ I && /* @__PURE__ */ n(Wt, {})
1501
1509
  ] }) }),
1502
1510
  /* @__PURE__ */ b(te.Col, { sm: "4", md: "8", lg: "6", xl: "9", children: [
1503
1511
  /* @__PURE__ */ n(Ot, {}),
@@ -1524,8 +1532,8 @@ const Kt = "data:image/svg+xml,%3csvg%20width='300'%20height='214'%20viewBox='0%
1524
1532
  nextText: "explorer.modal.onboarding.trash.next",
1525
1533
  closeText: "explorer.modal.onboarding.trash.close"
1526
1534
  } }),
1527
- a && /* @__PURE__ */ n(Xt, { isOpen: a, onCancel: c }),
1528
- p && /* @__PURE__ */ n(Jt, { isOpen: p, onCancel: d })
1535
+ c && /* @__PURE__ */ n(Xt, { isOpen: c, onCancel: p }),
1536
+ d && /* @__PURE__ */ n(Jt, { isOpen: d, onCancel: i })
1529
1537
  ] })
1530
1538
  ] }) })
1531
1539
  ] });
@@ -1537,7 +1545,7 @@ export {
1537
1545
  Ut as S,
1538
1546
  R as a,
1539
1547
  St as b,
1540
- z as c,
1548
+ _ as c,
1541
1549
  Ts as d,
1542
1550
  A as e,
1543
1551
  re as f,
@@ -1560,5 +1568,5 @@ export {
1560
1568
  Is as w,
1561
1569
  ys as x,
1562
1570
  Tt as y,
1563
- $ as z
1571
+ z
1564
1572
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ode-explorer",
3
- "version": "2.6.17-develop.20261104155830",
3
+ "version": "2.6.17-develop.20261105225934",
4
4
  "description": "Edifice Explorer",
5
5
  "homepage": "https://github.com/edificeio/explorer#readme",
6
6
  "bugs": {