@mattisvensson/strapi-plugin-webatlas 0.7.0 → 0.8.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/FullLoader-Cmsf8xS6.js +0 -12
- package/dist/_chunks/FullLoader-Cmsf8xS6.js.map +0 -1
- package/dist/_chunks/FullLoader-CrPED_dY.mjs +0 -1
- package/dist/_chunks/PageWrapper-B6nLPFak.mjs +55 -0
- package/dist/_chunks/PageWrapper-BMzPDWn4.js +0 -0
- package/dist/_chunks/PageWrapper-BMzPDWn4.js.map +0 -0
- package/dist/_chunks/{de-oxxH8hft.mjs → de-C1QgkRoj.mjs} +3 -2
- package/dist/_chunks/de-DYxCPOdb.js +0 -0
- package/dist/_chunks/de-DYxCPOdb.js.map +0 -0
- package/dist/_chunks/{en-DqC5aDzA.mjs → en--8p5hbLP.mjs} +3 -2
- package/dist/_chunks/en-Be-athEA.js +0 -0
- package/dist/_chunks/en-Be-athEA.js.map +0 -0
- package/dist/_chunks/{index-DKdAgBbF.mjs → index-7rox7tGX.mjs} +94 -123
- 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-BdlPAWj6.mjs → index-DGSjLYNl.mjs} +1 -1
- 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
- package/dist/_chunks/{index-CZ5qsGXH.mjs → index-DSPh-fHL.mjs} +39 -12
- package/dist/_chunks/index-VcxUbdMO.mjs +123 -0
- package/dist/_chunks/{index-B6MYtu3A.mjs → index-Z3qq1ab8.mjs} +39 -39
- package/dist/admin/index.js +0 -5
- package/dist/admin/index.js.map +0 -1
- package/dist/admin/index.mjs +1 -2
- package/dist/admin/src/hooks/usePluginConfig.d.ts +1 -1
- package/dist/admin/src/pages/Settings/{ContentTypeAccordion.d.ts → General/ContentTypeAccordion.d.ts} +1 -1
- package/dist/admin/src/pages/Settings/Navigation/index.d.ts +2 -0
- package/dist/admin/src/pages/Settings/PageWrapper.d.ts +3 -4
- package/dist/admin/src/utils/dnd.d.ts +1 -1
- package/dist/server/index.js +22 -13
- package/dist/server/index.mjs +22 -13
- package/dist/server/src/index.d.ts +1 -1
- package/dist/server/src/services/admin.d.ts +2 -2
- package/dist/server/src/services/index.d.ts +1 -1
- package/package.json +1 -1
- package/dist/_chunks/FullLoader-CrPED_dY.mjs.map +0 -1
- package/dist/_chunks/de-BZc1BkzH.js +0 -121
- package/dist/_chunks/de-BZc1BkzH.js.map +0 -1
- package/dist/_chunks/de-oxxH8hft.mjs.map +0 -1
- package/dist/_chunks/en-Deg4n_IM.js +0 -121
- package/dist/_chunks/en-Deg4n_IM.js.map +0 -1
- package/dist/_chunks/en-DqC5aDzA.mjs.map +0 -1
- package/dist/_chunks/index-B6MYtu3A.mjs.map +0 -1
- package/dist/_chunks/index-BEgpEtto.mjs +0 -247
- package/dist/_chunks/index-BEgpEtto.mjs.map +0 -1
- package/dist/_chunks/index-BOEv4jIJ.js +0 -4177
- package/dist/_chunks/index-BOEv4jIJ.js.map +0 -1
- package/dist/_chunks/index-BPhRQoGD.mjs +0 -282
- package/dist/_chunks/index-BPhRQoGD.mjs.map +0 -1
- package/dist/_chunks/index-Bg96TqDm.js +0 -247
- package/dist/_chunks/index-Bg96TqDm.js.map +0 -1
- package/dist/_chunks/index-BgzZLDPv.mjs +0 -12229
- package/dist/_chunks/index-BoVX1KF8.js +0 -246
- package/dist/_chunks/index-ByU38WNH.js +0 -4176
- package/dist/_chunks/index-CZ5qsGXH.mjs.map +0 -1
- package/dist/_chunks/index-D3xDvB4d.mjs +0 -4160
- package/dist/_chunks/index-D_QCV5Z5.js +0 -282
- package/dist/_chunks/index-D_QCV5Z5.js.map +0 -1
- package/dist/_chunks/index-UJ0LQ3Y3.js +0 -281
- package/dist/_chunks/index-dSU20yZ4.js +0 -12229
- package/dist/_chunks/index-mObQ5NXj.js +0 -12230
- package/dist/_chunks/index-mObQ5NXj.js.map +0 -1
- package/dist/admin/index.mjs.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/server/index.mjs.map +0 -1
- /package/dist/admin/src/pages/Settings/{index.d.ts → General/index.d.ts} +0 -0
|
@@ -1,246 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
const jsxRuntime = require("react/jsx-runtime");
|
|
4
|
-
const React = require("react");
|
|
5
|
-
const designSystem = require("@strapi/design-system");
|
|
6
|
-
const icons = require("@strapi/icons");
|
|
7
|
-
const index = require("./index-ByU38WNH.js");
|
|
8
|
-
const admin = require("@strapi/strapi/admin");
|
|
9
|
-
require("@strapi/icons/symbols");
|
|
10
|
-
const FullLoader = require("./FullLoader-Cmsf8xS6.js");
|
|
11
|
-
const reactIntl = require("react-intl");
|
|
12
|
-
const reactRouterDom = require("react-router-dom");
|
|
13
|
-
function getRouteType(route) {
|
|
14
|
-
if (route.wrapper) {
|
|
15
|
-
return "wrapper";
|
|
16
|
-
} else if (!route.internal) {
|
|
17
|
-
return "external";
|
|
18
|
-
} else {
|
|
19
|
-
return "internal";
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
function TableHeader({
|
|
23
|
-
sortKey,
|
|
24
|
-
handleSort
|
|
25
|
-
}) {
|
|
26
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
27
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
28
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Th, { onClick: () => handleSort("title"), cursor: "pointer", children: [
|
|
29
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
30
|
-
id: index.getTranslation("title"),
|
|
31
|
-
defaultMessage: "Title"
|
|
32
|
-
}) }),
|
|
33
|
-
sortKey === "title" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDown, {})
|
|
34
|
-
] }),
|
|
35
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Th, { onClick: () => handleSort("fullPath"), cursor: "pointer", children: [
|
|
36
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
37
|
-
id: index.getTranslation("route"),
|
|
38
|
-
defaultMessage: "Route"
|
|
39
|
-
}) }),
|
|
40
|
-
sortKey === "fullPath" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDown, {})
|
|
41
|
-
] }),
|
|
42
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Th, { onClick: () => handleSort("type"), cursor: "pointer", children: [
|
|
43
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: formatMessage({
|
|
44
|
-
id: index.getTranslation("routes.page.column.type"),
|
|
45
|
-
defaultMessage: "Type"
|
|
46
|
-
}) }),
|
|
47
|
-
sortKey === "type" && /* @__PURE__ */ jsxRuntime.jsx(icons.ChevronDown, {})
|
|
48
|
-
] }),
|
|
49
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: formatMessage({
|
|
50
|
-
id: index.getTranslation("actions"),
|
|
51
|
-
defaultMessage: "Actions"
|
|
52
|
-
}) }) })
|
|
53
|
-
] }) });
|
|
54
|
-
}
|
|
55
|
-
function TableRow({ route }) {
|
|
56
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
57
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
|
|
58
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.title }) }),
|
|
59
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: route.fullPath }) }),
|
|
60
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: formatMessage({
|
|
61
|
-
id: index.getTranslation(`route.type.${getRouteType(route)}`),
|
|
62
|
-
defaultMessage: "-"
|
|
63
|
-
}) }) }),
|
|
64
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, justifyContent: "end", children: route.internal && /* @__PURE__ */ jsxRuntime.jsx(
|
|
65
|
-
designSystem.LinkButton,
|
|
66
|
-
{
|
|
67
|
-
variant: "secondary",
|
|
68
|
-
startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Pencil, {}),
|
|
69
|
-
href: `/admin/content-manager/collection-types/${route.relatedContentType}/${route.relatedDocumentId}`,
|
|
70
|
-
children: formatMessage({
|
|
71
|
-
id: index.getTranslation("edit"),
|
|
72
|
-
defaultMessage: "Edit"
|
|
73
|
-
})
|
|
74
|
-
}
|
|
75
|
-
) }) })
|
|
76
|
-
] });
|
|
77
|
-
}
|
|
78
|
-
function PageWrapper({ children }) {
|
|
79
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
80
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
|
|
81
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
82
|
-
admin.Layouts.Header,
|
|
83
|
-
{
|
|
84
|
-
title: formatMessage({
|
|
85
|
-
id: index.getTranslation("routes.page.title"),
|
|
86
|
-
defaultMessage: "Routes"
|
|
87
|
-
}),
|
|
88
|
-
subtitle: formatMessage({
|
|
89
|
-
id: index.getTranslation("routes.page.subtitle"),
|
|
90
|
-
defaultMessage: "Overview of all existing routes"
|
|
91
|
-
})
|
|
92
|
-
}
|
|
93
|
-
),
|
|
94
|
-
/* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children }) })
|
|
95
|
-
] });
|
|
96
|
-
}
|
|
97
|
-
function compareBy(field, direction) {
|
|
98
|
-
if (!field) {
|
|
99
|
-
return () => 0;
|
|
100
|
-
}
|
|
101
|
-
if (field === "type") {
|
|
102
|
-
return (a, b) => {
|
|
103
|
-
const typeA = a.internal ? "internal" : "external";
|
|
104
|
-
const typeB = b.internal ? "internal" : "external";
|
|
105
|
-
return direction === "asc" ? typeA.localeCompare(typeB) : typeB.localeCompare(typeA);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
return (a, b) => {
|
|
109
|
-
const aValue = a[field];
|
|
110
|
-
const bValue = b[field];
|
|
111
|
-
if (typeof aValue === "string" && typeof bValue === "string") {
|
|
112
|
-
return direction === "asc" ? aValue.localeCompare(bValue) : bValue.localeCompare(aValue);
|
|
113
|
-
}
|
|
114
|
-
return 0;
|
|
115
|
-
};
|
|
116
|
-
}
|
|
117
|
-
function SearchInput({
|
|
118
|
-
searchQuery,
|
|
119
|
-
handleSearchChange
|
|
120
|
-
}) {
|
|
121
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
122
|
-
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Root, { style: { marginBottom: "16px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 12, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { width: "100%", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
123
|
-
designSystem.Field.Input,
|
|
124
|
-
{
|
|
125
|
-
name: "search",
|
|
126
|
-
placeholder: formatMessage({
|
|
127
|
-
id: index.getTranslation("routes.page.searchPlaceholder"),
|
|
128
|
-
defaultMessage: "Search routes"
|
|
129
|
-
}),
|
|
130
|
-
value: searchQuery,
|
|
131
|
-
onChange: handleSearchChange,
|
|
132
|
-
endAction: searchQuery ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
133
|
-
"button",
|
|
134
|
-
{
|
|
135
|
-
type: "button",
|
|
136
|
-
onClick: () => handleSearchChange({ target: { value: "" } }),
|
|
137
|
-
style: { color: "inherit", background: "none", border: "none", cursor: "pointer" },
|
|
138
|
-
"aria-label": "Clear search",
|
|
139
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {})
|
|
140
|
-
}
|
|
141
|
-
) : null
|
|
142
|
-
}
|
|
143
|
-
) }) }) }) });
|
|
144
|
-
}
|
|
145
|
-
function RouteTable({
|
|
146
|
-
routes,
|
|
147
|
-
sortKey,
|
|
148
|
-
handleSort
|
|
149
|
-
}) {
|
|
150
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
151
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 4, rowCount: routes.length, children: [
|
|
152
|
-
/* @__PURE__ */ jsxRuntime.jsx(TableHeader, { sortKey, handleSort }),
|
|
153
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: routes.length > 0 ? routes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(TableRow, { route }, route.id)) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
154
|
-
designSystem.EmptyStateLayout,
|
|
155
|
-
{
|
|
156
|
-
content: formatMessage({
|
|
157
|
-
id: index.getTranslation("routes.page.emptyRoutes"),
|
|
158
|
-
defaultMessage: "No routes found"
|
|
159
|
-
}),
|
|
160
|
-
shadow: false
|
|
161
|
-
}
|
|
162
|
-
) }) }) })
|
|
163
|
-
] });
|
|
164
|
-
}
|
|
165
|
-
const Routes = () => {
|
|
166
|
-
const { getRoutes } = index.useApi();
|
|
167
|
-
const { formatMessage } = reactIntl.useIntl();
|
|
168
|
-
const { toggleNotification } = admin.useNotification();
|
|
169
|
-
const [allRoutes, setAllRoutes] = React.useState([]);
|
|
170
|
-
const [routes, setRoutes] = React.useState([]);
|
|
171
|
-
const [loading, setLoading] = React.useState(true);
|
|
172
|
-
const [searchParams, setSearchParams] = reactRouterDom.useSearchParams();
|
|
173
|
-
const initialQuery = searchParams.get("search") || "";
|
|
174
|
-
const [searchQuery, setSearchQuery] = React.useState(initialQuery);
|
|
175
|
-
const [sortKey, setSortKey] = React.useState(void 0);
|
|
176
|
-
const [sortDirection, setSortDirection] = React.useState("asc");
|
|
177
|
-
React.useEffect(() => {
|
|
178
|
-
const query = searchQuery.toLowerCase();
|
|
179
|
-
setRoutes(
|
|
180
|
-
allRoutes.filter(
|
|
181
|
-
(route) => JSON.stringify(route.id).toLowerCase().includes(query) || route.title.toLowerCase().includes(query) || route.fullPath.toLowerCase().includes(query) || route.relatedDocumentId.toLowerCase().includes(query) || route.relatedContentType.toLowerCase().includes(query)
|
|
182
|
-
)
|
|
183
|
-
);
|
|
184
|
-
}, [searchQuery, allRoutes]);
|
|
185
|
-
const debouncedSetSearchParams = React.useMemo(
|
|
186
|
-
() => index.debounce((value) => {
|
|
187
|
-
value ? setSearchParams({ search: value }) : setSearchParams({});
|
|
188
|
-
}, 300),
|
|
189
|
-
[setSearchParams]
|
|
190
|
-
);
|
|
191
|
-
const handleSearchChange = (e) => {
|
|
192
|
-
const value = e.target.value;
|
|
193
|
-
setSearchQuery(value);
|
|
194
|
-
debouncedSetSearchParams(value);
|
|
195
|
-
};
|
|
196
|
-
React.useEffect(() => {
|
|
197
|
-
async function fetchRoutes() {
|
|
198
|
-
try {
|
|
199
|
-
const data = await getRoutes();
|
|
200
|
-
setAllRoutes(data);
|
|
201
|
-
setRoutes(data);
|
|
202
|
-
} catch (err) {
|
|
203
|
-
console.error("Failed to fetch routes:", err);
|
|
204
|
-
toggleNotification({
|
|
205
|
-
type: "danger",
|
|
206
|
-
message: formatMessage({
|
|
207
|
-
id: index.getTranslation("notification.routes.fetchFailed"),
|
|
208
|
-
defaultMessage: "Failed to fetch routes"
|
|
209
|
-
})
|
|
210
|
-
});
|
|
211
|
-
} finally {
|
|
212
|
-
setLoading(false);
|
|
213
|
-
}
|
|
214
|
-
}
|
|
215
|
-
fetchRoutes();
|
|
216
|
-
}, []);
|
|
217
|
-
const handleSort = (key) => {
|
|
218
|
-
setSortDirection((prev) => prev === "asc" ? "desc" : "asc");
|
|
219
|
-
setSortKey(key);
|
|
220
|
-
};
|
|
221
|
-
React.useEffect(() => {
|
|
222
|
-
const sortedRoutes = sortKey ? [...routes].sort(compareBy(sortKey, sortDirection)) : routes;
|
|
223
|
-
setRoutes(sortedRoutes);
|
|
224
|
-
}, [sortKey, sortDirection]);
|
|
225
|
-
if (loading) {
|
|
226
|
-
return /* @__PURE__ */ jsxRuntime.jsx(PageWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(FullLoader.FullLoader, {}) });
|
|
227
|
-
}
|
|
228
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(PageWrapper, { children: [
|
|
229
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
230
|
-
SearchInput,
|
|
231
|
-
{
|
|
232
|
-
handleSearchChange,
|
|
233
|
-
searchQuery
|
|
234
|
-
}
|
|
235
|
-
),
|
|
236
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
237
|
-
RouteTable,
|
|
238
|
-
{
|
|
239
|
-
routes,
|
|
240
|
-
sortKey,
|
|
241
|
-
handleSort
|
|
242
|
-
}
|
|
243
|
-
)
|
|
244
|
-
] });
|
|
245
|
-
};
|
|
246
|
-
exports.default = Routes;
|