@mattisvensson/strapi-plugin-webatlas 0.5.0 → 0.6.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.
- package/dist/_chunks/{de-D8LMOTFI.js → de-CL1TIZPg.js} +2 -1
- package/dist/_chunks/{en-BdfmJUs8.js.map → de-CL1TIZPg.js.map} +1 -1
- package/dist/_chunks/{de-BkirTac9.mjs → de-CzVD4dbZ.mjs} +2 -1
- package/dist/_chunks/{de-BkirTac9.mjs.map → de-CzVD4dbZ.mjs.map} +1 -1
- package/dist/_chunks/{en-BdfmJUs8.js → en-Du-Ap60j.js} +2 -1
- package/dist/_chunks/{de-D8LMOTFI.js.map → en-Du-Ap60j.js.map} +1 -1
- package/dist/_chunks/{en-DYbDta3m.mjs → en-Nk6QcTdr.mjs} +2 -1
- package/dist/_chunks/{en-DYbDta3m.mjs.map → en-Nk6QcTdr.mjs.map} +1 -1
- package/dist/_chunks/{index-Ctq2vsD5.mjs → index-B5u3q4DO.mjs} +5 -5
- package/dist/_chunks/{index-Ciae_OgQ.js → index-Bxhu-TNT.js} +6 -6
- package/dist/_chunks/{index-Ciae_OgQ.js.map → index-Bxhu-TNT.js.map} +1 -1
- package/dist/_chunks/{index-CJtLrSxU.js → index-C1HfYOU_.js} +5 -5
- package/dist/_chunks/{index-CNfpGKSw.mjs → index-CDqKPoLF.mjs} +74 -36
- package/dist/_chunks/{index-C5ejmUpN.mjs.map → index-CDqKPoLF.mjs.map} +1 -1
- package/dist/_chunks/{index-BOvKFOKk.js → index-CcwGhk4b.js} +73 -36
- package/dist/_chunks/{index-BAN8PGGJ.js → index-Cw8m9qME.js} +2 -2
- package/dist/_chunks/{index-BAN8PGGJ.js.map → index-Cw8m9qME.js.map} +1 -1
- package/dist/_chunks/{index-DtFIVZxq.mjs → index-DKWn1eh9.mjs} +2 -2
- package/dist/_chunks/{index-DtFIVZxq.mjs.map → index-DKWn1eh9.mjs.map} +1 -1
- package/dist/_chunks/{index-LAGFB7iO.mjs → index-DLfJwkbe.mjs} +1 -1
- package/dist/_chunks/{index-CEt9P4TS.mjs → index-DShP5BtK.mjs} +2 -2
- package/dist/_chunks/{index-CEt9P4TS.mjs.map → index-DShP5BtK.mjs.map} +1 -1
- package/dist/_chunks/{index-BxnHHgGC.js → index-DWcVnOi0.js} +74 -37
- package/dist/_chunks/{index-BxnHHgGC.js.map → index-DWcVnOi0.js.map} +1 -1
- package/dist/_chunks/{index-DTz7wDR7.mjs → index-Dl3NwmwH.mjs} +1 -1
- package/dist/_chunks/{index-CuJP8Fy7.mjs → index-DohcUdej.mjs} +6 -6
- package/dist/_chunks/{index-CuJP8Fy7.mjs.map → index-DohcUdej.mjs.map} +1 -1
- package/dist/_chunks/{index-D4tWVnt1.js → index-Dryo1JuH.js} +2 -2
- package/dist/_chunks/{index-D4tWVnt1.js.map → index-Dryo1JuH.js.map} +1 -1
- package/dist/_chunks/{index-BfgRvDzx.js → index-Dy2LLMda.js} +1 -1
- package/dist/_chunks/{index-C5ejmUpN.mjs → index-Upva9LaE.mjs} +73 -37
- package/dist/_chunks/{index-CJNR2c7_.js → index-xhAxCOze.js} +1 -1
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/pages/Navigation/RouteItem.d.ts +1 -0
- package/dist/admin/src/pages/Navigation/SortableRouteItem.d.ts +1 -1
- package/dist/server/index.js +1 -1
- package/dist/server/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -41,7 +41,7 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
|
41
41
|
);
|
|
42
42
|
});
|
|
43
43
|
};
|
|
44
|
-
const version = "0.
|
|
44
|
+
const version = "0.5.0";
|
|
45
45
|
const keywords = [];
|
|
46
46
|
const type = "commonjs";
|
|
47
47
|
const exports$1 = {
|
|
@@ -4077,7 +4077,7 @@ const index = {
|
|
|
4077
4077
|
defaultMessage: "Routes"
|
|
4078
4078
|
},
|
|
4079
4079
|
Component: async () => {
|
|
4080
|
-
const component = await Promise.resolve().then(() => require("./index-
|
|
4080
|
+
const component = await Promise.resolve().then(() => require("./index-Dy2LLMda.js"));
|
|
4081
4081
|
return { default: component.default };
|
|
4082
4082
|
},
|
|
4083
4083
|
permissions: [
|
|
@@ -4096,7 +4096,7 @@ const index = {
|
|
|
4096
4096
|
defaultMessage: "Navigation"
|
|
4097
4097
|
},
|
|
4098
4098
|
Component: async () => {
|
|
4099
|
-
const component = await Promise.resolve().then(() => require("./index-
|
|
4099
|
+
const component = await Promise.resolve().then(() => require("./index-CcwGhk4b.js"));
|
|
4100
4100
|
return { default: component.default };
|
|
4101
4101
|
},
|
|
4102
4102
|
permissions: [
|
|
@@ -4125,7 +4125,7 @@ const index = {
|
|
|
4125
4125
|
Component: async () => {
|
|
4126
4126
|
return await Promise.resolve().then(() => require(
|
|
4127
4127
|
/* webpackChunkName: "webatlas-settings-page" */
|
|
4128
|
-
"./index-
|
|
4128
|
+
"./index-xhAxCOze.js"
|
|
4129
4129
|
));
|
|
4130
4130
|
},
|
|
4131
4131
|
permissions: [
|
|
@@ -4154,7 +4154,7 @@ const index = {
|
|
|
4154
4154
|
return Promise.all(
|
|
4155
4155
|
locales.map(async (locale) => {
|
|
4156
4156
|
try {
|
|
4157
|
-
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-
|
|
4157
|
+
const { default: data } = await __variableDynamicImportRuntimeHelper(/* @__PURE__ */ Object.assign({ "./translations/de.json": () => Promise.resolve().then(() => require("./de-CL1TIZPg.js")), "./translations/en.json": () => Promise.resolve().then(() => require("./en-Du-Ap60j.js")) }), `./translations/${locale}.json`, 3);
|
|
4158
4158
|
return { data, locale };
|
|
4159
4159
|
} catch {
|
|
4160
4160
|
return { data: {}, locale };
|
|
@@ -5,7 +5,7 @@ import { Dialog, Typography, Button, Modal, Flex, SingleSelect, SingleSelectOpti
|
|
|
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 } from "./index-
|
|
8
|
+
import { u as useApi, g as getTranslation, d as debounce, a as duplicateCheck, t as transformToUrl, U as URLInfo } from "./index-DohcUdej.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 { E as EmptyBox } from "./EmptyBox-BM4IscSk.mjs";
|
|
@@ -10568,11 +10568,10 @@ function getProjection(items, activeId, overId, dragOffset) {
|
|
|
10568
10568
|
const activeItem = items[activeItemIndex];
|
|
10569
10569
|
const newItems = arrayMove(items, activeItemIndex, overItemIndex);
|
|
10570
10570
|
const previousItem = newItems[overItemIndex - 1];
|
|
10571
|
-
const nextItem = newItems[overItemIndex + 1];
|
|
10572
10571
|
const dragDepth = getDragDepth(dragOffset, indentationWidth);
|
|
10573
10572
|
const projectedDepth = activeItem && typeof activeItem.depth === "number" ? activeItem.depth + dragDepth : 0;
|
|
10574
|
-
|
|
10575
|
-
|
|
10573
|
+
let maxDepth = getMaxDepth({ previousItem });
|
|
10574
|
+
let minDepth = 0;
|
|
10576
10575
|
let depth = projectedDepth;
|
|
10577
10576
|
if (projectedDepth >= maxDepth) {
|
|
10578
10577
|
depth = maxDepth;
|
|
@@ -10587,12 +10586,6 @@ function getMaxDepth({ previousItem }) {
|
|
|
10587
10586
|
}
|
|
10588
10587
|
return 0;
|
|
10589
10588
|
}
|
|
10590
|
-
function getMinDepth({ nextItem }) {
|
|
10591
|
-
if (nextItem && typeof nextItem.depth === "number") {
|
|
10592
|
-
return nextItem.depth;
|
|
10593
|
-
}
|
|
10594
|
-
return 0;
|
|
10595
|
-
}
|
|
10596
10589
|
function getDragDepth(offset, indentationWidth2) {
|
|
10597
10590
|
return Math.round(offset / indentationWidth2);
|
|
10598
10591
|
}
|
|
@@ -10608,7 +10601,7 @@ function RouteIcon({ type, color = "neutral800" }) {
|
|
|
10608
10601
|
return /* @__PURE__ */ jsx(Box, { width: "16px", height: "16px" });
|
|
10609
10602
|
}
|
|
10610
10603
|
}
|
|
10611
|
-
const RouteItem = forwardRef(({ item, setParentId, setActionItem, ghost, depth, style, wrapperRef, handleProps }, ref) => {
|
|
10604
|
+
const RouteItem = forwardRef(({ item, setParentId, setActionItem, setNavigationItems, ghost, depth, style, wrapperRef, handleProps }, ref) => {
|
|
10612
10605
|
if (!item || !item.route) return null;
|
|
10613
10606
|
const { setModalType } = useContext(ModalContext);
|
|
10614
10607
|
const { formatMessage } = useIntl();
|
|
@@ -10660,6 +10653,17 @@ const RouteItem = forwardRef(({ item, setParentId, setActionItem, ghost, depth,
|
|
|
10660
10653
|
setActionItem(item);
|
|
10661
10654
|
setModalType("ItemDelete");
|
|
10662
10655
|
};
|
|
10656
|
+
const handleRestore = () => {
|
|
10657
|
+
setNavigationItems(
|
|
10658
|
+
(navItems) => navItems?.map((navItem) => {
|
|
10659
|
+
if (navItem.documentId === item.documentId) {
|
|
10660
|
+
delete navItem.update;
|
|
10661
|
+
delete navItem.deleted;
|
|
10662
|
+
}
|
|
10663
|
+
return navItem;
|
|
10664
|
+
})
|
|
10665
|
+
);
|
|
10666
|
+
};
|
|
10663
10667
|
const elStyle = {
|
|
10664
10668
|
marginLeft: depth !== void 0 ? depth * 48 : 0,
|
|
10665
10669
|
opacity: ghost || item.deleted ? 0.5 : 1,
|
|
@@ -10716,18 +10720,24 @@ const RouteItem = forwardRef(({ item, setParentId, setActionItem, ghost, depth,
|
|
|
10716
10720
|
] }),
|
|
10717
10721
|
/* @__PURE__ */ jsxs(Flex, { direction: "row", gap: 4, children: [
|
|
10718
10722
|
type === "internal" && item.status && /* @__PURE__ */ jsx(Status, { variant: itemStatusOptions[item.status].variant, size: "S", children: /* @__PURE__ */ jsx(Typography, { fontWeight: "bold", children: itemStatusOptions[item.status].status }) }),
|
|
10719
|
-
/* @__PURE__ */ jsxs(SimpleMenu, { label: "
|
|
10720
|
-
/* @__PURE__ */
|
|
10721
|
-
|
|
10722
|
-
|
|
10723
|
-
|
|
10724
|
-
|
|
10725
|
-
|
|
10726
|
-
|
|
10727
|
-
|
|
10728
|
-
|
|
10729
|
-
|
|
10730
|
-
|
|
10723
|
+
/* @__PURE__ */ jsxs(SimpleMenu, { label: "Item actions", tag: IconButton, icon: /* @__PURE__ */ jsx(More, {}), children: [
|
|
10724
|
+
!item.deleted && /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
10725
|
+
/* @__PURE__ */ jsx(MenuItem, { onClick: () => handleEdit(), children: formatMessage({
|
|
10726
|
+
id: getTranslation("edit"),
|
|
10727
|
+
defaultMessage: "Edit"
|
|
10728
|
+
}) }),
|
|
10729
|
+
/* @__PURE__ */ jsx(MenuItem, { onClick: () => handleAddChildren(), children: formatMessage({
|
|
10730
|
+
id: getTranslation("navigation.page.navItem.addChildren"),
|
|
10731
|
+
defaultMessage: "Add children"
|
|
10732
|
+
}) }),
|
|
10733
|
+
/* @__PURE__ */ jsx(MenuItem, { onClick: () => handleDelete(), children: /* @__PURE__ */ jsx(Typography, { textColor: "danger600", children: formatMessage({
|
|
10734
|
+
id: getTranslation("delete"),
|
|
10735
|
+
defaultMessage: "Delete"
|
|
10736
|
+
}) }) })
|
|
10737
|
+
] }),
|
|
10738
|
+
(item.deleted || item.update) && /* @__PURE__ */ jsx(Fragment, { children: /* @__PURE__ */ jsx(MenuItem, { onClick: () => handleRestore(), children: formatMessage({
|
|
10739
|
+
id: getTranslation("restore"),
|
|
10740
|
+
defaultMessage: "Restore"
|
|
10731
10741
|
}) }) })
|
|
10732
10742
|
] })
|
|
10733
10743
|
] })
|
|
@@ -10737,7 +10747,7 @@ const RouteItem = forwardRef(({ item, setParentId, setActionItem, ghost, depth,
|
|
|
10737
10747
|
}
|
|
10738
10748
|
);
|
|
10739
10749
|
});
|
|
10740
|
-
function SortableRouteItem({ item, depth, ...props }) {
|
|
10750
|
+
function SortableRouteItem({ item, depth, setNavigationItems, ...props }) {
|
|
10741
10751
|
if (!item) return null;
|
|
10742
10752
|
const {
|
|
10743
10753
|
isDragging,
|
|
@@ -10756,6 +10766,7 @@ function SortableRouteItem({ item, depth, ...props }) {
|
|
|
10756
10766
|
{
|
|
10757
10767
|
ref: setDraggableNodeRef,
|
|
10758
10768
|
wrapperRef: setDroppableNodeRef,
|
|
10769
|
+
setNavigationItems,
|
|
10759
10770
|
style,
|
|
10760
10771
|
item,
|
|
10761
10772
|
disableInteraction: isSorting,
|
|
@@ -10799,6 +10810,7 @@ function PageWrapper({ navigations, loading = false, children }) {
|
|
|
10799
10810
|
id: getTranslation("navigation.page.selectNavigation"),
|
|
10800
10811
|
defaultMessage: "Select Navigation"
|
|
10801
10812
|
}),
|
|
10813
|
+
selected: true,
|
|
10802
10814
|
onChange: (value) => {
|
|
10803
10815
|
const navItem = navigations.find((nav) => nav.slug === value);
|
|
10804
10816
|
navItem && navigate(`/plugins/webatlas/navigation/${navItem.documentId}`);
|
|
@@ -11800,6 +11812,7 @@ const Navigation = () => {
|
|
|
11800
11812
|
const { getNavigation, updateNavigationItemStructure } = useApi();
|
|
11801
11813
|
const [isSavingNavigation, setIsSavingNavigation] = useState(false);
|
|
11802
11814
|
const [loading, setLoading] = useState(true);
|
|
11815
|
+
const cachedNavigations = useRef(null);
|
|
11803
11816
|
const [projected, setProjected] = useState(null);
|
|
11804
11817
|
const [activeItem, setActiveItem] = useState();
|
|
11805
11818
|
const [activeId, setActiveId] = useState(null);
|
|
@@ -11843,11 +11856,10 @@ const Navigation = () => {
|
|
|
11843
11856
|
}) + ": " + updatedNavigations[0]?.name
|
|
11844
11857
|
});
|
|
11845
11858
|
navigate(`/plugins/webatlas/navigation/${updatedNavigations[0]?.documentId}`);
|
|
11859
|
+
return;
|
|
11846
11860
|
}
|
|
11847
|
-
|
|
11848
|
-
|
|
11849
|
-
setNavigationItems(selectedNav?.items || []);
|
|
11850
|
-
initialNavigationItemsRef.current = cloneDeep$1(selectedNav?.items) || null;
|
|
11861
|
+
cachedNavigations.current = updatedNavigations;
|
|
11862
|
+
switchNavigation(selectedNav, updatedNavigations);
|
|
11851
11863
|
} catch (error) {
|
|
11852
11864
|
console.error("Error fetching navigations: ", error);
|
|
11853
11865
|
toggleNotification({
|
|
@@ -11859,16 +11871,30 @@ const Navigation = () => {
|
|
|
11859
11871
|
});
|
|
11860
11872
|
}
|
|
11861
11873
|
}
|
|
11874
|
+
function switchNavigation(selectedNav, updatedNavigations) {
|
|
11875
|
+
setNavigations(updatedNavigations);
|
|
11876
|
+
setSelectedNavigation(selectedNav);
|
|
11877
|
+
setNavigationItems(selectedNav.items || []);
|
|
11878
|
+
initialNavigationItemsRef.current = cloneDeep$1(selectedNav.items) || null;
|
|
11879
|
+
}
|
|
11862
11880
|
useEffect(() => {
|
|
11863
11881
|
async function fetchNavigations() {
|
|
11864
11882
|
if (!navigationId) {
|
|
11865
|
-
const
|
|
11866
|
-
|
|
11867
|
-
|
|
11868
|
-
|
|
11869
|
-
|
|
11883
|
+
const navs = await getNavigation({ variant: "namesOnly" });
|
|
11884
|
+
if (navs && navs.length > 0) {
|
|
11885
|
+
navigate(`/plugins/webatlas/navigation/${navs[0].documentId}`);
|
|
11886
|
+
}
|
|
11887
|
+
return;
|
|
11888
|
+
}
|
|
11889
|
+
if (cachedNavigations.current) {
|
|
11890
|
+
const selectedNav = cachedNavigations.current.find((nav) => nav.documentId === navigationId);
|
|
11891
|
+
selectedNav && switchNavigation(selectedNav, cachedNavigations.current);
|
|
11870
11892
|
setLoading(false);
|
|
11893
|
+
return;
|
|
11871
11894
|
}
|
|
11895
|
+
setLoading(true);
|
|
11896
|
+
await loadNavigations();
|
|
11897
|
+
setLoading(false);
|
|
11872
11898
|
}
|
|
11873
11899
|
fetchNavigations();
|
|
11874
11900
|
}, [navigationId]);
|
|
@@ -11922,7 +11948,7 @@ const Navigation = () => {
|
|
|
11922
11948
|
})
|
|
11923
11949
|
});
|
|
11924
11950
|
} finally {
|
|
11925
|
-
loadNavigations();
|
|
11951
|
+
await loadNavigations();
|
|
11926
11952
|
setIsSavingNavigation(false);
|
|
11927
11953
|
}
|
|
11928
11954
|
}
|
|
@@ -11951,7 +11977,16 @@ const Navigation = () => {
|
|
|
11951
11977
|
const activeTreeItem = navigationItems[activeIndex];
|
|
11952
11978
|
navigationItems[activeIndex] = { ...activeTreeItem, depth };
|
|
11953
11979
|
const sortedItems = arrayMove(navigationItems, activeIndex, overIndex);
|
|
11954
|
-
|
|
11980
|
+
const fixedItems = [...sortedItems];
|
|
11981
|
+
fixedItems[0].depth = 0;
|
|
11982
|
+
for (let i = 1; i < fixedItems.length; i++) {
|
|
11983
|
+
const prev = fixedItems[i - 1].depth ?? 0;
|
|
11984
|
+
let curr = fixedItems[i].depth ?? 0;
|
|
11985
|
+
if (curr < 0) curr = 0;
|
|
11986
|
+
if (curr > prev + 1) curr = prev + 1;
|
|
11987
|
+
fixedItems[i].depth = curr;
|
|
11988
|
+
}
|
|
11989
|
+
setNavigationItems(fixedItems);
|
|
11955
11990
|
}
|
|
11956
11991
|
}
|
|
11957
11992
|
function resetState() {
|
|
@@ -12010,6 +12045,7 @@ const Navigation = () => {
|
|
|
12010
12045
|
item,
|
|
12011
12046
|
setParentId,
|
|
12012
12047
|
setActionItem,
|
|
12048
|
+
setNavigationItems,
|
|
12013
12049
|
indentationWidth,
|
|
12014
12050
|
depth: item.id === activeId && projected ? projected.depth : item.depth
|
|
12015
12051
|
},
|
|
@@ -12021,7 +12057,8 @@ const Navigation = () => {
|
|
|
12021
12057
|
{
|
|
12022
12058
|
item: activeItem,
|
|
12023
12059
|
setParentId,
|
|
12024
|
-
setActionItem
|
|
12060
|
+
setActionItem,
|
|
12061
|
+
setNavigationItems
|
|
12025
12062
|
}
|
|
12026
12063
|
) : null }),
|
|
12027
12064
|
document.body
|
|
@@ -12160,3 +12197,4 @@ const App = () => {
|
|
|
12160
12197
|
export {
|
|
12161
12198
|
App as default
|
|
12162
12199
|
};
|
|
12200
|
+
//# sourceMappingURL=index-CDqKPoLF.mjs.map
|