@mattisvensson/strapi-plugin-webatlas 0.8.0 → 0.8.2
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/_chunks/FullLoader-Cmsf8xS6.js +12 -0
- package/dist/_chunks/FullLoader-Cmsf8xS6.js.map +1 -0
- package/dist/_chunks/FullLoader-CrPED_dY.mjs +1 -0
- package/dist/_chunks/FullLoader-CrPED_dY.mjs.map +1 -0
- package/dist/_chunks/SettingTitle-BaaQ_99D.mjs +69 -0
- package/dist/_chunks/SettingTitle-BaaQ_99D.mjs.map +1 -0
- package/dist/_chunks/SettingTitle-D5oNwpzC.js +67 -0
- package/dist/_chunks/SettingTitle-DDZxIqee.js +68 -0
- package/dist/_chunks/SettingTitle-DDZxIqee.js.map +1 -0
- package/dist/_chunks/SettingTitle-IwvX4Kb5.mjs +68 -0
- package/dist/_chunks/{de-C1QgkRoj.mjs → de-B9pq-AJZ.mjs} +11 -2
- package/dist/_chunks/de-B9pq-AJZ.mjs.map +1 -0
- package/dist/_chunks/de-DlQxM8Tg.js +131 -0
- package/dist/_chunks/de-DlQxM8Tg.js.map +1 -0
- package/dist/_chunks/{en--8p5hbLP.mjs → en-Dmbcf7gp.mjs} +11 -2
- package/dist/_chunks/en-Dmbcf7gp.mjs.map +1 -0
- package/dist/_chunks/en-DrhxIwOr.js +131 -0
- package/dist/_chunks/en-DrhxIwOr.js.map +1 -0
- package/dist/_chunks/index--XAogZgv.js +247 -0
- package/dist/_chunks/index--XAogZgv.js.map +1 -0
- package/dist/_chunks/index-2lVgPz4a.js +128 -0
- package/dist/_chunks/index-B1dEY-gs.js +246 -0
- package/dist/_chunks/index-B1mbYb2_.js +293 -0
- package/dist/_chunks/index-B2tjc_lG.mjs +247 -0
- package/dist/_chunks/index-B2tjc_lG.mjs.map +1 -0
- package/dist/_chunks/index-BFuwbmZy.js +12241 -0
- package/dist/_chunks/{index-DSPh-fHL.mjs → index-D2Meknib.mjs} +11 -9
- package/dist/_chunks/index-D2SIGcj3.mjs +12242 -0
- package/dist/_chunks/index-D2SIGcj3.mjs.map +1 -0
- package/dist/_chunks/index-DH0mFrgH.js +129 -0
- package/dist/_chunks/index-DH0mFrgH.js.map +1 -0
- package/dist/_chunks/index-DKtlnMlv.js +12242 -0
- package/dist/_chunks/index-DKtlnMlv.js.map +1 -0
- package/dist/_chunks/index-DOMrViWi.js +4207 -0
- package/dist/_chunks/index-DOMrViWi.js.map +1 -0
- package/dist/_chunks/index-DXRtXlZW.mjs +129 -0
- package/dist/_chunks/index-DXRtXlZW.mjs.map +1 -0
- package/dist/_chunks/index-Df365kgY.js +294 -0
- package/dist/_chunks/index-Df365kgY.js.map +1 -0
- package/dist/_chunks/{index-VcxUbdMO.mjs → index-Dm_GIRd4.mjs} +35 -30
- package/dist/_chunks/index-Dt-mlR1F.mjs +4191 -0
- package/dist/_chunks/index-Dt-mlR1F.mjs.map +1 -0
- package/dist/_chunks/index-QFbHwlyj.mjs +294 -0
- package/dist/_chunks/index-QFbHwlyj.mjs.map +1 -0
- package/dist/_chunks/{index-7rox7tGX.mjs → index-QU9SZ_H9.mjs} +93 -52
- package/dist/_chunks/{index-Z3qq1ab8.mjs → index-_49Fvwqq.mjs} +47 -36
- package/dist/_chunks/{index-DGSjLYNl.mjs → index-aAKsnALd.mjs} +1 -1
- package/dist/_chunks/index-g8wz2qoC.js +4206 -0
- package/dist/admin/index.js +5 -0
- package/dist/admin/index.js.map +1 -0
- package/dist/admin/index.mjs +2 -1
- package/dist/admin/index.mjs.map +1 -0
- package/dist/admin/src/components/modals/NavEdit.d.ts +1 -1
- package/dist/admin/src/pages/Navigation/RouteItem.d.ts +1 -0
- package/dist/admin/src/pages/Settings/ContentBox.d.ts +5 -0
- package/dist/admin/src/pages/Settings/PageWrapper.d.ts +2 -1
- package/dist/admin/src/pages/Settings/SettingTitle.d.ts +4 -0
- package/dist/admin/src/pages/Settings/index.d.ts +4 -0
- package/dist/pluginId.d.ts +2 -1
- package/dist/server/index.js +63 -45
- package/dist/server/index.js.map +1 -0
- package/dist/server/index.mjs +63 -45
- package/dist/server/index.mjs.map +1 -0
- package/dist/server/src/utils/index.d.ts +6 -0
- package/dist/server/src/utils/navItemHandler.d.ts +1 -1
- package/dist/server/src/utils/reduceDepthOfOrphanedItems.d.ts +2 -0
- package/package.json +1 -1
- package/dist/_chunks/PageWrapper-B6nLPFak.mjs +0 -55
- package/dist/_chunks/PageWrapper-BMzPDWn4.js +0 -0
- package/dist/_chunks/PageWrapper-BMzPDWn4.js.map +0 -0
- package/dist/_chunks/de-DYxCPOdb.js +0 -0
- package/dist/_chunks/de-DYxCPOdb.js.map +0 -0
- package/dist/_chunks/en-Be-athEA.js +0 -0
- package/dist/_chunks/en-Be-athEA.js.map +0 -0
- package/dist/_chunks/index-Bu-uQ9jA.js +0 -0
- package/dist/_chunks/index-Bu-uQ9jA.js.map +0 -0
- package/dist/_chunks/index-C53yDU_z.js +0 -0
- package/dist/_chunks/index-C53yDU_z.js.map +0 -0
- package/dist/_chunks/index-CAz59RSr.js +0 -0
- package/dist/_chunks/index-CAz59RSr.js.map +0 -0
- package/dist/_chunks/index-DKfUSLPc.js +0 -0
- package/dist/_chunks/index-DKfUSLPc.js.map +0 -0
- package/dist/_chunks/index-DPMhcaxW.js +0 -0
- package/dist/_chunks/index-DPMhcaxW.js.map +0 -0
|
@@ -5,7 +5,7 @@ import { Box, Typography, Dialog, Button, Modal, Flex, SingleSelect, SingleSelec
|
|
|
5
5
|
import { useState, useEffect, createContext, useRef, useContext, useReducer, useCallback, useMemo, forwardRef } from "react";
|
|
6
6
|
import { createPortal } from "react-dom";
|
|
7
7
|
import { useIntl } from "react-intl";
|
|
8
|
-
import { u as useApi, g as getTranslation, d as debounce, a as duplicateCheck, t as transformToUrl, U as URLInfo, b as usePluginConfig } from "./index-
|
|
8
|
+
import { u as useApi, g as getTranslation, d as debounce, a as duplicateCheck, t as transformToUrl, U as URLInfo, b as usePluginConfig } from "./index-D2Meknib.mjs";
|
|
9
9
|
import { useFetchClient, useNotification, Page, Layouts } from "@strapi/strapi/admin";
|
|
10
10
|
import { C as Center, F as FullLoader } from "./FullLoader-CrPED_dY.mjs";
|
|
11
11
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
@@ -231,23 +231,21 @@ function NavCreate() {
|
|
|
231
231
|
setLoading(true);
|
|
232
232
|
try {
|
|
233
233
|
const { data } = await post("/webatlas/navigation", { name, isActive });
|
|
234
|
-
if (data.documentId)
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
} else {
|
|
238
|
-
toggleNotification({
|
|
239
|
-
type: "danger",
|
|
240
|
-
message: formatMessage({
|
|
241
|
-
id: getTranslation("notification.navigation.creationFailed"),
|
|
242
|
-
defaultMessage: "Creation of navigation failed"
|
|
243
|
-
})
|
|
244
|
-
});
|
|
245
|
-
}
|
|
234
|
+
if (!data.documentId) throw new Error("No documentId returned");
|
|
235
|
+
navigate(`/plugins/webatlas/navigation/${data.documentId}`);
|
|
236
|
+
setModalType("");
|
|
246
237
|
} catch (err) {
|
|
247
238
|
console.log(err);
|
|
239
|
+
toggleNotification({
|
|
240
|
+
type: "danger",
|
|
241
|
+
message: formatMessage({
|
|
242
|
+
id: getTranslation("notification.navigation.creationFailed"),
|
|
243
|
+
defaultMessage: "Creation of navigation failed"
|
|
244
|
+
})
|
|
245
|
+
});
|
|
248
246
|
} finally {
|
|
247
|
+
setLoading(false);
|
|
249
248
|
}
|
|
250
|
-
setLoading(false);
|
|
251
249
|
};
|
|
252
250
|
return /* @__PURE__ */ jsx(
|
|
253
251
|
NavModal,
|
|
@@ -282,14 +280,22 @@ function NavEdit({ item, onEdit }) {
|
|
|
282
280
|
const [loading, setLoading] = useState(false);
|
|
283
281
|
const { updateNavigation } = useApi();
|
|
284
282
|
const { formatMessage } = useIntl();
|
|
283
|
+
const { toggleNotification } = useNotification();
|
|
285
284
|
const updateNav = async () => {
|
|
286
285
|
setLoading(true);
|
|
287
286
|
try {
|
|
288
287
|
await updateNavigation(item.documentId, { name, visible });
|
|
289
288
|
setModalType("NavOverview");
|
|
290
|
-
onEdit();
|
|
289
|
+
onEdit({ ...item, name, visible });
|
|
291
290
|
} catch (err) {
|
|
292
291
|
console.log(err);
|
|
292
|
+
toggleNotification({
|
|
293
|
+
type: "danger",
|
|
294
|
+
message: formatMessage({
|
|
295
|
+
id: getTranslation("notification.navigation.updateFailed"),
|
|
296
|
+
defaultMessage: "Updating navigation failed"
|
|
297
|
+
})
|
|
298
|
+
});
|
|
293
299
|
} finally {
|
|
294
300
|
setLoading(false);
|
|
295
301
|
}
|
|
@@ -303,17 +309,6 @@ function NavEdit({ item, onEdit }) {
|
|
|
303
309
|
loadingText: formatMessage({ id: getTranslation("modal.navEdit.loadingText"), defaultMessage: "Updating" }),
|
|
304
310
|
onConfirm: updateNav,
|
|
305
311
|
loading,
|
|
306
|
-
modalToOpen: "NavOverview",
|
|
307
|
-
footer: /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
308
|
-
/* @__PURE__ */ jsx(Button, { onClick: () => setModalType("NavOverview"), variant: "tertiary", children: formatMessage({
|
|
309
|
-
id: getTranslation("modal.navEdit.closeText"),
|
|
310
|
-
defaultMessage: "Cancel"
|
|
311
|
-
}) }),
|
|
312
|
-
/* @__PURE__ */ jsx(Button, { children: formatMessage({
|
|
313
|
-
id: getTranslation("modal.navEdit.confirmText"),
|
|
314
|
-
defaultMessage: "Update"
|
|
315
|
-
}) })
|
|
316
|
-
] }),
|
|
317
312
|
children: /* @__PURE__ */ jsxs(Grid.Root, { gap: 4, children: [
|
|
318
313
|
/* @__PURE__ */ jsx(Grid.Item, { s: 12, m: 6, children: /* @__PURE__ */ jsx(Box, { width: "100%", children: /* @__PURE__ */ jsxs(Field.Root, { children: [
|
|
319
314
|
/* @__PURE__ */ jsx(Field.Label, { children: formatMessage({
|
|
@@ -10606,7 +10601,7 @@ function getProjection(items, activeId, overId, dragOffset, maxDepthValue) {
|
|
|
10606
10601
|
}
|
|
10607
10602
|
function getMaxDepth({ previousItem, maxDepthValue }) {
|
|
10608
10603
|
if (previousItem && typeof previousItem.depth === "number") {
|
|
10609
|
-
return Math.min(previousItem.depth + 1, maxDepthValue
|
|
10604
|
+
return Math.min(previousItem.depth + 1, maxDepthValue);
|
|
10610
10605
|
}
|
|
10611
10606
|
return 0;
|
|
10612
10607
|
}
|
|
@@ -10625,7 +10620,18 @@ function RouteIcon({ type, color = "neutral800" }) {
|
|
|
10625
10620
|
return /* @__PURE__ */ jsx(Box, { width: "16px", height: "16px" });
|
|
10626
10621
|
}
|
|
10627
10622
|
}
|
|
10628
|
-
const RouteItem = forwardRef(({
|
|
10623
|
+
const RouteItem = forwardRef(({
|
|
10624
|
+
item,
|
|
10625
|
+
setParentId,
|
|
10626
|
+
setActionItem,
|
|
10627
|
+
setNavigationItems,
|
|
10628
|
+
ghost,
|
|
10629
|
+
depth,
|
|
10630
|
+
maxDepth,
|
|
10631
|
+
style,
|
|
10632
|
+
wrapperRef,
|
|
10633
|
+
handleProps
|
|
10634
|
+
}, ref) => {
|
|
10629
10635
|
if (!item || !item.route) return null;
|
|
10630
10636
|
const { setModalType } = useContext(ModalContext);
|
|
10631
10637
|
const { formatMessage } = useIntl();
|
|
@@ -10750,7 +10756,7 @@ const RouteItem = forwardRef(({ item, setParentId, setActionItem, setNavigationI
|
|
|
10750
10756
|
id: getTranslation("edit"),
|
|
10751
10757
|
defaultMessage: "Edit"
|
|
10752
10758
|
}) }),
|
|
10753
|
-
/* @__PURE__ */ jsx(MenuItem, { onClick: () => handleAddChildren(), children: formatMessage({
|
|
10759
|
+
depth !== void 0 && depth < maxDepth && /* @__PURE__ */ jsx(MenuItem, { onClick: () => handleAddChildren(), children: formatMessage({
|
|
10754
10760
|
id: getTranslation("navigation.page.navItem.addChildren"),
|
|
10755
10761
|
defaultMessage: "Add children"
|
|
10756
10762
|
}) }),
|
|
@@ -12048,6 +12054,7 @@ const Navigation = () => {
|
|
|
12048
12054
|
onClick: () => saveNavigation(),
|
|
12049
12055
|
loading: isSavingNavigation,
|
|
12050
12056
|
variant: "primary",
|
|
12057
|
+
startIcon: /* @__PURE__ */ jsx(Check, {}),
|
|
12051
12058
|
disabled: JSON.stringify(navigationItems) === JSON.stringify(initialNavigationItemsRef.current),
|
|
12052
12059
|
children: formatMessage({
|
|
12053
12060
|
id: getTranslation("save"),
|
|
@@ -12067,7 +12074,7 @@ const Navigation = () => {
|
|
|
12067
12074
|
onDragCancel: () => handleDragCancel(),
|
|
12068
12075
|
measuring,
|
|
12069
12076
|
children: /* @__PURE__ */ jsxs(SortableContext, { items: navigationItems, strategy: verticalListSortingStrategy, children: [
|
|
12070
|
-
navigationItems.map((item, index) => /* @__PURE__ */ jsx(
|
|
12077
|
+
navigationItems.map((item, index) => config?.navigation.maxDepth && /* @__PURE__ */ jsx(
|
|
12071
12078
|
SortableRouteItem,
|
|
12072
12079
|
{
|
|
12073
12080
|
item,
|
|
@@ -12075,18 +12082,20 @@ const Navigation = () => {
|
|
|
12075
12082
|
setActionItem,
|
|
12076
12083
|
setNavigationItems,
|
|
12077
12084
|
indentationWidth,
|
|
12078
|
-
depth: item.id === activeId && projected ? projected.depth : item.depth
|
|
12085
|
+
depth: item.id === activeId && projected ? projected.depth : item.depth,
|
|
12086
|
+
maxDepth: config.navigation.maxDepth
|
|
12079
12087
|
},
|
|
12080
12088
|
item.documentId || index
|
|
12081
12089
|
)),
|
|
12082
12090
|
createPortal(
|
|
12083
|
-
/* @__PURE__ */ jsx(DragOverlay, { children: activeId && activeItem ? /* @__PURE__ */ jsx(
|
|
12091
|
+
/* @__PURE__ */ jsx(DragOverlay, { children: activeId && activeItem ? config?.navigation.maxDepth && /* @__PURE__ */ jsx(
|
|
12084
12092
|
SortableRouteItem,
|
|
12085
12093
|
{
|
|
12086
12094
|
item: activeItem,
|
|
12087
12095
|
setParentId,
|
|
12088
12096
|
setActionItem,
|
|
12089
|
-
setNavigationItems
|
|
12097
|
+
setNavigationItems,
|
|
12098
|
+
maxDepth: config.navigation.maxDepth
|
|
12090
12099
|
}
|
|
12091
12100
|
) : null }),
|
|
12092
12101
|
document.body
|
|
@@ -12125,7 +12134,7 @@ const Navigation = () => {
|
|
|
12125
12134
|
{
|
|
12126
12135
|
variant: "NavDelete",
|
|
12127
12136
|
item: actionItem,
|
|
12128
|
-
onDelete:
|
|
12137
|
+
onDelete: (deletedItem) => {
|
|
12129
12138
|
cachedNavigations.current = null;
|
|
12130
12139
|
setNavigations((navs) => navs.filter((nav) => nav.id !== deletedItem.id));
|
|
12131
12140
|
navigate("/plugins/webatlas/navigation");
|
|
@@ -12136,7 +12145,10 @@ const Navigation = () => {
|
|
|
12136
12145
|
NavEdit,
|
|
12137
12146
|
{
|
|
12138
12147
|
item: actionItem,
|
|
12139
|
-
onEdit: () => {
|
|
12148
|
+
onEdit: (editedNavigation) => {
|
|
12149
|
+
setNavigations(
|
|
12150
|
+
(navs) => navs?.map((nav) => nav.id === editedNavigation.id ? editedNavigation : nav)
|
|
12151
|
+
);
|
|
12140
12152
|
}
|
|
12141
12153
|
}
|
|
12142
12154
|
),
|
|
@@ -12166,7 +12178,6 @@ const Navigation = () => {
|
|
|
12166
12178
|
{
|
|
12167
12179
|
item: actionItem,
|
|
12168
12180
|
onEdit: (editedItem) => {
|
|
12169
|
-
console.log(editedItem);
|
|
12170
12181
|
setNavigationItems(
|
|
12171
12182
|
(items) => items?.map((item) => item.id === editedItem.id ? editedItem : item)
|
|
12172
12183
|
);
|
|
@@ -2,7 +2,7 @@ import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
|
2
2
|
import { useState, useEffect, useMemo } from "react";
|
|
3
3
|
import { Thead, Tr, Th, Typography, VisuallyHidden, Td, Flex, LinkButton, Grid, Box, Field, Table, Tbody, EmptyStateLayout } from "@strapi/design-system";
|
|
4
4
|
import { ChevronDown, Pencil, Cross } from "@strapi/icons";
|
|
5
|
-
import { g as getTranslation, u as useApi, d as debounce } from "./index-
|
|
5
|
+
import { g as getTranslation, u as useApi, d as debounce } from "./index-D2Meknib.mjs";
|
|
6
6
|
import { Page, Layouts, useNotification } from "@strapi/strapi/admin";
|
|
7
7
|
import "@strapi/icons/symbols";
|
|
8
8
|
import { F as FullLoader } from "./FullLoader-CrPED_dY.mjs";
|