@mattisvensson/strapi-plugin-webatlas 0.11.0 → 0.11.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/README.md +14 -8
- package/dist/admin/{FullLoader-CrPED_dY.mjs → FullLoader-Btjb2W2p.mjs} +4 -2
- package/dist/admin/{FullLoader-Cmsf8xS6.js → FullLoader-Da2n70bJ.js} +4 -2
- package/dist/admin/{SettingTitle-BjE_2u6R.js → SettingTitle-B0quw3f8.js} +5 -3
- package/dist/admin/{SettingTitle-B1IaU3qs.mjs → SettingTitle-HMfQOJnK.mjs} +5 -3
- package/dist/admin/de-B5pRvs13.mjs +0 -1
- package/dist/admin/de-CqU1FU8C.js +0 -1
- package/dist/admin/en-BE-zzIv8.mjs +0 -1
- package/dist/admin/en-C7I90FwV.js +0 -1
- package/dist/admin/{index-Cf9j0bn2.mjs → index-9_HhKDUC.mjs} +31 -59
- package/dist/admin/{index-DCYCtKrj.mjs → index-B79ELMEC.mjs} +220 -215
- package/dist/admin/{index-JLpXBQVL.js → index-BEVoxEAm.js} +31 -59
- package/dist/admin/index-Bmg-ERct.mjs +243 -0
- package/dist/admin/{index-AVI3QJ0R.js → index-C8YjuuOx.js} +496 -354
- package/dist/admin/{index-Yq-QR8t0.js → index-Cx_mktdk.js} +220 -215
- package/dist/admin/{index-BbnlyBrZ.mjs → index-Cz_k_jjp.mjs} +41 -31
- package/dist/admin/{index-D8bG0YFB.js → index-D2hB1vTw.js} +41 -31
- package/dist/admin/index-YdWxpvOH.js +243 -0
- package/dist/admin/{index-BIEUXWe7.mjs → index-oEJT_mvw.mjs} +496 -354
- package/dist/admin/index.js +1 -2
- package/dist/admin/index.mjs +1 -2
- package/dist/admin/src/index.d.ts +12 -0
- package/dist/server/index.js +174 -145
- package/dist/server/index.mjs +174 -145
- package/dist/server/src/index.d.ts +305 -0
- package/package.json +108 -108
- package/dist/admin/FullLoader-Cmsf8xS6.js.map +0 -1
- package/dist/admin/FullLoader-CrPED_dY.mjs.map +0 -1
- package/dist/admin/SettingTitle-B1IaU3qs.mjs.map +0 -1
- package/dist/admin/SettingTitle-BjE_2u6R.js.map +0 -1
- package/dist/admin/de-B5pRvs13.mjs.map +0 -1
- package/dist/admin/de-CqU1FU8C.js.map +0 -1
- package/dist/admin/en-BE-zzIv8.mjs.map +0 -1
- package/dist/admin/en-C7I90FwV.js.map +0 -1
- package/dist/admin/index-AVI3QJ0R.js.map +0 -1
- package/dist/admin/index-B90eSO4a.js +0 -219
- package/dist/admin/index-B90eSO4a.js.map +0 -1
- package/dist/admin/index-BIEUXWe7.mjs.map +0 -1
- package/dist/admin/index-BbnlyBrZ.mjs.map +0 -1
- package/dist/admin/index-Cf9j0bn2.mjs.map +0 -1
- package/dist/admin/index-D8bG0YFB.js.map +0 -1
- package/dist/admin/index-DCYCtKrj.mjs.map +0 -1
- package/dist/admin/index-JLpXBQVL.js.map +0 -1
- package/dist/admin/index-Y_PYIiRA.mjs +0 -219
- package/dist/admin/index-Y_PYIiRA.mjs.map +0 -1
- package/dist/admin/index-Yq-QR8t0.js.map +0 -1
- package/dist/admin/index.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
|
@@ -43,10 +43,10 @@ const __variableDynamicImportRuntimeHelper = (glob, path, segs) => {
|
|
|
43
43
|
};
|
|
44
44
|
function transformToUrl(input, replaceSlash = true) {
|
|
45
45
|
const specialCharMap = {
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
46
|
+
ü: "ue",
|
|
47
|
+
ä: "ae",
|
|
48
|
+
ö: "oe",
|
|
49
|
+
ß: "ss"
|
|
50
50
|
};
|
|
51
51
|
if (!input || typeof input !== "string") return "";
|
|
52
52
|
input = input.toLowerCase();
|
|
@@ -70,7 +70,7 @@ function transformToUrl(input, replaceSlash = true) {
|
|
|
70
70
|
input = input.replace(/-+/g, "-");
|
|
71
71
|
return input;
|
|
72
72
|
}
|
|
73
|
-
const version = "0.11.
|
|
73
|
+
const version = "0.11.1";
|
|
74
74
|
const strapi$1 = { "name": "webatlas", "displayName": "Webatlas" };
|
|
75
75
|
const pluginPkg = {
|
|
76
76
|
version,
|
|
@@ -125,7 +125,9 @@ function useApi() {
|
|
|
125
125
|
const entityResults = await Promise.allSettled(
|
|
126
126
|
contentTypes.map(async (contentType) => {
|
|
127
127
|
try {
|
|
128
|
-
const { data: data2 } = await get(
|
|
128
|
+
const { data: data2 } = await get(
|
|
129
|
+
`/content-manager/collection-types/${contentType.uid}?pageSize=9999`
|
|
130
|
+
);
|
|
129
131
|
if (!data2 || !data2.results) {
|
|
130
132
|
return null;
|
|
131
133
|
}
|
|
@@ -159,14 +161,21 @@ function useApi() {
|
|
|
159
161
|
return data;
|
|
160
162
|
};
|
|
161
163
|
const getProhibitedRouteIds = async (documentId) => {
|
|
162
|
-
const { data } = await get(
|
|
164
|
+
const { data } = await get(
|
|
165
|
+
`/${PLUGIN_ID}/route/prohibitedIds/${documentId ? `${documentId}` : ""}`
|
|
166
|
+
);
|
|
163
167
|
return data;
|
|
164
168
|
};
|
|
165
|
-
const getNavigation = async ({
|
|
169
|
+
const getNavigation = async ({
|
|
170
|
+
documentId,
|
|
171
|
+
variant
|
|
172
|
+
} = {}) => {
|
|
166
173
|
const query = [];
|
|
167
174
|
if (documentId) query.push(`documentId=${documentId}`);
|
|
168
175
|
if (variant) query.push(`variant=${variant}`);
|
|
169
|
-
const { data } = await get(
|
|
176
|
+
const { data } = await get(
|
|
177
|
+
`/${PLUGIN_ID}/navigation${query.length > 0 ? `?${query.join("&")}` : ""}`
|
|
178
|
+
);
|
|
170
179
|
return data;
|
|
171
180
|
};
|
|
172
181
|
const createNavigation = async (body) => {
|
|
@@ -237,7 +246,9 @@ function usePluginConfig() {
|
|
|
237
246
|
setLoading(true);
|
|
238
247
|
setFetchError(null);
|
|
239
248
|
try {
|
|
240
|
-
const {
|
|
249
|
+
const {
|
|
250
|
+
data: { data: contentTypesArray }
|
|
251
|
+
} = await get("/content-manager/content-types");
|
|
241
252
|
let { data: config2 } = await get(`/${PLUGIN_ID}/config`);
|
|
242
253
|
if (!config2 || !config2.selectedContentTypes) {
|
|
243
254
|
throw new Error(`Couldn't fetch plugin config`);
|
|
@@ -246,7 +257,9 @@ function usePluginConfig() {
|
|
|
246
257
|
(type) => type.pluginOptions?.webatlas?.enabled === true
|
|
247
258
|
);
|
|
248
259
|
const contentTypeUids = new Set(allowedContentTypes.map((type) => type.uid));
|
|
249
|
-
const activeContentTypes = config2.selectedContentTypes.filter(
|
|
260
|
+
const activeContentTypes = config2.selectedContentTypes.filter(
|
|
261
|
+
(type) => contentTypeUids.has(type.uid)
|
|
262
|
+
);
|
|
250
263
|
const displayConfig = {
|
|
251
264
|
...config2,
|
|
252
265
|
selectedContentTypes: activeContentTypes
|
|
@@ -289,7 +302,9 @@ async function duplicateCheck({
|
|
|
289
302
|
if (!path) throw new Error("URL is required");
|
|
290
303
|
try {
|
|
291
304
|
const pathToCheck = withoutTransform ? path : transformToUrl(path);
|
|
292
|
-
const { data } = await fetchFunction(
|
|
305
|
+
const { data } = await fetchFunction(
|
|
306
|
+
`/${PLUGIN_ID}/checkUniquePath?path=${pathToCheck}${routeDocumentId ? `&targetRouteDocumentId=${routeDocumentId}` : ""}`
|
|
307
|
+
);
|
|
293
308
|
if (!data.uniquePath) {
|
|
294
309
|
throw new Error("Network response was not ok");
|
|
295
310
|
}
|
|
@@ -307,45 +322,42 @@ function PathInfo({ validationState, replacement }) {
|
|
|
307
322
|
if (validationState === "initial") return;
|
|
308
323
|
if (validationState === "checking") {
|
|
309
324
|
setColor("neutral800");
|
|
310
|
-
setText(
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
325
|
+
setText(
|
|
326
|
+
formatMessage({
|
|
327
|
+
id: getTranslation("components.pathInfo.checking"),
|
|
328
|
+
defaultMessage: "Checking if path is available..."
|
|
329
|
+
})
|
|
330
|
+
);
|
|
314
331
|
} else if (validationState === "done") {
|
|
315
332
|
setColor(replacement ? "danger500" : "success500");
|
|
316
|
-
setText(
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
333
|
+
setText(
|
|
334
|
+
replacement ? `${formatMessage({
|
|
335
|
+
id: getTranslation("components.pathInfo.notAvailable"),
|
|
336
|
+
defaultMessage: "Path is not available. Replaced with"
|
|
337
|
+
})} "${replacement}".` : formatMessage({
|
|
338
|
+
id: getTranslation("components.pathInfo.available"),
|
|
339
|
+
defaultMessage: "Path is available."
|
|
340
|
+
})
|
|
341
|
+
);
|
|
323
342
|
}
|
|
324
343
|
}, [validationState, replacement, formatMessage]);
|
|
325
344
|
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 1, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: color, children: text }) });
|
|
326
345
|
}
|
|
327
346
|
function OverrideCheckbox({ isOverride, setIsOverride, disabledCondition }) {
|
|
328
347
|
const { formatMessage } = reactIntl.useIntl();
|
|
329
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
330
|
-
designSystem.
|
|
348
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, paddingTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
349
|
+
designSystem.Checkbox,
|
|
331
350
|
{
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
disabled: disabledCondition,
|
|
341
|
-
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
342
|
-
id: getTranslation("components.CMEditViewAside.path.overrideCheckbox"),
|
|
343
|
-
defaultMessage: "Override automatic path generation"
|
|
344
|
-
}) })
|
|
345
|
-
}
|
|
346
|
-
)
|
|
351
|
+
id: "path-override-checkbox",
|
|
352
|
+
checked: isOverride,
|
|
353
|
+
onCheckedChange: () => setIsOverride(!isOverride),
|
|
354
|
+
disabled: disabledCondition,
|
|
355
|
+
children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
356
|
+
id: getTranslation("components.CMEditViewAside.path.overrideCheckbox"),
|
|
357
|
+
defaultMessage: "Override automatic path generation"
|
|
358
|
+
}) })
|
|
347
359
|
}
|
|
348
|
-
);
|
|
360
|
+
) });
|
|
349
361
|
}
|
|
350
362
|
function NewPathInfo() {
|
|
351
363
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -364,13 +376,7 @@ function UidPathDisplay({ path }) {
|
|
|
364
376
|
defaultMessage: "Permanent UID path, cannot be changed"
|
|
365
377
|
}),
|
|
366
378
|
children: [
|
|
367
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
368
|
-
designSystem.Field.Input,
|
|
369
|
-
{
|
|
370
|
-
value: path,
|
|
371
|
-
disabled: true
|
|
372
|
-
}
|
|
373
|
-
),
|
|
379
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { value: path, disabled: true }),
|
|
374
380
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
375
381
|
]
|
|
376
382
|
}
|
|
@@ -3698,10 +3704,15 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
|
3698
3704
|
id: getTranslation("components.CMEditViewAside.path.input.label"),
|
|
3699
3705
|
defaultMessage: "Path"
|
|
3700
3706
|
}),
|
|
3701
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3702
|
-
|
|
3703
|
-
|
|
3704
|
-
|
|
3707
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3708
|
+
Tooltip,
|
|
3709
|
+
{
|
|
3710
|
+
description: formatMessage({
|
|
3711
|
+
id: getTranslation("components.CMEditViewAside.path.input.tooltip"),
|
|
3712
|
+
defaultMessage: "The following characters are valid: A-Z, a-z, 0-9, /, -, _, $, ., +, !, *, ', (, )"
|
|
3713
|
+
})
|
|
3714
|
+
}
|
|
3715
|
+
)
|
|
3705
3716
|
] }),
|
|
3706
3717
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3707
3718
|
designSystem.Field.Input,
|
|
@@ -3710,7 +3721,10 @@ function PathInput({ path, dispatchPath, isOverride, config }) {
|
|
|
3710
3721
|
value: displayedPath,
|
|
3711
3722
|
onChange: (e) => dispatchPath({ type: "SET_OVERRIDEPATH", payload: e.target.value }),
|
|
3712
3723
|
disabled: !isOverride,
|
|
3713
|
-
onBlur: (e) => dispatchPath({
|
|
3724
|
+
onBlur: (e) => dispatchPath({
|
|
3725
|
+
type: "SET_OVERRIDEPATH",
|
|
3726
|
+
payload: transformToUrl(e.target.value, false)
|
|
3727
|
+
}),
|
|
3714
3728
|
style: { outline: inputBorder }
|
|
3715
3729
|
}
|
|
3716
3730
|
),
|
|
@@ -3728,7 +3742,9 @@ function RouteStructure({
|
|
|
3728
3742
|
}) {
|
|
3729
3743
|
const { formatMessage } = reactIntl.useIntl();
|
|
3730
3744
|
const filteredRoutes = React.useMemo(() => {
|
|
3731
|
-
return [...routes].sort((a, b) => a.title.localeCompare(b.title)).filter(
|
|
3745
|
+
return [...routes].sort((a, b) => a.title.localeCompare(b.title)).filter(
|
|
3746
|
+
(route) => !prohibitedRouteIds?.includes(route.documentId) || route.documentId === selectedParent?.documentId
|
|
3747
|
+
);
|
|
3732
3748
|
}, [routes, prohibitedRouteIds, selectedParent]);
|
|
3733
3749
|
const handleSelectParent = (value) => {
|
|
3734
3750
|
const parentRoute = routes.find((route) => route.documentId === value) || null;
|
|
@@ -3740,27 +3756,13 @@ function RouteStructure({
|
|
|
3740
3756
|
id: getTranslation("components.CMEditViewAside.path.input.parentSelect.label"),
|
|
3741
3757
|
defaultMessage: "Place under"
|
|
3742
3758
|
}) }),
|
|
3743
|
-
/* @__PURE__ */ jsxRuntime.jsxs(
|
|
3744
|
-
designSystem.
|
|
3745
|
-
|
|
3746
|
-
|
|
3747
|
-
|
|
3748
|
-
|
|
3749
|
-
|
|
3750
|
-
id: getTranslation("components.CMEditViewAside.path.input.parentSelect.rootPath"),
|
|
3751
|
-
defaultMessage: "None (root path)"
|
|
3752
|
-
}) }),
|
|
3753
|
-
filteredRoutes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
3754
|
-
designSystem.SingleSelectOption,
|
|
3755
|
-
{
|
|
3756
|
-
value: route.documentId,
|
|
3757
|
-
children: route.title
|
|
3758
|
-
},
|
|
3759
|
-
route.documentId
|
|
3760
|
-
))
|
|
3761
|
-
]
|
|
3762
|
-
}
|
|
3763
|
-
)
|
|
3759
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.SingleSelect, { value: selectedParent?.documentId || "", onValueChange: handleSelectParent, children: [
|
|
3760
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "", children: formatMessage({
|
|
3761
|
+
id: getTranslation("components.CMEditViewAside.path.input.parentSelect.rootPath"),
|
|
3762
|
+
defaultMessage: "None (root path)"
|
|
3763
|
+
}) }),
|
|
3764
|
+
filteredRoutes.map((route) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: route.documentId, children: route.title }, route.documentId))
|
|
3765
|
+
] })
|
|
3764
3766
|
] }),
|
|
3765
3767
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { marginTop: 4, children: [
|
|
3766
3768
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Label, { children: [
|
|
@@ -3768,19 +3770,17 @@ function RouteStructure({
|
|
|
3768
3770
|
id: getTranslation("components.CMEditViewAside.canonicalPath.input.label"),
|
|
3769
3771
|
defaultMessage: "Canonical Path"
|
|
3770
3772
|
}),
|
|
3771
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3772
|
-
|
|
3773
|
-
|
|
3774
|
-
|
|
3773
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3774
|
+
Tooltip,
|
|
3775
|
+
{
|
|
3776
|
+
description: formatMessage({
|
|
3777
|
+
id: getTranslation("components.CMEditViewAside.canonicalPath.input.tooltip"),
|
|
3778
|
+
defaultMessage: "The path determined by your content's natural hierarchy, independent of where it appears in navigation menus."
|
|
3779
|
+
})
|
|
3780
|
+
}
|
|
3781
|
+
)
|
|
3775
3782
|
] }),
|
|
3776
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
3777
|
-
designSystem.Field.Input,
|
|
3778
|
-
{
|
|
3779
|
-
id: "canonicalPath-input",
|
|
3780
|
-
value: canonicalPath,
|
|
3781
|
-
disabled: true
|
|
3782
|
-
}
|
|
3783
|
-
),
|
|
3783
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Input, { id: "canonicalPath-input", value: canonicalPath, disabled: true }),
|
|
3784
3784
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {})
|
|
3785
3785
|
] })
|
|
3786
3786
|
] });
|
|
@@ -3835,10 +3835,9 @@ const Panel = ({ config }) => {
|
|
|
3835
3835
|
const { getRelatedRoute, getAllRoutes, getProhibitedRouteIds } = useApi();
|
|
3836
3836
|
const { formatMessage } = reactIntl.useIntl();
|
|
3837
3837
|
const { get } = admin.useFetchClient();
|
|
3838
|
-
const {
|
|
3839
|
-
canUpdate,
|
|
3840
|
-
|
|
3841
|
-
} } = admin.useRBAC([
|
|
3838
|
+
const {
|
|
3839
|
+
allowedActions: { canUpdate, canCreate }
|
|
3840
|
+
} = admin.useRBAC([
|
|
3842
3841
|
{
|
|
3843
3842
|
action: "plugin::content-manager.explorer.update",
|
|
3844
3843
|
subject: model,
|
|
@@ -3877,10 +3876,14 @@ const Panel = ({ config }) => {
|
|
|
3877
3876
|
const initialSourceFieldValue = initialValues[config?.default] || "";
|
|
3878
3877
|
const latestCheckPathRef = React.useRef(checkPath);
|
|
3879
3878
|
latestCheckPathRef.current = checkPath;
|
|
3880
|
-
const debouncedCheckPath = React.useRef(
|
|
3879
|
+
const debouncedCheckPath = React.useRef(
|
|
3880
|
+
debounce((p, id) => latestCheckPathRef.current(p, id), 250)
|
|
3881
|
+
).current;
|
|
3881
3882
|
const latestCheckCanonicalRef = React.useRef(checkCanonicalPath);
|
|
3882
3883
|
latestCheckCanonicalRef.current = checkCanonicalPath;
|
|
3883
|
-
const debouncedCheckCanonicalPath = React.useRef(
|
|
3884
|
+
const debouncedCheckCanonicalPath = React.useRef(
|
|
3885
|
+
debounce((p, id) => latestCheckCanonicalRef.current(p, id), 250)
|
|
3886
|
+
).current;
|
|
3884
3887
|
React.useEffect(() => {
|
|
3885
3888
|
async function fetchAllRoutes() {
|
|
3886
3889
|
const allRoutes = await getAllRoutes();
|
|
@@ -3900,7 +3903,15 @@ const Panel = ({ config }) => {
|
|
|
3900
3903
|
if (hasUserChangedField.current || hasUserInteracted.current) {
|
|
3901
3904
|
onChange("webatlas", data);
|
|
3902
3905
|
}
|
|
3903
|
-
}, [
|
|
3906
|
+
}, [
|
|
3907
|
+
path.value,
|
|
3908
|
+
path.overridePath,
|
|
3909
|
+
isOverride,
|
|
3910
|
+
selectedParent,
|
|
3911
|
+
sourceFieldValue,
|
|
3912
|
+
hasUserChangedField,
|
|
3913
|
+
hasUserInteracted
|
|
3914
|
+
]);
|
|
3904
3915
|
React.useEffect(() => {
|
|
3905
3916
|
if (!initialLoadComplete) return;
|
|
3906
3917
|
if (sourceFieldValue !== initialSourceFieldValue) {
|
|
@@ -3922,7 +3933,14 @@ const Panel = ({ config }) => {
|
|
|
3922
3933
|
const canonicalPath = buildPath("canonical", sourceFieldValue, selectedParent);
|
|
3923
3934
|
dispatchPath({ type: "SET_CANONICALPATH", payload: canonicalPath });
|
|
3924
3935
|
debouncedCheckCanonicalPath(canonicalPath, route?.documentId || null);
|
|
3925
|
-
}, [
|
|
3936
|
+
}, [
|
|
3937
|
+
sourceFieldValue,
|
|
3938
|
+
initialSourceFieldValue,
|
|
3939
|
+
initialLoadComplete,
|
|
3940
|
+
selectedParent,
|
|
3941
|
+
isOverride,
|
|
3942
|
+
route
|
|
3943
|
+
]);
|
|
3926
3944
|
React.useEffect(() => {
|
|
3927
3945
|
if (!initialLoadComplete) return;
|
|
3928
3946
|
if (path.needsUrlCheck && path.value) {
|
|
@@ -3943,14 +3961,20 @@ const Panel = ({ config }) => {
|
|
|
3943
3961
|
try {
|
|
3944
3962
|
const route2 = await getRelatedRoute(initialValues.documentId);
|
|
3945
3963
|
if (!route2) return;
|
|
3946
|
-
initialPath.current = initialValues.
|
|
3964
|
+
initialPath.current = initialValues.webatlas.path || route2.uidPath;
|
|
3947
3965
|
setRoute(route2);
|
|
3948
3966
|
setIsOverride(route2.isOverride || false);
|
|
3949
3967
|
dispatchPath({ type: "SET_OVERRIDEPATH", payload: route2.path || "" });
|
|
3950
|
-
dispatchPath({
|
|
3968
|
+
dispatchPath({
|
|
3969
|
+
type: "NO_TRANSFORM_AND_CHECK",
|
|
3970
|
+
payload: route2.path || ""
|
|
3971
|
+
});
|
|
3951
3972
|
dispatchPath({ type: "SET_UIDPATH", payload: route2.uidPath || "" });
|
|
3952
3973
|
dispatchPath({ type: "SET_SLUG", payload: route2.slug || "" });
|
|
3953
|
-
dispatchPath({
|
|
3974
|
+
dispatchPath({
|
|
3975
|
+
type: "SET_CANONICALPATH",
|
|
3976
|
+
payload: route2.canonicalPath || ""
|
|
3977
|
+
});
|
|
3954
3978
|
const key = config?.default;
|
|
3955
3979
|
if (key) {
|
|
3956
3980
|
prevSourceValueRef.current = values[key];
|
|
@@ -3965,7 +3989,9 @@ const Panel = ({ config }) => {
|
|
|
3965
3989
|
}, [config]);
|
|
3966
3990
|
React.useEffect(() => {
|
|
3967
3991
|
if (!route || !routes.length) return;
|
|
3968
|
-
const parentRoute = routes.find(
|
|
3992
|
+
const parentRoute = routes.find(
|
|
3993
|
+
(singleRoute) => singleRoute.documentId === route.parent?.documentId
|
|
3994
|
+
);
|
|
3969
3995
|
setSelectedParent(parentRoute || null);
|
|
3970
3996
|
}, [route, routes]);
|
|
3971
3997
|
React.useEffect(() => {
|
|
@@ -3976,16 +4002,20 @@ const Panel = ({ config }) => {
|
|
|
3976
4002
|
fetchProhibitedRouteIds();
|
|
3977
4003
|
}, [route]);
|
|
3978
4004
|
React.useEffect(() => {
|
|
3979
|
-
if (!sourceFieldValue)
|
|
3980
|
-
|
|
3981
|
-
|
|
3982
|
-
|
|
3983
|
-
}
|
|
4005
|
+
if (!sourceFieldValue || isOverride || !hasUserChangedField.current && !hasUserInteracted.current)
|
|
4006
|
+
return;
|
|
4007
|
+
const newPath = buildPath("path", sourceFieldValue, selectedParent);
|
|
4008
|
+
dispatchPath({ type: "DEFAULT", payload: newPath });
|
|
3984
4009
|
}, [selectedParent, sourceFieldValue, route, isOverride]);
|
|
3985
4010
|
async function checkCanonicalPath(path2, routeDocumentId) {
|
|
3986
4011
|
if (!path2) return;
|
|
3987
4012
|
try {
|
|
3988
|
-
const result = await duplicateCheck({
|
|
4013
|
+
const result = await duplicateCheck({
|
|
4014
|
+
fetchFunction: get,
|
|
4015
|
+
path: path2,
|
|
4016
|
+
routeDocumentId,
|
|
4017
|
+
withoutTransform: true
|
|
4018
|
+
});
|
|
3989
4019
|
dispatchPath({ type: "SET_CANONICALPATH", payload: result });
|
|
3990
4020
|
} catch (err) {
|
|
3991
4021
|
strapi.log.error(err);
|
|
@@ -3996,7 +4026,12 @@ const Panel = ({ config }) => {
|
|
|
3996
4026
|
setValidationState("checking");
|
|
3997
4027
|
dispatchPath({ type: "SET_REPLACEMENT", payload: "" });
|
|
3998
4028
|
try {
|
|
3999
|
-
const data = await duplicateCheck({
|
|
4029
|
+
const data = await duplicateCheck({
|
|
4030
|
+
fetchFunction: get,
|
|
4031
|
+
path: path2,
|
|
4032
|
+
routeDocumentId,
|
|
4033
|
+
withoutTransform: true
|
|
4034
|
+
});
|
|
4000
4035
|
if (!data || data === path2) return;
|
|
4001
4036
|
dispatchPath({ type: "NO_URL_CHECK", payload: data });
|
|
4002
4037
|
dispatchPath({ type: "SET_REPLACEMENT", payload: data });
|
|
@@ -4006,79 +4041,58 @@ const Panel = ({ config }) => {
|
|
|
4006
4041
|
setValidationState("done");
|
|
4007
4042
|
}
|
|
4008
4043
|
}
|
|
4009
|
-
if (!initialLoadComplete)
|
|
4010
|
-
|
|
4011
|
-
|
|
4012
|
-
|
|
4013
|
-
|
|
4014
|
-
|
|
4015
|
-
{
|
|
4016
|
-
|
|
4017
|
-
|
|
4018
|
-
|
|
4019
|
-
|
|
4020
|
-
|
|
4044
|
+
if (!initialLoadComplete)
|
|
4045
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
4046
|
+
id: getTranslation("loading"),
|
|
4047
|
+
defaultMessage: "Loading..."
|
|
4048
|
+
}) });
|
|
4049
|
+
return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "aside", "aria-labelledby": "URL Route", width: "100%", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
4050
|
+
!route && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4051
|
+
/* @__PURE__ */ jsxRuntime.jsx(NewPathInfo, {}),
|
|
4052
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 })
|
|
4053
|
+
] }),
|
|
4054
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4055
|
+
RouteStructure,
|
|
4056
|
+
{
|
|
4057
|
+
canonicalPath: path.canonicalPath,
|
|
4058
|
+
routes,
|
|
4059
|
+
selectedParent,
|
|
4060
|
+
setSelectedParent: (val) => {
|
|
4061
|
+
hasUserInteracted.current = true;
|
|
4062
|
+
setSelectedParent(val);
|
|
4063
|
+
},
|
|
4064
|
+
prohibitedRouteIds
|
|
4065
|
+
}
|
|
4066
|
+
),
|
|
4067
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 }),
|
|
4068
|
+
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
4069
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4070
|
+
PathInput,
|
|
4021
4071
|
{
|
|
4022
|
-
|
|
4023
|
-
|
|
4024
|
-
|
|
4025
|
-
|
|
4026
|
-
!route && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4027
|
-
/* @__PURE__ */ jsxRuntime.jsx(NewPathInfo, {}),
|
|
4028
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 })
|
|
4029
|
-
] }),
|
|
4030
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4031
|
-
RouteStructure,
|
|
4032
|
-
{
|
|
4033
|
-
canonicalPath: path.canonicalPath,
|
|
4034
|
-
routes,
|
|
4035
|
-
selectedParent,
|
|
4036
|
-
setSelectedParent: (val) => {
|
|
4037
|
-
hasUserInteracted.current = true;
|
|
4038
|
-
setSelectedParent(val);
|
|
4039
|
-
},
|
|
4040
|
-
prohibitedRouteIds
|
|
4041
|
-
}
|
|
4042
|
-
),
|
|
4043
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 }),
|
|
4044
|
-
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
|
|
4045
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4046
|
-
PathInput,
|
|
4047
|
-
{
|
|
4048
|
-
path,
|
|
4049
|
-
dispatchPath,
|
|
4050
|
-
isOverride,
|
|
4051
|
-
config
|
|
4052
|
-
}
|
|
4053
|
-
),
|
|
4054
|
-
validationState !== "initial" && /* @__PURE__ */ jsxRuntime.jsx(
|
|
4055
|
-
PathInfo,
|
|
4056
|
-
{
|
|
4057
|
-
validationState,
|
|
4058
|
-
replacement: path.replacement
|
|
4059
|
-
}
|
|
4060
|
-
)
|
|
4061
|
-
] }),
|
|
4062
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4063
|
-
OverrideCheckbox,
|
|
4064
|
-
{
|
|
4065
|
-
isOverride,
|
|
4066
|
-
setIsOverride: (val) => {
|
|
4067
|
-
hasUserInteracted.current = true;
|
|
4068
|
-
setIsOverride(val);
|
|
4069
|
-
},
|
|
4070
|
-
disabledCondition: !canCreate && !canUpdate
|
|
4071
|
-
}
|
|
4072
|
-
),
|
|
4073
|
-
path.uidPath && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4074
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 }),
|
|
4075
|
-
/* @__PURE__ */ jsxRuntime.jsx(UidPathDisplay, { path: path.uidPath })
|
|
4076
|
-
] })
|
|
4077
|
-
]
|
|
4072
|
+
path,
|
|
4073
|
+
dispatchPath,
|
|
4074
|
+
isOverride,
|
|
4075
|
+
config
|
|
4078
4076
|
}
|
|
4079
|
-
)
|
|
4080
|
-
|
|
4081
|
-
|
|
4077
|
+
),
|
|
4078
|
+
validationState !== "initial" && /* @__PURE__ */ jsxRuntime.jsx(PathInfo, { validationState, replacement: path.replacement })
|
|
4079
|
+
] }),
|
|
4080
|
+
/* @__PURE__ */ jsxRuntime.jsx(
|
|
4081
|
+
OverrideCheckbox,
|
|
4082
|
+
{
|
|
4083
|
+
isOverride,
|
|
4084
|
+
setIsOverride: (val) => {
|
|
4085
|
+
hasUserInteracted.current = true;
|
|
4086
|
+
setIsOverride(val);
|
|
4087
|
+
},
|
|
4088
|
+
disabledCondition: !canCreate && !canUpdate
|
|
4089
|
+
}
|
|
4090
|
+
),
|
|
4091
|
+
path.uidPath && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
4092
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { marginTop: 2, marginBottom: 2 }),
|
|
4093
|
+
/* @__PURE__ */ jsxRuntime.jsx(UidPathDisplay, { path: path.uidPath })
|
|
4094
|
+
] })
|
|
4095
|
+
] }) });
|
|
4082
4096
|
};
|
|
4083
4097
|
const pluginPermissions = {
|
|
4084
4098
|
"cm.aside": [{ action: `plugin::${PLUGIN_ID}.cm.aside`, subject: null }],
|
|
@@ -4087,7 +4101,7 @@ const pluginPermissions = {
|
|
|
4087
4101
|
"settings.general": [{ action: `plugin::${PLUGIN_ID}.settings.general`, subject: null }],
|
|
4088
4102
|
"settings.navigation": [{ action: `plugin::${PLUGIN_ID}.settings.navigation`, subject: null }]
|
|
4089
4103
|
};
|
|
4090
|
-
const CMEditViewAside = ({ documentId, model }) => {
|
|
4104
|
+
const CMEditViewAside = ({ documentId, model, activeTab }) => {
|
|
4091
4105
|
const { contentTypes } = useAllContentTypes();
|
|
4092
4106
|
const { config } = usePluginConfig();
|
|
4093
4107
|
const { formatMessage } = reactIntl.useIntl();
|
|
@@ -4110,7 +4124,9 @@ const CMEditViewAside = ({ documentId, model }) => {
|
|
|
4110
4124
|
const parent = container?.parentElement;
|
|
4111
4125
|
const greatGrandParent = parent?.parentElement?.parentElement;
|
|
4112
4126
|
if (!container || !parent) return;
|
|
4113
|
-
const parentWebatlasCount = Array.from(parent.querySelectorAll("label")).filter(
|
|
4127
|
+
const parentWebatlasCount = Array.from(parent.querySelectorAll("label")).filter(
|
|
4128
|
+
isWebatlasLabel
|
|
4129
|
+
).length;
|
|
4114
4130
|
const childrenCount = parent.children.length;
|
|
4115
4131
|
if (greatGrandParent && greatGrandParent?.querySelectorAll("label").length === Array.from(greatGrandParent.querySelectorAll("label")).filter(isWebatlasLabel).length) {
|
|
4116
4132
|
greatGrandParent.remove();
|
|
@@ -4127,7 +4143,7 @@ const CMEditViewAside = ({ documentId, model }) => {
|
|
|
4127
4143
|
return () => clearTimeout(secondTimeoutId);
|
|
4128
4144
|
}, 100);
|
|
4129
4145
|
return () => clearTimeout(timeoutId);
|
|
4130
|
-
}, [documentId, model]);
|
|
4146
|
+
}, [documentId, model, activeTab]);
|
|
4131
4147
|
React.useEffect(() => {
|
|
4132
4148
|
if (!config) return;
|
|
4133
4149
|
setIsActiveContentType(false);
|
|
@@ -4150,13 +4166,14 @@ const CMEditViewAside = ({ documentId, model }) => {
|
|
|
4150
4166
|
strapi.log.error("CMEditViewAside: Plugin is not configured.");
|
|
4151
4167
|
return null;
|
|
4152
4168
|
}
|
|
4153
|
-
if (isLoading)
|
|
4154
|
-
|
|
4155
|
-
|
|
4156
|
-
|
|
4157
|
-
|
|
4158
|
-
|
|
4159
|
-
|
|
4169
|
+
if (isLoading)
|
|
4170
|
+
return {
|
|
4171
|
+
title: panelTitle,
|
|
4172
|
+
content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage({
|
|
4173
|
+
id: getTranslation("loading"),
|
|
4174
|
+
defaultMessage: "Loading..."
|
|
4175
|
+
}) })
|
|
4176
|
+
};
|
|
4160
4177
|
return {
|
|
4161
4178
|
title: panelTitle,
|
|
4162
4179
|
content: /* @__PURE__ */ jsxRuntime.jsx(Panel, { config: contentTypeConfig })
|
|
@@ -4171,10 +4188,8 @@ const index = {
|
|
|
4171
4188
|
id: `${PLUGIN_ID}.link.paths`,
|
|
4172
4189
|
defaultMessage: "Paths"
|
|
4173
4190
|
},
|
|
4174
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4175
|
-
permissions: [
|
|
4176
|
-
pluginPermissions["page.routes"][0]
|
|
4177
|
-
]
|
|
4191
|
+
Component: () => Promise.resolve().then(() => require("./index-BEVoxEAm.js")),
|
|
4192
|
+
permissions: [pluginPermissions["page.routes"][0]]
|
|
4178
4193
|
});
|
|
4179
4194
|
app.addMenuLink({
|
|
4180
4195
|
to: `plugins/${PLUGIN_ID}/navigation`,
|
|
@@ -4183,10 +4198,8 @@ const index = {
|
|
|
4183
4198
|
id: `${PLUGIN_ID}.link.navigation`,
|
|
4184
4199
|
defaultMessage: "Navigation"
|
|
4185
4200
|
},
|
|
4186
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4187
|
-
permissions: [
|
|
4188
|
-
pluginPermissions["page.navigation"][0]
|
|
4189
|
-
]
|
|
4201
|
+
Component: () => Promise.resolve().then(() => require("./index-C8YjuuOx.js")),
|
|
4202
|
+
permissions: [pluginPermissions["page.navigation"][0]]
|
|
4190
4203
|
});
|
|
4191
4204
|
app.addSettingsLink(
|
|
4192
4205
|
{
|
|
@@ -4203,27 +4216,20 @@ const index = {
|
|
|
4203
4216
|
},
|
|
4204
4217
|
id: `${PLUGIN_ID}-general`,
|
|
4205
4218
|
to: `${PLUGIN_ID}/general`,
|
|
4206
|
-
Component: () => Promise.resolve().then(() => require("./index-
|
|
4207
|
-
permissions: [
|
|
4208
|
-
pluginPermissions["settings.general"][0]
|
|
4209
|
-
]
|
|
4210
|
-
}
|
|
4211
|
-
);
|
|
4212
|
-
app.addSettingsLink(
|
|
4213
|
-
PLUGIN_ID,
|
|
4214
|
-
{
|
|
4215
|
-
intlLabel: {
|
|
4216
|
-
id: `${PLUGIN_ID}.settings.navigation`,
|
|
4217
|
-
defaultMessage: "Navigation"
|
|
4218
|
-
},
|
|
4219
|
-
id: `${PLUGIN_ID}-navigation`,
|
|
4220
|
-
to: `${PLUGIN_ID}/navigation`,
|
|
4221
|
-
Component: () => Promise.resolve().then(() => require("./index-D8bG0YFB.js")),
|
|
4222
|
-
permissions: [
|
|
4223
|
-
pluginPermissions["settings.navigation"][0]
|
|
4224
|
-
]
|
|
4219
|
+
Component: () => Promise.resolve().then(() => require("./index-YdWxpvOH.js")),
|
|
4220
|
+
permissions: [pluginPermissions["settings.general"][0]]
|
|
4225
4221
|
}
|
|
4226
4222
|
);
|
|
4223
|
+
app.addSettingsLink(PLUGIN_ID, {
|
|
4224
|
+
intlLabel: {
|
|
4225
|
+
id: `${PLUGIN_ID}.settings.navigation`,
|
|
4226
|
+
defaultMessage: "Navigation"
|
|
4227
|
+
},
|
|
4228
|
+
id: `${PLUGIN_ID}-navigation`,
|
|
4229
|
+
to: `${PLUGIN_ID}/navigation`,
|
|
4230
|
+
Component: () => Promise.resolve().then(() => require("./index-D2hB1vTw.js")),
|
|
4231
|
+
permissions: [pluginPermissions["settings.navigation"][0]]
|
|
4232
|
+
});
|
|
4227
4233
|
app.registerPlugin({
|
|
4228
4234
|
id: PLUGIN_ID,
|
|
4229
4235
|
initializer: Initializer,
|
|
@@ -4260,4 +4266,3 @@ exports.pluginPermissions = pluginPermissions;
|
|
|
4260
4266
|
exports.useAllContentTypes = useAllContentTypes;
|
|
4261
4267
|
exports.useApi = useApi;
|
|
4262
4268
|
exports.usePluginConfig = usePluginConfig;
|
|
4263
|
-
//# sourceMappingURL=index-Yq-QR8t0.js.map
|