@mattisvensson/strapi-plugin-webatlas 0.2.6 → 0.3.1
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/README.md +2 -3
- package/dist/_chunks/de-4tL_cJTC.js +104 -0
- package/dist/_chunks/de-C8PE3n3B.mjs +104 -0
- package/dist/_chunks/en-Bg4z3fR7.js +104 -0
- package/dist/_chunks/en-CR1YZvJo.mjs +104 -0
- package/dist/_chunks/{index-D4IHmUrH.js → index-BAqGJ3TM.js} +298 -91
- package/dist/_chunks/{index-BMQSVj43.mjs → index-BBL_eQ0G.mjs} +167 -78
- package/dist/_chunks/{index-B_RPO9ty.mjs → index-BOq-WidK.mjs} +57 -17
- package/dist/_chunks/{index-DIyVy-8D.js → index-C4ou6MTp.js} +57 -17
- package/dist/_chunks/{index-DrlYDm6a.js → index-CKoxbSC0.js} +166 -77
- package/dist/_chunks/{index-uoH_HJQr.mjs → index-CwHhwtOU.mjs} +296 -89
- package/dist/_chunks/index-DZmhgSeq.mjs +92 -0
- package/dist/_chunks/{index-BvXbuF1E.js → index-DsTyLL2l.js} +56 -8
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/src/components/URLInfo.d.ts +2 -1
- package/dist/admin/src/components/modals/NavModal.d.ts +2 -1
- package/dist/admin/src/utils/getRouteType.d.ts +2 -0
- package/dist/admin/src/utils/index.d.ts +2 -1
- package/dist/server/index.js +15 -2
- package/dist/server/index.js.map +1 -1
- package/dist/server/index.mjs +15 -2
- package/dist/server/index.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/_chunks/en-B4KWt_jN.js +0 -4
- package/dist/_chunks/en-Byx4XI2L.mjs +0 -4
- package/dist/_chunks/index-BMlQpLGa.mjs +0 -44
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { jsxs, Fragment, jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { Layouts } from "@strapi/strapi/admin";
|
|
4
|
+
import { Table, Thead, Tr, Th, Typography, VisuallyHidden, Tbody, Td, Flex, LinkButton } from "@strapi/design-system";
|
|
5
|
+
import { Pencil } from "@strapi/icons";
|
|
6
|
+
import { u as useApi, g as getTranslation } from "./index-BBL_eQ0G.mjs";
|
|
7
|
+
import { C as Center, E as EmptyBox } from "./EmptyBox-7D4LrvdH.mjs";
|
|
8
|
+
import { useIntl } from "react-intl";
|
|
9
|
+
function getRouteType(route) {
|
|
10
|
+
if (route.wrapper) {
|
|
11
|
+
return "wrapper";
|
|
12
|
+
} else if (!route.internal) {
|
|
13
|
+
return "external";
|
|
14
|
+
} else {
|
|
15
|
+
return "internal";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
const Routes = () => {
|
|
19
|
+
const { getRoutes } = useApi();
|
|
20
|
+
const { formatMessage } = useIntl();
|
|
21
|
+
const [routes, setRoutes] = useState([]);
|
|
22
|
+
useEffect(() => {
|
|
23
|
+
async function fetchRoutes() {
|
|
24
|
+
const data = await getRoutes();
|
|
25
|
+
setRoutes(data);
|
|
26
|
+
}
|
|
27
|
+
fetchRoutes();
|
|
28
|
+
}, []);
|
|
29
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
30
|
+
/* @__PURE__ */ jsx(
|
|
31
|
+
Layouts.Header,
|
|
32
|
+
{
|
|
33
|
+
title: formatMessage({
|
|
34
|
+
id: getTranslation("routes.page.title"),
|
|
35
|
+
defaultMessage: "Routes"
|
|
36
|
+
}),
|
|
37
|
+
subtitle: formatMessage({
|
|
38
|
+
id: getTranslation("routes.page.subtitle"),
|
|
39
|
+
defaultMessage: "Overview of all existing routes"
|
|
40
|
+
})
|
|
41
|
+
}
|
|
42
|
+
),
|
|
43
|
+
/* @__PURE__ */ jsx(Layouts.Content, { children: routes.length === 0 ? /* @__PURE__ */ jsx(Center, { height: 400, children: /* @__PURE__ */ jsx(EmptyBox, { msg: formatMessage({
|
|
44
|
+
id: getTranslation("routes.page.emptyRoutes"),
|
|
45
|
+
defaultMessage: "No routes found"
|
|
46
|
+
}) }) }) : /* @__PURE__ */ jsxs(Table, { colCount: 4, rowCount: routes.length, children: [
|
|
47
|
+
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
48
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: "ID" }) }),
|
|
49
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
|
|
50
|
+
id: getTranslation("title"),
|
|
51
|
+
defaultMessage: "Title"
|
|
52
|
+
}) }) }),
|
|
53
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
|
|
54
|
+
id: getTranslation("route"),
|
|
55
|
+
defaultMessage: "Route"
|
|
56
|
+
}) }) }),
|
|
57
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", children: formatMessage({
|
|
58
|
+
id: getTranslation("routes.page.column.type"),
|
|
59
|
+
defaultMessage: "Type"
|
|
60
|
+
}) }) }),
|
|
61
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(VisuallyHidden, { children: formatMessage({
|
|
62
|
+
id: getTranslation("actions"),
|
|
63
|
+
defaultMessage: "Actions"
|
|
64
|
+
}) }) })
|
|
65
|
+
] }) }),
|
|
66
|
+
/* @__PURE__ */ jsx(Tbody, { children: routes.map((route) => /* @__PURE__ */ jsxs(Tr, { children: [
|
|
67
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.id }) }),
|
|
68
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.title }) }),
|
|
69
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: route.fullPath }) }),
|
|
70
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { textColor: "neutral800", children: formatMessage({
|
|
71
|
+
id: getTranslation(`route.type.${getRouteType(route)}`),
|
|
72
|
+
defaultMessage: "-"
|
|
73
|
+
}) }) }),
|
|
74
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { gap: 2, justifyContent: "end", children: route.internal && /* @__PURE__ */ jsx(
|
|
75
|
+
LinkButton,
|
|
76
|
+
{
|
|
77
|
+
variant: "secondary",
|
|
78
|
+
startIcon: /* @__PURE__ */ jsx(Pencil, {}),
|
|
79
|
+
href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
|
|
80
|
+
children: formatMessage({
|
|
81
|
+
id: getTranslation("edit"),
|
|
82
|
+
defaultMessage: "Edit"
|
|
83
|
+
})
|
|
84
|
+
}
|
|
85
|
+
) }) })
|
|
86
|
+
] }, route.id)) })
|
|
87
|
+
] }) })
|
|
88
|
+
] });
|
|
89
|
+
};
|
|
90
|
+
export {
|
|
91
|
+
Routes as default
|
|
92
|
+
};
|
|
@@ -5,10 +5,21 @@ const React = require("react");
|
|
|
5
5
|
const admin = require("@strapi/strapi/admin");
|
|
6
6
|
const designSystem = require("@strapi/design-system");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
|
-
const index = require("./index-
|
|
8
|
+
const index = require("./index-CKoxbSC0.js");
|
|
9
9
|
const EmptyBox = require("./EmptyBox-DT6D5gcf.js");
|
|
10
|
+
const reactIntl = require("react-intl");
|
|
11
|
+
function getRouteType(route) {
|
|
12
|
+
if (route.wrapper) {
|
|
13
|
+
return "wrapper";
|
|
14
|
+
} else if (!route.internal) {
|
|
15
|
+
return "external";
|
|
16
|
+
} else {
|
|
17
|
+
return "internal";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
10
20
|
const Routes = () => {
|
|
11
21
|
const { getRoutes } = index.useApi();
|
|
22
|
+
const { formatMessage } = reactIntl.useIntl();
|
|
12
23
|
const [routes, setRoutes] = React.useState([]);
|
|
13
24
|
React.useEffect(() => {
|
|
14
25
|
async function fetchRoutes() {
|
|
@@ -21,22 +32,59 @@ const Routes = () => {
|
|
|
21
32
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
22
33
|
admin.Layouts.Header,
|
|
23
34
|
{
|
|
24
|
-
title:
|
|
25
|
-
|
|
35
|
+
title: formatMessage({
|
|
36
|
+
id: index.getTranslation("routes.page.title"),
|
|
37
|
+
defaultMessage: "Routes"
|
|
38
|
+
}),
|
|
39
|
+
subtitle: formatMessage({
|
|
40
|
+
id: index.getTranslation("routes.page.subtitle"),
|
|
41
|
+
defaultMessage: "Overview of all existing routes"
|
|
42
|
+
})
|
|
26
43
|
}
|
|
27
44
|
),
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: routes.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(EmptyBox.Center, { height: 400, children: /* @__PURE__ */ jsxRuntime.jsx(EmptyBox.EmptyBox, { msg:
|
|
45
|
+
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: routes.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(EmptyBox.Center, { height: 400, children: /* @__PURE__ */ jsxRuntime.jsx(EmptyBox.EmptyBox, { msg: formatMessage({
|
|
46
|
+
id: index.getTranslation("routes.page.emptyRoutes"),
|
|
47
|
+
defaultMessage: "No routes found"
|
|
48
|
+
}) }) }) : /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 4, rowCount: routes.length, children: [
|
|
29
49
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
30
50
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: "ID" }) }),
|
|
31
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children:
|
|
32
|
-
|
|
33
|
-
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
52
|
+
id: index.getTranslation("title"),
|
|
53
|
+
defaultMessage: "Title"
|
|
54
|
+
}) }) }),
|
|
55
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
56
|
+
id: index.getTranslation("route"),
|
|
57
|
+
defaultMessage: "Route"
|
|
58
|
+
}) }) }),
|
|
59
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
60
|
+
id: index.getTranslation("routes.page.column.type"),
|
|
61
|
+
defaultMessage: "Type"
|
|
62
|
+
}) }) }),
|
|
63
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: formatMessage({
|
|
64
|
+
id: index.getTranslation("actions"),
|
|
65
|
+
defaultMessage: "Actions"
|
|
66
|
+
}) }) })
|
|
34
67
|
] }) }),
|
|
35
68
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: routes.map((route) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
36
69
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.id }) }),
|
|
37
70
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.title }) }),
|
|
38
71
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.fullPath }) }),
|
|
39
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.
|
|
72
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatMessage({
|
|
73
|
+
id: index.getTranslation(`route.type.${getRouteType(route)}`),
|
|
74
|
+
defaultMessage: "-"
|
|
75
|
+
}) }) }),
|
|
76
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, justifyContent: "end", children: route.internal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
77
|
+
designSystem.LinkButton,
|
|
78
|
+
{
|
|
79
|
+
variant: "secondary",
|
|
80
|
+
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {}),
|
|
81
|
+
href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
|
|
82
|
+
children: formatMessage({
|
|
83
|
+
id: index.getTranslation("edit"),
|
|
84
|
+
defaultMessage: "Edit"
|
|
85
|
+
})
|
|
86
|
+
}
|
|
87
|
+
) }) })
|
|
40
88
|
] }, route.id)) })
|
|
41
89
|
] }) })
|
|
42
90
|
] });
|
package/dist/admin/index.js
CHANGED
package/dist/admin/index.mjs
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
interface URLInfoProps {
|
|
2
2
|
validationState: 'initial' | 'checking' | 'done';
|
|
3
3
|
replacement: string;
|
|
4
|
+
setUrlStatus?: (isValid: 'valid' | 'invalid') => void;
|
|
4
5
|
}
|
|
5
|
-
export default function URLInfo({ validationState, replacement }: URLInfoProps): import("react/jsx-runtime").JSX.Element
|
|
6
|
+
export default function URLInfo({ validationState, replacement, setUrlStatus }: URLInfoProps): import("react/jsx-runtime").JSX.Element;
|
|
6
7
|
export {};
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="react" />
|
|
2
|
-
export default function NavModal({ triggerText, triggerVariant, confirmText, closeText, titleText, loadingText, children, onConfirm, loading, modalToOpen, footer, currentModalType, }: {
|
|
2
|
+
export default function NavModal({ triggerText, triggerVariant, confirmText, closeText, titleText, loadingText, children, onConfirm, loading, modalToOpen, footer, currentModalType, currentModalMode, }: {
|
|
3
3
|
triggerText?: string;
|
|
4
4
|
triggerVariant?: "primary" | "secondary";
|
|
5
5
|
confirmText: string;
|
|
@@ -12,4 +12,5 @@ export default function NavModal({ triggerText, triggerVariant, confirmText, clo
|
|
|
12
12
|
modalToOpen?: string;
|
|
13
13
|
footer?: React.ReactNode;
|
|
14
14
|
currentModalType?: 'ItemCreate' | 'WrapperCreate' | 'ExternalCreate' | null;
|
|
15
|
+
currentModalMode?: 'create' | 'edit';
|
|
15
16
|
}): import("react/jsx-runtime").JSX.Element;
|
|
@@ -3,4 +3,5 @@ import duplicateCheck from "./duplicateCheck";
|
|
|
3
3
|
import { isNestedNavigation, isNestedNavItem } from "./typeChecks";
|
|
4
4
|
import getTranslation from "./getTranslation";
|
|
5
5
|
import countChildren from "./countChildren";
|
|
6
|
-
|
|
6
|
+
import getRouteType from "./getRouteType";
|
|
7
|
+
export { debounce, duplicateCheck, isNestedNavigation, isNestedNavItem, getTranslation, countChildren, getRouteType };
|
package/dist/server/index.js
CHANGED
|
@@ -20,7 +20,7 @@ function transformToUrl(input) {
|
|
|
20
20
|
input = input.replace(/-+/g, "-");
|
|
21
21
|
return input;
|
|
22
22
|
}
|
|
23
|
-
const version = "0.
|
|
23
|
+
const version = "0.3.1";
|
|
24
24
|
const keywords = [];
|
|
25
25
|
const type = "commonjs";
|
|
26
26
|
const exports$1 = {
|
|
@@ -239,9 +239,11 @@ const bootstrap = async ({ strapi: strapi2 }) => {
|
|
|
239
239
|
});
|
|
240
240
|
strapi2.db?.lifecycles.subscribe({
|
|
241
241
|
models: config2.selectedContentTypes.map((type2) => type2.uid),
|
|
242
|
-
async beforeCreate() {
|
|
242
|
+
async beforeCreate(event) {
|
|
243
243
|
const validContentTypes = config2.selectedContentTypes.filter((type2) => strapi2.contentTypes[type2.uid]);
|
|
244
244
|
await pluginStore.set({ key: "config", value: { selectedContentTypes: validContentTypes } });
|
|
245
|
+
if (!event.params.data.webatlas_path) return;
|
|
246
|
+
event.params.data.webatlas_path = transformToUrl(event.params.data.webatlas_path);
|
|
245
247
|
},
|
|
246
248
|
async afterCreate(event) {
|
|
247
249
|
const ctSettings = config2.selectedContentTypes.find((type2) => type2.uid === event.model.uid);
|
|
@@ -1482,6 +1484,7 @@ const sortItems = (items) => {
|
|
|
1482
1484
|
function extractRouteAndItems(items) {
|
|
1483
1485
|
return items.map((item) => {
|
|
1484
1486
|
const route2 = { ...item.route };
|
|
1487
|
+
if (!route2) return null;
|
|
1485
1488
|
if (item.depth) {
|
|
1486
1489
|
route2.depth = item.depth;
|
|
1487
1490
|
}
|
|
@@ -5666,6 +5669,16 @@ const admin = ({ strapi: strapi2 }) => ({
|
|
|
5666
5669
|
},
|
|
5667
5670
|
async deleteNavigation(documentId) {
|
|
5668
5671
|
try {
|
|
5672
|
+
const navigation2 = await strapi2.documents(waNavigation).findOne({
|
|
5673
|
+
documentId,
|
|
5674
|
+
populate: ["items"]
|
|
5675
|
+
});
|
|
5676
|
+
if (!navigation2) throw new Error("Navigation not found");
|
|
5677
|
+
for (const item of navigation2.items) {
|
|
5678
|
+
await strapi2.documents(waNavItem).delete({
|
|
5679
|
+
documentId: item.documentId
|
|
5680
|
+
});
|
|
5681
|
+
}
|
|
5669
5682
|
return await strapi2.documents(waNavigation).delete({
|
|
5670
5683
|
documentId
|
|
5671
5684
|
});
|